Home | History | Annotate | Line # | Download | only in broadcom
bcm2835reg.h revision 1.2
      1 /*	$NetBSD: bcm2835reg.h,v 1.2 2012/08/20 07:45:24 skrll Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2012 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Nick Hudson
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29  * POSSIBILITY OF SUCH DAMAGE.
     30  */
     31 
     32 /*
     33  * Reference: BCM2835 ARM Periperhals
     34  *
     35  * 	http://dmkenr5gtnd8f.cloudfront.net/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf
     36  */
     37 
     38 #ifndef	_BCM2835REG_H_
     39 #define	_BCM2835REG_H_
     40 
     41 #define	BCM2835_PERIPHERALS_BASE	0x20000000
     42 #define	BCM2835_PERIPHERALS_SIZE	0x01000000	/* 16MBytes */
     43 
     44 #define	BCM2835_STIMER_BASE	(BCM2835_PERIPHERALS_BASE + 0x00003000)
     45 #define	BCM2835_ARM_BASE	(BCM2835_PERIPHERALS_BASE + 0x0000B000)
     46 #define	BCM2835_PM_BASE		(BCM2835_PERIPHERALS_BASE + 0x00100000)
     47 #define	BCM2835_UART0_BASE	(BCM2835_PERIPHERALS_BASE + 0x00201000)
     48 #define	BCM2835_EMMC_BASE	(BCM2835_PERIPHERALS_BASE + 0x00300000)
     49 
     50 #define	BCM2835_STIMER_SIZE	0x1c
     51 #define	BCM2835_PM_SIZE		0x1000
     52 #define	BCM2835_UART0_SIZE	0x90
     53 #define	BCM2835_EMMC_SIZE	0x1000
     54 
     55 #define BCM2835_IOPHYSTOVIRT(a) \
     56     ((0xf0000000 | (((a) & 0xf0000000) >> 4)) + ((a) & ~0xf0000000))
     57 
     58 #define	BCM2835_PERIPHERALS_VBASE \
     59 	BCM2835_IOPHYSTOVIRT(BCM2835_PERIPHERALS_BASE)
     60 #define	BCM2835_STIMER_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_ST_BASE)
     61 #define	BCM2835_PM_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_PM_BASE)
     62 #define	BCM2835_UART0_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_UART0_BASE)
     63 #define	BCM2835_EMMC_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_EMMC_BASE)
     64 
     65 #define	BCM2835_ARMICU_BASE	(BCM2835_ARM_BASE + 0x0200)
     66 #define	BCM2835_ARMICU_SIZE	0x200
     67 
     68 #define	BCM2835_ARMMBOX_BASE	(BCM2835_ARM_BASE + 0x0880)
     69 #define	BCM2835_ARMMBOX_SIZE	0x40
     70 
     71 #define	BCM2835_ARMICU_VBASE	BCM2835_IOPHYSTOVIRT(BCM2835_ARMICU_BASE)
     72 
     73 #define	BCM2835_INTC_BASE	(0x0)	/* Relative to BCM2835_ARMICU_BASE */
     74 
     75 /* Interrupt controller */
     76 #define	BCM2835_INTC_IRQBPENDING	(BCM2835_INTC_BASE + 0x00)	/* IRQ Basic pending */
     77 #define	BCM2835_INTC_IRQ1PENDING	(BCM2835_INTC_BASE + 0x04)	/* IRQ pending 1 */
     78 #define	BCM2835_INTC_IRQ2PENDING	(BCM2835_INTC_BASE + 0x08)	/* IRQ pending 2 */
     79 #define	BCM2835_INTC_FIQCTL		(BCM2835_INTC_BASE + 0x0c)	/* FIQ control */
     80 #define	BCM2835_INTC_IRQ1ENABLE		(BCM2835_INTC_BASE + 0x10)	/* Enable IRQs 1 */
     81 #define	BCM2835_INTC_IRQ2ENABLE		(BCM2835_INTC_BASE + 0x14)	/* Enable IRQs 2 */
     82 #define	BCM2835_INTC_IRQBENABLE		(BCM2835_INTC_BASE + 0x18)	/* Enable Basic IRQs */
     83 #define	BCM2835_INTC_IRQ1DISABLE	(BCM2835_INTC_BASE + 0x1c)	/* Disable IRQ 1 */
     84 #define	BCM2835_INTC_IRQ2DISABLE	(BCM2835_INTC_BASE + 0x20)	/* Disable IRQ 2 */
     85 #define	BCM2835_INTC_IRQBDISABLE	(BCM2835_INTC_BASE + 0x24)	/* Disable Basic IRQs */
     86 
     87 #define	BCM2835_INTC_ENABLEBASE		(BCM2835_INTC_BASE + 0x10)
     88 #define	BCM2835_INTC_DISABLEBASE	(BCM2835_INTC_BASE + 0x1c)
     89 
     90 /* Interrupt source */
     91 #define	BCM2835_INT_GPU0BASE		0
     92 #define	BCM2835_INT_TIMER0		(BCM2835_INT_GPU0BASE + 0)
     93 #define	BCM2835_INT_TIMER1		(BCM2835_INT_GPU0BASE + 1)
     94 #define	BCM2835_INT_TIMER2		(BCM2835_INT_GPU0BASE + 2)
     95 #define	BCM2835_INT_TIMER3		(BCM2835_INT_GPU0BASE + 3)
     96 #define	BCM2835_INT_USB			(BCM2835_INT_GPU0BASE + 9)
     97 #define	BCM2835_INT_DMA2		(BCM2835_INT_GPU0BASE + 18)
     98 #define	BCM2835_INT_DMA3		(BCM2835_INT_GPU0BASE + 19)
     99 
    100 #define	BCM2835_INT_GPU1BASE		32
    101 #define	BCM2835_INT_UART0		(BCM2835_INT_GPU1BASE + 25)
    102 #define	BCM2835_INT_EMMC		(BCM2835_INT_GPU1BASE + 30)
    103 
    104 #define	BCM2835_INT_BASICBASE		64
    105 #define	BCM2835_INT_ARMTIMER		(BCM2835_INT_BASICBASE + 0)
    106 #define	BCM2835_INT_ARMMAILBOX		(BCM2835_INT_BASICBASE + 1)
    107 #define	BCM2835_INT_ARMDOORBELL0	(BCM2835_INT_BASICBASE + 2)
    108 #define	BCM2835_INT_ARMDOORBELL1	(BCM2835_INT_BASICBASE + 3)
    109 #define	BCM2835_INT_GPU0HALTED		(BCM2835_INT_BASICBASE + 4)
    110 #define	BCM2835_INT_GPU1HALTED		(BCM2835_INT_BASICBASE + 5)
    111 #define	BCM2835_INT_ILLEGALTYPE0	(BCM2835_INT_BASICBASE + 6)
    112 #define	BCM2835_INT_ILLEGALTYPE1	(BCM2835_INT_BASICBASE + 7)
    113 
    114 #define	BCM2835_NIRQ	64 + 8
    115 
    116 #define	BCM2835_UART0_CLK	3000000
    117 
    118 #endif /* _BCM2835REG_H_ */
    119