* [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
2012-09-11 9:09 [PATCH v2 0/3] omap: musb: Add device tree support Kishon Vijay Abraham I
@ 2012-09-11 9:09 ` Kishon Vijay Abraham I
2012-09-11 9:13 ` Benoit Cousson
2012-09-11 9:09 ` [PATCH v2 2/3] usb: musb: omap: write directly to mailbox instead of using phy Kishon Vijay Abraham I
2012-09-11 9:09 ` [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue Kishon Vijay Abraham I
2 siblings, 1 reply; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-09-11 9:09 UTC (permalink / raw)
To: balbi, kishon, grant.likely, rob.herring, rob, linux, gregkh,
b-cousson, rnayak, tony, devicetree-discuss, linux-doc,
linux-kernel, linux-arm-kernel, linux-omap, linux-usb
The mailbox register for usb otg in omap is present in control module.
On detection of any events VBUS or ID, this register should be written
to send the notification to musb core.
Till we have a separate control module driver to write to control module,
omap2430 will handle the register writes to control module by itself. So
a new address space to represent this control module register is added
to usb_otg_hs.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 242aee4..3c19120 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5890,6 +5890,12 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
.pa_end = 0x4a0ab003,
.flags = ADDR_TYPE_RT
},
+ {
+ /* XXX: Remove this once control module driver is in place */
+ .pa_start = 0x4a00233c,
+ .pa_end = 0x4a00233f,
+ .flags = ADDR_TYPE_RT
+ },
{ }
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module
2012-09-11 9:09 ` [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module Kishon Vijay Abraham I
@ 2012-09-11 9:13 ` Benoit Cousson
0 siblings, 0 replies; 9+ messages in thread
From: Benoit Cousson @ 2012-09-11 9:13 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: balbi, grant.likely, rob.herring, rob, linux, gregkh, rnayak,
tony, devicetree-discuss, linux-doc, linux-kernel,
linux-arm-kernel, linux-omap, linux-usb
On 09/11/2012 11:09 AM, Kishon Vijay Abraham I wrote:
> The mailbox register for usb otg in omap is present in control module.
> On detection of any events VBUS or ID, this register should be written
> to send the notification to musb core.
>
> Till we have a separate control module driver to write to control module,
> omap2430 will handle the register writes to control module by itself. So
> a new address space to represent this control module register is added
> to usb_otg_hs.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Acked-by: Benoit Cousson <b-cousson@ti.com>
> ---
> arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> index 242aee4..3c19120 100644
> --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
> @@ -5890,6 +5890,12 @@ static struct omap_hwmod_addr_space omap44xx_usb_otg_hs_addrs[] = {
> .pa_end = 0x4a0ab003,
> .flags = ADDR_TYPE_RT
> },
> + {
> + /* XXX: Remove this once control module driver is in place */
> + .pa_start = 0x4a00233c,
> + .pa_end = 0x4a00233f,
> + .flags = ADDR_TYPE_RT
> + },
> { }
> };
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/3] usb: musb: omap: write directly to mailbox instead of using phy
2012-09-11 9:09 [PATCH v2 0/3] omap: musb: Add device tree support Kishon Vijay Abraham I
2012-09-11 9:09 ` [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module Kishon Vijay Abraham I
@ 2012-09-11 9:09 ` Kishon Vijay Abraham I
2012-09-11 9:09 ` [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue Kishon Vijay Abraham I
2 siblings, 0 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-09-11 9:09 UTC (permalink / raw)
To: balbi, kishon, grant.likely, rob.herring, rob, linux, gregkh,
b-cousson, rnayak, tony, devicetree-discuss, linux-doc,
linux-kernel, linux-arm-kernel, linux-omap, linux-usb
The glue layer should directly write to mailbox register (present in
control module) instead of calling phy layer to write to mailbox
register. Writing to mailbox register notifies the core of events like
device connect/disconnect.
Currently writing to control module register is taken care in this
driver which will be removed once the control module driver is in place.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/usb/musb/omap2430.c | 52 +++++++++++++++++++++++++++++++++++++------
drivers/usb/musb/omap2430.h | 9 ++++++++
2 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 02c39a7..f4d9503 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -45,6 +45,7 @@ struct omap2430_glue {
struct platform_device *musb;
enum omap_musb_vbus_id_status status;
struct work_struct omap_musb_mailbox_work;
+ u32 __iomem *control_otghs;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
@@ -52,6 +53,26 @@ struct omap2430_glue *_glue;
static struct timer_list musb_idle_timer;
+/**
+ * omap4_usb_phy_mailbox - write to usb otg mailbox
+ * @glue: struct omap2430_glue *
+ * @val: the value to be written to the mailbox
+ *
+ * On detection of a device (ID pin is grounded), this API should be called
+ * to set AVALID, VBUSVALID and ID pin is grounded.
+ *
+ * When OMAP is connected to a host (OMAP in device mode), this API
+ * is called to set AVALID, VBUSVALID and ID pin in high impedance.
+ *
+ * XXX: This function will be removed once we have a seperate driver for
+ * control module
+ */
+static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
+{
+ if (glue->control_otghs)
+ writel(val, glue->control_otghs);
+}
+
static void musb_do_idle(unsigned long _musb)
{
struct musb *musb = (void *)_musb;
@@ -247,6 +268,7 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
static void omap_musb_set_mailbox(struct omap2430_glue *glue)
{
+ u32 val;
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb->controller;
struct musb_hdrc_platform_data *pdata = dev->platform_data;
@@ -262,7 +284,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
musb->xceiv->last_event = USB_EVENT_ID;
if (musb->gadget_driver) {
pm_runtime_get_sync(dev);
- usb_phy_init(musb->xceiv);
+ val = AVALID | VBUSVALID;
+ omap4_usb_phy_mailbox(glue, val);
omap2430_musb_set_vbus(musb, 1);
}
break;
@@ -275,7 +298,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
musb->xceiv->last_event = USB_EVENT_VBUS;
if (musb->gadget_driver)
pm_runtime_get_sync(dev);
- usb_phy_init(musb->xceiv);
+ val = IDDIG | AVALID | VBUSVALID;
+ omap4_usb_phy_mailbox(glue, val);
break;
case OMAP_MUSB_ID_FLOAT:
@@ -292,7 +316,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue *glue)
if (musb->xceiv->otg->set_vbus)
otg_set_vbus(musb->xceiv->otg, 0);
}
- usb_phy_shutdown(musb->xceiv);
+ val = SESSEND | IDDIG;
+ omap4_usb_phy_mailbox(glue, val);
break;
default:
dev_dbg(dev, "ID float\n");
@@ -367,6 +392,7 @@ err1:
static void omap2430_musb_enable(struct musb *musb)
{
u8 devctl;
+ u32 val;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb->controller;
struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
@@ -376,7 +402,8 @@ static void omap2430_musb_enable(struct musb *musb)
switch (glue->status) {
case OMAP_MUSB_ID_GROUND:
- usb_phy_init(musb->xceiv);
+ val = AVALID | VBUSVALID;
+ omap4_usb_phy_mailbox(glue, val);
if (data->interface_type != MUSB_INTERFACE_UTMI)
break;
devctl = musb_readb(musb->mregs, MUSB_DEVCTL);
@@ -395,7 +422,8 @@ static void omap2430_musb_enable(struct musb *musb)
break;
case OMAP_MUSB_VBUS_VALID:
- usb_phy_init(musb->xceiv);
+ val = IDDIG | AVALID | VBUSVALID;
+ omap4_usb_phy_mailbox(glue, val);
break;
default:
@@ -405,11 +433,14 @@ static void omap2430_musb_enable(struct musb *musb)
static void omap2430_musb_disable(struct musb *musb)
{
+ u32 val;
struct device *dev = musb->controller;
struct omap2430_glue *glue = dev_get_drvdata(dev->parent);
- if (glue->status != OMAP_MUSB_UNKNOWN)
- usb_phy_shutdown(musb->xceiv);
+ if (glue->status != OMAP_MUSB_UNKNOWN) {
+ val = SESSEND | IDDIG;
+ omap4_usb_phy_mailbox(glue, val);
+ }
}
static int omap2430_musb_exit(struct musb *musb)
@@ -441,6 +472,7 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
struct platform_device *musb;
struct omap2430_glue *glue;
+ struct resource *res;
int ret = -ENOMEM;
glue = devm_kzalloc(&pdev->dev, sizeof(*glue), GFP_KERNEL);
@@ -463,6 +495,12 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
glue->musb = musb;
glue->status = OMAP_MUSB_UNKNOWN;
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+
+ glue->control_otghs = devm_request_and_ioremap(&pdev->dev, res);
+ if (glue->control_otghs == NULL)
+ dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
+
pdata->platform_ops = &omap2430_ops;
platform_set_drvdata(pdev, glue);
diff --git a/drivers/usb/musb/omap2430.h b/drivers/usb/musb/omap2430.h
index 40b3c02..b85f397 100644
--- a/drivers/usb/musb/omap2430.h
+++ b/drivers/usb/musb/omap2430.h
@@ -49,4 +49,13 @@
#define OTG_FORCESTDBY 0x414
# define ENABLEFORCE (1 << 0)
+/*
+ * Control Module bit definitions
+ * XXX: Will be removed once we have a driver for control module.
+ */
+#define AVALID BIT(0)
+#define BVALID BIT(1)
+#define VBUSVALID BIT(2)
+#define SESSEND BIT(3)
+#define IDDIG BIT(4)
#endif /* __MUSB_OMAP243X_H__ */
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue
2012-09-11 9:09 [PATCH v2 0/3] omap: musb: Add device tree support Kishon Vijay Abraham I
2012-09-11 9:09 ` [PATCH v2 1/3] arm: omap: hwmod: add a new addr space in otg for writing to control module Kishon Vijay Abraham I
2012-09-11 9:09 ` [PATCH v2 2/3] usb: musb: omap: write directly to mailbox instead of using phy Kishon Vijay Abraham I
@ 2012-09-11 9:09 ` Kishon Vijay Abraham I
2012-09-11 9:53 ` Vaibhav Hiremath
2013-01-08 19:32 ` Sergei Shtylyov
2 siblings, 2 replies; 9+ messages in thread
From: Kishon Vijay Abraham I @ 2012-09-11 9:09 UTC (permalink / raw)
To: balbi, kishon, grant.likely, rob.herring, rob, linux, gregkh,
b-cousson, rnayak, tony, devicetree-discuss, linux-doc,
linux-kernel, linux-arm-kernel, linux-omap, linux-usb
Added device tree support for omap musb driver and updated the
Documentation with device tree binding information.
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
Documentation/devicetree/bindings/usb/omap-usb.txt | 33 ++++++++++++
drivers/usb/musb/omap2430.c | 54 ++++++++++++++++++++
2 files changed, 87 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
new file mode 100644
index 0000000..29a043e
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -0,0 +1,33 @@
+OMAP GLUE
+
+OMAP MUSB GLUE
+ - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
+ - ti,hwmods : must be "usb_otg_hs"
+ - multipoint : Should be "1" indicating the musb controller supports
+ multipoint. This is a MUSB configuration-specific setting.
+ - num_eps : Specifies the number of endpoints. This is also a
+ MUSB configuration-specific setting. Should be set to "16"
+ - ram_bits : Specifies the ram address size. Should be set to "12"
+ - interface_type : This is a board specific setting to describe the type of
+ interface between the controller and the phy. It should be "0" or "1"
+ specifying ULPI and UTMI respectively.
+ - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
+ represents PERIPHERAL.
+ - power : Should be "50". This signifies the controller can supply upto
+ 100mA when operating in host mode.
+
+SOC specific device node entry
+usb_otg_hs: usb_otg_hs@4a0ab000 {
+ compatible = "ti,omap4-musb";
+ ti,hwmods = "usb_otg_hs";
+ multipoint = <1>;
+ num_eps = <16>;
+ ram_bits = <12>;
+};
+
+Board specific device node entry
+&usb_otg_hs {
+ interface_type = <1>;
+ mode = <3>;
+ power = <50>;
+};
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index f4d9503..d96873b 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -30,6 +30,7 @@
#include <linux/init.h>
#include <linux/list.h>
#include <linux/io.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
@@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
static int __devinit omap2430_probe(struct platform_device *pdev)
{
struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
+ struct omap_musb_board_data *data;
struct platform_device *musb;
struct omap2430_glue *glue;
+ struct device_node *np = pdev->dev.of_node;
+ struct musb_hdrc_config *config;
struct resource *res;
int ret = -ENOMEM;
@@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
if (glue->control_otghs == NULL)
dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
+ if (np) {
+ pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata) {
+ dev_err(&pdev->dev,
+ "failed to allocate musb platfrom data\n");
+ ret = -ENOMEM;
+ goto err1;
+ }
+
+ data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+ if (!data) {
+ dev_err(&pdev->dev,
+ "failed to allocate musb board data\n");
+ ret = -ENOMEM;
+ goto err1;
+ }
+
+ config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
+ if (!data) {
+ dev_err(&pdev->dev,
+ "failed to allocate musb hdrc config\n");
+ goto err1;
+ }
+
+ of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
+ of_property_read_u32(np, "interface_type",
+ (u32 *)&data->interface_type);
+ of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
+ of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
+ of_property_read_u32(np, "power", (u32 *)&pdata->power);
+ config->multipoint = of_property_read_bool(np, "multipoint");
+
+ pdata->board_data = data;
+ pdata->config = config;
+ }
+
pdata->platform_ops = &omap2430_ops;
platform_set_drvdata(pdev, glue);
@@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
#define DEV_PM_OPS NULL
#endif
+#ifdef CONFIG_OF
+static const struct of_device_id omap2430_id_table[] = {
+ {
+ .compatible = "ti,omap4-musb"
+ },
+ {
+ .compatible = "ti,omap3-musb"
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, omap2430_id_table);
+#endif
+
static struct platform_driver omap2430_driver = {
.probe = omap2430_probe,
.remove = __devexit_p(omap2430_remove),
.driver = {
.name = "musb-omap2430",
.pm = DEV_PM_OPS,
+ .of_match_table = of_match_ptr(omap2430_id_table),
},
};
--
1.7.9.5
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue
2012-09-11 9:09 ` [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue Kishon Vijay Abraham I
@ 2012-09-11 9:53 ` Vaibhav Hiremath
2012-09-11 11:24 ` ABRAHAM, KISHON VIJAY
2013-01-08 19:32 ` Sergei Shtylyov
1 sibling, 1 reply; 9+ messages in thread
From: Vaibhav Hiremath @ 2012-09-11 9:53 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: balbi, grant.likely, rob.herring, rob, linux, gregkh, b-cousson,
rnayak, tony, devicetree-discuss, linux-doc, linux-kernel,
linux-arm-kernel, linux-omap, linux-usb
On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
> Added device tree support for omap musb driver and updated the
> Documentation with device tree binding information.
>
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> ---
> Documentation/devicetree/bindings/usb/omap-usb.txt | 33 ++++++++++++
> drivers/usb/musb/omap2430.c | 54 ++++++++++++++++++++
> 2 files changed, 87 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
>
> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> new file mode 100644
> index 0000000..29a043e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> @@ -0,0 +1,33 @@
> +OMAP GLUE
> +
> +OMAP MUSB GLUE
> + - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
> + - ti,hwmods : must be "usb_otg_hs"
> + - multipoint : Should be "1" indicating the musb controller supports
> + multipoint. This is a MUSB configuration-specific setting.
> + - num_eps : Specifies the number of endpoints. This is also a
> + MUSB configuration-specific setting. Should be set to "16"
> + - ram_bits : Specifies the ram address size. Should be set to "12"
> + - interface_type : This is a board specific setting to describe the type of
> + interface between the controller and the phy. It should be "0" or "1"
> + specifying ULPI and UTMI respectively.
> + - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
> + represents PERIPHERAL.
> + - power : Should be "50". This signifies the controller can supply upto
> + 100mA when operating in host mode.
> +
> +SOC specific device node entry
> +usb_otg_hs: usb_otg_hs@4a0ab000 {
> + compatible = "ti,omap4-musb";
> + ti,hwmods = "usb_otg_hs";
> + multipoint = <1>;
> + num_eps = <16>;
> + ram_bits = <12>;
> +};
reg and interrupt properties are missing here.
I would encourage to specify "reg" and "interrupt" properties in every
node getting newly added to the OMAP DTS files.
Thanks,
Vaibhav
> +
> +Board specific device node entry
> +&usb_otg_hs {
> + interface_type = <1>;
> + mode = <3>;
> + power = <50>;
> +};
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index f4d9503..d96873b 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
> @@ -30,6 +30,7 @@
> #include <linux/init.h>
> #include <linux/list.h>
> #include <linux/io.h>
> +#include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/dma-mapping.h>
> #include <linux/pm_runtime.h>
> @@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
> static int __devinit omap2430_probe(struct platform_device *pdev)
> {
> struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
> + struct omap_musb_board_data *data;
> struct platform_device *musb;
> struct omap2430_glue *glue;
> + struct device_node *np = pdev->dev.of_node;
> + struct musb_hdrc_config *config;
> struct resource *res;
> int ret = -ENOMEM;
>
> @@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
> if (glue->control_otghs == NULL)
> dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
>
> + if (np) {
> + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + dev_err(&pdev->dev,
> + "failed to allocate musb platfrom data\n");
> + ret = -ENOMEM;
> + goto err1;
> + }
> +
> + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> + if (!data) {
> + dev_err(&pdev->dev,
> + "failed to allocate musb board data\n");
> + ret = -ENOMEM;
> + goto err1;
> + }
> +
> + config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
> + if (!data) {
> + dev_err(&pdev->dev,
> + "failed to allocate musb hdrc config\n");
> + goto err1;
> + }
> +
> + of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
> + of_property_read_u32(np, "interface_type",
> + (u32 *)&data->interface_type);
> + of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
> + of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
> + of_property_read_u32(np, "power", (u32 *)&pdata->power);
> + config->multipoint = of_property_read_bool(np, "multipoint");
> +
> + pdata->board_data = data;
> + pdata->config = config;
> + }
> +
> pdata->platform_ops = &omap2430_ops;
>
> platform_set_drvdata(pdev, glue);
> @@ -597,12 +637,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
> #define DEV_PM_OPS NULL
> #endif
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id omap2430_id_table[] = {
> + {
> + .compatible = "ti,omap4-musb"
> + },
> + {
> + .compatible = "ti,omap3-musb"
> + },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, omap2430_id_table);
> +#endif
> +
> static struct platform_driver omap2430_driver = {
> .probe = omap2430_probe,
> .remove = __devexit_p(omap2430_remove),
> .driver = {
> .name = "musb-omap2430",
> .pm = DEV_PM_OPS,
> + .of_match_table = of_match_ptr(omap2430_id_table),
> },
> };
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue
2012-09-11 9:53 ` Vaibhav Hiremath
@ 2012-09-11 11:24 ` ABRAHAM, KISHON VIJAY
2012-09-11 11:34 ` Hiremath, Vaibhav
0 siblings, 1 reply; 9+ messages in thread
From: ABRAHAM, KISHON VIJAY @ 2012-09-11 11:24 UTC (permalink / raw)
To: Vaibhav Hiremath
Cc: balbi, grant.likely, rob.herring, rob, linux, gregkh, b-cousson,
rnayak, tony, devicetree-discuss, linux-doc, linux-kernel,
linux-arm-kernel, linux-omap, linux-usb
Hi,
On Tue, Sep 11, 2012 at 3:23 PM, Vaibhav Hiremath <hvaibhav@ti.com> wrote:
>
>
> On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
>> Added device tree support for omap musb driver and updated the
>> Documentation with device tree binding information.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>> Documentation/devicetree/bindings/usb/omap-usb.txt | 33 ++++++++++++
>> drivers/usb/musb/omap2430.c | 54 ++++++++++++++++++++
>> 2 files changed, 87 insertions(+)
>> create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> new file mode 100644
>> index 0000000..29a043e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> @@ -0,0 +1,33 @@
>> +OMAP GLUE
>> +
>> +OMAP MUSB GLUE
>> + - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
>> + - ti,hwmods : must be "usb_otg_hs"
>> + - multipoint : Should be "1" indicating the musb controller supports
>> + multipoint. This is a MUSB configuration-specific setting.
>> + - num_eps : Specifies the number of endpoints. This is also a
>> + MUSB configuration-specific setting. Should be set to "16"
>> + - ram_bits : Specifies the ram address size. Should be set to "12"
>> + - interface_type : This is a board specific setting to describe the type of
>> + interface between the controller and the phy. It should be "0" or "1"
>> + specifying ULPI and UTMI respectively.
>> + - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
>> + represents PERIPHERAL.
>> + - power : Should be "50". This signifies the controller can supply upto
>> + 100mA when operating in host mode.
>> +
>> +SOC specific device node entry
>> +usb_otg_hs: usb_otg_hs@4a0ab000 {
>> + compatible = "ti,omap4-musb";
>> + ti,hwmods = "usb_otg_hs";
>> + multipoint = <1>;
>> + num_eps = <16>;
>> + ram_bits = <12>;
>> +};
>
>
> reg and interrupt properties are missing here.
>
> I would encourage to specify "reg" and "interrupt" properties in every
> node getting newly added to the OMAP DTS files.
Sure. will add that in my next version.
Thanks
Kishon
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue
2012-09-11 11:24 ` ABRAHAM, KISHON VIJAY
@ 2012-09-11 11:34 ` Hiremath, Vaibhav
0 siblings, 0 replies; 9+ messages in thread
From: Hiremath, Vaibhav @ 2012-09-11 11:34 UTC (permalink / raw)
To: ABRAHAM, KISHON VIJAY
Cc: Balbi, Felipe, grant.likely, rob.herring, rob, linux, gregkh,
Cousson, Benoit, Nayak, Rajendra, tony, devicetree-discuss,
linux-doc, linux-kernel, linux-arm-kernel, linux-omap, linux-usb
On Tue, Sep 11, 2012 at 16:54:37, ABRAHAM, KISHON VIJAY wrote:
> Hi,
>
> On Tue, Sep 11, 2012 at 3:23 PM, Vaibhav Hiremath <hvaibhav@ti.com> wrote:
> >
> >
> > On 9/11/2012 2:39 PM, Kishon Vijay Abraham I wrote:
> >> Added device tree support for omap musb driver and updated the
> >> Documentation with device tree binding information.
> >>
> >> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
> >> ---
> >> Documentation/devicetree/bindings/usb/omap-usb.txt | 33 ++++++++++++
> >> drivers/usb/musb/omap2430.c | 54 ++++++++++++++++++++
> >> 2 files changed, 87 insertions(+)
> >> create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
> >> new file mode 100644
> >> index 0000000..29a043e
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
> >> @@ -0,0 +1,33 @@
> >> +OMAP GLUE
> >> +
> >> +OMAP MUSB GLUE
> >> + - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
> >> + - ti,hwmods : must be "usb_otg_hs"
> >> + - multipoint : Should be "1" indicating the musb controller supports
> >> + multipoint. This is a MUSB configuration-specific setting.
> >> + - num_eps : Specifies the number of endpoints. This is also a
> >> + MUSB configuration-specific setting. Should be set to "16"
> >> + - ram_bits : Specifies the ram address size. Should be set to "12"
> >> + - interface_type : This is a board specific setting to describe the type of
> >> + interface between the controller and the phy. It should be "0" or "1"
> >> + specifying ULPI and UTMI respectively.
> >> + - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
> >> + represents PERIPHERAL.
> >> + - power : Should be "50". This signifies the controller can supply upto
> >> + 100mA when operating in host mode.
> >> +
> >> +SOC specific device node entry
> >> +usb_otg_hs: usb_otg_hs@4a0ab000 {
> >> + compatible = "ti,omap4-musb";
> >> + ti,hwmods = "usb_otg_hs";
> >> + multipoint = <1>;
> >> + num_eps = <16>;
> >> + ram_bits = <12>;
> >> +};
> >
> >
> > reg and interrupt properties are missing here.
> >
> > I would encourage to specify "reg" and "interrupt" properties in every
> > node getting newly added to the OMAP DTS files.
>
> Sure. will add that in my next version.
>
I saw there is some discussion going-on for which baseline to use, so make
sure that you test the patches on top of below patch (already available in
linux-omap/devel-dt)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap.git;a=commit;h=b82b04e8eb27abe0cfe9cd7bf4fee8bb1bb9b013
Thanks,
Vaibhav
> Thanks
> Kishon
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue
2012-09-11 9:09 ` [PATCH v2 3/3] usb: musb: omap: Add device tree support for omap musb glue Kishon Vijay Abraham I
2012-09-11 9:53 ` Vaibhav Hiremath
@ 2013-01-08 19:32 ` Sergei Shtylyov
1 sibling, 0 replies; 9+ messages in thread
From: Sergei Shtylyov @ 2013-01-08 19:32 UTC (permalink / raw)
To: Kishon Vijay Abraham I
Cc: balbi, grant.likely, rob.herring, rob, linux, gregkh, b-cousson,
rnayak, tony, devicetree-discuss, linux-doc, linux-kernel,
linux-arm-kernel, linux-omap, linux-usb
Hello.
On 09/11/2012 01:09 PM, Kishon Vijay Abraham I wrote:
> Added device tree support for omap musb driver and updated the
> Documentation with device tree binding information.
> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Belated comments to the patch which didn't pass my message size filter in
time. :-)
> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
> index f4d9503..d96873b 100644
> --- a/drivers/usb/musb/omap2430.c
> +++ b/drivers/usb/musb/omap2430.c
[...]
> @@ -470,8 +471,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
> static int __devinit omap2430_probe(struct platform_device *pdev)
> {
> struct musb_hdrc_platform_data *pdata = pdev->dev.platform_data;
> + struct omap_musb_board_data *data;
> struct platform_device *musb;
> struct omap2430_glue *glue;
> + struct device_node *np = pdev->dev.of_node;
> + struct musb_hdrc_config *config;
> struct resource *res;
> int ret = -ENOMEM;
>
> @@ -501,6 +505,42 @@ static int __devinit omap2430_probe(struct platform_device *pdev)
> if (glue->control_otghs == NULL)
> dev_dbg(&pdev->dev, "Failed to obtain control memory\n");
>
> + if (np) {
> + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata) {
> + dev_err(&pdev->dev,
> + "failed to allocate musb platfrom data\n");
> + ret = -ENOMEM;
'ret' is pre-initialized to -ENOMEM.
> + goto err1;
> + }
> +
> + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
> + if (!data) {
> + dev_err(&pdev->dev,
> + "failed to allocate musb board data\n");
Overindented this line.
> + ret = -ENOMEM;
Same comment about already pre-initialized variable.
> + goto err1;
> + }
> +
> + config = devm_kzalloc(&pdev->dev, sizeof(*config), GFP_KERNEL);
> + if (!data) {
You allocate 'config' but check 'data' again, so instead of exiting
gracefully we get an oops later on...
> + dev_err(&pdev->dev,
> + "failed to allocate musb hdrc config\n");
No 'ret = -ENOMEM;' here -- kinda inconsistent. :-)
> + goto err1;
> + }
> +
> + of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
> + of_property_read_u32(np, "interface_type",
> + (u32 *)&data->interface_type);
> + of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
> + of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
> + of_property_read_u32(np, "power", (u32 *)&pdata->power);
> + config->multipoint = of_property_read_bool(np, "multipoint");
> +
> + pdata->board_data = data;
> + pdata->config = config;
> + }
> +
> pdata->platform_ops = &omap2430_ops;
>
> platform_set_drvdata(pdev, glue);
Don't worry now, I've just sent two patches to address these shortcomings.
WBR, Sergei
^ permalink raw reply [flat|nested] 9+ messages in thread