* [PATCH v4 1/6] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-06-16 13:51 ` Krzysztof Kozlowski
2024-06-16 10:53 ` [PATCH v4 2/6] reset: renesas: Add USB VBUS regulator device as child Biju Das
` (6 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Philipp Zabel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: Biju Das, Liam Girdwood, Mark Brown, Geert Uytterhoeven,
Magnus Damm, devicetree, linux-phy, linux-renesas-soc,
Prabhakar Mahadev Lad, Biju Das
The VBUS enable can be controlled by the VBOUT bit of the VBUS control
register. This register is part of usbphy-ctrl IP.
Document the USB VBUS regulator object.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* Fixed example indentation to 4 char spaces
* Dropped regulator-{min,max}-microvolt from example.
v3:
* New patch
---
.../bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
index 03c18611e42d..b0b20af15313 100644
--- a/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
+++ b/Documentation/devicetree/bindings/reset/renesas,rzg2l-usbphy-ctrl.yaml
@@ -42,6 +42,12 @@ properties:
0 = Port 1 Phy reset
1 = Port 2 Phy reset
+ regulator-vbus:
+ type: object
+ description: USB VBUS regulator
+ $ref: /schemas/regulator/regulator.yaml#
+ unevaluatedProperties: false
+
required:
- compatible
- reg
@@ -49,6 +55,7 @@ required:
- resets
- power-domains
- '#reset-cells'
+ - regulator-vbus
additionalProperties: false
@@ -64,4 +71,7 @@ examples:
resets = <&cpg R9A07G044_USB_PRESETN>;
power-domains = <&cpg>;
#reset-cells = <1>;
+ regulator-vbus {
+ regulator-name = "vbus";
+ };
};
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 1/6] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator
2024-06-16 10:53 ` [PATCH v4 1/6] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
@ 2024-06-16 13:51 ` Krzysztof Kozlowski
0 siblings, 0 replies; 19+ messages in thread
From: Krzysztof Kozlowski @ 2024-06-16 13:51 UTC (permalink / raw)
To: Biju Das, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Liam Girdwood, Mark Brown, Geert Uytterhoeven, Magnus Damm,
devicetree, linux-phy, linux-renesas-soc, Prabhakar Mahadev Lad,
Biju Das
On 16/06/2024 12:53, Biju Das wrote:
> The VBUS enable can be controlled by the VBOUT bit of the VBUS control
> register. This register is part of usbphy-ctrl IP.
>
> Document the USB VBUS regulator object.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 2/6] reset: renesas: Add USB VBUS regulator device as child
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
2024-06-16 10:53 ` [PATCH v4 1/6] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-07-03 8:20 ` Philipp Zabel
2024-06-16 10:53 ` [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
` (5 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Philipp Zabel
Cc: Biju Das, Liam Girdwood, Mark Brown, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven,
Prabhakar Mahadev Lad, Biju Das, devicetree, linux-phy,
linux-renesas-soc
As per RZ/G2L HW manual, VBUS enable can be controlled by the VBOUT bit
of the VBUS Control Register(VBENCTL) register in the USBPHY Control.
Expose this register as regmap and instantiate the USB VBUS regulator
device, so that consumer can control the vbus using regulator API's
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* No change.
v2->v3:
* Updated commit description and header
* Moved regulator device creation and instantiation at the end of probe().
v1->v2:
* Instantiated regulator driver
---
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 37 +++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index 8f6fbd978591..c740b3b9599d 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -10,10 +10,12 @@
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
#include <linux/reset.h>
#include <linux/reset-controller.h>
#define RESET 0x000
+#define VBENCTL 0x03c
#define RESET_SEL_PLLRESET BIT(12)
#define RESET_PLLRESET BIT(8)
@@ -32,6 +34,7 @@ struct rzg2l_usbphy_ctrl_priv {
struct reset_controller_dev rcdev;
struct reset_control *rstc;
void __iomem *base;
+ struct platform_device *vdev;
spinlock_t lock;
};
@@ -100,10 +103,19 @@ static const struct reset_control_ops rzg2l_usbphy_ctrl_reset_ops = {
.status = rzg2l_usbphy_ctrl_status,
};
+static const struct regmap_config rzg2l_usb_regconf = {
+ .reg_bits = 32,
+ .val_bits = 32,
+ .reg_stride = 4,
+ .max_register = 1,
+};
+
static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct rzg2l_usbphy_ctrl_priv *priv;
+ struct platform_device *vdev;
+ struct regmap *regmap;
unsigned long flags;
int error;
u32 val;
@@ -116,6 +128,10 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
if (IS_ERR(priv->base))
return PTR_ERR(priv->base);
+ regmap = devm_regmap_init_mmio(dev, priv->base + VBENCTL, &rzg2l_usb_regconf);
+ if (IS_ERR(regmap))
+ return PTR_ERR(regmap);
+
priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
if (IS_ERR(priv->rstc))
return dev_err_probe(dev, PTR_ERR(priv->rstc),
@@ -153,13 +169,34 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
writel(val, priv->base + RESET);
spin_unlock_irqrestore(&priv->lock, flags);
+ vdev = platform_device_alloc("rzg2l-usb-vbus-regulator", pdev->id);
+ if (!vdev) {
+ error = -ENOMEM;
+ goto err_pm_runtime_put;
+ }
+ vdev->dev.parent = dev;
+ priv->vdev = vdev;
+
+ error = platform_device_add(vdev);
+ if (error)
+ goto err_device_put;
+
return 0;
+
+err_device_put:
+ platform_device_put(vdev);
+err_pm_runtime_put:
+ pm_runtime_put(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ reset_control_assert(priv->rstc);
+ return error;
}
static void rzg2l_usbphy_ctrl_remove(struct platform_device *pdev)
{
struct rzg2l_usbphy_ctrl_priv *priv = dev_get_drvdata(&pdev->dev);
+ platform_device_unregister(priv->vdev);
pm_runtime_put(&pdev->dev);
pm_runtime_disable(&pdev->dev);
reset_control_assert(priv->rstc);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 2/6] reset: renesas: Add USB VBUS regulator device as child
2024-06-16 10:53 ` [PATCH v4 2/6] reset: renesas: Add USB VBUS regulator device as child Biju Das
@ 2024-07-03 8:20 ` Philipp Zabel
0 siblings, 0 replies; 19+ messages in thread
From: Philipp Zabel @ 2024-07-03 8:20 UTC (permalink / raw)
To: Biju Das
Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das,
devicetree, linux-phy, linux-renesas-soc
On So, 2024-06-16 at 11:53 +0100, Biju Das wrote:
> As per RZ/G2L HW manual, VBUS enable can be controlled by the VBOUT bit
> of the VBUS Control Register(VBENCTL) register in the USBPHY Control.
>
> Expose this register as regmap and instantiate the USB VBUS regulator
> device, so that consumer can control the vbus using regulator API's
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
2024-06-16 10:53 ` [PATCH v4 1/6] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
2024-06-16 10:53 ` [PATCH v4 2/6] reset: renesas: Add USB VBUS regulator device as child Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-07-02 13:30 ` Mark Brown
2024-06-16 10:53 ` [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
` (4 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown
Cc: Biju Das, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Rafael J. Wysocki, Len Brown, Pavel Machek,
linux-pm, Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das,
devicetree, linux-renesas-soc
Add a helper function that allow regulator consumers to allow low-level
HW access, in order to enable/disable regulator in atomic context.
The use-case for RZ/G2L SoC is to enable VBUS selection register based
on vbus detection that happens in interrupt context.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* Updated commit header and description
* Replaced regulator_set_hardware_enable_register()->regulator_hardware_enable()
* Updated documentation to "must use of regulator_get_exclusive() for consumers"
* Enforced exclusive access in regulator_hardware_enable().
* Added generic support regulator_hardware_enable().
v3:
* New patch.
---
Documentation/power/regulator/consumer.rst | 6 +++++
drivers/regulator/core.c | 28 ++++++++++++++++++++++
include/linux/regulator/consumer.h | 7 ++++++
3 files changed, 41 insertions(+)
diff --git a/Documentation/power/regulator/consumer.rst b/Documentation/power/regulator/consumer.rst
index 85c2bf5ac07e..9d2416f63f6e 100644
--- a/Documentation/power/regulator/consumer.rst
+++ b/Documentation/power/regulator/consumer.rst
@@ -227,3 +227,9 @@ directly written to the voltage selector register, use::
int regulator_list_hardware_vsel(struct regulator *regulator,
unsigned selector);
+
+To access the hardware for enabling/disabling the regulator, consumers must
+use regulator_get_exclusive(), as it can't work if there's more than one
+consumer. To enable/disable regulator use::
+
+ int regulator_hardware_enable(struct regulator *regulator, bool enable);
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 844e9587a880..7674b7f2df14 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3408,6 +3408,34 @@ int regulator_list_hardware_vsel(struct regulator *regulator,
}
EXPORT_SYMBOL_GPL(regulator_list_hardware_vsel);
+/**
+ * regulator_hardware_enable - access the HW for enable/disable regulator
+ * @regulator: regulator source
+ * @enable: true for enable, false for disable
+ *
+ * Request that the regulator be enabled/disabled with the regulator output at
+ * the predefined voltage or current value.
+ *
+ * On success 0 is returned, otherwise a negative errno is returned.
+ */
+int regulator_hardware_enable(struct regulator *regulator, bool enable)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+ const struct regulator_ops *ops = rdev->desc->ops;
+ int ret = -EOPNOTSUPP;
+
+ if (!rdev->exclusive || !ops || !ops->enable || !ops->disable)
+ return ret;
+
+ if (enable)
+ ret = ops->enable(rdev);
+ else
+ ret = ops->disable(rdev);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(regulator_hardware_enable);
+
/**
* regulator_get_linear_step - return the voltage step size between VSEL values
* @regulator: regulator source
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index e6f81fc1fb17..d986ec13092e 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -250,6 +250,7 @@ int regulator_get_hardware_vsel_register(struct regulator *regulator,
unsigned *vsel_mask);
int regulator_list_hardware_vsel(struct regulator *regulator,
unsigned selector);
+int regulator_hardware_enable(struct regulator *regulator, bool enable);
/* regulator notifier block */
int regulator_register_notifier(struct regulator *regulator,
@@ -571,6 +572,12 @@ static inline int regulator_list_hardware_vsel(struct regulator *regulator,
return -EOPNOTSUPP;
}
+static inline int regulator_hardware_enable(struct regulator *regulator,
+ bool enable)
+{
+ return -EOPNOTSUPP;
+}
+
static inline int regulator_register_notifier(struct regulator *regulator,
struct notifier_block *nb)
{
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-06-16 10:53 ` [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
@ 2024-07-02 13:30 ` Mark Brown
2024-07-03 9:07 ` Philipp Zabel
0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2024-07-02 13:30 UTC (permalink / raw)
To: Biju Das
Cc: Liam Girdwood, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Rafael J. Wysocki, Len Brown, Pavel Machek,
linux-pm, Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das,
devicetree, linux-renesas-soc
[-- Attachment #1: Type: text/plain, Size: 1304 bytes --]
On Sun, Jun 16, 2024 at 11:53:55AM +0100, Biju Das wrote:
> Add a helper function that allow regulator consumers to allow low-level
> HW access, in order to enable/disable regulator in atomic context.
The following changes since commit f2661062f16b2de5d7b6a5c42a9a5c96326b8454:
Linux 6.10-rc5 (2024-06-23 17:08:54 -0400)
are available in the Git repository at:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git tags/regulator-hw-enable-helper
for you to fetch changes up to 1cb7d29157603561af4c38535e936850ceb99f0f:
regulator: core: Add helper for allow HW access to enable/disable regulator (2024-06-26 18:17:05 +0100)
----------------------------------------------------------------
regulator: Add helper to allow enable/disable in interrupt context
Add a helper function that enables exclusive consumers to bypass locking
and do an enable/disable from within interrupt context.
----------------------------------------------------------------
Biju Das (1):
regulator: core: Add helper for allow HW access to enable/disable regulator
Documentation/power/regulator/consumer.rst | 6 ++++++
drivers/regulator/core.c | 28 ++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 7 +++++++
3 files changed, 41 insertions(+)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-02 13:30 ` Mark Brown
@ 2024-07-03 9:07 ` Philipp Zabel
0 siblings, 0 replies; 19+ messages in thread
From: Philipp Zabel @ 2024-07-03 9:07 UTC (permalink / raw)
To: Mark Brown, Biju Das
Cc: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Rafael J. Wysocki, Len Brown, Pavel Machek, linux-pm,
Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das, devicetree,
linux-renesas-soc
On Di, 2024-07-02 at 14:30 +0100, Mark Brown wrote:
> On Sun, Jun 16, 2024 at 11:53:55AM +0100, Biju Das wrote:
> > Add a helper function that allow regulator consumers to allow low-level
> > HW access, in order to enable/disable regulator in atomic context.
>
> The following changes since commit f2661062f16b2de5d7b6a5c42a9a5c96326b8454:
>
> Linux 6.10-rc5 (2024-06-23 17:08:54 -0400)
>
> [...]
Thank you, merged into reset/next.
regards
Philipp
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
` (2 preceding siblings ...)
2024-06-16 10:53 ` [PATCH v4 3/6] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-07-11 14:40 ` Geert Uytterhoeven
2024-06-16 10:53 ` [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
` (3 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown
Cc: Biju Das, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Geert Uytterhoeven, Magnus Damm, devicetree,
linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das
As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT
bit of the VBUS Control Register. This register is mapped in the reset
framework. The reset driver expose this register as regmap and instantiates
this driver. The consumer will use the regulator API to control the VBOUT
bit as the control need to be done in the atomic context.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* Added check for of_get_child_by_name().
* Released the resource by of_node_put()
v2->v3:
* Dropped vbus_voltages table
* Added support for enabling/disabling regulator through regmap API's
* Updated rzg2l_usb_vbus_rdesc with enable_{reg,mask}, fixed_uV and
n_voltages
* Updated of_node with child node of the parent device.
v1->v2:
* New patch
---
drivers/regulator/Kconfig | 9 +++
drivers/regulator/Makefile | 1 +
.../regulator/renesas-usb-vbus-regulator.c | 74 +++++++++++++++++++
3 files changed, 84 insertions(+)
create mode 100644 drivers/regulator/renesas-usb-vbus-regulator.c
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index d333be2bea3b..0281a9a6f4ce 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
help
Support for regulators implemented on Socionext UniPhier SoCs.
+config REGULATOR_RZG2L_VBCTRL
+ tristate "Renesas RZ/G2L USB VBUS regulator driver"
+ depends on ARCH_RZG2L || COMPILE_TEST
+ depends on OF
+ select REGMAP_MMIO
+ default ARCH_RZG2L
+ help
+ Support for VBUS regulators implemented on Renesas RZ/G2L SoCs.
+
config REGULATOR_VCTRL
tristate "Voltage controlled regulators"
depends on OF
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile
index ba15fa5f30ad..6127ffb4b011 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -189,6 +189,7 @@ obj-$(CONFIG_REGULATOR_TPS65132) += tps65132-regulator.o
obj-$(CONFIG_REGULATOR_TPS68470) += tps68470-regulator.o
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o twl6030-regulator.o
obj-$(CONFIG_REGULATOR_UNIPHIER) += uniphier-regulator.o
+obj-$(CONFIG_REGULATOR_RZG2L_VBCTRL) += renesas-usb-vbus-regulator.o
obj-$(CONFIG_REGULATOR_VCTRL) += vctrl-regulator.o
obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress-regulator.o
obj-$(CONFIG_REGULATOR_VQMMC_IPQ4019) += vqmmc-ipq4019-regulator.o
diff --git a/drivers/regulator/renesas-usb-vbus-regulator.c b/drivers/regulator/renesas-usb-vbus-regulator.c
new file mode 100644
index 000000000000..4eceb6b54497
--- /dev/null
+++ b/drivers/regulator/renesas-usb-vbus-regulator.c
@@ -0,0 +1,74 @@
+// SPDX-License-Identifier: GPL-2.0
+//
+// Renesas USB VBUS output regulator driver
+//
+// Copyright (C) 2024 Renesas Electronics Corporation
+//
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
+
+static const struct regulator_ops rzg2l_usb_vbus_reg_ops = {
+ .enable = regulator_enable_regmap,
+ .disable = regulator_disable_regmap,
+ .is_enabled = regulator_is_enabled_regmap,
+};
+
+static const struct regulator_desc rzg2l_usb_vbus_rdesc = {
+ .name = "vbus",
+ .of_match = of_match_ptr("regulator-vbus"),
+ .ops = &rzg2l_usb_vbus_reg_ops,
+ .type = REGULATOR_VOLTAGE,
+ .owner = THIS_MODULE,
+ .enable_reg = 0,
+ .enable_mask = BIT(0),
+ .enable_is_inverted = true,
+ .fixed_uV = 5000000,
+ .n_voltages = 1,
+};
+
+static int rzg2l_usb_vbus_regulator_probe(struct platform_device *pdev)
+{
+ struct regulator_config config = { };
+ struct device *dev = &pdev->dev;
+ struct regulator_dev *rdev;
+
+ config.regmap = dev_get_regmap(dev->parent, NULL);
+ if (!config.regmap)
+ return dev_err_probe(dev, -ENOENT, "Failed to get regmap\n");
+
+ config.dev = dev;
+ config.of_node = of_get_child_by_name(dev->parent->of_node, "regulator-vbus");
+ if (!config.of_node)
+ return dev_err_probe(dev, -ENODEV, "regulator node not found\n");
+
+ rdev = devm_regulator_register(dev, &rzg2l_usb_vbus_rdesc, &config);
+ if (IS_ERR(rdev)) {
+ of_node_put(config.of_node);
+ return dev_err_probe(dev, PTR_ERR(rdev),
+ "not able to register vbus regulator\n");
+ }
+
+ of_node_put(config.of_node);
+
+ return 0;
+}
+
+static struct platform_driver rzg2l_usb_vbus_regulator_driver = {
+ .probe = rzg2l_usb_vbus_regulator_probe,
+ .driver = {
+ .name = "rzg2l-usb-vbus-regulator",
+ .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ },
+};
+module_platform_driver(rzg2l_usb_vbus_regulator_driver);
+
+MODULE_AUTHOR("Biju Das <biju.das.jz@bp.renesas.com>");
+MODULE_DESCRIPTION("Renesas RZ/G2L USB Vbus Regulator Driver");
+MODULE_LICENSE("GPL");
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-06-16 10:53 ` [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
@ 2024-07-11 14:40 ` Geert Uytterhoeven
2024-07-11 14:57 ` Biju Das
0 siblings, 1 reply; 19+ messages in thread
From: Geert Uytterhoeven @ 2024-07-11 14:40 UTC (permalink / raw)
To: Biju Das
Cc: Liam Girdwood, Mark Brown, Philipp Zabel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Magnus Damm, devicetree,
linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das
Hi Biju,
On Sun, Jun 16, 2024 at 12:54 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT
> bit of the VBUS Control Register. This register is mapped in the reset
> framework. The reset driver expose this register as regmap and instantiates
> this driver. The consumer will use the regulator API to control the VBOUT
> bit as the control need to be done in the atomic context.
>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Thanks for your patch, which is now commit 84fbd6198766336f
("regulator: Add Renesas RZ/G2L USB VBUS regulator driver")
in regulator/for-next.
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
> help
> Support for regulators implemented on Socionext UniPhier SoCs.
>
> +config REGULATOR_RZG2L_VBCTRL
> + tristate "Renesas RZ/G2L USB VBUS regulator driver"
> + depends on ARCH_RZG2L || COMPILE_TEST
> + depends on OF
> + select REGMAP_MMIO
> + default ARCH_RZG2L
As the "rzg2l-usb-vbus-regulator" platform device is only created by
drivers/reset/reset-rzg2l-usbphy-ctrl.c, perhaps this should be made
stricter by using "default RESET_RZG2L_USBPHY_CTRL"?
Alternatively, RESET_RZG2L_USBPHY_CTRL could select
RESET_RZG2L_USBPHY_CTRL if REGULATOR. Can RESET_RZG2L_USBPHY_CTRL
work without REGULATOR_RZG2L_VBCTRL? If not, RESET_RZG2L_USBPHY_CTRL
should depend on REGULATOR, too.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 19+ messages in thread* RE: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-07-11 14:40 ` Geert Uytterhoeven
@ 2024-07-11 14:57 ` Biju Das
2024-07-11 15:14 ` Geert Uytterhoeven
0 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-07-11 14:57 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Liam Girdwood, Mark Brown, Philipp Zabel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Geert,
Thanks for the feedback.
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: Thursday, July 11, 2024 3:40 PM
> Subject: Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
>
> Hi Biju,
>
> On Sun, Jun 16, 2024 at 12:54 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit
> > of the VBUS Control Register. This register is mapped in the reset
> > framework. The reset driver expose this register as regmap and
> > instantiates this driver. The consumer will use the regulator API to
> > control the VBOUT bit as the control need to be done in the atomic context.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
>
> Thanks for your patch, which is now commit 84fbd6198766336f
> ("regulator: Add Renesas RZ/G2L USB VBUS regulator driver") in regulator/for-next.
OK.
>
> > --- a/drivers/regulator/Kconfig
> > +++ b/drivers/regulator/Kconfig
> > @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
> > help
> > Support for regulators implemented on Socionext UniPhier SoCs.
> >
> > +config REGULATOR_RZG2L_VBCTRL
> > + tristate "Renesas RZ/G2L USB VBUS regulator driver"
> > + depends on ARCH_RZG2L || COMPILE_TEST
> > + depends on OF
> > + select REGMAP_MMIO
> > + default ARCH_RZG2L
>
> As the "rzg2l-usb-vbus-regulator" platform device is only created by drivers/reset/reset-rzg2l-
> usbphy-ctrl.c, perhaps this should be made stricter by using "default RESET_RZG2L_USBPHY_CTRL"?
OK.
>
> Alternatively, RESET_RZG2L_USBPHY_CTRL could select RESET_RZG2L_USBPHY_CTRL if REGULATOR. Can
> RESET_RZG2L_USBPHY_CTRL work without REGULATOR_RZG2L_VBCTRL? If not, RESET_RZG2L_USBPHY_CTRL should
> depend on REGULATOR, too.
Yes, from functionality point it works for both host and device mode without REGULATOR_RZG2L_VBCTRL.
From specification point, some customers reported on device mode, VBUS is showing 5V.
So, by adding vbus regulator, I am controlling this voltage and forcing to 0 for device mode
and 5V for host mode.
Please share your input how to proceed.
Cheers,
Biju
^ permalink raw reply [flat|nested] 19+ messages in thread* Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-07-11 14:57 ` Biju Das
@ 2024-07-11 15:14 ` Geert Uytterhoeven
2024-07-12 13:45 ` Biju Das
0 siblings, 1 reply; 19+ messages in thread
From: Geert Uytterhoeven @ 2024-07-11 15:14 UTC (permalink / raw)
To: Biju Das
Cc: Liam Girdwood, Mark Brown, Philipp Zabel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Biju,
On Thu, Jul 11, 2024 at 4:58 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > Sent: Thursday, July 11, 2024 3:40 PM
> > Subject: Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
> >
> > Hi Biju,
> >
> > On Sun, Jun 16, 2024 at 12:54 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT bit
> > > of the VBUS Control Register. This register is mapped in the reset
> > > framework. The reset driver expose this register as regmap and
> > > instantiates this driver. The consumer will use the regulator API to
> > > control the VBOUT bit as the control need to be done in the atomic context.
> > >
> > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > Thanks for your patch, which is now commit 84fbd6198766336f
> > ("regulator: Add Renesas RZ/G2L USB VBUS regulator driver") in regulator/for-next.
> > > --- a/drivers/regulator/Kconfig
> > > +++ b/drivers/regulator/Kconfig
> > > @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
> > > help
> > > Support for regulators implemented on Socionext UniPhier SoCs.
> > >
> > > +config REGULATOR_RZG2L_VBCTRL
> > > + tristate "Renesas RZ/G2L USB VBUS regulator driver"
> > > + depends on ARCH_RZG2L || COMPILE_TEST
> > > + depends on OF
> > > + select REGMAP_MMIO
> > > + default ARCH_RZG2L
> >
> > As the "rzg2l-usb-vbus-regulator" platform device is only created by drivers/reset/reset-rzg2l-
> > usbphy-ctrl.c, perhaps this should be made stricter by using "default RESET_RZG2L_USBPHY_CTRL"?
>
> OK.
> >
> > Alternatively, RESET_RZG2L_USBPHY_CTRL could select RESET_RZG2L_USBPHY_CTRL if REGULATOR. Can
> > RESET_RZG2L_USBPHY_CTRL work without REGULATOR_RZG2L_VBCTRL? If not, RESET_RZG2L_USBPHY_CTRL should
> > depend on REGULATOR, too.
>
> Yes, from functionality point it works for both host and device mode without REGULATOR_RZG2L_VBCTRL.
> From specification point, some customers reported on device mode, VBUS is showing 5V.
> So, by adding vbus regulator, I am controlling this voltage and forcing to 0 for device mode
> and 5V for host mode.
>
> Please share your input how to proceed.
As it works without, I think changing the default of
REGULATOR_RZG2L_VBCTRL from ARCH_RZG2L to RESET_RZG2L_USBPHY_CTRL is
the most appropriate option.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 19+ messages in thread* RE: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-07-11 15:14 ` Geert Uytterhoeven
@ 2024-07-12 13:45 ` Biju Das
0 siblings, 0 replies; 19+ messages in thread
From: Biju Das @ 2024-07-12 13:45 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Liam Girdwood, Mark Brown, Philipp Zabel, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Magnus Damm,
devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Geert,
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: Thursday, July 11, 2024 4:14 PM
> Subject: Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
>
> Hi Biju,
>
> On Thu, Jul 11, 2024 at 4:58 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > -----Original Message-----
> > > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > > Sent: Thursday, July 11, 2024 3:40 PM
> > > Subject: Re: [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS
> > > regulator driver
> > >
> > > Hi Biju,
> > >
> > > On Sun, Jun 16, 2024 at 12:54 PM Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > > As per the RZ/G2L HW manual, VBUSEN can be controlled by the VBOUT
> > > > bit of the VBUS Control Register. This register is mapped in the
> > > > reset framework. The reset driver expose this register as regmap
> > > > and instantiates this driver. The consumer will use the regulator
> > > > API to control the VBOUT bit as the control need to be done in the atomic context.
> > > >
> > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > >
> > > Thanks for your patch, which is now commit 84fbd6198766336f
> > > ("regulator: Add Renesas RZ/G2L USB VBUS regulator driver") in regulator/for-next.
>
> > > > --- a/drivers/regulator/Kconfig
> > > > +++ b/drivers/regulator/Kconfig
> > > > @@ -1634,6 +1634,15 @@ config REGULATOR_UNIPHIER
> > > > help
> > > > Support for regulators implemented on Socionext UniPhier SoCs.
> > > >
> > > > +config REGULATOR_RZG2L_VBCTRL
> > > > + tristate "Renesas RZ/G2L USB VBUS regulator driver"
> > > > + depends on ARCH_RZG2L || COMPILE_TEST
> > > > + depends on OF
> > > > + select REGMAP_MMIO
> > > > + default ARCH_RZG2L
> > >
> > > As the "rzg2l-usb-vbus-regulator" platform device is only created by
> > > drivers/reset/reset-rzg2l- usbphy-ctrl.c, perhaps this should be made stricter by using "default
> RESET_RZG2L_USBPHY_CTRL"?
> >
> > OK.
> > >
> > > Alternatively, RESET_RZG2L_USBPHY_CTRL could select
> > > RESET_RZG2L_USBPHY_CTRL if REGULATOR. Can RESET_RZG2L_USBPHY_CTRL
> > > work without REGULATOR_RZG2L_VBCTRL? If not, RESET_RZG2L_USBPHY_CTRL should depend on REGULATOR,
> too.
> >
> > Yes, from functionality point it works for both host and device mode without
> REGULATOR_RZG2L_VBCTRL.
> > From specification point, some customers reported on device mode, VBUS is showing 5V.
> > So, by adding vbus regulator, I am controlling this voltage and
> > forcing to 0 for device mode and 5V for host mode.
> >
> > Please share your input how to proceed.
>
> As it works without, I think changing the default of REGULATOR_RZG2L_VBCTRL from ARCH_RZG2L to
> RESET_RZG2L_USBPHY_CTRL is the most appropriate option.
OK.
Thanks,
Biju
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
` (3 preceding siblings ...)
2024-06-16 10:53 ` [PATCH v4 4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-07-02 11:27 ` Vinod Koul
2024-06-16 10:53 ` [PATCH v4 6/6] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Biju Das
` (2 subsequent siblings)
7 siblings, 1 reply; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Yoshihiro Shimoda
Cc: Biju Das, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
Liam Girdwood, Mark Brown, Conor Dooley, Vinod Koul,
Kishon Vijay Abraham I, Geert Uytterhoeven, Magnus Damm,
devicetree, linux-phy, linux-renesas-soc, Prabhakar Mahadev Lad,
Biju Das
Use regulator_hardware_enable() for controlling VBUS enable for
RZ/G2L alike SoCs in interrupt context.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* Updated commit description with regulator_hardware_enable()
* Used devm_regulator_get_exclusive() to get regulator handle.
v2->v3:
* Replaced regulator's regmap API with newly introduced
regulator_set_hardware_enable_register to enable/disable regulator
in interrupt context.
* Dropped using "usb_vbus-supply"
v1->v2:
* Used regulator driver's regmap to handle VBUS.
---
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
index fbab6ac0f0d1..7594f64eb737 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -188,6 +188,9 @@ static void rcar_gen3_enable_vbus_ctrl(struct rcar_gen3_chan *ch, int vbus)
dev_vdbg(ch->dev, "%s: %08x, %d\n", __func__, val, vbus);
if (ch->soc_no_adp_ctrl) {
+ if (ch->vbus)
+ regulator_hardware_enable(ch->vbus, vbus);
+
vbus_ctrl_reg = USB2_VBCTRL;
vbus_ctrl_val = USB2_VBCTRL_VBOUT;
}
@@ -718,7 +721,10 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev)
phy_set_drvdata(channel->rphys[i].phy, &channel->rphys[i]);
}
- channel->vbus = devm_regulator_get_optional(dev, "vbus");
+ if (channel->soc_no_adp_ctrl && channel->is_otg_channel)
+ channel->vbus = devm_regulator_get_exclusive(dev, "vbus");
+ else
+ channel->vbus = devm_regulator_get_optional(dev, "vbus");
if (IS_ERR(channel->vbus)) {
if (PTR_ERR(channel->vbus) == -EPROBE_DEFER) {
ret = PTR_ERR(channel->vbus);
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs
2024-06-16 10:53 ` [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
@ 2024-07-02 11:27 ` Vinod Koul
0 siblings, 0 replies; 19+ messages in thread
From: Vinod Koul @ 2024-07-02 11:27 UTC (permalink / raw)
To: Biju Das
Cc: Yoshihiro Shimoda, Philipp Zabel, Rob Herring,
Krzysztof Kozlowski, Liam Girdwood, Mark Brown, Conor Dooley,
Kishon Vijay Abraham I, Geert Uytterhoeven, Magnus Damm,
devicetree, linux-phy, linux-renesas-soc, Prabhakar Mahadev Lad,
Biju Das
On 16-06-24, 11:53, Biju Das wrote:
> Use regulator_hardware_enable() for controlling VBUS enable for
> RZ/G2L alike SoCs in interrupt context.
Acked-by: Vinod Koul <vkoul@kernel.org>
--
~Vinod
^ permalink raw reply [flat|nested] 19+ messages in thread
* [PATCH v4 6/6] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
` (4 preceding siblings ...)
2024-06-16 10:53 ` [PATCH v4 5/6] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
@ 2024-06-16 10:53 ` Biju Das
2024-06-20 16:37 ` [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Vinod Koul
2024-06-27 11:17 ` (subset) " Mark Brown
7 siblings, 0 replies; 19+ messages in thread
From: Biju Das @ 2024-06-16 10:53 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Conor Dooley
Cc: Biju Das, Philipp Zabel, Liam Girdwood, Mark Brown,
Geert Uytterhoeven, Magnus Damm, devicetree, linux-phy,
linux-renesas-soc, Prabhakar Mahadev Lad, Biju Das
Replace the fixed regulator for USB VBUS.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
* Dropped regulator-{min,max}-microvolt
v2->v3:
* Upated label name
* Updated node and regulator name that matches with the bindings.
v1->v2:
* New patch.
---
arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi b/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi
index b7a3e6caa386..b34855956ae0 100644
--- a/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi
+++ b/arch/arm64/boot/dts/renesas/rz-smarc-common.dtsi
@@ -54,14 +54,6 @@ codec_dai: simple-audio-card,codec {
};
};
- usb0_vbus_otg: regulator-usb0-vbus-otg {
- compatible = "regulator-fixed";
-
- regulator-name = "USB0_VBUS_OTG";
- regulator-min-microvolt = <5000000>;
- regulator-max-microvolt = <5000000>;
- };
-
vccq_sdhi1: regulator-vccq-sdhi1 {
compatible = "regulator-gpio";
regulator-name = "SDHI1 VccQ";
@@ -139,6 +131,9 @@ &ohci1 {
&phyrst {
status = "okay";
+ usb0_vbus_otg: regulator-vbus {
+ regulator-name = "vbus";
+ };
};
&scif0 {
--
2.43.0
^ permalink raw reply related [flat|nested] 19+ messages in thread* Re: [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
` (5 preceding siblings ...)
2024-06-16 10:53 ` [PATCH v4 6/6] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Biju Das
@ 2024-06-20 16:37 ` Vinod Koul
2024-06-20 17:11 ` Biju Das
2024-06-27 11:17 ` (subset) " Mark Brown
7 siblings, 1 reply; 19+ messages in thread
From: Vinod Koul @ 2024-06-20 16:37 UTC (permalink / raw)
To: Biju Das
Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Kishon Vijay Abraham I,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Geert Uytterhoeven, Prabhakar Mahadev Lad, Biju Das, devicetree,
linux-phy, linux-renesas-soc
On 16-06-24, 11:53, Biju Das wrote:
> As per RZ/G2L HW manual, VBUS enable can be controlled by the VBOUT bit of
> the VBUS Control Register(VBENCTL) register in the USBPHY Control. But
> this IP is in the Reset block.
>
> Reset driver exposes this register as regmap and instantiate the USB VBUS
> regulator device. Consumers(phy device) can use regulator APIs to control
> VBUS as controlling is done in the atomic context.
>
> We need to have merge strategy which subsytem will apply this patches
> as it involves multiple subsystems Reset, Regulator, PHY, DT and Renesas
> SoC??
Why is there a dependency.. why cant they go thru respective trees?
--
~Vinod
^ permalink raw reply [flat|nested] 19+ messages in thread* RE: [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L
2024-06-20 16:37 ` [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Vinod Koul
@ 2024-06-20 17:11 ` Biju Das
0 siblings, 0 replies; 19+ messages in thread
From: Biju Das @ 2024-06-20 17:11 UTC (permalink / raw)
To: Vinod Koul
Cc: Philipp Zabel, Liam Girdwood, Mark Brown, Kishon Vijay Abraham I,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Geert Uytterhoeven, Prabhakar Mahadev Lad, biju.das.au,
devicetree@vger.kernel.org, linux-phy@lists.infradead.org,
linux-renesas-soc@vger.kernel.org
Hi Vinod,
Thanks for the feedback.
> -----Original Message-----
> From: Vinod Koul <vkoul@kernel.org>
> Sent: Thursday, June 20, 2024 5:38 PM
> Subject: Re: [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L
>
> On 16-06-24, 11:53, Biju Das wrote:
> > As per RZ/G2L HW manual, VBUS enable can be controlled by the VBOUT
> > bit of the VBUS Control Register(VBENCTL) register in the USBPHY
> > Control. But this IP is in the Reset block.
> >
> > Reset driver exposes this register as regmap and instantiate the USB
> > VBUS regulator device. Consumers(phy device) can use regulator APIs to
> > control VBUS as controlling is done in the atomic context.
> >
> > We need to have merge strategy which subsytem will apply this patches
> > as it involves multiple subsystems Reset, Regulator, PHY, DT and
> > Renesas SoC??
>
> Why is there a dependency.. why cant they go thru respective trees?
In this series, only regulator driver changes has no dependency.
PHY driver (phy-rcar-gen3-usb2.c) has a dependency on new regulator consumer API regulator_hardware_enable(),
Without this it will lead to compilation error.
USB PHY ctrl driver(reset-rzg2l-usbphy-ctrl.c) instantiate and bind regulator driver(renesas-usb-vbus-regulator.c).
If regulator driver is not there means, USB PHY ctrl driver probe() fails,
that will break existing USB functionality.
Cheers,
Biju
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: (subset) [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L
2024-06-16 10:53 [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Biju Das
` (6 preceding siblings ...)
2024-06-20 16:37 ` [PATCH v4 0/6] Add USB VBUS regulator for RZ/G2L Vinod Koul
@ 2024-06-27 11:17 ` Mark Brown
7 siblings, 0 replies; 19+ messages in thread
From: Mark Brown @ 2024-06-27 11:17 UTC (permalink / raw)
To: Philipp Zabel, Liam Girdwood, Vinod Koul, Kishon Vijay Abraham I,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Geert Uytterhoeven, Biju Das
Cc: Prabhakar Mahadev Lad, Biju Das, devicetree, linux-phy,
linux-renesas-soc
On Sun, 16 Jun 2024 11:53:52 +0100, Biju Das wrote:
> As per RZ/G2L HW manual, VBUS enable can be controlled by the VBOUT bit of
> the VBUS Control Register(VBENCTL) register in the USBPHY Control. But
> this IP is in the Reset block.
>
> Reset driver exposes this register as regmap and instantiate the USB VBUS
> regulator device. Consumers(phy device) can use regulator APIs to control
> VBUS as controlling is done in the atomic context.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next
Thanks!
[3/6] regulator: core: Add helper for allow HW access to enable/disable regulator
commit: 1cb7d29157603561af4c38535e936850ceb99f0f
[4/6] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
commit: 84fbd6198766336f627ba08f073fd9970729074e
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 19+ messages in thread