diff options
author | Tom Rini <trini@konsulko.com> | 2016-10-28 14:14:18 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-28 14:14:18 -0400 |
commit | 1df182ddf700de49fb4400ba67c3029278ea88e7 (patch) | |
tree | c709e8a79950a29f1d12fc09fbf52b293bd54092 /board | |
parent | 4f892924d238cc415891dbea336a0fdaff2f853b (diff) | |
parent | 0eafd4b77615efdd948e698d83be746dcf026a53 (diff) | |
download | u-boot-1df182ddf700de49fb4400ba67c3029278ea88e7.tar.gz |
Merge branch 'master' of git://git.denx.de/u-boot-atmel
Diffstat (limited to 'board')
-rw-r--r-- | board/atmel/sama5d2_xplained/sama5d2_xplained.c | 167 | ||||
-rw-r--r-- | board/bluewater/gurnard/gurnard.c | 6 |
2 files changed, 65 insertions, 108 deletions
diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 93df7ba32a..c5337af4de 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -7,6 +7,9 @@ #include <common.h> #include <atmel_hlcdc.h> +#include <debug_uart.h> +#include <dm.h> +#include <i2c.h> #include <lcd.h> #include <mmc.h> #include <net.h> @@ -25,32 +28,6 @@ DECLARE_GLOBAL_DATA_PTR; -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - return bus == 0 && cs == 0; -} - -void spi_cs_activate(struct spi_slave *slave) -{ - atmel_pio4_set_pio_output(AT91_PIO_PORTA, 17, 0); -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - atmel_pio4_set_pio_output(AT91_PIO_PORTA, 17, 1); -} - -static void board_spi0_hw_init(void) -{ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 14, 0); - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 15, 0); - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 16, 0); - - atmel_pio4_set_pio_output(AT91_PIO_PORTA, 17, 1); - - at91_periph_clk_enable(ATMEL_ID_SPI0); -} - static void board_usb_hw_init(void) { atmel_pio4_set_pio_output(AT91_PIO_PORTB, 10, 1); @@ -157,55 +134,6 @@ static void board_gmac_hw_init(void) at91_periph_clk_enable(ATMEL_ID_GMAC); } -static void board_sdhci0_hw_init(void) -{ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 0, 0); /* SDMMC0_CK */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 1, 0); /* SDMMC0_CMD */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 2, 0); /* SDMMC0_DAT0 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 3, 0); /* SDMMC0_DAT1 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 4, 0); /* SDMMC0_DAT2 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 5, 0); /* SDMMC0_DAT3 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 6, 0); /* SDMMC0_DAT4 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 7, 0); /* SDMMC0_DAT5 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 8, 0); /* SDMMC0_DAT6 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 9, 0); /* SDMMC0_DAT7 */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 10, 0); /* SDMMC0_RSTN */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 11, 0); /* SDMMC0_VDDSEL */ - atmel_pio4_set_a_periph(AT91_PIO_PORTA, 13, 0); /* SDMMC0_CD */ - - at91_periph_clk_enable(ATMEL_ID_SDMMC0); - at91_enable_periph_generated_clk(ATMEL_ID_SDMMC0, - GCK_CSS_UPLL_CLK, 1); -} - -static void board_sdhci1_hw_init(void) -{ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 18, 0); /* SDMMC1_DAT0 */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 19, 0); /* SDMMC1_DAT1 */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 20, 0); /* SDMMC1_DAT2 */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 21, 0); /* SDMMC1_DAT3 */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 22, 0); /* SDMMC1_CK */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 27, 0); /* SDMMC1_RSTN */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 28, 0); /* SDMMC1_CMD */ - atmel_pio4_set_e_periph(AT91_PIO_PORTA, 30, 0); /* SDMMC1_CD */ - - at91_periph_clk_enable(ATMEL_ID_SDMMC1); - at91_enable_periph_generated_clk(ATMEL_ID_SDMMC1, - GCK_CSS_UPLL_CLK, 1); -} - -int board_mmc_init(bd_t *bis) -{ -#ifdef CONFIG_ATMEL_SDHCI0 - atmel_sdhci_init((void *)ATMEL_BASE_SDMMC0, ATMEL_ID_SDMMC0); -#endif -#ifdef CONFIG_ATMEL_SDHCI1 - atmel_sdhci_init((void *)ATMEL_BASE_SDMMC1, ATMEL_ID_SDMMC1); -#endif - - return 0; -} - static void board_uart1_hw_init(void) { atmel_pio4_set_a_periph(AT91_PIO_PORTD, 2, 1); /* URXD1 */ @@ -214,34 +142,31 @@ static void board_uart1_hw_init(void) at91_periph_clk_enable(ATMEL_ID_UART1); } -int board_early_init_f(void) +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) { - at91_periph_clk_enable(ATMEL_ID_PIOA); - at91_periph_clk_enable(ATMEL_ID_PIOB); - at91_periph_clk_enable(ATMEL_ID_PIOC); - at91_periph_clk_enable(ATMEL_ID_PIOD); + board_uart1_hw_init(); +} +#endif +#ifdef CONFIG_BOARD_EARLY_INIT_F +int board_early_init_f(void) +{ +#ifdef CONFIG_DEBUG_UART + debug_uart_init(); +#else board_uart1_hw_init(); +#endif return 0; } +#endif int board_init(void) { /* address of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; -#ifdef CONFIG_ATMEL_SPI - board_spi0_hw_init(); -#endif -#ifdef CONFIG_ATMEL_SDHCI -#ifdef CONFIG_ATMEL_SDHCI0 - board_sdhci0_hw_init(); -#endif -#ifdef CONFIG_ATMEL_SDHCI1 - board_sdhci1_hw_init(); -#endif -#endif #ifdef CONFIG_MACB board_gmac_hw_init(); #endif @@ -283,21 +208,59 @@ int board_eth_init(bd_t *bis) return rc; } +#ifdef CONFIG_CMD_I2C +static int set_ethaddr_from_eeprom(void) +{ + const int ETH_ADDR_LEN = 6; + unsigned char ethaddr[ETH_ADDR_LEN]; + const char *ETHADDR_NAME = "ethaddr"; + struct udevice *bus, *dev; + + if (getenv(ETHADDR_NAME)) + return 0; + + if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) { + printf("Cannot find I2C bus 1\n"); + return -1; + } + + if (dm_i2c_probe(bus, AT24MAC_ADDR, 0, &dev)) { + printf("Failed to probe I2C chip\n"); + return -1; + } + + if (dm_i2c_read(dev, AT24MAC_REG, ethaddr, ETH_ADDR_LEN)) { + printf("Failed to read ethernet address from EEPROM\n"); + return -1; + } + + if (!is_valid_ethaddr(ethaddr)) { + printf("The ethernet address read from EEPROM is not valid!\n"); + return -1; + } + + return eth_setenv_enetaddr(ETHADDR_NAME, ethaddr); +} +#else +static int set_ethaddr_from_eeprom(void) +{ + return 0; +} +#endif + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r(void) +{ + set_ethaddr_from_eeprom(); + + return 0; +} +#endif + /* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init(void) { -#ifdef CONFIG_SYS_USE_SERIALFLASH - board_spi0_hw_init(); -#endif -#ifdef CONFIG_ATMEL_SDHCI -#ifdef CONFIG_ATMEL_SDHCI0 - board_sdhci0_hw_init(); -#endif -#ifdef CONFIG_ATMEL_SDHCI1 - board_sdhci1_hw_init(); -#endif -#endif } static void ddrc_conf(struct atmel_mpddrc_config *ddrc) diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c index 2a36d29788..08b1401372 100644 --- a/board/bluewater/gurnard/gurnard.c +++ b/board/bluewater/gurnard/gurnard.c @@ -414,12 +414,6 @@ void reset_phy(void) { } -/* This breaks the Ethernet MAC at present */ -void enable_caches(void) -{ - dcache_enable(); -} - /* SPI chip select control - only used for FPGA programming */ #ifdef CONFIG_ATMEL_SPI |