Changeset 8f9d70b in mainline for boot/arch/arm32/src


Ignore:
Timestamp:
2013-03-24T14:55:36Z (12 years ago)
Author:
Beniamino Galvani <b.galvani@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0dfa93b0
Parents:
119b46e
Message:

Initial support for Raspberry Pi

Location:
boot/arch/arm32/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • boot/arch/arm32/src/mm.c

    r119b46e r8f9d70b  
    7575        if (address >= AM335x_RAM_START && address < AM335x_RAM_END)
    7676                return 1;
     77#elif defined MACHINE_raspberrypi
     78        const unsigned long address = section << PTE_SECTION_SHIFT;
     79        if (address < BCM2835_RAM_END)
     80                return 1;
    7781#endif
    7882        return 0;
     
    113117static void init_boot_pt(void)
    114118{
     119#if defined MACHINE_raspberrypi
     120        const pfn_t split_page = 2048;
     121#else
    115122        const pfn_t split_page = PTL0_ENTRIES;
     123#endif
     124
    116125        /* Create 1:1 virtual-physical mapping (in lower 2 GB). */
    117126        pfn_t page;
    118127        for (page = 0; page < split_page; page++)
    119128                init_ptl0_section(&boot_pt[page], page);
    120        
     129
     130#if defined MACHINE_raspberrypi
     131        for (; page < PTL0_ENTRIES; page++)
     132                init_ptl0_section(&boot_pt[page], page - split_page);
     133#endif 
    121134        asm volatile (
    122135                "mcr p15, 0, %[pt], c2, c0, 0\n"
  • boot/arch/arm32/src/putchar.c

    r119b46e r8f9d70b  
    122122#endif
    123123
     124#ifdef MACHINE_raspberrypi
     125
     126static int raspi_init;
     127
     128static inline void write32(uint32_t addr, uint32_t data)
     129{
     130        *(volatile uint32_t *)(addr) = data;
     131}
     132
     133static inline uint32_t read32(uint32_t addr)
     134{
     135        return *(volatile uint32_t *)(addr);
     136}
     137
     138static void scons_init_raspi(void)
     139{
     140        write32(BCM2835_UART0_CR, 0x0);         /* Disable UART */
     141        write32(BCM2835_UART0_ICR, 0x7f);       /* Clear interrupts */
     142        write32(BCM2835_UART0_IBRD, 1);         /* Set integer baud rate */
     143        write32(BCM2835_UART0_FBRD, 40);        /* Set fractional baud rate */
     144        write32(BCM2835_UART0_LCRH,
     145                BCM2835_UART0_LCRH_FEN |        /* Enable FIFOs */
     146                BCM2835_UART0_LCRH_WL8);        /* Word length: 8 */
     147        write32(BCM2835_UART0_CR,
     148                BCM2835_UART0_CR_UARTEN |       /* Enable UART */
     149                BCM2835_UART0_CR_TXE |          /* Enable TX */
     150                BCM2835_UART0_CR_RXE);          /* Enable RX */
     151}
     152
     153static void scons_sendb_raspi(uint8_t byte)
     154{
     155        if (!raspi_init) {
     156                scons_init_raspi();
     157                raspi_init = 1;
     158        }
     159
     160        while (read32(BCM2835_UART0_FR) & BCM2835_UART0_FR_TXFF);
     161
     162        write32(BCM2835_UART0_DR, byte);
     163}
     164#endif
     165
    124166/** Send a byte to the serial console.
    125167 *
     
    139181#ifdef MACHINE_integratorcp
    140182        scons_sendb_icp(byte);
     183#endif
     184#ifdef MACHINE_raspberrypi
     185        scons_sendb_raspi(byte);
    141186#endif
    142187}
Note: See TracChangeset for help on using the changeset viewer.