linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board
@ 2020-09-09 16:04 Neil Armstrong
  2020-09-09 16:04 ` [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode Neil Armstrong
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Neil Armstrong @ 2020-09-09 16:04 UTC (permalink / raw)
  To: khilman, kishon, balbi, martin.blumenstingl
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong,
	linux-usb

The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.

It needs the same init sequence as GXL & GXM, but it seems it doesn't need
the host disconnect bit.

The Glue driver reuses the already implemented GXL & GXM work.

The USB2 PHY driver needs a slight tweak to keep the OTG detection working.

Neil Armstrong (5):
  phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode
  dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG
    Families USB Glue Bindings
  usb: dwc-meson-g12a: Add support for USB on AXG SoCs
  arm64: dts: meson-axg: add USB nodes
  arm64: dts: meson-axg-s400: enable USB OTG

 .../usb/amlogic,meson-g12a-usb-ctrl.yaml      | 22 +++++++-
 .../arm64/boot/dts/amlogic/meson-axg-s400.dts | 10 ++++
 arch/arm64/boot/dts/amlogic/meson-axg.dtsi    | 51 +++++++++++++++++++
 drivers/phy/amlogic/phy-meson-gxl-usb2.c      |  3 +-
 drivers/usb/dwc3/dwc3-meson-g12a.c            | 17 +++++++
 5 files changed, 101 insertions(+), 2 deletions(-)

-- 
2.22.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode
  2020-09-09 16:04 [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Neil Armstrong
@ 2020-09-09 16:04 ` Neil Armstrong
  2020-09-15 19:53   ` Martin Blumenstingl
  2020-09-09 16:04 ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings Neil Armstrong
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Neil Armstrong @ 2020-09-09 16:04 UTC (permalink / raw)
  To: khilman, kishon, martin.blumenstingl
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong,
	linux-usb

In order to keep OTG ID detection even when in Host mode, the ID line of
the PHY (if the current phy is an OTG one) pull-up should be kept
enable in both modes.

This fixes OTG switch on GXL, GXM & AXG platforms, otherwise once switched
to Host, the ID detection doesn't work anymore to switch back to Device.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/phy/amlogic/phy-meson-gxl-usb2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/amlogic/phy-meson-gxl-usb2.c b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
index 43ec9bf24abf..6e862ea60d8f 100644
--- a/drivers/phy/amlogic/phy-meson-gxl-usb2.c
+++ b/drivers/phy/amlogic/phy-meson-gxl-usb2.c
@@ -158,7 +158,8 @@ static int phy_meson_gxl_usb2_set_mode(struct phy *phy,
 				   U2P_R0_DM_PULLDOWN);
 		regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_DP_PULLDOWN,
 				   U2P_R0_DP_PULLDOWN);
-		regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_ID_PULLUP, 0);
+		regmap_update_bits(priv->regmap, U2P_R0, U2P_R0_ID_PULLUP,
+				   U2P_R0_ID_PULLUP);
 		break;
 
 	case PHY_MODE_USB_DEVICE:
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings
  2020-09-09 16:04 [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Neil Armstrong
  2020-09-09 16:04 ` [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode Neil Armstrong
@ 2020-09-09 16:04 ` Neil Armstrong
  2020-09-15 17:32   ` [PATCH 2/5] dt-bindings: usb: amlogic, meson-g12a-usb-ctrl: " Rob Herring
  2020-09-15 19:56   ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: " Martin Blumenstingl
  2020-09-09 16:04 ` [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs Neil Armstrong
  2020-09-14 17:57 ` [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Kevin Hilman
  3 siblings, 2 replies; 10+ messages in thread
From: Neil Armstrong @ 2020-09-09 16:04 UTC (permalink / raw)
  To: khilman, martin.blumenstingl, devicetree
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong,
	linux-usb

The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 .../usb/amlogic,meson-g12a-usb-ctrl.yaml      | 22 ++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml b/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
index 5b04a7dfa018..c0058332b967 100644
--- a/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
+++ b/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
@@ -25,13 +25,14 @@ description: |
   The Amlogic A1 embeds a DWC3 USB IP Core configured for USB2 in
   host-only mode.
 
-  The Amlogic GXL & GXM SoCs doesn't embed an USB3 PHY.
+  The Amlogic GXL, GXM & AXG SoCs doesn't embed an USB3 PHY.
 
 properties:
   compatible:
     enum:
       - amlogic,meson-gxl-usb-ctrl
       - amlogic,meson-gxm-usb-ctrl
+      - amlogic,meson-axg-usb-ctrl
       - amlogic,meson-g12a-usb-ctrl
       - amlogic,meson-a1-usb-ctrl
 
@@ -151,6 +152,25 @@ allOf:
 
       required:
         - clock-names
+  - if:
+      properties:
+        compatible:
+          enum:
+            - amlogic,meson-axg-usb-ctrl
+
+    then:
+      properties:
+        phy-names:
+          items:
+            - const: usb2-phy1 # USB2 PHY1 if USBOTG_B port is used
+        clocks:
+          minItems: 2
+        clock-names:
+          items:
+            - const: usb_ctrl
+            - const: ddr
+      required:
+        - clock-names
   - if:
       properties:
         compatible:
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs
  2020-09-09 16:04 [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Neil Armstrong
  2020-09-09 16:04 ` [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode Neil Armstrong
  2020-09-09 16:04 ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings Neil Armstrong
@ 2020-09-09 16:04 ` Neil Armstrong
  2020-09-15 19:59   ` Martin Blumenstingl
  2020-09-14 17:57 ` [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Kevin Hilman
  3 siblings, 1 reply; 10+ messages in thread
From: Neil Armstrong @ 2020-09-09 16:04 UTC (permalink / raw)
  To: khilman, balbi, martin.blumenstingl
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong,
	linux-usb

The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.

It needs the same init sequence as GXL & GXM, but it seems it doesn't need
the host disconnect bit.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/usb/dwc3/dwc3-meson-g12a.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index 1f7f4d88ed9d..90275c13c224 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -215,6 +215,19 @@ static struct dwc3_meson_g12a_drvdata gxm_drvdata = {
 	.usb_post_init = dwc3_meson_gxl_usb_post_init,
 };
 
+static struct dwc3_meson_g12a_drvdata axg_drvdata = {
+	.otg_switch_supported = true,
+	.clks = meson_gxl_clocks,
+	.num_clks = ARRAY_SIZE(meson_gxl_clocks),
+	.phy_names = meson_a1_phy_names,
+	.num_phys = ARRAY_SIZE(meson_a1_phy_names),
+	.setup_regmaps = dwc3_meson_gxl_setup_regmaps,
+	.usb2_init_phy = dwc3_meson_gxl_usb2_init_phy,
+	.set_phy_mode = dwc3_meson_gxl_set_phy_mode,
+	.usb_init = dwc3_meson_g12a_usb_init,
+	.usb_post_init = dwc3_meson_gxl_usb_post_init,
+};
+
 static struct dwc3_meson_g12a_drvdata g12a_drvdata = {
 	.otg_switch_supported = true,
 	.clks = meson_g12a_clocks,
@@ -930,6 +943,10 @@ static const struct of_device_id dwc3_meson_g12a_match[] = {
 		.compatible = "amlogic,meson-gxm-usb-ctrl",
 		.data = &gxm_drvdata,
 	},
+	{
+		.compatible = "amlogic,meson-axg-usb-ctrl",
+		.data = &axg_drvdata,
+	},
 	{
 		.compatible = "amlogic,meson-g12a-usb-ctrl",
 		.data = &g12a_drvdata,
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board
  2020-09-09 16:04 [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Neil Armstrong
                   ` (2 preceding siblings ...)
  2020-09-09 16:04 ` [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs Neil Armstrong
@ 2020-09-14 17:57 ` Kevin Hilman
  3 siblings, 0 replies; 10+ messages in thread
From: Kevin Hilman @ 2020-09-14 17:57 UTC (permalink / raw)
  To: Neil Armstrong, kishon, balbi, martin.blumenstingl
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong,
	linux-usb

Neil Armstrong <narmstrong@baylibre.com> writes:

> The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.

minor grammar nit: s/close from/close to/  (also in patches 2 & 3).
Otherwise..

Reviewed-by: Kevin Hilman <khilman@baylibre.com>

Kevin



> It needs the same init sequence as GXL & GXM, but it seems it doesn't need
> the host disconnect bit.
>
> The Glue driver reuses the already implemented GXL & GXM work.
>
> The USB2 PHY driver needs a slight tweak to keep the OTG detection working.
>
> Neil Armstrong (5):
>   phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode
>   dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG
>     Families USB Glue Bindings
>   usb: dwc-meson-g12a: Add support for USB on AXG SoCs
>   arm64: dts: meson-axg: add USB nodes
>   arm64: dts: meson-axg-s400: enable USB OTG
>
>  .../usb/amlogic,meson-g12a-usb-ctrl.yaml      | 22 +++++++-
>  .../arm64/boot/dts/amlogic/meson-axg-s400.dts | 10 ++++
>  arch/arm64/boot/dts/amlogic/meson-axg.dtsi    | 51 +++++++++++++++++++
>  drivers/phy/amlogic/phy-meson-gxl-usb2.c      |  3 +-
>  drivers/usb/dwc3/dwc3-meson-g12a.c            | 17 +++++++
>  5 files changed, 101 insertions(+), 2 deletions(-)
>
> -- 
> 2.22.0

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] dt-bindings: usb: amlogic, meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings
  2020-09-09 16:04 ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings Neil Armstrong
@ 2020-09-15 17:32   ` Rob Herring
  2020-09-15 19:56   ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: " Martin Blumenstingl
  1 sibling, 0 replies; 10+ messages in thread
From: Rob Herring @ 2020-09-15 17:32 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: martin.blumenstingl, linux-arm-kernel, devicetree, linux-amlogic,
	linux-kernel, linux-usb, khilman

On Wed, 09 Sep 2020 18:04:06 +0200, Neil Armstrong wrote:
> The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  .../usb/amlogic,meson-g12a-usb-ctrl.yaml      | 22 ++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode
  2020-09-09 16:04 ` [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode Neil Armstrong
@ 2020-09-15 19:53   ` Martin Blumenstingl
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Blumenstingl @ 2020-09-15 19:53 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: khilman, kishon, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-usb

On Wed, Sep 9, 2020 at 6:04 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> In order to keep OTG ID detection even when in Host mode, the ID line of
> the PHY (if the current phy is an OTG one) pull-up should be kept
> enable in both modes.
>
> This fixes OTG switch on GXL, GXM & AXG platforms, otherwise once switched
> to Host, the ID detection doesn't work anymore to switch back to Device.
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings
  2020-09-09 16:04 ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings Neil Armstrong
  2020-09-15 17:32   ` [PATCH 2/5] dt-bindings: usb: amlogic, meson-g12a-usb-ctrl: " Rob Herring
@ 2020-09-15 19:56   ` Martin Blumenstingl
  1 sibling, 0 replies; 10+ messages in thread
From: Martin Blumenstingl @ 2020-09-15 19:56 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: khilman, devicetree, linux-amlogic, linux-arm-kernel,
	linux-kernel, linux-usb

Hi Neil

On Wed, Sep 9, 2020 at 6:04 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.
nit-pick: I think this should be "close to"

> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>

> ---
>  .../usb/amlogic,meson-g12a-usb-ctrl.yaml      | 22 ++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml b/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
> index 5b04a7dfa018..c0058332b967 100644
> --- a/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
> +++ b/Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
> @@ -25,13 +25,14 @@ description: |
>    The Amlogic A1 embeds a DWC3 USB IP Core configured for USB2 in
>    host-only mode.
>
> -  The Amlogic GXL & GXM SoCs doesn't embed an USB3 PHY.
> +  The Amlogic GXL, GXM & AXG SoCs doesn't embed an USB3 PHY.
nit-pick: not sure if we need to fix it here: s/doesn't/don't/
(personally I would also put AXG first - in reality it changes nothing though)


Best regards,
Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs
  2020-09-09 16:04 ` [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs Neil Armstrong
@ 2020-09-15 19:59   ` Martin Blumenstingl
  2020-09-16  7:11     ` Neil Armstrong
  0 siblings, 1 reply; 10+ messages in thread
From: Martin Blumenstingl @ 2020-09-15 19:59 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: khilman, balbi, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-usb

Hi Neil,

On Wed, Sep 9, 2020 at 6:04 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>
> The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.
s/close from/close to/

[...]
> +static struct dwc3_meson_g12a_drvdata axg_drvdata = {
> +       .otg_switch_supported = true,
> +       .clks = meson_gxl_clocks,
> +       .num_clks = ARRAY_SIZE(meson_gxl_clocks),
> +       .phy_names = meson_a1_phy_names,
> +       .num_phys = ARRAY_SIZE(meson_a1_phy_names),
I wonder if we should also update the comment for meson_a1_phy_names
to understand that part I had to go back to the dt-bindings patch


Best regards,
Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs
  2020-09-15 19:59   ` Martin Blumenstingl
@ 2020-09-16  7:11     ` Neil Armstrong
  0 siblings, 0 replies; 10+ messages in thread
From: Neil Armstrong @ 2020-09-16  7:11 UTC (permalink / raw)
  To: Martin Blumenstingl
  Cc: khilman, balbi, linux-amlogic, linux-arm-kernel, linux-kernel,
	linux-usb

On 15/09/2020 21:59, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Wed, Sep 9, 2020 at 6:04 PM Neil Armstrong <narmstrong@baylibre.com> wrote:
>>
>> The Amlogic AXG is close from the GXL Glue but with a single OTG PHY.
> s/close from/close to/
> 
> [...]
>> +static struct dwc3_meson_g12a_drvdata axg_drvdata = {
>> +       .otg_switch_supported = true,
>> +       .clks = meson_gxl_clocks,
>> +       .num_clks = ARRAY_SIZE(meson_gxl_clocks),
>> +       .phy_names = meson_a1_phy_names,
>> +       .num_phys = ARRAY_SIZE(meson_a1_phy_names),
> I wonder if we should also update the comment for meson_a1_phy_names
> to understand that part I had to go back to the dt-bindings patch
Sure,

Thanks,
Neil

> 
> 
> Best regards,
> Martin
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-09-16  7:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-09 16:04 [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Neil Armstrong
2020-09-09 16:04 ` [PATCH 1/5] phy: amlogic: phy-meson-gxl-usb2: keep ID pull-up even in Host mode Neil Armstrong
2020-09-15 19:53   ` Martin Blumenstingl
2020-09-09 16:04 ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: add the Amlogic AXG Families USB Glue Bindings Neil Armstrong
2020-09-15 17:32   ` [PATCH 2/5] dt-bindings: usb: amlogic, meson-g12a-usb-ctrl: " Rob Herring
2020-09-15 19:56   ` [PATCH 2/5] dt-bindings: usb: amlogic,meson-g12a-usb-ctrl: " Martin Blumenstingl
2020-09-09 16:04 ` [PATCH 3/5] usb: dwc-meson-g12a: Add support for USB on AXG SoCs Neil Armstrong
2020-09-15 19:59   ` Martin Blumenstingl
2020-09-16  7:11     ` Neil Armstrong
2020-09-14 17:57 ` [PATCH 0/5] usb: dwc-meson-g12a: Add support for USB on S400 board Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).