ARM: davinci: da8xx: Add USB PHY platform device
authorDavid Lechner <david@lechnology.com>
Thu, 27 Oct 2016 00:18:15 +0000 (19:18 -0500)
committerSekhar Nori <nsekhar@ti.com>
Mon, 31 Oct 2016 11:50:27 +0000 (17:20 +0530)
There is now a proper phy driver for the DA8xx SoC USB PHY. This adds the
platform device declarations needed to use it.

Signed-off-by: David Lechner <david@lechnology.com>
[nsekhar@ti.com: keep usb-davinci.h included in board-da830-evm.c
 minor subject line adjustment]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-omapl138-hawk.c
arch/arm/mach-davinci/include/mach/da8xx.h
arch/arm/mach-davinci/usb-da8xx.c

index 6001b32305ecb5a0d002e711dba2c7cf8cae1408..53172add5248f85a54dc711f6dd317ac02f1dc39 100644 (file)
@@ -112,7 +112,7 @@ static __init void da830_evm_usb_init(void)
        int ret;
 
        /*
-        * Set up USB clock/mode in the CFGCHIP2 register.
+        * Set up USB clock in the CFGCHIP2 register.
         * FYI:  CFGCHIP2 is 0x0000ef00 initially.
         */
        cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
@@ -129,22 +129,15 @@ static __init void da830_evm_usb_init(void)
        cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
        cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
 
-       /*
-        * We have to override VBUS/ID signals when MUSB is configured into the
-        * host-only mode -- ID pin will float if no cable is connected, so the
-        * controller won't be able to drive VBUS thinking that it's a B-device.
-        * Otherwise, we want to use the OTG mode and enable VBUS comparators.
-        */
-       cfgchip2 &= ~CFGCHIP2_OTGMODE_MASK;
-#ifdef CONFIG_USB_MUSB_HOST
-       cfgchip2 |=  CFGCHIP2_FORCE_HOST;
-#else
-       cfgchip2 |=  CFGCHIP2_SESENDEN | CFGCHIP2_VBDTCTEN;
-#endif
-
        __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
 
        /* USB_REFCLKIN is not used. */
+
+       ret = da8xx_register_usb_phy();
+       if (ret)
+               pr_warn("%s: USB PHY registration failed: %d\n",
+                       __func__, ret);
+
        ret = davinci_cfg_reg(DA830_USB0_DRVVBUS);
        if (ret)
                pr_warn("%s: USB 2.0 PinMux setup failed: %d\n", __func__, ret);
index 70ed5ef2ef8c6b57d2843c4e7f674c640868ed47..67477ca4f15a02da77c17a6e79748aa0ae6944bf 100644 (file)
@@ -260,6 +260,11 @@ static __init void omapl138_hawk_usb_init(void)
        cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
        __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
 
+       ret = da8xx_register_usb_phy();
+       if (ret)
+               pr_warn("%s: USB PHY registration failed: %d\n",
+                       __func__, ret);
+
        ret = gpio_request_one(DA850_USB1_VBUS_PIN,
                        GPIOF_DIR_OUT, "USB1 VBUS");
        if (ret < 0) {
index 2f6fe2f0c733b95c45919ac91fb3c6ca97339fc9..5e07d06f60e4fd927f2a3858484acc3963726d99 100644 (file)
@@ -89,6 +89,7 @@ int da850_register_edma(struct edma_rsv_info *rsv[2]);
 int da8xx_register_i2c(int instance, struct davinci_i2c_platform_data *pdata);
 int da8xx_register_spi_bus(int instance, unsigned num_chipselect);
 int da8xx_register_watchdog(void);
+int da8xx_register_usb_phy(void);
 int da8xx_register_usb20(unsigned mA, unsigned potpgt);
 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata);
 int da8xx_register_emac(void);
index f141f5171906091381952364c7c533e9a331ac3d..4bb190380060e40d896262d4a16579fdd59cee5e 100644 (file)
@@ -3,6 +3,7 @@
  */
 #include <linux/dma-mapping.h>
 #include <linux/init.h>
+#include <linux/phy/phy.h>
 #include <linux/platform_data/usb-davinci.h>
 #include <linux/platform_device.h>
 #include <linux/usb/musb.h>
 #define DA8XX_USB0_BASE                0x01e00000
 #define DA8XX_USB1_BASE                0x01e25000
 
+static struct platform_device da8xx_usb_phy = {
+       .name           = "da8xx-usb-phy",
+       .id             = -1,
+};
+
+int __init da8xx_register_usb_phy(void)
+{
+       return platform_device_register(&da8xx_usb_phy);
+}
+
 #if IS_ENABLED(CONFIG_USB_MUSB_HDRC)
 
 static struct musb_hdrc_config musb_config = {