Browse Source

usb: musb: omap2430: Don't use omap_get_control_dev()

omap_get_control_dev() is being deprecated as it doesn't support
multiple instances. As control device is present only from OMAP4
onwards which supports DT only, we use phandles to get the
reference to the control device.

Also get rid of "ti,has-mailbox" property as it is redundant and
we can determine that from whether "ctrl-module" property is present
or not. Get rid of has_mailbox from musb_hdrc_platform_data as well.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Roger Quadros 12 năm trước cách đây
mục cha
commit
8934d3e4d0

+ 0 - 4
Documentation/devicetree/bindings/usb/omap-usb.txt

@@ -3,9 +3,6 @@ OMAP GLUE AND OTHER OMAP SPECIFIC COMPONENTS
 OMAP MUSB GLUE
 OMAP MUSB GLUE
  - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
  - compatible : Should be "ti,omap4-musb" or "ti,omap3-musb"
  - ti,hwmods : must be "usb_otg_hs"
  - ti,hwmods : must be "usb_otg_hs"
- - ti,has-mailbox : to specify that omap uses an external mailbox
-   (in control module) to communicate with the musb core during device connect
-   and disconnect.
  - multipoint : Should be "1" indicating the musb controller supports
  - multipoint : Should be "1" indicating the musb controller supports
    multipoint. This is a MUSB configuration-specific setting.
    multipoint. This is a MUSB configuration-specific setting.
  - num-eps : Specifies the number of endpoints. This is also a
  - num-eps : Specifies the number of endpoints. This is also a
@@ -31,7 +28,6 @@ SOC specific device node entry
 usb_otg_hs: usb_otg_hs@4a0ab000 {
 usb_otg_hs: usb_otg_hs@4a0ab000 {
 	compatible = "ti,omap4-musb";
 	compatible = "ti,omap4-musb";
 	ti,hwmods = "usb_otg_hs";
 	ti,hwmods = "usb_otg_hs";
-	ti,has-mailbox;
 	multipoint = <1>;
 	multipoint = <1>;
 	num-eps = <16>;
 	num-eps = <16>;
 	ram-bits = <12>;
 	ram-bits = <12>;

+ 14 - 11
drivers/usb/musb/omap2430.c

@@ -38,6 +38,7 @@
 #include <linux/delay.h>
 #include <linux/delay.h>
 #include <linux/usb/musb-omap.h>
 #include <linux/usb/musb-omap.h>
 #include <linux/usb/omap_control_usb.h>
 #include <linux/usb/omap_control_usb.h>
+#include <linux/of_platform.h>
 
 
 #include "musb_core.h"
 #include "musb_core.h"
 #include "omap2430.h"
 #include "omap2430.h"
@@ -524,8 +525,12 @@ static int omap2430_probe(struct platform_device *pdev)
 	glue->dev			= &pdev->dev;
 	glue->dev			= &pdev->dev;
 	glue->musb			= musb;
 	glue->musb			= musb;
 	glue->status			= OMAP_MUSB_UNKNOWN;
 	glue->status			= OMAP_MUSB_UNKNOWN;
+	glue->control_otghs = ERR_PTR(-ENODEV);
 
 
 	if (np) {
 	if (np) {
+		struct device_node *control_node;
+		struct platform_device *control_pdev;
+
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata) {
 		if (!pdata) {
 			dev_err(&pdev->dev,
 			dev_err(&pdev->dev,
@@ -554,22 +559,20 @@ static int omap2430_probe(struct platform_device *pdev)
 		of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
 		config->multipoint = of_property_read_bool(np, "multipoint");
 		config->multipoint = of_property_read_bool(np, "multipoint");
-		pdata->has_mailbox = of_property_read_bool(np,
-		    "ti,has-mailbox");
 
 
 		pdata->board_data	= data;
 		pdata->board_data	= data;
 		pdata->config		= config;
 		pdata->config		= config;
-	}
 
 
-	if (pdata->has_mailbox) {
-		glue->control_otghs = omap_get_control_dev();
-		if (IS_ERR(glue->control_otghs)) {
-			dev_vdbg(&pdev->dev, "Failed to get control device\n");
-			ret = PTR_ERR(glue->control_otghs);
-			goto err2;
+		control_node = of_parse_phandle(np, "ctrl-module", 0);
+		if (control_node) {
+			control_pdev = of_find_device_by_node(control_node);
+			if (!control_pdev) {
+				dev_err(&pdev->dev, "Failed to get control device\n");
+				ret = -EINVAL;
+				goto err2;
+			}
+			glue->control_otghs = &control_pdev->dev;
 		}
 		}
-	} else {
-		glue->control_otghs = ERR_PTR(-ENODEV);
 	}
 	}
 	pdata->platform_ops		= &omap2430_ops;
 	pdata->platform_ops		= &omap2430_ops;
 
 

+ 0 - 2
include/linux/usb/musb.h

@@ -99,8 +99,6 @@ struct musb_hdrc_platform_data {
 	/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
 	/* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
 	u8		mode;
 	u8		mode;
 
 
-	u8		has_mailbox:1;
-
 	/* for clk_get() */
 	/* for clk_get() */
 	const char	*clock;
 	const char	*clock;