Skip to contentSkip to conversation

usb: ChipIdea: add Nuvoton NPCM UDC support

PATCH Superseded Tomer Maimon 2 participants 7 messages Oct 3, 2023 – Oct 5, 2023

Subsystems (4)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore

Tomer Maimon

author maintainer
#0 lore raw

v4 cover usb: ChipIdea: add Nuvoton NPCM UDC support

This patch set add USB device controller for the NPCM Baseboard Management Controllers (BMC).

NPCM UDC driver is a part of the USB ChipIdea driver.

Adding CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag to modify the vbus_active parameter to active in case the ChipIdea USB IP role is device-only and there is no otgsc register.

BMC NPCM7XX and BMC NPCM8XX has ten identical NPCM UDC modules,

The NPCM UDC were tested on NPCM845 evaluation board.

Changes since version 3:
- Add Acked-by Peter Chen.

Changes since version 2:
- Use dev_err_probe.
- Remove MODULE_ALIAS.

Changes since version 1:
- Add SoC specific compatible.
- Remove USB phy mux property from dt-binding, will be handled differently.
- Add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS commit to this patch set.

Tomer Maimon (3):
usb: chipidea: add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag
dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible
usb: chipidea: Add support for NPCM

 .../devicetree/bindings/usb/ci-hdrc-usb2.yaml |   4 +
 drivers/usb/chipidea/Kconfig                  |   4 +
 drivers/usb/chipidea/Makefile                 |   1 +
 drivers/usb/chipidea/ci_hdrc_npcm.c           | 114 ++++++++++++++++++
 drivers/usb/chipidea/otg.c                    |   5 +-
 include/linux/usb/chipidea.h                  |   1 +
 6 files changed, 128 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/chipidea/ci_hdrc_npcm.c
Signature · 1 line
2.33.0
author maintainer
#1 lore raw

PATCH v4 1/3 usb: chipidea: add CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag

Adding CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS flag to modify the vbus_active parameter to active in case the ChipIdea USB IP role is device-only and there is no otgsc register.

---
 drivers/usb/chipidea/otg.c   | 5 ++++-
 include/linux/usb/chipidea.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/usb/chipidea/otg.c +4 -1
index f5490f2a5b6b..647e98f4e351 100644
@@ -130,8 +130,11 @@ enum ci_role ci_otg_role(struct ci_hdrc *ci)
 
 void ci_handle_vbus_change(struct ci_hdrc *ci)
 {
-	if (!ci->is_otg)
+	if (!ci->is_otg) {
+		if (ci->platdata->flags & CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS)
+			usb_gadget_vbus_connect(&ci->gadget);
 		return;
+	}
 
 	if (hw_read_otgsc(ci, OTGSC_BSV) && !ci->vbus_active)
 		usb_gadget_vbus_connect(&ci->gadget);
include/linux/usb/chipidea.h +1 -0
index 0b4f2d5faa08..5a7f96684ea2 100644
@@ -64,6 +64,7 @@ struct ci_hdrc_platform_data {
 #define CI_HDRC_PMQOS			BIT(15)
 #define CI_HDRC_PHY_VBUS_CONTROL	BIT(16)
 #define CI_HDRC_HAS_PORTSC_PEC_MISSED	BIT(17)
+#define CI_HDRC_FORCE_VBUS_ACTIVE_ALWAYS	BIT(18)
 	enum usb_dr_mode	dr_mode;
 #define CI_HDRC_CONTROLLER_RESET_EVENT		0
 #define CI_HDRC_CONTROLLER_STOPPED_EVENT	1
Signature · 1 line
2.33.0
author maintainer
#2 lore raw

PATCH v4 2/3 dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible

In reply to Tomer Maimon

Add a compatible string for Nuvoton BMC NPCM750 and Nuvoton BMC NPCM845.

---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +4 -0
index 1394557517b1..a9e173432002 100644
@@ -16,6 +16,8 @@ properties:
       - enum:
           - chipidea,usb2
           - lsi,zevio-usb
+          - nuvoton,npcm750-udc
+          - nuvoton,npcm845-udc
           - nvidia,tegra20-ehci
           - nvidia,tegra20-udc
           - nvidia,tegra30-ehci
@@ -388,6 +390,8 @@ allOf:
             enum:
               - chipidea,usb2
               - lsi,zevio-usb
+              - nuvoton,npcm750-udc
+              - nuvoton,npcm845-udc
               - nvidia,tegra20-udc
               - nvidia,tegra30-udc
               - nvidia,tegra114-udc
Signature · 1 line
2.33.0
#3 lore raw

Re: [PATCH v4 2/3] dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible

Quoted 12 lines · Tomer Maimon

Add a compatible string for Nuvoton BMC NPCM750 and Nuvoton BMC NPCM845.

---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +0 -0
index 1394557517b1..a9e173432002 100644

Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml properties: · line 20

Quoted 5 lines
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +2 -0
@@ -16,6 +16,8 @@ properties:
       - enum:
           - chipidea,usb2
           - lsi,zevio-usb
+          - nuvoton,npcm750-udc
+          - nuvoton,npcm845-udc

Your driver clearly suggests these are compatible. If they are not, why commit msg does no explain anything here?

Best regards,
Krzysztof

author maintainer
#4 lore raw

Re: [PATCH v4 2/3] dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible

Hi Krzysztof,

Thanks for your comment

Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Tomer Maimon

Add a compatible string for Nuvoton BMC NPCM750 and Nuvoton BMC NPCM845.

---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 13 lines

Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml properties: · line 20

Quoted 10 lines
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +2 -0
index 1394557517b1..a9e173432002 100644
@@ -16,6 +16,8 @@ properties:
       - enum:
           - chipidea,usb2
           - lsi,zevio-usb
+          - nuvoton,npcm750-udc
+          - nuvoton,npcm845-udc

Your driver clearly suggests these are compatible. If they are not, why commit msg does no explain anything here?

Do you mean to add nuvoton,npcmxxx-udc as described below to the end of the compatible property?
- items:
- enum:
- nuvoton,npcm845-udc
- const: nuvoton,npcm750-udc

Quoted 4 lines

Best regards,
Krzysztof

Best regards,

Tomer

#5 lore raw

Re: [PATCH v4 2/3] dt-bindings: usb: ci-hdrc-usb2: add npcm750 and npcm845 compatible

Quoted 28 lines · Tomer Maimon

Hi Krzysztof,

Thanks for your comment

Quoted 9 lines · Krzysztof Kozlowski
Quoted 7 lines · Tomer Maimon

Add a compatible string for Nuvoton BMC NPCM750 and Nuvoton BMC NPCM845.

---
 Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 4 ++++
 1 file changed, 4 insertions(+)
Quoted 13 lines

Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml properties: · line 20

Quoted 10 lines
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml +2 -0
index 1394557517b1..a9e173432002 100644
@@ -16,6 +16,8 @@ properties:
       - enum:
           - chipidea,usb2
           - lsi,zevio-usb
+          - nuvoton,npcm750-udc
+          - nuvoton,npcm845-udc

Your driver clearly suggests these are compatible. If they are not, why commit msg does no explain anything here?

Quoted 6 lines

Do you mean to add nuvoton,npcmxxx-udc as described below to the end of the compatible property?
- items:
- enum:
- nuvoton,npcm845-udc
- const: nuvoton,npcm750-udc

For the 845 yes. Of course you also need enum entry for 750.

Best regards,
Krzysztof

author maintainer
#6 lore raw

PATCH v4 3/3 usb: chipidea: Add support for NPCM

In reply to Tomer Maimon

Add Nuvoton NPCM BMC SoCs support to USB ChipIdea driver. NPCM SoC include ChipIdea IP block that used for USB device controller mode.

---
 drivers/usb/chipidea/Kconfig        |   4 +
 drivers/usb/chipidea/Makefile       |   1 +
 drivers/usb/chipidea/ci_hdrc_npcm.c | 114 ++++++++++++++++++++++++++++
 3 files changed, 119 insertions(+)
 create mode 100644 drivers/usb/chipidea/ci_hdrc_npcm.c
drivers/usb/chipidea/Kconfig +4 -0
index c815824a0b2d..bab45bc62361 100644
@@ -43,6 +43,10 @@ config USB_CHIPIDEA_MSM
 	tristate "Enable MSM hsusb glue driver" if EXPERT
 	default USB_CHIPIDEA
 
+config USB_CHIPIDEA_NPCM
+	tristate "Enable NPCM hsusb glue driver" if EXPERT
+	default USB_CHIPIDEA
+
 config USB_CHIPIDEA_IMX
 	tristate "Enable i.MX USB glue driver" if EXPERT
 	depends on OF
drivers/usb/chipidea/Makefile +1 -0
index 71afeab97e83..718cb24603dd 100644
@@ -13,6 +13,7 @@ ci_hdrc-$(CONFIG_USB_OTG_FSM)		+= otg_fsm.o
 
 obj-$(CONFIG_USB_CHIPIDEA_GENERIC)	+= ci_hdrc_usb2.o
 obj-$(CONFIG_USB_CHIPIDEA_MSM)		+= ci_hdrc_msm.o
+obj-$(CONFIG_USB_CHIPIDEA_NPCM)		+= ci_hdrc_npcm.o
 obj-$(CONFIG_USB_CHIPIDEA_PCI)		+= ci_hdrc_pci.o
 obj-$(CONFIG_USB_CHIPIDEA_IMX)		+= usbmisc_imx.o ci_hdrc_imx.o
 obj-$(CONFIG_USB_CHIPIDEA_TEGRA)	+= ci_hdrc_tegra.o
drivers/usb/chipidea/ci_hdrc_npcm.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
2.33.0