Commit f4733a0764741966a5e842968166b40fb062d577
1 parent
b05dcb58fe
Exists in
master
and in
55 other branches
Add port initialization for digital I/O on INKA4x0
Showing 5 changed files with 59 additions and 17 deletions Side-by-side Diff
CHANGELOG
board/inka4x0/inka4x0.c
... | ... | @@ -43,13 +43,11 @@ |
43 | 43 | long hi_addr_bit = hi_addr ? 0x01000000 : 0; |
44 | 44 | |
45 | 45 | /* unlock mode register */ |
46 | - *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | | |
47 | - hi_addr_bit; | |
46 | + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000000 | hi_addr_bit; | |
48 | 47 | __asm__ volatile ("sync"); |
49 | 48 | |
50 | 49 | /* precharge all banks */ |
51 | - *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | | |
52 | - hi_addr_bit; | |
50 | + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; | |
53 | 51 | __asm__ volatile ("sync"); |
54 | 52 | |
55 | 53 | #if SDRAM_DDR |
56 | 54 | |
... | ... | @@ -63,13 +61,11 @@ |
63 | 61 | #endif |
64 | 62 | |
65 | 63 | /* precharge all banks */ |
66 | - *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | | |
67 | - hi_addr_bit; | |
64 | + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000002 | hi_addr_bit; | |
68 | 65 | __asm__ volatile ("sync"); |
69 | 66 | |
70 | 67 | /* auto refresh */ |
71 | - *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | | |
72 | - hi_addr_bit; | |
68 | + *(vu_long *)MPC5XXX_SDRAM_CTRL = SDRAM_CONTROL | 0x80000004 | hi_addr_bit; | |
73 | 69 | __asm__ volatile ("sync"); |
74 | 70 | |
75 | 71 | /* set mode register */ |
76 | 72 | |
77 | 73 | |
78 | 74 | |
79 | 75 | |
... | ... | @@ -177,27 +173,51 @@ |
177 | 173 | *(vu_long *)MPC5XXX_BOOTCS_CFG &= ~0x1; /* clear RO */ |
178 | 174 | } |
179 | 175 | |
180 | -#define GPIO_PSC3_9 0x04000000UL | |
176 | +#define GPIO_PSC3_9 0x04000000UL | |
181 | 177 | |
182 | 178 | int misc_init_f (void) |
183 | 179 | { |
180 | + /* Initialize GPIO output pins. | |
181 | + */ | |
182 | + /* Configure GPT as GPIO output */ | |
183 | + *(vu_long *)MPC5XXX_GPT0_ENABLE = | |
184 | + *(vu_long *)MPC5XXX_GPT1_ENABLE = | |
185 | + *(vu_long *)MPC5XXX_GPT2_ENABLE = | |
186 | + *(vu_long *)MPC5XXX_GPT3_ENABLE = | |
187 | + *(vu_long *)MPC5XXX_GPT4_ENABLE = | |
188 | + *(vu_long *)MPC5XXX_GPT5_ENABLE = 0x24; | |
189 | + | |
190 | + | |
191 | + /* Configure PSC3_6,7 as GPIO output */ | |
192 | + *(vu_long *)MPC5XXX_GPIO_ENABLE |= 0x00003000; | |
193 | + *(vu_long *)MPC5XXX_GPIO_DIR |= 0x00003000; | |
194 | + | |
195 | + /* Configure PSC3_8 as GPIO output, no interrupt */ | |
196 | + *(vu_long *)MPC5XXX_GPIO_SI_ENABLE |= 0x04000000; | |
197 | + *(vu_long *)MPC5XXX_GPIO_SI_DIR |= 0x04000000; | |
198 | + *(vu_long *)MPC5XXX_GPIO_SI_IEN &= ~0x04000000; | |
199 | + | |
200 | + /* Configure PSC3_9 and GPIO_WKUP6,7 as GPIO output */ | |
201 | + *(vu_long *)MPC5XXX_WU_GPIO_ENABLE |= 0xc4000000; | |
202 | + *(vu_long *)MPC5XXX_WU_GPIO_DIR |= 0xc4000000; | |
203 | + | |
184 | 204 | /* |
185 | 205 | * Reset Coral-P graphics controller |
186 | 206 | */ |
187 | - *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9; | |
188 | - *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC3_9; | |
189 | - *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC3_9; | |
190 | - return 0; | |
207 | + *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC3_9; | |
208 | + *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC3_9; | |
209 | + *(vu_long *) MPC5XXX_WU_GPIO_DATA |= GPIO_PSC3_9; | |
210 | + return 0; | |
191 | 211 | } |
192 | 212 | |
193 | -#ifdef CONFIG_PCI | |
213 | +#ifdef CONFIG_PCI | |
194 | 214 | static struct pci_controller hose; |
195 | 215 | |
196 | 216 | extern void pci_mpc5xxx_init(struct pci_controller *); |
197 | 217 | |
198 | 218 | void pci_init_board(void) |
199 | 219 | { |
200 | - pci_mpc5xxx_init(&hose); | |
220 | + pci_mpc5xxx_init(&hose); | |
201 | 221 | } |
202 | 222 | #endif |
203 | 223 | |
... | ... | @@ -209,7 +229,7 @@ |
209 | 229 | { |
210 | 230 | debug ("init_ide_reset\n"); |
211 | 231 | |
212 | - /* Configure PSC1_4 as GPIO output for ATA reset */ | |
232 | + /* Configure PSC1_4 as GPIO output for ATA reset */ | |
213 | 233 | *(vu_long *) MPC5XXX_WU_GPIO_ENABLE |= GPIO_PSC1_4; |
214 | 234 | *(vu_long *) MPC5XXX_WU_GPIO_DIR |= GPIO_PSC1_4; |
215 | 235 | /* Deassert reset */ |
common/cmd_ide.c
include/configs/inka4x0.h
... | ... | @@ -274,6 +274,11 @@ |
274 | 274 | #define CFG_CS2_SIZE 0x0001000 |
275 | 275 | #define CFG_CS2_CFG 0x21800 /* for pci_clk = 33 MHz */ |
276 | 276 | |
277 | +/* GPIO in @0x30400000 */ | |
278 | +#define CFG_CS3_START 0x30400000 | |
279 | +#define CFG_CS3_SIZE 0x00100000 | |
280 | +#define CFG_CS3_CFG 0x31800 /* for pci_clk = 33 MHz */ | |
281 | + | |
277 | 282 | #define CFG_CS_BURST 0x00000000 |
278 | 283 | #define CFG_CS_DEADCYCLE 0x33333333 |
279 | 284 |
include/mpc5xxx.h
... | ... | @@ -233,6 +233,21 @@ |
233 | 233 | /* General Purpose Timers registers */ |
234 | 234 | #define MPC5XXX_GPT0_ENABLE (MPC5XXX_GPT + 0x0) |
235 | 235 | #define MPC5XXX_GPT0_COUNTER (MPC5XXX_GPT + 0x4) |
236 | +#define MPC5XXX_GPT1_ENABLE (MPC5XXX_GPT + 0x10) | |
237 | +#define MPC5XXX_GPT1_COUNTER (MPC5XXX_GPT + 0x14) | |
238 | +#define MPC5XXX_GPT2_ENABLE (MPC5XXX_GPT + 0x20) | |
239 | +#define MPC5XXX_GPT2_COUNTER (MPC5XXX_GPT + 0x24) | |
240 | +#define MPC5XXX_GPT3_ENABLE (MPC5XXX_GPT + 0x30) | |
241 | +#define MPC5XXX_GPT3_COUNTER (MPC5XXX_GPT + 0x34) | |
242 | +#define MPC5XXX_GPT4_ENABLE (MPC5XXX_GPT + 0x40) | |
243 | +#define MPC5XXX_GPT4_COUNTER (MPC5XXX_GPT + 0x44) | |
244 | +#define MPC5XXX_GPT5_ENABLE (MPC5XXX_GPT + 0x50) | |
245 | +#define MPC5XXX_GPT5_COUNTER (MPC5XXX_GPT + 0x54) | |
246 | +#define MPC5XXX_GPT6_ENABLE (MPC5XXX_GPT + 0x60) | |
247 | +#define MPC5XXX_GPT6_COUNTER (MPC5XXX_GPT + 0x64) | |
248 | +#define MPC5XXX_GPT7_ENABLE (MPC5XXX_GPT + 0x70) | |
249 | +#define MPC5XXX_GPT7_COUNTER (MPC5XXX_GPT + 0x74) | |
250 | + | |
236 | 251 | |
237 | 252 | /* ATA registers */ |
238 | 253 | #define MPC5XXX_ATA_HOST_CONFIG (MPC5XXX_ATA + 0x0000) |