Skip to contentSkip to conversation

da8xx USB PHY platform devices and clocks

PATCH Applied David Lechner 2 participants 8 messages Oct 27, 2016 – Oct 31, 2016

Subsystems (3)

v7 of 8 Applied Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover da8xx USB PHY platform devices and clocks

This series depends on [v3] ARM: davinci: da8xx: Fix some redefined symbol warnings <https://patchwork.kernel.org/patch/9397005/> being applied first.

v7 changes:
* Dropped patches that have been accepted into linux-davinci already
* New patch for adding device names to clock lookup tables
* Picked up related patch from Axel Haslam for registering USB PHY clocks on device tree boards and added error checking to to that patch
* Rebased on latest linux-davinci + linux-next
* Added devices instead of NULL in clk_get() where appropriate usb-da8xx.c
* Re-ordered patches so that they apply/build cleanly

v6 changes:

* Combine "ARM: davinci: da8xx: Enable the usb20 "per" clk on phy_clk_enable" from the "[PATCH/RFT v2 00/17] Add DT support for ohci-da8xx" series with the "ARM: davinci: da8xx: add usb phy clocks" patch in this series.
* Change the syscon and da8xx-usb-phy device ids to -1.

v5 changes: renamed "usbphy" to "usb_phy" or "usb-phy" as appropriate

v4 changes: fix strict checkpatch complaint

v3 changes:

* Fixed the davinci device tree declarations to use the preferred DT address convention so that the items I have added can be correct too.
* Moved that davinci clock init so that we don't have to call ioremap in the clock mux functions.
* Added a new "syscon" device for the CFGCHIP registers. This is used by the USB PHY driver and will be used in the future in common clock framework drivers.
* USB clocks are moved to a common file instead of having duplicated code.
* PHY driver uses syscon for CFGCHIP registers instead of using them directly.

Axel Haslam (1):
ARM: davinci: da8xx: register USB PHY clocks in the DT file

David Lechner (3):
ARM: davinci: da8xx: Add USB PHY platform declaration
ARM: davinci: da8xx: Add USB device names to clock lookup tables
ARM: davinci: da8xx: add usb phy clocks

 arch/arm/mach-davinci/board-da830-evm.c     |  49 ++---
 arch/arm/mach-davinci/board-omapl138-hawk.c |  20 ++-
 arch/arm/mach-davinci/da830.c               |   4 +-
 arch/arm/mach-davinci/da850.c               |   4 +-
 arch/arm/mach-davinci/da8xx-dt.c            |  14 ++
 arch/arm/mach-davinci/include/mach/da8xx.h  |   4 +
 arch/arm/mach-davinci/usb-da8xx.c           | 270 ++++++++++++++++++++++++++--
 7 files changed, 307 insertions(+), 58 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH v7 1/4 ARM: davinci: da8xx: Add USB PHY platform declaration

There is now a proper phy driver for the DA8xx SoC USB PHY. This adds the platform device declarations needed to use it.

---

Updated this patch so that it applies/builds cleanly before "ARM: davinci:
da8xx: add usb phy clocks" since that patch now uses da8xx_usb_phy from this patch.

 arch/arm/mach-davinci/board-da830-evm.c     | 22 +++++++---------------
 arch/arm/mach-davinci/board-omapl138-hawk.c |  5 +++++
 arch/arm/mach-davinci/include/mach/da8xx.h  |  1 +
 arch/arm/mach-davinci/usb-da8xx.c           | 11 +++++++++++
 4 files changed, 24 insertions(+), 15 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +7 -15
index 2a96b40..829f68d 100644
@@ -26,7 +26,6 @@
 #include <linux/platform_data/mtd-davinci.h>
 #include <linux/platform_data/mtd-davinci-aemif.h>
 #include <linux/platform_data/spi-davinci.h>
-#include <linux/platform_data/usb-davinci.h>
 #include <linux/mfd/da8xx-cfgchip.h>
 
 #include <asm/mach-types.h>
@@ -111,7 +110,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));
@@ -128,22 +127,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;
-#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);
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
index 70ebbba..0fd2ef1 100644
@@ -259,6 +259,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) {
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
index 2f6fe2f0..5e07d06 100644
@@ -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);
arch/arm/mach-davinci/usb-da8xx.c +11 -0
index f141f51..4bb1903 100644
@@ -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>
@@ -15,6 +16,16 @@
 #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 = {
Signature · 1 line
2.7.4
#3 lore raw

PATCH v7 2/4 ARM: davinci: da8xx: Add USB device names to clock lookup tables

In reply to David Lechner

This adds device names for the SoC USB devices to the clock lookup tables in da830.c and da850.c.

Also add the USB device names to the da850_auxdata_lookup[] table.

---

This is a new patch setting up clock lookup names that will be used in "ARM:
davinci: da8xx: add usb phy clocks"

 arch/arm/mach-davinci/da830.c    | 4 ++--
 arch/arm/mach-davinci/da850.c    | 4 ++--
 arch/arm/mach-davinci/da8xx-dt.c | 2 ++
 3 files changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-davinci/da830.c +2 -2
index 426fd74..41459bd 100644
@@ -412,7 +412,7 @@ static struct clk_lookup da830_clks[] = {
 	CLK("davinci-mcasp.0",	NULL,		&mcasp0_clk),
 	CLK("davinci-mcasp.1",	NULL,		&mcasp1_clk),
 	CLK("davinci-mcasp.2",	NULL,		&mcasp2_clk),
-	CLK(NULL,		"usb20",	&usb20_clk),
+	CLK("musb-da8xx",	"usb20",	&usb20_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
 	CLK(NULL,		"aintc",	&aintc_clk),
 	CLK(NULL,		"secu_mgr",	&secu_mgr_clk),
@@ -420,7 +420,7 @@ static struct clk_lookup da830_clks[] = {
 	CLK("davinci_mdio.0",   "fck",          &emac_clk),
 	CLK(NULL,		"gpio",		&gpio_clk),
 	CLK("i2c_davinci.2",	NULL,		&i2c1_clk),
-	CLK(NULL,		"usb11",	&usb11_clk),
+	CLK("ohci",		"usb11",	&usb11_clk),
 	CLK(NULL,		"emif3",	&emif3_clk),
 	CLK(NULL,		"arm",		&arm_clk),
 	CLK(NULL,		"rmii",		&rmii_clk),
arch/arm/mach-davinci/da850.c +2 -2
index 6b78a8f..47084be 100644
@@ -503,8 +503,8 @@ static struct clk_lookup da850_clks[] = {
 	CLK("da830-mmc.1",	NULL,		&mmcsd1_clk),
 	CLK("ti-aemif",		NULL,		&aemif_clk),
 	CLK(NULL,		"aemif",	&aemif_clk),
-	CLK(NULL,		"usb11",	&usb11_clk),
-	CLK(NULL,		"usb20",	&usb20_clk),
+	CLK("ohci",		"usb11",	&usb11_clk),
+	CLK("musb-da8xx",	"usb20",	&usb20_clk),
 	CLK("spi_davinci.0",	NULL,		&spi0_clk),
 	CLK("spi_davinci.1",	NULL,		&spi1_clk),
 	CLK("vpif",		NULL,		&vpif_clk),
arch/arm/mach-davinci/da8xx-dt.c +2 -0
index b03ad19..aec569f9 100644
@@ -39,6 +39,8 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL),
 	OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", NULL),
 	OF_DEV_AUXDATA("ti,da850-tilcdc", 0x01e13000, "da8xx_lcdc.0", NULL),
+	OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci", NULL),
+	OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
 	{}
 };
 
Signature · 1 line
2.7.4
#5 lore raw

PATCH v7 3/4 ARM: davinci: da8xx: add usb phy clocks

In reply to David Lechner

Up to this point, the USB phy clock configuration was handled manually in the board files and in the usb drivers. This adds proper clocks so that the usb drivers can use clk_get and clk_enable and not have to worry about the details. Also, the related code is removed from the board files and replaced with the new clock registration functions.

This also removes the #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) around the musb declaration and renames the musb platform device so that we can reference it from the usb20 clock even if the musb device is not used.

[added usb20_clk get/enable to usb20_phy_clk_enable()]

---

This patch now includes devices instead of NULL in clk_get() where possible. Had to add dev.init_name to these devices to ensure that clock matching works. I have tested and clock matching fails without dev.init_name set.

I also fixed the #includes that somehow got messed up in the v6 patch.

Removing the #if IS_ENABLED(CONFIG_USB_MUSB_HDRC) is also new this go around.

 arch/arm/mach-davinci/board-da830-evm.c     |  31 +---
 arch/arm/mach-davinci/board-omapl138-hawk.c |  15 +-
 arch/arm/mach-davinci/da8xx-dt.c            |   1 +
 arch/arm/mach-davinci/include/mach/da8xx.h  |   3 +
 arch/arm/mach-davinci/usb-da8xx.c           | 261 ++++++++++++++++++++++++++--
 5 files changed, 269 insertions(+), 42 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +9 -22
index 829f68d..c62766e 100644
@@ -26,7 +26,6 @@
 #include <linux/platform_data/mtd-davinci.h>
 #include <linux/platform_data/mtd-davinci-aemif.h>
 #include <linux/platform_data/spi-davinci.h>
-#include <linux/mfd/da8xx-cfgchip.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -106,30 +105,18 @@ static irqreturn_t da830_evm_usb_ocic_irq(int irq, void *dev_id)
 
 static __init void da830_evm_usb_init(void)
 {
-	u32 cfgchip2;
 	int ret;
 
-	/*
-	 * Set up USB clock in the CFGCHIP2 register.
-	 * FYI:  CFGCHIP2 is 0x0000ef00 initially.
-	 */
-	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
-
-	/* USB2.0 PHY reference clock is 24 MHz */
-	cfgchip2 &= ~CFGCHIP2_REFFREQ;
-	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
-
-	/*
-	 * Select internal reference clock for USB 2.0 PHY
-	 * and use it as a clock source for USB 1.1 PHY
-	 * (this is the default setting anyway).
-	 */
-	cfgchip2 &= ~CFGCHIP2_USB1PHYCLKMUX;
-	cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
-
-	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
-
 	/* USB_REFCLKIN is not used. */
+	ret = da8xx_register_usb20_phy_clk(false);
+	if (ret)
+		pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n",
+			__func__, ret);
+
+	ret = da8xx_register_usb11_phy_clk(false);
+	if (ret)
+		pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n",
+			__func__, ret);
 
 	ret = da8xx_register_usb_phy();
 	if (ret)
arch/arm/mach-davinci/board-omapl138-hawk.c +8 -7
index 0fd2ef1..3798ee4 100644
@@ -14,7 +14,6 @@
 #include <linux/console.h>
 #include <linux/gpio.h>
 #include <linux/platform_data/gpio-davinci.h>
-#include <linux/mfd/da8xx-cfgchip.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -244,7 +243,6 @@ static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
 static __init void omapl138_hawk_usb_init(void)
 {
 	int ret;
-	u32 cfgchip2;
 
 	ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
 	if (ret) {
@@ -252,12 +250,15 @@ static __init void omapl138_hawk_usb_init(void)
 		return;
 	}
 
-	/* Setup the Ref. clock frequency for the HAWK at 24 MHz. */
+	ret = da8xx_register_usb20_phy_clk(false);
+	if (ret)
+		pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n",
+			__func__, ret);
 
-	cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
-	cfgchip2 &= ~CFGCHIP2_REFFREQ;
-	cfgchip2 |=  CFGCHIP2_REFFREQ_24MHZ;
-	__raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
+	ret = da8xx_register_usb11_phy_clk(false);
+	if (ret)
+		pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n",
+			__func__, ret);
 
 	ret = da8xx_register_usb_phy();
 	if (ret)
arch/arm/mach-davinci/da8xx-dt.c +1 -0
index aec569f9..75e831d 100644
@@ -41,6 +41,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,da850-tilcdc", 0x01e13000, "da8xx_lcdc.0", NULL),
 	OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci", NULL),
 	OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
+	OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c00000, "da8xx-usb-phy", NULL),
 	{}
 };
 
arch/arm/mach-davinci/include/mach/da8xx.h +3 -0
index 5e07d06..43322be 100644
@@ -92,6 +92,9 @@ 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_usb_refclkin(int rate);
+int da8xx_register_usb20_phy_clk(bool use_usb_refclkin);
+int da8xx_register_usb11_phy_clk(bool use_usb_refclkin);
 int da8xx_register_emac(void);
 int da8xx_register_uio_pruss(void);
 int da8xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata);
arch/arm/mach-davinci/usb-da8xx.c +254 -13

317 lines not on this page · raw message

Signature · 1 line
2.7.4
#6 lore raw

PATCH v7 4/4 ARM: davinci: da8xx: register USB PHY clocks in the DT file

In reply to David Lechner

From: Axel Haslam <[email protected]>

The usb20_phy clock needs to be registered for the driver to be able to get and enable a clock. Currently the usb phy clocks are registered form board files, which will not be called during a device tree based boot.

To be able to probe correctly usb form a device tree boot, register the usb phy clocks form the DT specific init.

Unfortunately, davinci does not have proper clock support on device tree yet, so by registering the clock form de DT specific file we are forced to hardcode the parent clock, and cannot select refclkin as parent for any of the phy clocks of the da850 family.

As none of the current da850 based boards currently in mainline use refclkin as source. I guess we can live with this limitation until clocks are correctly represented through CCF/device tree.

[Added error checking]

---

This patch was recently submitted separately. I added error checking and I am including it in this series since it is closely related. It could be combined with the "ARM: davinci: da8xx: add usb phy clocks" patch, but I think it is good to have a separate commit for the explanation in the commit message.

 arch/arm/mach-davinci/da8xx-dt.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
arch/arm/mach-davinci/da8xx-dt.c +11 -0
index 75e831d..839f8db 100644
@@ -49,6 +49,17 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 
 static void __init da850_init_machine(void)
 {
+	int ret;
+
+	ret = da8xx_register_usb20_phy_clk(false);
+	if (ret)
+		pr_warn("%s: registering USB 2.0 PHY clock failed: %d",
+			__func__, ret);
+	ret = da8xx_register_usb11_phy_clk(false);
+	if (ret)
+		pr_warn("%s: registering USB 1.1 PHY clock failed: %d",
+			__func__, ret);
+
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
 }
 
Signature · 1 line
2.7.4
#7 lore raw
In reply to David Lechner
Quoted 11 lines · David Lechner

This series depends on [v3] ARM: davinci: da8xx: Fix some redefined symbol warnings <https://patchwork.kernel.org/patch/9397005/> being applied first.

v7 changes:
* Dropped patches that have been accepted into linux-davinci already
* New patch for adding device names to clock lookup tables
* Picked up related patch from Axel Haslam for registering USB PHY clocks on device tree boards and added error checking to to that patch
* Rebased on latest linux-davinci + linux-next
* Added devices instead of NULL in clk_get() where appropriate usb-da8xx.c
* Re-ordered patches so that they apply/build cleanly

The series looks good to me now. Since this is considerable change from previous version, I will wait a while to see if others have any comments before applying this.

Thanks,
Sekhar

#2 lore raw

Re: [PATCH v7 1/4] ARM: davinci: da8xx: Add USB PHY platform declaration

In reply to David Lechner
Quoted 22 lines · David Lechner

There is now a proper phy driver for the DA8xx SoC USB PHY. This adds the platform device declarations needed to use it.

---

Updated this patch so that it applies/builds cleanly before "ARM: davinci:
da8xx: add usb phy clocks" since that patch now uses da8xx_usb_phy from this patch.

 arch/arm/mach-davinci/board-da830-evm.c     | 22 +++++++---------------
 arch/arm/mach-davinci/board-omapl138-hawk.c |  5 +++++
 arch/arm/mach-davinci/include/mach/da8xx.h  |  1 +
 arch/arm/mach-davinci/usb-da8xx.c           | 11 +++++++++++
 4 files changed, 24 insertions(+), 15 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +0 -0
index 2a96b40..829f68d 100644

arch/arm/mach-davinci/board-da830-evm.c line 29

Quoted 4 lines
arch/arm/mach-davinci/board-da830-evm.c +0 -1
@@ -26,7 +26,6 @@
 #include <linux/platform_data/mtd-davinci.h>
 #include <linux/platform_data/mtd-davinci-aemif.h>
 #include <linux/platform_data/spi-davinci.h>
-#include <linux/platform_data/usb-davinci.h>

I applied this patch, but did not drop this include. usb-davinci.h provides the definition of da8xx_ohci_root_hub which is still used in this file. I guess it did not lead to a build error because the file is still getting included indirectly. But I rather prefer a direct include of this file.

Attached is the patch I applied for reference.

Thanks,
Sekhar

---8<---

Quoted 1 line

From 00e69229147533769df8637ff4d4bb098150e325 Mon Sep 17 00:00:00 2001

From: David Lechner <[email protected]>
Date: Wed, 26 Oct 2016 19:18:15 -0500
Subject: [PATCH] ARM: davinci: da8xx: Add USB PHY platform device

There is now a proper phy driver for the DA8xx SoC USB PHY. This adds the platform device declarations needed to use it.

[nsekhar at ti.com: keep usb-davinci.h included in board-da830-evm.c
minor subject line adjustment]

---
 arch/arm/mach-davinci/board-da830-evm.c     | 21 +++++++--------------
 arch/arm/mach-davinci/board-omapl138-hawk.c |  5 +++++
 arch/arm/mach-davinci/include/mach/da8xx.h  |  1 +
 arch/arm/mach-davinci/usb-da8xx.c           | 11 +++++++++++
 4 files changed, 24 insertions(+), 14 deletions(-)
arch/arm/mach-davinci/board-da830-evm.c +7 -14
index 6001b32305ec..53172add5248 100644
@@ -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);
arch/arm/mach-davinci/board-omapl138-hawk.c +5 -0
index 70ed5ef2ef8c..67477ca4f15a 100644
@@ -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) {
arch/arm/mach-davinci/include/mach/da8xx.h +1 -0
index 2f6fe2f0c733..5e07d06f60e4 100644
@@ -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);
arch/arm/mach-davinci/usb-da8xx.c +11 -0
index f141f5171906..4bb190380060 100644
@@ -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>
@@ -15,6 +16,16 @@
 #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 = {
Signature · 1 line
2.9.0
Applied
#4 lore raw

Re: [PATCH v7 2/4] ARM: davinci: da8xx: Add USB device names to clock lookup tables

In reply to David Lechner
Quoted 6 lines · David Lechner

This adds device names for the SoC USB devices to the clock lookup tables in da830.c and da850.c.

Also add the USB device names to the da850_auxdata_lookup[] table.

Applied to v4.10/soc

Thanks,
Sekhar