Merge branch 'master' of git://git.denx.de/u-boot-ti
authorTom Rini <trini@ti.com>
Mon, 27 Oct 2014 13:05:43 +0000 (09:05 -0400)
committerTom Rini <trini@ti.com>
Mon, 27 Oct 2014 13:05:43 +0000 (09:05 -0400)
1  2 
board/overo/overo.c
drivers/net/phy/phy.c
drivers/usb/host/Makefile
include/configs/ks2_evm.h

diff --combined board/overo/overo.c
@@@ -13,8 -13,6 +13,8 @@@
   * SPDX-License-Identifier:   GPL-2.0+
   */
  #include <common.h>
 +#include <dm.h>
 +#include <ns16550.h>
  #include <netdev.h>
  #include <twl4030.h>
  #include <linux/mtd/nand.h>
  #include <asm/mach-types.h>
  #include "overo.h"
  
+ #ifdef CONFIG_USB_EHCI
+ #include <usb.h>
+ #include <asm/ehci-omap.h>
+ #endif
  DECLARE_GLOBAL_DATA_PTR;
  
  #define TWL4030_I2C_BUS                       0
  #define EXPANSION_EEPROM_I2C_BUS      2
  #define EXPANSION_EEPROM_I2C_ADDRESS  0x51
  
+ #define GUMSTIX_EMPTY_EEPROM          0x0
  #define GUMSTIX_SUMMIT                        0x01000200
  #define GUMSTIX_TOBI                  0x02000200
  #define GUMSTIX_TOBI_DUO              0x03000200
@@@ -58,34 -63,8 +65,19 @@@ static struct 
        char fab_revision[8];
        char env_var[16];
        char env_setting[64];
- } expansion_config;
- #if defined(CONFIG_CMD_NET)
- static void setup_net_chip(void);
- #endif
- /* GPMC definitions for LAN9221 chips on Tobi expansion boards */
- static const u32 gpmc_lan_config[] = {
-     NET_LAN9221_GPMC_CONFIG1,
-     NET_LAN9221_GPMC_CONFIG2,
-     NET_LAN9221_GPMC_CONFIG3,
-     NET_LAN9221_GPMC_CONFIG4,
-     NET_LAN9221_GPMC_CONFIG5,
-     NET_LAN9221_GPMC_CONFIG6,
-     /*CONFIG7- computed as params */
- };
+ } expansion_config = {0x0};
  
 +static const struct ns16550_platdata overo_serial = {
 +      OMAP34XX_UART3,
 +      2,
 +      V_NS16550_CLK
 +};
 +
 +U_BOOT_DEVICE(overo_uart) = {
 +      "serial_omap",
 +      &overo_serial
 +};
 +
  /*
   * Routine: board_init
   * Description: Early hardware init.
@@@ -226,6 -205,9 +218,9 @@@ int get_sdio2_config(void
   */
  unsigned int get_expansion_id(void)
  {
+       if (expansion_config.device_vendor != 0x0)
+               return expansion_config.device_vendor;
        i2c_set_bus_num(EXPANSION_EEPROM_I2C_BUS);
  
        /* return GUMSTIX_NO_EEPROM if eeprom doesn't respond */
@@@ -254,10 -236,6 +249,6 @@@ int misc_init_r(void
        twl4030_power_init();
        twl4030_led_init(TWL4030_LED_LEDEN_LEDAON | TWL4030_LED_LEDEN_LEDBON);
  
- #if defined(CONFIG_CMD_NET)
-       setup_net_chip();
- #endif
        printf("Board revision: %d\n", get_board_revision());
  
        switch (get_sdio2_config()) {
                printf("Recognized Summit expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "dvi");
                setenv("expansionname", "summit");
                break;
                printf("Recognized Tobi expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "dvi");
                setenv("expansionname", "tobi");
                break;
                printf("Recognized Tobi Duo expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
-               /* second lan chip */
-               enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4],
-                   0x2B000000, GPMC_SIZE_16M);
+               MUX_GUMSTIX();
                break;
        case GUMSTIX_PALO35:
                printf("Recognized Palo35 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "lcd35");
                break;
        case GUMSTIX_PALO43:
                printf("Recognized Palo43 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "lcd43");
                setenv("expansionname", "palo43");
                break;
                printf("Recognized Chestnut43 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "lcd43");
                setenv("expansionname", "chestnut43");
                break;
                printf("Recognized Pinto expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                break;
        case GUMSTIX_GALLOP43:
                printf("Recognized Gallop43 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                setenv("defaultdisplay", "lcd43");
                setenv("expansionname", "gallop43");
                break;
                printf("Recognized Alto35 expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                MUX_ALTO35();
                setenv("defaultdisplay", "lcd35");
                setenv("expansionname", "alto35");
                printf("Recognized Stagecoach expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                break;
        case GUMSTIX_THUMBO:
                printf("Recognized Thumbo expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                break;
        case GUMSTIX_TURTLECORE:
                printf("Recognized Turtlecore expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                break;
        case GUMSTIX_ARBOR43C:
                printf("Recognized Arbor43C expansion board (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                MUX_ARBOR43C();
                setenv("defaultdisplay", "lcd43");
                break;
                printf("Recognized Ettus Research USRP-E (rev %d %s)\n",
                        expansion_config.revision,
                        expansion_config.fab_revision);
+               MUX_GUMSTIX();
                MUX_USRP_E();
                setenv("defaultdisplay", "dvi");
                break;
        case GUMSTIX_NO_EEPROM:
-               puts("No EEPROM on expansion board\n");
+       case GUMSTIX_EMPTY_EEPROM:
+               puts("No or empty EEPROM on expansion board\n");
+               MUX_GUMSTIX();
                setenv("expansionname", "tobi");
                break;
        default:
-               if (expansion_id == 0x0)
-                       setenv("expansionname", "tobi");
                printf("Unrecognized expansion board 0x%08x\n", expansion_id);
                break;
        }
@@@ -401,7 -390,18 +403,18 @@@ void set_muxconf_regs(void
        MUX_OVERO();
  }
  
- #if defined(CONFIG_CMD_NET)
+ #if defined(CONFIG_CMD_NET) && !defined(CONFIG_SPL_BUILD)
+ /* GPMC definitions for LAN9221 chips on Tobi expansion boards */
+ static const u32 gpmc_lan_config[] = {
+       NET_LAN9221_GPMC_CONFIG1,
+       NET_LAN9221_GPMC_CONFIG2,
+       NET_LAN9221_GPMC_CONFIG3,
+       NET_LAN9221_GPMC_CONFIG4,
+       NET_LAN9221_GPMC_CONFIG5,
+       NET_LAN9221_GPMC_CONFIG6,
+       /*CONFIG7- computed as params */
+ };
  /*
   * Routine: setup_net_chip
   * Description: Setting up the configuration GPMC registers specific to the
@@@ -411,10 -411,6 +424,6 @@@ static void setup_net_chip(void
  {
        struct ctrl *ctrl_base = (struct ctrl *)OMAP34XX_CTRL_BASE;
  
-       /* first lan chip */
-       enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5], 0x2C000000,
-                       GPMC_SIZE_16M);
        /* Enable off mode for NWE in PADCONF_GPMC_NWE register */
        writew(readw(&ctrl_base ->gpmc_nwe) | 0x0E00, &ctrl_base->gpmc_nwe);
        /* Enable off mode for NOE in PADCONF_GPMC_NADV_ALE register */
        /* Enable off mode for ALE in PADCONF_GPMC_NADV_ALE register */
        writew(readw(&ctrl_base->gpmc_nadv_ale) | 0x0E00,
                &ctrl_base->gpmc_nadv_ale);
+ }
  
+ /*
+  * Routine: reset_net_chip
+  * Description: Reset the Ethernet hardware.
+  */
+ static void reset_net_chip(void)
+ {
        /* Make GPIO 64 as output pin and send a magic pulse through it */
        if (!gpio_request(64, "")) {
                gpio_direction_output(64, 0);
                gpio_set_value(64, 1);
        }
  }
- #endif
  
  int board_eth_init(bd_t *bis)
  {
+       unsigned int expansion_id;
        int rc = 0;
  #ifdef CONFIG_SMC911X
-       rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+       expansion_id = get_expansion_id();
+       switch (expansion_id) {
+       case GUMSTIX_TOBI_DUO:
+               /* second lan chip */
+               enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[4],
+                                     0x2B000000, GPMC_SIZE_16M);
+               /* no break */
+       case GUMSTIX_TOBI:
+       case GUMSTIX_CHESTNUT43:
+       case GUMSTIX_STAGECOACH:
+       case GUMSTIX_NO_EEPROM:
+       case GUMSTIX_EMPTY_EEPROM:
+               /* first lan chip */
+               enable_gpmc_cs_config(gpmc_lan_config, &gpmc_cfg->cs[5],
+                                     0x2C000000, GPMC_SIZE_16M);
+               setup_net_chip();
+               reset_net_chip();
+               rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+               break;
+       default:
+               break;
+       }
  #endif
        return rc;
  }
+ #endif
  
  #if defined(CONFIG_GENERIC_MMC) && !defined(CONFIG_SPL_BUILD)
  int board_mmc_init(bd_t *bis)
        return omap_mmc_init(0, 0, 0, -1, -1);
  }
  #endif
+ #if defined(CONFIG_USB_EHCI) &&  !defined(CONFIG_SPL_BUILD)
+ static struct omap_usbhs_board_data usbhs_bdata = {
+       .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
+       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
+       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
+ };
+ #define GUMSTIX_GPIO_USBH_CPEN                168
+ int ehci_hcd_init(int index, enum usb_init_type init,
+                 struct ehci_hccr **hccr, struct ehci_hcor **hcor)
+ {
+       /* Enable USB power */
+       if (!gpio_request(GUMSTIX_GPIO_USBH_CPEN, "usbh_cpen"))
+               gpio_direction_output(GUMSTIX_GPIO_USBH_CPEN, 1);
+       return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
+ }
+ int ehci_hcd_stop(void)
+ {
+       /* Disable USB power */
+       gpio_set_value(GUMSTIX_GPIO_USBH_CPEN, 0);
+       gpio_free(GUMSTIX_GPIO_USBH_CPEN);
+       return omap_ehci_hcd_stop();
+ }
+ #endif /* CONFIG_USB_EHCI */
diff --combined drivers/net/phy/phy.c
@@@ -575,7 -575,7 +575,7 @@@ static struct phy_device *phy_device_cr
   * Description: Reads the ID registers of the PHY at @addr on the
   *   @bus, stores it in @phy_id and returns zero on success.
   */
 -int __weak get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
 +static int get_phy_id(struct mii_dev *bus, int addr, int devad, u32 *phy_id)
  {
        int phy_reg;
  
@@@ -648,7 -648,7 +648,7 @@@ static struct phy_device *get_phy_devic
                if (phydev)
                        return phydev;
        }
-       printf("Phy not found\n");
+       printf("Phy %d not found\n", ffs(phy_mask) - 1);
        return phy_device_create(bus, ffs(phy_mask) - 1, 0xffffffff, interface);
  }
  
@@@ -785,13 -785,16 +785,13 @@@ int phy_startup(struct phy_device *phyd
        return 0;
  }
  
 -static int __board_phy_config(struct phy_device *phydev)
 +__weak int board_phy_config(struct phy_device *phydev)
  {
        if (phydev->drv->config)
                return phydev->drv->config(phydev);
        return 0;
  }
  
 -int board_phy_config(struct phy_device *phydev)
 -      __attribute__((weak, alias("__board_phy_config")));
 -
  int phy_config(struct phy_device *phydev)
  {
        /* Invoke an optional board-specific helper */
@@@ -43,8 -43,6 +43,9 @@@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zyn
  
  # xhci
  obj-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o
+ obj-$(CONFIG_USB_XHCI_KEYSTONE) += xhci-keystone.o
  obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o
  obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
 +
 +# designware
 +obj-$(CONFIG_USB_DWC2) += dwc2.o
@@@ -23,6 -23,7 +23,6 @@@
  #define CONFIG_ARMV7
  #define CONFIG_ARCH_CPU_INIT
  #define CONFIG_SYS_ARCH_TIMER
 -#define CONFIG_SYS_HZ                 1000
  #define CONFIG_SYS_TEXT_BASE          0x0c001000
  #define CONFIG_SPL_TARGET             "u-boot-spi.gph"
  #define CONFIG_SYS_DCACHE_OFF
@@@ -91,6 -92,8 +91,8 @@@
  #define CONFIG_SYS_SPI2_NUM_CS                4
  
  /* Network Configuration */
+ #define CONFIG_PHYLIB
+ #define CONFIG_PHY_MARVELL
  #define CONFIG_MII
  #define CONFIG_BOOTP_DEFAULT
  #define CONFIG_BOOTP_DNS
  #define CONFIG_BOOTP_SEND_HOSTNAME
  #define CONFIG_NET_RETRY_COUNT                32
  #define CONFIG_NET_MULTI
- #define CONFIG_GET_LINK_STATUS_ATTEMPTS       5
  #define CONFIG_SYS_SGMII_REFCLK_MHZ   312
  #define CONFIG_SYS_SGMII_LINERATE_MHZ 1250
  #define CONFIG_SYS_SGMII_RATESCALE    2
  
+ /* Keyston Navigator Configuration */
+ #define CONFIG_KSNAV_QM_BASE_ADDRESS          KS2_QM_BASE_ADDRESS
+ #define CONFIG_KSNAV_QM_CONF_BASE             KS2_QM_CONF_BASE
+ #define CONFIG_KSNAV_QM_DESC_SETUP_BASE               KS2_QM_DESC_SETUP_BASE
+ #define CONFIG_KSNAV_QM_STATUS_RAM_BASE               KS2_QM_STATUS_RAM_BASE
+ #define CONFIG_KSNAV_QM_INTD_CONF_BASE                KS2_QM_INTD_CONF_BASE
+ #define CONFIG_KSNAV_QM_PDSP1_CMD_BASE                KS2_QM_PDSP1_CMD_BASE
+ #define CONFIG_KSNAV_QM_PDSP1_CTRL_BASE               KS2_QM_PDSP1_CTRL_BASE
+ #define CONFIG_KSNAV_QM_PDSP1_IRAM_BASE               KS2_QM_PDSP1_IRAM_BASE
+ #define CONFIG_KSNAV_QM_MANAGER_QUEUES_BASE   KS2_QM_MANAGER_QUEUES_BASE
+ #define CONFIG_KSNAV_QM_MANAGER_Q_PROXY_BASE  KS2_QM_MANAGER_Q_PROXY_BASE
+ #define CONFIG_KSNAV_QM_QUEUE_STATUS_BASE     KS2_QM_QUEUE_STATUS_BASE
+ #define CONFIG_KSNAV_QM_LINK_RAM_BASE         KS2_QM_LINK_RAM_BASE
+ #define CONFIG_KSNAV_QM_REGION_NUM            KS2_QM_REGION_NUM
+ #define CONFIG_KSNAV_QM_QPOOL_NUM             KS2_QM_QPOOL_NUM
+ /* NETCP pktdma */
+ #define CONFIG_KSNAV_NETCP_PDMA_CTRL_BASE     KS2_NETCP_PDMA_CTRL_BASE
+ #define CONFIG_KSNAV_NETCP_PDMA_TX_BASE               KS2_NETCP_PDMA_TX_BASE
+ #define CONFIG_KSNAV_NETCP_PDMA_TX_CH_NUM     KS2_NETCP_PDMA_TX_CH_NUM
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_BASE               KS2_NETCP_PDMA_RX_BASE
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_CH_NUM     KS2_NETCP_PDMA_RX_CH_NUM
+ #define CONFIG_KSNAV_NETCP_PDMA_SCHED_BASE    KS2_NETCP_PDMA_SCHED_BASE
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_BASE  KS2_NETCP_PDMA_RX_FLOW_BASE
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_NUM   KS2_NETCP_PDMA_RX_FLOW_NUM
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_FREE_QUEUE KS2_NETCP_PDMA_RX_FREE_QUEUE
+ #define CONFIG_KSNAV_NETCP_PDMA_RX_RCV_QUEUE  KS2_NETCP_PDMA_RX_RCV_QUEUE
+ #define CONFIG_KSNAV_NETCP_PDMA_TX_SND_QUEUE  KS2_NETCP_PDMA_TX_SND_QUEUE
+ /* Keystone net */
+ #define CONFIG_KSNET_MAC_ID_BASE              KS2_MAC_ID_BASE_ADDR
+ #define CONFIG_KSNET_NETCP_BASE                       KS2_NETCP_BASE
+ #define CONFIG_KSNET_SERDES_SGMII_BASE                KS2_SGMII_SERDES_BASE
+ #define CONFIG_KSNET_SERDES_SGMII2_BASE               KS2_SGMII_SERDES2_BASE
+ #define CONFIG_KSNET_SERDES_LANES_PER_SGMII   KS2_LANES_PER_SGMII_SERDES
  /* AEMIF */
  #define CONFIG_TI_AEMIF
  #define CONFIG_AEMIF_CNTRL_BASE               KS2_AEMIF_CNTRL_BASE
                                        "1024k(bootloader)ro,512k(params)ro," \
                                        "-(ubifs)"
  
+ /* USB Configuration */
+ #define CONFIG_USB_XHCI
+ #define CONFIG_USB_XHCI_KEYSTONE
+ #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS    2
+ #define CONFIG_USB_STORAGE
+ #define CONFIG_DOS_PARTITION
+ #define CONFIG_EFI_PARTITION
+ #define CONFIG_FS_FAT
+ #define CONFIG_SYS_CACHELINE_SIZE             64
+ #define CONFIG_USB_SS_BASE                    KS2_USB_SS_BASE
+ #define CONFIG_USB_HOST_XHCI_BASE             KS2_USB_HOST_XHCI_BASE
+ #define CONFIG_DEV_USB_PHY_BASE                       KS2_DEV_USB_PHY_BASE
+ #define CONFIG_USB_PHY_CFG_BASE                       KS2_USB_PHY_CFG_BASE
  /* U-Boot command configuration */
  #include <config_cmd_default.h>
  #define CONFIG_CMD_ASKENV
  #define CONFIG_CMD_UBIFS
  #define CONFIG_CMD_SF
  #define CONFIG_CMD_EEPROM
+ #define CONFIG_CMD_USB
  
  /* U-Boot general configuration */
  #define CONFIG_SYS_GENERIC_BOARD
+ #define CONFIG_MISC_INIT_R
  #define CONFIG_SYS_CBSIZE             1024
  #define CONFIG_SYS_PBSIZE             2048
  #define CONFIG_SYS_MAXARGS            16
  #include <asm/arch/clock.h>
  #define CONFIG_SYS_HZ_CLOCK           clk_get_rate(KS2_CLK1_6)
  
- /* Maximum memory size for relocated U-boot at the end of the DDR3 memory
-    which is NOT applicable for DDR ECC test */
- #define CONFIG_MAX_UBOOT_MEM_SIZE     (4 << 20)       /* 4 MiB */
  #endif /* __CONFIG_KS2_EVM_H */