2019-01-10 13:38:38

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 1/4] Documentation: dt: Add binding info for jz4740-musb driver

This commit adds documentation for the device-tree bindings of the
jz4740-musb driver, which provides support for the USB gadget mode
of the JZ4740 and similar SoCs from Ingenic.

Signed-off-by: Paul Cercueil <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---

v2: No change

.../bindings/usb/ingenic,jz4740-musb.txt | 24 ++++++++++++++++++++++
1 file changed, 24 insertions(+)
create mode 100644 Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt

diff --git a/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
new file mode 100644
index 000000000000..620355cee63f
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ingenic,jz4740-musb.txt
@@ -0,0 +1,24 @@
+Ingenic JZ4740 MUSB driver
+
+Required properties:
+
+- compatible: Must be "ingenic,jz4740-musb"
+- reg: Address range of the UDC register set
+- interrupts: IRQ number related to the UDC hardware
+- interrupt-names: must be "mc"
+- clocks: phandle to the "udc" clock
+- clock-names: must be "udc"
+
+Example:
+
+udc: usb@13040000 {
+ compatible = "ingenic,jz4740-musb";
+ reg = <0x13040000 0x10000>;
+
+ interrupt-parent = <&intc>;
+ interrupts = <24>;
+ interrupt-names = "mc";
+
+ clocks = <&cgu JZ4740_CLK_UDC>;
+ clock-names = "udc";
+};
--
2.11.0



2019-01-10 13:38:38

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 2/4] usb: musb: jz4740: Add support for devicetree

Add support for probing the driver from devicetree.

Signed-off-by: Paul Cercueil <[email protected]>
---

v2: Add MODULE_DEVICE_TABLE and wrap inside CONFIG_OF

drivers/usb/musb/jz4740.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/drivers/usb/musb/jz4740.c b/drivers/usb/musb/jz4740.c
index 04d8b2bc205a..a60627bf7be3 100644
--- a/drivers/usb/musb/jz4740.c
+++ b/drivers/usb/musb/jz4740.c
@@ -10,6 +10,7 @@
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/usb/usb_phy_generic.h>

@@ -188,11 +189,20 @@ static int jz4740_remove(struct platform_device *pdev)
return 0;
}

+#ifdef CONFIG_OF
+static const struct of_device_id jz4740_musb_of_match[] = {
+ { .compatible = "ingenic,jz4740-musb" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, jz4740_musb_of_match);
+#endif
+
static struct platform_driver jz4740_driver = {
.probe = jz4740_probe,
.remove = jz4740_remove,
.driver = {
.name = "musb-jz4740",
+ .of_match_table = of_match_ptr(jz4740_musb_of_match),
},
};

--
2.11.0


2019-01-10 13:38:51

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 4/4] usb: musb: Kconfig: Drop dependency on CONFIG_USB for jz4740

The Kconfig entry previously depended on USB_OTG_BLACKLIST_HUB
unconditionally, which is an option that is only available when
CONFIG_USB is enabled. However, the USB IP in the JZ4740 SoC does not
support host mode, only gadget mode, so it makes sense to allow it to
build when CONFIG_USB is not set.

Signed-off-by: Paul Cercueil <[email protected]>
---

v2: Instead of removing the dependency on USB_OTG_BLACKLIST_HUB, we now
depend on (USB=n || USB_OTG_BLACKLIST_HUB)

drivers/usb/musb/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index 6f5b0ed6a507..fda7691bf173 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -113,7 +113,7 @@ config USB_MUSB_JZ4740
depends on NOP_USB_XCEIV
depends on MIPS || COMPILE_TEST
depends on USB_MUSB_GADGET
- depends on USB_OTG_BLACKLIST_HUB
+ depends on USB=n || USB_OTG_BLACKLIST_HUB

config USB_MUSB_AM335X_CHILD
tristate
--
2.11.0


2019-01-10 13:53:40

by Paul Cercueil

[permalink] [raw]
Subject: [PATCH v2 3/4] usb: musb: Kconfig: Drop dependency on MACH_JZ4740 for jz4740

Depending on MACH_INGENIC prevent us from creating a generic kernel that
works on more than one MIPS board. Instead, we just depend on MIPS being
set.

Signed-off-by: Paul Cercueil <[email protected]>
---

v2: Remove info about adding COMPILE_TEST in commit message, as it was
there before

drivers/usb/musb/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index ad08895e78f9..6f5b0ed6a507 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -111,7 +111,7 @@ config USB_MUSB_UX500
config USB_MUSB_JZ4740
tristate "JZ4740"
depends on NOP_USB_XCEIV
- depends on MACH_JZ4740 || COMPILE_TEST
+ depends on MIPS || COMPILE_TEST
depends on USB_MUSB_GADGET
depends on USB_OTG_BLACKLIST_HUB

--
2.11.0


2019-01-15 18:38:19

by Bin Liu

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] usb: musb: Kconfig: Drop dependency on MACH_JZ4740 for jz4740

Hi Paul,

On Thu, Jan 10, 2019 at 10:36:59AM -0300, Paul Cercueil wrote:
> Depending on MACH_INGENIC prevent us from creating a generic kernel that

Again, did you mean MACH_JZ4740 instead?

> works on more than one MIPS board. Instead, we just depend on MIPS being
> set.
>
> Signed-off-by: Paul Cercueil <[email protected]>
> ---
>
> v2: Remove info about adding COMPILE_TEST in commit message, as it was
> there before
>
> drivers/usb/musb/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
> index ad08895e78f9..6f5b0ed6a507 100644
> --- a/drivers/usb/musb/Kconfig
> +++ b/drivers/usb/musb/Kconfig
> @@ -111,7 +111,7 @@ config USB_MUSB_UX500
> config USB_MUSB_JZ4740
> tristate "JZ4740"
> depends on NOP_USB_XCEIV
> - depends on MACH_JZ4740 || COMPILE_TEST
> + depends on MIPS || COMPILE_TEST
> depends on USB_MUSB_GADGET
> depends on USB_OTG_BLACKLIST_HUB

Regards,
-Bin.

2019-01-17 22:35:29

by Paul Cercueil

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] usb: musb: Kconfig: Drop dependency on MACH_JZ4740 for jz4740

Hi,

On Tue, Jan 15, 2019 at 1:26 PM, Bin Liu <[email protected]> wrote:
> Hi Paul,
>
> On Thu, Jan 10, 2019 at 10:36:59AM -0300, Paul Cercueil wrote:
>> Depending on MACH_INGENIC prevent us from creating a generic kernel
>> that
>
> Again, did you mean MACH_JZ4740 instead?

Dammit. I'm sorry. Will send a v3 right now.

>> works on more than one MIPS board. Instead, we just depend on MIPS
>> being
>> set.
>>
>> Signed-off-by: Paul Cercueil <[email protected]
>> <mailto:[email protected]>>
>> ---
>>
>> v2: Remove info about adding COMPILE_TEST in commit message, as it
>> was
>> there before
>>
>> drivers/usb/musb/Kconfig | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
>> index ad08895e78f9..6f5b0ed6a507 100644
>> --- a/drivers/usb/musb/Kconfig
>> +++ b/drivers/usb/musb/Kconfig
>> @@ -111,7 +111,7 @@ config USB_MUSB_UX500
>> config USB_MUSB_JZ4740
>> tristate "JZ4740"
>> depends on NOP_USB_XCEIV
>> - depends on MACH_JZ4740 || COMPILE_TEST
>> + depends on MIPS || COMPILE_TEST
>> depends on USB_MUSB_GADGET
>> depends on USB_OTG_BLACKLIST_HUB
>
> Regards,
> -Bin.