2 * Board functions for Siemens TAURUS (AT91SAM9G20) based boards
3 * (C) Copyright Siemens AG
6 * U-Boot file: board/atmel/at91sam9260ek/at91sam9260ek.c
8 * (C) Copyright 2007-2008
9 * Stelian Pop <stelian@popies.net>
10 * Lead Tech Design <www.leadtechdesign.com>
12 * SPDX-License-Identifier: GPL-2.0+
17 #include <asm/arch/at91sam9260_matrix.h>
18 #include <asm/arch/at91sam9_smc.h>
19 #include <asm/arch/at91_common.h>
20 #include <asm/arch/at91_pmc.h>
21 #include <asm/arch/at91_rstc.h>
22 #include <asm/arch/gpio.h>
23 #include <asm/arch/at91sam9_sdramc.h>
24 #include <atmel_mci.h>
25 #include <asm/arch/at91_spi.h>
31 DECLARE_GLOBAL_DATA_PTR;
33 #ifdef CONFIG_CMD_NAND
34 static void taurus_nand_hw_init(void)
36 struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
37 struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
40 /* Assign CS3 to NAND/SmartMedia Interface */
41 csa = readl(&matrix->ebicsa);
42 csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA;
43 writel(csa, &matrix->ebicsa);
45 /* Configure SMC CS3 for NAND/SmartMedia */
46 writel(AT91_SMC_SETUP_NWE(2) | AT91_SMC_SETUP_NCS_WR(0) |
47 AT91_SMC_SETUP_NRD(2) | AT91_SMC_SETUP_NCS_RD(0),
49 writel(AT91_SMC_PULSE_NWE(4) | AT91_SMC_PULSE_NCS_WR(3) |
50 AT91_SMC_PULSE_NRD(4) | AT91_SMC_PULSE_NCS_RD(3),
52 writel(AT91_SMC_CYCLE_NWE(7) | AT91_SMC_CYCLE_NRD(7),
54 writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
55 AT91_SMC_MODE_EXNW_DISABLE |
57 AT91_SMC_MODE_TDF_CYCLE(3),
60 /* Configure RDY/BSY */
61 at91_set_gpio_input(CONFIG_SYS_NAND_READY_PIN, 1);
63 /* Enable NandFlash */
64 at91_set_gpio_output(CONFIG_SYS_NAND_ENABLE_PIN, 1);
69 static void taurus_macb_hw_init(void)
71 struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
73 /* Enable EMAC clock */
74 writel(1 << ATMEL_ID_EMAC0, &pmc->pcer);
78 * RXDV (PA17) => PHY normal mode (not Test mode)
79 * ERX0 (PA14) => PHY ADDR0
80 * ERX1 (PA15) => PHY ADDR1
81 * ERX2 (PA25) => PHY ADDR2
82 * ERX3 (PA26) => PHY ADDR3
83 * ECRS (PA28) => PHY ADDR4 => PHYADDR = 0x0
85 * PHY has internal pull-down
87 at91_set_pio_pullup(AT91_PIO_PORTA, 14, 0);
88 at91_set_pio_pullup(AT91_PIO_PORTA, 15, 0);
89 at91_set_pio_pullup(AT91_PIO_PORTA, 17, 0);
90 at91_set_pio_pullup(AT91_PIO_PORTA, 25, 0);
91 at91_set_pio_pullup(AT91_PIO_PORTA, 26, 0);
92 at91_set_pio_pullup(AT91_PIO_PORTA, 28, 0);
96 at91_set_gpio_input(AT91_PIN_PA25, 1); /* ERST tri-state */
98 /* Re-enable pull-up */
99 at91_set_pio_pullup(AT91_PIO_PORTA, 14, 1);
100 at91_set_pio_pullup(AT91_PIO_PORTA, 15, 1);
101 at91_set_pio_pullup(AT91_PIO_PORTA, 17, 1);
102 at91_set_pio_pullup(AT91_PIO_PORTA, 25, 1);
103 at91_set_pio_pullup(AT91_PIO_PORTA, 26, 1);
104 at91_set_pio_pullup(AT91_PIO_PORTA, 28, 1);
106 /* Initialize EMAC=MACB hardware */
111 #ifdef CONFIG_GENERIC_ATMEL_MCI
112 int board_mmc_init(bd_t *bd)
116 return atmel_mci_init((void *)ATMEL_BASE_MCI);
120 int board_early_init_f(void)
122 struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
124 /* Enable clocks for all PIOs */
125 writel((1 << ATMEL_ID_PIOA) | (1 << ATMEL_ID_PIOB) |
126 (1 << ATMEL_ID_PIOC),
132 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
134 return bus == 0 && cs == 0;
137 void spi_cs_activate(struct spi_slave *slave)
139 at91_set_gpio_value(TAURUS_SPI_CS_PIN, 0);
142 void spi_cs_deactivate(struct spi_slave *slave)
144 at91_set_gpio_value(TAURUS_SPI_CS_PIN, 1);
149 /* adress of boot parameters */
150 gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
152 at91_seriald_hw_init();
153 #ifdef CONFIG_CMD_NAND
154 taurus_nand_hw_init();
157 taurus_macb_hw_init();
159 at91_spi0_hw_init(TAURUS_SPI_MASK);
166 gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
167 CONFIG_SYS_SDRAM_SIZE);
171 int board_eth_init(bd_t *bis)
175 rc = macb_eth_initialize(0, (void *)ATMEL_BASE_EMAC0, 0x00);