X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=board%2Flogicpd%2Fam3517evm%2Fam3517evm.c;h=da8be22085689f70296554ce0099654f30d4a6a8;hb=e3b1aaa4e0340b986513a9a54a57cb0244cbabd2;hp=1cabc80b8af8667c51d8ac52bcd3aba72a9201c5;hpb=3be2bdf5dc69b3142c1162a59bc67191c9077567;p=oweals%2Fu-boot.git diff --git a/board/logicpd/am3517evm/am3517evm.c b/board/logicpd/am3517evm/am3517evm.c index 1cabc80b8a..da8be22085 100644 --- a/board/logicpd/am3517evm/am3517evm.c +++ b/board/logicpd/am3517evm/am3517evm.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * am3517evm.c - board file for TI's AM3517 family of devices. * @@ -7,11 +8,11 @@ * * Copyright (C) 2010 * Texas Instruments Incorporated - http://www.ti.com/ - * - * SPDX-License-Identifier: GPL-2.0+ */ #include +#include +#include #include #include #include @@ -21,7 +22,8 @@ #include #include #include -#include +#include +#include #include #include #include @@ -31,6 +33,11 @@ DECLARE_GLOBAL_DATA_PTR; +#define AM3517_IP_SW_RESET 0x48002598 +#define CPGMACSS_SW_RST (1 << 1) +#define PHY_GPIO 30 + + /* * Routine: board_init * Description: Early hardware init. @@ -61,12 +68,12 @@ static struct omap_musb_board_data musb_board_data = { }; static struct musb_hdrc_platform_data musb_plat = { -#if defined(CONFIG_MUSB_HOST) +#if defined(CONFIG_USB_MUSB_HOST) .mode = MUSB_HOST, -#elif defined(CONFIG_MUSB_GADGET) +#elif defined(CONFIG_USB_MUSB_GADGET) .mode = MUSB_PERIPHERAL, #else -#error "Please define either CONFIG_MUSB_HOST or CONFIG_MUSB_GADGET" +#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET" #endif .config = &musb_config, .power = 250, @@ -98,14 +105,47 @@ static void am3517_evm_musb_init(void) */ int misc_init_r(void) { -#ifdef CONFIG_DRIVER_OMAP34XX_I2C - i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); + volatile unsigned int ctr; + u32 reset; + +#ifdef CONFIG_SYS_I2C_OMAP24XX + i2c_init(CONFIG_SYS_OMAP24_I2C_SPEED, CONFIG_SYS_OMAP24_I2C_SLAVE); #endif - dieid_num_r(); + omap_die_id_display(); am3517_evm_musb_init(); + if (gpio_request(PHY_GPIO, "gpio_30") == 0) { + /* activate PHY reset */ + gpio_direction_output(PHY_GPIO, 0); + gpio_set_value(PHY_GPIO, 0); + + ctr = 0; + do { + udelay(1000); + ctr++; + } while (ctr < 300); + + /* deactivate PHY reset */ + gpio_set_value(PHY_GPIO, 1); + + /* allow the PHY to stabilize and settle down */ + ctr = 0; + do { + udelay(1000); + ctr++; + } while (ctr < 300); + + /* ensure that the module is out of reset */ + reset = readl(AM3517_IP_SW_RESET); + reset &= (~CPGMACSS_SW_RST); + writel(reset, AM3517_IP_SW_RESET); + + /* Free requested GPIO */ + gpio_free(PHY_GPIO); + } + return 0; } @@ -120,14 +160,14 @@ void set_muxconf_regs(void) MUX_AM3517EVM(); } -#if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD) +#if defined(CONFIG_MMC) int board_mmc_init(bd_t *bis) { return omap_mmc_init(0, 0, 0, -1, -1); } #endif -#if defined(CONFIG_USB_ETHER) && defined(CONFIG_MUSB_GADGET) +#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET) int board_eth_init(bd_t *bis) { int rv, n = 0; @@ -143,4 +183,3 @@ int board_eth_init(bd_t *bis) return n; } #endif -