diff --git a/build/jam/board/raspberry_pi/BoardSetup b/build/jam/board/raspberry_pi/BoardSetup index 795172fb58..5ecce07b70 100644 --- a/build/jam/board/raspberry_pi/BoardSetup +++ b/build/jam/board/raspberry_pi/BoardSetup @@ -56,9 +56,6 @@ fi" ; HAIKU_BOARD_SDIMAGE_FILES = haiku_loader - haiku_loader.ub - haiku_loader_nbsd.ub - $(HAIKU_BOARD_SDIMAGE_UBOOT_SCRIPT_NAME) ; diff --git a/build/jam/board/raspberry_pi/first32k.bin b/build/jam/board/raspberry_pi/first32k.bin new file mode 100644 index 0000000000..ebf74be8a1 Binary files /dev/null and b/build/jam/board/raspberry_pi/first32k.bin differ diff --git a/src/system/boot/platform/raspberrypi_arm/Jamfile b/src/system/boot/platform/raspberrypi_arm/Jamfile index b854c2b452..13094f770c 100644 --- a/src/system/boot/platform/raspberrypi_arm/Jamfile +++ b/src/system/boot/platform/raspberrypi_arm/Jamfile @@ -30,6 +30,7 @@ KernelMergeObject boot_platform_raspberrypi_arm.o : cpu.cpp debug.cpp devices.cpp + gpio.cpp keyboard.cpp menu.cpp mmu.cpp diff --git a/src/system/boot/platform/raspberrypi_arm/gpio.cpp b/src/system/boot/platform/raspberrypi_arm/gpio.cpp new file mode 100644 index 0000000000..daba364a00 --- /dev/null +++ b/src/system/boot/platform/raspberrypi_arm/gpio.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ + + +#include "gpio.h" + + +void +gpio_init() +{ + // Set up pointer to Raspberry Pi GPIO base + gGPIOBase = (volatile unsigned *)GPIO_BASE; + + // Take control of general use pins, status led, uart + int pin = 0; + for (pin = 14; pin <= 25; pin++) { + GPIO_IN(pin); + GPIO_OUT(pin); + } +} diff --git a/src/system/boot/platform/raspberrypi_arm/gpio.h b/src/system/boot/platform/raspberrypi_arm/gpio.h new file mode 100644 index 0000000000..da0f95233f --- /dev/null +++ b/src/system/boot/platform/raspberrypi_arm/gpio.h @@ -0,0 +1,38 @@ +/* + * Copyright 2011-2012 Haiku, Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Alexander von Gluck, kallisti5@unixzen.com + */ +#ifndef _SYSTEM_BOOT_PLATFORM_PI_GPIO_H +#define _SYSTEM_BOOT_PLATFORM_PI_GPIO_H + + +#include + + +// Macros for easy GPIO pin access in loader +#define GPIO_IN(g) *(gGPIOBase + ((g)/10)) &= ~(7<<(((g)%10)*3)) +#define GPIO_OUT(g) *(gGPIOBase + ((g)/10)) |= (1<<(((g)%10)*3)) +#define GPIO_SET(g) *(gGPIOBase + 7) = (1< #include @@ -33,6 +34,9 @@ extern int main(stage2_args *args); void _start(void); +volatile unsigned *gGPIOBase; + + static void clear_bss(void) { @@ -104,6 +108,11 @@ pi_start(void) call_ctors(); cpu_init(); + gpio_init(); + + // Flick on "OK" led + GPIO_CLR(16); + mmu_init(); serial_init(); console_init();