2012-05-30 10:56:58

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [RFC PATCH 0/5] 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

--
1.7.5.4


2012-05-30 10:57:09

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [RFC PATCH 5/5] arm: omap: ocp2scp: create omap device for ocp2scp

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

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
arch/arm/mach-omap2/devices.c | 72 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index ae62ece..d87cf40 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -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;
}
--
1.7.5.4

2012-05-30 10:57:13

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [RFC PATCH 4/5] ARM: OMAP4: add _dev_attr_ to ocp2scp for representing usb_phy

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

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
Cc: Benoit Cousson <[email protected]>
---
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 249ff76..b5a91e8 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -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),
};
--
1.7.5.4

2012-05-30 10:57:16

by Kishon Vijay Abraham I

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

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.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
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

diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 2661f6e..c70aa15 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -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"
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
index 456972f..4d7c8ce 100644
--- a/drivers/misc/Makefile
+++ b/drivers/misc/Makefile
@@ -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/
diff --git a/drivers/misc/omap-ocp2scp.c b/drivers/misc/omap-ocp2scp.c
new file mode 100644
index 0000000..c53b9f4
--- /dev/null
+++ b/drivers/misc/omap-ocp2scp.c
@@ -0,0 +1,135 @@
+/*
+ * omap-ocp2scp.c - transform ocp interface protocol to scp protocol
+ *
+ * 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.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/err.h>
+#include <linux/pm_runtime.h>
+#include <linux/platform_data/omap_ocp2scp.h>
+
+/**
+ * _count_resources - count for the number of resources
+ * @res: struct resource *
+ *
+ * Count and return the number of resources populated for the device that is
+ * connected to ocp2scp.
+ */
+static unsigned _count_resources(struct resource *res)
+{
+ int cnt = 0;
+
+ while (res->start != res->end) {
+ cnt++;
+ res++;
+ }
+
+ return cnt;
+}
+
+static int ocp2scp_remove_devices(struct device *dev, void *c)
+{
+ struct platform_device *pdev = to_platform_device(dev);
+
+ platform_device_unregister(pdev);
+
+ return 0;
+}
+
+static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
+{
+ int ret;
+ unsigned res_cnt, i;
+ struct platform_device *pdev_child;
+ struct omap_ocp2scp_platform_data *pdata;
+ struct omap_ocp2scp_dev *dev;
+
+ pdata = pdev->dev.platform_data;
+ if (!pdata) {
+ dev_err(&pdev->dev, "OCP2SCP initialized without plat data\n");
+ return -EINVAL;
+ }
+
+ for (i = 0, dev = *pdata->devices; i < pdata->dev_cnt; i++, dev++) {
+ res_cnt = _count_resources(dev->res);
+
+ pdev_child = platform_device_alloc(dev->drv_name, -1);
+ if (!pdev_child) {
+ dev_err(&pdev->dev, "failed to allocate memory for ocp2scp child\n");
+ return -ENOMEM;
+ }
+
+ ret = platform_device_add_resources(pdev_child, dev->res,
+ res_cnt);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to add resources for ocp2scp child\n");
+ goto err0;
+ }
+
+ pdev_child->dev.parent = &pdev->dev;
+
+ ret = platform_device_add(pdev_child);
+ if (ret) {
+ dev_err(&pdev->dev, "failed to register ocp2scp child device\n");
+ goto err0;
+ }
+ }
+
+ pm_runtime_enable(&pdev->dev);
+
+ return 0;
+
+err0:
+ platform_device_put(pdev_child);
+ device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
+
+ return ret;
+}
+
+static int __devexit omap_ocp2scp_remove(struct platform_device *pdev)
+{
+ pm_runtime_disable(&pdev->dev);
+ device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
+
+ return 0;
+}
+
+static struct platform_driver omap_ocp2scp_driver = {
+ .probe = omap_ocp2scp_probe,
+ .remove = __devexit_p(omap_ocp2scp_remove),
+ .driver = {
+ .name = "omap-ocp2scp",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init omap_ocp2scp_init(void)
+{
+ return platform_driver_register(&omap_ocp2scp_driver);
+}
+arch_initcall(omap_ocp2scp_init);
+
+static void __exit omap_ocp2scp_exit(void)
+{
+ platform_driver_unregister(&omap_ocp2scp_driver);
+}
+module_exit(omap_ocp2scp_exit);
+
+MODULE_ALIAS("platform: omap-ocp2scp");
+MODULE_AUTHOR("Kishon Vijay Abraham I <[email protected]>");
+MODULE_DESCRIPTION("OMAP OCP2SCP DRIVER");
+MODULE_LICENSE("GPL");
diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
new file mode 100644
index 0000000..dcbbf2a
--- /dev/null
+++ b/include/linux/platform_data/omap_ocp2scp.h
@@ -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 */
--
1.7.5.4

2012-05-30 10:56:57

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [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.

Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 950454a..249ff76 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -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

2012-05-30 10:58:17

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: [RFC PATCH 2/5] arm: omap: remove ocp2scp_usb_phy_ick clock node

"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.

Cc: Benoit Cousson <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
---
arch/arm/mach-omap2/clock44xx_data.c | 11 -----------
1 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
index 2172f66..3e2cccf 100644
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -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),
--
1.7.5.4

2012-05-30 14:48:26

by Santosh Shilimkar

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

On Wed, May 30, 2012 at 4:26 PM, Kishon Vijay Abraham I <[email protected]> wrote:
> 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.
>
> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
> ---


> ?arch/arm/mach-omap2/omap_hwmod_44xx_data.c | ? ?1 +
> ?1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index 950454a..249ff76 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -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
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> 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

2012-05-30 14:52:19

by Santosh Shilimkar

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

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.
>
> Cc: Benoit Cousson <[email protected]>
> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
> ---
> ?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

2012-05-30 14:55:29

by Santosh Shilimkar

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

On Wed, May 30, 2012 at 4:26 PM, Kishon Vijay Abraham I <[email protected]> wrote:
> 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.
>
> Signed-off-by: Kishon Vijay Abraham I <[email protected]>
> ---
[...]

> +++ b/drivers/misc/omap-ocp2scp.c
> @@ -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

[...]

> diff --git a/include/linux/platform_data/omap_ocp2scp.h b/include/linux/platform_data/omap_ocp2scp.h
> new file mode 100644
> index 0000000..dcbbf2a
> --- /dev/null
> +++ b/include/linux/platform_data/omap_ocp2scp.h
> @@ -0,0 +1,31 @@
> +/*
> + * omap_ocp2scp.h -- ocp2scp header file
> + *
> + * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com
Dito.

2012-05-30 15:24:12

by Benoit Cousson

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

On 5/30/2012 4:51 PM, Shilimkar, Santosh wrote:
> 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.
>>
>> Cc: Benoit Cousson<[email protected]>
>> Signed-off-by: Kishon Vijay Abraham I<[email protected]>
>> ---
>> 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

2012-05-30 18:44:28

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

On Wednesday 30 May 2012, Kishon Vijay Abraham I wrote:
>
> 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.

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

2012-05-31 08:14:09

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

Hi Arnd,

On Thu, May 31, 2012 at 12:13 AM, Arnd Bergmann <[email protected]> wrote:
> On Wednesday 30 May 2012, Kishon Vijay Abraham I wrote:
>>
>> 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.
>
> 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

2012-05-31 09:22:43

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
> >
> > 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.

> 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

2012-05-31 11:18:43

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

Hi Arnd,

On Thu, May 31, 2012 at 2:52 PM, Arnd Bergmann <[email protected]> wrote:
> On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
>> >
>> > 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.
>
>> 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.

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

2012-05-31 20:47:22

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
> > 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.

> 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

2012-06-01 10:58:09

by Tony Lindgren

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

* Arnd Bergmann <[email protected]> [120531 02:26]:
> On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
> > >
> > > 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

2012-06-01 12:53:04

by Kishon Vijay Abraham I

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

Hi Benoit,

On Wed, May 30, 2012 at 8:53 PM, Cousson, Benoit <[email protected]> wrote:
> On 5/30/2012 4:51 PM, Shilimkar, Santosh wrote:
>>
>> 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.
>>>
>>> Cc: Benoit Cousson<[email protected]>
>>> Signed-off-by: Kishon Vijay Abraham I<[email protected]>
>>> ---
>>> ?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.

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

2012-06-01 13:24:40

by Benoit Cousson

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

On 6/1/2012 2:52 PM, ABRAHAM, KISHON VIJAY wrote:
> Hi Benoit,
>
> On Wed, May 30, 2012 at 8:53 PM, Cousson, Benoit<[email protected]> wrote:
>> On 5/30/2012 4:51 PM, Shilimkar, Santosh wrote:
>>>
>>> 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.
>>>>
>>>> Cc: Benoit Cousson<[email protected]>
>>>> Signed-off-by: Kishon Vijay Abraham I<[email protected]>
>>>> ---
>>>> 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.
>
> 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

2012-06-01 15:54:48

by Kishon Vijay Abraham I

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

On Fri, Jun 1, 2012 at 6:54 PM, Cousson, Benoit <[email protected]> wrote:
> On 6/1/2012 2:52 PM, ABRAHAM, KISHON VIJAY wrote:
>>
>> Hi Benoit,
>>
>> On Wed, May 30, 2012 at 8:53 PM, Cousson, Benoit<[email protected]> ?wrote:
>>>
>>> On 5/30/2012 4:51 PM, Shilimkar, Santosh wrote:
>>>>
>>>>
>>>> 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.
>>>>>
>>>>> Cc: Benoit Cousson<[email protected]>
>>>>> Signed-off-by: Kishon Vijay Abraham I<[email protected]>
>>>>> ---
>>>>> ?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.
>>
>>
>> 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

2012-06-06 15:10:57

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

Hi Kevin, Benoit, Paul,

On Fri, Jun 1, 2012 at 2:16 AM, Arnd Bergmann <[email protected]> wrote:
> On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
>> > 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.
>
>> 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.

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

2012-06-12 17:07:40

by Kevin Hilman

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

"ABRAHAM, KISHON VIJAY" <[email protected]> writes:

> Hi Kevin, Benoit, Paul,
>
> On Fri, Jun 1, 2012 at 2:16 AM, Arnd Bergmann <[email protected]> wrote:
>> On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
>>> > 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.
>>
>>> 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.
>
> 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.

> 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

2012-06-18 09:34:49

by Kishon Vijay Abraham I

[permalink] [raw]
Subject: Re: [RFC PATCH 0/5] omap: add ocp2scp as a misc driver

Hi Kevin,

On Tue, Jun 12, 2012 at 10:37 PM, Kevin Hilman <[email protected]> wrote:
> "ABRAHAM, KISHON VIJAY" <[email protected]> writes:
>
>> Hi Kevin, Benoit, Paul,
>>
>> On Fri, Jun 1, 2012 at 2:16 AM, Arnd Bergmann <[email protected]> wrote:
>>> On Thursday 31 May 2012, ABRAHAM, KISHON VIJAY wrote:
>>>> > 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.
>>>
>>>> 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.
>>
>> 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.
>
>> 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?

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