]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - board/atmel/atngw100/atngw100.c
Merge branch 'eth-cleanup' of git://git.denx.de/u-boot-avr32
[people/ms/u-boot.git] / board / atmel / atngw100 / atngw100.c
index c649855d63988e937e5f1a5d3bba446fe72bab1a..7f3e48541deae21ea113d224a9a4b10412d96273 100644 (file)
@@ -60,11 +60,14 @@ int board_early_init_f(void)
 #if defined(CONFIG_MMC)
        gpio_enable_mmci();
 #endif
+#if defined(CONFIG_ATMEL_SPI)
+       gpio_enable_spi0(1 << 0);
+#endif
 
        return 0;
 }
 
-long int initdram(int board_type)
+phys_size_t initdram(int board_type)
 {
        unsigned long expected_size;
        unsigned long actual_size;
@@ -78,7 +81,7 @@ long int initdram(int board_type)
        unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
 
        if (expected_size != actual_size)
-               printf("Warning: Only %u of %u MiB SDRAM is working\n",
+               printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
                                actual_size >> 20, expected_size >> 20);
 
        return actual_size;
@@ -89,3 +92,36 @@ void board_init_info(void)
        gd->bd->bi_phy_id[0] = 0x01;
        gd->bd->bi_phy_id[1] = 0x03;
 }
+
+extern int macb_eth_initialize(int id, void *regs, unsigned int phy_addr);
+
+#ifdef CONFIG_CMD_NET
+int board_eth_init(bd_t *bi)
+{
+       macb_eth_initialize(0, (void *)MACB0_BASE, bi->bi_phy_id[0]);
+       macb_eth_initialize(1, (void *)MACB1_BASE, bi->bi_phy_id[1]);
+       return 0;
+}
+#endif
+
+/* SPI chip select control */
+#ifdef CONFIG_ATMEL_SPI
+#include <spi.h>
+
+#define ATNGW100_DATAFLASH_CS_PIN      GPIO_PIN_PA3
+
+int spi_cs_is_valid(unsigned int bus, unsigned int cs)
+{
+       return bus == 0 && cs == 0;
+}
+
+void spi_cs_activate(struct spi_slave *slave)
+{
+       gpio_set_value(ATNGW100_DATAFLASH_CS_PIN, 0);
+}
+
+void spi_cs_deactivate(struct spi_slave *slave)
+{
+       gpio_set_value(ATNGW100_DATAFLASH_CS_PIN, 1);
+}
+#endif /* CONFIG_ATMEL_SPI */