* [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements
@ 2024-07-29 15:34 Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 01/13] reset: rzg2l-usbphy-ctrl: Move reset controller registration Biju Das
` (14 more replies)
0 siblings, 15 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
This patch series aim to add below enhancements on RZ/G2L SoCs.
1) Add VBUS regulator to control vbus voltage
2) Update correct procedure for cleating Alarm
3) Fix lockdep assert warning on DMA driver
All the patches are cherry-picked from the mainline.
Biju Das (12):
reset: rzg2l-usbphy-ctrl: Move reset controller registration
regulator: core: Add helper for allow HW access to enable/disable
regulator
dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS
regulator
reset: renesas: Add USB VBUS regulator device as child
regulator: Add Renesas RZ/G2L USB VBUS regulator driver
regulator: renesas-usb-vbus-regulator: Update the default
phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs
arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS
dmaengine: sh: rz-dmac: Fix lockdep assert warning
dt-bindings: watchdog: dlg,da9062-watchdog: Drop blank space
rtc: isl1208: Add a delay for clearing alarm
rtc: isl1208: Update correct procedure for clearing alarm
Mark Brown (1):
regulator: Further restrict RZG2L USB VBCTRL regulator dependencies
.../reset/renesas,rzg2l-usbphy-ctrl.yaml | 10 +++
.../watchdog/dlg,da9062-watchdog.yaml | 2 +-
Documentation/power/regulator/consumer.rst | 6 ++
.../boot/dts/renesas/rz-smarc-common.dtsi | 11 +--
drivers/dma/sh/rz-dmac.c | 2 +-
drivers/phy/renesas/phy-rcar-gen3-usb2.c | 8 +-
drivers/regulator/Kconfig | 9 +++
drivers/regulator/Makefile | 1 +
drivers/regulator/core.c | 28 +++++++
.../regulator/renesas-usb-vbus-regulator.c | 74 +++++++++++++++++++
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 63 ++++++++++++----
drivers/rtc/rtc-isl1208.c | 25 +++++--
include/linux/regulator/consumer.h | 7 ++
13 files changed, 217 insertions(+), 29 deletions(-)
create mode 100644 drivers/regulator/renesas-usb-vbus-regulator.c
--
2.43.0
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 01/13] reset: rzg2l-usbphy-ctrl: Move reset controller registration
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
` (13 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit b081f13c11500bceb8ab504797a48cc7751de4b5 upstream.
As soon as the reset controller is registered, it could be used by a
reset consumer. That means hardware setup to be done first and then the
registration of the reset controller. So move the registration of reset
controller at the end of probe().
While at it, fix the issue that the reset is not re-asserted in case
devm_reset_controller_register() fails and also use goto statements to
simplify the error path in probe().
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240610164845.89666-1-biju.das.jz@bp.renesas.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 32 +++++++++++++++----------
1 file changed, 19 insertions(+), 13 deletions(-)
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index a8dde4606360..bea3270fb698 100644
--- a/drivers/reset/reset-rzg2l-usbphy-ctrl.c
+++ b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
@@ -125,25 +125,14 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
if (error)
return error;
- priv->rcdev.ops = &rzg2l_usbphy_ctrl_reset_ops;
- priv->rcdev.of_reset_n_cells = 1;
- priv->rcdev.nr_resets = NUM_PORTS;
- priv->rcdev.of_node = dev->of_node;
- priv->rcdev.dev = dev;
-
- error = devm_reset_controller_register(dev, &priv->rcdev);
- if (error)
- return error;
-
spin_lock_init(&priv->lock);
dev_set_drvdata(dev, priv);
pm_runtime_enable(&pdev->dev);
error = pm_runtime_resume_and_get(&pdev->dev);
if (error < 0) {
- pm_runtime_disable(&pdev->dev);
- reset_control_assert(priv->rstc);
- return dev_err_probe(&pdev->dev, error, "pm_runtime_resume_and_get failed");
+ dev_err_probe(&pdev->dev, error, "pm_runtime_resume_and_get failed");
+ goto err_pm_disable_reset_deassert;
}
/* put pll and phy into reset state */
@@ -153,7 +142,24 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
writel(val, priv->base + RESET);
spin_unlock_irqrestore(&priv->lock, flags);
+ priv->rcdev.ops = &rzg2l_usbphy_ctrl_reset_ops;
+ priv->rcdev.of_reset_n_cells = 1;
+ priv->rcdev.nr_resets = NUM_PORTS;
+ priv->rcdev.of_node = dev->of_node;
+ priv->rcdev.dev = dev;
+
+ error = devm_reset_controller_register(dev, &priv->rcdev);
+ if (error)
+ goto err_pm_runtime_put;
+
return 0;
+
+err_pm_runtime_put:
+ pm_runtime_put(&pdev->dev);
+err_pm_disable_reset_deassert:
+ pm_runtime_disable(&pdev->dev);
+ reset_control_assert(priv->rstc);
+ return error;
}
static int rzg2l_usbphy_ctrl_remove(struct platform_device *pdev)
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 01/13] reset: rzg2l-usbphy-ctrl: Move reset controller registration Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-30 12:28 ` Pavel Machek
2024-07-29 15:34 ` [PATCH 5.10.y-cip 03/13] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
` (12 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 1cb7d29157603561af4c38535e936850ceb99f0f upstream.
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>
Link: https://patch.msgid.link/20240616105402.45211-4-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
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 0cd8cc1275a7..ebc4c8076711 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 7082cffdd10e..c5b6979b2560 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3244,6 +3244,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 20e84a84fb77..42da800f86ff 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -268,6 +268,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,
@@ -565,6 +566,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] 22+ messages in thread
* [PATCH 5.10.y-cip 03/13] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 01/13] reset: rzg2l-usbphy-ctrl: Move reset controller registration Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 04/13] reset: renesas: Add USB VBUS regulator device as child Biju Das
` (11 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit f64f2d6fdda459b10bc8f774ed87e9980a5021e5 upstream.
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>
Link: https://lore.kernel.org/r/20240702180032.207275-2-biju.das.jz@bp.renesas.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../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 731b8ce01525..ca6a3002546e 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] 22+ messages in thread
* [PATCH 5.10.y-cip 04/13] reset: renesas: Add USB VBUS regulator device as child
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (2 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 03/13] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 05/13] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
` (10 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 4068f22e4b47f7352fc369c22800e04d2860416b upstream.
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>
Link: https://lore.kernel.org/r/20240702180032.207275-3-biju.das.jz@bp.renesas.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/reset/reset-rzg2l-usbphy-ctrl.c | 31 +++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/reset/reset-rzg2l-usbphy-ctrl.c b/drivers/reset/reset-rzg2l-usbphy-ctrl.c
index bea3270fb698..255c894a4782 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),
@@ -152,8 +168,22 @@ static int rzg2l_usbphy_ctrl_probe(struct platform_device *pdev)
if (error)
goto err_pm_runtime_put;
+ 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);
err_pm_disable_reset_deassert:
@@ -166,6 +196,7 @@ static int 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] 22+ messages in thread
* [PATCH 5.10.y-cip 05/13] regulator: Add Renesas RZ/G2L USB VBUS regulator driver
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (3 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 04/13] reset: renesas: Add USB VBUS regulator device as child Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 06/13] regulator: renesas-usb-vbus-regulator: Update the default Biju Das
` (9 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 84fbd6198766336f627ba08f073fd9970729074e upstream.
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>
Link: https://patch.msgid.link/20240616105402.45211-5-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
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 1420b12173a9..0bf6004bcbe2 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1232,6 +1232,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 25513b52d7dc..70c92ae6af34 100644
--- a/drivers/regulator/Makefile
+++ b/drivers/regulator/Makefile
@@ -149,6 +149,7 @@ obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
obj-$(CONFIG_REGULATOR_TPS65132) += tps65132-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] 22+ messages in thread
* [PATCH 5.10.y-cip 06/13] regulator: renesas-usb-vbus-regulator: Update the default
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (4 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 05/13] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 07/13] regulator: Further restrict RZG2L USB VBCTRL regulator dependencies Biju Das
` (8 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 7164122e25b18806f5dce68c8a0bdaa9e4f902a5 upstream.
As the "rzg2l-usb-vbus-regulator" platform device is only created by
drivers/reset/reset-rzg2l-usbphy-ctrl.c, update the default stricter by
replacing ARCH_RZG2L->RESET_RZG2L_USBPHY_CTRL.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reported-by: Geert Uytterhoeven <geert+renesas@glider.be>
Closes: https://lore.kernel.org/all/CAMuHMdX5ayWbLEEa6nAipECVB6H9eCpRg21pu3zYrTdiER0F+Q@mail.gmail.com/
Link: https://patch.msgid.link/20240715134120.312610-1-biju.das.jz@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/regulator/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 0bf6004bcbe2..75ccde6e8e64 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1237,7 +1237,7 @@ config REGULATOR_RZG2L_VBCTRL
depends on ARCH_RZG2L || COMPILE_TEST
depends on OF
select REGMAP_MMIO
- default ARCH_RZG2L
+ default RESET_RZG2L_USBPHY_CTRL
help
Support for VBUS regulators implemented on Renesas RZ/G2L SoCs.
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 07/13] regulator: Further restrict RZG2L USB VBCTRL regulator dependencies
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (5 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 06/13] regulator: renesas-usb-vbus-regulator: Update the default Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 08/13] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
` (7 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
From: Mark Brown <broonie@kernel.org>
commit e975d955c07cbc2cd6a83a5d8235d8373441fdb9 upstream.
Since the regulator can't be used without the USB controller also
tighten the dependency to match, as well as the default.
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://patch.msgid.link/20240726-regulator-restrict-rzg2l-v1-1-640e508896e2@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/regulator/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig
index 75ccde6e8e64..44821e2f70bd 100644
--- a/drivers/regulator/Kconfig
+++ b/drivers/regulator/Kconfig
@@ -1234,7 +1234,7 @@ config REGULATOR_UNIPHIER
config REGULATOR_RZG2L_VBCTRL
tristate "Renesas RZ/G2L USB VBUS regulator driver"
- depends on ARCH_RZG2L || COMPILE_TEST
+ depends on RESET_RZG2L_USBPHY_CTRL || COMPILE_TEST
depends on OF
select REGMAP_MMIO
default RESET_RZG2L_USBPHY_CTRL
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 08/13] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (6 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 07/13] regulator: Further restrict RZG2L USB VBCTRL regulator dependencies Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 09/13] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Biju Das
` (6 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 24843404efe47eab1ee88d7475a0be0f2f6fd9db upstream.
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>
Acked-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20240702180032.207275-4-biju.das.jz@bp.renesas.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
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 7e61c6b278a7..90756f6befb0 100644
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@ -190,6 +190,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;
}
@@ -720,7 +723,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] 22+ messages in thread
* [PATCH 5.10.y-cip 09/13] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (7 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 08/13] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 10/13] dmaengine: sh: rz-dmac: Fix lockdep assert warning Biju Das
` (5 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit c1267e1afae60e0b1d17d3a2e55515ecccb22a3e upstream.
Replace the fixed regulator for USB VBUS and use the proper one that
controls regulator based on VBUS detection.
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240702180032.207275-5-biju.das.jz@bp.renesas.com
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
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 48b839a6eae4..90b20324c5d1 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] 22+ messages in thread
* [PATCH 5.10.y-cip 10/13] dmaengine: sh: rz-dmac: Fix lockdep assert warning
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (8 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 09/13] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 11/13] dt-bindings: watchdog: dlg,da9062-watchdog: Drop blank space Biju Das
` (4 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 0e53aa3464e9a0a82bd3b926ba5999a11569c9ba upstream.
Fix the below lockdep assert warning by holding vc.lock for
vchan_get_all_descriptors().
WARNING: virt-dma.h:188 rz_dmac_terminate_all
pc : rz_dmac_terminate_all
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240625170119.173595-1-biju.das.jz@bp.renesas.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/dma/sh/rz-dmac.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index f777addda8ba..2d31c583508a 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -540,8 +540,8 @@ static int rz_dmac_terminate_all(struct dma_chan *chan)
spin_lock_irqsave(&channel->vc.lock, flags);
list_splice_tail_init(&channel->ld_active, &channel->ld_free);
list_splice_tail_init(&channel->ld_queue, &channel->ld_free);
- spin_unlock_irqrestore(&channel->vc.lock, flags);
vchan_get_all_descriptors(&channel->vc, &head);
+ spin_unlock_irqrestore(&channel->vc.lock, flags);
vchan_dma_desc_free_list(&channel->vc, &head);
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 11/13] dt-bindings: watchdog: dlg,da9062-watchdog: Drop blank space
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (9 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 10/13] dmaengine: sh: rz-dmac: Fix lockdep assert warning Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm Biju Das
` (3 subsequent siblings)
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 63d097d46799dc6ab4d1430482cd5ab6a409c4ec upstream.
Drop unnecessary blank space from binding documentation.
Reported-by: Pavel Machek <pavel@denx.de>
Closes: https://lore.kernel.org/all/ZpemkYsK6zQgGCF2@duo.ucw.cz/
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20240717115649.131914-1-biju.das.jz@bp.renesas.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
.../devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml b/Documentation/devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml
index f058628bb632..0fd1d4759e00 100644
--- a/Documentation/devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml
+++ b/Documentation/devicetree/bindings/watchdog/dlg,da9062-watchdog.yaml
@@ -24,7 +24,7 @@ properties:
Add this property to disable the watchdog during suspend.
Only use this option if you can't use the watchdog automatic suspend
function during a suspend (see register CONTROL_B).
-
+
dlg,wdt-sd:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1]
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (10 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 11/13] dt-bindings: watchdog: dlg,da9062-watchdog: Drop blank space Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-30 12:30 ` Pavel Machek
2024-07-29 15:34 ` [PATCH 5.10.y-cip 13/13] rtc: isl1208: Update correct procedure " Biju Das
` (2 subsequent siblings)
14 siblings, 1 reply; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 0dbd610c426ed695eef5d26584259d96b6250c76 upstream.
As per the latest HW manual[1], the INT# output is pulled low after the
alarm is triggered. After the INT# output is pulled low, it is low for at
least 250ms, even if the correct action is taken to clear it. It is
impossible to clear ALM if it is still active. The host must wait for the
RTC to progress past the alarm time plus the 250ms delay before clearing
ALM.
[1]https://www.renesas.com/us/en/document/dst/raa215300-datasheet?r=1506351
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20240618152635.48956-2-biju.das.jz@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/rtc/rtc-isl1208.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index 5b0a161f9552..c1824a76bc1c 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -7,6 +7,7 @@
#include <linux/bcd.h>
#include <linux/clk.h>
+#include <linux/delay.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_device.h>
@@ -628,6 +629,18 @@ isl1208_rtc_interrupt(int irq, void *data)
struct isl1208_state *isl1208 = i2c_get_clientdata(client);
int handled = 0, sr, err;
+ if (!isl1208->config->has_tamper) {
+ /*
+ * The INT# output is pulled low 250ms after the alarm is
+ * triggered. After the INT# output is pulled low, it is low for
+ * at least 250ms, even if the correct action is taken to clear
+ * it. It is impossible to clear ALM if it is still active. The
+ * host must wait for the RTC to progress past the alarm time
+ * plus the 250ms delay before clearing ALM.
+ */
+ msleep(250);
+ }
+
/*
* I2C reads get NAK'ed if we read straight away after an interrupt?
* Using a mdelay/msleep didn't seem to help either, so we work around
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 5.10.y-cip 13/13] rtc: isl1208: Update correct procedure for clearing alarm
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (11 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm Biju Das
@ 2024-07-29 15:34 ` Biju Das
2024-07-30 12:25 ` [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Pavel Machek
2024-07-31 10:07 ` Pavel Machek
14 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-29 15:34 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek; +Cc: Biju Das, Lad Prabhakar
commit 43696b3a9e46cf622bfeb70856b9b1cfa5a9fb23 upstream.
As per the latest HW manual[1], there is an internal delay(~250 microsec)
from setting ALME = 0 to disabling the alarm function, so the user must
add a short delay of greater than 250µs between setting ALME = 0 and
clearing ALM.
Currently setting of ALME = 0 is done after clearing the ALM, so just
reverse the operation and add a delay of 275 microsec.
[1]https://www.renesas.com/us/en/document/dst/raa215300-datasheet?r=1506351
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20240618152635.48956-3-biju.das.jz@bp.renesas.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
drivers/rtc/rtc-isl1208.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
index c1824a76bc1c..c92569ec4d9a 100644
--- a/drivers/rtc/rtc-isl1208.c
+++ b/drivers/rtc/rtc-isl1208.c
@@ -663,6 +663,13 @@ isl1208_rtc_interrupt(int irq, void *data)
rtc_update_irq(isl1208->rtc, 1, RTC_IRQF | RTC_AF);
+ /* Disable the alarm */
+ err = isl1208_rtc_toggle_alarm(client, 0);
+ if (err)
+ return err;
+
+ fsleep(275);
+
/* Clear the alarm */
sr &= ~ISL1208_REG_SR_ALM;
sr = i2c_smbus_write_byte_data(client, ISL1208_REG_SR, sr);
@@ -671,11 +678,6 @@ isl1208_rtc_interrupt(int irq, void *data)
__func__);
else
handled = 1;
-
- /* Disable the alarm */
- err = isl1208_rtc_toggle_alarm(client, 0);
- if (err)
- return err;
}
if (isl1208->config->has_tamper && (sr & ISL1208_REG_SR_EVT)) {
--
2.43.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (12 preceding siblings ...)
2024-07-29 15:34 ` [PATCH 5.10.y-cip 13/13] rtc: isl1208: Update correct procedure " Biju Das
@ 2024-07-30 12:25 ` Pavel Machek
2024-07-31 10:07 ` Pavel Machek
14 siblings, 0 replies; 22+ messages in thread
From: Pavel Machek @ 2024-07-30 12:25 UTC (permalink / raw)
To: Biju Das; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
Hi!
> This patch series aim to add below enhancements on RZ/G2L SoCs.
> 1) Add VBUS regulator to control vbus voltage
> 2) Update correct procedure for cleating Alarm
> 3) Fix lockdep assert warning on DMA driver
Looks good to me, both 5.10 and 6.1 versions. I can apply both if it
passes testing and there are no other comments.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-29 15:34 ` [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
@ 2024-07-30 12:28 ` Pavel Machek
2024-07-30 12:32 ` Biju Das
0 siblings, 1 reply; 22+ messages in thread
From: Pavel Machek @ 2024-07-30 12:28 UTC (permalink / raw)
To: Biju Das; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]
Hi!
> commit 1cb7d29157603561af4c38535e936850ceb99f0f upstream.
>
> 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>
> Link: https://patch.msgid.link/20240616105402.45211-4-biju.das.jz@bp.renesas.com
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> 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 0cd8cc1275a7..ebc4c8076711 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 7082cffdd10e..c5b6979b2560 100644
> --- a/drivers/regulator/core.c
> +++ b/drivers/regulator/core.c
> @@ -3244,6 +3244,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.
"Unlinke other functions, this can be called ...".
And fill in the blanks. "from interrupt context"? "with interrupts
disabled"? I'm not sure what real limits are. Probably can't do that
from NMI?
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm
2024-07-29 15:34 ` [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm Biju Das
@ 2024-07-30 12:30 ` Pavel Machek
2024-07-30 12:34 ` Biju Das
0 siblings, 1 reply; 22+ messages in thread
From: Pavel Machek @ 2024-07-30 12:30 UTC (permalink / raw)
To: Biju Das; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]
Hi!
> commit 0dbd610c426ed695eef5d26584259d96b6250c76 upstream.
>
> As per the latest HW manual[1], the INT# output is pulled low after the
> alarm is triggered. After the INT# output is pulled low, it is low for at
> least 250ms, even if the correct action is taken to clear it. It is
> impossible to clear ALM if it is still active. The host must wait for the
> RTC to progress past the alarm time plus the 250ms delay before clearing
> ALM.
> [1]https://www.renesas.com/us/en/document/dst/raa215300-datasheet?r=1506351
Ok, so this is kind of interesting. Yes, Renesas hw manual documents
250ms delay, but is that true for other chips? This seems to be
generic driver.
> +++ b/drivers/rtc/rtc-isl1208.c
> @@ -7,6 +7,7 @@
>
> #include <linux/bcd.h>
> #include <linux/clk.h>
> +#include <linux/delay.h>
> #include <linux/i2c.h>
> #include <linux/module.h>
> #include <linux/of_device.h>
> @@ -628,6 +629,18 @@ isl1208_rtc_interrupt(int irq, void *data)
> struct isl1208_state *isl1208 = i2c_get_clientdata(client);
> int handled = 0, sr, err;
>
> + if (!isl1208->config->has_tamper) {
> + /*
> + * The INT# output is pulled low 250ms after the alarm is
> + * triggered. After the INT# output is pulled low, it is low for
> + * at least 250ms, even if the correct action is taken to clear
> + * it. It is impossible to clear ALM if it is still active. The
> + * host must wait for the RTC to progress past the alarm time
> + * plus the 250ms delay before clearing ALM.
> + */
> + msleep(250);
> + }
Plus 250 msec in interrupt handler is strange. I guess this is i2c so
you can sleep, but... Plus I'd expect it to be conditional on we
having the alarm interrupt?
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-30 12:28 ` Pavel Machek
@ 2024-07-30 12:32 ` Biju Das
2024-07-31 10:06 ` Pavel Machek
0 siblings, 1 reply; 22+ messages in thread
From: Biju Das @ 2024-07-30 12:32 UTC (permalink / raw)
To: Pavel Machek
Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu,
Prabhakar Mahadev Lad
Hi Pavel,
Thanks for the feedback.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: Tuesday, July 30, 2024 1:28 PM
> enable/disable regulator
>
> Hi!
>
> > commit 1cb7d29157603561af4c38535e936850ceb99f0f upstream.
> >
> > 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>
> > Link:
> > https://patch.msgid.link/20240616105402.45211-4-biju.das.jz@bp.renesas
> > .com
> > Signed-off-by: Mark Brown <broonie@kernel.org>
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > 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 0cd8cc1275a7..ebc4c8076711 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
> > 7082cffdd10e..c5b6979b2560 100644
> > --- a/drivers/regulator/core.c
> > +++ b/drivers/regulator/core.c
> > @@ -3244,6 +3244,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.
>
> "Unlinke other functions, this can be called ...".
>
> And fill in the blanks. "from interrupt context"? "with interrupts disabled"? I'm not sure what real
> limits are. Probably can't do that from NMI?
From interrupt context provided the callback function does not uses any sleeping calls.
Cheers,
Biju
>
> Best regards,
> Pavel
> --
> DENX Software Engineering GmbH, Managing Director: Erika Unter
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm
2024-07-30 12:30 ` Pavel Machek
@ 2024-07-30 12:34 ` Biju Das
0 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-30 12:34 UTC (permalink / raw)
To: Pavel Machek
Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu,
Prabhakar Mahadev Lad
Hi Pavel Machek,
Thanks for the feedback.
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: Tuesday, July 30, 2024 1:31 PM
> Subject: Re: [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm
>
> Hi!
>
> > commit 0dbd610c426ed695eef5d26584259d96b6250c76 upstream.
> >
> > As per the latest HW manual[1], the INT# output is pulled low after
> > the alarm is triggered. After the INT# output is pulled low, it is low
> > for at least 250ms, even if the correct action is taken to clear it.
> > It is impossible to clear ALM if it is still active. The host must
> > wait for the RTC to progress past the alarm time plus the 250ms delay
> > before clearing ALM.
>
> > [1]https://www.renesas.com/us/en/document/dst/raa215300-datasheet?r=15
> > 06351
>
> Ok, so this is kind of interesting. Yes, Renesas hw manual documents 250ms delay, but is that true for
> other chips? This seems to be generic driver.
I believe so, that is the reason there is a work around in interrupt handler.
>
> > +++ b/drivers/rtc/rtc-isl1208.c
> > @@ -7,6 +7,7 @@
> >
> > #include <linux/bcd.h>
> > #include <linux/clk.h>
> > +#include <linux/delay.h>
> > #include <linux/i2c.h>
> > #include <linux/module.h>
> > #include <linux/of_device.h>
> > @@ -628,6 +629,18 @@ isl1208_rtc_interrupt(int irq, void *data)
> > struct isl1208_state *isl1208 = i2c_get_clientdata(client);
> > int handled = 0, sr, err;
> >
> > + if (!isl1208->config->has_tamper) {
> > + /*
> > + * The INT# output is pulled low 250ms after the alarm is
> > + * triggered. After the INT# output is pulled low, it is low for
> > + * at least 250ms, even if the correct action is taken to clear
> > + * it. It is impossible to clear ALM if it is still active. The
> > + * host must wait for the RTC to progress past the alarm time
> > + * plus the 250ms delay before clearing ALM.
> > + */
> > + msleep(250);
> > + }
>
> Plus 250 msec in interrupt handler is strange. I guess this is i2c so you can sleep, but... Plus I'd
> expect it to be conditional on we having the alarm interrupt?
It should be fine as it is threaded irq.
Cheers,
Biju
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-30 12:32 ` Biju Das
@ 2024-07-31 10:06 ` Pavel Machek
2024-07-31 13:08 ` Biju Das
0 siblings, 1 reply; 22+ messages in thread
From: Pavel Machek @ 2024-07-31 10:06 UTC (permalink / raw)
To: Biju Das
Cc: Pavel Machek, cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu,
Prabhakar Mahadev Lad
[-- Attachment #1: Type: text/plain, Size: 1166 bytes --]
Hi!
> > > +++ b/drivers/regulator/core.c
> > > @@ -3244,6 +3244,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.
> >
> > "Unlinke other functions, this can be called ...".
> >
> > And fill in the blanks. "from interrupt context"? "with interrupts disabled"? I'm not sure what real
> > limits are. Probably can't do that from NMI?
>
> From interrupt context provided the callback function does not uses any sleeping calls.
So the contexts allowed differ based on what low-level driver is used?
That's quite unfortunate...
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
` (13 preceding siblings ...)
2024-07-30 12:25 ` [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Pavel Machek
@ 2024-07-31 10:07 ` Pavel Machek
14 siblings, 0 replies; 22+ messages in thread
From: Pavel Machek @ 2024-07-31 10:07 UTC (permalink / raw)
To: Biju Das; +Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Lad Prabhakar
[-- Attachment #1: Type: text/plain, Size: 550 bytes --]
Hi!
> This patch series aim to add below enhancements on RZ/G2L SoCs.
> 1) Add VBUS regulator to control vbus voltage
> 2) Update correct procedure for cleating Alarm
> 3) Fix lockdep assert warning on DMA driver
>
> All the patches are cherry-picked from the mainline.
Thank you, applied.
I tried testing 6.1 version, but gitlab did not cooperate there.
Best regards,
Pavel
--
DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 22+ messages in thread
* RE: [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator
2024-07-31 10:06 ` Pavel Machek
@ 2024-07-31 13:08 ` Biju Das
0 siblings, 0 replies; 22+ messages in thread
From: Biju Das @ 2024-07-31 13:08 UTC (permalink / raw)
To: Pavel Machek
Cc: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu,
Prabhakar Mahadev Lad
Hi Pavel,
> -----Original Message-----
> From: Pavel Machek <pavel@denx.de>
> Sent: Wednesday, July 31, 2024 11:06 AM
> Subject: Re: [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for
> allow HW access to enable/disable regulator
>
> Hi!
>
> > > > +++ b/drivers/regulator/core.c
> > > > @@ -3244,6 +3244,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.
> > >
> > > "Unlinke other functions, this can be called ...".
> > >
> > > And fill in the blanks. "from interrupt context"? "with interrupts
> > > disabled"? I'm not sure what real limits are. Probably can't do that
> from NMI?
> >
> > From interrupt context provided the callback function does not uses any
> sleeping calls.
>
> So the contexts allowed differ based on what low-level driver is used?
> That's quite unfortunate...
The only limitation is it has to be exclusive usage. Other than that it is for generic usage.
Ie, can be used for regulator_gpio_enable or regulator_regmap_enable()
Currently regulator API won't allow you to enable or disable() in atomic context.
But this API allows to you do that.
Cheers,
Biju
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2024-07-31 13:08 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-29 15:34 [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 01/13] reset: rzg2l-usbphy-ctrl: Move reset controller registration Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 02/13] regulator: core: Add helper for allow HW access to enable/disable regulator Biju Das
2024-07-30 12:28 ` Pavel Machek
2024-07-30 12:32 ` Biju Das
2024-07-31 10:06 ` Pavel Machek
2024-07-31 13:08 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 03/13] dt-bindings: reset: renesas,rzg2l-usbphy-ctrl: Document USB VBUS regulator Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 04/13] reset: renesas: Add USB VBUS regulator device as child Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 05/13] regulator: Add Renesas RZ/G2L USB VBUS regulator driver Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 06/13] regulator: renesas-usb-vbus-regulator: Update the default Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 07/13] regulator: Further restrict RZG2L USB VBCTRL regulator dependencies Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 08/13] phy: renesas: phy-rcar-gen3-usb2: Control VBUS for RZ/G2L SoCs Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 09/13] arm64: dts: renesas: rz-smarc: Replace fixed regulator for USB VBUS Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 10/13] dmaengine: sh: rz-dmac: Fix lockdep assert warning Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 11/13] dt-bindings: watchdog: dlg,da9062-watchdog: Drop blank space Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 12/13] rtc: isl1208: Add a delay for clearing alarm Biju Das
2024-07-30 12:30 ` Pavel Machek
2024-07-30 12:34 ` Biju Das
2024-07-29 15:34 ` [PATCH 5.10.y-cip 13/13] rtc: isl1208: Update correct procedure " Biju Das
2024-07-30 12:25 ` [PATCH 5.10.y-cip 00/13] RZ/G2L enhancements Pavel Machek
2024-07-31 10:07 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox