Home | History | Annotate | Line # | Download | only in broadcom
bcm2835reg.h revision 1.13
      1  1.13     skrll /*	$NetBSD: bcm2835reg.h,v 1.13 2015/02/03 08:48:24 skrll Exp $	*/
      2   1.1     skrll 
      3   1.1     skrll /*-
      4   1.1     skrll  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      5   1.1     skrll  * All rights reserved.
      6   1.1     skrll  *
      7   1.1     skrll  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1     skrll  * by Nick Hudson
      9   1.1     skrll  *
     10   1.1     skrll  * Redistribution and use in source and binary forms, with or without
     11   1.1     skrll  * modification, are permitted provided that the following conditions
     12   1.1     skrll  * are met:
     13   1.1     skrll  * 1. Redistributions of source code must retain the above copyright
     14   1.1     skrll  *    notice, this list of conditions and the following disclaimer.
     15   1.1     skrll  * 2. Redistributions in binary form must reproduce the above copyright
     16   1.1     skrll  *    notice, this list of conditions and the following disclaimer in the
     17   1.1     skrll  *    documentation and/or other materials provided with the distribution.
     18   1.1     skrll  *
     19   1.1     skrll  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20   1.1     skrll  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21   1.1     skrll  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22   1.1     skrll  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23   1.1     skrll  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24   1.1     skrll  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25   1.1     skrll  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26   1.1     skrll  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27   1.1     skrll  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28   1.1     skrll  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29   1.1     skrll  * POSSIBILITY OF SUCH DAMAGE.
     30   1.1     skrll  */
     31   1.1     skrll 
     32   1.1     skrll /*
     33   1.1     skrll  * Reference: BCM2835 ARM Periperhals
     34   1.5     skrll  *
     35  1.13     skrll  * 	http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
     36   1.1     skrll  */
     37   1.1     skrll 
     38   1.1     skrll #ifndef	_BCM2835REG_H_
     39   1.1     skrll #define	_BCM2835REG_H_
     40   1.1     skrll 
     41   1.1     skrll #define	BCM2835_PERIPHERALS_BASE	0x20000000
     42   1.1     skrll #define	BCM2835_PERIPHERALS_SIZE	0x01000000	/* 16MBytes */
     43  1.12  jakllsch #define	BCM2835_PERIPHERALS_BASE_BUS	0x7e000000
     44  1.12  jakllsch #define	BCM2835_PERIPHERALS_TO_BUS(a) \
     45  1.12  jakllsch     ((a) - BCM2835_PERIPHERALS_BASE + BCM2835_PERIPHERALS_BASE_BUS)
     46   1.1     skrll 
     47   1.1     skrll #define	BCM2835_STIMER_BASE	(BCM2835_PERIPHERALS_BASE + 0x00003000)
     48   1.3  jakllsch #define	BCM2835_DMA0_BASE	(BCM2835_PERIPHERALS_BASE + 0x00007000)
     49   1.1     skrll #define	BCM2835_ARM_BASE	(BCM2835_PERIPHERALS_BASE + 0x0000B000)
     50   1.1     skrll #define	BCM2835_PM_BASE		(BCM2835_PERIPHERALS_BASE + 0x00100000)
     51   1.8  jmcneill #define	BCM2835_RNG_BASE	(BCM2835_PERIPHERALS_BASE + 0x00104000)
     52   1.3  jakllsch #define	BCM2835_GPIO_BASE	(BCM2835_PERIPHERALS_BASE + 0x00200000)
     53   1.1     skrll #define	BCM2835_UART0_BASE	(BCM2835_PERIPHERALS_BASE + 0x00201000)
     54   1.3  jakllsch #define	BCM2835_PCM_BASE	(BCM2835_PERIPHERALS_BASE + 0x00203000)
     55   1.3  jakllsch #define	BCM2835_SPI0_BASE	(BCM2835_PERIPHERALS_BASE + 0x00204000)
     56   1.3  jakllsch #define	BCM2835_BSC0_BASE	(BCM2835_PERIPHERALS_BASE + 0x00205000)
     57   1.3  jakllsch #define	BCM2835_BSCSPISLV_BASE	(BCM2835_PERIPHERALS_BASE + 0x00214000)
     58   1.3  jakllsch #define	BCM2835_AUX_BASE	(BCM2835_PERIPHERALS_BASE + 0x00215000)
     59   1.1     skrll #define	BCM2835_EMMC_BASE	(BCM2835_PERIPHERALS_BASE + 0x00300000)
     60   1.3  jakllsch #define	BCM2835_BSC1_BASE	(BCM2835_PERIPHERALS_BASE + 0x00804000)
     61   1.3  jakllsch #define	BCM2835_BSC2_BASE	(BCM2835_PERIPHERALS_BASE + 0x00805000)
     62   1.3  jakllsch #define	BCM2835_USB_BASE	(BCM2835_PERIPHERALS_BASE + 0x00980000)
     63   1.3  jakllsch #define	BCM2835_DMA15_BASE	(BCM2835_PERIPHERALS_BASE + 0x00E05000)
     64   1.1     skrll 
     65   1.1     skrll #define	BCM2835_STIMER_SIZE	0x1c
     66   1.3  jakllsch #define	BCM2835_DMA0_SIZE	0x1000
     67   1.3  jakllsch #define	BCM2835_ARM_SIZE	0x1000
     68   1.1     skrll #define	BCM2835_PM_SIZE		0x1000
     69   1.8  jmcneill #define	BCM2835_RNG_SIZE	0x1000
     70   1.3  jakllsch #define	BCM2835_GPIO_SIZE	0x1000
     71   1.1     skrll #define	BCM2835_UART0_SIZE	0x90
     72   1.3  jakllsch #define	BCM2835_PCM_SIZE	0x1000
     73   1.3  jakllsch #define	BCM2835_SPI0_SIZE	0x1000
     74   1.3  jakllsch #define	BCM2835_BSC_SIZE	0x1000
     75   1.3  jakllsch #define	BCM2835_AUX_SIZE	0x1000
     76   1.1     skrll #define	BCM2835_EMMC_SIZE	0x1000
     77   1.7     skrll #define	BCM2835_USB_SIZE	0x20000
     78   1.3  jakllsch #define	BCM2835_DMA15_SIZE	0x100
     79   1.1     skrll 
     80   1.1     skrll #define BCM2835_IOPHYSTOVIRT(a) \
     81   1.1     skrll     ((0xf0000000 | (((a) & 0xf0000000) >> 4)) + ((a) & ~0xf0000000))
     82   1.1     skrll 
     83   1.9     skrll #define	BCM2835_BUSADDR_CACHE_MASK	0xc0000000
     84   1.9     skrll #define	BCM2835_BUSADDR_CACHE_COHERENT	0x40000000
     85   1.9     skrll #define	BCM2835_BUSADDR_CACHE_L1L2	0x00000000
     86   1.9     skrll #define	BCM2835_BUSADDR_CACHE_L2ONLY	0x80000000
     87   1.9     skrll #define	BCM2835_BUSADDR_CACHE_DIRECT	0xc0000000
     88   1.9     skrll 
     89   1.1     skrll #define	BCM2835_PERIPHERALS_VBASE \
     90   1.1     skrll 	BCM2835_IOPHYSTOVIRT(BCM2835_PERIPHERALS_BASE)
     91   1.1     skrll #define	BCM2835_STIMER_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_ST_BASE)
     92   1.1     skrll #define	BCM2835_PM_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_PM_BASE)
     93   1.1     skrll #define	BCM2835_UART0_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_UART0_BASE)
     94   1.1     skrll #define	BCM2835_EMMC_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_EMMC_BASE)
     95   1.1     skrll 
     96   1.1     skrll #define	BCM2835_ARMICU_BASE	(BCM2835_ARM_BASE + 0x0200)
     97   1.1     skrll #define	BCM2835_ARMICU_SIZE	0x200
     98   1.1     skrll 
     99  1.10  jmcneill #define	BCM2835_VCHIQ_BASE	(BCM2835_ARM_BASE + 0x0800)
    100  1.10  jmcneill #define	BCM2835_VCHIQ_SIZE	0x50
    101  1.10  jmcneill 
    102   1.2     skrll #define	BCM2835_ARMMBOX_BASE	(BCM2835_ARM_BASE + 0x0880)
    103   1.2     skrll #define	BCM2835_ARMMBOX_SIZE	0x40
    104   1.2     skrll 
    105   1.1     skrll #define	BCM2835_ARMICU_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_ARMICU_BASE)
    106   1.1     skrll 
    107   1.1     skrll #define	BCM2835_INTC_BASE	(0x0)	/* Relative to BCM2835_ARMICU_BASE */
    108   1.1     skrll 
    109   1.1     skrll /* Interrupt controller */
    110   1.1     skrll #define	BCM2835_INTC_IRQBPENDING	(BCM2835_INTC_BASE + 0x00)	/* IRQ Basic pending */
    111   1.1     skrll #define	BCM2835_INTC_IRQ1PENDING	(BCM2835_INTC_BASE + 0x04)	/* IRQ pending 1 */
    112   1.1     skrll #define	BCM2835_INTC_IRQ2PENDING	(BCM2835_INTC_BASE + 0x08)	/* IRQ pending 2 */
    113   1.1     skrll #define	BCM2835_INTC_FIQCTL		(BCM2835_INTC_BASE + 0x0c)	/* FIQ control */
    114   1.1     skrll #define	BCM2835_INTC_IRQ1ENABLE		(BCM2835_INTC_BASE + 0x10)	/* Enable IRQs 1 */
    115   1.1     skrll #define	BCM2835_INTC_IRQ2ENABLE		(BCM2835_INTC_BASE + 0x14)	/* Enable IRQs 2 */
    116   1.1     skrll #define	BCM2835_INTC_IRQBENABLE		(BCM2835_INTC_BASE + 0x18)	/* Enable Basic IRQs */
    117   1.1     skrll #define	BCM2835_INTC_IRQ1DISABLE	(BCM2835_INTC_BASE + 0x1c)	/* Disable IRQ 1 */
    118   1.1     skrll #define	BCM2835_INTC_IRQ2DISABLE	(BCM2835_INTC_BASE + 0x20)	/* Disable IRQ 2 */
    119   1.1     skrll #define	BCM2835_INTC_IRQBDISABLE	(BCM2835_INTC_BASE + 0x24)	/* Disable Basic IRQs */
    120   1.1     skrll 
    121   1.1     skrll #define	BCM2835_INTC_ENABLEBASE		(BCM2835_INTC_BASE + 0x10)
    122   1.1     skrll #define	BCM2835_INTC_DISABLEBASE	(BCM2835_INTC_BASE + 0x1c)
    123   1.1     skrll 
    124   1.1     skrll /* Interrupt source */
    125   1.1     skrll #define	BCM2835_INT_GPU0BASE		0
    126   1.1     skrll #define	BCM2835_INT_TIMER0		(BCM2835_INT_GPU0BASE + 0)
    127   1.1     skrll #define	BCM2835_INT_TIMER1		(BCM2835_INT_GPU0BASE + 1)
    128   1.1     skrll #define	BCM2835_INT_TIMER2		(BCM2835_INT_GPU0BASE + 2)
    129   1.1     skrll #define	BCM2835_INT_TIMER3		(BCM2835_INT_GPU0BASE + 3)
    130   1.1     skrll #define	BCM2835_INT_USB			(BCM2835_INT_GPU0BASE + 9)
    131  1.11  jmcneill #define	BCM2835_INT_DMA0		(BCM2835_INT_GPU0BASE + 16)
    132   1.1     skrll #define	BCM2835_INT_DMA2		(BCM2835_INT_GPU0BASE + 18)
    133   1.1     skrll #define	BCM2835_INT_DMA3		(BCM2835_INT_GPU0BASE + 19)
    134   1.3  jakllsch #define	BCM2835_INT_AUX			(BCM2835_INT_GPU0BASE + 29)
    135   1.3  jakllsch #define	BCM2835_INT_ARM			(BCM2835_INT_GPU0BASE + 30)
    136   1.1     skrll 
    137   1.1     skrll #define	BCM2835_INT_GPU1BASE		32
    138   1.3  jakllsch #define	BCM2835_INT_GPIO0		(BCM2835_INT_GPU1BASE + 17)
    139   1.3  jakllsch #define	BCM2835_INT_GPIO1		(BCM2835_INT_GPU1BASE + 18)
    140   1.3  jakllsch #define	BCM2835_INT_GPIO2		(BCM2835_INT_GPU1BASE + 19)
    141   1.3  jakllsch #define	BCM2835_INT_GPIO3		(BCM2835_INT_GPU1BASE + 20)
    142   1.6  jakllsch #define	BCM2835_INT_BSC			(BCM2835_INT_GPU1BASE + 21)
    143   1.3  jakllsch #define	BCM2835_INT_SPI0		(BCM2835_INT_GPU1BASE + 22)
    144   1.3  jakllsch #define	BCM2835_INT_PCM			(BCM2835_INT_GPU1BASE + 23)
    145   1.1     skrll #define	BCM2835_INT_UART0		(BCM2835_INT_GPU1BASE + 25)
    146   1.1     skrll #define	BCM2835_INT_EMMC		(BCM2835_INT_GPU1BASE + 30)
    147   1.1     skrll 
    148   1.1     skrll #define	BCM2835_INT_BASICBASE		64
    149   1.1     skrll #define	BCM2835_INT_ARMTIMER		(BCM2835_INT_BASICBASE + 0)
    150   1.1     skrll #define	BCM2835_INT_ARMMAILBOX		(BCM2835_INT_BASICBASE + 1)
    151   1.1     skrll #define	BCM2835_INT_ARMDOORBELL0	(BCM2835_INT_BASICBASE + 2)
    152   1.1     skrll #define	BCM2835_INT_ARMDOORBELL1	(BCM2835_INT_BASICBASE + 3)
    153   1.1     skrll #define	BCM2835_INT_GPU0HALTED		(BCM2835_INT_BASICBASE + 4)
    154   1.1     skrll #define	BCM2835_INT_GPU1HALTED		(BCM2835_INT_BASICBASE + 5)
    155   1.1     skrll #define	BCM2835_INT_ILLEGALTYPE0	(BCM2835_INT_BASICBASE + 6)
    156   1.1     skrll #define	BCM2835_INT_ILLEGALTYPE1	(BCM2835_INT_BASICBASE + 7)
    157   1.1     skrll 
    158   1.1     skrll #define	BCM2835_NIRQ	64 + 8
    159   1.1     skrll 
    160   1.1     skrll #define	BCM2835_UART0_CLK	3000000
    161   1.1     skrll 
    162   1.1     skrll #endif /* _BCM2835REG_H_ */
    163