* [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3
@ 2025-06-12 18:50 Dan Carpenter
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Dan Carpenter @ 2025-06-12 18:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Conor Dooley, devicetree, Fabio Estevam, imx, Krzysztof Kozlowski,
linux-arm-kernel, linux-kernel, linux-usb, Peng Fan,
Pengutronix Kernel Team, Peter Chen, Rob Herring, Sascha Hauer,
Shawn Guo, Xu Yang, s32, linaro-s32, Larisa Grigore,
Ionut Vicovan, Ghennadi Procopciuc
This patchset adds support for the s32g2 and s32g3 chips.
The changes since v1:
* Put the device tree lines in alphabetical order.
* Add imx@lists.linux.dev to the CC list.
* Use power_lost_check() instead of creating a new REINIT_DURING_RESUME
flag.
* Change the Copyright date.
* Leave the .compatible = "nxp,s32g3-usb" out of the ci_hdrc_imx.c
driver because people can just specify both in the devicetree
since they are compatible.
Ghennadi Procopciuc (3):
dt-bindings: usb: Add compatible strings for s32g2/s32g3
usb: chipidea: s32g: Add usb support for s32g2
usb: chipidea: s32g: Add usb support for s32g3
.../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 2 +
.../devicetree/bindings/usb/fsl,usbmisc.yaml | 2 +
drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++
drivers/usb/chipidea/usbmisc_imx.c | 89 +++++++++++++++++++
4 files changed, 99 insertions(+)
--
2.47.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3
2025-06-12 18:50 [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Dan Carpenter
@ 2025-06-12 18:50 ` Ghennadi Procopciuc
2025-06-13 14:47 ` Conor Dooley
2025-06-13 14:49 ` Frank Li
2025-06-12 18:50 ` [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2 Dan Carpenter
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Ghennadi Procopciuc @ 2025-06-12 18:50 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Xu Yang, Peng Fan,
linux-usb, devicetree, linux-kernel, imx, s32, linaro-s32,
Larisa Grigore, Ionut Vicovan, Ghennadi Procopciuc
From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Add the compatible strings for the NXP s32g2 and s32g3. These chips
are mostly compatible. The one difference is that the s32g2-usbmisc
device has an errata ERR050474 which requires a special flag to be set
for handling packages that aren't 4 byte aligned.
Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
Signed-off-by: Ionut Vicovan <Ionut.Vicovan@nxp.com>
Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
Changes since v1:
1: Alphabetize
2: Update the commit message a bit.
Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 2 ++
Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml | 2 ++
2 files changed, 4 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
index cc5787a8cfa3..f6372b76ed5a 100644
--- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
+++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
@@ -23,6 +23,8 @@ properties:
- nvidia,tegra30-udc
- nvidia,tegra114-udc
- nvidia,tegra124-udc
+ - nxp,s32g2-usb
+ - nxp,s32g3-usb
- qcom,ci-hdrc
- items:
- enum:
diff --git a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
index 019435540df0..ca677d1a8274 100644
--- a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
+++ b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
@@ -21,6 +21,8 @@ properties:
- fsl,imx53-usbmisc
- fsl,imx6q-usbmisc
- fsl,vf610-usbmisc
+ - nxp,s32g2-usbmisc
+ - nxp,s32g3-usbmisc
- items:
- enum:
- fsl,imx6ul-usbmisc
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2
2025-06-12 18:50 [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Dan Carpenter
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
@ 2025-06-12 18:50 ` Dan Carpenter
2025-06-13 14:53 ` Frank Li
2025-06-12 18:51 ` [PATCH 3/3 v2] usb: chipidea: s32g: Add usb support for s32g3 Dan Carpenter
2025-06-13 14:50 ` [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Frank Li
3 siblings, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2025-06-12 18:50 UTC (permalink / raw)
To: Peter Chen
Cc: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, Krzysztof Kozlowski, s32,
linaro-s32, Larisa Grigore, Ionut Vicovan, Ghennadi Procopciuc
From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Enable USB driver for s32g2. This chip has an errata ERR050474,
so we need to set S32G_UCMALLBE for it to handle packages which
aren't 4 byte aligned correctly.
Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
Changes since v1:
* Update the copyright
* Use the .power_lost_check callback.
drivers/usb/chipidea/ci_hdrc_imx.c | 6 +++
drivers/usb/chipidea/usbmisc_imx.c | 74 ++++++++++++++++++++++++++++++
2 files changed, 80 insertions(+)
diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
index 780f4d151345..e8c847eab8e3 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2025 NXP
* Copyright (C) 2012 Marek Vasut <marex@denx.de>
* on behalf of DENX Software Engineering GmbH
*/
@@ -78,6 +79,10 @@ static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
CI_HDRC_HAS_PORTSC_PEC_MISSED,
};
+static const struct ci_hdrc_imx_platform_flag s32g_usb_data = {
+ .flags = CI_HDRC_DISABLE_HOST_STREAMING,
+};
+
static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
{ .compatible = "fsl,imx23-usb", .data = &imx23_usb_data},
{ .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
@@ -89,6 +94,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
{ .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
{ .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
{ .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data},
+ { .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data},
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 118b9a68496b..67ff073ad806 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2025 NXP
*/
#include <linux/module.h>
@@ -155,6 +156,18 @@
BLKCTL_OTG_VBUS_WAKEUP_EN | \
BLKCTL_OTG_DPDM_WAKEUP_EN)
+#define S32G_WAKEUP_IE BIT(0)
+#define S32G_CORE_IE BIT(1)
+#define S32G_PWRFLTEN BIT(7)
+#define S32G_WAKEUPCTRL BIT(10)
+#define S32G_WAKEUPEN BIT(11)
+
+/* Workaround errata ERR050474 (handle packages that aren't 4 byte aligned) */
+#define S32G_UCMALLBE BIT(15)
+
+#define S32G_WAKEUP_BITS (S32G_WAKEUP_IE | S32G_CORE_IE | S32G_WAKEUPEN | \
+ S32G_WAKEUPCTRL)
+
struct usbmisc_ops {
/* It's called once when probe a usb device */
int (*init)(struct imx_usbmisc_data *data);
@@ -614,6 +627,52 @@ static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
return 0;
}
+static int usbmisc_s32g_set_wakeup(struct imx_usbmisc_data *data, bool enabled)
+{
+ struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&usbmisc->lock, flags);
+
+ reg = readl(usbmisc->base);
+ if (enabled)
+ reg |= S32G_WAKEUP_BITS;
+ else
+ reg &= ~S32G_WAKEUP_BITS;
+
+ writel(reg, usbmisc->base);
+ spin_unlock_irqrestore(&usbmisc->lock, flags);
+
+ return 0;
+}
+
+static int usbmisc_s32g_init(struct imx_usbmisc_data *data, u32 extra_flags)
+{
+ struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
+ unsigned long flags;
+ u32 reg;
+
+ spin_lock_irqsave(&usbmisc->lock, flags);
+
+ reg = readl(usbmisc->base);
+
+ reg |= S32G_PWRFLTEN;
+ reg |= extra_flags;
+
+ writel(reg, usbmisc->base);
+
+ spin_unlock_irqrestore(&usbmisc->lock, flags);
+ usbmisc_s32g_set_wakeup(data, false);
+
+ return 0;
+}
+
+static int usbmisc_s32g2_init(struct imx_usbmisc_data *data)
+{
+ return usbmisc_s32g_init(data, S32G_UCMALLBE);
+}
+
static int usbmisc_imx7d_set_wakeup
(struct imx_usbmisc_data *data, bool enabled)
{
@@ -1033,6 +1092,11 @@ static int usbmisc_imx6sx_power_lost_check(struct imx_usbmisc_data *data)
return 0;
}
+static int usbmisc_s32g_power_lost_check(struct imx_usbmisc_data *data)
+{
+ return 1;
+}
+
static u32 usbmisc_blkctl_wakeup_setting(struct imx_usbmisc_data *data)
{
u32 wakeup_setting = BLKCTL_WAKEUP_SOURCE;
@@ -1131,6 +1195,12 @@ static const struct usbmisc_ops imx95_usbmisc_ops = {
.vbus_comparator_on = usbmisc_imx7d_vbus_comparator_on,
};
+static const struct usbmisc_ops s32g2_usbmisc_ops = {
+ .init = usbmisc_s32g2_init,
+ .set_wakeup = usbmisc_s32g_set_wakeup,
+ .power_lost_check = usbmisc_s32g_power_lost_check,
+};
+
static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data)
{
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
@@ -1356,6 +1426,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.compatible = "fsl,imx95-usbmisc",
.data = &imx95_usbmisc_ops,
},
+ {
+ .compatible = "nxp,s32g2-usbmisc",
+ .data = &s32g2_usbmisc_ops,
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3 v2] usb: chipidea: s32g: Add usb support for s32g3
2025-06-12 18:50 [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Dan Carpenter
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
2025-06-12 18:50 ` [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2 Dan Carpenter
@ 2025-06-12 18:51 ` Dan Carpenter
2025-06-13 14:50 ` [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Frank Li
3 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2025-06-12 18:51 UTC (permalink / raw)
To: Peter Chen
Cc: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, Krzysztof Kozlowski, s32,
linaro-s32, Larisa Grigore, Ionut Vicovan, Ghennadi Procopciuc
From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Enable USB driver for the s32g3 USB device.
Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
Changes since v1:
* Drop the changes to ci_hdrc_imx.c since that part is compatible with
the s32g2 chip.
* Use the .power_lost_check() callback.
drivers/usb/chipidea/usbmisc_imx.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
index 67ff073ad806..d5389156e157 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -673,6 +673,11 @@ static int usbmisc_s32g2_init(struct imx_usbmisc_data *data)
return usbmisc_s32g_init(data, S32G_UCMALLBE);
}
+static int usbmisc_s32g3_init(struct imx_usbmisc_data *data)
+{
+ return usbmisc_s32g_init(data, 0);
+}
+
static int usbmisc_imx7d_set_wakeup
(struct imx_usbmisc_data *data, bool enabled)
{
@@ -1201,6 +1206,12 @@ static const struct usbmisc_ops s32g2_usbmisc_ops = {
.power_lost_check = usbmisc_s32g_power_lost_check,
};
+static const struct usbmisc_ops s32g3_usbmisc_ops = {
+ .init = usbmisc_s32g3_init,
+ .set_wakeup = usbmisc_s32g_set_wakeup,
+ .power_lost_check = usbmisc_s32g_power_lost_check,
+};
+
static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data)
{
struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
@@ -1430,6 +1441,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.compatible = "nxp,s32g2-usbmisc",
.data = &s32g2_usbmisc_ops,
},
+ {
+ .compatible = "nxp,s32g3-usbmisc",
+ .data = &s32g3_usbmisc_ops,
+ },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
--
2.47.2
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
@ 2025-06-13 14:47 ` Conor Dooley
2025-06-13 14:49 ` Frank Li
1 sibling, 0 replies; 8+ messages in thread
From: Conor Dooley @ 2025-06-13 14:47 UTC (permalink / raw)
To: Ghennadi Procopciuc
Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Xu Yang, Peng Fan, linux-usb, devicetree,
linux-kernel, imx, s32, linaro-s32, Larisa Grigore, Ionut Vicovan,
Ghennadi Procopciuc
[-- Attachment #1: Type: text/plain, Size: 2349 bytes --]
On Thu, Jun 12, 2025 at 09:50:51PM +0300, Ghennadi Procopciuc wrote:
> From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
>
> Add the compatible strings for the NXP s32g2 and s32g3. These chips
> are mostly compatible. The one difference is that the s32g2-usbmisc
> device has an errata ERR050474 which requires a special flag to be set
> for handling packages that aren't 4 byte aligned.
>
> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
> Signed-off-by: Ionut Vicovan <Ionut.Vicovan@nxp.com>
> Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
This signoff chain is absolutely wrong, what were the contributions of
Larisa, Ionut or Dan to this patch? If they were co-authors (surely not
4 people for a trivial 4 line diff) they need co-developed-by tags.
You sent it, so your name should be last.
> ---
> Changes since v1:
> 1: Alphabetize
> 2: Update the commit message a bit.
>
> Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 2 ++
> Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> index cc5787a8cfa3..f6372b76ed5a 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> @@ -23,6 +23,8 @@ properties:
> - nvidia,tegra30-udc
> - nvidia,tegra114-udc
> - nvidia,tegra124-udc
> + - nxp,s32g2-usb
> + - nxp,s32g3-usb
> - qcom,ci-hdrc
> - items:
> - enum:
> diff --git a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> index 019435540df0..ca677d1a8274 100644
> --- a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> +++ b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> @@ -21,6 +21,8 @@ properties:
> - fsl,imx53-usbmisc
> - fsl,imx6q-usbmisc
> - fsl,vf610-usbmisc
> + - nxp,s32g2-usbmisc
> + - nxp,s32g3-usbmisc
> - items:
> - enum:
> - fsl,imx6ul-usbmisc
> --
> 2.47.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
2025-06-13 14:47 ` Conor Dooley
@ 2025-06-13 14:49 ` Frank Li
1 sibling, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-06-13 14:49 UTC (permalink / raw)
To: Ghennadi Procopciuc
Cc: Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Xu Yang, Peng Fan, linux-usb, devicetree,
linux-kernel, imx, s32, linaro-s32, Larisa Grigore, Ionut Vicovan,
Ghennadi Procopciuc
On Thu, Jun 12, 2025 at 09:50:51PM +0300, Ghennadi Procopciuc wrote:
> From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
>
> Add the compatible strings for the NXP s32g2 and s32g3. These chips
> are mostly compatible. The one difference is that the s32g2-usbmisc
> device has an errata ERR050474 which requires a special flag to be set
> for handling packages that aren't 4 byte aligned.
>
> Signed-off-by: Larisa Grigore <larisa.grigore@nxp.com>
> Signed-off-by: Ionut Vicovan <Ionut.Vicovan@nxp.com>
> Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> Changes since v1:
> 1: Alphabetize
> 2: Update the commit message a bit.
>
> Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml | 2 ++
> Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> index cc5787a8cfa3..f6372b76ed5a 100644
> --- a/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> +++ b/Documentation/devicetree/bindings/usb/ci-hdrc-usb2.yaml
> @@ -23,6 +23,8 @@ properties:
> - nvidia,tegra30-udc
> - nvidia,tegra114-udc
> - nvidia,tegra124-udc
> + - nxp,s32g2-usb
> + - nxp,s32g3-usb
You plan support nxp,s32g3-usb fallback to nxp,s32g2-usb in dts, your dts
can't pass CHECK_DTB with this bindding.
Frank
> - qcom,ci-hdrc
> - items:
> - enum:
> diff --git a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> index 019435540df0..ca677d1a8274 100644
> --- a/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> +++ b/Documentation/devicetree/bindings/usb/fsl,usbmisc.yaml
> @@ -21,6 +21,8 @@ properties:
> - fsl,imx53-usbmisc
> - fsl,imx6q-usbmisc
> - fsl,vf610-usbmisc
> + - nxp,s32g2-usbmisc
> + - nxp,s32g3-usbmisc
> - items:
> - enum:
> - fsl,imx6ul-usbmisc
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3
2025-06-12 18:50 [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Dan Carpenter
` (2 preceding siblings ...)
2025-06-12 18:51 ` [PATCH 3/3 v2] usb: chipidea: s32g: Add usb support for s32g3 Dan Carpenter
@ 2025-06-13 14:50 ` Frank Li
3 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-06-13 14:50 UTC (permalink / raw)
To: Dan Carpenter
Cc: Greg Kroah-Hartman, Conor Dooley, devicetree, Fabio Estevam, imx,
Krzysztof Kozlowski, linux-arm-kernel, linux-kernel, linux-usb,
Peng Fan, Pengutronix Kernel Team, Peter Chen, Rob Herring,
Sascha Hauer, Shawn Guo, Xu Yang, s32, linaro-s32, Larisa Grigore,
Ionut Vicovan, Ghennadi Procopciuc
On Thu, Jun 12, 2025 at 09:50:42PM +0300, Dan Carpenter wrote:
> This patchset adds support for the s32g2 and s32g3 chips.
>
> The changes since v1:
> * Put the device tree lines in alphabetical order.
> * Add imx@lists.linux.dev to the CC list.
> * Use power_lost_check() instead of creating a new REINIT_DURING_RESUME
> flag.
> * Change the Copyright date.
> * Leave the .compatible = "nxp,s32g3-usb" out of the ci_hdrc_imx.c
> driver because people can just specify both in the devicetree
> since they are compatible.
Suggest add dts patch also, make sure your dts file pass CHECK_DTBS
Frank
>
> Ghennadi Procopciuc (3):
> dt-bindings: usb: Add compatible strings for s32g2/s32g3
> usb: chipidea: s32g: Add usb support for s32g2
> usb: chipidea: s32g: Add usb support for s32g3
>
> .../devicetree/bindings/usb/ci-hdrc-usb2.yaml | 2 +
> .../devicetree/bindings/usb/fsl,usbmisc.yaml | 2 +
> drivers/usb/chipidea/ci_hdrc_imx.c | 6 ++
> drivers/usb/chipidea/usbmisc_imx.c | 89 +++++++++++++++++++
> 4 files changed, 99 insertions(+)
>
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2
2025-06-12 18:50 ` [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2 Dan Carpenter
@ 2025-06-13 14:53 ` Frank Li
0 siblings, 0 replies; 8+ messages in thread
From: Frank Li @ 2025-06-13 14:53 UTC (permalink / raw)
To: Dan Carpenter
Cc: Peter Chen, Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, linux-usb, imx,
linux-arm-kernel, linux-kernel, Krzysztof Kozlowski, s32,
linaro-s32, Larisa Grigore, Ionut Vicovan, Ghennadi Procopciuc
On Thu, Jun 12, 2025 at 09:50:59PM +0300, Dan Carpenter wrote:
> From: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
>
> Enable USB driver for s32g2. This chip has an errata ERR050474,
Can you provide errata link here?
> so we need to set S32G_UCMALLBE for it to handle packages which
> aren't 4 byte aligned correctly.
>
> Signed-off-by: Ghennadi Procopciuc <ghennadi.procopciuc@nxp.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> Changes since v1:
> * Update the copyright
> * Use the .power_lost_check callback.
>
> drivers/usb/chipidea/ci_hdrc_imx.c | 6 +++
> drivers/usb/chipidea/usbmisc_imx.c | 74 ++++++++++++++++++++++++++++++
> 2 files changed, 80 insertions(+)
>
> diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c
> index 780f4d151345..e8c847eab8e3 100644
> --- a/drivers/usb/chipidea/ci_hdrc_imx.c
> +++ b/drivers/usb/chipidea/ci_hdrc_imx.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0+
> /*
> * Copyright 2012 Freescale Semiconductor, Inc.
> + * Copyright 2025 NXP
> * Copyright (C) 2012 Marek Vasut <marex@denx.de>
> * on behalf of DENX Software Engineering GmbH
> */
> @@ -78,6 +79,10 @@ static const struct ci_hdrc_imx_platform_flag imx8ulp_usb_data = {
> CI_HDRC_HAS_PORTSC_PEC_MISSED,
> };
>
> +static const struct ci_hdrc_imx_platform_flag s32g_usb_data = {
> + .flags = CI_HDRC_DISABLE_HOST_STREAMING,
> +};
> +
> static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
> { .compatible = "fsl,imx23-usb", .data = &imx23_usb_data},
> { .compatible = "fsl,imx28-usb", .data = &imx28_usb_data},
> @@ -89,6 +94,7 @@ static const struct of_device_id ci_hdrc_imx_dt_ids[] = {
> { .compatible = "fsl,imx7d-usb", .data = &imx7d_usb_data},
> { .compatible = "fsl,imx7ulp-usb", .data = &imx7ulp_usb_data},
> { .compatible = "fsl,imx8ulp-usb", .data = &imx8ulp_usb_data},
> + { .compatible = "nxp,s32g2-usb", .data = &s32g_usb_data},
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, ci_hdrc_imx_dt_ids);
> diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c
> index 118b9a68496b..67ff073ad806 100644
> --- a/drivers/usb/chipidea/usbmisc_imx.c
> +++ b/drivers/usb/chipidea/usbmisc_imx.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0+
> /*
> * Copyright 2012 Freescale Semiconductor, Inc.
> + * Copyright 2025 NXP
> */
>
> #include <linux/module.h>
> @@ -155,6 +156,18 @@
> BLKCTL_OTG_VBUS_WAKEUP_EN | \
> BLKCTL_OTG_DPDM_WAKEUP_EN)
>
> +#define S32G_WAKEUP_IE BIT(0)
> +#define S32G_CORE_IE BIT(1)
> +#define S32G_PWRFLTEN BIT(7)
> +#define S32G_WAKEUPCTRL BIT(10)
> +#define S32G_WAKEUPEN BIT(11)
> +
> +/* Workaround errata ERR050474 (handle packages that aren't 4 byte aligned) */
> +#define S32G_UCMALLBE BIT(15)
> +
> +#define S32G_WAKEUP_BITS (S32G_WAKEUP_IE | S32G_CORE_IE | S32G_WAKEUPEN | \
> + S32G_WAKEUPCTRL)
> +
> struct usbmisc_ops {
> /* It's called once when probe a usb device */
> int (*init)(struct imx_usbmisc_data *data);
> @@ -614,6 +627,52 @@ static int usbmisc_vf610_init(struct imx_usbmisc_data *data)
> return 0;
> }
>
> +static int usbmisc_s32g_set_wakeup(struct imx_usbmisc_data *data, bool enabled)
> +{
> + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&usbmisc->lock, flags);
> +
> + reg = readl(usbmisc->base);
> + if (enabled)
> + reg |= S32G_WAKEUP_BITS;
> + else
> + reg &= ~S32G_WAKEUP_BITS;
> +
> + writel(reg, usbmisc->base);
> + spin_unlock_irqrestore(&usbmisc->lock, flags);
> +
> + return 0;
> +}
> +
> +static int usbmisc_s32g_init(struct imx_usbmisc_data *data, u32 extra_flags)
> +{
> + struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&usbmisc->lock, flags);
> +
> + reg = readl(usbmisc->base);
> +
> + reg |= S32G_PWRFLTEN;
> + reg |= extra_flags;
> +
> + writel(reg, usbmisc->base);
> +
> + spin_unlock_irqrestore(&usbmisc->lock, flags);
> + usbmisc_s32g_set_wakeup(data, false);
> +
> + return 0;
> +}
> +
> +static int usbmisc_s32g2_init(struct imx_usbmisc_data *data)
> +{
> + return usbmisc_s32g_init(data, S32G_UCMALLBE);
> +}
> +
> static int usbmisc_imx7d_set_wakeup
> (struct imx_usbmisc_data *data, bool enabled)
> {
> @@ -1033,6 +1092,11 @@ static int usbmisc_imx6sx_power_lost_check(struct imx_usbmisc_data *data)
> return 0;
> }
>
> +static int usbmisc_s32g_power_lost_check(struct imx_usbmisc_data *data)
> +{
> + return 1;
> +}
> +
> static u32 usbmisc_blkctl_wakeup_setting(struct imx_usbmisc_data *data)
> {
> u32 wakeup_setting = BLKCTL_WAKEUP_SOURCE;
> @@ -1131,6 +1195,12 @@ static const struct usbmisc_ops imx95_usbmisc_ops = {
> .vbus_comparator_on = usbmisc_imx7d_vbus_comparator_on,
> };
>
> +static const struct usbmisc_ops s32g2_usbmisc_ops = {
> + .init = usbmisc_s32g2_init,
> + .set_wakeup = usbmisc_s32g_set_wakeup,
> + .power_lost_check = usbmisc_s32g_power_lost_check,
> +};
> +
> static inline bool is_imx53_usbmisc(struct imx_usbmisc_data *data)
> {
> struct imx_usbmisc *usbmisc = dev_get_drvdata(data->dev);
> @@ -1356,6 +1426,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
> .compatible = "fsl,imx95-usbmisc",
> .data = &imx95_usbmisc_ops,
> },
> + {
> + .compatible = "nxp,s32g2-usbmisc",
> + .data = &s32g2_usbmisc_ops,
> + },
> { /* sentinel */ }
> };
> MODULE_DEVICE_TABLE(of, usbmisc_imx_dt_ids);
> --
> 2.47.2
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-06-13 14:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 18:50 [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Dan Carpenter
2025-06-12 18:50 ` [PATCH 1/3 v2] dt-bindings: usb: Add compatible strings for s32g2/s32g3 Ghennadi Procopciuc
2025-06-13 14:47 ` Conor Dooley
2025-06-13 14:49 ` Frank Li
2025-06-12 18:50 ` [PATCH 2/3 v2] usb: chipidea: s32g: Add usb support for s32g2 Dan Carpenter
2025-06-13 14:53 ` Frank Li
2025-06-12 18:51 ` [PATCH 3/3 v2] usb: chipidea: s32g: Add usb support for s32g3 Dan Carpenter
2025-06-13 14:50 ` [PATCH 0/3 v2] usb: chipidea: Add support for s32g2 and s32g3 Frank Li
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.