make sure the arm implementation struct is aligned
[AROS.git] / arch / arm-native / soc / broadcom / 283x / include / hardware / bcm283x.h
blob0d9bf68dd0964d34d5f6f6d6ad42be5733e9b978
1 /*
2 Copyright © 2013-2015, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #ifndef BCM2835_H
7 #define BCM2835_H
9 #define CLID_I2C_BCM283X "hidd.i2c.bcm283x"
11 #define BCM2835_PERIPHYSBASE 0x20000000 // Peripheral physical base address
12 #define BCM2836_PERIPHYSBASE 0x3f000000 // Peripheral physical base address
13 #define BCM2835_PERIPHYSSIZE 0x400000
14 #define BCM2835_PERIBUSBASE 0x7E000000
16 #define BCM_BUSBASE BCM2835_PERIBUSBASE
17 #define ARM_PERIIOSIZE BCM2835_PERIPHYSSIZE
19 #if (1)
20 // TODO: Move to a more generic ARM header..
21 #define ARM_STACK_DEF 4096
22 #define ARM_VIRTBASE 0xF0000000
23 #define ARM_PRIMECELLID 0xB105F00D
24 #define ARM_PRIMECELLPERISIZE 0x1000
26 #define STACK_SIZE ARM_STACK_DEF
30 caller must provide ARM_PERIIOBASE
33 #define SYSTIMER_BASE (ARM_PERIIOBASE + 0x003000)
34 #define ARMTIMER_BASE (ARM_PERIIOBASE + 0x00b000)
35 #define IRQ_BASE (ARM_PERIIOBASE + 0x00b200)
36 #define GPIO_PADS (ARM_PERIIOBASE + 0x100000)
37 #define CLOCK_BASE (ARM_PERIIOBASE + 0x101000)
38 #define GPIO_BASE (ARM_PERIIOBASE + 0x200000)
40 #define SPI0_BASE (ARM_PERIIOBASE + 0x204000)
41 #define BSC0_BASE (ARM_PERIIOBASE + 0x205000)
42 #define GPIO_PWM (ARM_PERIIOBASE + 0x20C000)
43 #define V3D_BASE (ARM_PERIIOBASE + 0xc00000)
45 #define SYSTIMER_CS (SYSTIMER_BASE + 0x00)
46 #define SYSTIMER_CLO (SYSTIMER_BASE + 0x04)
47 #define SYSTIMER_CHI (SYSTIMER_BASE + 0x08)
48 #define SYSTIMER_C0 (SYSTIMER_BASE + 0x0c)
49 #define SYSTIMER_C1 (SYSTIMER_BASE + 0x10)
50 #define SYSTIMER_C2 (SYSTIMER_BASE + 0x14)
51 #define SYSTIMER_C3 (SYSTIMER_BASE + 0x18)
53 #define SYSTIMER_M0 (1 << 0)
54 #define SYSTIMER_M1 (1 << 1)
55 #define SYSTIMER_M2 (1 << 2)
56 #define SYSTIMER_M3 (1 << 3)
58 #define ARMTIMER_LOAD (ARMTIMER_BASE + 0x400)
59 #define ARMTIMER_VALUE (ARMTIMER_BASE + 0x404)
60 #define ARMTIMER_CONTROL (ARMTIMER_BASE + 0x408)
61 #define ARMTIMER_IRQ_ACK (ARMTIMER_BASE + 0x40c)
62 #define ARMTIMER_IRQ_RAW (ARMTIMER_BASE + 0x410)
63 #define ARMTIMER_IRQ_MSK (ARMTIMER_BASE + 0x414)
64 #define ARMTIMER_RELOAD (ARMTIMER_BASE + 0x418)
65 #define ARMTIMER_PREDIV (ARMTIMER_BASE + 0x41c)
66 #define ARMTIMER_FRC (ARMTIMER_BASE + 0x420)
68 #define ARMIRQ_PEND (IRQ_BASE + 0x00)
69 #define GPUIRQ_PEND0 (IRQ_BASE + 0x04) // Pending IRQs
70 #define GPUIRQ_PEND1 (IRQ_BASE + 0x08)
71 #define GPUIRQ_ENBL0 (IRQ_BASE + 0x10) // IRQ enable bits
72 #define GPUIRQ_ENBL1 (IRQ_BASE + 0x14)
73 #define ARMIRQ_ENBL (IRQ_BASE + 0x18)
74 #define GPUIRQ_DIBL0 (IRQ_BASE + 0x1C) // IRQ disable bits
75 #define GPUIRQ_DIBL1 (IRQ_BASE + 0x20)
76 #define ARMIRQ_DIBL (IRQ_BASE + 0x24)
78 #define IRQ_MASK(irq) (1 << (irq & 0x1f))
79 #define IRQ_BANK(irq) (irq >> 5)
81 #define GPUIRQ0_BASE (0 << 5)
82 #define IRQ_TIMER0 (GPUIRQ0_BASE + 0)
83 #define IRQ_TIMER1 (GPUIRQ0_BASE + 1)
84 #define IRQ_TIMER2 (GPUIRQ0_BASE + 2)
85 #define IRQ_TIMER3 (GPUIRQ0_BASE + 3)
86 #define IRQ_CODEC0 (GPUIRQ0_BASE + 4)
87 #define IRQ_CODEC1 (GPUIRQ0_BASE + 5)
88 #define IRQ_CODEC2 (GPUIRQ0_BASE + 6)
89 #define IRQ_VC_JPEG (GPUIRQ0_BASE + 7)
90 #define IRQ_ISP (GPUIRQ0_BASE + 8)
91 #define IRQ_VC_USB (GPUIRQ0_BASE + 9)
92 #define IRQ_VC_3D (GPUIRQ0_BASE + 10)
93 #define IRQ_TRANSPOSER (GPUIRQ0_BASE + 11)
94 #define IRQ_MULTICORESYNC0 (GPUIRQ0_BASE + 12)
95 #define IRQ_MULTICORESYNC1 (GPUIRQ0_BASE + 13)
96 #define IRQ_MULTICORESYNC2 (GPUIRQ0_BASE + 14)
97 #define IRQ_MULTICORESYNC3 (GPUIRQ0_BASE + 15)
98 #define IRQ_DMA0 (GPUIRQ0_BASE + 16)
99 #define IRQ_DMA1 (GPUIRQ0_BASE + 17)
100 #define IRQ_VC_DMA2 (GPUIRQ0_BASE + 18)
101 #define IRQ_VC_DMA3 (GPUIRQ0_BASE + 19)
102 #define IRQ_DMA4 (GPUIRQ0_BASE + 20)
103 #define IRQ_DMA5 (GPUIRQ0_BASE + 21)
104 #define IRQ_DMA6 (GPUIRQ0_BASE + 22)
105 #define IRQ_DMA7 (GPUIRQ0_BASE + 23)
106 #define IRQ_DMA8 (GPUIRQ0_BASE + 24)
107 #define IRQ_DMA9 (GPUIRQ0_BASE + 25)
108 #define IRQ_DMA10 (GPUIRQ0_BASE + 26)
109 #define IRQ_DMA11 (GPUIRQ0_BASE + 27)
110 #define IRQ_DMA12 (GPUIRQ0_BASE + 28)
111 #define IRQ_AUX (GPUIRQ0_BASE + 29)
112 #define IRQ_ARM (GPUIRQ0_BASE + 30)
113 #define IRQ_VPUDMA (GPUIRQ0_BASE + 31)
115 #define GPUIRQ1_BASE (1 << 5)
116 #define IRQ_HOSTPORT (GPUIRQ1_BASE + 0)
117 #define IRQ_VIDEOSCALER (GPUIRQ1_BASE + 1)
118 #define IRQ_CCP2TX (GPUIRQ1_BASE + 2)
119 #define IRQ_SDC (GPUIRQ1_BASE + 3)
120 #define IRQ_DSI0 (GPUIRQ1_BASE + 4)
121 #define IRQ_AVE (GPUIRQ1_BASE + 5)
122 #define IRQ_CAM0 (GPUIRQ1_BASE + 6)
123 #define IRQ_CAM1 (GPUIRQ1_BASE + 7)
124 #define IRQ_HDMI0 (GPUIRQ1_BASE + 8)
125 #define IRQ_HDMI1 (GPUIRQ1_BASE + 9)
126 #define IRQ_PIXELVALVE1 (GPUIRQ1_BASE + 10)
127 #define IRQ_I2CSPISLV (GPUIRQ1_BASE + 11)
128 #define IRQ_DSI1 (GPUIRQ1_BASE + 12)
129 #define IRQ_PWA0 (GPUIRQ1_BASE + 13)
130 #define IRQ_PWA1 (GPUIRQ1_BASE + 14)
131 #define IRQ_CPR (GPUIRQ1_BASE + 15)
132 #define IRQ_SMI (GPUIRQ1_BASE + 16)
133 #define IRQ_GPIO0 (GPUIRQ1_BASE + 17)
134 #define IRQ_GPIO1 (GPUIRQ1_BASE + 18)
135 #define IRQ_GPIO2 (GPUIRQ1_BASE + 19)
136 #define IRQ_GPIO3 (GPUIRQ1_BASE + 20)
137 #define IRQ_VC_I2C (GPUIRQ1_BASE + 21)
138 #define IRQ_VC_SPI (GPUIRQ1_BASE + 22)
139 #define IRQ_VC_I2SPCM (GPUIRQ1_BASE + 23)
140 #define IRQ_VC_SDIO (GPUIRQ1_BASE + 24)
141 #define IRQ_VC_UART (GPUIRQ1_BASE + 25)
142 #define IRQ_SLIMBUS (GPUIRQ1_BASE + 26)
143 #define IRQ_VEC (GPUIRQ1_BASE + 27)
144 #define IRQ_CPG (GPUIRQ1_BASE + 28)
145 #define IRQ_RNG (GPUIRQ1_BASE + 29)
146 #define IRQ_VC_ARASANSDIO (GPUIRQ1_BASE + 30)
147 #define IRQ_AVSPMON (GPUIRQ1_BASE + 31)
149 #define ARMIRQ_BASE (2 << 5)
150 #define IRQ_ARM_TIMER (ARMIRQ_BASE + 0)
151 #define IRQ_ARM_MAILBOX (ARMIRQ_BASE + 1)
152 #define IRQ_ARM_DOORBELL_0 (ARMIRQ_BASE + 2)
153 #define IRQ_ARM_DOORBELL_1 (ARMIRQ_BASE + 3)
154 #define IRQ_VPU0_HALTED (ARMIRQ_BASE + 4)
155 #define IRQ_VPU1_HALTED (ARMIRQ_BASE + 5)
156 #define IRQ_ILLEGAL_TYPE0 (ARMIRQ_BASE + 6)
157 #define IRQ_ILLEGAL_TYPE1 (ARMIRQ_BASE + 7)
158 #define IRQ_PENDING1 (ARMIRQ_BASE + 8)
159 #define IRQ_PENDING2 (ARMIRQ_BASE + 9)
160 #define IRQ_JPEG (ARMIRQ_BASE + 10)
161 #define IRQ_USB (ARMIRQ_BASE + 11)
162 #define IRQ_3D (ARMIRQ_BASE + 12)
163 #define IRQ_DMA2 (ARMIRQ_BASE + 13)
164 #define IRQ_DMA3 (ARMIRQ_BASE + 14)
165 #define IRQ_I2C (ARMIRQ_BASE + 15)
166 #define IRQ_SPI (ARMIRQ_BASE + 16)
167 #define IRQ_I2SPCM (ARMIRQ_BASE + 17)
168 #define IRQ_SDIO (ARMIRQ_BASE + 18)
169 #define IRQ_UART0 (ARMIRQ_BASE + 19)
170 #define IRQ_ARASANSDIO (ARMIRQ_BASE + 20)
172 #define GPIO_PADS_0_27 0x002c
173 #define GPIO_PADS_28_45 0x0030
174 #define GPIO_PADS_46_53 0x0034
176 #define GPFSEL0 (GPIO_BASE + 0x0) // GPIO Function Selectors..
177 #define GPFSEL1 (GPIO_BASE + 0x4)
178 #define GPFSEL2 (GPIO_BASE + 0x8)
179 #define GPFSEL3 (GPIO_BASE + 0xC)
180 #define GPFSEL4 (GPIO_BASE + 0x10)
181 #define GPFSEL5 (GPIO_BASE + 0x14)
182 #define GPSET0 (GPIO_BASE + 0x1C) // GPIO Pin Output control..
183 #define GPSET1 (GPIO_BASE + 0x20)
184 #define GPCLR0 (GPIO_BASE + 0x28)
185 #define GPCLR1 (GPIO_BASE + 0x2C)
186 #define GPLEV0 (GPIO_BASE + 0x34) // GPIO Pin Levels..
187 #define GPLEV1 (GPIO_BASE + 0x38)
188 #define GPEDS0 (GPIO_BASE + 0x40) // GPIO Pin Event Detect Status ..
189 #define GPEDS1 (GPIO_BASE + 0x44)
190 #define GPREN0 (GPIO_BASE + 0x4C) // GPIO Pin Rising Edge Detect Enables..
191 #define GPREN1 (GPIO_BASE + 0x50)
192 #define GPFEN0 (GPIO_BASE + 0x58) // GPIO Pin Falling Edge Detect Enables..
193 #define GPFEN1 (GPIO_BASE + 0x5C)
194 #define GPHEN0 (GPIO_BASE + 0x64)
195 #define GPHEN1 (GPIO_BASE + 0x68)
196 #define GPLEN0 (GPIO_BASE + 0x70)
197 #define GPLEN1 (GPIO_BASE + 0x74)
198 #define GPAREN0 (GPIO_BASE + 0x7c)
199 #define GPAREN1 (GPIO_BASE + 0x80)
200 #define GPAFEN0 (GPIO_BASE + 0x88)
201 #define GPAFEN1 (GPIO_BASE + 0x8c)
202 #define GPPUD (GPIO_BASE + 0x94)
203 #define GPPUDCLK0 (GPIO_BASE + 0x98)
204 #define GPPUDCLK1 (GPIO_BASE + 0x9c)
206 #define SPI0_CS (0x00)
207 #define SPI0_FIFO (0x04)
208 #define SPI0_CLK (0x08)
209 #define SPI0_DLEN (0x0c)
210 #define SPI0_LTOH (0x10)
211 #define SPI0_DC (0x14)
213 #define BSC0_CONTROL (BSC0_BASE + 0x00)
214 #define BSC0_STATUS (BSC0_BASE + 0x01)
215 #define BSC0_DATALEN (BSC0_BASE + 0x02)
216 #define BSC0_FIFO (BSC0_BASE + 0x04)
218 #define BSC_CONTROL_READ (1 << 0)
219 #define BSC_CONTROL_CLEAR (1 << 4)
220 #define BSC_CONTROL_ST (1 << 7)
221 #define BSC_CONTROL_INTD (1 << 8)
222 #define BSC_CONTROL_INTT (1 << 9)
223 #define BSC_CONTROL_INTR (1 << 10)
224 #define BSC_CONTROL_I2CEN (1 << 15)
226 #define BSC_STATUS_TA (1 << 0)
227 #define BSC_STATUS_DONE (1 << 1)
228 #define BSC_STATUS_TXW (1 << 2)
229 #define BSC_STATUS_RXR (1 << 3)
230 #define BSC_STATUS_TXD (1 << 4)
231 #define BSC_STATUS_RXD (1 << 5)
232 #define BSC_STATUS_TXE (1 << 6)
233 #define BSC_STATUS_RXF (1 << 7)
234 #define BSC_STATUS_ERR (1 << 8)
235 #define BSC_STATUS_CLKT (1 << 9)
237 #define BSC_READ BSC_CONTROL_I2CEN|BSC_CONTROL_ST|BSC_CONTROL_CLEAR|BSC_CONTROL_READ
238 #define BSC_WRITE BSC_CONTROL_I2CEN|BSC_CONTROL_ST
239 #define BSC_CLEAR BSC_STATUS_CLKT|BSC_STATUS_ERR|BSC_STATUS_DONE
241 #define AUX_IRQ (ARM_PERIIOBASE + 0x215000) // Auxiliary Interrupt status
242 #define AUX_ENABLES (ARM_PERIIOBASE + 0x215004) // Auxiliary enables
243 #define AUX_MU_IO_REG (ARM_PERIIOBASE + 0x215040) // AUX_MU_IO_REG Mini Uart I/O Data
244 #define AUX_MU_IER_REG (ARM_PERIIOBASE + 0x215044) // Mini Uart Interrupt Enable
245 #define AUX_MU_IIR_REG (ARM_PERIIOBASE + 0x215048) // Mini Uart Interrupt Identify
246 #define AUX_MU_LCR_REG (ARM_PERIIOBASE + 0x21504C) // Mini Uart Line Control
247 #define AUX_MU_MCR_REG (ARM_PERIIOBASE + 0x215050) // Mini Uart Modem Control
248 #define AUX_MU_LSR_REG (ARM_PERIIOBASE + 0x215054) // Mini Uart Line Status
249 #define AUX_MU_MSR_REG (ARM_PERIIOBASE + 0x215058) // Mini Uart Modem Status
250 #define AUX_MU_SCRATCH (ARM_PERIIOBASE + 0x21505C) // Mini Uart Scratch
251 #define AUX_MU_CNTL_REG (ARM_PERIIOBASE + 0x215060) // Mini Uart Extra Control
252 #define AUX_MU_STAT_REG (ARM_PERIIOBASE + 0x215064) // Mini Uart Extra Status
253 #define AUX_MU_BAUD_REG (ARM_PERIIOBASE + 0x215068) // Mini Uart Baudrate
254 #define AUX_SPI0_CNTL0_REG (ARM_PERIIOBASE + 0x215080) // SPI 1 Control register 0
255 #define AUX_SPI0_CNTL1_REG (ARM_PERIIOBASE + 0x215084) // SPI 1 Control register 1
256 #define AUX_SPI0_STAT_REG (ARM_PERIIOBASE + 0x215088) // SPI 1 Status
257 #define AUX_SPI0_IO_REG (ARM_PERIIOBASE + 0x215090) // SPI 1 Data
258 #define AUX_SPI0_PEEK_REG (ARM_PERIIOBASE + 0x215094) // SPI 1 Peek
259 #define AUX_SPI1_CNTL0_REG (ARM_PERIIOBASE + 0x2150C0) // SPI 2 Control register 0
260 #define AUX_SPI1_CNTL1_REG (ARM_PERIIOBASE + 0x2150C4) // SPI 2 Control register 1
261 #define AUX_SPI1_STAT_REG (ARM_PERIIOBASE + 0x2150C8) // SPI 2 Status
262 #define AUX_SPI1_IO_REG (ARM_PERIIOBASE + 0x2150D0) // SPI 2 Data
263 #define AUX_SPI1_PEEK_REG (ARM_PERIIOBASE + 0x2150D4) // SPI 2 Peek
264 #endif
265 #endif /* BCM2835_H */