Skip to contentSkip to conversation

omap: add ocp2scp as a misc driver

RFC PATCH Superseded Kishon Vijay Abraham I 6 participants 23 messages May 30, 2012 – Sep 6, 2012

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover omap: add ocp2scp as a misc driver

This patch series is done as a preparatory step for adding phy drivers for dwc3 and musb.

This series adds a new driver for ocp2scp to which phy drivers are connected.

I'm planning to send phy drivers asap. Meanwhile I'd like to get some review comments for this series. I have also plans to send device tree adaptation of the ocp2scp driver.

Developed on
http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next

If it has to be based on some other tree, please let me know.

Kishon Vijay Abraham I (5):
arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp
arm: omap: remove ocp2scp_usb_phy_ick clock node
drivers: misc: omap: add a new driver for ocp2scp
ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy
arm: omap: ocp2scp: create omap device for ocp2scp

 arch/arm/mach-omap2/clock44xx_data.c       |   11 ---
 arch/arm/mach-omap2/devices.c              |   72 +++++++++++++++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   22 +++++
 drivers/misc/Kconfig                       |    8 ++
 drivers/misc/Makefile                      |    1 +
 drivers/misc/omap-ocp2scp.c                |  135 ++++++++++++++++++++++++++++
 include/linux/platform_data/omap_ocp2scp.h |   31 +++++++
 7 files changed, 269 insertions(+), 11 deletions(-)
 create mode 100644 drivers/misc/omap-ocp2scp.c
 create mode 100644 include/linux/platform_data/omap_ocp2scp.h
Signature · 1 line
1.7.5.4
#1 lore raw

RFC PATCH 1/5 arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp

Made *ocp2scp_usb_phy_phy_48m* as the main_clk for ocp2scp. Since this ocp2scp module does not have any fck but does have a single opt_clock, it is added as the main_clk for ocp2scp.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -0
index 950454a..249ff76 100644
@@ -2508,6 +2508,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 	.name		= "ocp2scp_usb_phy",
 	.class		= &omap44xx_ocp2scp_hwmod_class,
 	.clkdm_name	= "l3_init_clkdm",
+	.main_clk	= "ocp2scp_usb_phy_phy_48m",
 	.prcm = {
 		.omap4 = {
 			.clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET,
Signature · 1 line
1.7.5.4
#2 lore raw

Re: [RFC PATCH 1/5] arm: omap: hwmod: make *phy_48m* as the main_clk of ocp2scp

Quoted 26 lines · Kishon Vijay Abraham I

Made *ocp2scp_usb_phy_phy_48m* as the main_clk for ocp2scp. Since this ocp2scp module does not have any fck but does have a single opt_clock, it is added as the main_clk for ocp2scp.

---

?arch/arm/mach-omap2/omap_hwmod_44xx_data.c | ? ?1 + ?1 files changed, 1 insertions(+), 0 deletions(-)

arch/arm/mach-omap2/omap_hwmod_44xx_data.c +1 -1
index 950454a..249ff76 100644
@@ -2508,6 +2508,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 ? ? ? ?.name ? ? ? ? ? = "ocp2scp_usb_phy",
 ? ? ? ?.class ? ? ? ? ?= &omap44xx_ocp2scp_hwmod_class,
 ? ? ? ?.clkdm_name ? ? = "l3_init_clkdm",
+ ? ? ? .main_clk ? ? ? = "ocp2scp_usb_phy_phy_48m",
 ? ? ? ?.prcm = {
 ? ? ? ? ? ? ? ?.omap4 = {
 ? ? ? ? ? ? ? ? ? ? ? ?.clkctrl_offs = OMAP4_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL_OFFSET,
--

1.7.5.4

Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

Minor ..
$subject
s/arm: omap: / ARM: OMAP

An maintain this naming consistency since one of the patch in the series uses capital where as others not

#3 lore raw

RFC PATCH 2/5 arm: omap: remove ocp2scp_usb_phy_ick clock node

In reply to Kishon Vijay Abraham I

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added (which can be used to control MODULEMODE) this clock node is removed.

---
 arch/arm/mach-omap2/clock44xx_data.c |   11 -----------
 1 files changed, 0 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/clock44xx_data.c +0 -11
index 2172f66..3e2cccf 100644
@@ -2132,16 +2132,6 @@ static struct clk ocp2scp_usb_phy_phy_48m = {
 	.recalc		= &followparent_recalc,
 };
 
-static struct clk ocp2scp_usb_phy_ick = {
-	.name		= "ocp2scp_usb_phy_ick",
-	.ops		= &clkops_omap2_dflt,
-	.enable_reg	= OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
-	.enable_bit	= OMAP4430_MODULEMODE_HWCTRL,
-	.clkdm_name	= "l3_init_clkdm",
-	.parent		= &l4_div_ck,
-	.recalc		= &followparent_recalc,
-};
-
 static struct clk ocp_wp_noc_ick = {
 	.name		= "ocp_wp_noc_ick",
 	.ops		= &clkops_omap2_dflt,
@@ -3277,7 +3267,6 @@ static struct omap_clk omap44xx_clks[] = {
 	CLK(NULL,	"mmc4_fck",			&mmc4_fck,	CK_443X),
 	CLK(NULL,	"mmc5_fck",			&mmc5_fck,	CK_443X),
 	CLK(NULL,	"ocp2scp_usb_phy_phy_48m",	&ocp2scp_usb_phy_phy_48m,	CK_443X),
-	CLK(NULL,	"ocp2scp_usb_phy_ick",		&ocp2scp_usb_phy_ick,	CK_443X),
 	CLK(NULL,	"ocp_wp_noc_ick",		&ocp_wp_noc_ick,	CK_443X),
 	CLK("omap_rng",	"ick",				&rng_ick,	CK_443X),
 	CLK(NULL,	"sha2md5_fck",			&sha2md5_fck,	CK_443X),
Signature · 1 line
1.7.5.4
#4 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

Quoted 8 lines · Kishon Vijay Abraham I

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added (which can be used to control MODULEMODE) this clock node is removed.

---
?arch/arm/mach-omap2/clock44xx_data.c | ? 11 -----------

Have you patched clock44xx_data.c manually or you have a patch for the clock_data autogen script to generate it ?

Regards
Santosh

#5 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

Quoted 5 lines · Santosh
Quoted 4 lines · Kishon Vijay Abraham I

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added (which can be used to control MODULEMODE) this clock node is removed.

Quoted 7 lines
Quoted 4 lines
---
  arch/arm/mach-omap2/clock44xx_data.c |   11 -----------

Have you patched clock44xx_data.c manually or you have a patch for the clock_data autogen script to generate it ?

I have a series that will remove all these clock nodes. I should be able to post that soon.

Potentially at that time, Kishon might be able to drop that patch.

Regards,
Benoit

#6 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

Hi Benoit,

Quoted 16 lines · Benoit
Quoted 15 lines · Santosh
Quoted 10 lines · On Wed, May 30, 2012 at 4:26 PM, Kishon Vijay Abraham I<[email protected]> ?wrote:

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added
(which can be used to control MODULEMODE) this clock node is removed.

---
?arch/arm/mach-omap2/clock44xx_data.c | ? 11 -----------

Quoted 8 lines
Quoted 2 lines

Have you patched clock44xx_data.c manually or you have a patch for the clock_data autogen script to generate it ?

I have a series that will remove all these clock nodes. I should be able to post that soon.

Potentially at that time, Kishon might be able to drop that patch.

Will you be sending a patch for *[RFC PATCH 1/5] arm: omap: hwmod:
make *phy_48m* as the main_clk of ocp2scp* also or I have to keep that as part of my series?

Thanks
Kishon

#7 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

Quoted 23 lines · KISHON VIJAY

Hi Benoit,

Quoted 20 lines · Benoit
Quoted 17 lines · Santosh
Quoted 10 lines · Kishon Vijay Abraham I

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added
(which can be used to control MODULEMODE) this clock node is removed.

---
  arch/arm/mach-omap2/clock44xx_data.c |   11 -----------

Have you patched clock44xx_data.c manually or you have a patch for the clock_data autogen script to generate it ?

Quoted 8 lines
Quoted 4 lines

I have a series that will remove all these clock nodes. I should be able to post that soon.

Potentially at that time, Kishon might be able to drop that patch.

Will you be sending a patch for *[RFC PATCH 1/5] arm: omap: hwmod:
make *phy_48m* as the main_clk of ocp2scp* also or I have to keep that as part of my series?

Good point. In fact, I'm fixing both at the same time to avoid any bisect issue.

Regards,
Benoit

#8 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

Quoted 37 lines · Benoit
Quoted 36 lines · KISHON VIJAY

Hi Benoit,

Quoted 30 lines · On Wed, May 30, 2012 at 8:53 PM, Cousson, Benoit<[email protected]> ?wrote:
Quoted 18 lines · Santosh
Quoted 11 lines · On Wed, May 30, 2012 at 4:26 PM, Kishon Vijay Abraham I<[email protected]> ?wrote:

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added
(which can be used to control MODULEMODE) this clock node is removed.

---
?arch/arm/mach-omap2/clock44xx_data.c | ? 11 -----------

Quoted 2 lines

Have you patched clock44xx_data.c manually or you have a patch for the clock_data autogen script to generate it ?

I have a series that will remove all these clock nodes. I should be able to
post that soon.

Potentially at that time, Kishon might be able to drop that patch.

Quoted 7 lines
Quoted 3 lines

Will you be sending a patch for *[RFC PATCH 1/5] arm: omap: hwmod:
make *phy_48m* as the main_clk of ocp2scp* also or I have to keep that as part of my series?

Good point. In fact, I'm fixing both at the same time to avoid any bisect issue.

Thanks :-)

-Kishon

#9 lore raw

Re: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

In reply to Kishon Vijay Abraham I

Hi,

Quoted 6 lines · Kishon Vijay Abraham I

"ocp2scp_usb_phy_ick" clock node was a fake clock node created to control MODULEMODE of ocp2scp. Since the hwmod for ocp2scp is now added (which can be used to control MODULEMODE) this clock node is removed.

If there isn't any comments for this patch, can someone queue it up?

Thanks
Kishon

#10 lore raw

RFC PATCH 3/5 drivers: misc: omap: add a new driver for ocp2scp

In reply to Kishon Vijay Abraham I

Adds a new driver _ocp2scp_. This driver takes the responsibility of creating all the devices that is connected to OCP2SCP. In the case of OMAP4, USB2PHY is connected to ocp2scp.

---
 drivers/misc/Kconfig                       |    8 ++
 drivers/misc/Makefile                      |    1 +
 drivers/misc/omap-ocp2scp.c                |  135 ++++++++++++++++++++++++++++
 include/linux/platform_data/omap_ocp2scp.h |   31 +++++++
 4 files changed, 175 insertions(+), 0 deletions(-)
 create mode 100644 drivers/misc/omap-ocp2scp.c
 create mode 100644 include/linux/platform_data/omap_ocp2scp.h
drivers/misc/Kconfig +8 -0
index 2661f6e..c70aa15 100644
@@ -508,6 +508,14 @@ config USB_SWITCH_FSA9480
 	  stereo and mono audio, video, microphone and UART data to use
 	  a common connector port.
 
+config OMAP_OCP2SCP
+	tristate "OMAP OCP2SCP DRIVER"
+	help
+	  Driver to enable ocp2scp module which transforms ocp interface
+	  protocol to scp protocol. In OMAP4, USB PHY is connected via
+	  OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
+	  OCP2SCP.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index 456972f..4d7c8ce 100644
@@ -50,4 +50,5 @@ obj-y				+= lis3lv02d/
 obj-y				+= carma/
 obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
 obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
+obj-$(CONFIG_OMAP_OCP2SCP)	+= omap-ocp2scp.o
 obj-$(CONFIG_INTEL_MEI)		+= mei/
drivers/misc/omap-ocp2scp.c new file +135 -0

135 lines not on this page · raw message

include/linux/platform_data/omap_ocp2scp.h new file +31 -0
new file mode 100644
index 0000000..dcbbf2a
@@ -0,0 +1,31 @@
+/*
+ * omap_ocp2scp.h -- ocp2scp header file
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I <[email protected]>
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef __DRIVERS_OMAP_OCP2SCP_H
+#define __DRIVERS_OMAP_OCP2SCP_H
+
+struct omap_ocp2scp_dev {
+	const char			*drv_name;
+	struct resource			*res;
+};
+
+struct omap_ocp2scp_platform_data {
+	int				dev_cnt;
+	struct omap_ocp2scp_dev		**devices;
+};
+#endif /* __DRIVERS_OMAP_OCP2SCP_H */
Signature · 1 line
1.7.5.4
#11 lore raw

Re: [RFC PATCH 3/5] drivers: misc: omap: add a new driver for ocp2scp

Quoted 6 lines · Kishon Vijay Abraham I

Adds a new driver _ocp2scp_. This driver takes the responsibility of creating all the devices that is connected to OCP2SCP. In the case of OMAP4, USB2PHY is connected to ocp2scp.

---

[...]

drivers/misc/omap-ocp2scp.c line 4

Quoted 6 lines

+++ b/drivers/misc/omap-ocp2scp.c

drivers/misc/omap-ocp2scp.c new file +4 -0
@@ -0,0 +1,135 @@
+/*
+ * omap-ocp2scp.c - transform ocp interface protocol to scp protocol
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com

s/2011/2012

[...]

include/linux/platform_data/omap_ocp2scp.h line 4

Quoted 10 lines
include/linux/platform_data/omap_ocp2scp.h new file +4 -0
new file mode 100644
index 0000000..dcbbf2a
@@ -0,0 +1,31 @@
+/*
+ * omap_ocp2scp.h -- ocp2scp header file
+ *
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com

Dito.

#12 lore raw

RFC PATCH 4/5 ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy

In reply to Kishon Vijay Abraham I

In order to reflect devices(usb_phy) attached to ocp2scp bus, ocp2scp is assigned a device attribute to represent the attached devices.

---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/omap_hwmod_44xx_data.c +21 -0
index 249ff76..b5a91e8 100644
@@ -19,6 +19,7 @@
  */
 
 #include <linux/io.h>
+#include <linux/platform_data/omap_ocp2scp.h>
 
 #include <plat/omap_hwmod.h>
 #include <plat/cpu.h>
@@ -2499,6 +2500,25 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = {
 	.name	= "ocp2scp",
 };
 
+/* ocp2scp dev_attr */
+static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
+	{
+		.name		= "usb_phy",
+		.start		= 0x4a0ad080,
+		.end		= 0x4a0ae000,
+		.flags		= IORESOURCE_MEM,
+	},
+	{ }
+};
+
+static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
+	{
+		.drv_name       = "omap-usb2",
+		.res		= omap44xx_usb_phy_and_pll_addrs,
+	},
+	{ }
+};
+
 /* ocp2scp_usb_phy */
 static struct omap_hwmod_opt_clk ocp2scp_usb_phy_opt_clks[] = {
 	{ .role = "phy_48m", .clk = "ocp2scp_usb_phy_phy_48m" },
@@ -2516,6 +2536,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
 			.modulemode   = MODULEMODE_HWCTRL,
 		},
 	},
+	.dev_attr	= ocp2scp_dev_attr,
 	.opt_clks	= ocp2scp_usb_phy_opt_clks,
 	.opt_clks_cnt	= ARRAY_SIZE(ocp2scp_usb_phy_opt_clks),
 };
Signature · 1 line
1.7.5.4
#13 lore raw

RFC PATCH 5/5 arm: omap: ocp2scp: create omap device for ocp2scp

In reply to Kishon Vijay Abraham I

Platfrom device for ocp2scp is created using omap_device_build in devices file. This is used for both omap4(musb) and omap5(dwc3).

---
 arch/arm/mach-omap2/devices.c |   72 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/devices.c +72 -0
index ae62ece..d87cf40 100644
@@ -18,6 +18,7 @@
 #include <linux/slab.h>
 #include <linux/of.h>
 #include <linux/platform_data/omap4-keypad.h>
+#include <linux/platform_data/omap_ocp2scp.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -659,6 +660,76 @@ void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
 
 #endif
 
+#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)
+static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
+{
+	int cnt	= 0;
+
+	while (ocp2scp_dev->drv_name != NULL) {
+		cnt++;
+		ocp2scp_dev++;
+	}
+
+	return cnt;
+}
+
+static void omap_init_ocp2scp(void)
+{
+	struct omap_hwmod	*oh;
+	struct platform_device	*pdev;
+	int			bus_id = -1, dev_cnt = 0, i;
+	struct omap_ocp2scp_dev	*ocp2scp_dev;
+	const char		*oh_name, *name;
+	struct omap_ocp2scp_platform_data *pdata;
+
+	oh_name = "ocp2scp_usb_phy";
+	name	= "omap-ocp2scp";
+
+	oh = omap_hwmod_lookup(oh_name);
+	if (!oh) {
+		pr_err("%s: could not find omap_hwmod for %s\n", __func__,
+								oh_name);
+		return;
+	}
+
+	pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
+	if (!pdata) {
+		pr_err("%s: No memory for ocp2scp pdata\n", __func__);
+		return;
+	}
+
+	ocp2scp_dev = oh->dev_attr;
+	dev_cnt = count_ocp2scp_devices(ocp2scp_dev);
+
+	if (!dev_cnt) {
+		pr_err("%s: No devices connected to ocp2scp\n", __func__);
+		return;
+	}
+
+	pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *)
+					* dev_cnt, GFP_KERNEL);
+	if (!pdata->devices) {
+		pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);
+		return;
+	}
+
+	for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)
+		pdata->devices[i] = ocp2scp_dev;
+
+	pdata->dev_cnt	= dev_cnt;
+
+	pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata), NULL,
+								0, false);
+	if (IS_ERR(pdev)) {
+		pr_err("Could not build omap_device for %s %s\n",
+						name, oh_name);
+		return;
+	}
+}
+#else
+static inline void omap_init_ocp2scp(void) { }
+#endif
+
 /*-------------------------------------------------------------------------*/
 
 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
@@ -745,6 +816,7 @@ static int __init omap2_init_devices(void)
 	omap_init_sham();
 	omap_init_aes();
 	omap_init_vout();
+	omap_init_ocp2scp();
 
 	return 0;
 }
Signature · 1 line
1.7.5.4
maintainer
#14 lore raw
In reply to Kishon Vijay Abraham I
Quoted 6 lines · Kishon Vijay Abraham I

This patch series is done as a preparatory step for adding phy drivers for dwc3 and musb.

This series adds a new driver for ocp2scp to which phy drivers are connected.

Quoted 8 lines

I'm planning to send phy drivers asap. Meanwhile I'd like to get some review comments for this series. I have also plans to send device tree adaptation of the ocp2scp driver.

Developed on
http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next

If it has to be based on some other tree, please let me know.

This must be the most pointless driver I've seen in a long time. It doesn't actually do anything at all, it just creates child devices from a static lookup table.

Just put the devices you actually want into the device tree instead and have them automatically created.

Arnd

#15 lore raw

Hi Arnd,

Quoted 14 lines · Arnd Bergmann
Quoted 13 lines · Kishon Vijay Abraham I

This patch series is done as a preparatory step for adding phy drivers for dwc3 and musb.

This series adds a new driver for ocp2scp to which phy drivers are connected.

I'm planning to send phy drivers asap. Meanwhile I'd like to get some review comments for this series. I have also plans to send device tree adaptation of the ocp2scp driver.

Developed on
http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next

Quoted 8 lines
Quoted 1 line

If it has to be based on some other tree, please let me know.

This must be the most pointless driver I've seen in a long time. It doesn't actually do anything at all, it just creates child devices from a static lookup table.

Just put the devices you actually want into the device tree instead and have them automatically created.

But shouldn't device tree support and non-device tree support co-exist till the non-device tree is completely knocked out of the kernel? Even then shouldn't there be a separate driver to extract the child nodes of ocp2scp and create a device (using of_platform_populate)? As far as I've seen, the devices are automatically created (by virtue of of_platform_populate() in mach-omap2/board-generic.c in omap case) only for the devices that is connected to the system bus. For other cases, the parent should be responsible for creating the child devices.

Thanks
Kishon

maintainer
#16 lore raw
Quoted 6 lines · KISHON VIJAY
Quoted 3 lines

Just put the devices you actually want into the device tree instead and have them automatically created.

But shouldn't device tree support and non-device tree support co-exist till the non-device tree is completely knocked out of the kernel? Even

Well, it's a new driver, so there is no regression in supporting it only on DT-enabled boards. OMAP5 is DT-only anyway and OMAP4 only supports two boards that should both be working with the generic DT code already.

Quoted 7 lines

then shouldn't there be a separate driver to extract the child nodes of ocp2scp and create a device (using of_platform_populate)? As far as I've seen, the devices are automatically created (by virtue of of_platform_populate() in mach-omap2/board-generic.c in omap case) only for the devices that is connected to the system bus. For other cases, the parent should be responsible for creating the child devices.

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

Arnd

#17 lore raw

Hi Arnd,

Quoted 20 lines · Arnd Bergmann
Quoted 6 lines · KISHON VIJAY
Quoted 3 lines

Just put the devices you actually want into the device tree instead and have them automatically created.

But shouldn't device tree support and non-device tree support co-exist till the non-device tree is completely knocked out of the kernel? Even

Well, it's a new driver, so there is no regression in supporting it only on DT-enabled boards. OMAP5 is DT-only anyway and OMAP4 only supports two boards that should both be working with the generic DT code already.

Quoted 7 lines

then shouldn't there be a separate driver to extract the child nodes of ocp2scp and create a device (using of_platform_populate)? As far as I've seen, the devices are automatically created (by virtue of of_platform_populate() in ?mach-omap2/board-generic.c in omap case) only for the devices that is connected to the system bus. For other cases, the parent should be responsible for creating the child devices.

Quoted 2 lines

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

hmm.. ocp2scp has a sysconfig register and it also has a module mode by which it can be enabled/disabled. I was making use of pm_runtime API's to control these registers (Apart from creating child devices, the driver also has a call to pm_runtime_enable). I'm not sure if with "simple-bus" we'll be able to do those. I have to check on that.

Thanks
Kishon

maintainer
#18 lore raw
Quoted 7 lines · KISHON VIJAY
Quoted 2 lines

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

hmm.. ocp2scp has a sysconfig register and it also has a module mode by which it can be enabled/disabled. I was making use of pm_runtime API's to control these registers (Apart from creating child devices, the driver also has a call to pm_runtime_enable).

I see.

Quoted 2 lines

I'm not sure if with
"simple-bus" we'll be able to do those. I have to check on that.

How about making it compatible with both "simple-bus" and something that handles the pm_runtime requirements?

I don't understand enough of what needs to be done for pm_runtime across a lot of devices, but I'd hope that it should be possible to do that in a generic way based on the device definition.

Arnd

#19 lore raw

Hi Kevin, Benoit, Paul,

Quoted 14 lines · Arnd Bergmann
Quoted 7 lines · KISHON VIJAY
Quoted 2 lines

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

hmm.. ocp2scp has a sysconfig register and it also has a module mode by which it can be enabled/disabled. I was making use of pm_runtime API's to control these registers (Apart from creating child devices, the driver also has a call to pm_runtime_enable).

I see.

Quoted 2 lines

I'm not sure if with
"simple-bus" we'll be able to do those. I have to check on that.

Quoted 6 lines

How about making it compatible with both "simple-bus" and something that handles the pm_runtime requirements?

I don't understand enough of what needs to be done for pm_runtime across a lot of devices, but I'd hope that it should be possible to do that in a generic way based on the device definition.

Is there already exists a generic way for handling pm_runtime requirements (as simple as doing a pm_runtime_enable on a device).

So the actual problem is we have ocp2scp as parent and usb2phy and usb3phy as the child device. ocp2scp has the sysconfig register and it can be controlled using module mode bit (both of this can be controlled by pm_runtime). Whenever usb controller(dwc3/musb) wants to enable a phy, it calls an exported API in usb2/usb3 phy to enable it. These API's have pm_runtime_get_sync on usb2/usb3 device which in-turn calls pm_runtime_get_sync of ocp2scp because of parent->child relationship (For this both usb2/usb3 phy and ocp2scp devices should have called pm_runtime_enable). All I'm trying is to find a place to have pm_runtime_enable for ocp2scp.

Thanks
Kishon

#20 lore raw
Quoted 20 lines · KISHON VIJAY

Hi Kevin, Benoit, Paul,

Quoted 17 lines · Arnd Bergmann
Quoted 7 lines · KISHON VIJAY
Quoted 2 lines

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

hmm.. ocp2scp has a sysconfig register and it also has a module mode by which it can be enabled/disabled. I was making use of pm_runtime API's to control these registers (Apart from creating child devices, the driver also has a call to pm_runtime_enable).

I see.

Quoted 2 lines

I'm not sure if with
"simple-bus" we'll be able to do those. I have to check on that.

How about making it compatible with both "simple-bus" and something that handles the pm_runtime requirements?

Quoted 6 lines
Quoted 3 lines

I don't understand enough of what needs to be done for pm_runtime across a lot of devices, but I'd hope that it should be possible to do that in a generic way based on the device definition.

Is there already exists a generic way for handling pm_runtime requirements (as simple as doing a pm_runtime_enable on a device).

As you've discovered, the runtime PM core handles the parent/child relationships already.

Quoted 10 lines

So the actual problem is we have ocp2scp as parent and usb2phy and usb3phy as the child device. ocp2scp has the sysconfig register and it can be controlled using module mode bit (both of this can be controlled by pm_runtime). Whenever usb controller(dwc3/musb) wants to enable a phy, it calls an exported API in usb2/usb3 phy to enable it. These API's have pm_runtime_get_sync on usb2/usb3 device which in-turn calls pm_runtime_get_sync of ocp2scp because of parent->child relationship (For this both usb2/usb3 phy and ocp2scp devices should have called pm_runtime_enable). All I'm trying is to find a place to have pm_runtime_enable for ocp2scp.

Maybe I'm not following, but why can't it be in the driver?

Kevin

#21 lore raw

Hi Kevin,

Quoted 43 lines · Kevin Hilman
Quoted 20 lines · KISHON VIJAY

Hi Kevin, Benoit, Paul,

Quoted 17 lines · Arnd Bergmann
Quoted 7 lines · KISHON VIJAY
Quoted 2 lines

I would mark the multiplexed device compatible with "simple-bus", which results in the child devices automatically getting added.

hmm.. ocp2scp has a sysconfig register and it also has a module mode by which it can be enabled/disabled. I was making use of pm_runtime API's to control these registers (Apart from creating child devices, the driver also has a call to pm_runtime_enable).

I see.

Quoted 2 lines

I'm not sure if with
"simple-bus" we'll be able to do those. I have to check on that.

How about making it compatible with both "simple-bus" and something that handles the pm_runtime requirements?

Quoted 6 lines
Quoted 3 lines

I don't understand enough of what needs to be done for pm_runtime across a lot of devices, but I'd hope that it should be possible to do that in a generic way based on the device definition.

Is there already exists a generic way for handling pm_runtime requirements (as simple as doing a pm_runtime_enable on a device).

As you've discovered, the runtime PM core handles the parent/child relationships already.

Quoted 10 lines

So the actual problem is we have ocp2scp as parent and usb2phy and usb3phy as the child device. ocp2scp has the sysconfig register and it can be controlled using module mode bit (both of this can be controlled by pm_runtime). Whenever usb controller(dwc3/musb) wants to enable a phy, it calls an exported API in usb2/usb3 phy to enable it. These API's have pm_runtime_get_sync on usb2/usb3 device which in-turn calls pm_runtime_get_sync of ocp2scp because of parent->child relationship (For this both usb2/usb3 phy and ocp2scp devices should have called pm_runtime_enable). All I'm trying is to find a place to have pm_runtime_enable for ocp2scp.

Quoted 1 line

Maybe I'm not following, but why can't it be in the driver?

Arnd feels it is pointless to have a driver that only does creation of child (and pm_runtime_enable of the device). He feels it would be better to have a generic way to do a runtime_enable of a device with dt. (Just like how there is a generic way to create child devices by giving .compatible as "simple-bus").

Thanks
Kishon

maintainer
#22 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 6 lines · KISHON VIJAY
Quoted 3 lines

Just put the devices you actually want into the device tree instead and have them automatically created.

But shouldn't device tree support and non-device tree support co-exist till the non-device tree is completely knocked out of the kernel? Even

Well, it's a new driver, so there is no regression in supporting it only on DT-enabled boards. OMAP5 is DT-only anyway and OMAP4 only supports two boards that should both be working with the generic DT code already.

I agree, let's keep the new omap4/5 drivers DT only.

Regards,

Tony