Changeset 8f9d70b in mainline


Ignore:
Timestamp:
2013-03-24T14:55:36Z (11 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

Files:
6 added
14 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    r119b46e r8f9d70b  
    6666@ "beagleboardxm" BeagleBoard-xM
    6767@ "beaglebone" BeagleBone
     68@ "raspberrypi" Raspberry Pi
    6869! [PLATFORM=arm32] MACHINE (choice)
    6970
     
    99100! [PLATFORM=arm32&MACHINE=integratorcp] PROCESSOR (choice)
    100101
     102% CPU type
     103@ "arm1176" ARM1176
     104! [PLATFORM=arm32&MACHINE=raspberrypi] PROCESSOR (choice)
    101105
    102106# Add more ARMv4 CPUs
     
    109113@ "armv5" ARMv5
    110114! [PLATFORM=arm32&(PROCESSOR=arm926ej_s)] PROCESSOR_ARCH (choice)
     115
     116# Add more ARMv6 CPUs
     117% CPU arch
     118@ "armv6" ARMv6
     119! [PLATFORM=arm32&(PROCESSOR=arm1176)] PROCESSOR_ARCH (choice)
    111120
    112121# Add more ARMv7-A CPUs
     
    447456% Output device class
    448457@ "generic" Monitor or serial line
    449 ! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp|MACHINE=beagleboardxm|MACHINE=beaglebone)] CONFIG_HID_OUT (choice)
     458! [PLATFORM=arm32&(MACHINE=gta02|MACHINE=integratorcp|MACHINE=beagleboardxm|MACHINE=beaglebone|MACHINE=raspberrypi)] CONFIG_HID_OUT (choice)
    450459
    451460% Output device class
     
    481490! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=integratorcp] CONFIG_ARM926_UART (y/n)
    482491
     492% Support for BCM2835 on-chip UART
     493! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=raspberrypi] CONFIG_BCM2835_UART (y/n)
     494
    483495% Support for Samsung S3C24XX on-chip UART
    484496! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n)
     
    515527
    516528% Serial line input module
    517 ! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_ARM926_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_AM335X_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_AMDM37X_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)] CONFIG_SRLN (y)
     529! [CONFIG_DSRLNIN=y|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_ARM926_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_AM335X_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_AMDM37X_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_BCM2835_UART=y)] CONFIG_SRLN (y)
    518530
    519531% EGA support
  • boot/arch/arm32/Makefile.inc

    r119b46e r8f9d70b  
    4343endif
    4444
     45ifeq ($(MACHINE), raspberrypi)
     46        BOOT_OUTPUT = image.boot
     47        POST_OUTPUT = $(ROOT_PATH)/uImage.bin   
     48        LADDR = 0x00008000
     49        SADDR = 0x00008000
     50        POSTBUILD = Makefile.uboot           
     51endif
     52
    4553BFD_NAME = elf32-littlearm
    4654BFD_OUTPUT = $(BFD_NAME)
  • boot/arch/arm32/include/arch.h

    r119b46e r8f9d70b  
    4646#elif defined MACHINE_beaglebone
    4747#define BOOT_BASE       0x80000000
     48#elif defined MACHINE_raspberrypi
     49#define BOOT_BASE       0x00008000
    4850#else
    4951#define BOOT_BASE       0x00000000
  • boot/arch/arm32/include/main.h

    r119b46e r8f9d70b  
    7575#define ICP_SCONS_ADDR          0x16000000
    7676
     77/** Raspberry PI serial console registers */
     78#define BCM2835_UART0_BASE      0x20201000
     79#define BCM2835_UART0_DR        (BCM2835_UART0_BASE + 0x00)
     80#define BCM2835_UART0_FR        (BCM2835_UART0_BASE + 0x18)
     81#define BCM2835_UART0_ILPR      (BCM2835_UART0_BASE + 0x20)
     82#define BCM2835_UART0_IBRD      (BCM2835_UART0_BASE + 0x24)
     83#define BCM2835_UART0_FBRD      (BCM2835_UART0_BASE + 0x28)
     84#define BCM2835_UART0_LCRH      (BCM2835_UART0_BASE + 0x2C)
     85#define BCM2835_UART0_CR        (BCM2835_UART0_BASE + 0x30)
     86#define BCM2835_UART0_ICR       (BCM2835_UART0_BASE + 0x44)
     87
     88#define BCM2835_UART0_FR_TXFF   (1 << 5)
     89#define BCM2835_UART0_LCRH_FEN  (1 << 4)
     90#define BCM2835_UART0_LCRH_WL8  ((1 << 5) | (1 << 6))
     91#define BCM2835_UART0_CR_UARTEN (1 << 0)
     92#define BCM2835_UART0_CR_TXE    (1 << 8)
     93#define BCM2835_UART0_CR_RXE    (1 << 9)
     94
     95
     96
    7797extern void bootstrap(void);
    7898
  • boot/arch/arm32/include/mm.h

    r119b46e r8f9d70b  
    6868#define AM335x_RAM_END     0xC0000000
    6969
     70/** Start of ram memory on BCM2835 */
     71#define BCM2835_RAM_START   0
     72/** End of ram memory on BCM2835 */
     73#define BCM2835_RAM_END     0x20000000
    7074
    7175/* Page table level 0 entry - "section" format is used
  • 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}
  • kernel/arch/arm32/Makefile.inc

    r119b46e r8f9d70b  
    8989endif
    9090
     91ifeq ($(MACHINE),raspberrypi)
     92        ARCH_SOURCES += arch/$(KARCH)/src/mach/raspberrypi/raspberrypi.c
     93endif
     94
    9195ifeq ($(CONFIG_PL050),y)
    9296        ARCH_SOURCES += genarch/src/drivers/pl050/pl050.c
  • kernel/arch/arm32/_link.ld.in

    r119b46e r8f9d70b  
    1313#elif defined MACHINE_beaglebone
    1414#define KERNEL_LOAD_ADDRESS 0x80a00000
     15#elif defined MACHINE_raspberrypi
     16#define KERNEL_LOAD_ADDRESS 0x80a08000
    1517#else
    1618#define KERNEL_LOAD_ADDRESS 0x80a00000
  • kernel/arch/arm32/include/arch/cp15.h

    r119b46e r8f9d70b  
    223223        SCTLR_FAST_IRQ_EN_FLAG       = 1 << 21, /* Disable impl. specific feat*/
    224224        SCTLR_UNALIGNED_EN_FLAG      = 1 << 22, /* Must be 1 on armv7 */
     225        SCTLR_EXTENDED_PT_EN_FLAG    = 1 << 23,
    225226        SCTLR_IRQ_VECTORS_EN_FLAG    = 1 << 24,
    226227        SCTLR_BIG_ENDIAN_EXC_FLAG    = 1 << 25,
  • kernel/arch/arm32/include/arch/mm/frame.h

    r119b46e r8f9d70b  
    6161#define BOOT_PAGE_TABLE_ADDRESS  0x80008000
    6262
     63#elif defined MACHINE_raspberrypi
     64
     65#define PHYSMEM_START_ADDR       0x00000000
     66#define BOOT_PAGE_TABLE_ADDRESS  0x00010000
     67
    6368#else
    6469
  • kernel/arch/arm32/src/machine_func.c

    r119b46e r8f9d70b  
    4343#include <arch/mach/beagleboardxm/beagleboardxm.h>
    4444#include <arch/mach/beaglebone/beaglebone.h>
     45#include <arch/mach/raspberrypi/raspberrypi.h>
    4546
    4647/** Pointer to machine_ops structure being used. */
     
    5859#elif defined(MACHINE_beaglebone)
    5960        machine_ops = &bbone_machine_ops;
     61#elif defined(MACHINE_raspberrypi)
     62        machine_ops = &raspberrypi_machine_ops;
    6063#else
    6164#error Machine type not defined.
  • kernel/arch/arm32/src/mm/page.c

    r119b46e r8f9d70b  
    5555        page_mapping_operations = &pt_mapping_operations;
    5656
     57#ifdef PROCESSOR_ARCH_armv6
     58        /* Select ARMv6 and ARMv7 memory model */
     59        SCTLR_write(SCTLR_read() | SCTLR_EXTENDED_PT_EN_FLAG);
     60#endif
    5761        page_table_lock(AS_KERNEL, true);
    5862       
  • kernel/genarch/Makefile.inc

    r119b46e r8f9d70b  
    9696endif
    9797
     98ifeq ($(CONFIG_BCM2835_UART),y)
     99        GENARCH_SOURCES += \
     100                genarch/src/drivers/bcm2835/pl011_uart.c
     101endif
     102
    98103ifeq ($(CONFIG_S3C24XX_IRQC),y)
    99104        GENARCH_SOURCES += \
Note: See TracChangeset for help on using the changeset viewer.