Commit 97238b35 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Felipe Balbi

usb: musb: dsps: use proper child nodes

This moves the two instances from the big node into two child nodes. The
glue layer ontop does almost nothing.

There is one devices containing the control module for USB (2) phy,
(2) usb and later the dma engine. The usb device is the "glue device"
which contains the musb device as a child. This is what we do ever since.

The new file musb_am335x is just here to prob the new bus and populate
child devices.

There are a lot of changes to the dsps file as a result of the changes:

- musb_core_offset
  This is gone. The device tree provides memory ressources information
  for the device there is no need to "fix" things

- instances
  This is gone as well. If we have two instances then we have have two
  child enabled nodes in the device tree. For instance the SoC in beagle
  bone has two USB instances but only one has been wired up so there is
  no need to load and init the second instance since it won't be used.

- dsps_glue is now per glue device
  In the past there was one of this structs but with an array of two and
  each instance accessed its variable depending on the platform device
  id.

- no unneeded copy of structs
  I do not know why struct dsps_musb_wrapper is copied but it is not
  necessary. The same goes for musb_hdrc_platform_data which allocated
  on demand and then again by platform_device_add_data(). One copy is
  enough.
Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent e96bdc3d
...@@ -120,6 +120,22 @@ uart0: serial@44e09000 { ...@@ -120,6 +120,22 @@ uart0: serial@44e09000 {
status = "okay"; status = "okay";
}; };
musb: usb@47400000 {
status = "okay";
control@44e10000 {
status = "okay";
};
phy@47401300 {
status = "okay";
};
usb@47401000 {
status = "okay";
};
};
i2c0: i2c@44e0b000 { i2c0: i2c@44e0b000 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&i2c0_pins>; pinctrl-0 = <&i2c0_pins>;
......
...@@ -171,6 +171,30 @@ tps: tps@2d { ...@@ -171,6 +171,30 @@ tps: tps@2d {
}; };
}; };
musb: usb@47400000 {
status = "okay";
control@44e10000 {
status = "okay";
};
phy@47401300 {
status = "okay";
};
phy@47401b00 {
status = "okay";
};
usb@47401000 {
status = "okay";
};
usb@47401800 {
status = "okay";
};
};
i2c1: i2c@4802a000 { i2c1: i2c@4802a000 {
pinctrl-names = "default"; pinctrl-names = "default";
pinctrl-0 = <&i2c1_pins>; pinctrl-0 = <&i2c1_pins>;
......
...@@ -207,6 +207,22 @@ lis331dlh: lis331dlh@18 { ...@@ -207,6 +207,22 @@ lis331dlh: lis331dlh@18 {
}; };
}; };
musb: usb@47400000 {
status = "okay";
control@44e10000 {
status = "okay";
};
phy@47401300 {
status = "okay";
};
usb@47401000 {
status = "okay";
};
};
epwmss2: epwmss@48304000 { epwmss2: epwmss@48304000 {
status = "okay"; status = "okay";
......
...@@ -26,6 +26,10 @@ aliases { ...@@ -26,6 +26,10 @@ aliases {
serial5 = &uart5; serial5 = &uart5;
d_can0 = &dcan0; d_can0 = &dcan0;
d_can1 = &dcan1; d_can1 = &dcan1;
usb0 = &usb0;
usb1 = &usb1;
phy0 = &usb0_phy;
phy1 = &usb1_phy;
}; };
cpus { cpus {
...@@ -333,21 +337,86 @@ spi1: spi@481a0000 { ...@@ -333,21 +337,86 @@ spi1: spi@481a0000 {
status = "disabled"; status = "disabled";
}; };
usb@47400000 { usb: usb@47400000 {
compatible = "ti,musb-am33xx"; compatible = "ti,am33xx-usb";
reg = <0x47400000 0x1000 /* usbss */ reg = <0x47400000 0x1000>;
0x47401000 0x800 /* musb instance 0 */ ranges;
0x47401800 0x800>; /* musb instance 1 */ #address-cells = <1>;
interrupts = <17 /* usbss */ #size-cells = <1>;
18 /* musb instance 0 */
19>; /* musb instance 1 */
multipoint = <1>;
num-eps = <16>;
ram-bits = <12>;
port0-mode = <3>;
port1-mode = <3>;
power = <250>;
ti,hwmods = "usb_otg_hs"; ti,hwmods = "usb_otg_hs";
status = "disabled";
ctrl_mod: control@44e10000 {
compatible = "ti,am335x-usb-ctrl-module";
reg = <0x44e10620 0x10
0x44e10648 0x4>;
reg-names = "phy_ctrl", "wakeup";
status = "disabled";
};
usb0_phy: phy@47401300 {
compatible = "ti,am335x-usb-phy";
reg = <0x47401300 0x100>;
reg-names = "phy";
status = "disabled";
ti,ctrl_mod = <&ctrl_mod>;
};
usb0: usb@47401000 {
compatible = "ti,musb-am33xx";
ranges;
#address-cells = <1>;
#size-cells = <1>;
reg = <0x47401000 0x200>;
reg-names = "control";
status = "disabled";
musb0: usb@47401400 {
compatible = "mg,musbmhdrc";
reg = <0x47401400 0x400>;
reg-names = "mc";
interrupts = <18>;
interrupt-names = "mc";
multipoint = <1>;
num-eps = <16>;
ram-bits = <12>;
port-mode = <3>;
power = <250>;
phys = <&usb0_phy>;
};
};
usb1_phy: phy@47401b00 {
compatible = "ti,am335x-usb-phy";
reg = <0x47401b00 0x100>;
reg-names = "phy";
status = "disabled";
ti,ctrl_mod = <&ctrl_mod>;
};
usb1: usb@47401800 {
compatible = "ti,musb-am33xx";
ranges;
#address-cells = <1>;
#size-cells = <1>;
reg = <0x47401800 0x200>;
reg-names = "control";
status = "disabled";
musb1: usb@47401c00 {
compatible = "mg,musbmhdrc";
reg = <0x47401c00 0x400>;
reg-names = "mc";
interrupts = <19>;
interrupt-names = "mc";
multipoint = <1>;
num-eps = <16>;
ram-bits = <12>;
port-mode = <3>;
power = <250>;
phys = <&usb1_phy>;
};
};
}; };
epwmss0: epwmss@48300000 { epwmss0: epwmss@48300000 {
......
...@@ -83,6 +83,7 @@ config USB_MUSB_AM35X ...@@ -83,6 +83,7 @@ config USB_MUSB_AM35X
config USB_MUSB_DSPS config USB_MUSB_DSPS
tristate "TI DSPS platforms" tristate "TI DSPS platforms"
select USB_MUSB_AM335X_CHILD
config USB_MUSB_BLACKFIN config USB_MUSB_BLACKFIN
tristate "Blackfin" tristate "Blackfin"
...@@ -93,6 +94,9 @@ config USB_MUSB_UX500 ...@@ -93,6 +94,9 @@ config USB_MUSB_UX500
endchoice endchoice
config USB_MUSB_AM335X_CHILD
tristate
choice choice
prompt 'MUSB DMA mode' prompt 'MUSB DMA mode'
default MUSB_PIO_ONLY if ARCH_MULTIPLATFORM default MUSB_PIO_ONLY if ARCH_MULTIPLATFORM
......
...@@ -20,6 +20,9 @@ obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o ...@@ -20,6 +20,9 @@ obj-$(CONFIG_USB_MUSB_DA8XX) += da8xx.o
obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o obj-$(CONFIG_USB_MUSB_BLACKFIN) += blackfin.o
obj-$(CONFIG_USB_MUSB_UX500) += ux500.o obj-$(CONFIG_USB_MUSB_UX500) += ux500.o
obj-$(CONFIG_USB_MUSB_AM335X_CHILD) += musb_am335x.o
# the kconfig must guarantee that only one of the # the kconfig must guarantee that only one of the
# possible I/O schemes will be enabled at a time ... # possible I/O schemes will be enabled at a time ...
# PIO only, or DMA (several potential schemes). # PIO only, or DMA (several potential schemes).
......
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/module.h>
#include <linux/of_platform.h>
static int am335x_child_probe(struct platform_device *pdev)
{
int ret;
pm_runtime_enable(&pdev->dev);
ret = of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
if (ret)
goto err;
return 0;
err:
pm_runtime_disable(&pdev->dev);
return ret;
}
static int of_remove_populated_child(struct device *dev, void *d)
{
struct platform_device *pdev = to_platform_device(dev);
of_device_unregister(pdev);
return 0;
}
static int am335x_child_remove(struct platform_device *pdev)
{
device_for_each_child(&pdev->dev, NULL, of_remove_populated_child);
pm_runtime_disable(&pdev->dev);
return 0;
}
static const struct of_device_id am335x_child_of_match[] = {
{ .compatible = "ti,am33xx-usb" },
{ },
};
MODULE_DEVICE_TABLE(of, am335x_child_of_match);
static struct platform_driver am335x_child_driver = {
.probe = am335x_child_probe,
.remove = am335x_child_remove,
.driver = {
.name = "am335x-usb-childs",
.of_match_table = of_match_ptr(am335x_child_of_match),
},
};
module_platform_driver(am335x_child_driver);
MODULE_DESCRIPTION("AM33xx child devices");
MODULE_LICENSE("GPL v2");
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment