Commit 33034a77a5c592bdf0fdf7b61c1d04e34b2d204f
Committed by
Simon Glass
1 parent
ef33aa3dca
Exists in
smarc_8mq_lf_v2020.04
and in
20 other branches
board: sama5d4ek: clean up code
Due to the introduction of the pinctrl and clk driver, and using device tree files, remove the unneeded hardcoded pin configuration and clock enabling code from the board file. Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com> Reviewed-by: Andreas Bießmann <andreas@biessmann.org>
Showing 1 changed file with 1 additions and 133 deletions Side-by-side Diff
board/atmel/sama5d4ek/sama5d4ek.c
| ... | ... | @@ -10,54 +10,17 @@ |
| 10 | 10 | #include <asm/arch/at91_common.h> |
| 11 | 11 | #include <asm/arch/at91_rstc.h> |
| 12 | 12 | #include <asm/arch/atmel_mpddrc.h> |
| 13 | -#include <asm/arch/atmel_usba_udc.h> | |
| 14 | 13 | #include <asm/arch/gpio.h> |
| 15 | 14 | #include <asm/arch/clk.h> |
| 16 | 15 | #include <asm/arch/sama5d3_smc.h> |
| 17 | 16 | #include <asm/arch/sama5d4.h> |
| 18 | 17 | #include <atmel_hlcdc.h> |
| 19 | -#include <atmel_mci.h> | |
| 20 | 18 | #include <lcd.h> |
| 21 | -#include <mmc.h> | |
| 22 | -#include <net.h> | |
| 23 | -#include <netdev.h> | |
| 24 | 19 | #include <nand.h> |
| 25 | -#include <spi.h> | |
| 26 | 20 | #include <version.h> |
| 27 | 21 | |
| 28 | 22 | DECLARE_GLOBAL_DATA_PTR; |
| 29 | 23 | |
| 30 | -#ifdef CONFIG_ATMEL_SPI | |
| 31 | -#ifndef CONFIG_DM_SPI | |
| 32 | -int spi_cs_is_valid(unsigned int bus, unsigned int cs) | |
| 33 | -{ | |
| 34 | - return bus == 0 && cs == 0; | |
| 35 | -} | |
| 36 | -#endif | |
| 37 | - | |
| 38 | -void spi_cs_activate(struct spi_slave *slave) | |
| 39 | -{ | |
| 40 | - at91_set_pio_output(AT91_PIO_PORTC, 3, 0); | |
| 41 | -} | |
| 42 | - | |
| 43 | -void spi_cs_deactivate(struct spi_slave *slave) | |
| 44 | -{ | |
| 45 | - at91_set_pio_output(AT91_PIO_PORTC, 3, 1); | |
| 46 | -} | |
| 47 | - | |
| 48 | -static void sama5d4ek_spi0_hw_init(void) | |
| 49 | -{ | |
| 50 | - at91_pio3_set_a_periph(AT91_PIO_PORTC, 0, 0); /* SPI0_MISO */ | |
| 51 | - at91_pio3_set_a_periph(AT91_PIO_PORTC, 1, 0); /* SPI0_MOSI */ | |
| 52 | - at91_pio3_set_a_periph(AT91_PIO_PORTC, 2, 0); /* SPI0_SPCK */ | |
| 53 | - | |
| 54 | - at91_set_pio_output(AT91_PIO_PORTC, 3, 1); /* SPI0_CS0 */ | |
| 55 | - | |
| 56 | - /* Enable clock */ | |
| 57 | - at91_periph_clk_enable(ATMEL_ID_SPI0); | |
| 58 | -} | |
| 59 | -#endif /* CONFIG_ATMEL_SPI */ | |
| 60 | - | |
| 61 | 24 | #ifdef CONFIG_NAND_ATMEL |
| 62 | 25 | static void sama5d4ek_nand_hw_init(void) |
| 63 | 26 | { |
| ... | ... | @@ -198,61 +161,6 @@ |
| 198 | 161 | |
| 199 | 162 | #endif /* CONFIG_LCD */ |
| 200 | 163 | |
| 201 | -#ifdef CONFIG_GENERIC_ATMEL_MCI | |
| 202 | -void sama5d4ek_mci1_hw_init(void) | |
| 203 | -{ | |
| 204 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 19, 1); /* MCI1 CDA */ | |
| 205 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 20, 1); /* MCI1 DA0 */ | |
| 206 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 21, 1); /* MCI1 DA1 */ | |
| 207 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 22, 1); /* MCI1 DA2 */ | |
| 208 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 23, 1); /* MCI1 DA3 */ | |
| 209 | - at91_pio3_set_c_periph(AT91_PIO_PORTE, 18, 0); /* MCI1 CLK */ | |
| 210 | - | |
| 211 | - /* | |
| 212 | - * As the mci io internal pull down is too strong, so if the io needs | |
| 213 | - * external pull up, the pull up resistor will be very small, if so | |
| 214 | - * the power consumption will increase, so disable the interanl pull | |
| 215 | - * down to save the power. | |
| 216 | - */ | |
| 217 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 18, 0); | |
| 218 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 19, 0); | |
| 219 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 20, 0); | |
| 220 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 21, 0); | |
| 221 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 22, 0); | |
| 222 | - at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 23, 0); | |
| 223 | - | |
| 224 | - /* Enable clock */ | |
| 225 | - at91_periph_clk_enable(ATMEL_ID_MCI1); | |
| 226 | -} | |
| 227 | - | |
| 228 | -int board_mmc_init(bd_t *bis) | |
| 229 | -{ | |
| 230 | - /* Enable power for MCI1 interface */ | |
| 231 | - at91_set_pio_output(AT91_PIO_PORTE, 15, 0); | |
| 232 | - | |
| 233 | - return atmel_mci_init((void *)ATMEL_BASE_MCI1); | |
| 234 | -} | |
| 235 | -#endif /* CONFIG_GENERIC_ATMEL_MCI */ | |
| 236 | - | |
| 237 | -#ifdef CONFIG_MACB | |
| 238 | -void sama5d4ek_macb0_hw_init(void) | |
| 239 | -{ | |
| 240 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 0, 0); /* ETXCK_EREFCK */ | |
| 241 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 6, 0); /* ERXDV */ | |
| 242 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 8, 0); /* ERX0 */ | |
| 243 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 9, 0); /* ERX1 */ | |
| 244 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 7, 0); /* ERXER */ | |
| 245 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 2, 0); /* ETXEN */ | |
| 246 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 12, 0); /* ETX0 */ | |
| 247 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 13, 0); /* ETX1 */ | |
| 248 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 17, 0); /* EMDIO */ | |
| 249 | - at91_pio3_set_a_periph(AT91_PIO_PORTB, 16, 0); /* EMDC */ | |
| 250 | - | |
| 251 | - /* Enable clock */ | |
| 252 | - at91_periph_clk_enable(ATMEL_ID_GMAC0); | |
| 253 | -} | |
| 254 | -#endif | |
| 255 | - | |
| 256 | 164 | static void sama5d4ek_serial3_hw_init(void) |
| 257 | 165 | { |
| 258 | 166 | at91_pio3_set_b_periph(AT91_PIO_PORTE, 17, 1); /* TXD3 */ |
| ... | ... | @@ -264,12 +172,6 @@ |
| 264 | 172 | |
| 265 | 173 | int board_early_init_f(void) |
| 266 | 174 | { |
| 267 | - at91_periph_clk_enable(ATMEL_ID_PIOA); | |
| 268 | - at91_periph_clk_enable(ATMEL_ID_PIOB); | |
| 269 | - at91_periph_clk_enable(ATMEL_ID_PIOC); | |
| 270 | - at91_periph_clk_enable(ATMEL_ID_PIOD); | |
| 271 | - at91_periph_clk_enable(ATMEL_ID_PIOE); | |
| 272 | - | |
| 273 | 175 | sama5d4ek_serial3_hw_init(); |
| 274 | 176 | |
| 275 | 177 | return 0; |
| 276 | 178 | |
| 277 | 179 | |
| ... | ... | @@ -280,27 +182,15 @@ |
| 280 | 182 | /* adress of boot parameters */ |
| 281 | 183 | gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; |
| 282 | 184 | |
| 283 | -#ifdef CONFIG_ATMEL_SPI | |
| 284 | - sama5d4ek_spi0_hw_init(); | |
| 285 | -#endif | |
| 286 | 185 | #ifdef CONFIG_NAND_ATMEL |
| 287 | 186 | sama5d4ek_nand_hw_init(); |
| 288 | 187 | #endif |
| 289 | -#ifdef CONFIG_GENERIC_ATMEL_MCI | |
| 290 | - sama5d4ek_mci1_hw_init(); | |
| 291 | -#endif | |
| 292 | -#ifdef CONFIG_MACB | |
| 293 | - sama5d4ek_macb0_hw_init(); | |
| 294 | -#endif | |
| 295 | 188 | #ifdef CONFIG_LCD |
| 296 | 189 | sama5d4ek_lcd_hw_init(); |
| 297 | 190 | #endif |
| 298 | 191 | #ifdef CONFIG_CMD_USB |
| 299 | 192 | sama5d4ek_usb_hw_init(); |
| 300 | 193 | #endif |
| 301 | -#ifdef CONFIG_USB_GADGET_ATMEL_USBA | |
| 302 | - at91_udp_hw_init(); | |
| 303 | -#endif | |
| 304 | 194 | |
| 305 | 195 | return 0; |
| 306 | 196 | } |
| 307 | 197 | |
| 308 | 198 | |
| ... | ... | @@ -312,34 +202,12 @@ |
| 312 | 202 | return 0; |
| 313 | 203 | } |
| 314 | 204 | |
| 315 | -int board_eth_init(bd_t *bis) | |
| 316 | -{ | |
| 317 | - int rc = 0; | |
| 318 | - | |
| 319 | -#ifdef CONFIG_MACB | |
| 320 | - rc = macb_eth_initialize(0, (void *)ATMEL_BASE_GMAC0, 0x00); | |
| 321 | -#endif | |
| 322 | - | |
| 323 | -#ifdef CONFIG_USB_GADGET_ATMEL_USBA | |
| 324 | - usba_udc_probe(&pdata); | |
| 325 | -#ifdef CONFIG_USB_ETH_RNDIS | |
| 326 | - usb_eth_initialize(bis); | |
| 327 | -#endif | |
| 328 | -#endif | |
| 329 | - | |
| 330 | - return rc; | |
| 331 | -} | |
| 332 | - | |
| 333 | 205 | /* SPL */ |
| 334 | 206 | #ifdef CONFIG_SPL_BUILD |
| 335 | 207 | void spl_board_init(void) |
| 336 | 208 | { |
| 337 | -#ifdef CONFIG_SYS_USE_MMC | |
| 338 | - sama5d4ek_mci1_hw_init(); | |
| 339 | -#elif CONFIG_SYS_USE_NANDFLASH | |
| 209 | +#if CONFIG_SYS_USE_NANDFLASH | |
| 340 | 210 | sama5d4ek_nand_hw_init(); |
| 341 | -#elif CONFIG_SYS_USE_SERIALFLASH | |
| 342 | - sama5d4ek_spi0_hw_init(); | |
| 343 | 211 | #endif |
| 344 | 212 | } |
| 345 | 213 |