[haiku-commits] haiku: hrev44119 - build/jam/board/raspberry_pi src/system/kernel/arch/arm

  • From: kallisti5@xxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 6 May 2012 19:07:21 +0200 (CEST)

hrev44119 adds 2 changesets to branch 'master'
old head: 52a5878b742ba845b2fb9b6fe618ee40076e1684
new head: 19b42424c652a6557a21ecdf655256ed2cd95a5b

----------------------------------------------------------------------------

79a9f64: arm uart: Cleanup serial port setup.
  
  * Be a little more discreet on how we
    configure the serial port.

19b4242: rpi: Remove need for first32k.bin
  
  * Thanks go out to Simon Arlott for replacing
    the first32k.bin blob with assembly removing
    the need for first32k.bin hack.
  * This assembly is a modified version removing
    the Linux kernel boot args.
  * haiku_loader renamed to kernel.img will boot
    on Raspberry Pi directly.

                          [ Alexander von Gluck IV <kallisti5@xxxxxxxxxxx> ]

----------------------------------------------------------------------------

3 files changed, 39 insertions(+), 19 deletions(-)
build/jam/board/raspberry_pi/first32k.bin        |  Bin 32768 -> 0 bytes
src/system/boot/platform/raspberrypi_arm/entry.S |   19 ++++++++-
src/system/kernel/arch/arm/uart.cpp              |   39 ++++++++++--------

############################################################################

Commit:      79a9f645ba3fab39b3175683d6da44a1ed5f6b98
URL:         http://cgit.haiku-os.org/haiku/commit/?id=79a9f64
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Sun May  6 16:36:46 2012 UTC

arm uart: Cleanup serial port setup.

* Be a little more discreet on how we
  configure the serial port.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/arch/arm/uart.cpp 
b/src/system/kernel/arch/arm/uart.cpp
index cc383f3..8d4ec4d 100644
--- a/src/system/kernel/arch/arm/uart.cpp
+++ b/src/system/kernel/arch/arm/uart.cpp
@@ -91,10 +91,6 @@ static inline unsigned char read_uart_reg(int port, uint reg)
 #define LSR_TEMT       0x40    /* Xmitter empty */
 #define LSR_ERR                0x80    /* Error */
 
-#define LCRVAL LCR_8N1                         /* 8 data, 1 stop, no parity */
-#define MCRVAL (MCR_DTR | MCR_RTS)     /* RTS/DTR */
-#define FCRVAL (FCR_FIFO_EN | FCR_RXSR | FCR_TXSR) /* Clear & enable FIFOs */
-
 
 int uart_debug_port(void)
 {
@@ -104,26 +100,36 @@ int uart_debug_port(void)
 
 void uart_init_port(int port, uint baud)
 {
-       /* clear the tx & rx fifo and disable */
-       uint16 baud_divisor = (BOARD_UART_CLOCK / 16 / baud);
+       uint16 baudDivisor = BOARD_UART_CLOCK / (16 * baud);
 
+       // Write standard uart settings
+       write_uart_reg(port, UART_LCR, LCR_8N1);
+               // 8N1
        write_uart_reg(port, UART_IER, 0);
-       write_uart_reg(port, UART_LCR, LCR_BKSE | LCRVAL); // config mode A
-       write_uart_reg(port, UART_DLL, baud_divisor & 0xff);
-       write_uart_reg(port, UART_DLH, (baud_divisor >> 8) & 0xff);
-       write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
-       write_uart_reg(port, UART_MCR, MCRVAL);
-       write_uart_reg(port, UART_FCR, FCRVAL);
-       write_uart_reg(port, UART_MDR1, 0); // UART 16x mode
-
+               // Disable interrupt
+       write_uart_reg(port, UART_FCR, 0);
+               // Disable FIFO
+       write_uart_reg(port, UART_MCR, MCR_DTR | MCR_RTS);
+               // DTR / RTS
+
+       // Gain access to, and program baud divisor
+       unsigned char buffer = read_uart_reg(port, UART_LCR);
+       write_uart_reg(port, UART_LCR, buffer | LCR_BKSE);
+       write_uart_reg(port, UART_DLL, baudDivisor & 0xff);
+       write_uart_reg(port, UART_DLH, (baudDivisor >> 8) & 0xff);
+       write_uart_reg(port, UART_LCR, buffer & ~LCR_BKSE);
+
+//     write_uart_reg(port, UART_MDR1, 0); // UART 16x mode
 //     write_uart_reg(port, UART_LCR, 0xBF); // config mode B
 //     write_uart_reg(port, UART_EFR, (1<<7)|(1<<6)); // hw flow control
-//     write_uart_reg(port, UART_LCR, LCRVAL); // operational mode
+//     write_uart_reg(port, UART_LCR, LCR_8N1); // operational mode
 }
 
 
 void uart_init_early(void)
 {
+       // Perform special hardware UART configuration
+
        #if BOARD_CPU_OMAP3
        /* UART1 */
        RMWREG32(CM_FCLKEN1_CORE, 13, 1, 1);
@@ -139,13 +145,12 @@ void uart_init_early(void)
        #else
        #warning INTITIALIZE UART!!!!!
        #endif
-
-       uart_init_port(DEBUG_UART, 115200);
 }
 
 
 void uart_init(void)
 {
+       uart_init_port(uart_debug_port(), 115200);
 }
 
 

############################################################################

Revision:    hrev44119
Commit:      19b42424c652a6557a21ecdf655256ed2cd95a5b
URL:         http://cgit.haiku-os.org/haiku/commit/?id=19b4242
Author:      Alexander von Gluck IV <kallisti5@xxxxxxxxxxx>
Date:        Sun May  6 17:04:47 2012 UTC

rpi: Remove need for first32k.bin

* Thanks go out to Simon Arlott for replacing
  the first32k.bin blob with assembly removing
  the need for first32k.bin hack.
* This assembly is a modified version removing
  the Linux kernel boot args.
* haiku_loader renamed to kernel.img will boot
  on Raspberry Pi directly.

----------------------------------------------------------------------------

diff --git a/build/jam/board/raspberry_pi/first32k.bin 
b/build/jam/board/raspberry_pi/first32k.bin
deleted file mode 100644
index ebf74be..0000000
Binary files a/build/jam/board/raspberry_pi/first32k.bin and /dev/null differ
diff --git a/src/system/boot/platform/raspberrypi_arm/entry.S 
b/src/system/boot/platform/raspberrypi_arm/entry.S
index 4d48aeb..8e83693 100644
--- a/src/system/boot/platform/raspberrypi_arm/entry.S
+++ b/src/system/boot/platform/raspberrypi_arm/entry.S
@@ -1,9 +1,24 @@
 .globl _start
 _start:
+       b boot
 
+.balign 0x20
+boot:
+       mov r0, #0
+       @ Machine ID 3138 (0xC42)
+       mov r1, #66
+       orr r1, r1, #3072
+
+       ldr pc, kern_addr
+
+kern_addr:
+       .word kern
+
+.balign 0x8000, 0
+kern:
        /* Set up 1MB C Stack Space */
        mov sp, #0x100000
+       mov r4, #0
 
-       mov r4,#0
-       /* Start loader */
+       /* Start Haiku loader */
        b pi_start


Other related posts: