mirror of
https://github.com/drasko/codezero.git
synced 2026-01-19 14:23:15 +01:00
Kernel updates since December 2009
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_IRQ_H__
|
||||
#define __PLATFORM_IRQ_H__
|
||||
|
||||
/* TODO: Not sure about this, need to check */
|
||||
#define IRQ_CHIPS_MAX 4
|
||||
#define IRQS_MAX 96
|
||||
/* Actually there are 4 GIC's on the EB, only 2 are used for tile site 1 */
|
||||
#define IRQ_CHIPS_MAX 2
|
||||
|
||||
#if defined(CONFIG_CPU_ARM11MPCORE) || defined (CONFIG_CPU_CORTEXA9)
|
||||
#define IRQS_MAX 64
|
||||
#else
|
||||
#define IRQS_MAX 96
|
||||
#endif
|
||||
|
||||
/*
|
||||
* IRQ indices,
|
||||
* GIC 0 and 1 are for logic tile 1
|
||||
* GIC 2 and 3 are for logic tile 2
|
||||
*/
|
||||
#define IRQ_TIMER01 4
|
||||
#define IRQ_TIMER23 5
|
||||
#define IRQ_RTC 10
|
||||
#define IRQ_UART0 12
|
||||
#define IRQ_UART1 13
|
||||
#define IRQ_UART2 14
|
||||
#define IRQ_UART3 15
|
||||
|
||||
/*
|
||||
* TODO: Seems like GIC0 and GIC1 are cascaded for logic tile1
|
||||
* and GIC2 and GIC3 are cascaded for logic tile 2.
|
||||
* Interrupt Distribution:
|
||||
* 0-31: Used as SI provided by distributed interrupt controller
|
||||
* 32-63: Externel Peripheral Interrupts
|
||||
@@ -28,4 +22,57 @@
|
||||
* 72-79: Interrupts from tile site 2
|
||||
* 80-95: PCI and reserved Interrupts
|
||||
*/
|
||||
#define EB_GIC_IRQ_OFFSET 32
|
||||
#define EB_IRQ_WATCHDOG (EB_GIC_IRQ_OFFSET + 0)
|
||||
#define EB_IRQ_SOFTINT (EB_GIC_IRQ_OFFSET + 1)
|
||||
#define EB_IRQ_COMRX (EB_GIC_IRQ_OFFSET + 2)
|
||||
#define EB_IRQ_COMTX (EB_GIC_IRQ_OFFSET + 3)
|
||||
#define EB_IRQ_TIMER01 (EB_GIC_IRQ_OFFSET + 4)
|
||||
#define EB_IRQ_TIMER23 (EB_GIC_IRQ_OFFSET + 5)
|
||||
#define EB_IRQ_GPIO0 (EB_GIC_IRQ_OFFSET + 6)
|
||||
#define EB_IRQ_GPIO1 (EB_GIC_IRQ_OFFSET + 7)
|
||||
#define EB_IRQ_GPIO2 (EB_GIC_IRQ_OFFSET + 8)
|
||||
|
||||
#define EB_IRQ_RTC (EB_GIC_IRQ_OFFSET + 10)
|
||||
#define EB_IRQ_UART0 (EB_GIC_IRQ_OFFSET + 12)
|
||||
#define EB_IRQ_UART1 (EB_GIC_IRQ_OFFSET + 13)
|
||||
#define EB_IRQ_UART2 (EB_GIC_IRQ_OFFSET + 14)
|
||||
#define EB_IRQ_UART3 (EB_GIC_IRQ_OFFSET + 15)
|
||||
#define EB_IRQ_SCI (EB_GIC_IRQ_OFFSET + 16) /* Smart Card Interface */
|
||||
#define EB_IRQ_MCI0 (EB_GIC_IRQ_OFFSET + 17)
|
||||
#define EB_IRQ_MCI1 (EB_GIC_IRQ_OFFSET + 18)
|
||||
#define EB_IRQ_AACI (EB_GIC_IRQ_OFFSET + 19) /* Advanced Audio codec */
|
||||
#define EB_IRQ_KMI0 (EB_GIC_IRQ_OFFSET + 20) /* Keyboard */
|
||||
#define EB_IRQ_KMI1 (EB_GIC_IRQ_OFFSET + 21) /* Mouse */
|
||||
#define EB_IRQ_LCD (EB_GIC_IRQ_OFFSET + 20) /* Character LCD */
|
||||
#define EB_IRQ_DMAC (EB_GIC_IRQ_OFFSET + 20) /* DMA Controller */
|
||||
|
||||
|
||||
/* Interrupt Sources to ARM 11 MPCore or EB+A9 MPCore GIC */
|
||||
#define MPCORE_GIC_IRQ_AACI (EB_GIC_IRQ_OFFSET + 0)
|
||||
#define MPCORE_GIC_IRQ_TIMER01 (EB_GIC_IRQ_OFFSET + 1)
|
||||
#define MPCORE_GIC_IRQ_TIMER23 (EB_GIC_IRQ_OFFSET + 2)
|
||||
#define MPCORE_GIC_IRQ_USB (EB_GIC_IRQ_OFFSET + 3)
|
||||
#define MPCORE_GIC_IRQ_UART0 (EB_GIC_IRQ_OFFSET + 4)
|
||||
#define MPCORE_GIC_IRQ_UART1 (EB_GIC_IRQ_OFFSET + 5)
|
||||
#define MPCORE_GIC_IRQ_RTC (EB_GIC_IRQ_OFFSET + 6)
|
||||
#define MPCORE_GIC_IRQ_KMI0 (EB_GIC_IRQ_OFFSET + 7)
|
||||
#define MPCORE_GIC_IRQ_KMI1 (EB_GIC_IRQ_OFFSET + 8)
|
||||
#define MPCORE_GIC_IRQ_ETH (EB_GIC_IRQ_OFFSET + 9)
|
||||
|
||||
/* Interrupt from GIC1 on Base board */
|
||||
#define MPCORE_GIC_IRQ_EB_GIC1 (EB_GIC_IRQ_OFFSET + 10)
|
||||
#define MPCORE_GIC_IRQ_EB_GIC2 (EB_GIC_IRQ_OFFSET + 11)
|
||||
#define MPCORE_GIC_IRQ_EB_GIC3 (EB_GIC_IRQ_OFFSET + 12)
|
||||
#define MPCORE_GIC_IRQ_EB_GIC4 (EB_GIC_IRQ_OFFSET + 13)
|
||||
|
||||
#if defined (CONFIG_CPU_ARM11MPCORE) || defined (CONFIG_CPU_CORTEXA9)
|
||||
#define IRQ_TIMER0 MPCORE_GIC_IRQ_TIMER01
|
||||
#define IRQ_TIMER1 MPCORE_GIC_IRQ_TIMER23
|
||||
#else
|
||||
#define IRQ_TIMER0 EB_IRQ_TIMER01
|
||||
#define IRQ_TIMER1 EB_IRQ_TIMER23
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __PLATFORM_IRQ_H__ */
|
||||
|
||||
@@ -1,71 +1,61 @@
|
||||
/*
|
||||
* Describes physical memory layout of EB platform.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
* This only include physical and memory offsets that
|
||||
* are not included in realview/offsets.h
|
||||
*
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
* Author: Prem Mallappa <prem.mallappa@b-labs.co.uk>
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_EB_OFFSETS_H__
|
||||
#define __PLATFORM_EB_OFFSETS_H__
|
||||
|
||||
/* Physical memory base */
|
||||
#define PHYS_MEM_START 0x00000000 /* inclusive */
|
||||
#define PHYS_MEM_END 0x10000000 /* 256 MB, exclusive */
|
||||
|
||||
/*
|
||||
* These bases taken from where kernel is `physically' linked at,
|
||||
* also used to calculate virtual-to-physical translation offset.
|
||||
* See the linker script for their sources. PHYS_ADDR_BASE can't
|
||||
* use a linker variable because it's referred from assembler.
|
||||
*/
|
||||
#define PHYS_ADDR_BASE 0x100000
|
||||
|
||||
/* Device memory base */
|
||||
#define EB_DEV_PHYS 0x10000000
|
||||
#include <l4/platform/realview/offsets.h>
|
||||
|
||||
/* Device offsets in physical memory */
|
||||
#define EB_SYSTEM_REGISTERS 0x10000000 /* System registers */
|
||||
#define EB_SYSCTRL_BASE 0x10001000 /* System controller */
|
||||
#define EB_UART0_BASE 0x10009000 /* UART 0 */
|
||||
#define EB_UART1_BASE 0x1000A000 /* UART 1 */
|
||||
#define EB_UART2_BASE 0x1000B000 /* UART 2 */
|
||||
#define EB_UART3_BASE 0x1000C000 /* UART 3 */
|
||||
#define EB_WATCHDOG0_BASE 0x10010000 /* WATCHDOG */
|
||||
#define EB_TIMER01_BASE 0x10011000 /* TIMER 0-1 */
|
||||
#define EB_TIMER23_BASE 0x10012000 /* TIMER 2-3 */
|
||||
#define EB_RTC_BASE 0x10017000 /* RTC interface */
|
||||
#define EB_GIC0_BASE 0x10040000 /* GIC 0 */
|
||||
#define EB_GIC1_BASE 0x10050000 /* GIC 1 */
|
||||
#define EB_GIC2_BASE 0x10060000 /* GIC 2 */
|
||||
#define EB_GIC3_BASE 0x10070000 /* GIC 3 */
|
||||
#define PLATFORM_GIC1_BASE 0x10040000 /* GIC 1 */
|
||||
#define PLATFORM_GIC2_BASE 0x10050000 /* GIC 2 */
|
||||
#define PLATFORM_GIC3_BASE 0x10060000 /* GIC 3 */
|
||||
#define PLATFORM_GIC4_BASE 0x10070000 /* GIC 4 */
|
||||
|
||||
/*
|
||||
* Uart virtual address until a file-based console access
|
||||
* is available for userspace
|
||||
*/
|
||||
#define USERSPACE_UART_BASE 0x500000
|
||||
#define MPCORE_PRIVATE_VBASE (IO_AREA0_VADDR + (13 * DEVICE_PAGE))
|
||||
|
||||
/*
|
||||
* Device offsets in virtual memory. They offset to some virtual
|
||||
* device base address. Each page on this virtual base is consecutively
|
||||
* allocated to devices. Nice and smooth.
|
||||
*/
|
||||
#define EB_SYSREGS_VOFFSET 0x00000000
|
||||
#define EB_SYSCTRL_VOFFSET 0x00001000
|
||||
#define EB_UART0_VOFFSET 0x00002000
|
||||
#define EB_TIMER01_VOFFSET 0x00003000
|
||||
#define EB_GIC0_VOFFSET 0x00004000
|
||||
#define EB_GIC1_VOFFSET 0x00005000
|
||||
#define EB_GIC2_VOFFSET 0x00006000
|
||||
#define EB_GIC3_VOFFSET 0x00007000
|
||||
#if defined (CONFIG_CPU_CORTEXA9)
|
||||
#define MPCORE_PRIVATE_BASE 0x1F000000
|
||||
#endif /* End CORTEXA9 */
|
||||
|
||||
#define EB_SYSREGS_VBASE (IO_AREA0_VADDR + EB_SYSREGS_VOFFSET)
|
||||
#define EB_SYSCTRL_VBASE (IO_AREA0_VADDR + EB_SYSCTRL_VOFFSET)
|
||||
#define EB_UART0_VBASE (IO_AREA0_VADDR + EB_UART0_VOFFSET)
|
||||
#define EB_TIMER01_VBASE (IO_AREA0_VADDR + EB_TIMER01_VOFFSET)
|
||||
#define EB_GIC0_VBASE (IO_AREA0_VADDR + EB_GIC0_VOFFSET)
|
||||
#define EB_GIC1_VBASE (IO_AREA0_VADDR + EB_GIC1_VOFFSET)
|
||||
#define EB_GIC2_VBASE (IO_AREA0_VADDR + EB_GIC2_VOFFSET)
|
||||
#define EB_GIC3_VBASE (IO_AREA0_VADDR + EB_GIC3_VOFFSET)
|
||||
#if defined (CONFIG_CPU_ARM11MPCORE)
|
||||
#if defined REV_C || defined REV_D
|
||||
#define MPCORE_PRIVATE_BASE 0x1F000000
|
||||
#else /* REV_B and QEMU */
|
||||
#define MPCORE_PRIVATE_BASE 0x10100000
|
||||
#endif /* End REV_B and QEMU */
|
||||
#endif /* End ARM11MPCORE */
|
||||
|
||||
#if defined (CONFIG_CPU_CORTEXA9) || defined (CONFIG_CPU_ARM11MPCORE)
|
||||
/* MPCore private memory region */
|
||||
#define SCU_BASE MPCORE_PRIVATE_BASE
|
||||
#define SCU_VBASE MPCORE_PRIVATE_VBASE
|
||||
#define GIC0_CPU_VBASE (MPCORE_PRIVATE_VBASE + 0x100)
|
||||
#define GIC0_DIST_VBASE (MPCORE_PRIVATE_VBASE + 0x1000)
|
||||
#endif /* End CORTEXA9 || ARM11MPCORE */
|
||||
|
||||
#define GIC1_CPU_VBASE (PLATFORM_GIC1_VBASE + 0x0)
|
||||
#define GIC2_CPU_VBASE (PLATFORM_GIC2_VBASE + 0x0)
|
||||
#define GIC3_CPU_VBASE (PLATFORM_GIC3_VBASE + 0x0)
|
||||
#define GIC4_CPU_VBASE (PLATFORM_GIC4_VBASE + 0x0)
|
||||
|
||||
#define GIC1_DIST_VBASE (PLATFORM_GIC1_VBASE + 0x1000)
|
||||
#define GIC2_DIST_VBASE (PLATFORM_GIC2_VBASE + 0x1000)
|
||||
#define GIC3_DIST_VBASE (PLATFORM_GIC3_VBASE + 0x1000)
|
||||
#define GIC4_DIST_VBASE (PLATFORM_GIC4_VBASE + 0x1000)
|
||||
|
||||
#if defined (CONFIG_CPU_ARM11MPCORE) || defined (CONFIG_CPU_CORTEXA9)
|
||||
#define PLATFORM_IRQCTRL0_VIRTUAL EB_GIC0_VBASE
|
||||
#endif
|
||||
|
||||
#define PLATFORM_IRQCTRL1_VIRTUAL EB_GIC1_VBASE
|
||||
|
||||
#endif /* __PLATFORM_EB_OFFSETS_H__ */
|
||||
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
#ifndef __EB_PLATFORM_H__
|
||||
#define __EB_PLATFORM_H__
|
||||
/*
|
||||
* Platform specific ties between drivers and generic APIs used by the kernel.
|
||||
* E.g. system timer and console.
|
||||
*
|
||||
* Copyright (C) Bahadir Balban 2007
|
||||
* Copyright (C) 2009 B Labs Ltd.
|
||||
*/
|
||||
#ifndef __EB_PLATFORM_H__
|
||||
#define __EB_PLATFORM_H__
|
||||
|
||||
#include INC_PLAT(offsets.h)
|
||||
#include INC_GLUE(memlayout.h)
|
||||
#include INC_PLAT(sysctrl.h)
|
||||
#include <l4/drivers/irq/gic/gic.h>
|
||||
#include <l4/platform/realview/platform.h>
|
||||
|
||||
#define PLATFORM_CONSOLE0_BASE EB_UART0_VBASE
|
||||
#define PLATFORM_TIMER0_BASE EB_TIMER01_VBASE
|
||||
#define PLATFORM_SP810_BASE EB_SYSCTRL_VBASE
|
||||
void cpu_extra_init(void);
|
||||
void init_platform_irq_controller();
|
||||
void init_platform_devices();
|
||||
|
||||
/* Total number of timers present in this platform */
|
||||
#define TOTAL_TIMERS 4
|
||||
|
||||
#define PLATFORM_TIMER0 0
|
||||
#define PLATFORM_TIMER1 1
|
||||
#define PLATFORM_TIMER2 2
|
||||
#define PLATFORM_TIMER3 3
|
||||
|
||||
void platform_irq_enable(int irq);
|
||||
void platform_irq_disable(int irq);
|
||||
void timer_start(void);
|
||||
#endif /* __EB_PLATFORM_H__ */
|
||||
|
||||
95
include/l4/platform/eb/sysctrl.h
Normal file
95
include/l4/platform/eb/sysctrl.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef __EB_SYSCTRL_H__
|
||||
#define __EB_SYSCTRL_H__
|
||||
/* TODO: Better to stick this file in a ARM specific folder as most realview boards
|
||||
* tend to have this component
|
||||
*/
|
||||
#define SYS_ID 0x0000
|
||||
#define SYS_SW 0x0004
|
||||
#define SYS_LED 0x0008
|
||||
|
||||
#define SYS_OSC0 0x000C
|
||||
#define SYS_OSC1 0x0010
|
||||
#define SYS_OSC2 0x0014
|
||||
#define SYS_OSC3 0x0018
|
||||
#define SYS_OSC4 0x001C
|
||||
|
||||
#define SYS_LOCK 0x0020
|
||||
#define SYS_100HZ 0x0024
|
||||
|
||||
#define SYS_CFGDATA0 0x0028
|
||||
#define SYS_CFGDATA1 0x002C
|
||||
|
||||
#define SYS_FLAGS 0x0030
|
||||
#define SYS_FLAGS_SET 0x0030
|
||||
#define SYS_FLAGS_CLR 0x0034
|
||||
#define SYS_NVFLAGS 0x0038
|
||||
#define SYS_NVFLAGS_SET 0x0038
|
||||
#define SYS_NVFLAGS_CLR 0x003C
|
||||
|
||||
#define SYS_PCICTL 0x0044
|
||||
#define SYS_MCI 0x0048
|
||||
#define SYS_FLASH 0x004C
|
||||
#define SYS_CLCD 0x0050
|
||||
#define SYS_CLCDSER 0x0054
|
||||
#define SYS_BOOTCS 0x0058
|
||||
|
||||
#define SYS_24MHZ 0x005C
|
||||
#define SYS_MISC 0x0060
|
||||
#define SYS_DMAPSR0 0x0064
|
||||
#define SYS_DMAPSR1 0x0068
|
||||
#define SYS_DMAPSR2 0x006C
|
||||
#define SYS_IOSEL 0x0070
|
||||
#define SYS_PLDCTL1 0x0074
|
||||
#define SYS_PLDCTL2 0x0078
|
||||
|
||||
#define SYS_BUSID 0x0080
|
||||
#define SYS_PROCID1 0x0084
|
||||
#define SYS_PROCID0 0x0088
|
||||
|
||||
#define SYS_OSCRESET0 0x008C
|
||||
#define SYS_OSCRESET1 0x0090
|
||||
#define SYS_OSCRESET2 0x0094
|
||||
#define SYS_OSCRESET3 0x0098
|
||||
#define SYS_OSCRESET4 0x009C
|
||||
|
||||
|
||||
/* System Controller Lock/Unlock */
|
||||
#define SYSCTRL_LOCK 0xFF
|
||||
#define SYSCTRL_UNLOCK 0xA05F
|
||||
|
||||
|
||||
#define ID_MASK_REV 0xF0000000
|
||||
#define ID_MASK_HBI 0x0FFF0000
|
||||
#define ID_MASK_BUILD 0x0000F000
|
||||
#define ID_MASK_ARCH 0x00000F00
|
||||
#define ID_MASK_FPGA 0x000000FF
|
||||
|
||||
|
||||
#define SW_MASK_BOOTSEL 0x0000FF00
|
||||
#define SW_MASK_GP 0x000000FF
|
||||
|
||||
#define LED_MASK_LED 0x000000FF
|
||||
|
||||
#define FLASH_WRITE_EN 0x1
|
||||
#define FLASH_WRITE_DIS 0x0
|
||||
|
||||
#define CLCD_QVGA (0 << 8) /* 320x240 */
|
||||
#define CLDE_VGA (1 << 8) /* 640x480 */
|
||||
#define CLCD_SMALL (2 << 8) /* 220x176 */
|
||||
#define CLCD_SSP_CS (1 << 7) /* SSP Chip Select */
|
||||
#define CLCD_TS_EN (1 << 6) /* Touch Screen Enable */
|
||||
/* Different Voltages */
|
||||
#define CLCD_NEG_EN (1 << 5)
|
||||
#define CLCD_3V5V_EN (1 << 4)
|
||||
#define CLCD_POS_EN (1 << 3)
|
||||
#define CLCD_IO_ON (1 << 2)
|
||||
|
||||
|
||||
/* Normal without DCC, no FIQ, recommended for SMP */
|
||||
#define PLD_CTRL1_INTMOD_WITHOUT_DCC (1 << 22)
|
||||
/* Not Recommended */
|
||||
#define PLD_CTRL1_INTMOD_WITH_DCC (2 << 22)
|
||||
/* For single cpu such as 1136 */
|
||||
#define PLD_CTRL1_INTMOD_LEGACY (4 << 22)
|
||||
|
||||
#endif /* __EB_SYSCTRL_H__ */
|
||||
@@ -1,20 +1,6 @@
|
||||
/*
|
||||
* Platform specific ties to generic uart functions that putc expects.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*
|
||||
*/
|
||||
#ifndef __EB_UART_H__
|
||||
#define __EB_UART_H__
|
||||
|
||||
#ifndef __PLATFORM_EB_UART_H__
|
||||
#define __PLATFORM_EB_UART_H__
|
||||
#include <l4/platform/realview/uart.h>
|
||||
|
||||
#include INC_PLAT(offsets.h)
|
||||
#include INC_GLUE(memlayout.h)
|
||||
|
||||
#define PLATFORM_CONSOLE_BASE EB_UART0_VBASE
|
||||
#include <l4/drivers/uart/pl011/pl011_uart.h>
|
||||
|
||||
void uart_init(void);
|
||||
void uart_putc(char c);
|
||||
|
||||
#endif /* __PLATFORM_EB_UART_H__ */
|
||||
#endif /* __EB_UART_H__ */
|
||||
|
||||
Reference in New Issue
Block a user