X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=board%2Fegnite%2Fethernut5%2Fethernut5.c;h=9dea2ba80e2a533c766e261da625d03f5fc7a20f;hb=83d290c56fab2d38cd1ab4c4cc7099559c1d5046;hp=67d39844ac615e25edc27216e7e3b2215fb0f742;hpb=1733259d25015c28c47990ec11af99b3f62f811c;p=platform%2Fkernel%2Fu-boot.git diff --git a/board/egnite/ethernut5/ethernut5.c b/board/egnite/ethernut5/ethernut5.c index 67d3984..9dea2ba 100644 --- a/board/egnite/ethernut5/ethernut5.c +++ b/board/egnite/ethernut5/ethernut5.c @@ -1,11 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * (C) Copyright 2011 * egnite GmbH * * (C) Copyright 2010 * Ole Reinhardt - * - * SPDX-License-Identifier: GPL-2.0+ */ /* @@ -58,8 +57,6 @@ #include #include #include -#include -#include #include #include @@ -67,8 +64,7 @@ #include #include #include -#include -#include +#include #include #include #include @@ -77,25 +73,6 @@ DECLARE_GLOBAL_DATA_PTR; -AT91S_DATAFLASH_INFO dataflash_info[CONFIG_SYS_MAX_DATAFLASH_BANKS]; - -struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS] = { - {CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0, 0} -}; - -/* - * In fact we have 7 partitions, but u-boot supports 5 only. This is - * no big deal, because the first partition is reserved for applications - * and the last one is used by Nut/OS. Both need not to be visible here. - */ -dataflash_protect_t area_list[NB_DATAFLASH_AREA] = { - { 0x00021000, 0x00041FFF, FLAG_PROTECT_SET, 0, "setup" }, - { 0x00042000, 0x000C5FFF, FLAG_PROTECT_SET, 0, "uboot" }, - { 0x000C6000, 0x00359FFF, FLAG_PROTECT_SET, 0, "kernel" }, - { 0x0035A000, 0x003DDFFF, FLAG_PROTECT_SET, 0, "nutos" }, - { 0x003DE000, 0x003FEFFF, FLAG_PROTECT_CLEAR, 0, "env" } -}; - /* * This is called last during early initialization. Most of the basic * hardware interfaces are up and running. @@ -151,23 +128,17 @@ static void ethernut5_nand_hw_init(void) */ int board_init(void) { - struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + at91_periph_clk_enable(ATMEL_ID_PIOA); + at91_periph_clk_enable(ATMEL_ID_PIOB); + at91_periph_clk_enable(ATMEL_ID_PIOC); - /* Enable clocks for all PIOs */ - writel((1 << ATMEL_ID_PIOA) | (1 << ATMEL_ID_PIOB) | - (1 << ATMEL_ID_PIOC), - &pmc->pcer); /* Set adress of boot parameters. */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; /* Initialize UARTs and power management. */ - at91_seriald_hw_init(); ethernut5_power_init(); #ifdef CONFIG_CMD_NAND ethernut5_nand_hw_init(); #endif -#ifdef CONFIG_HAS_DATAFLASH - at91_spi0_hw_init(1 << 0); -#endif return 0; } @@ -179,10 +150,9 @@ int board_eth_init(bd_t *bis) { const char *devname; unsigned short mode; - struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; - /* Enable on-chip EMAC clock. */ - writel(1 << ATMEL_ID_EMAC0, &pmc->pcer); + at91_periph_clk_enable(ATMEL_ID_EMAC0); + /* Need to reset PHY via power management. */ ethernut5_phy_reset(); /* Set peripheral pins. */ @@ -211,10 +181,8 @@ int board_eth_init(bd_t *bis) #ifdef CONFIG_GENERIC_ATMEL_MCI int board_mmc_init(bd_t *bd) { - struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + at91_periph_clk_enable(ATMEL_ID_MCI); - /* Enable MCI clock. */ - writel(1 << ATMEL_ID_MCI, &pmc->pcer); /* Initialize MCI hardware. */ at91_mci_hw_init(); /* Register the device. */ @@ -226,30 +194,3 @@ int board_mmc_getcd(struct mmc *mmc) return !at91_get_pio_value(CONFIG_SYS_MMC_CD_PIN); } #endif - -#ifdef CONFIG_ATMEL_SPI -/* - * Note, that u-boot uses different code for SPI bus access. While - * memory routines use automatic chip select control, the serial - * flash support requires 'manual' GPIO control. Thus, we switch - * modes. - */ -void spi_cs_activate(struct spi_slave *slave) -{ - /* Enable NPCS0 in GPIO mode. This disables peripheral control. */ - at91_set_pio_output(AT91_PIO_PORTA, 3, 0); -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - /* Disable NPCS0 in GPIO mode. */ - at91_set_pio_output(AT91_PIO_PORTA, 3, 1); - /* Switch back to peripheral chip select control. */ - at91_set_a_periph(AT91_PIO_PORTA, 3, 1); -} - -int spi_cs_is_valid(unsigned int bus, unsigned int cs) -{ - return bus == 0 && cs == 0; -} -#endif