Commit da9971d1b3bdb554d4a4ac948119f8b2616bbcce
Committed by
Tom Rini
1 parent
ef0f2f5752
Exists in
v2017.01-smarct4x
and in
34 other branches
Revert "sunxi/nand: Add support to the SPL for loading u-boot from internal NAND memory"
This reverts commit f76eba38b3eda905ff3bdc18dd1240d3dcbc6e5a. This patch did not have a full and proper copyright/S-o-b chain. Signed-off-by: Ian Campbell <ijc@hellion.org.uk> Conflicts: include/configs/sun6i.h include/configs/sun8i.h
Showing 13 changed files with 2 additions and 415 deletions Inline Diff
- arch/arm/cpu/armv7/sunxi/board.c
- arch/arm/include/asm/arch-sunxi/gpio.h
- arch/arm/include/asm/arch-sunxi/nand.h
- board/sunxi/Kconfig
- board/sunxi/board.c
- drivers/mtd/nand/Makefile
- drivers/mtd/nand/sunxi_nand_spl.c
- include/configs/sun4i.h
- include/configs/sun5i.h
- include/configs/sun6i.h
- include/configs/sun7i.h
- include/configs/sun8i.h
- include/configs/sunxi-common.h
arch/arm/cpu/armv7/sunxi/board.c
1 | /* | 1 | /* |
2 | * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * | 3 | * |
4 | * (C) Copyright 2007-2011 | 4 | * (C) Copyright 2007-2011 |
5 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | 5 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> |
6 | * Tom Cubie <tangliang@allwinnertech.com> | 6 | * Tom Cubie <tangliang@allwinnertech.com> |
7 | * | 7 | * |
8 | * Some init for sunxi platform. | 8 | * Some init for sunxi platform. |
9 | * | 9 | * |
10 | * SPDX-License-Identifier: GPL-2.0+ | 10 | * SPDX-License-Identifier: GPL-2.0+ |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <common.h> | 13 | #include <common.h> |
14 | #include <i2c.h> | 14 | #include <i2c.h> |
15 | #include <serial.h> | 15 | #include <serial.h> |
16 | #ifdef CONFIG_SPL_BUILD | 16 | #ifdef CONFIG_SPL_BUILD |
17 | #include <spl.h> | 17 | #include <spl.h> |
18 | #endif | 18 | #endif |
19 | #include <asm/gpio.h> | 19 | #include <asm/gpio.h> |
20 | #include <asm/io.h> | 20 | #include <asm/io.h> |
21 | #include <asm/arch/clock.h> | 21 | #include <asm/arch/clock.h> |
22 | #include <asm/arch/gpio.h> | 22 | #include <asm/arch/gpio.h> |
23 | #include <asm/arch/sys_proto.h> | 23 | #include <asm/arch/sys_proto.h> |
24 | #include <asm/arch/timer.h> | 24 | #include <asm/arch/timer.h> |
25 | 25 | ||
26 | #include <linux/compiler.h> | 26 | #include <linux/compiler.h> |
27 | 27 | ||
28 | struct fel_stash { | 28 | struct fel_stash { |
29 | uint32_t sp; | 29 | uint32_t sp; |
30 | uint32_t lr; | 30 | uint32_t lr; |
31 | uint32_t cpsr; | 31 | uint32_t cpsr; |
32 | uint32_t sctlr; | 32 | uint32_t sctlr; |
33 | uint32_t vbar; | 33 | uint32_t vbar; |
34 | uint32_t cr; | 34 | uint32_t cr; |
35 | }; | 35 | }; |
36 | 36 | ||
37 | struct fel_stash fel_stash __attribute__((section(".data"))); | 37 | struct fel_stash fel_stash __attribute__((section(".data"))); |
38 | 38 | ||
39 | static int gpio_init(void) | 39 | static int gpio_init(void) |
40 | { | 40 | { |
41 | #if CONFIG_CONS_INDEX == 1 && defined(CONFIG_UART0_PORT_F) | 41 | #if CONFIG_CONS_INDEX == 1 && defined(CONFIG_UART0_PORT_F) |
42 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 42 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
43 | /* disable GPB22,23 as uart0 tx,rx to avoid conflict */ | 43 | /* disable GPB22,23 as uart0 tx,rx to avoid conflict */ |
44 | sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUNXI_GPIO_INPUT); | 44 | sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUNXI_GPIO_INPUT); |
45 | sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUNXI_GPIO_INPUT); | 45 | sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUNXI_GPIO_INPUT); |
46 | #endif | 46 | #endif |
47 | #if defined(CONFIG_MACH_SUN8I) | 47 | #if defined(CONFIG_MACH_SUN8I) |
48 | sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUN8I_GPF_UART0_TX); | 48 | sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUN8I_GPF_UART0_TX); |
49 | sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUN8I_GPF_UART0_RX); | 49 | sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUN8I_GPF_UART0_RX); |
50 | #else | 50 | #else |
51 | sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUNXI_GPF_UART0_TX); | 51 | sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUNXI_GPF_UART0_TX); |
52 | sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUNXI_GPF_UART0_RX); | 52 | sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUNXI_GPF_UART0_RX); |
53 | #endif | 53 | #endif |
54 | sunxi_gpio_set_pull(SUNXI_GPF(4), 1); | 54 | sunxi_gpio_set_pull(SUNXI_GPF(4), 1); |
55 | #elif CONFIG_CONS_INDEX == 1 && (defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)) | 55 | #elif CONFIG_CONS_INDEX == 1 && (defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I)) |
56 | sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB_UART0); | 56 | sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB_UART0); |
57 | sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB_UART0); | 57 | sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB_UART0); |
58 | sunxi_gpio_set_pull(SUNXI_GPB(23), SUNXI_GPIO_PULL_UP); | 58 | sunxi_gpio_set_pull(SUNXI_GPB(23), SUNXI_GPIO_PULL_UP); |
59 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN5I) | 59 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN5I) |
60 | sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN5I_GPB_UART0); | 60 | sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN5I_GPB_UART0); |
61 | sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN5I_GPB_UART0); | 61 | sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN5I_GPB_UART0); |
62 | sunxi_gpio_set_pull(SUNXI_GPB(20), SUNXI_GPIO_PULL_UP); | 62 | sunxi_gpio_set_pull(SUNXI_GPB(20), SUNXI_GPIO_PULL_UP); |
63 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN6I) | 63 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN6I) |
64 | sunxi_gpio_set_cfgpin(SUNXI_GPH(20), SUN6I_GPH_UART0); | 64 | sunxi_gpio_set_cfgpin(SUNXI_GPH(20), SUN6I_GPH_UART0); |
65 | sunxi_gpio_set_cfgpin(SUNXI_GPH(21), SUN6I_GPH_UART0); | 65 | sunxi_gpio_set_cfgpin(SUNXI_GPH(21), SUN6I_GPH_UART0); |
66 | sunxi_gpio_set_pull(SUNXI_GPH(21), SUNXI_GPIO_PULL_UP); | 66 | sunxi_gpio_set_pull(SUNXI_GPH(21), SUNXI_GPIO_PULL_UP); |
67 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I) | 67 | #elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN9I) |
68 | sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0); | 68 | sunxi_gpio_set_cfgpin(SUNXI_GPH(12), SUN9I_GPH_UART0); |
69 | sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0); | 69 | sunxi_gpio_set_cfgpin(SUNXI_GPH(13), SUN9I_GPH_UART0); |
70 | sunxi_gpio_set_pull(SUNXI_GPH(13), SUNXI_GPIO_PULL_UP); | 70 | sunxi_gpio_set_pull(SUNXI_GPH(13), SUNXI_GPIO_PULL_UP); |
71 | #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) | 71 | #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) |
72 | sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1); | 72 | sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1); |
73 | sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1); | 73 | sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1); |
74 | sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP); | 74 | sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP); |
75 | #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) | 75 | #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) |
76 | sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN8I_GPB_UART2); | 76 | sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN8I_GPB_UART2); |
77 | sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN8I_GPB_UART2); | 77 | sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN8I_GPB_UART2); |
78 | sunxi_gpio_set_pull(SUNXI_GPB(1), SUNXI_GPIO_PULL_UP); | 78 | sunxi_gpio_set_pull(SUNXI_GPB(1), SUNXI_GPIO_PULL_UP); |
79 | #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) | 79 | #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) |
80 | sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART); | 80 | sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART); |
81 | sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART); | 81 | sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART); |
82 | sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP); | 82 | sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP); |
83 | #else | 83 | #else |
84 | #error Unsupported console port number. Please fix pin mux settings in board.c | 84 | #error Unsupported console port number. Please fix pin mux settings in board.c |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | return 0; | 87 | return 0; |
88 | } | 88 | } |
89 | 89 | ||
90 | void spl_board_load_image(void) | 90 | void spl_board_load_image(void) |
91 | { | 91 | { |
92 | debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr); | 92 | debug("Returning to FEL sp=%x, lr=%x\n", fel_stash.sp, fel_stash.lr); |
93 | return_to_fel(fel_stash.sp, fel_stash.lr); | 93 | return_to_fel(fel_stash.sp, fel_stash.lr); |
94 | } | 94 | } |
95 | 95 | ||
96 | void s_init(void) | 96 | void s_init(void) |
97 | { | 97 | { |
98 | #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_A23 | 98 | #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_A23 |
99 | /* Magic (undocmented) value taken from boot0, without this DRAM | 99 | /* Magic (undocmented) value taken from boot0, without this DRAM |
100 | * access gets messed up (seems cache related) */ | 100 | * access gets messed up (seems cache related) */ |
101 | setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800); | 101 | setbits_le32(SUNXI_SRAMC_BASE + 0x44, 0x1800); |
102 | #endif | 102 | #endif |
103 | #if defined CONFIG_MACH_SUN6I || \ | 103 | #if defined CONFIG_MACH_SUN6I || \ |
104 | defined CONFIG_MACH_SUN7I || \ | 104 | defined CONFIG_MACH_SUN7I || \ |
105 | defined CONFIG_MACH_SUN8I | 105 | defined CONFIG_MACH_SUN8I |
106 | /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ | 106 | /* Enable SMP mode for CPU0, by setting bit 6 of Auxiliary Ctl reg */ |
107 | asm volatile( | 107 | asm volatile( |
108 | "mrc p15, 0, r0, c1, c0, 1\n" | 108 | "mrc p15, 0, r0, c1, c0, 1\n" |
109 | "orr r0, r0, #1 << 6\n" | 109 | "orr r0, r0, #1 << 6\n" |
110 | "mcr p15, 0, r0, c1, c0, 1\n"); | 110 | "mcr p15, 0, r0, c1, c0, 1\n"); |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | clock_init(); | 113 | clock_init(); |
114 | timer_init(); | 114 | timer_init(); |
115 | gpio_init(); | 115 | gpio_init(); |
116 | i2c_init_board(); | 116 | i2c_init_board(); |
117 | } | 117 | } |
118 | 118 | ||
119 | #ifdef CONFIG_SPL_BUILD | 119 | #ifdef CONFIG_SPL_BUILD |
120 | /* The sunxi internal brom will try to loader external bootloader | 120 | /* The sunxi internal brom will try to loader external bootloader |
121 | * from mmc0, nand flash, mmc2. | 121 | * from mmc0, nand flash, mmc2. |
122 | * | 122 | * Unfortunately we can't check how SPL was loaded so assume |
123 | * Unfortunately we can't check how SPL was loaded so assume it's | 123 | * it's always the first SD/MMC controller |
124 | * always the first SD/MMC controller, unless it was explicitly | ||
125 | * stated that SPL is on nand flash. | ||
126 | */ | 124 | */ |
127 | u32 spl_boot_device(void) | 125 | u32 spl_boot_device(void) |
128 | { | 126 | { |
129 | #if defined(CONFIG_SPL_NAND_SUPPORT) | ||
130 | /* | 127 | /* |
131 | * This is compile time configuration informing SPL, that it | ||
132 | * was loaded from nand flash. | ||
133 | */ | ||
134 | return BOOT_DEVICE_NAND; | ||
135 | #else | ||
136 | /* | ||
137 | * When booting from the SD card, the "eGON.BT0" signature is expected | 128 | * When booting from the SD card, the "eGON.BT0" signature is expected |
138 | * to be found in memory at the address 0x0004 (see the "mksunxiboot" | 129 | * to be found in memory at the address 0x0004 (see the "mksunxiboot" |
139 | * tool, which generates this header). | 130 | * tool, which generates this header). |
140 | * | 131 | * |
141 | * When booting in the FEL mode over USB, this signature is patched in | 132 | * When booting in the FEL mode over USB, this signature is patched in |
142 | * memory and replaced with something else by the 'fel' tool. This other | 133 | * memory and replaced with something else by the 'fel' tool. This other |
143 | * signature is selected in such a way, that it can't be present in a | 134 | * signature is selected in such a way, that it can't be present in a |
144 | * valid bootable SD card image (because the BROM would refuse to | 135 | * valid bootable SD card image (because the BROM would refuse to |
145 | * execute the SPL in this case). | 136 | * execute the SPL in this case). |
146 | * | 137 | * |
147 | * This branch is just making a decision at runtime whether to load | 138 | * This branch is just making a decision at runtime whether to load |
148 | * the main u-boot binary from the SD card (if the "eGON.BT0" signature | 139 | * the main u-boot binary from the SD card (if the "eGON.BT0" signature |
149 | * is found) or return to the FEL code in the BROM to wait and receive | 140 | * is found) or return to the FEL code in the BROM to wait and receive |
150 | * the main u-boot binary over USB. | 141 | * the main u-boot binary over USB. |
151 | */ | 142 | */ |
152 | if (readl(4) == 0x4E4F4765 && readl(8) == 0x3054422E) /* eGON.BT0 */ | 143 | if (readl(4) == 0x4E4F4765 && readl(8) == 0x3054422E) /* eGON.BT0 */ |
153 | return BOOT_DEVICE_MMC1; | 144 | return BOOT_DEVICE_MMC1; |
154 | else | 145 | else |
155 | return BOOT_DEVICE_BOARD; | 146 | return BOOT_DEVICE_BOARD; |
156 | #endif | ||
157 | } | 147 | } |
158 | 148 | ||
159 | /* No confirmation data available in SPL yet. Hardcode bootmode */ | 149 | /* No confirmation data available in SPL yet. Hardcode bootmode */ |
160 | u32 spl_boot_mode(void) | 150 | u32 spl_boot_mode(void) |
161 | { | 151 | { |
162 | return MMCSD_MODE_RAW; | 152 | return MMCSD_MODE_RAW; |
163 | } | 153 | } |
164 | 154 | ||
165 | void board_init_f(ulong dummy) | 155 | void board_init_f(ulong dummy) |
166 | { | 156 | { |
167 | preloader_console_init(); | 157 | preloader_console_init(); |
168 | 158 | ||
169 | #ifdef CONFIG_SPL_I2C_SUPPORT | 159 | #ifdef CONFIG_SPL_I2C_SUPPORT |
170 | /* Needed early by sunxi_board_init if PMU is enabled */ | 160 | /* Needed early by sunxi_board_init if PMU is enabled */ |
171 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); | 161 | i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); |
172 | #endif | 162 | #endif |
173 | sunxi_board_init(); | 163 | sunxi_board_init(); |
174 | 164 | ||
175 | /* Clear the BSS. */ | 165 | /* Clear the BSS. */ |
176 | memset(__bss_start, 0, __bss_end - __bss_start); | 166 | memset(__bss_start, 0, __bss_end - __bss_start); |
177 | 167 | ||
178 | board_init_r(NULL, 0); | 168 | board_init_r(NULL, 0); |
179 | } | 169 | } |
180 | #endif | 170 | #endif |
181 | 171 | ||
182 | void reset_cpu(ulong addr) | 172 | void reset_cpu(ulong addr) |
183 | { | 173 | { |
184 | #ifdef CONFIG_SUNXI_GEN_SUN4I | 174 | #ifdef CONFIG_SUNXI_GEN_SUN4I |
185 | static const struct sunxi_wdog *wdog = | 175 | static const struct sunxi_wdog *wdog = |
186 | &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog; | 176 | &((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog; |
187 | 177 | ||
188 | /* Set the watchdog for its shortest interval (.5s) and wait */ | 178 | /* Set the watchdog for its shortest interval (.5s) and wait */ |
189 | writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode); | 179 | writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode); |
190 | writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl); | 180 | writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl); |
191 | 181 | ||
192 | while (1) { | 182 | while (1) { |
193 | /* sun5i sometimes gets stuck without this */ | 183 | /* sun5i sometimes gets stuck without this */ |
194 | writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode); | 184 | writel(WDT_MODE_RESET_EN | WDT_MODE_EN, &wdog->mode); |
195 | } | 185 | } |
196 | #endif | 186 | #endif |
197 | #ifdef CONFIG_SUNXI_GEN_SUN6I | 187 | #ifdef CONFIG_SUNXI_GEN_SUN6I |
198 | static const struct sunxi_wdog *wdog = | 188 | static const struct sunxi_wdog *wdog = |
199 | ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog; | 189 | ((struct sunxi_timer_reg *)SUNXI_TIMER_BASE)->wdog; |
200 | 190 | ||
201 | /* Set the watchdog for its shortest interval (.5s) and wait */ | 191 | /* Set the watchdog for its shortest interval (.5s) and wait */ |
202 | writel(WDT_CFG_RESET, &wdog->cfg); | 192 | writel(WDT_CFG_RESET, &wdog->cfg); |
203 | writel(WDT_MODE_EN, &wdog->mode); | 193 | writel(WDT_MODE_EN, &wdog->mode); |
204 | writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl); | 194 | writel(WDT_CTRL_KEY | WDT_CTRL_RESTART, &wdog->ctl); |
205 | while (1) { } | 195 | while (1) { } |
206 | #endif | 196 | #endif |
207 | } | 197 | } |
208 | 198 | ||
209 | #ifndef CONFIG_SYS_DCACHE_OFF | 199 | #ifndef CONFIG_SYS_DCACHE_OFF |
210 | void enable_caches(void) | 200 | void enable_caches(void) |
211 | { | 201 | { |
212 | /* Enable D-cache. I-cache is already enabled in start.S */ | 202 | /* Enable D-cache. I-cache is already enabled in start.S */ |
213 | dcache_enable(); | 203 | dcache_enable(); |
214 | } | 204 | } |
215 | #endif | 205 | #endif |
216 | 206 | ||
217 | #ifdef CONFIG_CMD_NET | 207 | #ifdef CONFIG_CMD_NET |
218 | /* | 208 | /* |
219 | * Initializes on-chip ethernet controllers. | 209 | * Initializes on-chip ethernet controllers. |
220 | * to override, implement board_eth_init() | 210 | * to override, implement board_eth_init() |
221 | */ | 211 | */ |
222 | int cpu_eth_init(bd_t *bis) | 212 | int cpu_eth_init(bd_t *bis) |
223 | { | 213 | { |
224 | __maybe_unused int rc; | 214 | __maybe_unused int rc; |
225 | 215 | ||
226 | #ifdef CONFIG_MACPWR | 216 | #ifdef CONFIG_MACPWR |
227 | gpio_request(CONFIG_MACPWR, "macpwr"); | 217 | gpio_request(CONFIG_MACPWR, "macpwr"); |
228 | gpio_direction_output(CONFIG_MACPWR, 1); | 218 | gpio_direction_output(CONFIG_MACPWR, 1); |
229 | mdelay(200); | 219 | mdelay(200); |
230 | #endif | 220 | #endif |
231 | 221 | ||
232 | #ifdef CONFIG_SUNXI_GMAC | 222 | #ifdef CONFIG_SUNXI_GMAC |
233 | rc = sunxi_gmac_initialize(bis); | 223 | rc = sunxi_gmac_initialize(bis); |
234 | if (rc < 0) { | 224 | if (rc < 0) { |
235 | printf("sunxi: failed to initialize gmac\n"); | 225 | printf("sunxi: failed to initialize gmac\n"); |
236 | return rc; | 226 | return rc; |
237 | } | 227 | } |
238 | #endif | 228 | #endif |
239 | 229 | ||
240 | return 0; | 230 | return 0; |
241 | } | 231 | } |
242 | #endif | 232 | #endif |
243 | 233 |
arch/arm/include/asm/arch-sunxi/gpio.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2007-2012 | 2 | * (C) Copyright 2007-2012 |
3 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | 3 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> |
4 | * Tom Cubie <tangliang@allwinnertech.com> | 4 | * Tom Cubie <tangliang@allwinnertech.com> |
5 | * | 5 | * |
6 | * SPDX-License-Identifier: GPL-2.0+ | 6 | * SPDX-License-Identifier: GPL-2.0+ |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef _SUNXI_GPIO_H | 9 | #ifndef _SUNXI_GPIO_H |
10 | #define _SUNXI_GPIO_H | 10 | #define _SUNXI_GPIO_H |
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <asm/arch/cpu.h> | 13 | #include <asm/arch/cpu.h> |
14 | 14 | ||
15 | /* | 15 | /* |
16 | * sunxi has 9 banks of gpio, they are: | 16 | * sunxi has 9 banks of gpio, they are: |
17 | * PA0 - PA17 | PB0 - PB23 | PC0 - PC24 | 17 | * PA0 - PA17 | PB0 - PB23 | PC0 - PC24 |
18 | * PD0 - PD27 | PE0 - PE31 | PF0 - PF5 | 18 | * PD0 - PD27 | PE0 - PE31 | PF0 - PF5 |
19 | * PG0 - PG9 | PH0 - PH27 | PI0 - PI12 | 19 | * PG0 - PG9 | PH0 - PH27 | PI0 - PI12 |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #define SUNXI_GPIO_A 0 | 22 | #define SUNXI_GPIO_A 0 |
23 | #define SUNXI_GPIO_B 1 | 23 | #define SUNXI_GPIO_B 1 |
24 | #define SUNXI_GPIO_C 2 | 24 | #define SUNXI_GPIO_C 2 |
25 | #define SUNXI_GPIO_D 3 | 25 | #define SUNXI_GPIO_D 3 |
26 | #define SUNXI_GPIO_E 4 | 26 | #define SUNXI_GPIO_E 4 |
27 | #define SUNXI_GPIO_F 5 | 27 | #define SUNXI_GPIO_F 5 |
28 | #define SUNXI_GPIO_G 6 | 28 | #define SUNXI_GPIO_G 6 |
29 | #define SUNXI_GPIO_H 7 | 29 | #define SUNXI_GPIO_H 7 |
30 | #define SUNXI_GPIO_I 8 | 30 | #define SUNXI_GPIO_I 8 |
31 | 31 | ||
32 | /* | 32 | /* |
33 | * This defines the number of GPIO banks for the _main_ GPIO controller. | 33 | * This defines the number of GPIO banks for the _main_ GPIO controller. |
34 | * You should fix up the padding in struct sunxi_gpio_reg below if you | 34 | * You should fix up the padding in struct sunxi_gpio_reg below if you |
35 | * change this. | 35 | * change this. |
36 | */ | 36 | */ |
37 | #define SUNXI_GPIO_BANKS 9 | 37 | #define SUNXI_GPIO_BANKS 9 |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) | 40 | * sun6i/sun8i and later SoCs have an additional GPIO controller (R_PIO) |
41 | * at a different register offset. | 41 | * at a different register offset. |
42 | * | 42 | * |
43 | * sun6i has 2 banks: | 43 | * sun6i has 2 banks: |
44 | * PL0 - PL8 | PM0 - PM7 | 44 | * PL0 - PL8 | PM0 - PM7 |
45 | * | 45 | * |
46 | * sun8i has 1 bank: | 46 | * sun8i has 1 bank: |
47 | * PL0 - PL11 | 47 | * PL0 - PL11 |
48 | * | 48 | * |
49 | * sun9i has 3 banks: | 49 | * sun9i has 3 banks: |
50 | * PL0 - PL9 | PM0 - PM15 | PN0 - PN1 | 50 | * PL0 - PL9 | PM0 - PM15 | PN0 - PN1 |
51 | */ | 51 | */ |
52 | #define SUNXI_GPIO_L 11 | 52 | #define SUNXI_GPIO_L 11 |
53 | #define SUNXI_GPIO_M 12 | 53 | #define SUNXI_GPIO_M 12 |
54 | #define SUNXI_GPIO_N 13 | 54 | #define SUNXI_GPIO_N 13 |
55 | 55 | ||
56 | struct sunxi_gpio { | 56 | struct sunxi_gpio { |
57 | u32 cfg[4]; | 57 | u32 cfg[4]; |
58 | u32 dat; | 58 | u32 dat; |
59 | u32 drv[2]; | 59 | u32 drv[2]; |
60 | u32 pull[2]; | 60 | u32 pull[2]; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /* gpio interrupt control */ | 63 | /* gpio interrupt control */ |
64 | struct sunxi_gpio_int { | 64 | struct sunxi_gpio_int { |
65 | u32 cfg[3]; | 65 | u32 cfg[3]; |
66 | u32 ctl; | 66 | u32 ctl; |
67 | u32 sta; | 67 | u32 sta; |
68 | u32 deb; /* interrupt debounce */ | 68 | u32 deb; /* interrupt debounce */ |
69 | }; | 69 | }; |
70 | 70 | ||
71 | struct sunxi_gpio_reg { | 71 | struct sunxi_gpio_reg { |
72 | struct sunxi_gpio gpio_bank[SUNXI_GPIO_BANKS]; | 72 | struct sunxi_gpio gpio_bank[SUNXI_GPIO_BANKS]; |
73 | u8 res[0xbc]; | 73 | u8 res[0xbc]; |
74 | struct sunxi_gpio_int gpio_int; | 74 | struct sunxi_gpio_int gpio_int; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | #define BANK_TO_GPIO(bank) (((bank) < SUNXI_GPIO_L) ? \ | 77 | #define BANK_TO_GPIO(bank) (((bank) < SUNXI_GPIO_L) ? \ |
78 | &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ | 78 | &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank] : \ |
79 | &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_L]) | 79 | &((struct sunxi_gpio_reg *)SUNXI_R_PIO_BASE)->gpio_bank[(bank) - SUNXI_GPIO_L]) |
80 | 80 | ||
81 | #define GPIO_BANK(pin) ((pin) >> 5) | 81 | #define GPIO_BANK(pin) ((pin) >> 5) |
82 | #define GPIO_NUM(pin) ((pin) & 0x1f) | 82 | #define GPIO_NUM(pin) ((pin) & 0x1f) |
83 | 83 | ||
84 | #define GPIO_CFG_INDEX(pin) (((pin) & 0x1f) >> 3) | 84 | #define GPIO_CFG_INDEX(pin) (((pin) & 0x1f) >> 3) |
85 | #define GPIO_CFG_OFFSET(pin) ((((pin) & 0x1f) & 0x7) << 2) | 85 | #define GPIO_CFG_OFFSET(pin) ((((pin) & 0x1f) & 0x7) << 2) |
86 | 86 | ||
87 | #define GPIO_DRV_INDEX(pin) (((pin) & 0x1f) >> 4) | 87 | #define GPIO_DRV_INDEX(pin) (((pin) & 0x1f) >> 4) |
88 | #define GPIO_DRV_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) | 88 | #define GPIO_DRV_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) |
89 | 89 | ||
90 | #define GPIO_PULL_INDEX(pin) (((pin) & 0x1f) >> 4) | 90 | #define GPIO_PULL_INDEX(pin) (((pin) & 0x1f) >> 4) |
91 | #define GPIO_PULL_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) | 91 | #define GPIO_PULL_OFFSET(pin) ((((pin) & 0x1f) & 0xf) << 1) |
92 | 92 | ||
93 | /* GPIO bank sizes */ | 93 | /* GPIO bank sizes */ |
94 | #define SUNXI_GPIO_A_NR 32 | 94 | #define SUNXI_GPIO_A_NR 32 |
95 | #define SUNXI_GPIO_B_NR 32 | 95 | #define SUNXI_GPIO_B_NR 32 |
96 | #define SUNXI_GPIO_C_NR 32 | 96 | #define SUNXI_GPIO_C_NR 32 |
97 | #define SUNXI_GPIO_D_NR 32 | 97 | #define SUNXI_GPIO_D_NR 32 |
98 | #define SUNXI_GPIO_E_NR 32 | 98 | #define SUNXI_GPIO_E_NR 32 |
99 | #define SUNXI_GPIO_F_NR 32 | 99 | #define SUNXI_GPIO_F_NR 32 |
100 | #define SUNXI_GPIO_G_NR 32 | 100 | #define SUNXI_GPIO_G_NR 32 |
101 | #define SUNXI_GPIO_H_NR 32 | 101 | #define SUNXI_GPIO_H_NR 32 |
102 | #define SUNXI_GPIO_I_NR 32 | 102 | #define SUNXI_GPIO_I_NR 32 |
103 | #define SUNXI_GPIO_L_NR 32 | 103 | #define SUNXI_GPIO_L_NR 32 |
104 | #define SUNXI_GPIO_M_NR 32 | 104 | #define SUNXI_GPIO_M_NR 32 |
105 | 105 | ||
106 | #define SUNXI_GPIO_NEXT(__gpio) \ | 106 | #define SUNXI_GPIO_NEXT(__gpio) \ |
107 | ((__gpio##_START) + (__gpio##_NR) + 0) | 107 | ((__gpio##_START) + (__gpio##_NR) + 0) |
108 | 108 | ||
109 | enum sunxi_gpio_number { | 109 | enum sunxi_gpio_number { |
110 | SUNXI_GPIO_A_START = 0, | 110 | SUNXI_GPIO_A_START = 0, |
111 | SUNXI_GPIO_B_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_A), | 111 | SUNXI_GPIO_B_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_A), |
112 | SUNXI_GPIO_C_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_B), | 112 | SUNXI_GPIO_C_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_B), |
113 | SUNXI_GPIO_D_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_C), | 113 | SUNXI_GPIO_D_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_C), |
114 | SUNXI_GPIO_E_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_D), | 114 | SUNXI_GPIO_E_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_D), |
115 | SUNXI_GPIO_F_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_E), | 115 | SUNXI_GPIO_F_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_E), |
116 | SUNXI_GPIO_G_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_F), | 116 | SUNXI_GPIO_G_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_F), |
117 | SUNXI_GPIO_H_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_G), | 117 | SUNXI_GPIO_H_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_G), |
118 | SUNXI_GPIO_I_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_H), | 118 | SUNXI_GPIO_I_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_H), |
119 | SUNXI_GPIO_L_START = 352, | 119 | SUNXI_GPIO_L_START = 352, |
120 | SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), | 120 | SUNXI_GPIO_M_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_L), |
121 | SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M), | 121 | SUNXI_GPIO_N_START = SUNXI_GPIO_NEXT(SUNXI_GPIO_M), |
122 | SUNXI_GPIO_AXP0_START = 1024, | 122 | SUNXI_GPIO_AXP0_START = 1024, |
123 | }; | 123 | }; |
124 | 124 | ||
125 | /* SUNXI GPIO number definitions */ | 125 | /* SUNXI GPIO number definitions */ |
126 | #define SUNXI_GPA(_nr) (SUNXI_GPIO_A_START + (_nr)) | 126 | #define SUNXI_GPA(_nr) (SUNXI_GPIO_A_START + (_nr)) |
127 | #define SUNXI_GPB(_nr) (SUNXI_GPIO_B_START + (_nr)) | 127 | #define SUNXI_GPB(_nr) (SUNXI_GPIO_B_START + (_nr)) |
128 | #define SUNXI_GPC(_nr) (SUNXI_GPIO_C_START + (_nr)) | 128 | #define SUNXI_GPC(_nr) (SUNXI_GPIO_C_START + (_nr)) |
129 | #define SUNXI_GPD(_nr) (SUNXI_GPIO_D_START + (_nr)) | 129 | #define SUNXI_GPD(_nr) (SUNXI_GPIO_D_START + (_nr)) |
130 | #define SUNXI_GPE(_nr) (SUNXI_GPIO_E_START + (_nr)) | 130 | #define SUNXI_GPE(_nr) (SUNXI_GPIO_E_START + (_nr)) |
131 | #define SUNXI_GPF(_nr) (SUNXI_GPIO_F_START + (_nr)) | 131 | #define SUNXI_GPF(_nr) (SUNXI_GPIO_F_START + (_nr)) |
132 | #define SUNXI_GPG(_nr) (SUNXI_GPIO_G_START + (_nr)) | 132 | #define SUNXI_GPG(_nr) (SUNXI_GPIO_G_START + (_nr)) |
133 | #define SUNXI_GPH(_nr) (SUNXI_GPIO_H_START + (_nr)) | 133 | #define SUNXI_GPH(_nr) (SUNXI_GPIO_H_START + (_nr)) |
134 | #define SUNXI_GPI(_nr) (SUNXI_GPIO_I_START + (_nr)) | 134 | #define SUNXI_GPI(_nr) (SUNXI_GPIO_I_START + (_nr)) |
135 | #define SUNXI_GPL(_nr) (SUNXI_GPIO_L_START + (_nr)) | 135 | #define SUNXI_GPL(_nr) (SUNXI_GPIO_L_START + (_nr)) |
136 | #define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr)) | 136 | #define SUNXI_GPM(_nr) (SUNXI_GPIO_M_START + (_nr)) |
137 | #define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr)) | 137 | #define SUNXI_GPN(_nr) (SUNXI_GPIO_N_START + (_nr)) |
138 | 138 | ||
139 | #define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr)) | 139 | #define SUNXI_GPAXP0(_nr) (SUNXI_GPIO_AXP0_START + (_nr)) |
140 | 140 | ||
141 | /* GPIO pin function config */ | 141 | /* GPIO pin function config */ |
142 | #define SUNXI_GPIO_INPUT 0 | 142 | #define SUNXI_GPIO_INPUT 0 |
143 | #define SUNXI_GPIO_OUTPUT 1 | 143 | #define SUNXI_GPIO_OUTPUT 1 |
144 | 144 | ||
145 | #define SUNXI_GPA_EMAC 2 | 145 | #define SUNXI_GPA_EMAC 2 |
146 | #define SUN6I_GPA_GMAC 2 | 146 | #define SUN6I_GPA_GMAC 2 |
147 | #define SUN7I_GPA_GMAC 5 | 147 | #define SUN7I_GPA_GMAC 5 |
148 | #define SUN6I_GPA_SDC2 5 | 148 | #define SUN6I_GPA_SDC2 5 |
149 | #define SUN6I_GPA_SDC3 4 | 149 | #define SUN6I_GPA_SDC3 4 |
150 | 150 | ||
151 | #define SUN4I_GPB_TWI0 2 | 151 | #define SUN4I_GPB_TWI0 2 |
152 | #define SUN4I_GPB_TWI1 2 | 152 | #define SUN4I_GPB_TWI1 2 |
153 | #define SUN5I_GPB_TWI1 2 | 153 | #define SUN5I_GPB_TWI1 2 |
154 | #define SUN4I_GPB_TWI2 2 | 154 | #define SUN4I_GPB_TWI2 2 |
155 | #define SUN5I_GPB_TWI2 2 | 155 | #define SUN5I_GPB_TWI2 2 |
156 | #define SUN4I_GPB_UART0 2 | 156 | #define SUN4I_GPB_UART0 2 |
157 | #define SUN5I_GPB_UART0 2 | 157 | #define SUN5I_GPB_UART0 2 |
158 | #define SUN8I_GPB_UART2 2 | 158 | #define SUN8I_GPB_UART2 2 |
159 | 159 | ||
160 | #define SUNXI_GPC_NAND 2 | ||
161 | |||
162 | #define SUNXI_GPC_SDC2 3 | 160 | #define SUNXI_GPC_SDC2 3 |
163 | #define SUN6I_GPC_SDC3 4 | 161 | #define SUN6I_GPC_SDC3 4 |
164 | 162 | ||
165 | #define SUN8I_GPD_SDC1 3 | 163 | #define SUN8I_GPD_SDC1 3 |
166 | #define SUNXI_GPD_LCD0 2 | 164 | #define SUNXI_GPD_LCD0 2 |
167 | #define SUNXI_GPD_LVDS0 3 | 165 | #define SUNXI_GPD_LVDS0 3 |
168 | 166 | ||
169 | #define SUN5I_GPE_SDC2 3 | 167 | #define SUN5I_GPE_SDC2 3 |
170 | #define SUN8I_GPE_TWI2 3 | 168 | #define SUN8I_GPE_TWI2 3 |
171 | 169 | ||
172 | #define SUNXI_GPF_SDC0 2 | 170 | #define SUNXI_GPF_SDC0 2 |
173 | #define SUNXI_GPF_UART0 4 | 171 | #define SUNXI_GPF_UART0 4 |
174 | #define SUN8I_GPF_UART0 3 | 172 | #define SUN8I_GPF_UART0 3 |
175 | 173 | ||
176 | #define SUN4I_GPG_SDC1 4 | 174 | #define SUN4I_GPG_SDC1 4 |
177 | #define SUN5I_GPG_SDC1 2 | 175 | #define SUN5I_GPG_SDC1 2 |
178 | #define SUN6I_GPG_SDC1 2 | 176 | #define SUN6I_GPG_SDC1 2 |
179 | #define SUN8I_GPG_SDC1 2 | 177 | #define SUN8I_GPG_SDC1 2 |
180 | #define SUN6I_GPG_TWI3 2 | 178 | #define SUN6I_GPG_TWI3 2 |
181 | #define SUN5I_GPG_UART1 4 | 179 | #define SUN5I_GPG_UART1 4 |
182 | 180 | ||
183 | #define SUN4I_GPH_SDC1 5 | 181 | #define SUN4I_GPH_SDC1 5 |
184 | #define SUN6I_GPH_TWI0 2 | 182 | #define SUN6I_GPH_TWI0 2 |
185 | #define SUN8I_GPH_TWI0 2 | 183 | #define SUN8I_GPH_TWI0 2 |
186 | #define SUN6I_GPH_TWI1 2 | 184 | #define SUN6I_GPH_TWI1 2 |
187 | #define SUN8I_GPH_TWI1 2 | 185 | #define SUN8I_GPH_TWI1 2 |
188 | #define SUN6I_GPH_TWI2 2 | 186 | #define SUN6I_GPH_TWI2 2 |
189 | #define SUN6I_GPH_UART0 2 | 187 | #define SUN6I_GPH_UART0 2 |
190 | #define SUN9I_GPH_UART0 2 | 188 | #define SUN9I_GPH_UART0 2 |
191 | 189 | ||
192 | #define SUNXI_GPI_SDC3 2 | 190 | #define SUNXI_GPI_SDC3 2 |
193 | #define SUN7I_GPI_TWI3 3 | 191 | #define SUN7I_GPI_TWI3 3 |
194 | #define SUN7I_GPI_TWI4 3 | 192 | #define SUN7I_GPI_TWI4 3 |
195 | 193 | ||
196 | #define SUN6I_GPL0_R_P2WI_SCK 3 | 194 | #define SUN6I_GPL0_R_P2WI_SCK 3 |
197 | #define SUN6I_GPL1_R_P2WI_SDA 3 | 195 | #define SUN6I_GPL1_R_P2WI_SDA 3 |
198 | 196 | ||
199 | #define SUN8I_GPL_R_RSB 2 | 197 | #define SUN8I_GPL_R_RSB 2 |
200 | #define SUN8I_GPL_R_UART 2 | 198 | #define SUN8I_GPL_R_UART 2 |
201 | 199 | ||
202 | #define SUN9I_GPN_R_RSB 3 | 200 | #define SUN9I_GPN_R_RSB 3 |
203 | 201 | ||
204 | /* GPIO pin pull-up/down config */ | 202 | /* GPIO pin pull-up/down config */ |
205 | #define SUNXI_GPIO_PULL_DISABLE 0 | 203 | #define SUNXI_GPIO_PULL_DISABLE 0 |
206 | #define SUNXI_GPIO_PULL_UP 1 | 204 | #define SUNXI_GPIO_PULL_UP 1 |
207 | #define SUNXI_GPIO_PULL_DOWN 2 | 205 | #define SUNXI_GPIO_PULL_DOWN 2 |
208 | 206 | ||
209 | /* Virtual AXP0 GPIOs */ | 207 | /* Virtual AXP0 GPIOs */ |
210 | #define SUNXI_GPIO_AXP0_PREFIX "AXP0-" | 208 | #define SUNXI_GPIO_AXP0_PREFIX "AXP0-" |
211 | #define SUNXI_GPIO_AXP0_VBUS_DETECT 4 | 209 | #define SUNXI_GPIO_AXP0_VBUS_DETECT 4 |
212 | #define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 | 210 | #define SUNXI_GPIO_AXP0_VBUS_ENABLE 5 |
213 | #define SUNXI_GPIO_AXP0_GPIO_COUNT 6 | 211 | #define SUNXI_GPIO_AXP0_GPIO_COUNT 6 |
214 | 212 | ||
215 | void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val); | 213 | void sunxi_gpio_set_cfgbank(struct sunxi_gpio *pio, int bank_offset, u32 val); |
216 | void sunxi_gpio_set_cfgpin(u32 pin, u32 val); | 214 | void sunxi_gpio_set_cfgpin(u32 pin, u32 val); |
217 | int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset); | 215 | int sunxi_gpio_get_cfgbank(struct sunxi_gpio *pio, int bank_offset); |
218 | int sunxi_gpio_get_cfgpin(u32 pin); | 216 | int sunxi_gpio_get_cfgpin(u32 pin); |
219 | int sunxi_gpio_set_drv(u32 pin, u32 val); | 217 | int sunxi_gpio_set_drv(u32 pin, u32 val); |
220 | int sunxi_gpio_set_pull(u32 pin, u32 val); | 218 | int sunxi_gpio_set_pull(u32 pin, u32 val); |
221 | int sunxi_name_to_gpio_bank(const char *name); | 219 | int sunxi_name_to_gpio_bank(const char *name); |
222 | int sunxi_name_to_gpio(const char *name); | 220 | int sunxi_name_to_gpio(const char *name); |
223 | #define name_to_gpio(name) sunxi_name_to_gpio(name) | 221 | #define name_to_gpio(name) sunxi_name_to_gpio(name) |
224 | 222 | ||
225 | #if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO | 223 | #if !defined CONFIG_SPL_BUILD && defined CONFIG_AXP_GPIO |
226 | int axp_gpio_init(void); | 224 | int axp_gpio_init(void); |
227 | #else | 225 | #else |
228 | static inline int axp_gpio_init(void) { return 0; } | 226 | static inline int axp_gpio_init(void) { return 0; } |
229 | #endif | 227 | #endif |
230 | 228 | ||
231 | #endif /* _SUNXI_GPIO_H */ | 229 | #endif /* _SUNXI_GPIO_H */ |
232 | 230 |
arch/arm/include/asm/arch-sunxi/nand.h
1 | /* | File was deleted | |
2 | * (C) Copyright 2015 Roy Spliet <rspliet@ultimaker.com> | ||
3 | * | ||
4 | * SPDX-License-Identifier: GPL-2.0+ | ||
5 | */ | ||
6 | |||
7 | #ifndef _SUNXI_NAND_H | ||
8 | #define _SUNXI_NAND_H | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | |||
12 | struct sunxi_nand | ||
13 | { | ||
14 | u32 ctl; /* 0x000 Configure and control */ | ||
15 | u32 st; /* 0x004 Status information */ | ||
16 | u32 intr; /* 0x008 Interrupt control */ | ||
17 | u32 timing_ctl; /* 0x00C Timing control */ | ||
18 | u32 timing_cfg; /* 0x010 Timing configure */ | ||
19 | u32 addr_low; /* 0x014 Low word address */ | ||
20 | u32 addr_high; /* 0x018 High word address */ | ||
21 | u32 block_num; /* 0x01C Data block number */ | ||
22 | u32 data_cnt; /* 0x020 Data counter for transfer */ | ||
23 | u32 cmd; /* 0x024 NDFC commands */ | ||
24 | u32 rcmd_set; /* 0x028 Read command set for vendor NAND mem */ | ||
25 | u32 wcmd_set; /* 0x02C Write command set */ | ||
26 | u32 io_data; /* 0x030 IO data */ | ||
27 | u32 ecc_ctl; /* 0x034 ECC configure and control */ | ||
28 | u32 ecc_st; /* 0x038 ECC status and operation info */ | ||
29 | u32 efr; /* 0x03C Enhanced feature */ | ||
30 | u32 err_cnt0; /* 0x040 Corrected error bit counter 0 */ | ||
31 | u32 err_cnt1; /* 0x044 Corrected error bit counter 1 */ | ||
32 | u32 user_data[16]; /* 0x050[16] User data field */ | ||
33 | u32 efnand_st; /* 0x090 EFNAND status */ | ||
34 | u32 res0[3]; | ||
35 | u32 spare_area; /* 0x0A0 Spare area configure */ | ||
36 | u32 pat_id; /* 0x0A4 Pattern ID register */ | ||
37 | u32 rdata_sta_ctl; /* 0x0A8 Read data status control */ | ||
38 | u32 rdata_sta_0; /* 0x0AC Read data status 0 */ | ||
39 | u32 rdata_sta_1; /* 0x0B0 Read data status 1 */ | ||
40 | u32 res1[3]; | ||
41 | u32 mdma_addr; /* 0x0C0 MBUS DMA Address */ | ||
42 | u32 mdma_cnt; /* 0x0C4 MBUS DMA data counter */ | ||
43 | }; | ||
44 | |||
45 | #define SUNXI_NAND_CTL_EN (1 << 0) | ||
46 | #define SUNXI_NAND_CTL_RST (1 << 1) | ||
47 | #define SUNXI_NAND_CTL_PAGE_SIZE(a) ((fls(a) - 11) << 8) | ||
48 | #define SUNXI_NAND_CTL_RAM_METHOD_DMA (1 << 14) | ||
49 | |||
50 | #define SUNXI_NAND_ST_CMD_INT (1 << 1) | ||
51 | #define SUNXI_NAND_ST_DMA_INT (1 << 2) | ||
52 | #define SUNXI_NAND_ST_FIFO_FULL (1 << 3) | ||
53 | |||
54 | #define SUNXI_NAND_CMD_ADDR_CYCLES(a) ((a - 1) << 16); | ||
55 | #define SUNXI_NAND_CMD_SEND_CMD1 (1 << 22) | ||
56 | #define SUNXI_NAND_CMD_WAIT_FLAG (1 << 23) | ||
57 | #define SUNXI_NAND_CMD_ORDER_INTERLEAVE 0 | ||
58 | #define SUNXI_NAND_CMD_ORDER_SEQ (1 << 25) | ||
59 | |||
60 | #define SUNXI_NAND_ECC_CTL_ECC_EN (1 << 0) | ||
61 | #define SUNXI_NAND_ECC_CTL_PIPELINE (1 << 3) | ||
62 | #define SUNXI_NAND_ECC_CTL_BS_512B (1 << 5) | ||
63 | #define SUNXI_NAND_ECC_CTL_RND_EN (1 << 9) | ||
64 | #define SUNXI_NAND_ECC_CTL_MODE(a) ((a) << 12) | ||
65 | #define SUNXI_NAND_ECC_CTL_RND_SEED(a) ((a) << 16) | ||
66 | |||
67 | #endif /* _SUNXI_NAND_H */ | ||
68 | 1 | /* |
board/sunxi/Kconfig
1 | if ARCH_SUNXI | 1 | if ARCH_SUNXI |
2 | 2 | ||
3 | # Note only one of these may be selected at a time! But hidden choices are | 3 | # Note only one of these may be selected at a time! But hidden choices are |
4 | # not supported by Kconfig | 4 | # not supported by Kconfig |
5 | config SUNXI_GEN_SUN4I | 5 | config SUNXI_GEN_SUN4I |
6 | bool | 6 | bool |
7 | ---help--- | 7 | ---help--- |
8 | Select this for sunxi SoCs which have resets and clocks set up | 8 | Select this for sunxi SoCs which have resets and clocks set up |
9 | as the original A10 (mach-sun4i). | 9 | as the original A10 (mach-sun4i). |
10 | 10 | ||
11 | config SUNXI_GEN_SUN6I | 11 | config SUNXI_GEN_SUN6I |
12 | bool | 12 | bool |
13 | ---help--- | 13 | ---help--- |
14 | Select this for sunxi SoCs which have sun6i like periphery, like | 14 | Select this for sunxi SoCs which have sun6i like periphery, like |
15 | separate ahb reset control registers, custom pmic bus, new style | 15 | separate ahb reset control registers, custom pmic bus, new style |
16 | watchdog, etc. | 16 | watchdog, etc. |
17 | 17 | ||
18 | 18 | ||
19 | choice | 19 | choice |
20 | prompt "Sunxi SoC Variant" | 20 | prompt "Sunxi SoC Variant" |
21 | optional | 21 | optional |
22 | 22 | ||
23 | config MACH_SUN4I | 23 | config MACH_SUN4I |
24 | bool "sun4i (Allwinner A10)" | 24 | bool "sun4i (Allwinner A10)" |
25 | select CPU_V7 | 25 | select CPU_V7 |
26 | select SUNXI_GEN_SUN4I | 26 | select SUNXI_GEN_SUN4I |
27 | select SUPPORT_SPL | 27 | select SUPPORT_SPL |
28 | 28 | ||
29 | config MACH_SUN5I | 29 | config MACH_SUN5I |
30 | bool "sun5i (Allwinner A13)" | 30 | bool "sun5i (Allwinner A13)" |
31 | select CPU_V7 | 31 | select CPU_V7 |
32 | select SUNXI_GEN_SUN4I | 32 | select SUNXI_GEN_SUN4I |
33 | select SUPPORT_SPL | 33 | select SUPPORT_SPL |
34 | 34 | ||
35 | config MACH_SUN6I | 35 | config MACH_SUN6I |
36 | bool "sun6i (Allwinner A31)" | 36 | bool "sun6i (Allwinner A31)" |
37 | select CPU_V7 | 37 | select CPU_V7 |
38 | select CPU_V7_HAS_NONSEC | 38 | select CPU_V7_HAS_NONSEC |
39 | select CPU_V7_HAS_VIRT | 39 | select CPU_V7_HAS_VIRT |
40 | select SUNXI_GEN_SUN6I | 40 | select SUNXI_GEN_SUN6I |
41 | select SUPPORT_SPL | 41 | select SUPPORT_SPL |
42 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT | 42 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT |
43 | 43 | ||
44 | config MACH_SUN7I | 44 | config MACH_SUN7I |
45 | bool "sun7i (Allwinner A20)" | 45 | bool "sun7i (Allwinner A20)" |
46 | select CPU_V7 | 46 | select CPU_V7 |
47 | select CPU_V7_HAS_NONSEC | 47 | select CPU_V7_HAS_NONSEC |
48 | select CPU_V7_HAS_VIRT | 48 | select CPU_V7_HAS_VIRT |
49 | select SUNXI_GEN_SUN4I | 49 | select SUNXI_GEN_SUN4I |
50 | select SUPPORT_SPL | 50 | select SUPPORT_SPL |
51 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT | 51 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT |
52 | 52 | ||
53 | config MACH_SUN8I_A23 | 53 | config MACH_SUN8I_A23 |
54 | bool "sun8i (Allwinner A23)" | 54 | bool "sun8i (Allwinner A23)" |
55 | select CPU_V7 | 55 | select CPU_V7 |
56 | select CPU_V7_HAS_NONSEC | 56 | select CPU_V7_HAS_NONSEC |
57 | select CPU_V7_HAS_VIRT | 57 | select CPU_V7_HAS_VIRT |
58 | select SUNXI_GEN_SUN6I | 58 | select SUNXI_GEN_SUN6I |
59 | select SUPPORT_SPL | 59 | select SUPPORT_SPL |
60 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT | 60 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT |
61 | 61 | ||
62 | config MACH_SUN8I_A33 | 62 | config MACH_SUN8I_A33 |
63 | bool "sun8i (Allwinner A33)" | 63 | bool "sun8i (Allwinner A33)" |
64 | select CPU_V7 | 64 | select CPU_V7 |
65 | select CPU_V7_HAS_NONSEC | 65 | select CPU_V7_HAS_NONSEC |
66 | select CPU_V7_HAS_VIRT | 66 | select CPU_V7_HAS_VIRT |
67 | select SUNXI_GEN_SUN6I | 67 | select SUNXI_GEN_SUN6I |
68 | select SUPPORT_SPL | 68 | select SUPPORT_SPL |
69 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT | 69 | select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT |
70 | 70 | ||
71 | config MACH_SUN9I | 71 | config MACH_SUN9I |
72 | bool "sun9i (Allwinner A80)" | 72 | bool "sun9i (Allwinner A80)" |
73 | select CPU_V7 | 73 | select CPU_V7 |
74 | select SUNXI_GEN_SUN6I | 74 | select SUNXI_GEN_SUN6I |
75 | 75 | ||
76 | endchoice | 76 | endchoice |
77 | 77 | ||
78 | # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" | 78 | # The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33" |
79 | config MACH_SUN8I | 79 | config MACH_SUN8I |
80 | bool | 80 | bool |
81 | default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 | 81 | default y if MACH_SUN8I_A23 || MACH_SUN8I_A33 |
82 | 82 | ||
83 | 83 | ||
84 | config DRAM_CLK | 84 | config DRAM_CLK |
85 | int "sunxi dram clock speed" | 85 | int "sunxi dram clock speed" |
86 | default 312 if MACH_SUN6I || MACH_SUN8I | 86 | default 312 if MACH_SUN6I || MACH_SUN8I |
87 | default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I | 87 | default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I |
88 | ---help--- | 88 | ---help--- |
89 | Set the dram clock speed, valid range 240 - 480, must be a multiple | 89 | Set the dram clock speed, valid range 240 - 480, must be a multiple |
90 | of 24. | 90 | of 24. |
91 | 91 | ||
92 | if MACH_SUN5I || MACH_SUN7I | 92 | if MACH_SUN5I || MACH_SUN7I |
93 | config DRAM_MBUS_CLK | 93 | config DRAM_MBUS_CLK |
94 | int "sunxi mbus clock speed" | 94 | int "sunxi mbus clock speed" |
95 | default 300 | 95 | default 300 |
96 | ---help--- | 96 | ---help--- |
97 | Set the mbus clock speed. The maximum on sun5i hardware is 300MHz. | 97 | Set the mbus clock speed. The maximum on sun5i hardware is 300MHz. |
98 | 98 | ||
99 | endif | 99 | endif |
100 | 100 | ||
101 | config DRAM_ZQ | 101 | config DRAM_ZQ |
102 | int "sunxi dram zq value" | 102 | int "sunxi dram zq value" |
103 | default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I | 103 | default 123 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I |
104 | default 127 if MACH_SUN7I | 104 | default 127 if MACH_SUN7I |
105 | ---help--- | 105 | ---help--- |
106 | Set the dram zq value. | 106 | Set the dram zq value. |
107 | 107 | ||
108 | config DRAM_ODT_EN | 108 | config DRAM_ODT_EN |
109 | bool "sunxi dram odt enable" | 109 | bool "sunxi dram odt enable" |
110 | default n if !MACH_SUN8I_A23 | 110 | default n if !MACH_SUN8I_A23 |
111 | default y if MACH_SUN8I_A23 | 111 | default y if MACH_SUN8I_A23 |
112 | ---help--- | 112 | ---help--- |
113 | Select this to enable dram odt (on die termination). | 113 | Select this to enable dram odt (on die termination). |
114 | 114 | ||
115 | if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I | 115 | if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I |
116 | config DRAM_EMR1 | 116 | config DRAM_EMR1 |
117 | int "sunxi dram emr1 value" | 117 | int "sunxi dram emr1 value" |
118 | default 0 if MACH_SUN4I | 118 | default 0 if MACH_SUN4I |
119 | default 4 if MACH_SUN5I || MACH_SUN7I | 119 | default 4 if MACH_SUN5I || MACH_SUN7I |
120 | ---help--- | 120 | ---help--- |
121 | Set the dram controller emr1 value. | 121 | Set the dram controller emr1 value. |
122 | 122 | ||
123 | config DRAM_TPR3 | 123 | config DRAM_TPR3 |
124 | hex "sunxi dram tpr3 value" | 124 | hex "sunxi dram tpr3 value" |
125 | default 0 | 125 | default 0 |
126 | ---help--- | 126 | ---help--- |
127 | Set the dram controller tpr3 parameter. This parameter configures | 127 | Set the dram controller tpr3 parameter. This parameter configures |
128 | the delay on the command lane and also phase shifts, which are | 128 | the delay on the command lane and also phase shifts, which are |
129 | applied for sampling incoming read data. The default value 0 | 129 | applied for sampling incoming read data. The default value 0 |
130 | means that no phase/delay adjustments are necessary. Properly | 130 | means that no phase/delay adjustments are necessary. Properly |
131 | configuring this parameter increases reliability at high DRAM | 131 | configuring this parameter increases reliability at high DRAM |
132 | clock speeds. | 132 | clock speeds. |
133 | 133 | ||
134 | config DRAM_DQS_GATING_DELAY | 134 | config DRAM_DQS_GATING_DELAY |
135 | hex "sunxi dram dqs_gating_delay value" | 135 | hex "sunxi dram dqs_gating_delay value" |
136 | default 0 | 136 | default 0 |
137 | ---help--- | 137 | ---help--- |
138 | Set the dram controller dqs_gating_delay parmeter. Each byte | 138 | Set the dram controller dqs_gating_delay parmeter. Each byte |
139 | encodes the DQS gating delay for each byte lane. The delay | 139 | encodes the DQS gating delay for each byte lane. The delay |
140 | granularity is 1/4 cycle. For example, the value 0x05060606 | 140 | granularity is 1/4 cycle. For example, the value 0x05060606 |
141 | means that the delay is 5 quarter-cycles for one lane (1.25 | 141 | means that the delay is 5 quarter-cycles for one lane (1.25 |
142 | cycles) and 6 quarter-cycles (1.5 cycles) for 3 other lanes. | 142 | cycles) and 6 quarter-cycles (1.5 cycles) for 3 other lanes. |
143 | The default value 0 means autodetection. The results of hardware | 143 | The default value 0 means autodetection. The results of hardware |
144 | autodetection are not very reliable and depend on the chip | 144 | autodetection are not very reliable and depend on the chip |
145 | temperature (sometimes producing different results on cold start | 145 | temperature (sometimes producing different results on cold start |
146 | and warm reboot). But the accuracy of hardware autodetection | 146 | and warm reboot). But the accuracy of hardware autodetection |
147 | is usually good enough, unless running at really high DRAM | 147 | is usually good enough, unless running at really high DRAM |
148 | clocks speeds (up to 600MHz). If unsure, keep as 0. | 148 | clocks speeds (up to 600MHz). If unsure, keep as 0. |
149 | 149 | ||
150 | choice | 150 | choice |
151 | prompt "sunxi dram timings" | 151 | prompt "sunxi dram timings" |
152 | default DRAM_TIMINGS_VENDOR_MAGIC | 152 | default DRAM_TIMINGS_VENDOR_MAGIC |
153 | ---help--- | 153 | ---help--- |
154 | Select the timings of the DDR3 chips. | 154 | Select the timings of the DDR3 chips. |
155 | 155 | ||
156 | config DRAM_TIMINGS_VENDOR_MAGIC | 156 | config DRAM_TIMINGS_VENDOR_MAGIC |
157 | bool "Magic vendor timings from Android" | 157 | bool "Magic vendor timings from Android" |
158 | ---help--- | 158 | ---help--- |
159 | The same DRAM timings as in the Allwinner boot0 bootloader. | 159 | The same DRAM timings as in the Allwinner boot0 bootloader. |
160 | 160 | ||
161 | config DRAM_TIMINGS_DDR3_1066F_1333H | 161 | config DRAM_TIMINGS_DDR3_1066F_1333H |
162 | bool "JEDEC DDR3-1333H with down binning to DDR3-1066F" | 162 | bool "JEDEC DDR3-1333H with down binning to DDR3-1066F" |
163 | ---help--- | 163 | ---help--- |
164 | Use the timings of the standard JEDEC DDR3-1066F speed bin for | 164 | Use the timings of the standard JEDEC DDR3-1066F speed bin for |
165 | DRAM_CLK <= 533MHz and the timings of the DDR3-1333H speed bin | 165 | DRAM_CLK <= 533MHz and the timings of the DDR3-1333H speed bin |
166 | for DRAM_CLK > 533MHz. This covers the majority of DDR3 chips | 166 | for DRAM_CLK > 533MHz. This covers the majority of DDR3 chips |
167 | used in Allwinner A10/A13/A20 devices. In the case of DDR3-1333 | 167 | used in Allwinner A10/A13/A20 devices. In the case of DDR3-1333 |
168 | or DDR3-1600 chips, be sure to check the DRAM datasheet to confirm | 168 | or DDR3-1600 chips, be sure to check the DRAM datasheet to confirm |
169 | that down binning to DDR3-1066F is supported (because DDR3-1066F | 169 | that down binning to DDR3-1066F is supported (because DDR3-1066F |
170 | uses a bit faster timings than DDR3-1333H). | 170 | uses a bit faster timings than DDR3-1333H). |
171 | 171 | ||
172 | config DRAM_TIMINGS_DDR3_800E_1066G_1333J | 172 | config DRAM_TIMINGS_DDR3_800E_1066G_1333J |
173 | bool "JEDEC DDR3-800E / DDR3-1066G / DDR3-1333J" | 173 | bool "JEDEC DDR3-800E / DDR3-1066G / DDR3-1333J" |
174 | ---help--- | 174 | ---help--- |
175 | Use the timings of the slowest possible JEDEC speed bin for the | 175 | Use the timings of the slowest possible JEDEC speed bin for the |
176 | selected DRAM_CLK. Depending on the DRAM_CLK value, it may be | 176 | selected DRAM_CLK. Depending on the DRAM_CLK value, it may be |
177 | DDR3-800E, DDR3-1066G or DDR3-1333J. | 177 | DDR3-800E, DDR3-1066G or DDR3-1333J. |
178 | 178 | ||
179 | endchoice | 179 | endchoice |
180 | 180 | ||
181 | endif | 181 | endif |
182 | 182 | ||
183 | if MACH_SUN8I_A23 | 183 | if MACH_SUN8I_A23 |
184 | config DRAM_ODT_CORRECTION | 184 | config DRAM_ODT_CORRECTION |
185 | int "sunxi dram odt correction value" | 185 | int "sunxi dram odt correction value" |
186 | default 0 | 186 | default 0 |
187 | ---help--- | 187 | ---help--- |
188 | Set the dram odt correction value (range -255 - 255). In allwinner | 188 | Set the dram odt correction value (range -255 - 255). In allwinner |
189 | fex files, this option is found in bits 8-15 of the u32 odt_en variable | 189 | fex files, this option is found in bits 8-15 of the u32 odt_en variable |
190 | in the [dram] section. When bit 31 of the odt_en variable is set | 190 | in the [dram] section. When bit 31 of the odt_en variable is set |
191 | then the correction is negative. Usually the value for this is 0. | 191 | then the correction is negative. Usually the value for this is 0. |
192 | endif | 192 | endif |
193 | 193 | ||
194 | config SYS_CLK_FREQ | 194 | config SYS_CLK_FREQ |
195 | default 912000000 if MACH_SUN7I | 195 | default 912000000 if MACH_SUN7I |
196 | default 1008000000 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I | 196 | default 1008000000 if MACH_SUN4I || MACH_SUN5I || MACH_SUN6I || MACH_SUN8I |
197 | 197 | ||
198 | config SYS_CONFIG_NAME | 198 | config SYS_CONFIG_NAME |
199 | default "sun4i" if MACH_SUN4I | 199 | default "sun4i" if MACH_SUN4I |
200 | default "sun5i" if MACH_SUN5I | 200 | default "sun5i" if MACH_SUN5I |
201 | default "sun6i" if MACH_SUN6I | 201 | default "sun6i" if MACH_SUN6I |
202 | default "sun7i" if MACH_SUN7I | 202 | default "sun7i" if MACH_SUN7I |
203 | default "sun8i" if MACH_SUN8I | 203 | default "sun8i" if MACH_SUN8I |
204 | default "sun9i" if MACH_SUN9I | 204 | default "sun9i" if MACH_SUN9I |
205 | 205 | ||
206 | config SYS_BOARD | 206 | config SYS_BOARD |
207 | default "sunxi" | 207 | default "sunxi" |
208 | 208 | ||
209 | config SYS_SOC | 209 | config SYS_SOC |
210 | default "sunxi" | 210 | default "sunxi" |
211 | 211 | ||
212 | config UART0_PORT_F | 212 | config UART0_PORT_F |
213 | bool "UART0 on MicroSD breakout board" | 213 | bool "UART0 on MicroSD breakout board" |
214 | default n | 214 | default n |
215 | ---help--- | 215 | ---help--- |
216 | Repurpose the SD card slot for getting access to the UART0 serial | 216 | Repurpose the SD card slot for getting access to the UART0 serial |
217 | console. Primarily useful only for low level u-boot debugging on | 217 | console. Primarily useful only for low level u-boot debugging on |
218 | tablets, where normal UART0 is difficult to access and requires | 218 | tablets, where normal UART0 is difficult to access and requires |
219 | device disassembly and/or soldering. As the SD card can't be used | 219 | device disassembly and/or soldering. As the SD card can't be used |
220 | at the same time, the system can be only booted in the FEL mode. | 220 | at the same time, the system can be only booted in the FEL mode. |
221 | Only enable this if you really know what you are doing. | 221 | Only enable this if you really know what you are doing. |
222 | 222 | ||
223 | config OLD_SUNXI_KERNEL_COMPAT | 223 | config OLD_SUNXI_KERNEL_COMPAT |
224 | boolean "Enable workarounds for booting old kernels" | 224 | boolean "Enable workarounds for booting old kernels" |
225 | default n | 225 | default n |
226 | ---help--- | 226 | ---help--- |
227 | Set this to enable various workarounds for old kernels, this results in | 227 | Set this to enable various workarounds for old kernels, this results in |
228 | sub-optimal settings for newer kernels, only enable if needed. | 228 | sub-optimal settings for newer kernels, only enable if needed. |
229 | 229 | ||
230 | config MMC0_CD_PIN | 230 | config MMC0_CD_PIN |
231 | string "Card detect pin for mmc0" | 231 | string "Card detect pin for mmc0" |
232 | default "" | 232 | default "" |
233 | ---help--- | 233 | ---help--- |
234 | Set the card detect pin for mmc0, leave empty to not use cd. This | 234 | Set the card detect pin for mmc0, leave empty to not use cd. This |
235 | takes a string in the format understood by sunxi_name_to_gpio, e.g. | 235 | takes a string in the format understood by sunxi_name_to_gpio, e.g. |
236 | PH1 for pin 1 of port H. | 236 | PH1 for pin 1 of port H. |
237 | 237 | ||
238 | config MMC1_CD_PIN | 238 | config MMC1_CD_PIN |
239 | string "Card detect pin for mmc1" | 239 | string "Card detect pin for mmc1" |
240 | default "" | 240 | default "" |
241 | ---help--- | 241 | ---help--- |
242 | See MMC0_CD_PIN help text. | 242 | See MMC0_CD_PIN help text. |
243 | 243 | ||
244 | config MMC2_CD_PIN | 244 | config MMC2_CD_PIN |
245 | string "Card detect pin for mmc2" | 245 | string "Card detect pin for mmc2" |
246 | default "" | 246 | default "" |
247 | ---help--- | 247 | ---help--- |
248 | See MMC0_CD_PIN help text. | 248 | See MMC0_CD_PIN help text. |
249 | 249 | ||
250 | config MMC3_CD_PIN | 250 | config MMC3_CD_PIN |
251 | string "Card detect pin for mmc3" | 251 | string "Card detect pin for mmc3" |
252 | default "" | 252 | default "" |
253 | ---help--- | 253 | ---help--- |
254 | See MMC0_CD_PIN help text. | 254 | See MMC0_CD_PIN help text. |
255 | 255 | ||
256 | config MMC1_PINS | 256 | config MMC1_PINS |
257 | string "Pins for mmc1" | 257 | string "Pins for mmc1" |
258 | default "" | 258 | default "" |
259 | ---help--- | 259 | ---help--- |
260 | Set the pins used for mmc1, when applicable. This takes a string in the | 260 | Set the pins used for mmc1, when applicable. This takes a string in the |
261 | format understood by sunxi_name_to_gpio_bank, e.g. PH for port H. | 261 | format understood by sunxi_name_to_gpio_bank, e.g. PH for port H. |
262 | 262 | ||
263 | config MMC2_PINS | 263 | config MMC2_PINS |
264 | string "Pins for mmc2" | 264 | string "Pins for mmc2" |
265 | default "" | 265 | default "" |
266 | ---help--- | 266 | ---help--- |
267 | See MMC1_PINS help text. | 267 | See MMC1_PINS help text. |
268 | 268 | ||
269 | config MMC3_PINS | 269 | config MMC3_PINS |
270 | string "Pins for mmc3" | 270 | string "Pins for mmc3" |
271 | default "" | 271 | default "" |
272 | ---help--- | 272 | ---help--- |
273 | See MMC1_PINS help text. | 273 | See MMC1_PINS help text. |
274 | 274 | ||
275 | config MMC_SUNXI_SLOT_EXTRA | 275 | config MMC_SUNXI_SLOT_EXTRA |
276 | int "mmc extra slot number" | 276 | int "mmc extra slot number" |
277 | default -1 | 277 | default -1 |
278 | ---help--- | 278 | ---help--- |
279 | sunxi builds always enable mmc0, some boards also have a second sdcard | 279 | sunxi builds always enable mmc0, some boards also have a second sdcard |
280 | slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable | 280 | slot or emmc on mmc1 - mmc3. Setting this to 1, 2 or 3 will enable |
281 | support for this. | 281 | support for this. |
282 | 282 | ||
283 | config SPL_NAND_SUPPORT | ||
284 | bool "SPL/NAND mode support" | ||
285 | depends on SPL | ||
286 | default n | ||
287 | ---help--- | ||
288 | This enables support for booting from NAND internal | ||
289 | memory. U-Boot SPL doesn't detect where is it load from, | ||
290 | therefore this option is needed to properly load image from | ||
291 | flash. Option also disables MMC functionality on U-Boot due to | ||
292 | initialization errors encountered, when both controllers are | ||
293 | enabled. | ||
294 | |||
295 | config USB0_VBUS_PIN | 283 | config USB0_VBUS_PIN |
296 | string "Vbus enable pin for usb0 (otg)" | 284 | string "Vbus enable pin for usb0 (otg)" |
297 | default "" | 285 | default "" |
298 | ---help--- | 286 | ---help--- |
299 | Set the Vbus enable pin for usb0 (otg). This takes a string in the | 287 | Set the Vbus enable pin for usb0 (otg). This takes a string in the |
300 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 288 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
301 | 289 | ||
302 | config USB0_VBUS_DET | 290 | config USB0_VBUS_DET |
303 | string "Vbus detect pin for usb0 (otg)" | 291 | string "Vbus detect pin for usb0 (otg)" |
304 | default "" | 292 | default "" |
305 | ---help--- | 293 | ---help--- |
306 | Set the Vbus detect pin for usb0 (otg). This takes a string in the | 294 | Set the Vbus detect pin for usb0 (otg). This takes a string in the |
307 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 295 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
308 | 296 | ||
309 | config USB1_VBUS_PIN | 297 | config USB1_VBUS_PIN |
310 | string "Vbus enable pin for usb1 (ehci0)" | 298 | string "Vbus enable pin for usb1 (ehci0)" |
311 | default "PH6" if MACH_SUN4I || MACH_SUN7I | 299 | default "PH6" if MACH_SUN4I || MACH_SUN7I |
312 | default "PH27" if MACH_SUN6I | 300 | default "PH27" if MACH_SUN6I |
313 | ---help--- | 301 | ---help--- |
314 | Set the Vbus enable pin for usb1 (ehci0, usb0 is the otg). This takes | 302 | Set the Vbus enable pin for usb1 (ehci0, usb0 is the otg). This takes |
315 | a string in the format understood by sunxi_name_to_gpio, e.g. | 303 | a string in the format understood by sunxi_name_to_gpio, e.g. |
316 | PH1 for pin 1 of port H. | 304 | PH1 for pin 1 of port H. |
317 | 305 | ||
318 | config USB2_VBUS_PIN | 306 | config USB2_VBUS_PIN |
319 | string "Vbus enable pin for usb2 (ehci1)" | 307 | string "Vbus enable pin for usb2 (ehci1)" |
320 | default "PH3" if MACH_SUN4I || MACH_SUN7I | 308 | default "PH3" if MACH_SUN4I || MACH_SUN7I |
321 | default "PH24" if MACH_SUN6I | 309 | default "PH24" if MACH_SUN6I |
322 | ---help--- | 310 | ---help--- |
323 | See USB1_VBUS_PIN help text. | 311 | See USB1_VBUS_PIN help text. |
324 | 312 | ||
325 | config I2C0_ENABLE | 313 | config I2C0_ENABLE |
326 | bool "Enable I2C/TWI controller 0" | 314 | bool "Enable I2C/TWI controller 0" |
327 | default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I | 315 | default y if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I |
328 | default n if MACH_SUN6I || MACH_SUN8I | 316 | default n if MACH_SUN6I || MACH_SUN8I |
329 | ---help--- | 317 | ---help--- |
330 | This allows enabling I2C/TWI controller 0 by muxing its pins, enabling | 318 | This allows enabling I2C/TWI controller 0 by muxing its pins, enabling |
331 | its clock and setting up the bus. This is especially useful on devices | 319 | its clock and setting up the bus. This is especially useful on devices |
332 | with slaves connected to the bus or with pins exposed through e.g. an | 320 | with slaves connected to the bus or with pins exposed through e.g. an |
333 | expansion port/header. | 321 | expansion port/header. |
334 | 322 | ||
335 | config I2C1_ENABLE | 323 | config I2C1_ENABLE |
336 | bool "Enable I2C/TWI controller 1" | 324 | bool "Enable I2C/TWI controller 1" |
337 | default n | 325 | default n |
338 | ---help--- | 326 | ---help--- |
339 | See I2C0_ENABLE help text. | 327 | See I2C0_ENABLE help text. |
340 | 328 | ||
341 | config I2C2_ENABLE | 329 | config I2C2_ENABLE |
342 | bool "Enable I2C/TWI controller 2" | 330 | bool "Enable I2C/TWI controller 2" |
343 | default n | 331 | default n |
344 | ---help--- | 332 | ---help--- |
345 | See I2C0_ENABLE help text. | 333 | See I2C0_ENABLE help text. |
346 | 334 | ||
347 | if MACH_SUN6I || MACH_SUN7I | 335 | if MACH_SUN6I || MACH_SUN7I |
348 | config I2C3_ENABLE | 336 | config I2C3_ENABLE |
349 | bool "Enable I2C/TWI controller 3" | 337 | bool "Enable I2C/TWI controller 3" |
350 | default n | 338 | default n |
351 | ---help--- | 339 | ---help--- |
352 | See I2C0_ENABLE help text. | 340 | See I2C0_ENABLE help text. |
353 | endif | 341 | endif |
354 | 342 | ||
355 | if MACH_SUN7I | 343 | if MACH_SUN7I |
356 | config I2C4_ENABLE | 344 | config I2C4_ENABLE |
357 | bool "Enable I2C/TWI controller 4" | 345 | bool "Enable I2C/TWI controller 4" |
358 | default n | 346 | default n |
359 | ---help--- | 347 | ---help--- |
360 | See I2C0_ENABLE help text. | 348 | See I2C0_ENABLE help text. |
361 | endif | 349 | endif |
362 | 350 | ||
363 | config AXP_GPIO | 351 | config AXP_GPIO |
364 | boolean "Enable support for gpio-s on axp PMICs" | 352 | boolean "Enable support for gpio-s on axp PMICs" |
365 | default n | 353 | default n |
366 | ---help--- | 354 | ---help--- |
367 | Say Y here to enable support for the gpio pins of the axp PMIC ICs. | 355 | Say Y here to enable support for the gpio pins of the axp PMIC ICs. |
368 | 356 | ||
369 | config VIDEO | 357 | config VIDEO |
370 | boolean "Enable graphical uboot console on HDMI, LCD or VGA" | 358 | boolean "Enable graphical uboot console on HDMI, LCD or VGA" |
371 | default y | 359 | default y |
372 | ---help--- | 360 | ---help--- |
373 | Say Y here to add support for using a cfb console on the HDMI, LCD | 361 | Say Y here to add support for using a cfb console on the HDMI, LCD |
374 | or VGA output found on most sunxi devices. See doc/README.video for | 362 | or VGA output found on most sunxi devices. See doc/README.video for |
375 | info on how to select the video output and mode. | 363 | info on how to select the video output and mode. |
376 | 364 | ||
377 | config VIDEO_HDMI | 365 | config VIDEO_HDMI |
378 | boolean "HDMI output support" | 366 | boolean "HDMI output support" |
379 | depends on VIDEO && !MACH_SUN8I | 367 | depends on VIDEO && !MACH_SUN8I |
380 | default y | 368 | default y |
381 | ---help--- | 369 | ---help--- |
382 | Say Y here to add support for outputting video over HDMI. | 370 | Say Y here to add support for outputting video over HDMI. |
383 | 371 | ||
384 | config VIDEO_VGA | 372 | config VIDEO_VGA |
385 | boolean "VGA output support" | 373 | boolean "VGA output support" |
386 | depends on VIDEO && (MACH_SUN4I || MACH_SUN7I) | 374 | depends on VIDEO && (MACH_SUN4I || MACH_SUN7I) |
387 | default n | 375 | default n |
388 | ---help--- | 376 | ---help--- |
389 | Say Y here to add support for outputting video over VGA. | 377 | Say Y here to add support for outputting video over VGA. |
390 | 378 | ||
391 | config VIDEO_VGA_VIA_LCD | 379 | config VIDEO_VGA_VIA_LCD |
392 | boolean "VGA via LCD controller support" | 380 | boolean "VGA via LCD controller support" |
393 | depends on VIDEO && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I) | 381 | depends on VIDEO && (MACH_SUN5I || MACH_SUN6I || MACH_SUN8I) |
394 | default n | 382 | default n |
395 | ---help--- | 383 | ---help--- |
396 | Say Y here to add support for external DACs connected to the parallel | 384 | Say Y here to add support for external DACs connected to the parallel |
397 | LCD interface driving a VGA connector, such as found on the | 385 | LCD interface driving a VGA connector, such as found on the |
398 | Olimex A13 boards. | 386 | Olimex A13 boards. |
399 | 387 | ||
400 | config VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH | 388 | config VIDEO_VGA_VIA_LCD_FORCE_SYNC_ACTIVE_HIGH |
401 | boolean "Force sync active high for VGA via LCD controller support" | 389 | boolean "Force sync active high for VGA via LCD controller support" |
402 | depends on VIDEO_VGA_VIA_LCD | 390 | depends on VIDEO_VGA_VIA_LCD |
403 | default n | 391 | default n |
404 | ---help--- | 392 | ---help--- |
405 | Say Y here if you've a board which uses opendrain drivers for the vga | 393 | Say Y here if you've a board which uses opendrain drivers for the vga |
406 | hsync and vsync signals. Opendrain drivers cannot generate steep enough | 394 | hsync and vsync signals. Opendrain drivers cannot generate steep enough |
407 | positive edges for a stable video output, so on boards with opendrain | 395 | positive edges for a stable video output, so on boards with opendrain |
408 | drivers the sync signals must always be active high. | 396 | drivers the sync signals must always be active high. |
409 | 397 | ||
410 | config VIDEO_VGA_EXTERNAL_DAC_EN | 398 | config VIDEO_VGA_EXTERNAL_DAC_EN |
411 | string "LCD panel power enable pin" | 399 | string "LCD panel power enable pin" |
412 | depends on VIDEO_VGA_VIA_LCD | 400 | depends on VIDEO_VGA_VIA_LCD |
413 | default "" | 401 | default "" |
414 | ---help--- | 402 | ---help--- |
415 | Set the enable pin for the external VGA DAC. This takes a string in the | 403 | Set the enable pin for the external VGA DAC. This takes a string in the |
416 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 404 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
417 | 405 | ||
418 | config VIDEO_LCD_MODE | 406 | config VIDEO_LCD_MODE |
419 | string "LCD panel timing details" | 407 | string "LCD panel timing details" |
420 | depends on VIDEO | 408 | depends on VIDEO |
421 | default "" | 409 | default "" |
422 | ---help--- | 410 | ---help--- |
423 | LCD panel timing details string, leave empty if there is no LCD panel. | 411 | LCD panel timing details string, leave empty if there is no LCD panel. |
424 | This is in drivers/video/videomodes.c: video_get_params() format, e.g. | 412 | This is in drivers/video/videomodes.c: video_get_params() format, e.g. |
425 | x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:0,vmode:0 | 413 | x:800,y:480,depth:18,pclk_khz:33000,le:16,ri:209,up:22,lo:22,hs:30,vs:1,sync:0,vmode:0 |
426 | 414 | ||
427 | config VIDEO_LCD_DCLK_PHASE | 415 | config VIDEO_LCD_DCLK_PHASE |
428 | int "LCD panel display clock phase" | 416 | int "LCD panel display clock phase" |
429 | depends on VIDEO | 417 | depends on VIDEO |
430 | default 1 | 418 | default 1 |
431 | ---help--- | 419 | ---help--- |
432 | Select LCD panel display clock phase shift, range 0-3. | 420 | Select LCD panel display clock phase shift, range 0-3. |
433 | 421 | ||
434 | config VIDEO_LCD_POWER | 422 | config VIDEO_LCD_POWER |
435 | string "LCD panel power enable pin" | 423 | string "LCD panel power enable pin" |
436 | depends on VIDEO | 424 | depends on VIDEO |
437 | default "" | 425 | default "" |
438 | ---help--- | 426 | ---help--- |
439 | Set the power enable pin for the LCD panel. This takes a string in the | 427 | Set the power enable pin for the LCD panel. This takes a string in the |
440 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 428 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
441 | 429 | ||
442 | config VIDEO_LCD_RESET | 430 | config VIDEO_LCD_RESET |
443 | string "LCD panel reset pin" | 431 | string "LCD panel reset pin" |
444 | depends on VIDEO | 432 | depends on VIDEO |
445 | default "" | 433 | default "" |
446 | ---help--- | 434 | ---help--- |
447 | Set the reset pin for the LCD panel. This takes a string in the format | 435 | Set the reset pin for the LCD panel. This takes a string in the format |
448 | understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 436 | understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
449 | 437 | ||
450 | config VIDEO_LCD_BL_EN | 438 | config VIDEO_LCD_BL_EN |
451 | string "LCD panel backlight enable pin" | 439 | string "LCD panel backlight enable pin" |
452 | depends on VIDEO | 440 | depends on VIDEO |
453 | default "" | 441 | default "" |
454 | ---help--- | 442 | ---help--- |
455 | Set the backlight enable pin for the LCD panel. This takes a string in the | 443 | Set the backlight enable pin for the LCD panel. This takes a string in the |
456 | the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of | 444 | the format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of |
457 | port H. | 445 | port H. |
458 | 446 | ||
459 | config VIDEO_LCD_BL_PWM | 447 | config VIDEO_LCD_BL_PWM |
460 | string "LCD panel backlight pwm pin" | 448 | string "LCD panel backlight pwm pin" |
461 | depends on VIDEO | 449 | depends on VIDEO |
462 | default "" | 450 | default "" |
463 | ---help--- | 451 | ---help--- |
464 | Set the backlight pwm pin for the LCD panel. This takes a string in the | 452 | Set the backlight pwm pin for the LCD panel. This takes a string in the |
465 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 453 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
466 | 454 | ||
467 | config VIDEO_LCD_BL_PWM_ACTIVE_LOW | 455 | config VIDEO_LCD_BL_PWM_ACTIVE_LOW |
468 | bool "LCD panel backlight pwm is inverted" | 456 | bool "LCD panel backlight pwm is inverted" |
469 | depends on VIDEO | 457 | depends on VIDEO |
470 | default y | 458 | default y |
471 | ---help--- | 459 | ---help--- |
472 | Set this if the backlight pwm output is active low. | 460 | Set this if the backlight pwm output is active low. |
473 | 461 | ||
474 | config VIDEO_LCD_PANEL_I2C | 462 | config VIDEO_LCD_PANEL_I2C |
475 | bool "LCD panel needs to be configured via i2c" | 463 | bool "LCD panel needs to be configured via i2c" |
476 | depends on VIDEO | 464 | depends on VIDEO |
477 | default n | 465 | default n |
478 | ---help--- | 466 | ---help--- |
479 | Say y here if the LCD panel needs to be configured via i2c. This | 467 | Say y here if the LCD panel needs to be configured via i2c. This |
480 | will add a bitbang i2c controller using gpios to talk to the LCD. | 468 | will add a bitbang i2c controller using gpios to talk to the LCD. |
481 | 469 | ||
482 | config VIDEO_LCD_PANEL_I2C_SDA | 470 | config VIDEO_LCD_PANEL_I2C_SDA |
483 | string "LCD panel i2c interface SDA pin" | 471 | string "LCD panel i2c interface SDA pin" |
484 | depends on VIDEO_LCD_PANEL_I2C | 472 | depends on VIDEO_LCD_PANEL_I2C |
485 | default "PG12" | 473 | default "PG12" |
486 | ---help--- | 474 | ---help--- |
487 | Set the SDA pin for the LCD i2c interface. This takes a string in the | 475 | Set the SDA pin for the LCD i2c interface. This takes a string in the |
488 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 476 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
489 | 477 | ||
490 | config VIDEO_LCD_PANEL_I2C_SCL | 478 | config VIDEO_LCD_PANEL_I2C_SCL |
491 | string "LCD panel i2c interface SCL pin" | 479 | string "LCD panel i2c interface SCL pin" |
492 | depends on VIDEO_LCD_PANEL_I2C | 480 | depends on VIDEO_LCD_PANEL_I2C |
493 | default "PG10" | 481 | default "PG10" |
494 | ---help--- | 482 | ---help--- |
495 | Set the SCL pin for the LCD i2c interface. This takes a string in the | 483 | Set the SCL pin for the LCD i2c interface. This takes a string in the |
496 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. | 484 | format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H. |
497 | 485 | ||
498 | 486 | ||
499 | # Note only one of these may be selected at a time! But hidden choices are | 487 | # Note only one of these may be selected at a time! But hidden choices are |
500 | # not supported by Kconfig | 488 | # not supported by Kconfig |
501 | config VIDEO_LCD_IF_PARALLEL | 489 | config VIDEO_LCD_IF_PARALLEL |
502 | bool | 490 | bool |
503 | 491 | ||
504 | config VIDEO_LCD_IF_LVDS | 492 | config VIDEO_LCD_IF_LVDS |
505 | bool | 493 | bool |
506 | 494 | ||
507 | 495 | ||
508 | choice | 496 | choice |
509 | prompt "LCD panel support" | 497 | prompt "LCD panel support" |
510 | depends on VIDEO | 498 | depends on VIDEO |
511 | ---help--- | 499 | ---help--- |
512 | Select which type of LCD panel to support. | 500 | Select which type of LCD panel to support. |
513 | 501 | ||
514 | config VIDEO_LCD_PANEL_PARALLEL | 502 | config VIDEO_LCD_PANEL_PARALLEL |
515 | bool "Generic parallel interface LCD panel" | 503 | bool "Generic parallel interface LCD panel" |
516 | select VIDEO_LCD_IF_PARALLEL | 504 | select VIDEO_LCD_IF_PARALLEL |
517 | 505 | ||
518 | config VIDEO_LCD_PANEL_LVDS | 506 | config VIDEO_LCD_PANEL_LVDS |
519 | bool "Generic lvds interface LCD panel" | 507 | bool "Generic lvds interface LCD panel" |
520 | select VIDEO_LCD_IF_LVDS | 508 | select VIDEO_LCD_IF_LVDS |
521 | 509 | ||
522 | config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828 | 510 | config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828 |
523 | bool "MIPI 4-lane, 513Mbps LCD panel via SSD2828 bridge chip" | 511 | bool "MIPI 4-lane, 513Mbps LCD panel via SSD2828 bridge chip" |
524 | select VIDEO_LCD_SSD2828 | 512 | select VIDEO_LCD_SSD2828 |
525 | select VIDEO_LCD_IF_PARALLEL | 513 | select VIDEO_LCD_IF_PARALLEL |
526 | ---help--- | 514 | ---help--- |
527 | 7.85" 768x1024 LCD panels, such as LG LP079X01 or AUO B079XAN01.0 | 515 | 7.85" 768x1024 LCD panels, such as LG LP079X01 or AUO B079XAN01.0 |
528 | 516 | ||
529 | config VIDEO_LCD_PANEL_HITACHI_TX18D42VM | 517 | config VIDEO_LCD_PANEL_HITACHI_TX18D42VM |
530 | bool "Hitachi tx18d42vm LCD panel" | 518 | bool "Hitachi tx18d42vm LCD panel" |
531 | select VIDEO_LCD_HITACHI_TX18D42VM | 519 | select VIDEO_LCD_HITACHI_TX18D42VM |
532 | select VIDEO_LCD_IF_LVDS | 520 | select VIDEO_LCD_IF_LVDS |
533 | ---help--- | 521 | ---help--- |
534 | 7.85" 1024x768 Hitachi tx18d42vm LCD panel support | 522 | 7.85" 1024x768 Hitachi tx18d42vm LCD panel support |
535 | 523 | ||
536 | config VIDEO_LCD_TL059WV5C0 | 524 | config VIDEO_LCD_TL059WV5C0 |
537 | bool "tl059wv5c0 LCD panel" | 525 | bool "tl059wv5c0 LCD panel" |
538 | select VIDEO_LCD_PANEL_I2C | 526 | select VIDEO_LCD_PANEL_I2C |
539 | select VIDEO_LCD_IF_PARALLEL | 527 | select VIDEO_LCD_IF_PARALLEL |
540 | ---help--- | 528 | ---help--- |
541 | 6" 480x800 tl059wv5c0 panel support, as used on the Utoo P66 and | 529 | 6" 480x800 tl059wv5c0 panel support, as used on the Utoo P66 and |
542 | Aigo M60/M608/M606 tablets. | 530 | Aigo M60/M608/M606 tablets. |
543 | 531 | ||
544 | endchoice | 532 | endchoice |
545 | 533 | ||
546 | 534 | ||
547 | config USB_MUSB_SUNXI | 535 | config USB_MUSB_SUNXI |
548 | bool "Enable sunxi OTG / DRC USB controller in host mode" | 536 | bool "Enable sunxi OTG / DRC USB controller in host mode" |
549 | default n | 537 | default n |
550 | ---help--- | 538 | ---help--- |
551 | Say y here to enable support for the sunxi OTG / DRC USB controller | 539 | Say y here to enable support for the sunxi OTG / DRC USB controller |
552 | used on almost all sunxi boards. Note currently u-boot can only have | 540 | used on almost all sunxi boards. Note currently u-boot can only have |
553 | one usb host controller enabled at a time, so enabling this on boards | 541 | one usb host controller enabled at a time, so enabling this on boards |
554 | which also use the ehci host controller will result in build errors. | 542 | which also use the ehci host controller will result in build errors. |
555 | 543 | ||
556 | config USB_KEYBOARD | 544 | config USB_KEYBOARD |
557 | boolean "Enable USB keyboard support" | 545 | boolean "Enable USB keyboard support" |
558 | default y | 546 | default y |
559 | ---help--- | 547 | ---help--- |
560 | Say Y here to add support for using a USB keyboard (typically used | 548 | Say Y here to add support for using a USB keyboard (typically used |
561 | in combination with a graphical console). | 549 | in combination with a graphical console). |
562 | 550 | ||
563 | config GMAC_TX_DELAY | 551 | config GMAC_TX_DELAY |
564 | int "GMAC Transmit Clock Delay Chain" | 552 | int "GMAC Transmit Clock Delay Chain" |
565 | default 0 | 553 | default 0 |
566 | ---help--- | 554 | ---help--- |
567 | Set the GMAC Transmit Clock Delay Chain value. | 555 | Set the GMAC Transmit Clock Delay Chain value. |
568 | 556 | ||
569 | endif | 557 | endif |
570 | 558 |
board/sunxi/board.c
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> | 3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> |
4 | * | 4 | * |
5 | * (C) Copyright 2007-2011 | 5 | * (C) Copyright 2007-2011 |
6 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | 6 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> |
7 | * Tom Cubie <tangliang@allwinnertech.com> | 7 | * Tom Cubie <tangliang@allwinnertech.com> |
8 | * | 8 | * |
9 | * Some board init for the Allwinner A10-evb board. | 9 | * Some board init for the Allwinner A10-evb board. |
10 | * | 10 | * |
11 | * SPDX-License-Identifier: GPL-2.0+ | 11 | * SPDX-License-Identifier: GPL-2.0+ |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <common.h> | 14 | #include <common.h> |
15 | #include <mmc.h> | 15 | #include <mmc.h> |
16 | #ifdef CONFIG_AXP152_POWER | 16 | #ifdef CONFIG_AXP152_POWER |
17 | #include <axp152.h> | 17 | #include <axp152.h> |
18 | #endif | 18 | #endif |
19 | #ifdef CONFIG_AXP209_POWER | 19 | #ifdef CONFIG_AXP209_POWER |
20 | #include <axp209.h> | 20 | #include <axp209.h> |
21 | #endif | 21 | #endif |
22 | #ifdef CONFIG_AXP221_POWER | 22 | #ifdef CONFIG_AXP221_POWER |
23 | #include <axp221.h> | 23 | #include <axp221.h> |
24 | #endif | 24 | #endif |
25 | #ifdef CONFIG_NAND_SUNXI | ||
26 | #include <nand.h> | ||
27 | #endif | ||
28 | #include <asm/arch/clock.h> | 25 | #include <asm/arch/clock.h> |
29 | #include <asm/arch/cpu.h> | 26 | #include <asm/arch/cpu.h> |
30 | #include <asm/arch/display.h> | 27 | #include <asm/arch/display.h> |
31 | #include <asm/arch/dram.h> | 28 | #include <asm/arch/dram.h> |
32 | #include <asm/arch/gpio.h> | 29 | #include <asm/arch/gpio.h> |
33 | #include <asm/arch/mmc.h> | 30 | #include <asm/arch/mmc.h> |
34 | #include <asm/arch/usb_phy.h> | 31 | #include <asm/arch/usb_phy.h> |
35 | #include <asm/gpio.h> | 32 | #include <asm/gpio.h> |
36 | #include <asm/io.h> | 33 | #include <asm/io.h> |
37 | #include <linux/usb/musb.h> | 34 | #include <linux/usb/musb.h> |
38 | #include <net.h> | 35 | #include <net.h> |
39 | 36 | ||
40 | #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) | 37 | #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) |
41 | /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ | 38 | /* So that we can use pin names in Kconfig and sunxi_name_to_gpio() */ |
42 | int soft_i2c_gpio_sda; | 39 | int soft_i2c_gpio_sda; |
43 | int soft_i2c_gpio_scl; | 40 | int soft_i2c_gpio_scl; |
44 | 41 | ||
45 | static int soft_i2c_board_init(void) | 42 | static int soft_i2c_board_init(void) |
46 | { | 43 | { |
47 | int ret; | 44 | int ret; |
48 | 45 | ||
49 | soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA); | 46 | soft_i2c_gpio_sda = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SDA); |
50 | if (soft_i2c_gpio_sda < 0) { | 47 | if (soft_i2c_gpio_sda < 0) { |
51 | printf("Error invalid soft i2c sda pin: '%s', err %d\n", | 48 | printf("Error invalid soft i2c sda pin: '%s', err %d\n", |
52 | CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda); | 49 | CONFIG_VIDEO_LCD_PANEL_I2C_SDA, soft_i2c_gpio_sda); |
53 | return soft_i2c_gpio_sda; | 50 | return soft_i2c_gpio_sda; |
54 | } | 51 | } |
55 | ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda"); | 52 | ret = gpio_request(soft_i2c_gpio_sda, "soft-i2c-sda"); |
56 | if (ret) { | 53 | if (ret) { |
57 | printf("Error requesting soft i2c sda pin: '%s', err %d\n", | 54 | printf("Error requesting soft i2c sda pin: '%s', err %d\n", |
58 | CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret); | 55 | CONFIG_VIDEO_LCD_PANEL_I2C_SDA, ret); |
59 | return ret; | 56 | return ret; |
60 | } | 57 | } |
61 | 58 | ||
62 | soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL); | 59 | soft_i2c_gpio_scl = sunxi_name_to_gpio(CONFIG_VIDEO_LCD_PANEL_I2C_SCL); |
63 | if (soft_i2c_gpio_scl < 0) { | 60 | if (soft_i2c_gpio_scl < 0) { |
64 | printf("Error invalid soft i2c scl pin: '%s', err %d\n", | 61 | printf("Error invalid soft i2c scl pin: '%s', err %d\n", |
65 | CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl); | 62 | CONFIG_VIDEO_LCD_PANEL_I2C_SCL, soft_i2c_gpio_scl); |
66 | return soft_i2c_gpio_scl; | 63 | return soft_i2c_gpio_scl; |
67 | } | 64 | } |
68 | ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl"); | 65 | ret = gpio_request(soft_i2c_gpio_scl, "soft-i2c-scl"); |
69 | if (ret) { | 66 | if (ret) { |
70 | printf("Error requesting soft i2c scl pin: '%s', err %d\n", | 67 | printf("Error requesting soft i2c scl pin: '%s', err %d\n", |
71 | CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret); | 68 | CONFIG_VIDEO_LCD_PANEL_I2C_SCL, ret); |
72 | return ret; | 69 | return ret; |
73 | } | 70 | } |
74 | 71 | ||
75 | return 0; | 72 | return 0; |
76 | } | 73 | } |
77 | #else | 74 | #else |
78 | static int soft_i2c_board_init(void) { return 0; } | 75 | static int soft_i2c_board_init(void) { return 0; } |
79 | #endif | 76 | #endif |
80 | 77 | ||
81 | DECLARE_GLOBAL_DATA_PTR; | 78 | DECLARE_GLOBAL_DATA_PTR; |
82 | 79 | ||
83 | /* add board specific code here */ | 80 | /* add board specific code here */ |
84 | int board_init(void) | 81 | int board_init(void) |
85 | { | 82 | { |
86 | int id_pfr1, ret; | 83 | int id_pfr1, ret; |
87 | 84 | ||
88 | gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100); | 85 | gd->bd->bi_boot_params = (PHYS_SDRAM_0 + 0x100); |
89 | 86 | ||
90 | asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1)); | 87 | asm volatile("mrc p15, 0, %0, c0, c1, 1" : "=r"(id_pfr1)); |
91 | debug("id_pfr1: 0x%08x\n", id_pfr1); | 88 | debug("id_pfr1: 0x%08x\n", id_pfr1); |
92 | /* Generic Timer Extension available? */ | 89 | /* Generic Timer Extension available? */ |
93 | if ((id_pfr1 >> 16) & 0xf) { | 90 | if ((id_pfr1 >> 16) & 0xf) { |
94 | debug("Setting CNTFRQ\n"); | 91 | debug("Setting CNTFRQ\n"); |
95 | /* CNTFRQ == 24 MHz */ | 92 | /* CNTFRQ == 24 MHz */ |
96 | asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000)); | 93 | asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r"(24000000)); |
97 | } | 94 | } |
98 | 95 | ||
99 | ret = axp_gpio_init(); | 96 | ret = axp_gpio_init(); |
100 | if (ret) | 97 | if (ret) |
101 | return ret; | 98 | return ret; |
102 | 99 | ||
103 | /* Uses dm gpio code so do this here and not in i2c_init_board() */ | 100 | /* Uses dm gpio code so do this here and not in i2c_init_board() */ |
104 | return soft_i2c_board_init(); | 101 | return soft_i2c_board_init(); |
105 | } | 102 | } |
106 | 103 | ||
107 | int dram_init(void) | 104 | int dram_init(void) |
108 | { | 105 | { |
109 | gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE); | 106 | gd->ram_size = get_ram_size((long *)PHYS_SDRAM_0, PHYS_SDRAM_0_SIZE); |
110 | 107 | ||
111 | return 0; | 108 | return 0; |
112 | } | 109 | } |
113 | 110 | ||
114 | #ifdef CONFIG_GENERIC_MMC | 111 | #ifdef CONFIG_GENERIC_MMC |
115 | static void mmc_pinmux_setup(int sdc) | 112 | static void mmc_pinmux_setup(int sdc) |
116 | { | 113 | { |
117 | unsigned int pin; | 114 | unsigned int pin; |
118 | __maybe_unused int pins; | 115 | __maybe_unused int pins; |
119 | 116 | ||
120 | switch (sdc) { | 117 | switch (sdc) { |
121 | case 0: | 118 | case 0: |
122 | /* SDC0: PF0-PF5 */ | 119 | /* SDC0: PF0-PF5 */ |
123 | for (pin = SUNXI_GPF(0); pin <= SUNXI_GPF(5); pin++) { | 120 | for (pin = SUNXI_GPF(0); pin <= SUNXI_GPF(5); pin++) { |
124 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPF_SDC0); | 121 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPF_SDC0); |
125 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 122 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
126 | sunxi_gpio_set_drv(pin, 2); | 123 | sunxi_gpio_set_drv(pin, 2); |
127 | } | 124 | } |
128 | break; | 125 | break; |
129 | 126 | ||
130 | case 1: | 127 | case 1: |
131 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC1_PINS); | 128 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC1_PINS); |
132 | 129 | ||
133 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 130 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
134 | if (pins == SUNXI_GPIO_H) { | 131 | if (pins == SUNXI_GPIO_H) { |
135 | /* SDC1: PH22-PH-27 */ | 132 | /* SDC1: PH22-PH-27 */ |
136 | for (pin = SUNXI_GPH(22); pin <= SUNXI_GPH(27); pin++) { | 133 | for (pin = SUNXI_GPH(22); pin <= SUNXI_GPH(27); pin++) { |
137 | sunxi_gpio_set_cfgpin(pin, SUN4I_GPH_SDC1); | 134 | sunxi_gpio_set_cfgpin(pin, SUN4I_GPH_SDC1); |
138 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 135 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
139 | sunxi_gpio_set_drv(pin, 2); | 136 | sunxi_gpio_set_drv(pin, 2); |
140 | } | 137 | } |
141 | } else { | 138 | } else { |
142 | /* SDC1: PG0-PG5 */ | 139 | /* SDC1: PG0-PG5 */ |
143 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { | 140 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { |
144 | sunxi_gpio_set_cfgpin(pin, SUN4I_GPG_SDC1); | 141 | sunxi_gpio_set_cfgpin(pin, SUN4I_GPG_SDC1); |
145 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 142 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
146 | sunxi_gpio_set_drv(pin, 2); | 143 | sunxi_gpio_set_drv(pin, 2); |
147 | } | 144 | } |
148 | } | 145 | } |
149 | #elif defined(CONFIG_MACH_SUN5I) | 146 | #elif defined(CONFIG_MACH_SUN5I) |
150 | /* SDC1: PG3-PG8 */ | 147 | /* SDC1: PG3-PG8 */ |
151 | for (pin = SUNXI_GPG(3); pin <= SUNXI_GPG(8); pin++) { | 148 | for (pin = SUNXI_GPG(3); pin <= SUNXI_GPG(8); pin++) { |
152 | sunxi_gpio_set_cfgpin(pin, SUN5I_GPG_SDC1); | 149 | sunxi_gpio_set_cfgpin(pin, SUN5I_GPG_SDC1); |
153 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 150 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
154 | sunxi_gpio_set_drv(pin, 2); | 151 | sunxi_gpio_set_drv(pin, 2); |
155 | } | 152 | } |
156 | #elif defined(CONFIG_MACH_SUN6I) | 153 | #elif defined(CONFIG_MACH_SUN6I) |
157 | /* SDC1: PG0-PG5 */ | 154 | /* SDC1: PG0-PG5 */ |
158 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { | 155 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { |
159 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPG_SDC1); | 156 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPG_SDC1); |
160 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 157 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
161 | sunxi_gpio_set_drv(pin, 2); | 158 | sunxi_gpio_set_drv(pin, 2); |
162 | } | 159 | } |
163 | #elif defined(CONFIG_MACH_SUN8I) | 160 | #elif defined(CONFIG_MACH_SUN8I) |
164 | if (pins == SUNXI_GPIO_D) { | 161 | if (pins == SUNXI_GPIO_D) { |
165 | /* SDC1: PD2-PD7 */ | 162 | /* SDC1: PD2-PD7 */ |
166 | for (pin = SUNXI_GPD(2); pin <= SUNXI_GPD(7); pin++) { | 163 | for (pin = SUNXI_GPD(2); pin <= SUNXI_GPD(7); pin++) { |
167 | sunxi_gpio_set_cfgpin(pin, SUN8I_GPD_SDC1); | 164 | sunxi_gpio_set_cfgpin(pin, SUN8I_GPD_SDC1); |
168 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 165 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
169 | sunxi_gpio_set_drv(pin, 2); | 166 | sunxi_gpio_set_drv(pin, 2); |
170 | } | 167 | } |
171 | } else { | 168 | } else { |
172 | /* SDC1: PG0-PG5 */ | 169 | /* SDC1: PG0-PG5 */ |
173 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { | 170 | for (pin = SUNXI_GPG(0); pin <= SUNXI_GPG(5); pin++) { |
174 | sunxi_gpio_set_cfgpin(pin, SUN8I_GPG_SDC1); | 171 | sunxi_gpio_set_cfgpin(pin, SUN8I_GPG_SDC1); |
175 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 172 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
176 | sunxi_gpio_set_drv(pin, 2); | 173 | sunxi_gpio_set_drv(pin, 2); |
177 | } | 174 | } |
178 | } | 175 | } |
179 | #endif | 176 | #endif |
180 | break; | 177 | break; |
181 | 178 | ||
182 | case 2: | 179 | case 2: |
183 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC2_PINS); | 180 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC2_PINS); |
184 | 181 | ||
185 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 182 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
186 | /* SDC2: PC6-PC11 */ | 183 | /* SDC2: PC6-PC11 */ |
187 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(11); pin++) { | 184 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(11); pin++) { |
188 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); | 185 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); |
189 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 186 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
190 | sunxi_gpio_set_drv(pin, 2); | 187 | sunxi_gpio_set_drv(pin, 2); |
191 | } | 188 | } |
192 | #elif defined(CONFIG_MACH_SUN5I) | 189 | #elif defined(CONFIG_MACH_SUN5I) |
193 | if (pins == SUNXI_GPIO_E) { | 190 | if (pins == SUNXI_GPIO_E) { |
194 | /* SDC2: PE4-PE9 */ | 191 | /* SDC2: PE4-PE9 */ |
195 | for (pin = SUNXI_GPE(4); pin <= SUNXI_GPD(9); pin++) { | 192 | for (pin = SUNXI_GPE(4); pin <= SUNXI_GPD(9); pin++) { |
196 | sunxi_gpio_set_cfgpin(pin, SUN5I_GPE_SDC2); | 193 | sunxi_gpio_set_cfgpin(pin, SUN5I_GPE_SDC2); |
197 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 194 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
198 | sunxi_gpio_set_drv(pin, 2); | 195 | sunxi_gpio_set_drv(pin, 2); |
199 | } | 196 | } |
200 | } else { | 197 | } else { |
201 | /* SDC2: PC6-PC15 */ | 198 | /* SDC2: PC6-PC15 */ |
202 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { | 199 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { |
203 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); | 200 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); |
204 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 201 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
205 | sunxi_gpio_set_drv(pin, 2); | 202 | sunxi_gpio_set_drv(pin, 2); |
206 | } | 203 | } |
207 | } | 204 | } |
208 | #elif defined(CONFIG_MACH_SUN6I) | 205 | #elif defined(CONFIG_MACH_SUN6I) |
209 | if (pins == SUNXI_GPIO_A) { | 206 | if (pins == SUNXI_GPIO_A) { |
210 | /* SDC2: PA9-PA14 */ | 207 | /* SDC2: PA9-PA14 */ |
211 | for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) { | 208 | for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) { |
212 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC2); | 209 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC2); |
213 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 210 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
214 | sunxi_gpio_set_drv(pin, 2); | 211 | sunxi_gpio_set_drv(pin, 2); |
215 | } | 212 | } |
216 | } else { | 213 | } else { |
217 | /* SDC2: PC6-PC15, PC24 */ | 214 | /* SDC2: PC6-PC15, PC24 */ |
218 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { | 215 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { |
219 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); | 216 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); |
220 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 217 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
221 | sunxi_gpio_set_drv(pin, 2); | 218 | sunxi_gpio_set_drv(pin, 2); |
222 | } | 219 | } |
223 | 220 | ||
224 | sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUNXI_GPC_SDC2); | 221 | sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUNXI_GPC_SDC2); |
225 | sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP); | 222 | sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP); |
226 | sunxi_gpio_set_drv(SUNXI_GPC(24), 2); | 223 | sunxi_gpio_set_drv(SUNXI_GPC(24), 2); |
227 | } | 224 | } |
228 | #elif defined(CONFIG_MACH_SUN8I) | 225 | #elif defined(CONFIG_MACH_SUN8I) |
229 | /* SDC2: PC5-PC6, PC8-PC16 */ | 226 | /* SDC2: PC5-PC6, PC8-PC16 */ |
230 | for (pin = SUNXI_GPC(5); pin <= SUNXI_GPC(6); pin++) { | 227 | for (pin = SUNXI_GPC(5); pin <= SUNXI_GPC(6); pin++) { |
231 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); | 228 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); |
232 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 229 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
233 | sunxi_gpio_set_drv(pin, 2); | 230 | sunxi_gpio_set_drv(pin, 2); |
234 | } | 231 | } |
235 | 232 | ||
236 | for (pin = SUNXI_GPC(8); pin <= SUNXI_GPC(16); pin++) { | 233 | for (pin = SUNXI_GPC(8); pin <= SUNXI_GPC(16); pin++) { |
237 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); | 234 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2); |
238 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 235 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
239 | sunxi_gpio_set_drv(pin, 2); | 236 | sunxi_gpio_set_drv(pin, 2); |
240 | } | 237 | } |
241 | #endif | 238 | #endif |
242 | break; | 239 | break; |
243 | 240 | ||
244 | case 3: | 241 | case 3: |
245 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC3_PINS); | 242 | pins = sunxi_name_to_gpio_bank(CONFIG_MMC3_PINS); |
246 | 243 | ||
247 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 244 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
248 | /* SDC3: PI4-PI9 */ | 245 | /* SDC3: PI4-PI9 */ |
249 | for (pin = SUNXI_GPI(4); pin <= SUNXI_GPI(9); pin++) { | 246 | for (pin = SUNXI_GPI(4); pin <= SUNXI_GPI(9); pin++) { |
250 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPI_SDC3); | 247 | sunxi_gpio_set_cfgpin(pin, SUNXI_GPI_SDC3); |
251 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 248 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
252 | sunxi_gpio_set_drv(pin, 2); | 249 | sunxi_gpio_set_drv(pin, 2); |
253 | } | 250 | } |
254 | #elif defined(CONFIG_MACH_SUN6I) | 251 | #elif defined(CONFIG_MACH_SUN6I) |
255 | if (pins == SUNXI_GPIO_A) { | 252 | if (pins == SUNXI_GPIO_A) { |
256 | /* SDC3: PA9-PA14 */ | 253 | /* SDC3: PA9-PA14 */ |
257 | for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) { | 254 | for (pin = SUNXI_GPA(9); pin <= SUNXI_GPA(14); pin++) { |
258 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC3); | 255 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPA_SDC3); |
259 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 256 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
260 | sunxi_gpio_set_drv(pin, 2); | 257 | sunxi_gpio_set_drv(pin, 2); |
261 | } | 258 | } |
262 | } else { | 259 | } else { |
263 | /* SDC3: PC6-PC15, PC24 */ | 260 | /* SDC3: PC6-PC15, PC24 */ |
264 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { | 261 | for (pin = SUNXI_GPC(6); pin <= SUNXI_GPC(15); pin++) { |
265 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPC_SDC3); | 262 | sunxi_gpio_set_cfgpin(pin, SUN6I_GPC_SDC3); |
266 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); | 263 | sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP); |
267 | sunxi_gpio_set_drv(pin, 2); | 264 | sunxi_gpio_set_drv(pin, 2); |
268 | } | 265 | } |
269 | 266 | ||
270 | sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUN6I_GPC_SDC3); | 267 | sunxi_gpio_set_cfgpin(SUNXI_GPC(24), SUN6I_GPC_SDC3); |
271 | sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP); | 268 | sunxi_gpio_set_pull(SUNXI_GPC(24), SUNXI_GPIO_PULL_UP); |
272 | sunxi_gpio_set_drv(SUNXI_GPC(24), 2); | 269 | sunxi_gpio_set_drv(SUNXI_GPC(24), 2); |
273 | } | 270 | } |
274 | #endif | 271 | #endif |
275 | break; | 272 | break; |
276 | 273 | ||
277 | default: | 274 | default: |
278 | printf("sunxi: invalid MMC slot %d for pinmux setup\n", sdc); | 275 | printf("sunxi: invalid MMC slot %d for pinmux setup\n", sdc); |
279 | break; | 276 | break; |
280 | } | 277 | } |
281 | } | 278 | } |
282 | 279 | ||
283 | int board_mmc_init(bd_t *bis) | 280 | int board_mmc_init(bd_t *bis) |
284 | { | 281 | { |
285 | __maybe_unused struct mmc *mmc0, *mmc1; | 282 | __maybe_unused struct mmc *mmc0, *mmc1; |
286 | __maybe_unused char buf[512]; | 283 | __maybe_unused char buf[512]; |
287 | 284 | ||
288 | mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT); | 285 | mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT); |
289 | mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); | 286 | mmc0 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT); |
290 | if (!mmc0) | 287 | if (!mmc0) |
291 | return -1; | 288 | return -1; |
292 | 289 | ||
293 | #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 | 290 | #if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1 |
294 | mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA); | 291 | mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA); |
295 | mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); | 292 | mmc1 = sunxi_mmc_init(CONFIG_MMC_SUNXI_SLOT_EXTRA); |
296 | if (!mmc1) | 293 | if (!mmc1) |
297 | return -1; | 294 | return -1; |
298 | #endif | 295 | #endif |
299 | 296 | ||
300 | #if CONFIG_MMC_SUNXI_SLOT == 0 && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 | 297 | #if CONFIG_MMC_SUNXI_SLOT == 0 && CONFIG_MMC_SUNXI_SLOT_EXTRA == 2 |
301 | /* | 298 | /* |
302 | * Both mmc0 and mmc2 are bootable, figure out where we're booting | 299 | * Both mmc0 and mmc2 are bootable, figure out where we're booting |
303 | * from. Try mmc0 first, just like the brom does. | 300 | * from. Try mmc0 first, just like the brom does. |
304 | */ | 301 | */ |
305 | if (mmc_getcd(mmc0) && mmc_init(mmc0) == 0 && | 302 | if (mmc_getcd(mmc0) && mmc_init(mmc0) == 0 && |
306 | mmc0->block_dev.block_read(0, 16, 1, buf) == 1) { | 303 | mmc0->block_dev.block_read(0, 16, 1, buf) == 1) { |
307 | buf[12] = 0; | 304 | buf[12] = 0; |
308 | if (strcmp(&buf[4], "eGON.BT0") == 0) | 305 | if (strcmp(&buf[4], "eGON.BT0") == 0) |
309 | return 0; | 306 | return 0; |
310 | } | 307 | } |
311 | 308 | ||
312 | /* no bootable card in mmc0, so we must be booting from mmc2, swap */ | 309 | /* no bootable card in mmc0, so we must be booting from mmc2, swap */ |
313 | mmc0->block_dev.dev = 1; | 310 | mmc0->block_dev.dev = 1; |
314 | mmc1->block_dev.dev = 0; | 311 | mmc1->block_dev.dev = 0; |
315 | #endif | 312 | #endif |
316 | 313 | ||
317 | return 0; | 314 | return 0; |
318 | } | ||
319 | #endif | ||
320 | |||
321 | #ifdef CONFIG_NAND | ||
322 | void board_nand_init(void) | ||
323 | { | ||
324 | unsigned int pin; | ||
325 | static u8 ports[] = CONFIG_NAND_SUNXI_GPC_PORTS; | ||
326 | |||
327 | /* Configure AHB muxes to connect output pins with NAND controller */ | ||
328 | for (pin = 0; pin < 16; pin++) | ||
329 | sunxi_gpio_set_cfgpin(SUNXI_GPC(pin), SUNXI_GPC_NAND); | ||
330 | |||
331 | for (pin = 0; pin < ARRAY_SIZE(ports); pin++) | ||
332 | sunxi_gpio_set_cfgpin(SUNXI_GPC(ports[pin]), SUNXI_GPC_NAND); | ||
333 | } | 315 | } |
334 | #endif | 316 | #endif |
335 | 317 | ||
336 | void i2c_init_board(void) | 318 | void i2c_init_board(void) |
337 | { | 319 | { |
338 | #ifdef CONFIG_I2C0_ENABLE | 320 | #ifdef CONFIG_I2C0_ENABLE |
339 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I) | 321 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN5I) || defined(CONFIG_MACH_SUN7I) |
340 | sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0); | 322 | sunxi_gpio_set_cfgpin(SUNXI_GPB(0), SUN4I_GPB_TWI0); |
341 | sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0); | 323 | sunxi_gpio_set_cfgpin(SUNXI_GPB(1), SUN4I_GPB_TWI0); |
342 | clock_twi_onoff(0, 1); | 324 | clock_twi_onoff(0, 1); |
343 | #elif defined(CONFIG_MACH_SUN6I) | 325 | #elif defined(CONFIG_MACH_SUN6I) |
344 | sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0); | 326 | sunxi_gpio_set_cfgpin(SUNXI_GPH(14), SUN6I_GPH_TWI0); |
345 | sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0); | 327 | sunxi_gpio_set_cfgpin(SUNXI_GPH(15), SUN6I_GPH_TWI0); |
346 | clock_twi_onoff(0, 1); | 328 | clock_twi_onoff(0, 1); |
347 | #elif defined(CONFIG_MACH_SUN8I) | 329 | #elif defined(CONFIG_MACH_SUN8I) |
348 | sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0); | 330 | sunxi_gpio_set_cfgpin(SUNXI_GPH(2), SUN8I_GPH_TWI0); |
349 | sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0); | 331 | sunxi_gpio_set_cfgpin(SUNXI_GPH(3), SUN8I_GPH_TWI0); |
350 | clock_twi_onoff(0, 1); | 332 | clock_twi_onoff(0, 1); |
351 | #endif | 333 | #endif |
352 | #endif | 334 | #endif |
353 | 335 | ||
354 | #ifdef CONFIG_I2C1_ENABLE | 336 | #ifdef CONFIG_I2C1_ENABLE |
355 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 337 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
356 | sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1); | 338 | sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN4I_GPB_TWI1); |
357 | sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1); | 339 | sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN4I_GPB_TWI1); |
358 | clock_twi_onoff(1, 1); | 340 | clock_twi_onoff(1, 1); |
359 | #elif defined(CONFIG_MACH_SUN5I) | 341 | #elif defined(CONFIG_MACH_SUN5I) |
360 | sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1); | 342 | sunxi_gpio_set_cfgpin(SUNXI_GPB(15), SUN5I_GPB_TWI1); |
361 | sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1); | 343 | sunxi_gpio_set_cfgpin(SUNXI_GPB(16), SUN5I_GPB_TWI1); |
362 | clock_twi_onoff(1, 1); | 344 | clock_twi_onoff(1, 1); |
363 | #elif defined(CONFIG_MACH_SUN6I) | 345 | #elif defined(CONFIG_MACH_SUN6I) |
364 | sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1); | 346 | sunxi_gpio_set_cfgpin(SUNXI_GPH(16), SUN6I_GPH_TWI1); |
365 | sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1); | 347 | sunxi_gpio_set_cfgpin(SUNXI_GPH(17), SUN6I_GPH_TWI1); |
366 | clock_twi_onoff(1, 1); | 348 | clock_twi_onoff(1, 1); |
367 | #elif defined(CONFIG_MACH_SUN8I) | 349 | #elif defined(CONFIG_MACH_SUN8I) |
368 | sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); | 350 | sunxi_gpio_set_cfgpin(SUNXI_GPH(4), SUN8I_GPH_TWI1); |
369 | sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); | 351 | sunxi_gpio_set_cfgpin(SUNXI_GPH(5), SUN8I_GPH_TWI1); |
370 | clock_twi_onoff(1, 1); | 352 | clock_twi_onoff(1, 1); |
371 | #endif | 353 | #endif |
372 | #endif | 354 | #endif |
373 | 355 | ||
374 | #ifdef CONFIG_I2C2_ENABLE | 356 | #ifdef CONFIG_I2C2_ENABLE |
375 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) | 357 | #if defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I) |
376 | sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2); | 358 | sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN4I_GPB_TWI2); |
377 | sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2); | 359 | sunxi_gpio_set_cfgpin(SUNXI_GPB(21), SUN4I_GPB_TWI2); |
378 | clock_twi_onoff(2, 1); | 360 | clock_twi_onoff(2, 1); |
379 | #elif defined(CONFIG_MACH_SUN5I) | 361 | #elif defined(CONFIG_MACH_SUN5I) |
380 | sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2); | 362 | sunxi_gpio_set_cfgpin(SUNXI_GPB(17), SUN5I_GPB_TWI2); |
381 | sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2); | 363 | sunxi_gpio_set_cfgpin(SUNXI_GPB(18), SUN5I_GPB_TWI2); |
382 | clock_twi_onoff(2, 1); | 364 | clock_twi_onoff(2, 1); |
383 | #elif defined(CONFIG_MACH_SUN6I) | 365 | #elif defined(CONFIG_MACH_SUN6I) |
384 | sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2); | 366 | sunxi_gpio_set_cfgpin(SUNXI_GPH(18), SUN6I_GPH_TWI2); |
385 | sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2); | 367 | sunxi_gpio_set_cfgpin(SUNXI_GPH(19), SUN6I_GPH_TWI2); |
386 | clock_twi_onoff(2, 1); | 368 | clock_twi_onoff(2, 1); |
387 | #elif defined(CONFIG_MACH_SUN8I) | 369 | #elif defined(CONFIG_MACH_SUN8I) |
388 | sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2); | 370 | sunxi_gpio_set_cfgpin(SUNXI_GPE(12), SUN8I_GPE_TWI2); |
389 | sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2); | 371 | sunxi_gpio_set_cfgpin(SUNXI_GPE(13), SUN8I_GPE_TWI2); |
390 | clock_twi_onoff(2, 1); | 372 | clock_twi_onoff(2, 1); |
391 | #endif | 373 | #endif |
392 | #endif | 374 | #endif |
393 | 375 | ||
394 | #ifdef CONFIG_I2C3_ENABLE | 376 | #ifdef CONFIG_I2C3_ENABLE |
395 | #if defined(CONFIG_MACH_SUN6I) | 377 | #if defined(CONFIG_MACH_SUN6I) |
396 | sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3); | 378 | sunxi_gpio_set_cfgpin(SUNXI_GPG(10), SUN6I_GPG_TWI3); |
397 | sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3); | 379 | sunxi_gpio_set_cfgpin(SUNXI_GPG(11), SUN6I_GPG_TWI3); |
398 | clock_twi_onoff(3, 1); | 380 | clock_twi_onoff(3, 1); |
399 | #elif defined(CONFIG_MACH_SUN7I) | 381 | #elif defined(CONFIG_MACH_SUN7I) |
400 | sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3); | 382 | sunxi_gpio_set_cfgpin(SUNXI_GPI(0), SUN7I_GPI_TWI3); |
401 | sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3); | 383 | sunxi_gpio_set_cfgpin(SUNXI_GPI(1), SUN7I_GPI_TWI3); |
402 | clock_twi_onoff(3, 1); | 384 | clock_twi_onoff(3, 1); |
403 | #endif | 385 | #endif |
404 | #endif | 386 | #endif |
405 | 387 | ||
406 | #ifdef CONFIG_I2C4_ENABLE | 388 | #ifdef CONFIG_I2C4_ENABLE |
407 | #if defined(CONFIG_MACH_SUN7I) | 389 | #if defined(CONFIG_MACH_SUN7I) |
408 | sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4); | 390 | sunxi_gpio_set_cfgpin(SUNXI_GPI(2), SUN7I_GPI_TWI4); |
409 | sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4); | 391 | sunxi_gpio_set_cfgpin(SUNXI_GPI(3), SUN7I_GPI_TWI4); |
410 | clock_twi_onoff(4, 1); | 392 | clock_twi_onoff(4, 1); |
411 | #endif | 393 | #endif |
412 | #endif | 394 | #endif |
413 | } | 395 | } |
414 | 396 | ||
415 | #ifdef CONFIG_SPL_BUILD | 397 | #ifdef CONFIG_SPL_BUILD |
416 | void sunxi_board_init(void) | 398 | void sunxi_board_init(void) |
417 | { | 399 | { |
418 | int power_failed = 0; | 400 | int power_failed = 0; |
419 | unsigned long ramsize; | 401 | unsigned long ramsize; |
420 | 402 | ||
421 | #ifdef CONFIG_AXP152_POWER | 403 | #ifdef CONFIG_AXP152_POWER |
422 | power_failed = axp152_init(); | 404 | power_failed = axp152_init(); |
423 | power_failed |= axp152_set_dcdc2(1400); | 405 | power_failed |= axp152_set_dcdc2(1400); |
424 | power_failed |= axp152_set_dcdc3(1500); | 406 | power_failed |= axp152_set_dcdc3(1500); |
425 | power_failed |= axp152_set_dcdc4(1250); | 407 | power_failed |= axp152_set_dcdc4(1250); |
426 | power_failed |= axp152_set_ldo2(3000); | 408 | power_failed |= axp152_set_ldo2(3000); |
427 | #endif | 409 | #endif |
428 | #ifdef CONFIG_AXP209_POWER | 410 | #ifdef CONFIG_AXP209_POWER |
429 | power_failed |= axp209_init(); | 411 | power_failed |= axp209_init(); |
430 | power_failed |= axp209_set_dcdc2(1400); | 412 | power_failed |= axp209_set_dcdc2(1400); |
431 | power_failed |= axp209_set_dcdc3(1250); | 413 | power_failed |= axp209_set_dcdc3(1250); |
432 | power_failed |= axp209_set_ldo2(3000); | 414 | power_failed |= axp209_set_ldo2(3000); |
433 | power_failed |= axp209_set_ldo3(2800); | 415 | power_failed |= axp209_set_ldo3(2800); |
434 | power_failed |= axp209_set_ldo4(2800); | 416 | power_failed |= axp209_set_ldo4(2800); |
435 | #endif | 417 | #endif |
436 | #ifdef CONFIG_AXP221_POWER | 418 | #ifdef CONFIG_AXP221_POWER |
437 | power_failed = axp221_init(); | 419 | power_failed = axp221_init(); |
438 | power_failed |= axp221_set_dcdc1(CONFIG_AXP221_DCDC1_VOLT); | 420 | power_failed |= axp221_set_dcdc1(CONFIG_AXP221_DCDC1_VOLT); |
439 | power_failed |= axp221_set_dcdc2(1200); /* A31:VDD-GPU, A23:VDD-SYS */ | 421 | power_failed |= axp221_set_dcdc2(1200); /* A31:VDD-GPU, A23:VDD-SYS */ |
440 | power_failed |= axp221_set_dcdc3(1200); /* VDD-CPU */ | 422 | power_failed |= axp221_set_dcdc3(1200); /* VDD-CPU */ |
441 | #ifdef CONFIG_MACH_SUN6I | 423 | #ifdef CONFIG_MACH_SUN6I |
442 | power_failed |= axp221_set_dcdc4(1200); /* A31:VDD-SYS */ | 424 | power_failed |= axp221_set_dcdc4(1200); /* A31:VDD-SYS */ |
443 | #else | 425 | #else |
444 | power_failed |= axp221_set_dcdc4(0); /* A23:unused */ | 426 | power_failed |= axp221_set_dcdc4(0); /* A23:unused */ |
445 | #endif | 427 | #endif |
446 | power_failed |= axp221_set_dcdc5(1500); /* VCC-DRAM */ | 428 | power_failed |= axp221_set_dcdc5(1500); /* VCC-DRAM */ |
447 | power_failed |= axp221_set_dldo1(CONFIG_AXP221_DLDO1_VOLT); | 429 | power_failed |= axp221_set_dldo1(CONFIG_AXP221_DLDO1_VOLT); |
448 | power_failed |= axp221_set_dldo4(CONFIG_AXP221_DLDO4_VOLT); | 430 | power_failed |= axp221_set_dldo4(CONFIG_AXP221_DLDO4_VOLT); |
449 | power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT); | 431 | power_failed |= axp221_set_aldo1(CONFIG_AXP221_ALDO1_VOLT); |
450 | power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT); | 432 | power_failed |= axp221_set_aldo2(CONFIG_AXP221_ALDO2_VOLT); |
451 | power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT); | 433 | power_failed |= axp221_set_aldo3(CONFIG_AXP221_ALDO3_VOLT); |
452 | power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT); | 434 | power_failed |= axp221_set_eldo(3, CONFIG_AXP221_ELDO3_VOLT); |
453 | #endif | 435 | #endif |
454 | 436 | ||
455 | printf("DRAM:"); | 437 | printf("DRAM:"); |
456 | ramsize = sunxi_dram_init(); | 438 | ramsize = sunxi_dram_init(); |
457 | printf(" %lu MiB\n", ramsize >> 20); | 439 | printf(" %lu MiB\n", ramsize >> 20); |
458 | if (!ramsize) | 440 | if (!ramsize) |
459 | hang(); | 441 | hang(); |
460 | 442 | ||
461 | /* | 443 | /* |
462 | * Only clock up the CPU to full speed if we are reasonably | 444 | * Only clock up the CPU to full speed if we are reasonably |
463 | * assured it's being powered with suitable core voltage | 445 | * assured it's being powered with suitable core voltage |
464 | */ | 446 | */ |
465 | if (!power_failed) | 447 | if (!power_failed) |
466 | clock_set_pll1(CONFIG_SYS_CLK_FREQ); | 448 | clock_set_pll1(CONFIG_SYS_CLK_FREQ); |
467 | else | 449 | else |
468 | printf("Failed to set core voltage! Can't set CPU frequency\n"); | 450 | printf("Failed to set core voltage! Can't set CPU frequency\n"); |
469 | } | 451 | } |
470 | #endif | 452 | #endif |
471 | 453 | ||
472 | #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) | 454 | #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) |
473 | extern const struct musb_platform_ops sunxi_musb_ops; | 455 | extern const struct musb_platform_ops sunxi_musb_ops; |
474 | 456 | ||
475 | static struct musb_hdrc_config musb_config = { | 457 | static struct musb_hdrc_config musb_config = { |
476 | .multipoint = 1, | 458 | .multipoint = 1, |
477 | .dyn_fifo = 1, | 459 | .dyn_fifo = 1, |
478 | .num_eps = 6, | 460 | .num_eps = 6, |
479 | .ram_bits = 11, | 461 | .ram_bits = 11, |
480 | }; | 462 | }; |
481 | 463 | ||
482 | static struct musb_hdrc_platform_data musb_plat = { | 464 | static struct musb_hdrc_platform_data musb_plat = { |
483 | #if defined(CONFIG_MUSB_HOST) | 465 | #if defined(CONFIG_MUSB_HOST) |
484 | .mode = MUSB_HOST, | 466 | .mode = MUSB_HOST, |
485 | #else | 467 | #else |
486 | .mode = MUSB_PERIPHERAL, | 468 | .mode = MUSB_PERIPHERAL, |
487 | #endif | 469 | #endif |
488 | .config = &musb_config, | 470 | .config = &musb_config, |
489 | .power = 250, | 471 | .power = 250, |
490 | .platform_ops = &sunxi_musb_ops, | 472 | .platform_ops = &sunxi_musb_ops, |
491 | }; | 473 | }; |
492 | #endif | 474 | #endif |
493 | 475 | ||
494 | #ifdef CONFIG_USB_GADGET | 476 | #ifdef CONFIG_USB_GADGET |
495 | int g_dnl_board_usb_cable_connected(void) | 477 | int g_dnl_board_usb_cable_connected(void) |
496 | { | 478 | { |
497 | return sunxi_usb_phy_vbus_detect(0); | 479 | return sunxi_usb_phy_vbus_detect(0); |
498 | } | 480 | } |
499 | #endif | 481 | #endif |
500 | 482 | ||
501 | #ifdef CONFIG_SERIAL_TAG | 483 | #ifdef CONFIG_SERIAL_TAG |
502 | void get_board_serial(struct tag_serialnr *serialnr) | 484 | void get_board_serial(struct tag_serialnr *serialnr) |
503 | { | 485 | { |
504 | char *serial_string; | 486 | char *serial_string; |
505 | unsigned long long serial; | 487 | unsigned long long serial; |
506 | 488 | ||
507 | serial_string = getenv("serial#"); | 489 | serial_string = getenv("serial#"); |
508 | 490 | ||
509 | if (serial_string) { | 491 | if (serial_string) { |
510 | serial = simple_strtoull(serial_string, NULL, 16); | 492 | serial = simple_strtoull(serial_string, NULL, 16); |
511 | 493 | ||
512 | serialnr->high = (unsigned int) (serial >> 32); | 494 | serialnr->high = (unsigned int) (serial >> 32); |
513 | serialnr->low = (unsigned int) (serial & 0xffffffff); | 495 | serialnr->low = (unsigned int) (serial & 0xffffffff); |
514 | } else { | 496 | } else { |
515 | serialnr->high = 0; | 497 | serialnr->high = 0; |
516 | serialnr->low = 0; | 498 | serialnr->low = 0; |
517 | } | 499 | } |
518 | } | 500 | } |
519 | #endif | 501 | #endif |
520 | 502 | ||
521 | #ifdef CONFIG_MISC_INIT_R | 503 | #ifdef CONFIG_MISC_INIT_R |
522 | int misc_init_r(void) | 504 | int misc_init_r(void) |
523 | { | 505 | { |
524 | char serial_string[17] = { 0 }; | 506 | char serial_string[17] = { 0 }; |
525 | unsigned int sid[4]; | 507 | unsigned int sid[4]; |
526 | uint8_t mac_addr[6]; | 508 | uint8_t mac_addr[6]; |
527 | int ret; | 509 | int ret; |
528 | 510 | ||
529 | ret = sunxi_get_sid(sid); | 511 | ret = sunxi_get_sid(sid); |
530 | if (ret == 0 && sid[0] != 0 && sid[3] != 0) { | 512 | if (ret == 0 && sid[0] != 0 && sid[3] != 0) { |
531 | if (!getenv("ethaddr")) { | 513 | if (!getenv("ethaddr")) { |
532 | /* Non OUI / registered MAC address */ | 514 | /* Non OUI / registered MAC address */ |
533 | mac_addr[0] = 0x02; | 515 | mac_addr[0] = 0x02; |
534 | mac_addr[1] = (sid[0] >> 0) & 0xff; | 516 | mac_addr[1] = (sid[0] >> 0) & 0xff; |
535 | mac_addr[2] = (sid[3] >> 24) & 0xff; | 517 | mac_addr[2] = (sid[3] >> 24) & 0xff; |
536 | mac_addr[3] = (sid[3] >> 16) & 0xff; | 518 | mac_addr[3] = (sid[3] >> 16) & 0xff; |
537 | mac_addr[4] = (sid[3] >> 8) & 0xff; | 519 | mac_addr[4] = (sid[3] >> 8) & 0xff; |
538 | mac_addr[5] = (sid[3] >> 0) & 0xff; | 520 | mac_addr[5] = (sid[3] >> 0) & 0xff; |
539 | 521 | ||
540 | eth_setenv_enetaddr("ethaddr", mac_addr); | 522 | eth_setenv_enetaddr("ethaddr", mac_addr); |
541 | } | 523 | } |
542 | 524 | ||
543 | if (!getenv("serial#")) { | 525 | if (!getenv("serial#")) { |
544 | snprintf(serial_string, sizeof(serial_string), | 526 | snprintf(serial_string, sizeof(serial_string), |
545 | "%08x%08x", sid[0], sid[3]); | 527 | "%08x%08x", sid[0], sid[3]); |
546 | 528 | ||
547 | setenv("serial#", serial_string); | 529 | setenv("serial#", serial_string); |
548 | } | 530 | } |
549 | } | 531 | } |
550 | 532 | ||
551 | #ifndef CONFIG_MACH_SUN9I | 533 | #ifndef CONFIG_MACH_SUN9I |
552 | ret = sunxi_usb_phy_probe(); | 534 | ret = sunxi_usb_phy_probe(); |
553 | if (ret) | 535 | if (ret) |
554 | return ret; | 536 | return ret; |
555 | #endif | 537 | #endif |
556 | #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) | 538 | #if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET) |
557 | musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); | 539 | musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE); |
558 | #endif | 540 | #endif |
559 | return 0; | 541 | return 0; |
560 | } | 542 | } |
561 | #endif | 543 | #endif |
562 | 544 | ||
563 | #ifdef CONFIG_OF_BOARD_SETUP | 545 | #ifdef CONFIG_OF_BOARD_SETUP |
564 | int ft_board_setup(void *blob, bd_t *bd) | 546 | int ft_board_setup(void *blob, bd_t *bd) |
565 | { | 547 | { |
566 | #ifdef CONFIG_VIDEO_DT_SIMPLEFB | 548 | #ifdef CONFIG_VIDEO_DT_SIMPLEFB |
567 | return sunxi_simplefb_setup(blob); | 549 | return sunxi_simplefb_setup(blob); |
568 | #endif | 550 | #endif |
569 | } | 551 | } |
570 | #endif /* CONFIG_OF_BOARD_SETUP */ | 552 | #endif /* CONFIG_OF_BOARD_SETUP */ |
571 | 553 |
drivers/mtd/nand/Makefile
1 | # | 1 | # |
2 | # (C) Copyright 2006 | 2 | # (C) Copyright 2006 |
3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. | 3 | # Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | # | 4 | # |
5 | # SPDX-License-Identifier: GPL-2.0+ | 5 | # SPDX-License-Identifier: GPL-2.0+ |
6 | # | 6 | # |
7 | 7 | ||
8 | ifdef CONFIG_SPL_BUILD | 8 | ifdef CONFIG_SPL_BUILD |
9 | 9 | ||
10 | ifdef CONFIG_SPL_NAND_DRIVERS | 10 | ifdef CONFIG_SPL_NAND_DRIVERS |
11 | NORMAL_DRIVERS=y | 11 | NORMAL_DRIVERS=y |
12 | endif | 12 | endif |
13 | 13 | ||
14 | obj-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o | 14 | obj-$(CONFIG_SPL_NAND_AM33XX_BCH) += am335x_spl_bch.o |
15 | obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.o | 15 | obj-$(CONFIG_SPL_NAND_DENALI) += denali_spl.o |
16 | obj-$(CONFIG_SPL_NAND_DOCG4) += docg4_spl.o | 16 | obj-$(CONFIG_SPL_NAND_DOCG4) += docg4_spl.o |
17 | obj-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o | 17 | obj-$(CONFIG_SPL_NAND_SIMPLE) += nand_spl_simple.o |
18 | obj-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o | 18 | obj-$(CONFIG_SPL_NAND_LOAD) += nand_spl_load.o |
19 | obj-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o | 19 | obj-$(CONFIG_SPL_NAND_ECC) += nand_ecc.o |
20 | obj-$(CONFIG_SPL_NAND_BASE) += nand_base.o | 20 | obj-$(CONFIG_SPL_NAND_BASE) += nand_base.o |
21 | obj-$(CONFIG_SPL_NAND_INIT) += nand.o | 21 | obj-$(CONFIG_SPL_NAND_INIT) += nand.o |
22 | ifeq ($(CONFIG_SPL_ENV_SUPPORT),y) | 22 | ifeq ($(CONFIG_SPL_ENV_SUPPORT),y) |
23 | obj-$(CONFIG_ENV_IS_IN_NAND) += nand_util.o | 23 | obj-$(CONFIG_ENV_IS_IN_NAND) += nand_util.o |
24 | endif | 24 | endif |
25 | 25 | ||
26 | else # not spl | 26 | else # not spl |
27 | 27 | ||
28 | NORMAL_DRIVERS=y | 28 | NORMAL_DRIVERS=y |
29 | 29 | ||
30 | obj-y += nand.o | 30 | obj-y += nand.o |
31 | obj-y += nand_bbt.o | 31 | obj-y += nand_bbt.o |
32 | obj-y += nand_ids.o | 32 | obj-y += nand_ids.o |
33 | obj-y += nand_util.o | 33 | obj-y += nand_util.o |
34 | obj-y += nand_ecc.o | 34 | obj-y += nand_ecc.o |
35 | obj-y += nand_base.o | 35 | obj-y += nand_base.o |
36 | 36 | ||
37 | endif # not spl | 37 | endif # not spl |
38 | 38 | ||
39 | ifdef NORMAL_DRIVERS | 39 | ifdef NORMAL_DRIVERS |
40 | 40 | ||
41 | obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o | 41 | obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o |
42 | 42 | ||
43 | obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o | 43 | obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o |
44 | obj-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o | 44 | obj-$(CONFIG_DRIVER_NAND_BFIN) += bfin_nand.o |
45 | obj-$(CONFIG_NAND_DAVINCI) += davinci_nand.o | 45 | obj-$(CONFIG_NAND_DAVINCI) += davinci_nand.o |
46 | obj-$(CONFIG_NAND_DENALI) += denali.o | 46 | obj-$(CONFIG_NAND_DENALI) += denali.o |
47 | obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o | 47 | obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_nand.o |
48 | obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o | 48 | obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_nand.o |
49 | obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o | 49 | obj-$(CONFIG_NAND_FSL_UPM) += fsl_upm.o |
50 | obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o | 50 | obj-$(CONFIG_NAND_FSMC) += fsmc_nand.o |
51 | obj-$(CONFIG_NAND_JZ4740) += jz4740_nand.o | 51 | obj-$(CONFIG_NAND_JZ4740) += jz4740_nand.o |
52 | obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o | 52 | obj-$(CONFIG_NAND_KB9202) += kb9202_nand.o |
53 | obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o | 53 | obj-$(CONFIG_NAND_KIRKWOOD) += kirkwood_nand.o |
54 | obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o | 54 | obj-$(CONFIG_NAND_KMETER1) += kmeter1_nand.o |
55 | obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o | 55 | obj-$(CONFIG_NAND_LPC32XX_MLC) += lpc32xx_nand_mlc.o |
56 | obj-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o | 56 | obj-$(CONFIG_NAND_MPC5121_NFC) += mpc5121_nfc.o |
57 | obj-$(CONFIG_NAND_VF610_NFC) += vf610_nfc.o | 57 | obj-$(CONFIG_NAND_VF610_NFC) += vf610_nfc.o |
58 | obj-$(CONFIG_NAND_MXC) += mxc_nand.o | 58 | obj-$(CONFIG_NAND_MXC) += mxc_nand.o |
59 | obj-$(CONFIG_NAND_MXS) += mxs_nand.o | 59 | obj-$(CONFIG_NAND_MXS) += mxs_nand.o |
60 | obj-$(CONFIG_NAND_NDFC) += ndfc.o | 60 | obj-$(CONFIG_NAND_NDFC) += ndfc.o |
61 | obj-$(CONFIG_NAND_NOMADIK) += nomadik.o | 61 | obj-$(CONFIG_NAND_NOMADIK) += nomadik.o |
62 | obj-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o | 62 | obj-$(CONFIG_NAND_S3C2410) += s3c2410_nand.o |
63 | obj-$(CONFIG_NAND_SPEAR) += spr_nand.o | 63 | obj-$(CONFIG_NAND_SPEAR) += spr_nand.o |
64 | obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o | 64 | obj-$(CONFIG_TEGRA_NAND) += tegra_nand.o |
65 | obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o | 65 | obj-$(CONFIG_NAND_OMAP_GPMC) += omap_gpmc.o |
66 | obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o | 66 | obj-$(CONFIG_NAND_OMAP_ELM) += omap_elm.o |
67 | obj-$(CONFIG_NAND_PLAT) += nand_plat.o | 67 | obj-$(CONFIG_NAND_PLAT) += nand_plat.o |
68 | obj-$(CONFIG_NAND_DOCG4) += docg4.o | 68 | obj-$(CONFIG_NAND_DOCG4) += docg4.o |
69 | 69 | ||
70 | else # minimal SPL drivers | 70 | else # minimal SPL drivers |
71 | 71 | ||
72 | obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o | 72 | obj-$(CONFIG_NAND_FSL_ELBC) += fsl_elbc_spl.o |
73 | obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o | 73 | obj-$(CONFIG_NAND_FSL_IFC) += fsl_ifc_spl.o |
74 | obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o | 74 | obj-$(CONFIG_NAND_MXC) += mxc_nand_spl.o |
75 | obj-$(CONFIG_NAND_MXS) += mxs_nand_spl.o mxs_nand.o | 75 | obj-$(CONFIG_NAND_MXS) += mxs_nand_spl.o mxs_nand.o |
76 | obj-$(CONFIG_NAND_SUNXI) += sunxi_nand_spl.o | ||
77 | 76 | ||
78 | endif # drivers | 77 | endif # drivers |
79 | 78 |
drivers/mtd/nand/sunxi_nand_spl.c
1 | /* | File was deleted | |
2 | * Copyright (c) 2014, Antmicro Ltd <www.antmicro.com> | ||
3 | * Copyright (c) 2015, Turtle Solutions <www.turtle-solutions.eu> | ||
4 | * Copyright (c) 2015, Roy Spliet <rspliet@ultimaker.com> | ||
5 | * | ||
6 | * SPDX-License-Identifier: GPL-2.0+ | ||
7 | * | ||
8 | * \todo Detect chip parameters (page size, ECC mode, randomisation...) | ||
9 | */ | ||
10 | |||
11 | #include <common.h> | ||
12 | #include <config.h> | ||
13 | #include <asm/io.h> | ||
14 | #include <nand.h> | ||
15 | #include <asm/arch/cpu.h> | ||
16 | #include <asm/arch/clock.h> | ||
17 | #include <asm/arch/dma.h> | ||
18 | #include <asm/arch/nand.h> | ||
19 | |||
20 | void | ||
21 | nand_init(void) | ||
22 | { | ||
23 | struct sunxi_ccm_reg * const ccm = | ||
24 | (struct sunxi_ccm_reg *)SUNXI_CCM_BASE; | ||
25 | struct sunxi_nand * const nand = (struct sunxi_nand *)SUNXI_NFC_BASE; | ||
26 | u32 val; | ||
27 | |||
28 | board_nand_init(); | ||
29 | |||
30 | /* "un-gate" NAND clock and clock source | ||
31 | * This assumes that the clock was already correctly configured by | ||
32 | * BootROM */ | ||
33 | setbits_le32(&ccm->ahb_gate0, (1 << AHB_GATE_OFFSET_NAND0)); | ||
34 | #ifdef CONFIG_MACH_SUN9I | ||
35 | setbits_le32(&ccm->ahb_gate1, (1 << AHB_GATE_OFFSET_DMA)); | ||
36 | #else | ||
37 | setbits_le32(&ccm->ahb_gate0, (1 << AHB_GATE_OFFSET_DMA)); | ||
38 | #endif | ||
39 | setbits_le32(&ccm->nand0_clk_cfg, 0x80000000); | ||
40 | |||
41 | val = readl(&nand->ctl); | ||
42 | val |= SUNXI_NAND_CTL_RST; | ||
43 | writel(val, &nand->ctl); | ||
44 | |||
45 | /* Wait until reset pin is deasserted */ | ||
46 | do { | ||
47 | val = readl(&nand->ctl); | ||
48 | if (!(val & SUNXI_NAND_CTL_RST)) | ||
49 | break; | ||
50 | } while (1); | ||
51 | |||
52 | /** \todo Chip select, currently kind of static */ | ||
53 | val = readl(&nand->ctl); | ||
54 | val &= 0xf0fff0f2; | ||
55 | val |= SUNXI_NAND_CTL_EN; | ||
56 | val |= SUNXI_NAND_CTL_PAGE_SIZE(CONFIG_NAND_SUNXI_PAGE_SIZE); | ||
57 | writel(val, &nand->ctl); | ||
58 | |||
59 | writel(0x100, &nand->timing_ctl); | ||
60 | writel(0x7ff, &nand->timing_cfg); | ||
61 | |||
62 | /* reset CMD */ | ||
63 | val = SUNXI_NAND_CMD_SEND_CMD1 | SUNXI_NAND_CMD_WAIT_FLAG | | ||
64 | NAND_CMD_RESET; | ||
65 | writel(val, &nand->cmd); | ||
66 | do { | ||
67 | val = readl(&nand->st); | ||
68 | if (val & (1<<1)) | ||
69 | break; | ||
70 | udelay(1000); | ||
71 | } while (1); | ||
72 | |||
73 | printf("Nand initialised\n"); | ||
74 | } | ||
75 | |||
76 | int | ||
77 | nand_wait_timeout(u32 *reg, u32 mask, u32 val) | ||
78 | { | ||
79 | unsigned long tmo = timer_get_us() + 1000000; /* 1s */ | ||
80 | |||
81 | while ((readl(reg) & mask) != val) { | ||
82 | if (timer_get_us() > tmo) | ||
83 | return -ETIMEDOUT; | ||
84 | } | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | |||
89 | /* random seed */ | ||
90 | static const uint16_t random_seed[128] = { | ||
91 | 0x2b75, 0x0bd0, 0x5ca3, 0x62d1, 0x1c93, 0x07e9, 0x2162, 0x3a72, | ||
92 | 0x0d67, 0x67f9, 0x1be7, 0x077d, 0x032f, 0x0dac, 0x2716, 0x2436, | ||
93 | 0x7922, 0x1510, 0x3860, 0x5287, 0x480f, 0x4252, 0x1789, 0x5a2d, | ||
94 | 0x2a49, 0x5e10, 0x437f, 0x4b4e, 0x2f45, 0x216e, 0x5cb7, 0x7130, | ||
95 | 0x2a3f, 0x60e4, 0x4dc9, 0x0ef0, 0x0f52, 0x1bb9, 0x6211, 0x7a56, | ||
96 | 0x226d, 0x4ea7, 0x6f36, 0x3692, 0x38bf, 0x0c62, 0x05eb, 0x4c55, | ||
97 | 0x60f4, 0x728c, 0x3b6f, 0x2037, 0x7f69, 0x0936, 0x651a, 0x4ceb, | ||
98 | 0x6218, 0x79f3, 0x383f, 0x18d9, 0x4f05, 0x5c82, 0x2912, 0x6f17, | ||
99 | 0x6856, 0x5938, 0x1007, 0x61ab, 0x3e7f, 0x57c2, 0x542f, 0x4f62, | ||
100 | 0x7454, 0x2eac, 0x7739, 0x42d4, 0x2f90, 0x435a, 0x2e52, 0x2064, | ||
101 | 0x637c, 0x66ad, 0x2c90, 0x0bad, 0x759c, 0x0029, 0x0986, 0x7126, | ||
102 | 0x1ca7, 0x1605, 0x386a, 0x27f5, 0x1380, 0x6d75, 0x24c3, 0x0f8e, | ||
103 | 0x2b7a, 0x1418, 0x1fd1, 0x7dc1, 0x2d8e, 0x43af, 0x2267, 0x7da3, | ||
104 | 0x4e3d, 0x1338, 0x50db, 0x454d, 0x764d, 0x40a3, 0x42e6, 0x262b, | ||
105 | 0x2d2e, 0x1aea, 0x2e17, 0x173d, 0x3a6e, 0x71bf, 0x25f9, 0x0a5d, | ||
106 | 0x7c57, 0x0fbe, 0x46ce, 0x4939, 0x6b17, 0x37bb, 0x3e91, 0x76db, | ||
107 | }; | ||
108 | |||
109 | uint32_t ecc_errors = 0; | ||
110 | |||
111 | static void | ||
112 | nand_config_ecc(struct sunxi_nand *nand, uint32_t page, int syndrome) | ||
113 | { | ||
114 | static u8 strength[] = {16, 24, 28, 32, 40, 48, 56, 60, 64}; | ||
115 | int i; | ||
116 | uint32_t ecc_mode; | ||
117 | u32 ecc; | ||
118 | u16 seed = 0; | ||
119 | |||
120 | for (i = 0; i < ARRAY_SIZE(strength); i++) { | ||
121 | if (CONFIG_NAND_SUNXI_ECC_STRENGTH == strength[i]) { | ||
122 | ecc_mode = i; | ||
123 | break; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | if (i == ARRAY_SIZE(strength)) { | ||
128 | printf("ECC strength unsupported\n"); | ||
129 | return; | ||
130 | } | ||
131 | |||
132 | ecc = SUNXI_NAND_ECC_CTL_ECC_EN | | ||
133 | SUNXI_NAND_ECC_CTL_PIPELINE | | ||
134 | SUNXI_NAND_ECC_CTL_RND_EN | | ||
135 | SUNXI_NAND_ECC_CTL_MODE(ecc_mode); | ||
136 | |||
137 | if (CONFIG_NAND_SUNXI_ECC_STEP == 512) | ||
138 | ecc |= SUNXI_NAND_ECC_CTL_BS_512B; | ||
139 | |||
140 | if (syndrome) | ||
141 | seed = 0x4A80; | ||
142 | else | ||
143 | seed = random_seed[page % ARRAY_SIZE(random_seed)]; | ||
144 | |||
145 | ecc |= SUNXI_NAND_ECC_CTL_RND_SEED(seed); | ||
146 | |||
147 | writel(ecc, &nand->ecc_ctl); | ||
148 | } | ||
149 | |||
150 | /* read CONFIG_NAND_SUNXI_ECC_STEP bytes from real_addr to temp_buf */ | ||
151 | void | ||
152 | nand_read_block(struct sunxi_nand *nand, phys_addr_t src, dma_addr_t dst, | ||
153 | int syndrome) | ||
154 | { | ||
155 | struct sunxi_dma * const dma = (struct sunxi_dma *)SUNXI_DMA_BASE; | ||
156 | struct sunxi_dma_cfg * const dma_cfg = &dma->ddma[0]; | ||
157 | |||
158 | uint32_t shift; | ||
159 | uint32_t page; | ||
160 | uint32_t addr; | ||
161 | uint32_t oob_offset; | ||
162 | uint32_t ecc_bytes; | ||
163 | u32 val; | ||
164 | u32 cmd; | ||
165 | |||
166 | page = src / CONFIG_NAND_SUNXI_PAGE_SIZE; | ||
167 | if (page > 0xFFFF) { | ||
168 | /* TODO: currently this is not supported */ | ||
169 | printf("Reading from address >= %08X is not allowed.\n", | ||
170 | 0xFFFF * CONFIG_NAND_SUNXI_PAGE_SIZE); | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | shift = src % CONFIG_NAND_SUNXI_PAGE_SIZE; | ||
175 | writel(0, &nand->ecc_st); | ||
176 | |||
177 | /* ECC_CTL, randomization */ | ||
178 | ecc_bytes = CONFIG_NAND_SUNXI_ECC_STRENGTH * | ||
179 | fls(CONFIG_NAND_SUNXI_ECC_STEP * 8); | ||
180 | ecc_bytes = DIV_ROUND_UP(ecc_bytes, 8); | ||
181 | ecc_bytes += (ecc_bytes & 1); /* Align to 2-bytes */ | ||
182 | ecc_bytes += 4; | ||
183 | |||
184 | nand_config_ecc(nand, page, syndrome); | ||
185 | if (syndrome) { | ||
186 | /* shift every 1kB in syndrome */ | ||
187 | shift += (shift / CONFIG_NAND_SUNXI_ECC_STEP) * ecc_bytes; | ||
188 | oob_offset = CONFIG_NAND_SUNXI_ECC_STEP + shift; | ||
189 | } else { | ||
190 | oob_offset = CONFIG_NAND_SUNXI_PAGE_SIZE + | ||
191 | (shift / CONFIG_NAND_SUNXI_ECC_STEP) * ecc_bytes; | ||
192 | } | ||
193 | |||
194 | addr = (page << 16) | shift; | ||
195 | |||
196 | /* DMA */ | ||
197 | val = readl(&nand->ctl); | ||
198 | writel(val | SUNXI_NAND_CTL_RAM_METHOD_DMA, &nand->ctl); | ||
199 | |||
200 | writel(oob_offset, &nand->spare_area); | ||
201 | |||
202 | /* DMAC | ||
203 | * \todo Separate this into a tidy driver */ | ||
204 | writel(0x0, &dma->irq_en); /* clear dma interrupts */ | ||
205 | writel((uint32_t) &nand->io_data , &dma_cfg->src_addr); | ||
206 | writel(dst , &dma_cfg->dst_addr); | ||
207 | writel(0x00007F0F , &dma_cfg->ddma_para); | ||
208 | writel(CONFIG_NAND_SUNXI_ECC_STEP, &dma_cfg->bc); | ||
209 | |||
210 | val = SUNXI_DMA_CTL_SRC_DRQ(DDMA_SRC_DRQ_NAND) | | ||
211 | SUNXI_DMA_CTL_MODE_IO | | ||
212 | SUNXI_DMA_CTL_SRC_DATA_WIDTH_32 | | ||
213 | SUNXI_DMA_CTL_DST_DRQ(DDMA_DST_DRQ_SDRAM) | | ||
214 | SUNXI_DMA_CTL_DST_DATA_WIDTH_32 | | ||
215 | SUNXI_DMA_CTL_TRIGGER; | ||
216 | writel(val, &dma_cfg->ctl); | ||
217 | |||
218 | writel(0x00E00530, &nand->rcmd_set); | ||
219 | nand_wait_timeout(&nand->st, SUNXI_NAND_ST_FIFO_FULL, 0); | ||
220 | |||
221 | writel(1 , &nand->block_num); | ||
222 | writel(addr, &nand->addr_low); | ||
223 | writel(0 , &nand->addr_high); | ||
224 | |||
225 | /* CMD (PAGE READ) */ | ||
226 | cmd = 0x85E80000; | ||
227 | cmd |= SUNXI_NAND_CMD_ADDR_CYCLES(CONFIG_NAND_SUNXI_ADDR_CYCLES); | ||
228 | cmd |= (syndrome ? SUNXI_NAND_CMD_ORDER_SEQ : | ||
229 | SUNXI_NAND_CMD_ORDER_INTERLEAVE); | ||
230 | writel(cmd, &nand->cmd); | ||
231 | |||
232 | if(nand_wait_timeout(&nand->st, SUNXI_NAND_ST_DMA_INT, | ||
233 | SUNXI_NAND_ST_DMA_INT)) { | ||
234 | printf("NAND timeout reading data\n"); | ||
235 | return; | ||
236 | } | ||
237 | |||
238 | if(nand_wait_timeout(&dma_cfg->ctl, SUNXI_DMA_CTL_TRIGGER, 0)) { | ||
239 | printf("NAND timeout reading data\n"); | ||
240 | return; | ||
241 | } | ||
242 | |||
243 | if (readl(&nand->ecc_st)) | ||
244 | ecc_errors++; | ||
245 | } | ||
246 | |||
247 | int | ||
248 | nand_spl_load_image(uint32_t offs, unsigned int size, void *dest) | ||
249 | { | ||
250 | struct sunxi_nand * const nand = (struct sunxi_nand *)SUNXI_NFC_BASE; | ||
251 | dma_addr_t dst_block; | ||
252 | dma_addr_t dst_end; | ||
253 | phys_addr_t addr = offs; | ||
254 | |||
255 | dst_end = ((dma_addr_t) dest) + size; | ||
256 | |||
257 | memset((void *)dest, 0x0, size); | ||
258 | ecc_errors = 0; | ||
259 | for (dst_block = (dma_addr_t) dest; dst_block < dst_end; | ||
260 | dst_block += CONFIG_NAND_SUNXI_ECC_STEP, | ||
261 | addr += CONFIG_NAND_SUNXI_ECC_STEP) { | ||
262 | /* syndrome read first 4MiB to match Allwinner BootROM */ | ||
263 | nand_read_block(nand, addr, dst_block, addr < 0x400000); | ||
264 | } | ||
265 | |||
266 | if (ecc_errors) | ||
267 | printf("Error: %d ECC failures detected\n", ecc_errors); | ||
268 | return ecc_errors == 0; | ||
269 | } | ||
270 | |||
271 | void | ||
272 | nand_deselect(void) | ||
273 | {} | ||
274 | 1 | /* |
include/configs/sun4i.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * | 3 | * |
4 | * Configuration settings for the Allwinner A10 (sun4i) CPU | 4 | * Configuration settings for the Allwinner A10 (sun4i) CPU |
5 | * | 5 | * |
6 | * SPDX-License-Identifier: GPL-2.0+ | 6 | * SPDX-License-Identifier: GPL-2.0+ |
7 | */ | 7 | */ |
8 | #ifndef __CONFIG_H | 8 | #ifndef __CONFIG_H |
9 | #define __CONFIG_H | 9 | #define __CONFIG_H |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * A10 specific configuration | 12 | * A10 specific configuration |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifdef CONFIG_USB_EHCI | 15 | #ifdef CONFIG_USB_EHCI |
16 | #define CONFIG_USB_EHCI_SUNXI | 16 | #define CONFIG_USB_EHCI_SUNXI |
17 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 | 17 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #define CONFIG_SUNXI_USB_PHYS 3 | 20 | #define CONFIG_SUNXI_USB_PHYS 3 |
21 | #define CONFIG_NAND_SUNXI_GPC_PORTS {16, 17, 18, 19, 20, 21, 22, 24} | ||
22 | 21 | ||
23 | /* | 22 | /* |
24 | * Include common sunxi configuration where most the settings are | 23 | * Include common sunxi configuration where most the settings are |
25 | */ | 24 | */ |
26 | #include <configs/sunxi-common.h> | 25 | #include <configs/sunxi-common.h> |
27 | 26 | ||
28 | #define CONFIG_MACH_TYPE (4104 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) | 27 | #define CONFIG_MACH_TYPE (4104 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) |
29 | 28 | ||
30 | #endif /* __CONFIG_H */ | 29 | #endif /* __CONFIG_H */ |
31 | 30 |
include/configs/sun5i.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * | 3 | * |
4 | * Configuration settings for the Allwinner A13 (sun5i) CPU | 4 | * Configuration settings for the Allwinner A13 (sun5i) CPU |
5 | * | 5 | * |
6 | * SPDX-License-Identifier: GPL-2.0+ | 6 | * SPDX-License-Identifier: GPL-2.0+ |
7 | */ | 7 | */ |
8 | #ifndef __CONFIG_H | 8 | #ifndef __CONFIG_H |
9 | #define __CONFIG_H | 9 | #define __CONFIG_H |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * High Level Configuration Options | 12 | * High Level Configuration Options |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifdef CONFIG_USB_EHCI | 15 | #ifdef CONFIG_USB_EHCI |
16 | #define CONFIG_USB_EHCI_SUNXI | 16 | #define CONFIG_USB_EHCI_SUNXI |
17 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 | 17 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 |
18 | #endif | 18 | #endif |
19 | 19 | ||
20 | #define CONFIG_SUNXI_USB_PHYS 2 | 20 | #define CONFIG_SUNXI_USB_PHYS 2 |
21 | 21 | ||
22 | /* \todo A13 only defines port 19, whereas A10s requires each of these */ | ||
23 | #define CONFIG_NAND_SUNXI_GPC_PORTS {16, 17, 18, 19} | ||
24 | |||
25 | /* | 22 | /* |
26 | * Include common sunxi configuration where most the settings are | 23 | * Include common sunxi configuration where most the settings are |
27 | */ | 24 | */ |
28 | #include <configs/sunxi-common.h> | 25 | #include <configs/sunxi-common.h> |
29 | 26 | ||
30 | #define CONFIG_MACH_TYPE (4138 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) | 27 | #define CONFIG_MACH_TYPE (4138 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) |
31 | 28 | ||
32 | #endif /* __CONFIG_H */ | 29 | #endif /* __CONFIG_H */ |
33 | 30 |
include/configs/sun6i.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> | 3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> |
4 | * (C) Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com> | 4 | * (C) Copyright 2013 Maxime Ripard <maxime.ripard@free-electrons.com> |
5 | * | 5 | * |
6 | * Configuration settings for the Allwinner A31 (sun6i) CPU | 6 | * Configuration settings for the Allwinner A31 (sun6i) CPU |
7 | * | 7 | * |
8 | * SPDX-License-Identifier: GPL-2.0+ | 8 | * SPDX-License-Identifier: GPL-2.0+ |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __CONFIG_H | 11 | #ifndef __CONFIG_H |
12 | #define __CONFIG_H | 12 | #define __CONFIG_H |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * A31 specific configuration | 15 | * A31 specific configuration |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifdef CONFIG_USB_EHCI | 18 | #ifdef CONFIG_USB_EHCI |
19 | #define CONFIG_USB_EHCI_SUNXI | 19 | #define CONFIG_USB_EHCI_SUNXI |
20 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 | 20 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #define CONFIG_SUNXI_USB_PHYS 3 | 23 | #define CONFIG_SUNXI_USB_PHYS 3 |
24 | 24 | ||
25 | #define CONFIG_ARMV7_PSCI 1 | 25 | #define CONFIG_ARMV7_PSCI 1 |
26 | #define CONFIG_ARMV7_PSCI_NR_CPUS 4 | 26 | #define CONFIG_ARMV7_PSCI_NR_CPUS 4 |
27 | #define CONFIG_ARMV7_SECURE_BASE SUNXI_SRAM_B_BASE | 27 | #define CONFIG_ARMV7_SECURE_BASE SUNXI_SRAM_B_BASE |
28 | #define CONFIG_TIMER_CLK_FREQ 24000000 | 28 | #define CONFIG_TIMER_CLK_FREQ 24000000 |
29 | 29 | ||
30 | #define CONFIG_NAND_SUNXI_GPC_PORTS {24, 25, 26} | ||
31 | |||
32 | /* | 30 | /* |
33 | * Include common sunxi configuration where most the settings are | 31 | * Include common sunxi configuration where most the settings are |
34 | */ | 32 | */ |
35 | #include <configs/sunxi-common.h> | 33 | #include <configs/sunxi-common.h> |
36 | 34 | ||
37 | #endif /* __CONFIG_H */ | 35 | #endif /* __CONFIG_H */ |
38 | 36 |
include/configs/sun7i.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2013 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> | 3 | * (C) Copyright 2013 Luke Kenneth Casson Leighton <lkcl@lkcl.net> |
4 | * | 4 | * |
5 | * Configuration settings for the Allwinner A20 (sun7i) CPU | 5 | * Configuration settings for the Allwinner A20 (sun7i) CPU |
6 | * | 6 | * |
7 | * SPDX-License-Identifier: GPL-2.0+ | 7 | * SPDX-License-Identifier: GPL-2.0+ |
8 | */ | 8 | */ |
9 | #ifndef __CONFIG_H | 9 | #ifndef __CONFIG_H |
10 | #define __CONFIG_H | 10 | #define __CONFIG_H |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * A20 specific configuration | 13 | * A20 specific configuration |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifdef CONFIG_USB_EHCI | 16 | #ifdef CONFIG_USB_EHCI |
17 | #define CONFIG_USB_EHCI_SUNXI | 17 | #define CONFIG_USB_EHCI_SUNXI |
18 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 | 18 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 2 |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #define CONFIG_SUNXI_USB_PHYS 3 | 21 | #define CONFIG_SUNXI_USB_PHYS 3 |
22 | 22 | ||
23 | #define CONFIG_ARMV7_PSCI 1 | 23 | #define CONFIG_ARMV7_PSCI 1 |
24 | #define CONFIG_ARMV7_SECURE_BASE SUNXI_SRAM_B_BASE | 24 | #define CONFIG_ARMV7_SECURE_BASE SUNXI_SRAM_B_BASE |
25 | #define CONFIG_TIMER_CLK_FREQ 24000000 | 25 | #define CONFIG_TIMER_CLK_FREQ 24000000 |
26 | 26 | ||
27 | #define CONFIG_NAND_SUNXI_GPC_PORTS {16, 17, 18, 19, 20, 21, 22, 24} | ||
28 | |||
29 | /* | 27 | /* |
30 | * Include common sunxi configuration where most the settings are | 28 | * Include common sunxi configuration where most the settings are |
31 | */ | 29 | */ |
32 | #include <configs/sunxi-common.h> | 30 | #include <configs/sunxi-common.h> |
33 | 31 | ||
34 | #define CONFIG_MACH_TYPE (4283 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) | 32 | #define CONFIG_MACH_TYPE (4283 | ((CONFIG_MACH_TYPE_COMPAT_REV) << 28)) |
35 | 33 | ||
36 | #endif /* __CONFIG_H */ | 34 | #endif /* __CONFIG_H */ |
37 | 35 |
include/configs/sun8i.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2014 Chen-Yu Tsai <wens@csie.org> | 2 | * (C) Copyright 2014 Chen-Yu Tsai <wens@csie.org> |
3 | * | 3 | * |
4 | * Configuration settings for the Allwinner A23 (sun8i) CPU | 4 | * Configuration settings for the Allwinner A23 (sun8i) CPU |
5 | * | 5 | * |
6 | * SPDX-License-Identifier: GPL-2.0+ | 6 | * SPDX-License-Identifier: GPL-2.0+ |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #ifndef __CONFIG_H | 9 | #ifndef __CONFIG_H |
10 | #define __CONFIG_H | 10 | #define __CONFIG_H |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * A23 specific configuration | 13 | * A23 specific configuration |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #ifdef CONFIG_USB_EHCI | 16 | #ifdef CONFIG_USB_EHCI |
17 | #define CONFIG_USB_EHCI_SUNXI | 17 | #define CONFIG_USB_EHCI_SUNXI |
18 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 | 18 | #define CONFIG_USB_MAX_CONTROLLER_COUNT 1 |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | #define CONFIG_SUNXI_USB_PHYS 2 | 21 | #define CONFIG_SUNXI_USB_PHYS 2 |
22 | 22 | ||
23 | #define CONFIG_ARMV7_PSCI 1 | 23 | #define CONFIG_ARMV7_PSCI 1 |
24 | #if defined(CONFIG_MACH_SUN8I_A23) | 24 | #if defined(CONFIG_MACH_SUN8I_A23) |
25 | #define CONFIG_ARMV7_PSCI_NR_CPUS 2 | 25 | #define CONFIG_ARMV7_PSCI_NR_CPUS 2 |
26 | #define CONFIG_NAND_SUNXI_GPC_PORTS {16, 17, 18} | ||
27 | #elif defined(CONFIG_MACH_SUN8I_A33) | 26 | #elif defined(CONFIG_MACH_SUN8I_A33) |
28 | #define CONFIG_ARMV7_PSCI_NR_CPUS 4 | 27 | #define CONFIG_ARMV7_PSCI_NR_CPUS 4 |
29 | #define CONFIG_NAND_SUNXI_GPC_PORTS {16} | ||
30 | #else | 28 | #else |
31 | #error Unsupported sun8i variant | 29 | #error Unsupported sun8i variant |
32 | #endif | 30 | #endif |
33 | #define CONFIG_TIMER_CLK_FREQ 24000000 | 31 | #define CONFIG_TIMER_CLK_FREQ 24000000 |
34 | 32 | ||
35 | /* | 33 | /* |
36 | * Include common sunxi configuration where most the settings are | 34 | * Include common sunxi configuration where most the settings are |
37 | */ | 35 | */ |
38 | #include <configs/sunxi-common.h> | 36 | #include <configs/sunxi-common.h> |
39 | 37 | ||
40 | #endif /* __CONFIG_H */ | 38 | #endif /* __CONFIG_H */ |
41 | 39 |
include/configs/sunxi-common.h
1 | /* | 1 | /* |
2 | * (C) Copyright 2012-2012 Henrik Nordstrom <henrik@henriknordstrom.net> | 2 | * (C) Copyright 2012-2012 Henrik Nordstrom <henrik@henriknordstrom.net> |
3 | * | 3 | * |
4 | * (C) Copyright 2007-2011 | 4 | * (C) Copyright 2007-2011 |
5 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> | 5 | * Allwinner Technology Co., Ltd. <www.allwinnertech.com> |
6 | * Tom Cubie <tangliang@allwinnertech.com> | 6 | * Tom Cubie <tangliang@allwinnertech.com> |
7 | * | 7 | * |
8 | * Configuration settings for the Allwinner sunxi series of boards. | 8 | * Configuration settings for the Allwinner sunxi series of boards. |
9 | * | 9 | * |
10 | * SPDX-License-Identifier: GPL-2.0+ | 10 | * SPDX-License-Identifier: GPL-2.0+ |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #ifndef _SUNXI_COMMON_CONFIG_H | 13 | #ifndef _SUNXI_COMMON_CONFIG_H |
14 | #define _SUNXI_COMMON_CONFIG_H | 14 | #define _SUNXI_COMMON_CONFIG_H |
15 | 15 | ||
16 | #include <linux/stringify.h> | 16 | #include <linux/stringify.h> |
17 | 17 | ||
18 | #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT | 18 | #ifdef CONFIG_OLD_SUNXI_KERNEL_COMPAT |
19 | /* | 19 | /* |
20 | * The U-Boot workarounds bugs in the outdated buggy sunxi-3.4 kernels at the | 20 | * The U-Boot workarounds bugs in the outdated buggy sunxi-3.4 kernels at the |
21 | * expense of restricting some features, so the regular machine id values can | 21 | * expense of restricting some features, so the regular machine id values can |
22 | * be used. | 22 | * be used. |
23 | */ | 23 | */ |
24 | # define CONFIG_MACH_TYPE_COMPAT_REV 0 | 24 | # define CONFIG_MACH_TYPE_COMPAT_REV 0 |
25 | #else | 25 | #else |
26 | /* | 26 | /* |
27 | * A compatibility guard to prevent loading outdated buggy sunxi-3.4 kernels. | 27 | * A compatibility guard to prevent loading outdated buggy sunxi-3.4 kernels. |
28 | * Only sunxi-3.4 kernels with appropriate fixes applied are able to pass | 28 | * Only sunxi-3.4 kernels with appropriate fixes applied are able to pass |
29 | * beyond the machine id check. | 29 | * beyond the machine id check. |
30 | */ | 30 | */ |
31 | # define CONFIG_MACH_TYPE_COMPAT_REV 1 | 31 | # define CONFIG_MACH_TYPE_COMPAT_REV 1 |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | /* | 34 | /* |
35 | * High Level Configuration Options | 35 | * High Level Configuration Options |
36 | */ | 36 | */ |
37 | #define CONFIG_SUNXI /* sunxi family */ | 37 | #define CONFIG_SUNXI /* sunxi family */ |
38 | #ifdef CONFIG_SPL_BUILD | 38 | #ifdef CONFIG_SPL_BUILD |
39 | #define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */ | 39 | #define CONFIG_SYS_THUMB_BUILD /* Thumbs mode to save space in SPL */ |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #include <asm/arch/cpu.h> /* get chip and board defs */ | 42 | #include <asm/arch/cpu.h> /* get chip and board defs */ |
43 | 43 | ||
44 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL) | 44 | #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_DM_SERIAL) |
45 | # define CONFIG_DW_SERIAL | 45 | # define CONFIG_DW_SERIAL |
46 | #endif | 46 | #endif |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Display CPU information | 49 | * Display CPU information |
50 | */ | 50 | */ |
51 | #define CONFIG_DISPLAY_CPUINFO | 51 | #define CONFIG_DISPLAY_CPUINFO |
52 | 52 | ||
53 | #define CONFIG_SYS_PROMPT "sunxi# " | 53 | #define CONFIG_SYS_PROMPT "sunxi# " |
54 | 54 | ||
55 | /* Serial & console */ | 55 | /* Serial & console */ |
56 | #define CONFIG_SYS_NS16550 | 56 | #define CONFIG_SYS_NS16550 |
57 | #define CONFIG_SYS_NS16550_SERIAL | 57 | #define CONFIG_SYS_NS16550_SERIAL |
58 | /* ns16550 reg in the low bits of cpu reg */ | 58 | /* ns16550 reg in the low bits of cpu reg */ |
59 | #define CONFIG_SYS_NS16550_CLK 24000000 | 59 | #define CONFIG_SYS_NS16550_CLK 24000000 |
60 | #ifndef CONFIG_DM_SERIAL | 60 | #ifndef CONFIG_DM_SERIAL |
61 | # define CONFIG_SYS_NS16550_REG_SIZE -4 | 61 | # define CONFIG_SYS_NS16550_REG_SIZE -4 |
62 | # define CONFIG_SYS_NS16550_COM1 SUNXI_UART0_BASE | 62 | # define CONFIG_SYS_NS16550_COM1 SUNXI_UART0_BASE |
63 | # define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE | 63 | # define CONFIG_SYS_NS16550_COM2 SUNXI_UART1_BASE |
64 | # define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE | 64 | # define CONFIG_SYS_NS16550_COM3 SUNXI_UART2_BASE |
65 | # define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE | 65 | # define CONFIG_SYS_NS16550_COM4 SUNXI_UART3_BASE |
66 | # define CONFIG_SYS_NS16550_COM5 SUNXI_R_UART_BASE | 66 | # define CONFIG_SYS_NS16550_COM5 SUNXI_R_UART_BASE |
67 | #endif | 67 | #endif |
68 | 68 | ||
69 | /* CPU */ | 69 | /* CPU */ |
70 | #define CONFIG_SYS_CACHELINE_SIZE 64 | 70 | #define CONFIG_SYS_CACHELINE_SIZE 64 |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * The DRAM Base differs between some models. We cannot use macros for the | 73 | * The DRAM Base differs between some models. We cannot use macros for the |
74 | * CONFIG_FOO defines which contain the DRAM base address since they end | 74 | * CONFIG_FOO defines which contain the DRAM base address since they end |
75 | * up unexpanded in include/autoconf.mk . | 75 | * up unexpanded in include/autoconf.mk . |
76 | * | 76 | * |
77 | * So we have to have this #ifdef #else #endif block for these. | 77 | * So we have to have this #ifdef #else #endif block for these. |
78 | */ | 78 | */ |
79 | #ifdef CONFIG_MACH_SUN9I | 79 | #ifdef CONFIG_MACH_SUN9I |
80 | #define SDRAM_OFFSET(x) 0x2##x | 80 | #define SDRAM_OFFSET(x) 0x2##x |
81 | #define CONFIG_SYS_SDRAM_BASE 0x20000000 | 81 | #define CONFIG_SYS_SDRAM_BASE 0x20000000 |
82 | #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* default load address */ | 82 | #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* default load address */ |
83 | #define CONFIG_SYS_TEXT_BASE 0x2a000000 | 83 | #define CONFIG_SYS_TEXT_BASE 0x2a000000 |
84 | #define CONFIG_PRE_CON_BUF_ADDR 0x2f000000 | 84 | #define CONFIG_PRE_CON_BUF_ADDR 0x2f000000 |
85 | #define CONFIG_SYS_SPL_MALLOC_START 0x2ff00000 | 85 | #define CONFIG_SYS_SPL_MALLOC_START 0x2ff00000 |
86 | #define CONFIG_SPL_BSS_START_ADDR 0x2ff80000 | 86 | #define CONFIG_SPL_BSS_START_ADDR 0x2ff80000 |
87 | #else | 87 | #else |
88 | #define SDRAM_OFFSET(x) 0x4##x | 88 | #define SDRAM_OFFSET(x) 0x4##x |
89 | #define CONFIG_SYS_SDRAM_BASE 0x40000000 | 89 | #define CONFIG_SYS_SDRAM_BASE 0x40000000 |
90 | #define CONFIG_SYS_LOAD_ADDR 0x42000000 /* default load address */ | 90 | #define CONFIG_SYS_LOAD_ADDR 0x42000000 /* default load address */ |
91 | #define CONFIG_SYS_TEXT_BASE 0x4a000000 | 91 | #define CONFIG_SYS_TEXT_BASE 0x4a000000 |
92 | #define CONFIG_PRE_CON_BUF_ADDR 0x4f000000 | 92 | #define CONFIG_PRE_CON_BUF_ADDR 0x4f000000 |
93 | #define CONFIG_SYS_SPL_MALLOC_START 0x4ff00000 | 93 | #define CONFIG_SYS_SPL_MALLOC_START 0x4ff00000 |
94 | #define CONFIG_SPL_BSS_START_ADDR 0x4ff80000 | 94 | #define CONFIG_SPL_BSS_START_ADDR 0x4ff80000 |
95 | #endif | 95 | #endif |
96 | 96 | ||
97 | #define CONFIG_SPL_BSS_MAX_SIZE 0x00080000 /* 512 KiB */ | 97 | #define CONFIG_SPL_BSS_MAX_SIZE 0x00080000 /* 512 KiB */ |
98 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x00080000 /* 512 KiB */ | 98 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x00080000 /* 512 KiB */ |
99 | 99 | ||
100 | #ifdef CONFIG_MACH_SUN9I | 100 | #ifdef CONFIG_MACH_SUN9I |
101 | /* | 101 | /* |
102 | * The A80's A1 sram starts at 0x00010000 rather then at 0x00000000 and is | 102 | * The A80's A1 sram starts at 0x00010000 rather then at 0x00000000 and is |
103 | * slightly bigger. Note that it is possible to map the first 32 KiB of the | 103 | * slightly bigger. Note that it is possible to map the first 32 KiB of the |
104 | * A1 at 0x00000000 like with older SoCs by writing 0x16aa0001 to the | 104 | * A1 at 0x00000000 like with older SoCs by writing 0x16aa0001 to the |
105 | * undocumented 0x008000e0 SYS_CTRL register. Where the 16aa is a key and | 105 | * undocumented 0x008000e0 SYS_CTRL register. Where the 16aa is a key and |
106 | * the 1 actually activates the mapping of the first 32 KiB to 0x00000000. | 106 | * the 1 actually activates the mapping of the first 32 KiB to 0x00000000. |
107 | */ | 107 | */ |
108 | #define CONFIG_SYS_INIT_RAM_ADDR 0x10000 | 108 | #define CONFIG_SYS_INIT_RAM_ADDR 0x10000 |
109 | #define CONFIG_SYS_INIT_RAM_SIZE 0x0a000 /* 40 KiB */ | 109 | #define CONFIG_SYS_INIT_RAM_SIZE 0x0a000 /* 40 KiB */ |
110 | #else | 110 | #else |
111 | #define CONFIG_SYS_INIT_RAM_ADDR 0x0 | 111 | #define CONFIG_SYS_INIT_RAM_ADDR 0x0 |
112 | #define CONFIG_SYS_INIT_RAM_SIZE 0x8000 /* 32 KiB */ | 112 | #define CONFIG_SYS_INIT_RAM_SIZE 0x8000 /* 32 KiB */ |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #define CONFIG_SYS_INIT_SP_OFFSET \ | 115 | #define CONFIG_SYS_INIT_SP_OFFSET \ |
116 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) | 116 | (CONFIG_SYS_INIT_RAM_SIZE - GENERATED_GBL_DATA_SIZE) |
117 | #define CONFIG_SYS_INIT_SP_ADDR \ | 117 | #define CONFIG_SYS_INIT_SP_ADDR \ |
118 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) | 118 | (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_SP_OFFSET) |
119 | 119 | ||
120 | #define CONFIG_NR_DRAM_BANKS 1 | 120 | #define CONFIG_NR_DRAM_BANKS 1 |
121 | #define PHYS_SDRAM_0 CONFIG_SYS_SDRAM_BASE | 121 | #define PHYS_SDRAM_0 CONFIG_SYS_SDRAM_BASE |
122 | #define PHYS_SDRAM_0_SIZE 0x80000000 /* 2 GiB */ | 122 | #define PHYS_SDRAM_0_SIZE 0x80000000 /* 2 GiB */ |
123 | 123 | ||
124 | #ifdef CONFIG_AHCI | 124 | #ifdef CONFIG_AHCI |
125 | #define CONFIG_LIBATA | 125 | #define CONFIG_LIBATA |
126 | #define CONFIG_SCSI_AHCI | 126 | #define CONFIG_SCSI_AHCI |
127 | #define CONFIG_SCSI_AHCI_PLAT | 127 | #define CONFIG_SCSI_AHCI_PLAT |
128 | #define CONFIG_SUNXI_AHCI | 128 | #define CONFIG_SUNXI_AHCI |
129 | #define CONFIG_SYS_64BIT_LBA | 129 | #define CONFIG_SYS_64BIT_LBA |
130 | #define CONFIG_SYS_SCSI_MAX_SCSI_ID 1 | 130 | #define CONFIG_SYS_SCSI_MAX_SCSI_ID 1 |
131 | #define CONFIG_SYS_SCSI_MAX_LUN 1 | 131 | #define CONFIG_SYS_SCSI_MAX_LUN 1 |
132 | #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ | 132 | #define CONFIG_SYS_SCSI_MAX_DEVICE (CONFIG_SYS_SCSI_MAX_SCSI_ID * \ |
133 | CONFIG_SYS_SCSI_MAX_LUN) | 133 | CONFIG_SYS_SCSI_MAX_LUN) |
134 | #define CONFIG_CMD_SCSI | 134 | #define CONFIG_CMD_SCSI |
135 | #endif | 135 | #endif |
136 | 136 | ||
137 | #define CONFIG_SETUP_MEMORY_TAGS | 137 | #define CONFIG_SETUP_MEMORY_TAGS |
138 | #define CONFIG_CMDLINE_TAG | 138 | #define CONFIG_CMDLINE_TAG |
139 | #define CONFIG_INITRD_TAG | 139 | #define CONFIG_INITRD_TAG |
140 | #define CONFIG_SERIAL_TAG | 140 | #define CONFIG_SERIAL_TAG |
141 | 141 | ||
142 | /* mmc config */ | 142 | /* mmc config */ |
143 | #if !defined(CONFIG_UART0_PORT_F) | 143 | #if !defined(CONFIG_UART0_PORT_F) |
144 | #define CONFIG_MMC | 144 | #define CONFIG_MMC |
145 | #define CONFIG_GENERIC_MMC | 145 | #define CONFIG_GENERIC_MMC |
146 | #define CONFIG_CMD_MMC | 146 | #define CONFIG_CMD_MMC |
147 | #define CONFIG_MMC_SUNXI | 147 | #define CONFIG_MMC_SUNXI |
148 | #define CONFIG_MMC_SUNXI_SLOT 0 | 148 | #define CONFIG_MMC_SUNXI_SLOT 0 |
149 | #if !defined(CONFIG_SPL_NAND_SUPPORT) | ||
150 | #define CONFIG_ENV_IS_IN_MMC | 149 | #define CONFIG_ENV_IS_IN_MMC |
151 | #define CONFIG_SYS_MMC_ENV_DEV 0 /* first detected MMC controller */ | 150 | #define CONFIG_SYS_MMC_ENV_DEV 0 /* first detected MMC controller */ |
152 | #endif /* CONFIG_SPL_NAND_SUPPORT */ | ||
153 | #endif | 151 | #endif |
154 | 152 | ||
155 | /* 4MB of malloc() pool */ | 153 | /* 4MB of malloc() pool */ |
156 | #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (4 << 20)) | 154 | #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (4 << 20)) |
157 | 155 | ||
158 | /* | 156 | /* |
159 | * Miscellaneous configurable options | 157 | * Miscellaneous configurable options |
160 | */ | 158 | */ |
161 | #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ | 159 | #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */ |
162 | #define CONFIG_SYS_PBSIZE 1024 /* Print Buffer Size */ | 160 | #define CONFIG_SYS_PBSIZE 1024 /* Print Buffer Size */ |
163 | #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ | 161 | #define CONFIG_SYS_MAXARGS 16 /* max number of command args */ |
164 | #define CONFIG_SYS_GENERIC_BOARD | 162 | #define CONFIG_SYS_GENERIC_BOARD |
165 | 163 | ||
166 | /* Boot Argument Buffer Size */ | 164 | /* Boot Argument Buffer Size */ |
167 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE | 165 | #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE |
168 | 166 | ||
169 | /* standalone support */ | 167 | /* standalone support */ |
170 | #define CONFIG_STANDALONE_LOAD_ADDR CONFIG_SYS_LOAD_ADDR | 168 | #define CONFIG_STANDALONE_LOAD_ADDR CONFIG_SYS_LOAD_ADDR |
171 | 169 | ||
172 | /* baudrate */ | 170 | /* baudrate */ |
173 | #define CONFIG_BAUDRATE 115200 | 171 | #define CONFIG_BAUDRATE 115200 |
174 | 172 | ||
175 | /* The stack sizes are set up in start.S using the settings below */ | 173 | /* The stack sizes are set up in start.S using the settings below */ |
176 | #define CONFIG_STACKSIZE (256 << 10) /* 256 KiB */ | 174 | #define CONFIG_STACKSIZE (256 << 10) /* 256 KiB */ |
177 | 175 | ||
178 | /* FLASH and environment organization */ | 176 | /* FLASH and environment organization */ |
179 | 177 | ||
180 | #define CONFIG_SYS_NO_FLASH | 178 | #define CONFIG_SYS_NO_FLASH |
181 | 179 | ||
182 | #define CONFIG_SYS_MONITOR_LEN (512 << 10) /* 512 KiB */ | 180 | #define CONFIG_SYS_MONITOR_LEN (512 << 10) /* 512 KiB */ |
183 | #define CONFIG_IDENT_STRING " Allwinner Technology" | 181 | #define CONFIG_IDENT_STRING " Allwinner Technology" |
184 | 182 | ||
185 | #define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */ | 183 | #define CONFIG_ENV_OFFSET (544 << 10) /* (8 + 24 + 512) KiB */ |
186 | #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ | 184 | #define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */ |
187 | 185 | ||
188 | #define CONFIG_FAT_WRITE /* enable write access */ | 186 | #define CONFIG_FAT_WRITE /* enable write access */ |
189 | 187 | ||
190 | #define CONFIG_SPL_FRAMEWORK | 188 | #define CONFIG_SPL_FRAMEWORK |
191 | #define CONFIG_SPL_LIBCOMMON_SUPPORT | 189 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
192 | #define CONFIG_SPL_SERIAL_SUPPORT | 190 | #define CONFIG_SPL_SERIAL_SUPPORT |
193 | #define CONFIG_SPL_LIBGENERIC_SUPPORT | 191 | #define CONFIG_SPL_LIBGENERIC_SUPPORT |
194 | 192 | ||
195 | #define CONFIG_SPL_BOARD_LOAD_IMAGE | 193 | #define CONFIG_SPL_BOARD_LOAD_IMAGE |
196 | 194 | ||
197 | #define CONFIG_SPL_TEXT_BASE 0x20 /* sram start+header */ | 195 | #define CONFIG_SPL_TEXT_BASE 0x20 /* sram start+header */ |
198 | #define CONFIG_SPL_MAX_SIZE 0x5fe0 /* 24KB on sun4i/sun7i */ | 196 | #define CONFIG_SPL_MAX_SIZE 0x5fe0 /* 24KB on sun4i/sun7i */ |
199 | 197 | ||
200 | #define CONFIG_SPL_LIBDISK_SUPPORT | 198 | #define CONFIG_SPL_LIBDISK_SUPPORT |
201 | 199 | ||
202 | #if !defined(CONFIG_UART0_PORT_F) | 200 | #if !defined(CONFIG_UART0_PORT_F) |
203 | #define CONFIG_SPL_MMC_SUPPORT | 201 | #define CONFIG_SPL_MMC_SUPPORT |
204 | #endif | 202 | #endif |
205 | 203 | ||
206 | #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" | 204 | #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/sunxi/u-boot-spl.lds" |
207 | 205 | ||
208 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 80 /* 40KiB */ | 206 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 80 /* 40KiB */ |
209 | #define CONFIG_SPL_PAD_TO 32768 /* decimal for 'dd' */ | 207 | #define CONFIG_SPL_PAD_TO 32768 /* decimal for 'dd' */ |
210 | 208 | ||
211 | /* end of 32 KiB in sram */ | 209 | /* end of 32 KiB in sram */ |
212 | #define LOW_LEVEL_SRAM_STACK 0x00008000 /* End of sram */ | 210 | #define LOW_LEVEL_SRAM_STACK 0x00008000 /* End of sram */ |
213 | #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK | 211 | #define CONFIG_SPL_STACK LOW_LEVEL_SRAM_STACK |
214 | 212 | ||
215 | /* I2C */ | 213 | /* I2C */ |
216 | #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER | 214 | #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER |
217 | #define CONFIG_SPL_I2C_SUPPORT | 215 | #define CONFIG_SPL_I2C_SUPPORT |
218 | #endif | 216 | #endif |
219 | 217 | ||
220 | #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \ | 218 | #if defined CONFIG_I2C0_ENABLE || defined CONFIG_I2C1_ENABLE || \ |
221 | defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \ | 219 | defined CONFIG_I2C2_ENABLE || defined CONFIG_I2C3_ENABLE || \ |
222 | defined CONFIG_I2C4_ENABLE | 220 | defined CONFIG_I2C4_ENABLE |
223 | #define CONFIG_SYS_I2C | 221 | #define CONFIG_SYS_I2C |
224 | #define CONFIG_SYS_I2C_MVTWSI | 222 | #define CONFIG_SYS_I2C_MVTWSI |
225 | #define CONFIG_SYS_I2C_SPEED 400000 | 223 | #define CONFIG_SYS_I2C_SPEED 400000 |
226 | #define CONFIG_SYS_I2C_SLAVE 0x7f | 224 | #define CONFIG_SYS_I2C_SLAVE 0x7f |
227 | #define CONFIG_CMD_I2C | 225 | #define CONFIG_CMD_I2C |
228 | #endif | 226 | #endif |
229 | 227 | ||
230 | #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) | 228 | #if defined CONFIG_VIDEO_LCD_PANEL_I2C && !(defined CONFIG_SPL_BUILD) |
231 | #define CONFIG_SYS_I2C_SOFT | 229 | #define CONFIG_SYS_I2C_SOFT |
232 | #define CONFIG_SYS_I2C_SOFT_SPEED 50000 | 230 | #define CONFIG_SYS_I2C_SOFT_SPEED 50000 |
233 | #define CONFIG_SYS_I2C_SOFT_SLAVE 0x00 | 231 | #define CONFIG_SYS_I2C_SOFT_SLAVE 0x00 |
234 | /* We use pin names in Kconfig and sunxi_name_to_gpio() */ | 232 | /* We use pin names in Kconfig and sunxi_name_to_gpio() */ |
235 | #define CONFIG_SOFT_I2C_GPIO_SDA soft_i2c_gpio_sda | 233 | #define CONFIG_SOFT_I2C_GPIO_SDA soft_i2c_gpio_sda |
236 | #define CONFIG_SOFT_I2C_GPIO_SCL soft_i2c_gpio_scl | 234 | #define CONFIG_SOFT_I2C_GPIO_SCL soft_i2c_gpio_scl |
237 | #ifndef __ASSEMBLY__ | 235 | #ifndef __ASSEMBLY__ |
238 | extern int soft_i2c_gpio_sda; | 236 | extern int soft_i2c_gpio_sda; |
239 | extern int soft_i2c_gpio_scl; | 237 | extern int soft_i2c_gpio_scl; |
240 | #endif | 238 | #endif |
241 | #define CONFIG_VIDEO_LCD_I2C_BUS 0 /* The lcd panel soft i2c is bus 0 */ | 239 | #define CONFIG_VIDEO_LCD_I2C_BUS 0 /* The lcd panel soft i2c is bus 0 */ |
242 | #define CONFIG_SYS_SPD_BUS_NUM 1 /* And the axp209 i2c bus is bus 1 */ | 240 | #define CONFIG_SYS_SPD_BUS_NUM 1 /* And the axp209 i2c bus is bus 1 */ |
243 | #else | 241 | #else |
244 | #define CONFIG_SYS_SPD_BUS_NUM 0 /* The axp209 i2c bus is bus 0 */ | 242 | #define CONFIG_SYS_SPD_BUS_NUM 0 /* The axp209 i2c bus is bus 0 */ |
245 | #define CONFIG_VIDEO_LCD_I2C_BUS -1 /* NA, but necessary to compile */ | 243 | #define CONFIG_VIDEO_LCD_I2C_BUS -1 /* NA, but necessary to compile */ |
246 | #endif | 244 | #endif |
247 | 245 | ||
248 | /* PMU */ | 246 | /* PMU */ |
249 | #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER | 247 | #if defined CONFIG_AXP152_POWER || defined CONFIG_AXP209_POWER || defined CONFIG_AXP221_POWER |
250 | #define CONFIG_SPL_POWER_SUPPORT | 248 | #define CONFIG_SPL_POWER_SUPPORT |
251 | #endif | 249 | #endif |
252 | 250 | ||
253 | #ifndef CONFIG_CONS_INDEX | 251 | #ifndef CONFIG_CONS_INDEX |
254 | #define CONFIG_CONS_INDEX 1 /* UART0 */ | 252 | #define CONFIG_CONS_INDEX 1 /* UART0 */ |
255 | #endif | 253 | #endif |
256 | 254 | ||
257 | #if CONFIG_CONS_INDEX == 1 | 255 | #if CONFIG_CONS_INDEX == 1 |
258 | #ifdef CONFIG_MACH_SUN9I | 256 | #ifdef CONFIG_MACH_SUN9I |
259 | #define OF_STDOUT_PATH "/soc/serial@07000000:115200" | 257 | #define OF_STDOUT_PATH "/soc/serial@07000000:115200" |
260 | #else | 258 | #else |
261 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28000:115200" | 259 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28000:115200" |
262 | #endif | 260 | #endif |
263 | #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) | 261 | #elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I) |
264 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200" | 262 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28400:115200" |
265 | #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) | 263 | #elif CONFIG_CONS_INDEX == 3 && defined(CONFIG_MACH_SUN8I) |
266 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28800:115200" | 264 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01c28800:115200" |
267 | #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) | 265 | #elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I) |
268 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01f02800:115200" | 266 | #define OF_STDOUT_PATH "/soc@01c00000/serial@01f02800:115200" |
269 | #else | 267 | #else |
270 | #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h. | 268 | #error Unsupported console port nr. Please fix stdout-path in sunxi-common.h. |
271 | #endif | 269 | #endif |
272 | 270 | ||
273 | /* GPIO */ | 271 | /* GPIO */ |
274 | #define CONFIG_SUNXI_GPIO | 272 | #define CONFIG_SUNXI_GPIO |
275 | #define CONFIG_SPL_GPIO_SUPPORT | 273 | #define CONFIG_SPL_GPIO_SUPPORT |
276 | #define CONFIG_CMD_GPIO | 274 | #define CONFIG_CMD_GPIO |
277 | 275 | ||
278 | #ifdef CONFIG_VIDEO | 276 | #ifdef CONFIG_VIDEO |
279 | /* | 277 | /* |
280 | * The amount of RAM to keep free at the top of RAM when relocating u-boot, | 278 | * The amount of RAM to keep free at the top of RAM when relocating u-boot, |
281 | * to use as framebuffer. This must be a multiple of 4096. | 279 | * to use as framebuffer. This must be a multiple of 4096. |
282 | */ | 280 | */ |
283 | #define CONFIG_SUNXI_MAX_FB_SIZE (9 << 20) | 281 | #define CONFIG_SUNXI_MAX_FB_SIZE (9 << 20) |
284 | 282 | ||
285 | /* Do we want to initialize a simple FB? */ | 283 | /* Do we want to initialize a simple FB? */ |
286 | #define CONFIG_VIDEO_DT_SIMPLEFB | 284 | #define CONFIG_VIDEO_DT_SIMPLEFB |
287 | 285 | ||
288 | #define CONFIG_VIDEO_SUNXI | 286 | #define CONFIG_VIDEO_SUNXI |
289 | 287 | ||
290 | #define CONFIG_CFB_CONSOLE | 288 | #define CONFIG_CFB_CONSOLE |
291 | #define CONFIG_VIDEO_SW_CURSOR | 289 | #define CONFIG_VIDEO_SW_CURSOR |
292 | #define CONFIG_VIDEO_LOGO | 290 | #define CONFIG_VIDEO_LOGO |
293 | #define CONFIG_VIDEO_STD_TIMINGS | 291 | #define CONFIG_VIDEO_STD_TIMINGS |
294 | #define CONFIG_I2C_EDID | 292 | #define CONFIG_I2C_EDID |
295 | 293 | ||
296 | /* allow both serial and cfb console. */ | 294 | /* allow both serial and cfb console. */ |
297 | #define CONFIG_CONSOLE_MUX | 295 | #define CONFIG_CONSOLE_MUX |
298 | /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ | 296 | /* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ |
299 | #define CONFIG_VGA_AS_SINGLE_DEVICE | 297 | #define CONFIG_VGA_AS_SINGLE_DEVICE |
300 | 298 | ||
301 | /* To be able to hook simplefb into dt */ | 299 | /* To be able to hook simplefb into dt */ |
302 | #ifdef CONFIG_VIDEO_DT_SIMPLEFB | 300 | #ifdef CONFIG_VIDEO_DT_SIMPLEFB |
303 | #define CONFIG_OF_BOARD_SETUP | 301 | #define CONFIG_OF_BOARD_SETUP |
304 | #endif | 302 | #endif |
305 | 303 | ||
306 | #endif /* CONFIG_VIDEO */ | 304 | #endif /* CONFIG_VIDEO */ |
307 | 305 | ||
308 | /* Ethernet support */ | 306 | /* Ethernet support */ |
309 | #ifdef CONFIG_SUNXI_EMAC | 307 | #ifdef CONFIG_SUNXI_EMAC |
310 | #define CONFIG_PHY_ADDR 1 | 308 | #define CONFIG_PHY_ADDR 1 |
311 | #define CONFIG_MII /* MII PHY management */ | 309 | #define CONFIG_MII /* MII PHY management */ |
312 | #define CONFIG_PHYLIB | 310 | #define CONFIG_PHYLIB |
313 | #endif | 311 | #endif |
314 | 312 | ||
315 | #ifdef CONFIG_SUNXI_GMAC | 313 | #ifdef CONFIG_SUNXI_GMAC |
316 | #define CONFIG_DW_AUTONEG | 314 | #define CONFIG_DW_AUTONEG |
317 | #define CONFIG_PHY_GIGE /* GMAC can use gigabit PHY */ | 315 | #define CONFIG_PHY_GIGE /* GMAC can use gigabit PHY */ |
318 | #define CONFIG_PHY_ADDR 1 | 316 | #define CONFIG_PHY_ADDR 1 |
319 | #define CONFIG_MII /* MII PHY management */ | 317 | #define CONFIG_MII /* MII PHY management */ |
320 | #define CONFIG_PHYLIB | 318 | #define CONFIG_PHYLIB |
321 | #endif | 319 | #endif |
322 | 320 | ||
323 | #ifdef CONFIG_USB_EHCI | 321 | #ifdef CONFIG_USB_EHCI |
324 | #define CONFIG_USB_OHCI_NEW | 322 | #define CONFIG_USB_OHCI_NEW |
325 | #define CONFIG_USB_OHCI_SUNXI | 323 | #define CONFIG_USB_OHCI_SUNXI |
326 | #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1 | 324 | #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1 |
327 | #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1 | 325 | #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1 |
328 | #endif | 326 | #endif |
329 | 327 | ||
330 | #ifdef CONFIG_USB_MUSB_SUNXI | 328 | #ifdef CONFIG_USB_MUSB_SUNXI |
331 | #define CONFIG_MUSB_HOST | 329 | #define CONFIG_MUSB_HOST |
332 | #define CONFIG_MUSB_PIO_ONLY | 330 | #define CONFIG_MUSB_PIO_ONLY |
333 | #endif | 331 | #endif |
334 | 332 | ||
335 | #if defined CONFIG_USB_EHCI || defined CONFIG_USB_MUSB_SUNXI | 333 | #if defined CONFIG_USB_EHCI || defined CONFIG_USB_MUSB_SUNXI |
336 | #define CONFIG_CMD_USB | 334 | #define CONFIG_CMD_USB |
337 | #define CONFIG_USB_STORAGE | 335 | #define CONFIG_USB_STORAGE |
338 | #endif | 336 | #endif |
339 | 337 | ||
340 | #ifdef CONFIG_USB_KEYBOARD | 338 | #ifdef CONFIG_USB_KEYBOARD |
341 | #define CONFIG_CONSOLE_MUX | 339 | #define CONFIG_CONSOLE_MUX |
342 | #define CONFIG_PREBOOT | 340 | #define CONFIG_PREBOOT |
343 | #define CONFIG_SYS_STDIO_DEREGISTER | 341 | #define CONFIG_SYS_STDIO_DEREGISTER |
344 | #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE | 342 | #define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE |
345 | #endif | 343 | #endif |
346 | 344 | ||
347 | #if !defined CONFIG_ENV_IS_IN_MMC && \ | 345 | #if !defined CONFIG_ENV_IS_IN_MMC && \ |
348 | !defined CONFIG_ENV_IS_IN_NAND && \ | 346 | !defined CONFIG_ENV_IS_IN_NAND && \ |
349 | !defined CONFIG_ENV_IS_IN_FAT && \ | 347 | !defined CONFIG_ENV_IS_IN_FAT && \ |
350 | !defined CONFIG_ENV_IS_IN_SPI_FLASH | 348 | !defined CONFIG_ENV_IS_IN_SPI_FLASH |
351 | #define CONFIG_ENV_IS_NOWHERE | 349 | #define CONFIG_ENV_IS_NOWHERE |
352 | #endif | 350 | #endif |
353 | |||
354 | #ifdef CONFIG_SPL_NAND_SUPPORT | ||
355 | #define CONFIG_NAND | ||
356 | #define CONFIG_SYS_NAND_SELF_INIT | ||
357 | #define CONFIG_NAND_SUNXI | ||
358 | #define CONFIG_CMD_SPL_WRITE_SIZE 0x000400 | ||
359 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x008000 | ||
360 | |||
361 | /* \todo Make these parameterisable in kernel config ? */ | ||
362 | #define CONFIG_NAND_SUNXI_PAGE_SIZE 8192 | ||
363 | #define CONFIG_NAND_SUNXI_ECC_STEP 1024 | ||
364 | #define CONFIG_NAND_SUNXI_ECC_STRENGTH 40 | ||
365 | #define CONFIG_NAND_SUNXI_ADDR_CYCLES 5 | ||
366 | |||
367 | #ifndef CONFIG_NAND_SUNXI_GPC_PORTS | ||
368 | #error "No NAND GPC ports defined, NAND unsupported" | ||
369 | #endif | ||
370 | #endif /* CONFIG_SPL_NAND_SUPPORT */ | ||
371 | 351 | ||
372 | #define CONFIG_MISC_INIT_R | 352 | #define CONFIG_MISC_INIT_R |
373 | #define CONFIG_SYS_CONSOLE_IS_IN_ENV | 353 | #define CONFIG_SYS_CONSOLE_IS_IN_ENV |
374 | 354 | ||
375 | #ifndef CONFIG_SPL_BUILD | 355 | #ifndef CONFIG_SPL_BUILD |
376 | #include <config_distro_defaults.h> | 356 | #include <config_distro_defaults.h> |
377 | 357 | ||
378 | /* Enable pre-console buffer to get complete log on the VGA console */ | 358 | /* Enable pre-console buffer to get complete log on the VGA console */ |
379 | #define CONFIG_PRE_CONSOLE_BUFFER | 359 | #define CONFIG_PRE_CONSOLE_BUFFER |
380 | #define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */ | 360 | #define CONFIG_PRE_CON_BUF_SZ 4096 /* Aprox 2 80*25 screens */ |
381 | 361 | ||
382 | /* | 362 | /* |
383 | * 240M RAM (256M minimum minus space for the framebuffer), | 363 | * 240M RAM (256M minimum minus space for the framebuffer), |
384 | * 32M uncompressed kernel, 16M compressed kernel, 1M fdt, | 364 | * 32M uncompressed kernel, 16M compressed kernel, 1M fdt, |
385 | * 1M script, 1M pxe and the ramdisk at the end. | 365 | * 1M script, 1M pxe and the ramdisk at the end. |
386 | */ | 366 | */ |
387 | #define MEM_LAYOUT_ENV_SETTINGS \ | 367 | #define MEM_LAYOUT_ENV_SETTINGS \ |
388 | "bootm_size=0xf000000\0" \ | 368 | "bootm_size=0xf000000\0" \ |
389 | "kernel_addr_r=" __stringify(SDRAM_OFFSET(2000000)) "\0" \ | 369 | "kernel_addr_r=" __stringify(SDRAM_OFFSET(2000000)) "\0" \ |
390 | "fdt_addr_r=" __stringify(SDRAM_OFFSET(3000000)) "\0" \ | 370 | "fdt_addr_r=" __stringify(SDRAM_OFFSET(3000000)) "\0" \ |
391 | "scriptaddr=" __stringify(SDRAM_OFFSET(3100000)) "\0" \ | 371 | "scriptaddr=" __stringify(SDRAM_OFFSET(3100000)) "\0" \ |
392 | "pxefile_addr_r=" __stringify(SDRAM_OFFSET(3200000)) "\0" \ | 372 | "pxefile_addr_r=" __stringify(SDRAM_OFFSET(3200000)) "\0" \ |
393 | "ramdisk_addr_r=" __stringify(SDRAM_OFFSET(3300000)) "\0" | 373 | "ramdisk_addr_r=" __stringify(SDRAM_OFFSET(3300000)) "\0" |
394 | 374 | ||
395 | #ifdef CONFIG_MMC | 375 | #ifdef CONFIG_MMC |
396 | #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) | 376 | #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) |
397 | #else | 377 | #else |
398 | #define BOOT_TARGET_DEVICES_MMC(func) | 378 | #define BOOT_TARGET_DEVICES_MMC(func) |
399 | #endif | 379 | #endif |
400 | 380 | ||
401 | #ifdef CONFIG_AHCI | 381 | #ifdef CONFIG_AHCI |
402 | #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) | 382 | #define BOOT_TARGET_DEVICES_SCSI(func) func(SCSI, scsi, 0) |
403 | #else | 383 | #else |
404 | #define BOOT_TARGET_DEVICES_SCSI(func) | 384 | #define BOOT_TARGET_DEVICES_SCSI(func) |
405 | #endif | 385 | #endif |
406 | 386 | ||
407 | #ifdef CONFIG_USB_EHCI | 387 | #ifdef CONFIG_USB_EHCI |
408 | #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) | 388 | #define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) |
409 | #else | 389 | #else |
410 | #define BOOT_TARGET_DEVICES_USB(func) | 390 | #define BOOT_TARGET_DEVICES_USB(func) |
411 | #endif | 391 | #endif |
412 | 392 | ||
413 | #define BOOT_TARGET_DEVICES(func) \ | 393 | #define BOOT_TARGET_DEVICES(func) \ |
414 | BOOT_TARGET_DEVICES_MMC(func) \ | 394 | BOOT_TARGET_DEVICES_MMC(func) \ |
415 | BOOT_TARGET_DEVICES_SCSI(func) \ | 395 | BOOT_TARGET_DEVICES_SCSI(func) \ |
416 | BOOT_TARGET_DEVICES_USB(func) \ | 396 | BOOT_TARGET_DEVICES_USB(func) \ |
417 | func(PXE, pxe, na) \ | 397 | func(PXE, pxe, na) \ |
418 | func(DHCP, dhcp, na) | 398 | func(DHCP, dhcp, na) |
419 | 399 | ||
420 | #include <config_distro_bootcmd.h> | 400 | #include <config_distro_bootcmd.h> |
421 | 401 | ||
422 | #ifdef CONFIG_USB_KEYBOARD | 402 | #ifdef CONFIG_USB_KEYBOARD |
423 | #define CONSOLE_STDIN_SETTINGS \ | 403 | #define CONSOLE_STDIN_SETTINGS \ |
424 | "preboot=usb start\0" \ | 404 | "preboot=usb start\0" \ |
425 | "stdin=serial,usbkbd\0" | 405 | "stdin=serial,usbkbd\0" |
426 | #else | 406 | #else |
427 | #define CONSOLE_STDIN_SETTINGS \ | 407 | #define CONSOLE_STDIN_SETTINGS \ |
428 | "stdin=serial\0" | 408 | "stdin=serial\0" |
429 | #endif | 409 | #endif |
430 | 410 | ||
431 | #ifdef CONFIG_VIDEO | 411 | #ifdef CONFIG_VIDEO |
432 | #define CONSOLE_STDOUT_SETTINGS \ | 412 | #define CONSOLE_STDOUT_SETTINGS \ |
433 | "stdout=serial,vga\0" \ | 413 | "stdout=serial,vga\0" \ |
434 | "stderr=serial,vga\0" | 414 | "stderr=serial,vga\0" |
435 | #else | 415 | #else |
436 | #define CONSOLE_STDOUT_SETTINGS \ | 416 | #define CONSOLE_STDOUT_SETTINGS \ |
437 | "stdout=serial\0" \ | 417 | "stdout=serial\0" \ |
438 | "stderr=serial\0" | 418 | "stderr=serial\0" |
439 | #endif | 419 | #endif |
440 | 420 | ||
441 | #define CONSOLE_ENV_SETTINGS \ | 421 | #define CONSOLE_ENV_SETTINGS \ |
442 | CONSOLE_STDIN_SETTINGS \ | 422 | CONSOLE_STDIN_SETTINGS \ |
443 | CONSOLE_STDOUT_SETTINGS | 423 | CONSOLE_STDOUT_SETTINGS |
444 | 424 | ||
445 | #define CONFIG_EXTRA_ENV_SETTINGS \ | 425 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
446 | CONSOLE_ENV_SETTINGS \ | 426 | CONSOLE_ENV_SETTINGS \ |
447 | MEM_LAYOUT_ENV_SETTINGS \ | 427 | MEM_LAYOUT_ENV_SETTINGS \ |
448 | "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ | 428 | "fdtfile=" CONFIG_DEFAULT_DEVICE_TREE ".dtb\0" \ |
449 | "console=ttyS0,115200\0" \ | 429 | "console=ttyS0,115200\0" \ |
450 | BOOTENV | 430 | BOOTENV |
451 | 431 | ||
452 | #else /* ifndef CONFIG_SPL_BUILD */ | 432 | #else /* ifndef CONFIG_SPL_BUILD */ |
453 | #define CONFIG_EXTRA_ENV_SETTINGS | 433 | #define CONFIG_EXTRA_ENV_SETTINGS |
454 | #endif | 434 | #endif |
455 | 435 | ||
456 | #endif /* _SUNXI_COMMON_CONFIG_H */ | 436 | #endif /* _SUNXI_COMMON_CONFIG_H */ |
457 | 437 |