Skip to contentSkip to conversation

dt/bindings: Add binding for the DA8xx MUSB driver

PATCH In review Petr Kulhavy 6 participants 22 messages Mar 11, 2016 – Apr 4, 2016 10 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v10 1/5 dt/bindings: Add binding for the DA8xx MUSB driver

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

---
v1: <initial>

v2:
- using standard properties "dr_mode", "mentor,power", "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits"
- using "ti," prefix instead of "da8xx," for specific property names
- no wildcards in compatibility string

v3:
- added "reg", "interrupts" and "interrupt-names" properties
- wildcards in compatibility string

v4:
- compatibility string set to "ti,da830-musb"
- "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits" properties removed and hardcoded
- "ti,phy20-clkmux-cfg" renamed to "ti,phy20-clkmux-pll" and changed to boolean
- removed "ti,hwmods"

v5:
- "ti,phy20-refclock-frequency" property made mandatory

v6:
- using "ti,usb2-phy-" prefix instead of "ti,phy20-" for the specific properties

v7:
- removed the "mentor,power" property; hard coded to 500mA in the code

v8:
- "ti,usb2-phy-refclock-frequency" renamed to "ti,usb2-phy-refclock-hz" and description amended
- "ti,usb2-phy-clkmux-pll" changed to "ti,usb2-phy-clkmux-refclkin" to reflect the more common case
- USB maximum power modelled via a regulator "vbus-supply"

v9: <no change>
v10: <no change>

 .../devicetree/bindings/usb/da8xx-usb.txt          | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt
Documentation/devicetree/bindings/usb/da8xx-usb.txt new file +45 -0
new file mode 100644
index 0000000..a6eda5b
@@ -0,0 +1,45 @@
+TI DA8xx MUSB
+~~~~~~~~~~~~~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+~~~~~~~~~~~~~~~~~~~~
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or "otg".
+
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+ - ti,usb2-phy-refclock-hz : Integer. Frequency in Hz of the USB 2.0 PHY reference clock,
+     either provided by the internal PLL or an external source.
+     The supported values are: 12MHz, 13MHz, 19.2MHz, 20MHz, 24MHz, 26MHz, 38.4MHz, 40MHz, 48MHz.
+
+
+Optional properties:
+~~~~~~~~~~~~~~~~~~~~
+ - ti,usb2-phy-clkmux-refclkin: Boolean. Defines the USB 2.0 PHY reference clock source.
+     If present the the external USB_REFCLKIN pin is used as a clock source, otherwise
+     the internal PLL is used.
+
+Example:
+
+	usb20: usb@1e00000 {
+		compatible = "ti,da830-musb";
+		reg =   <0x00200000 0x10000>;
+		interrupt-parent = <&intc>;
+		interrupts = <58>;
+		interrupt-names = "mc";
+
+		dr_mode = "host";
+		vbus-supply = <&usb_vbus>;
+
+		ti,usb2-phy-refclock-hz = <24000000>;
+
+		status = "okay";
+	};
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH v10 2/5 usb: musb: core: added helper function for parsing DT

In reply to a message not in the archive

This adds the function musb_get_mode() to get the DT property "dr_mode"

---
v4: <initial>
- created musb_get_dr_mode()

v5:
- musb_get_dr_mode() renamed to musb_get_mode()
- added musb_get_power()

v6:
- musb_get_power() : added missing boundary check for the maximum value 510mA
- formatting
- added empty implementation of musb_get_power()

v7:
- removed empty implementation of musb_get_power()
- musb_get_mode() returns MUSB_OTG if the property is not found

v8:
- musb_get_power() removed

v9: <no change>
v10: <no change>

 drivers/usb/musb/musb_core.c | 19 +++++++++++++++++++
 drivers/usb/musb/musb_core.h |  5 +++++
 2 files changed, 24 insertions(+)
drivers/usb/musb/musb_core.c +19 -0
index c3791a0..6a2d6d3 100644
@@ -100,6 +100,7 @@
 #include <linux/io.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb.h>
+#include <linux/usb/of.h>
 
 #include "musb_core.h"
 
@@ -129,6 +130,24 @@ static inline struct musb *dev_to_musb(struct device *dev)
 	return dev_get_drvdata(dev);
 }
 
+enum musb_mode musb_get_mode(struct device *dev)
+{
+	enum usb_dr_mode mode;
+
+	mode = usb_get_dr_mode(dev);
+	switch (mode) {
+	case USB_DR_MODE_HOST:
+		return MUSB_HOST;
+	case USB_DR_MODE_PERIPHERAL:
+		return MUSB_PERIPHERAL;
+	case USB_DR_MODE_OTG:
+	case USB_DR_MODE_UNKNOWN:
+	default:
+		return MUSB_OTG;
+	}
+}
+EXPORT_SYMBOL_GPL(musb_get_mode);
+
 /*-------------------------------------------------------------------------*/
 
 #ifndef CONFIG_BLACKFIN
drivers/usb/musb/musb_core.h +5 -0
index fd215fb..3f7a325 100644
@@ -614,4 +614,9 @@ static inline void musb_platform_post_root_reset_end(struct musb *musb)
 		musb->ops->post_root_reset_end(musb);
 }
 
+/* gets the "dr_mode" property from DT and converts it into musb_mode
+ * if the property is not found or not recognized returns MUSB_OTG
+ */
+extern enum musb_mode musb_get_mode(struct device *dev);
+
 #endif	/* __MUSB_CORE_H__ */
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw

PATCH v10 3/5 usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config

In reply to a message not in the archive

The musb_hdrc_platform_data::config was defined as a non-const pointer. However some drivers (e.g. the ux500) set up this pointer to point to a static structure, which is potentially dangerous. Since the musb core uses the pointer in a read-only manner the const qualifier was added to protect the content of the config.

---
v5: <initial>

v6:
- whitespace formatting corrected

v7: <no change>
v8: <no change>
v9: <no change>
v10: <no change>

 drivers/usb/musb/musb_core.c | 2 +-
 drivers/usb/musb/musb_core.h | 2 +-
 include/linux/usb/musb.h     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_core.c +1 -1
index 6a2d6d3..b0be1a9 100644
@@ -1920,7 +1920,7 @@ static void musb_recover_from_babble(struct musb *musb)
  */
 
 static struct musb *allocate_instance(struct device *dev,
-		struct musb_hdrc_config *config, void __iomem *mbase)
+		const struct musb_hdrc_config *config, void __iomem *mbase)
 {
 	struct musb		*musb;
 	struct musb_hw_ep	*ep;
drivers/usb/musb/musb_core.h +1 -1
index 3f7a325..a062185 100644
@@ -438,7 +438,7 @@ struct musb {
 	 */
 	unsigned                double_buffer_not_ok:1;
 
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	int			xceiv_old_state;
 #ifdef CONFIG_DEBUG_FS
include/linux/usb/musb.h +1 -1
index 96ddfb7..0b3da40 100644
@@ -124,7 +124,7 @@ struct musb_hdrc_platform_data {
 	int		(*set_power)(int state);
 
 	/* MUSB configuration-specific details */
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	/* Architecture specific board data	*/
 	void		*board_data;
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH v10 4/5 ARM: davinci: defined missing CFGCHIP2_REFFREQ_* macros for MUSB PHY

In reply to a message not in the archive

Only few MUSB PHY reference clock frequencies were defined. This patch defines macros for the missing frequencies:
19.2MHz, 38.4MHz, 13MHz, 26MHz, 20MHz, 40MHz

---
v5: <initial>
v6: <no change>
v7: <no change>
v8: <no change>
v9: <no change>
v10: <no change>

 include/linux/platform_data/usb-davinci.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/linux/platform_data/usb-davinci.h +6 -0
index e0bc4ab..961d3dc 100644
@@ -33,6 +33,12 @@
 #define CFGCHIP2_REFFREQ_12MHZ	(1 << 0)
 #define CFGCHIP2_REFFREQ_24MHZ	(2 << 0)
 #define CFGCHIP2_REFFREQ_48MHZ	(3 << 0)
+#define CFGCHIP2_REFFREQ_19_2MHZ	(4 << 0)
+#define CFGCHIP2_REFFREQ_38_4MHZ	(5 << 0)
+#define CFGCHIP2_REFFREQ_13MHZ	(6 << 0)
+#define CFGCHIP2_REFFREQ_26MHZ	(7 << 0)
+#define CFGCHIP2_REFFREQ_20MHZ	(8 << 0)
+#define CFGCHIP2_REFFREQ_40MHZ	(9 << 0)
 
 struct	da8xx_ohci_root_hub;
 
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH v10 5/5 usb: musb: da8xx: Add DT support for the DA8xx driver

In reply to a message not in the archive

This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver

---
v1: <initial>

v2:
- using standard MUSB properties "dr_mode", "mentor,power", "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits"
- using "ti," prefix instead of "da8xx," for specific property names
- no wilcards in compatibility string
- using CFGCHIP2_USB2PHYCLKMUX_SHIFT instead of CFGCHIP2_USB2PHYCLKMUX_OFFSET

v3:
- DMA mask initialization corrected
- removed extra #ifdef CONFIG_OF

v4:
- compatibility string set to "ti,da830-musb"
- "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits" properties removed and hardcoded
- "ti,phy20-clkmux-cfg" renamed to "ti,phy20-clkmux-pll" and changed to boolean
- removed use of the DA8XX_SYSCFG0_VIRT macro

v5:
- using CFGCHIP2_REFFREQ_ in get_phy_refclk_cfg()
- simplified initialization of the hard coded config parameters
- optimization CFGCHIP2 register update

v6:
- using "ti,usb2-phy-" prefix instead of "ti,phy20-" for the specific properties
- optimization CFGCHIP2 register update

v7:
- pdata::power hard coded to 500mA

v8:
- USB maximum power modelled via a regulator "vbus-supply"
- "ti,usb2-phy-refclock-frequency" renamed to "ti,usb2-phy-refclock-hz"
- "ti,usb2-phy-clkmux-pll" changed to "ti,usb2-phy-clkmux-refclkin" and the boolean meaning inverted to reflect the more common case

v9:
- power regulator used only to get the current

v10:
- corrected current calculation in get_vbus_power (missing divide by 2)

 drivers/usb/musb/da8xx.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 106 insertions(+)
drivers/usb/musb/da8xx.c +106 -0
index b03d3b8..52f2c3d 100644
@@ -6,6 +6,9 @@
  * Based on the DaVinci "glue layer" code.
  * Copyright (C) 2005-2006 by Texas Instruments
  *
+ * DT support
+ * Copyright (c) 2016 Petr Kulhavy, Barix AG <petr-Qh/[email protected]>
+ *
  * This file is part of the Inventra Controller Driver for Linux.
  *
  * The Inventra Controller Driver for Linux is free software; you
@@ -33,9 +36,11 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/usb/usb_phy_generic.h>
+#include <linux/regulator/consumer.h>
 
 #include <mach/da8xx.h>
 #include <linux/platform_data/usb-davinci.h>
+#include <linux/of_platform.h>
 
 #include "musb_core.h"
 
@@ -134,6 +139,55 @@ static inline void phy_off(void)
 	__raw_writel(cfgchip2, CFGCHIP2);
 }
 
+static inline int get_phy_refclk_cfg(struct device_node *np)
+{
+	u32 freq;
+
+	if (of_property_read_u32(np, "ti,usb2-phy-refclock-hz", &freq))
+		return -EINVAL;
+
+	switch (freq) {
+	case 12000000:
+		return CFGCHIP2_REFFREQ_12MHZ;
+	case 13000000:
+		return CFGCHIP2_REFFREQ_13MHZ;
+	case 19200000:
+		return CFGCHIP2_REFFREQ_19_2MHZ;
+	case 20000000:
+		return CFGCHIP2_REFFREQ_20MHZ;
+	case 24000000:
+		return CFGCHIP2_REFFREQ_24MHZ;
+	case 26000000:
+		return CFGCHIP2_REFFREQ_26MHZ;
+	case 38400000:
+		return CFGCHIP2_REFFREQ_38_4MHZ;
+	case 40000000:
+		return CFGCHIP2_REFFREQ_40MHZ;
+	case 48000000:
+		return CFGCHIP2_REFFREQ_48MHZ;
+	default:
+		return -EINVAL;
+	}
+}
+
+static inline u8 get_vbus_power(struct device *dev)
+{
+	struct regulator *vbus_supply;
+	int current_uA;
+
+	vbus_supply = regulator_get(dev, "vbus");
+	if (IS_ERR(vbus_supply))
+		return 255;
+
+	current_uA = regulator_get_current_limit(vbus_supply);
+	regulator_put(vbus_supply);
+
+	if (current_uA <= 0 || current_uA > 510000)
+		return 255;
+
+	return current_uA / 1000 / 2;
+}
+
 /*
  * Because we don't set CTRL.UINT, it's "important" to:
  *	- not read/write INTRUSB/INTRUSBE (except during
@@ -482,6 +536,12 @@ static const struct platform_device_info da8xx_dev_info = {
 	.dma_mask	= DMA_BIT_MASK(32),
 };
 
+static const struct musb_hdrc_config da8xx_config = {
+	.ram_bits = 10,
+	.num_eps = 5,
+	.multipoint = 1,
+};
+
 static int da8xx_probe(struct platform_device *pdev)
 {
 	struct resource musb_resources[2];
@@ -490,6 +550,7 @@ static int da8xx_probe(struct platform_device *pdev)
 	struct da8xx_glue		*glue;
 	struct platform_device_info	pinfo;
 	struct clk			*clk;
+	struct device_node		*np = pdev->dev.of_node;
 
 	int				ret = -ENOMEM;
 
@@ -515,6 +576,42 @@ static int da8xx_probe(struct platform_device *pdev)
 	glue->dev			= &pdev->dev;
 	glue->clk			= clk;
 
+	if (IS_ENABLED(CONFIG_OF) && np) {
+		int refclk_cfg;
+		u32 cfgchip2;
+
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			ret = -ENOMEM;
+			goto err5;
+		}
+
+		pdata->config	= &da8xx_config;
+		pdata->mode	= musb_get_mode(&pdev->dev);
+		pdata->power	= get_vbus_power(&pdev->dev);
+
+		refclk_cfg = get_phy_refclk_cfg(np);
+		if (refclk_cfg < 0) {
+			dev_err(&pdev->dev,
+				"PHY 2.0 clock frequency invalid or undefined\n");
+			ret = -EINVAL;
+			goto err5;
+		}
+
+		cfgchip2 = __raw_readl(CFGCHIP2);
+		cfgchip2 &= ~(CFGCHIP2_USB2PHYCLKMUX | CFGCHIP2_REFFREQ);
+
+		/*
+		 * optional parameter reference clock source
+		 * false = use PLL, true = use the external clock pin
+		 */
+		if (!of_property_read_bool(np, "ti,usb2-phy-clkmux-refclkin"))
+			cfgchip2 |=  CFGCHIP2_USB2PHYCLKMUX;
+		cfgchip2 |=  refclk_cfg;
+
+		__raw_writel(cfgchip2, CFGCHIP2);
+	}
+
 	pdata->platform_ops		= &da8xx_ops;
 
 	glue->phy = usb_phy_generic_register();
@@ -582,11 +679,20 @@ static int da8xx_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id da8xx_id_table[] = {
+	{
+		.compatible = "ti,da830-musb",
+	},
+	{},
+};
+MODULE_DEVICE_TABLE(of, da8xx_id_table);
+
 static struct platform_driver da8xx_driver = {
 	.probe		= da8xx_probe,
 	.remove		= da8xx_remove,
 	.driver		= {
 		.name	= "musb-da8xx",
+		.of_match_table = of_match_ptr(da8xx_id_table),
 	},
 };
 
Signature · 6 lines
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#9 lore raw

Re: [PATCH 5/5 v10] usb: musb: da8xx: Add DT support for the DA8xx driver

In reply to a message not in the archive

Hello.

Quoted 4 lines · Petr Kulhavy

This adds DT support for TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver

Author's own "Tested-by:" tag is assumed, no need to specify it.

Though using the clk API seems a good idea still...

[...]

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw
In reply to a message not in the archive
Quoted 3 lines · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#11 lore raw
In reply to a message not in the archive

Hi,

Quoted 1 line · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

Thanks,
-Bin.

Quoted 95 lines

---
v1: <initial>

v2:
- using standard properties "dr_mode", "mentor,power", "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits"
- using "ti," prefix instead of "da8xx," for specific property names
- no wildcards in compatibility string

v3:
- added "reg", "interrupts" and "interrupt-names" properties
- wildcards in compatibility string

v4:
- compatibility string set to "ti,da830-musb"
- "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits" properties removed and hardcoded
- "ti,phy20-clkmux-cfg" renamed to "ti,phy20-clkmux-pll" and changed to boolean
- removed "ti,hwmods"

v5:
- "ti,phy20-refclock-frequency" property made mandatory

v6:
- using "ti,usb2-phy-" prefix instead of "ti,phy20-" for the specific properties

v7:
- removed the "mentor,power" property; hard coded to 500mA in the code

v8:
- "ti,usb2-phy-refclock-frequency" renamed to "ti,usb2-phy-refclock-hz" and description amended
- "ti,usb2-phy-clkmux-pll" changed to "ti,usb2-phy-clkmux-refclkin" to reflect the more common case
- USB maximum power modelled via a regulator "vbus-supply"

v9: <no change>
v10: <no change>

 .../devicetree/bindings/usb/da8xx-usb.txt          | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt
Documentation/devicetree/bindings/usb/da8xx-usb.txt new file +45 -0
new file mode 100644
index 0000000..a6eda5b
@@ -0,0 +1,45 @@
+TI DA8xx MUSB
+~~~~~~~~~~~~~
+For DA8xx/OMAP-L1x/AM17xx/AM18xx platforms.
+
+Required properties:
+~~~~~~~~~~~~~~~~~~~~
+ - compatible : Should be set to "ti,da830-musb".
+
+ - reg: Offset and length of the USB controller register set.
+
+ - interrupts: The USB interrupt number.
+
+ - interrupt-names: Should be set to "mc".
+
+ - dr_mode: The USB operation mode. Should be one of "host", "peripheral" or "otg".
+
+ - vbus-supply: Phandle to a regulator providing the USB bus power.
+
+ - ti,usb2-phy-refclock-hz : Integer. Frequency in Hz of the USB 2.0 PHY reference clock,
+     either provided by the internal PLL or an external source.
+     The supported values are: 12MHz, 13MHz, 19.2MHz, 20MHz, 24MHz, 26MHz, 38.4MHz, 40MHz, 48MHz.
+
+
+Optional properties:
+~~~~~~~~~~~~~~~~~~~~
+ - ti,usb2-phy-clkmux-refclkin: Boolean. Defines the USB 2.0 PHY reference clock source.
+     If present the the external USB_REFCLKIN pin is used as a clock source, otherwise
+     the internal PLL is used.
+
+Example:
+
+	usb20: usb@1e00000 {
+		compatible = "ti,da830-musb";
+		reg =   <0x00200000 0x10000>;
+		interrupt-parent = <&intc>;
+		interrupts = <58>;
+		interrupt-names = "mc";
+
+		dr_mode = "host";
+		vbus-supply = <&usb_vbus>;
+
+		ti,usb2-phy-refclock-hz = <24000000>;
+
+		status = "okay";
+	};
Signature · 1 line
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw

Re: [PATCH 3/5 v10] usb: musb: core: added missing const qualifier to musb_hdrc_platform_data::config

In reply to a message not in the archive

Hi,

Quoted 9 lines · Petr Kulhavy

The musb_hdrc_platform_data::config was defined as a non-const pointer. However some drivers (e.g. the ux500) set up this pointer to point to a static structure, which is potentially dangerous. Since the musb core uses the pointer in a read-only manner the const qualifier was added to protect the content of the config.

It is okay now, but I don't remember I've given my Signed-off-by to this patch yet.

Regards,
-Bin.

Quoted 58 lines

---
v5: <initial>

v6:
- whitespace formatting corrected

v7: <no change>
v8: <no change>
v9: <no change>
v10: <no change>

 drivers/usb/musb/musb_core.c | 2 +-
 drivers/usb/musb/musb_core.h | 2 +-
 include/linux/usb/musb.h     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/usb/musb/musb_core.c +1 -1
index 6a2d6d3..b0be1a9 100644
@@ -1920,7 +1920,7 @@ static void musb_recover_from_babble(struct musb *musb)
  */
 
 static struct musb *allocate_instance(struct device *dev,
-		struct musb_hdrc_config *config, void __iomem *mbase)
+		const struct musb_hdrc_config *config, void __iomem *mbase)
 {
 	struct musb		*musb;
 	struct musb_hw_ep	*ep;
drivers/usb/musb/musb_core.h +1 -1
index 3f7a325..a062185 100644
@@ -438,7 +438,7 @@ struct musb {
 	 */
 	unsigned                double_buffer_not_ok:1;
 
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	int			xceiv_old_state;
 #ifdef CONFIG_DEBUG_FS
include/linux/usb/musb.h +1 -1
index 96ddfb7..0b3da40 100644
@@ -124,7 +124,7 @@ struct musb_hdrc_platform_data {
 	int		(*set_power)(int state);
 
 	/* MUSB configuration-specific details */
-	struct musb_hdrc_config	*config;
+	const struct musb_hdrc_config *config;
 
 	/* Architecture specific board data	*/
 	void		*board_data;
Signature · 1 line
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#12 lore raw
In reply to Bin Liu
Quoted 9 lines · Bin Liu

Hi,

Quoted 1 line · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

Thanks,
-Bin.

Hi Bin,

I have not touched the DA8xx dtsi file as I have these changes in my own board specific dts. But I can create another patch if you find it sensible. For me it makes sense.

Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to a message not in the archive

Hi,

Quoted 10 lines · Petr Kulhavy
Quoted 7 lines · Bin Liu

Hi,

Quoted 1 line · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

Quoted 8 lines
Quoted 2 lines

Thanks,
-Bin.

Hi Bin,

I have not touched the DA8xx dtsi file as I have these changes in my own board specific dts.
But I can create another patch if you find it sensible. For me it makes sense.

Okay, that is up to you, you can submit that patch whenever you are ready. I will take this patch set when all comments are sorted out.

I am having 2nd thought on parsing the clock prop, Sergei's comment might be better. I will look more on this over this weekend. (DT is not in my expertise...)

Regards,
-Bin.

Quoted 2 lines

Petr

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#15 lore raw
Quoted 14 lines · Bin Liu

Hi,

Quoted 11 lines · Petr Kulhavy
Quoted 9 lines · Bin Liu

Hi,

Quoted 1 line · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

Thanks,
-Bin.

Quoted 8 lines
Quoted 6 lines

Hi Bin,

I have not touched the DA8xx dtsi file as I have these changes in my own board specific dts.
But I can create another patch if you find it sensible. For me it makes sense.

Okay, that is up to you, you can submit that patch whenever you are ready. I will take this patch set when all comments are sorted out.

I will submit that patch once the DT is there.

Quoted 6 lines

I am having 2nd thought on parsing the clock prop, Sergei's comment might be better. I will look more on this over this weekend. (DT is not in my expertise...)

Regards,
-Bin.

I like Sergei's comment as well, but cannot see (yet) how the clock input selection would be done.
I mean, it makes sense to do the clock abstraction only if it can be done properly and the clock input selection can be covered as well. The DA8xx platform is missing the real clock framework and therefore the different clocks cannot be referenced in DT. There is a fake clock framework in arch/arm/mach-davinci/clock.c - I've already been through that and then gave up.

So if you come up with some good idea it's appreciated.

Regards
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw
In reply to a message not in the archive
Quoted 9 lines · Petr Kulhavy
Quoted 6 lines

I am having 2nd thought on parsing the clock prop, Sergei's comment might be better. I will look more on this over this weekend. (DT is not in my expertise...)

Regards,
-Bin.

I like Sergei's comment as well, but cannot see (yet) how the clock input selection would be done.

The same way as now, of course. Only getting the clock frequency would be
different, via clk_get_rate()...

Quoted 2 lines

I mean, it makes sense to do the clock abstraction only if it can be done properly and the clock input selection can be covered as well.

No, this item has never been covered by the clk layer IIRC. That's what
the device node props are for.

Quoted 2 lines

The DA8xx platform is missing the real clock framework and therefore the different clocks cannot be referenced in DT.

You mean more than one clock per device?

Quoted 2 lines

There is a fake clock framework in arch/arm/mach-davinci/clock.c - I've already been through that and then gave up.

I'm not sure why you call it "fake". It's a normal clk implementation,
just not converted to the common clk framework.

Quoted 2 lines

Regards
Petr

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#20 lore raw
In reply to Bin Liu
Quoted 4 lines · Bin Liu
Quoted 1 line

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

The .dts[i] patches go thru the arm-soc tree. This patch only documents
the bindings, that's all.

Quoted 2 lines

Thanks,
-Bin.

Please cut out the part of mail you're not replying to -- this saves
everybody's time.

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#22 lore raw
In reply to a message not in the archive

Hi,

Quoted 7 lines · Sergei Shtylyov
Quoted 4 lines · Bin Liu
Quoted 1 line

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

It seems the dts(i) file is not touched in this patch set, so DA8xx MUSB still does not use DT with these patches? Or did I miss anything?

Quoted 8 lines

The .dts[i] patches go thru the arm-soc tree. This patch only
documents the bindings, that's all.

Quoted 2 lines

Thanks,
-Bin.

Please cut out the part of mail you're not replying to -- this
saves everybody's time.

Ok, will do. Thanks.

Quoted 3 lines

MBR, Sergei

Regards,
-Bin.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#23 lore raw
In reply to a message not in the archive

Hi,

Documentation/devicetree/bindings/usb/da8xx-usb.txt line 21

Quoted 3 lines · Petr Kulhavy

+ - ti,usb2-phy-refclock-hz : Integer. Frequency in Hz of the USB 2.0 PHY reference clock,

Documentation/devicetree/bindings/usb/da8xx-usb.txt new file +2 -0
+     either provided by the internal PLL or an external source.
+     The supported values are: 12MHz, 13MHz, 19.2MHz, 20MHz, 24MHz, 26MHz, 38.4MHz, 40MHz, 48MHz.

why isn't this an actual clock phandle ? Driver could, then, use clk_get_rate() to figure this one out. You could just use a fixed clock here to satisfy the clock API.

Signature · 1 line
balbi
#25 lore raw
In reply to a message not in the archive
Quoted 12 lines · Felipe Balbi

Hi,

Documentation/devicetree/bindings/usb/da8xx-usb.txt line 21

Quoted 3 lines · Petr Kulhavy

+ - ti,usb2-phy-refclock-hz : Integer. Frequency in Hz of the USB 2.0 PHY reference clock,

Documentation/devicetree/bindings/usb/da8xx-usb.txt new file +2 -0
+     either provided by the internal PLL or an external source.
+     The supported values are: 12MHz, 13MHz, 19.2MHz, 20MHz, 24MHz, 26MHz, 38.4MHz, 40MHz, 48MHz.

why isn't this an actual clock phandle ? Driver could, then, use clk_get_rate() to figure this one out. You could just use a fixed clock here to satisfy the clock API.

I've actually been working on getting the da8xx ohci driver working with device tree. It has similar clock issues (in fact, the ohci clock is a child of the musb clock). Petr, give me a day or two and will have post some patches. It will have a clock that can be used here for clk_get_rate(). --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#27 lore raw
In reply to a message not in the archive

Hi,

Quoted 16 lines · David Lechner

[ text/plain ]

Quoted 12 lines · Felipe Balbi

Hi,

Documentation/devicetree/bindings/usb/da8xx-usb.txt line 21

Quoted 3 lines · Petr Kulhavy

+ - ti,usb2-phy-refclock-hz : Integer. Frequency in Hz of the USB 2.0 PHY reference clock,

Documentation/devicetree/bindings/usb/da8xx-usb.txt new file +2 -0
+     either provided by the internal PLL or an external source.
+     The supported values are: 12MHz, 13MHz, 19.2MHz, 20MHz, 24MHz, 26MHz, 38.4MHz, 40MHz, 48MHz.

why isn't this an actual clock phandle ? Driver could, then, use clk_get_rate() to figure this one out. You could just use a fixed clock here to satisfy the clock API.

Quoted 4 lines

I've actually been working on getting the da8xx ohci driver working with device tree. It has similar clock issues (in fact, the ohci clock is a child of the musb clock). Petr, give me a day or two and will have post some patches. It will have a clock that can be used here for clk_get_rate().

sounds good, cool.

Signature · 1 line
balbi
#19 lore raw
In reply to a message not in the archive
Quoted 24 lines · Sergei Shtylyov
Quoted 9 lines · Petr Kulhavy
Quoted 6 lines

I am having 2nd thought on parsing the clock prop, Sergei's comment might be better. I will look more on this over this weekend. (DT is not in my expertise...)

Regards,
-Bin.

I like Sergei's comment as well, but cannot see (yet) how the clock input selection would be done.

The same way as now, of course. Only getting the clock frequency
would be different, via clk_get_rate()...

Quoted 2 lines

I mean, it makes sense to do the clock abstraction only if it can be done properly and the clock input selection can be covered as well.

No, this item has never been covered by the clk layer IIRC. That's
what the device node props are for.

Quoted 2 lines

The DA8xx platform is missing the real clock framework and therefore the different clocks cannot be referenced in DT.

Quoted 8 lines

You mean more than one clock per device?

Quoted 2 lines

There is a fake clock framework in arch/arm/mach-davinci/clock.c - I've already been through that and then gave up.

I'm not sure why you call it "fake". It's a normal clk
implementation, just not converted to the common clk framework.

Hi Sergei,

what I mean is that the DA8xx platform does not use the common clock framework. It uses its own clock implementation instead which is incompatible with the common clock framework, since it uses the same function names. So the common clock framework cannot be even compiled with this architecture.

With common clock framework the USB 2.0 clock would be modelled as a multiplexer between AUXCLK and USB_REFCLKIN. The AUXCLK would be a phandle to the respective internal clock. USB_REFCLKIN then a phandle to either fixed clock or another clock source. Providing the right parent phandle, internally calling set_parent() would do the job and no extra property would be needed. Or did I miss something?

If the common clock framework is not available for this platform then the only option I see is what I did in my patch - to set the frequency via an integer property and control the multiplexer with another property. We cannot even do what you suggested as the fixed clock simply does not exist due to the lack of the common clock framework. Or do you see another way?

Regards
Petr
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by
#31 lore raw
In reply to a message not in the archive
Quoted 35 lines · Petr Kulhavy

DT binding for the TI DA8xx/OMAP-L1x/AM17xx/AM18xx MUSB driver.

---
v1: <initial>

v2:
- using standard properties "dr_mode", "mentor,power", "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits"
- using "ti," prefix instead of "da8xx," for specific property names
- no wildcards in compatibility string

v3:
- added "reg", "interrupts" and "interrupt-names" properties
- wildcards in compatibility string

v4:
- compatibility string set to "ti,da830-musb"
- "mentor,num-eps", "mentor,multipoint", "mentor,ram-bits" properties removed and hardcoded
- "ti,phy20-clkmux-cfg" renamed to "ti,phy20-clkmux-pll" and changed to boolean
- removed "ti,hwmods"

v5:
- "ti,phy20-refclock-frequency" property made mandatory

v6:
- using "ti,usb2-phy-" prefix instead of "ti,phy20-" for the specific properties

v7:
- removed the "mentor,power" property; hard coded to 500mA in the code

v8:
- "ti,usb2-phy-refclock-frequency" renamed to "ti,usb2-phy-refclock-hz" and description amended
- "ti,usb2-phy-clkmux-pll" changed to "ti,usb2-phy-clkmux-refclkin" to reflect the more common case
- USB maximum power modelled via a regulator "vbus-supply"

Quoted 6 lines

v9: <no change>
v10: <no change>

 .../devicetree/bindings/usb/da8xx-usb.txt          | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/da8xx-usb.txt

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#28 lore raw
In reply to a message not in the archive
Quoted 10 lines · David Lechner
Quoted 7 lines · Felipe Balbi

Hi,

why isn't this an actual clock phandle ? Driver could, then, use clk_get_rate() to figure this one out. You could just use a fixed clock here to satisfy the clock API.

I've actually been working on getting the da8xx ohci driver working with device tree. It has similar clock issues (in fact, the ohci clock is a child of the musb clock). Petr, give me a day or two and will have post some patches. It will have a clock that can be used here for clk_get_rate().

Hi David,

I'm trying to move on with my USB2.0 patch set because my projects is blocked waiting for it.
I've seen your PHY patch but it contains only on/off functions and does not handle the clocks, which IMHO should be moved to the PHY driver as well if we decided to do it properly.

How shall we proceed if both of us are working on the same piece of code?

Thanks
Petr

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#30 lore raw
In reply to a message not in the archive
Quoted 5 lines · Petr Kulhavy

I'm trying to move on with my USB2.0 patch set because my projects is blocked waiting for it.
I've seen your PHY patch but it contains only on/off functions and does not handle the clocks, which IMHO should be moved to the PHY driver as well if we decided to do it properly.

Have a closer look at my (v3) patchset. It does handle clocks in the phy driver. The clocks themselves are implemented in mach-davinici similar to the rest of the SoC clocks and the phy driver uses clk_get(), clk_prepare_enable(), etc.

Quoted 1 line

How shall we proceed if both of us are working on the same piece of code?

I have never submitted patches for the Linux kernel before last month, so I have not yet experienced the whole process of getting a patch accepted. So, I don't know an answer to this question.

Perhaps someone with more experience can offer advice?
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html