X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=board%2Fti%2Fevm%2Fevm.c;h=8a3aa0c5bfdad3234d424f0b98e34e58ab3b3791;hb=79f38777947ac7685e2cef8bd977f954ab198c0e;hp=9948b9cd30e7742354f31a829ddd6c8c7da25e5e;hpb=f12d4cb48a1040c25a55148d0eedee1a896364e6;p=oweals%2Fu-boot.git diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c index 9948b9cd30..8a3aa0c5bf 100644 --- a/board/ti/evm/evm.c +++ b/board/ti/evm/evm.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2004-2008 + * (C) Copyright 2004-2011 * Texas Instruments, * * Author : @@ -33,19 +33,32 @@ #include #include #include +#include +#include #include #include +#include #include "evm.h" -static u8 omap3_evm_version; +#define OMAP3EVM_GPIO_ETH_RST_GEN1 64 +#define OMAP3EVM_GPIO_ETH_RST_GEN2 7 -u8 get_omap3_evm_rev(void) +DECLARE_GLOBAL_DATA_PTR; + +static u32 omap3_evm_version; + +u32 get_omap3_evm_rev(void) { return omap3_evm_version; } static void omap3_evm_get_revision(void) { +#if defined(CONFIG_CMD_NET) + /* + * Board revision can be ascertained only by identifying + * the Ethernet chipset. + */ unsigned int smsc_id; /* Ethernet PHY ID is stored at ID_REV register */ @@ -62,8 +75,22 @@ static void omap3_evm_get_revision(void) default: omap3_evm_version = OMAP3EVM_BOARD_GEN_2; } +#else +#if defined(CONFIG_STATIC_BOARD_REV) + /* + * Look for static defintion of the board revision + */ + omap3_evm_version = CONFIG_STATIC_BOARD_REV; +#else + /* + * Fallback to the default above. + */ + omap3_evm_version = OMAP3EVM_BOARD_GEN_2; +#endif +#endif /* CONFIG_CMD_NET */ } +#ifdef CONFIG_USB_OMAP3 /* * MUSB port on OMAP3EVM Rev >= E requires extvbus programming. */ @@ -76,6 +103,7 @@ u8 omap3_evm_need_extvbus(void) return retval; } +#endif /* * Routine: board_init @@ -83,8 +111,6 @@ u8 omap3_evm_need_extvbus(void) */ int board_init(void) { - DECLARE_GLOBAL_DATA_PTR; - gpmc_init(); /* in SRAM or SDRAM, finish GPMC */ /* board id for Linux */ gd->bd->bi_arch_number = MACH_TYPE_OMAP3EVM; @@ -94,6 +120,41 @@ int board_init(void) return 0; } +#ifdef CONFIG_SPL_BUILD +/* + * Routine: get_board_mem_timings + * Description: If we use SPL then there is no x-loader nor config header + * so we have to setup the DDR timings ourself on the first bank. This + * provides the timing values back to the function that configures + * the memory. + */ +void get_board_mem_timings(struct board_sdrc_timings *timings) +{ + int pop_mfr, pop_id; + + /* + * We need to identify what PoP memory is on the board so that + * we know what timings to use. To map the ID values please see + * nand_ids.c + */ + identify_nand_chip(&pop_mfr, &pop_id); + + if (pop_mfr == NAND_MFR_HYNIX && pop_id == 0xbc) { + /* 256MB DDR */ + timings->mcfg = HYNIX_V_MCFG_200(256 << 20); + timings->ctrla = HYNIX_V_ACTIMA_200; + timings->ctrlb = HYNIX_V_ACTIMB_200; + } else { + /* 128MB DDR */ + timings->mcfg = MICRON_V_MCFG_165(128 << 20); + timings->ctrla = MICRON_V_ACTIMA_165; + timings->ctrlb = MICRON_V_ACTIMB_165; + } + timings->rfr_ctrl = SDP_3430_SDRC_RFR_CTRL_165MHz; + timings->mr = MICRON_V_MR_165; +} +#endif + /* * Routine: misc_init_r * Description: Init ethernet (done here so udelay works) @@ -108,7 +169,11 @@ int misc_init_r(void) #if defined(CONFIG_CMD_NET) setup_net_chip(); #endif + omap3_evm_get_revision(); +#if defined(CONFIG_CMD_NET) + reset_net_chip(); +#endif dieid_num_r(); return 0; @@ -125,6 +190,7 @@ void set_muxconf_regs(void) MUX_EVM(); } +#ifdef CONFIG_CMD_NET /* * Routine: setup_net_chip * Description: Setting up the configuration GPMC registers specific to the @@ -132,7 +198,6 @@ void set_muxconf_regs(void) */ static void setup_net_chip(void) { - struct gpio *gpio3_base = (struct gpio *)OMAP34XX_GPIO3_BASE; struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE; /* Configure GPMC registers */ @@ -151,26 +216,68 @@ static void setup_net_chip(void) /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */ writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00, &ctrl_base->gpmc_nadv_ale); +} + +/** + * Reset the ethernet chip. + */ +static void reset_net_chip(void) +{ + int ret; + int rst_gpio; - /* Make GPIO 64 as output pin */ - writel(readl(&gpio3_base->oe) & ~(GPIO0), &gpio3_base->oe); + if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) { + rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN1; + } else { + rst_gpio = OMAP3EVM_GPIO_ETH_RST_GEN2; + } - /* Now send a pulse on the GPIO pin */ - writel(GPIO0, &gpio3_base->setdataout); + ret = gpio_request(rst_gpio, ""); + if (ret < 0) { + printf("Unable to get GPIO %d\n", rst_gpio); + return ; + } + + /* Configure as output */ + gpio_direction_output(rst_gpio, 0); + + /* Send a pulse on the GPIO pin */ + gpio_set_value(rst_gpio, 1); udelay(1); - writel(GPIO0, &gpio3_base->cleardataout); + gpio_set_value(rst_gpio, 0); udelay(1); - writel(GPIO0, &gpio3_base->setdataout); - - /* determine omap3evm revision */ - omap3_evm_get_revision(); + gpio_set_value(rst_gpio, 1); } int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_SMC911X +#define STR_ENV_ETHADDR "ethaddr" + + struct eth_device *dev; + uchar eth_addr[6]; + rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); + + if (!eth_getenv_enetaddr(STR_ENV_ETHADDR, eth_addr)) { + dev = eth_get_dev_by_index(0); + if (dev) { + eth_setenv_enetaddr(STR_ENV_ETHADDR, dev->enetaddr); + } else { + printf("omap3evm: Couldn't get eth device\n"); + rc = -1; + } + } #endif return rc; } +#endif /* CONFIG_CMD_NET */ + +#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) +int board_mmc_init(bd_t *bis) +{ + omap_mmc_init(0, 0, 0); + return 0; +} +#endif