RZ/{G2L, G2LC, G2UL, G3S, Five, V2L}: Backport MSTOP support
Subsystems (16)
v3 cover RZ/{G2L, G2LC, G2UL, G3S, Five, V2L}: Backport MSTOP support
From: Claudiu Beznea <[email protected]>
Hi,
Series backports the MSTOP (Module Stop) support for the Renesas RZ/G2L, RZ/G2LC, RZ/G2UL, RZ/G3S, RZ/Five, RZ/V2L SoCs.
The purpose of MSTOP is to reduce power consumption by stopping unnecessary module's functions.
If any master accesses a module that has the clock stopped and the MSTOP bit set, a bus error will occur.
Due to this, to avoid CPU generating synchronous aborts, changes to PM domain specific code were needed. The changes backported in this series were adjusted to be executed only for the above mentioned Renesas SoCs.
Please share your thoughts on this approach.
Thank you,
Claudiu
Changes in v3:
- kept RZ/G3S TSU clock as it is now integrated in v5.10 CIP
Changes in v2:
- dropped patches:
-- rpmsg: core: Drop dev_pm_domain_detach() call -- soundwire: bus: Drop dev_pm_domain_detach() call -- serdev: Drop dev_pm_domain_detach() call
-- clk: renesas: r9a07g04[34]: Use tabs instead of spaces
Claudiu Beznea (17):
PM: domains: Add flags to specify power on attach/detach
PM: domains: Add helper to check for PM domain detach on unbind
cleanup
PM: domains: Detach on device_unbind_cleanup()
driver core: platform: Drop dev_pm_domain_detach() call
mmc: sdio: Drop dev_pm_domain_detach() call
spi: Drop dev_pm_domain_detach() call
i2c: core: Drop dev_pm_domain_detach() call
clk: renesas: rzg2l: Extend power domain support
clk: renesas: rzg2l: Postpone updating priv->clks[]
clk: renesas: rzg2l: Move pointers after hw member
clk: renesas: rzg2l: Add macro to loop through module clocks
clk: renesas: rzg2l: Add support for MSTOP in clock enable/disable API
clk: renesas: r9a08g045: Drop power domain instantiation
clk: renesas: r9a08g045: Add MSTOP for coupled clocks as well
clk: renesas: r9a08g045: Add MSTOP for GPIO
clk: renesas: r9a07g044: Add MSTOP for RZ/G2L
clk: renesas: r9a07g043: Add MSTOP for RZ/G2UL
Michael Ellerman (1):
of: Add of_machine_compatible_match()
drivers/amba/bus.c | 4 +- drivers/base/dd.c | 7 + drivers/base/platform.c | 8 +- drivers/base/power/common.c | 29 ++- drivers/clk/renesas/r9a07g043-cpg.c | 132 ++++++------- drivers/clk/renesas/r9a07g044-cpg.c | 168 ++++++++-------- drivers/clk/renesas/r9a08g045-cpg.c | 142 +++++++++----- drivers/clk/renesas/r9a09g011-cpg.c | 92 ++++----- drivers/clk/renesas/rzg2l-cpg.c | 285 ++++++++++++++++++++++++++-- drivers/clk/renesas/rzg2l-cpg.h | 28 ++- drivers/i2c/i2c-core-base.c | 9 +- drivers/mmc/core/sdio_bus.c | 8 +- drivers/of/base.c | 21 ++ drivers/rpmsg/rpmsg_core.c | 2 +- drivers/soundwire/bus_type.c | 2 +- drivers/spi/spi.c | 8 +- drivers/tty/serdev/core.c | 2 +- include/linux/of.h | 6 + include/linux/pm.h | 1 + include/linux/pm_domain.h | 20 +- 20 files changed, 688 insertions(+), 286 deletions(-)
Signature · 1 line
2.43.0
PATCH v3 1/18 PM: domains: Add flags to specify power on attach/detach
From: Claudiu Beznea <[email protected]>
commit d42c7c6fd66a6e2a78ae1da666c5df6c2fde8389 upstream.
Calling dev_pm_domain_attach()/dev_pm_domain_detach() in bus driver probe/remove functions can affect system behavior when the drivers attached to the bus use devres-managed resources. Since devres actions may need to access device registers, calling dev_pm_domain_detach() too early, i.e., before these actions complete, can cause failures on some systems. One such example is Renesas RZ/G3S SoC-based platforms.
If the device clocks are managed via PM domains, invoking dev_pm_domain_detach() in the bus driver's remove function removes the device's clocks from the PM domain, preventing any subsequent pm_runtime_resume*() calls from enabling those clocks.
The second argument of dev_pm_domain_attach() specifies whether the PM domain should be powered on during attachment. Likewise, the second argument of dev_pm_domain_detach() indicates whether the domain should be powered off during detachment.
Upcoming changes address the issue described above (initially for the platform bus only) by deferring the call to dev_pm_domain_detach() until after devres_release_all() in device_unbind_cleanup(). The detach_power_off field in struct dev_pm_info stores the detach power off info from the second argument of dev_pm_domain_attach().
Because there are cases where the device's PM domain power-on/off behavior must be conditional (e.g., in i2c_device_probe()), the patch introduces PD_FLAG_ATTACH_POWER_ON and PD_FLAG_DETACH_POWER_OFF flags to be passed to dev_pm_domain_attach().
Finally, dev_pm_domain_attach() and its users are updated to use the newly introduced PD_FLAG_ATTACH_POWER_ON and PD_FLAG_DETACH_POWER_OFF macros.
This change is preparatory.
[claudiu.beznea:
- fix confclit in amba bus by keeing v5.10 CIP code
- drop auxiliary bus code as it is not in v5.10 CIP
- keep the code from v5.10 and add PD flags for platform bus
- removed apcs-sdx55.c, drm_dp_aux_bus.c
- for i2c-core kept the v5.10 CIP variant and add PD_FLAG_ATTACH_POWER_ON to it
- for pm_domain.h fix conflict by keeping only PD_FLAG_ATTACH_POWER_ON, PD_FLAG_ATTACH_POWER_OFF flags]
--- drivers/amba/bus.c | 4 ++-- drivers/base/platform.c | 2 +- drivers/base/power/common.c | 6 +++--- drivers/i2c/i2c-core-base.c | 2 +- drivers/mmc/core/sdio_bus.c | 2 +- drivers/rpmsg/rpmsg_core.c | 2 +- drivers/soundwire/bus_type.c | 2 +- drivers/spi/spi.c | 2 +- drivers/tty/serdev/core.c | 2 +- include/linux/pm_domain.h | 15 +++++++++++++-- 10 files changed, 25 insertions(+), 14 deletions(-)
drivers/amba/bus.c +2 -2
@@ -266,7 +266,7 @@ static int amba_probe(struct device *dev)if (ret <0 )break ; - ret =dev_pm_domain_attach (dev, true); + ret =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON );if (ret)break ;
@@ -394,7 +394,7 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent) goto err_release; } - ret =dev_pm_domain_attach (&dev->dev, true); + ret =dev_pm_domain_attach (&dev->dev,PD_FLAG_ATTACH_POWER_ON );if (ret) {iounmap (tmp); goto err_release;
drivers/base/platform.c +1 -1
@@ -753,7 +753,7 @@ static int platform_drv_probe(struct device *_dev)if (ret <0 )return ret; - ret =dev_pm_domain_attach (_dev, true); + ret =dev_pm_domain_attach (_dev,PD_FLAG_ATTACH_POWER_ON );if (ret) goto out;
drivers/base/power/common.c +3 -3
@@ -82,7 +82,7 @@ EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);/** * dev_pm_domain_attach - Attach a device to its PM domain. * @dev: Device to attach. -* @power_on: Used to indicate whether we should power on the device. +* @flags: indicate whether we should power on/off the device on attach/detach * * The @dev may only be attached to a single PM domain. By iterating through * the available alternatives we try to find a valid PM domain for the device.
@@ -99,14 +99,14 @@ EXPORT_SYMBOL_GPL(dev_pm_put_subsys_data);* Returns 0 on successfully attached PM domain, or when it is found that the * device doesn't need a PM domain, else a negative error code. */ -int dev_pm_domain_attach (struct device *dev,bool power_on) +int dev_pm_domain_attach (struct device *dev,u32 flags) {int ret;if (dev->pm_domain)return 0 ; - ret =acpi_dev_pm_attach (dev, power_on); + ret =acpi_dev_pm_attach (dev, !!(flags &PD_FLAG_ATTACH_POWER_ON ));if (!ret) ret =genpd_dev_pm_attach (dev);
drivers/i2c/i2c-core-base.c +1 -1
@@ -535,7 +535,7 @@ static int i2c_device_probe(struct device *dev)if (status <0 ) goto err_clear_wakeup_irq; - status =dev_pm_domain_attach (&client->dev, true); + status =dev_pm_domain_attach (&client->dev,PD_FLAG_ATTACH_POWER_ON );if (status) goto err_clear_wakeup_irq;
drivers/mmc/core/sdio_bus.c +1 -1
@@ -160,7 +160,7 @@ static int sdio_bus_probe(struct device *dev)if (!id)return -ENODEV ; - ret =dev_pm_domain_attach (dev, false); + ret =dev_pm_domain_attach (dev,0 );if (ret)return ret;
drivers/rpmsg/rpmsg_core.c +1 -1
@@ -451,7 +451,7 @@ static int rpmsg_dev_probe(struct device *dev)struct rpmsg_endpoint *ept =NULL ;int err; - err =dev_pm_domain_attach (dev, true); + err =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON );if (err) goto out;
drivers/soundwire/bus_type.c +1 -1
@@ -102,7 +102,7 @@ static int sdw_drv_probe(struct device *dev)/* * attach to power domain but don't turn on (last arg) */ - ret =dev_pm_domain_attach (dev, false); + ret =dev_pm_domain_attach (dev,0 );if (ret)return ret;
drivers/spi/spi.c +1 -1
@@ -407,7 +407,7 @@ static int spi_drv_probe(struct device *dev) spi->irq =0 ; } - ret =dev_pm_domain_attach (dev, true); + ret =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON );if (ret)return ret;
drivers/tty/serdev/core.c +1 -1
@@ -410,7 +410,7 @@ static int serdev_drv_probe(struct device *dev)const struct serdev_device_driver *sdrv =to_serdev_device_driver (dev->driver);int ret; - ret =dev_pm_domain_attach (dev, true); + ret =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON );if (ret)return ret;
include/linux/pm_domain.h +13 -2
@@ -17,6 +17,17 @@#include <linux/spinlock.h> #include <linux/cpumask.h> +/* +* Flags to control the behaviour when attaching a device to its PM domains. +* +* PD_FLAG_ATTACH_POWER_ON: Power on the domain during attach. +* +* PD_FLAG_DETACH_POWER_OFF: Power off the domain during detach. +* +*/ +#define PD_FLAG_ATTACH_POWER_ON BIT(3) +#define PD_FLAG_DETACH_POWER_OFF BIT(4) +/* * Flags to control the behaviour of a genpd. *
@@ -392,7 +403,7 @@ struct generic_pm_domain *of_genpd_remove_last(struct device_node *np)#endif /* CONFIG_PM_GENERIC_DOMAINS_OF */ #ifdef CONFIG_PM -int dev_pm_domain_attach (struct device *dev,bool power_on); +int dev_pm_domain_attach (struct device *dev,u32 flags);struct device *dev_pm_domain_attach_by_id (struct device *dev,unsigned int index); struct device *dev_pm_domain_attach_by_name(struct device *dev,
@@ -401,7 +412,7 @@ void dev_pm_domain_detach(struct device *dev, bool power_off);int dev_pm_domain_start (struct device *dev);void dev_pm_domain_set (struct device *dev,struct dev_pm_domain *pd);#else -static inline int dev_pm_domain_attach (struct device *dev,bool power_on) +static inline int dev_pm_domain_attach (struct device *dev,u32 flags) {return 0 ; }
Signature · 1 line
2.43.0
PATCH v3 2/18 of: Add of_machine_compatible_match()
In reply to ClaudiuFrom: Michael Ellerman <[email protected]>
commit c029b22f8a98e14988f800d5c0176a9eaec3c8db upstream.
We have of_machine_is_compatible() to check if a machine is compatible with a single compatible string. However some code is able to support multiple compatible boards, and so wants to check for one of many compatible strings.
So add of_machine_compatible_match() which takes a NULL terminated array of compatible strings to check against the root node's compatible property.
Compared to an open coded match this is slightly more self documenting, and also avoids the caller needing to juggle the root node either directly or via of_find_node_by_path().
--- drivers/of/base.c | 21 +++++++++++++++++++++ include/linux/of.h | 6 ++++++ 2 files changed, 27 insertions(+)
drivers/of/base.c +21 -0
@@ -557,6 +557,27 @@ int of_device_compatible_match(struct device_node *device,return score; } +/** +* of_machine_compatible_match - Test root of device tree against a compatible array +* @compats: NULL terminated array of compatible strings to look for in root node's compatible property. +* +* Returns true if the root node has any of the given compatible values in its +* compatible property. +*/ +bool of_machine_compatible_match (const char *const *compats) +{ +struct device_node *root; +int rc =0 ; + + root =of_find_node_by_path ("/" ); +if (root) { + rc =of_device_compatible_match (root, compats); +of_node_put (root); + } + +return rc !=0 ; +} +/** * of_machine_is_compatible - Test root of device tree for a given compatible value * @compat: compatible string to look for in root node's compatible property.
include/linux/of.h +6 -0
@@ -398,6 +398,7 @@ extern int of_alias_get_alias_list(const struct of_device_id *matches, unsigned int nbits);extern int of_machine_is_compatible (const char *compat); +bool of_machine_compatible_match (const char *const *compats);extern int of_add_property (struct device_node *np,struct property *prop);extern int of_remove_property (struct device_node *np,struct property *prop);
@@ -794,6 +795,11 @@ static inline int of_remove_property(struct device_node *np, struct property *prreturn 0 ; } +static inline bool of_machine_compatible_match (const char *const *compats) +{ +return false; +} +static inline bool of_console_check (const struct device_node *dn,const char *name,int index) {return false;
Signature · 1 line
2.43.0
PATCH v3 3/18 PM: domains: Add helper to check for PM domain detach on unbind cleanup
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
Add helper to check if PM domain detach is allowed in device_unbind_cleanup(). This is necessary to avoid issues when unbinding as decribed in commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()").
--- drivers/base/power/common.c | 20 ++++++++++++++++++++ include/linux/pm_domain.h | 5 +++++ 2 files changed, 25 insertions(+)
drivers/base/power/common.c +20 -0
@@ -228,3 +228,23 @@ void dev_pm_domain_set(struct device *dev, struct dev_pm_domain *pd)device_pm_check_callbacks (dev); }EXPORT_SYMBOL_GPL (dev_pm_domain_set); + +/** +* dev_pm_domain_allow_detach_on_unbind_cleanup - Check if PM domain +* detach during the unbind cleanup driver remove phase is permitted. +* +* Returns true if allowed, false otherwise +*/ +bool dev_pm_domain_allow_detach_on_unbind_cleanup (void ) +{ +static const char *const pm_detach_allow_list[] = { +"renesas,r9a07g043" ,/* Renesas RZ/{G2UL, Five} */ +"renesas,r9a07g044" ,/* Renesas RZ/G2{L, LC} */ +"renesas,r9a07g054" ,/* Renesas RZ/V2L */ +"renesas,r9a08g045" ,/* Renesas RZ/G3S */ +NULL + }; + +return of_machine_compatible_match (pm_detach_allow_list); +} +EXPORT_SYMBOL_GPL (dev_pm_domain_allow_detach_on_unbind_cleanup);
include/linux/pm_domain.h +5 -0
@@ -411,6 +411,7 @@ struct device *dev_pm_domain_attach_by_name(struct device *dev,void dev_pm_domain_detach (struct device *dev,bool power_off);int dev_pm_domain_start (struct device *dev);void dev_pm_domain_set (struct device *dev,struct dev_pm_domain *pd); +bool dev_pm_domain_allow_detach_on_unbind_cleanup (void );#else static inline int dev_pm_domain_attach (struct device *dev,u32 flags) {
@@ -433,6 +434,10 @@ static inline int dev_pm_domain_start(struct device *dev) }static inline void dev_pm_domain_set (struct device *dev,struct dev_pm_domain *pd) {} +static bool dev_pm_domain_allow_detach_on_unbind_cleanup (void ) +{ +return false; +}#endif #endif /* _LINUX_PM_DOMAIN_H */
Signature · 1 line
2.43.0
PATCH v3 4/18 PM: domains: Detach on device_unbind_cleanup()
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit f99508074e78fea17f06d753d9ef453b174ec98e upstream.
The dev_pm_domain_attach() function is typically used in bus code alongside dev_pm_domain_detach(), often following patterns like:
static int bus_probe(struct device *_dev)
{
struct bus_driver *drv = to_bus_driver(dev->driver);
struct bus_device *dev = to_bus_device(_dev);
int ret;
// ...
ret = dev_pm_domain_attach(_dev, true);
if (ret)
return ret;
if (drv->probe)
ret = drv->probe(dev);
// ...
}static void bus_remove(struct device *_dev)
{
struct bus_driver *drv = to_bus_driver(dev->driver);
struct bus_device *dev = to_bus_device(_dev);
if (drv->remove)
drv->remove(dev);
dev_pm_domain_detach(_dev);
}When the driver's probe function uses devres-managed resources that depend on the power domain state, those resources are released later during device_unbind_cleanup().
Releasing devres-managed resources that depend on the power domain state after detaching the device from its PM domain can cause failures.
For example, if the driver uses devm_pm_runtime_enable() in its probe function, and the device's clocks are managed by the PM domain, then during removal the runtime PM is disabled in device_unbind_cleanup() after the clocks have been removed from the PM domain. It may happen that the devm_pm_runtime_enable() action causes the device to be runtime- resumed. If the driver specific runtime PM APIs access registers directly, this will lead to accessing device registers without clocks being enabled. Similar issues may occur with other devres actions that access device registers.
Add detach_power_off member to struct dev_pm_info, to be used later in device_unbind_cleanup() as the power_off argument for dev_pm_domain_detach(). This is a preparatory step toward removing dev_pm_domain_detach() calls from bus remove functions. Since the current PM domain detach functions (genpd_dev_pm_detach() and acpi_dev_pm_detach()) already set dev->pm_domain = NULL, there should be no issues with bus drivers that still call dev_pm_domain_detach() in their remove functions.
--- drivers/base/dd.c | 7 +++++++ drivers/base/power/common.c | 3 +++ include/linux/pm.h | 1 + 3 files changed, 11 insertions(+)
drivers/base/dd.c +7 -0
@@ -25,6 +25,7 @@#include <linux/kthread.h> #include <linux/wait.h> #include <linux/async.h> +#include <linux/pm_domain.h> #include <linux/pm_runtime.h> #include <linux/pinctrl/devinfo.h> #include <linux/slab.h>
@@ -596,6 +597,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)driver_sysfs_remove (dev); dev->driver =NULL ;dev_set_drvdata (dev,NULL ); +if (dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, dev->power.detach_power_off);if (dev->pm_domain && dev->pm_domain->dismiss) dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);
@@ -634,6 +637,8 @@ static int really_probe(struct device *dev, struct device_driver *drv)driver_sysfs_remove (dev); dev->driver =NULL ;dev_set_drvdata (dev,NULL ); +if (dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, dev->power.detach_power_off);if (dev->pm_domain && dev->pm_domain->dismiss) dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);
@@ -1193,6 +1198,8 @@ static void __device_release_driver(struct device *dev, struct device *parent) dev->dma_range_map =NULL ; dev->driver =NULL ;dev_set_drvdata (dev,NULL ); +if (dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, dev->power.detach_power_off);if (dev->pm_domain && dev->pm_domain->dismiss) dev->pm_domain->dismiss (dev);pm_runtime_reinit (dev);
drivers/base/power/common.c +3 -0
@@ -110,6 +110,9 @@ int dev_pm_domain_attach(struct device *dev, u32 flags)if (!ret) ret =genpd_dev_pm_attach (dev); +if (dev->pm_domain) + dev->power.detach_power_off = !!(flags &PD_FLAG_DETACH_POWER_OFF ); +return ret <0 ? ret :0 ; }EXPORT_SYMBOL_GPL (dev_pm_domain_attach);
include/linux/pm.h +1 -0
@@ -621,6 +621,7 @@ struct dev_pm_info {struct pm_subsys_data *subsys_data;/* Owned by the subsystem. */ void (*set_latency_tolerance)(struct device *,s32 );struct dev_pm_qos *qos; + bool detach_power_off:1; /* Owned by the driver core */ };extern int dev_pm_get_subsys_data (struct device *dev);
Signature · 1 line
2.43.0
PATCH v3 5/18 driver core: platform: Drop dev_pm_domain_detach() call
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit ba2ebd52a22eb7306a2093924920a125ad91215a upstream.
On the Renesas RZ/G3S (and other Renesas SoCs, e.g., RZ/G2{L, LC, UL}), clocks are managed through PM domains. These PM domains, registered on behalf of the clock controller driver, are configured with GENPD_FLAG_PM_CLK. In most of the Renesas drivers used by RZ SoCs, the clocks are enabled/disabled using runtime PM APIs. The power domains may also have power_on/power_off support implemented. After the device PM domain is powered off any CPU accesses to these domains leads to system aborts.
During probe, devices are attached to the PM domain controlling their clocks and power. Similarly, during removal, devices are detached from the PM domain.
The detachment call stack is as follows:
device_driver_detach() ->
device_release_driver_internal() ->
__device_release_driver() ->
device_remove() ->
platform_remove() ->
dev_pm_domain_detach()During driver unbind, after the device is detached from its PM domain, the device_unbind_cleanup() function is called, which subsequently invokes devres_release_all(). This function handles devres resource cleanup.
If runtime PM is enabled in driver probe via devm_pm_runtime_enable(), the cleanup process triggers the action or reset function for disabling runtime PM. This function is pm_runtime_disable_action(), which leads to the following call stack of interest when called:
pm_runtime_disable_action() ->
pm_runtime_dont_use_autosuspend() ->
__pm_runtime_use_autosuspend() ->
update_autosuspend() ->
rpm_idle()The rpm_idle() function attempts to resume the device at runtime. However, at the point it is called, the device is no longer part of a PM domain (which manages clocks and power states). If the driver implements its own runtime PM APIs for specific functionalities - such as the rzg2l_adc driver - while also relying on the power domain subsystem for power management, rpm_idle() will invoke the driver's runtime PM API. However, since the device is no longer part of a PM domain at this point, the PM domain's runtime PM APIs will not be called. This leads to system aborts on Renesas SoCs.
Another identified case is when a subsystem performs various cleanups using device_unbind_cleanup(), calling driver-specific APIs in the process. A known example is the thermal subsystem, which may call driver- specific APIs to disable the thermal device. The relevant call stack in this case is:
device_driver_detach() ->
device_release_driver_internal() ->
device_unbind_cleanup() ->
devres_release_all() ->
devm_thermal_of_zone_release() ->
thermal_zone_device_disable() ->
thermal_zone_device_set_mode() ->
struct thermal_zone_device_ops::change_mode()At the moment the driver-specific change_mode() API is called, the device is no longer part of its PM domain. Accessing its registers without proper power management leads to system aborts.
Drop the call to dev_pm_domain_detach() from the platform bus remove function and rely on the newly introduced call in device_unbind_cleanup().
This ensures the same effect, but the call now occurs after all driver-specific devres resources have been freed.
[claudiu.beznea:
- fixed conflict in platform.c by keeping v5.10 CIP code
- manually adjust the dev_pm_domain_attach() and dev_pm_domain_detach() calls
- conditionally call dev_pm_domain_detach()]
--- drivers/base/platform.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/platform.c +5 -3
@@ -753,13 +753,14 @@ static int platform_drv_probe(struct device *_dev)if (ret <0 )return ret; - ret =dev_pm_domain_attach (_dev,PD_FLAG_ATTACH_POWER_ON ); + ret =dev_pm_domain_attach (_dev,PD_FLAG_ATTACH_POWER_ON | +PD_FLAG_DETACH_POWER_OFF );if (ret) goto out;if (drv->probe) { ret = drv->probe (dev); -if (ret) +if (ret && !dev_pm_domain_allow_detach_on_unbind_cleanup ())dev_pm_domain_detach (_dev, true); }
@@ -785,7 +786,8 @@ static int platform_drv_remove(struct device *_dev)if (drv->remove) ret = drv->remove (dev); -dev_pm_domain_detach (_dev, true); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (_dev, true);return ret; }
Signature · 1 line
2.43.0
PATCH v3 6/18 mmc: sdio: Drop dev_pm_domain_detach() call
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit c2ef7a03f5c8f0a612a8beff666483b725adf8fc upstream.
Starting with commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()"), there is no longer a need to call dev_pm_domain_detach() in the bus remove function. The device_unbind_cleanup() function now handles this to avoid invoking devres cleanup handlers while the PM domain is powered off, which could otherwise lead to failures as described in the above-mentioned commit.
Drop the explicit dev_pm_domain_detach() call and rely instead on the flags passed to dev_pm_domain_attach() to power off the domain.
--- drivers/mmc/core/sdio_bus.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mmc/core/sdio_bus.c +4 -2
@@ -199,7 +199,8 @@ static int sdio_bus_probe(struct device *dev)atomic_dec (&func->card->sdio_funcs_probed);if (func->card->host->caps &MMC_CAP_POWER_OFF_CARD )pm_runtime_put_noidle (dev); -dev_pm_domain_detach (dev, false); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, false);return ret; }
@@ -231,7 +232,8 @@ static int sdio_bus_remove(struct device *dev)if (func->card->host->caps &MMC_CAP_POWER_OFF_CARD )pm_runtime_put_sync (dev); -dev_pm_domain_detach (dev, false); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, false);return 0 ; }
Signature · 1 line
2.43.0
PATCH v3 7/18 spi: Drop dev_pm_domain_detach() call
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit c42e36a488c7e01f833fc9f4814f735b66b2d494 upstream.
Starting with commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()"), there is no longer a need to call dev_pm_domain_detach() in the bus remove function. The device_unbind_cleanup() function now handles this to avoid invoking devres cleanup handlers while the PM domain is powered off, which could otherwise lead to failures as described in the above-mentioned commit.
Drop the explicit dev_pm_domain_detach() call and rely instead on the flags passed to dev_pm_domain_attach() to power off the domain.
Message-ID: <[email protected]>
--- drivers/spi/spi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/spi/spi.c +5 -3
@@ -407,13 +407,14 @@ static int spi_drv_probe(struct device *dev) spi->irq =0 ; } - ret =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON ); + ret =dev_pm_domain_attach (dev,PD_FLAG_ATTACH_POWER_ON | +PD_FLAG_DETACH_POWER_OFF );if (ret)return ret;if (sdrv->probe) { ret = sdrv->probe (spi); -if (ret) +if (ret && !dev_pm_domain_allow_detach_on_unbind_cleanup ())dev_pm_domain_detach (dev, true); }
@@ -427,7 +428,8 @@ static int spi_drv_remove(struct device *dev)if (sdrv->remove) ret = sdrv->remove (to_spi_device (dev)); -dev_pm_domain_detach (dev, true); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (dev, true);return ret; }
Signature · 1 line
2.43.0
PATCH v3 8/18 i2c: core: Drop dev_pm_domain_detach() call
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit eddfe53b0d84b02802432bf783ccd53b095dd10a upstream.
Starting with commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()"), there is no longer a need to call dev_pm_domain_detach() in the bus remove function. The device_unbind_cleanup() function now handles this to avoid invoking devres cleanup handlers while the PM domain is powered off, which could otherwise lead to failures as described in the above-mentioned commit.
Drop the explicit dev_pm_domain_detach() call and rely instead on the flags passed to dev_pm_domain_attach() to power off the domain.
[claudiu.beznea:
- fixed conflict by keeping v5.10 CIP code
- manually added PD_FLAG_DETACH_POWER_OFF
- drop dev_pm_domain_detach() conditionally]
--- drivers/i2c/i2c-core-base.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/i2c/i2c-core-base.c +6 -3
@@ -535,7 +535,8 @@ static int i2c_device_probe(struct device *dev)if (status <0 ) goto err_clear_wakeup_irq; - status =dev_pm_domain_attach (&client->dev,PD_FLAG_ATTACH_POWER_ON ); + status =dev_pm_domain_attach (&client->dev,PD_FLAG_ATTACH_POWER_ON | +PD_FLAG_DETACH_POWER_OFF );if (status) goto err_clear_wakeup_irq;
@@ -557,7 +558,8 @@ static int i2c_device_probe(struct device *dev)return 0 ; err_detach_pm_domain: -dev_pm_domain_detach (&client->dev, true); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (&client->dev, true); err_clear_wakeup_irq:dev_pm_clear_wake_irq (&client->dev);device_init_wakeup (&client->dev, false);
@@ -583,7 +585,8 @@ static int i2c_device_remove(struct device *dev) status = driver->remove (client); } -dev_pm_domain_detach (&client->dev, true); +if (!dev_pm_domain_allow_detach_on_unbind_cleanup ()) +dev_pm_domain_detach (&client->dev, true);dev_pm_clear_wake_irq (&client->dev);device_init_wakeup (&client->dev, false);
Signature · 1 line
2.43.0
PATCH v3 9/18 clk: renesas: rzg2l: Extend power domain support
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 0c8a59b3113ef6184d1e4cf2fb911c641d5172e3 upstream.
RZ/{G2L, V2L, G3S}-based CPG versions have support for saving extra power when clocks are disabled by activating module standby. This is done through MSTOP-specific registers that are part of CPG. Each individual module has one or more bits associated with one MSTOP register (see table "Registers for Module Standby Mode" from HW manuals). Hardware manual associates modules' clocks with one or more MSTOP bits. There are 3 mappings available (identified by researching RZ/G2L, RZ/G3S, RZ/V2L HW manuals):
case 1: N clocks mapped to N MSTOP bits (with N={0, ..., X}) case 2: N clocks mapped to 1 MSTOP bit (with N={0, ..., X}) case 3: N clocks mapped to M MSTOP bits (with N={0, ..., X}, M={0, ..., Y})
Case 3 has been currently identified on RZ/V2L for the VCPL4 module.
To cover all three cases, the individual platform drivers will provide the clock driver with MSTOP register offsets and associated bits in this register as a bitmask, and the clock driver will apply this bitmask to the proper MSTOP register.
The MSTOP support was implemented through power domains. Platform-specific clock drivers will register an array of type struct rzg2l_cpg_pm_domain_init_data, which will be used to instantiate properly the power domains.
--- drivers/clk/renesas/rzg2l-cpg.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/clk/renesas/rzg2l-cpg.h +12 -0
@@ -28,6 +28,18 @@#define CPG_PL6_ETH_SSEL (0x418)#define CPG_PL5_SDIV (0x420)#define CPG_RST_MON (0x680) +#define CPG_BUS_ACPU_MSTOP (0xB60) +#define CPG_BUS_MCPU1_MSTOP (0xB64) +#define CPG_BUS_MCPU2_MSTOP (0xB68) +#define CPG_BUS_PERI_COM_MSTOP (0xB6C) +#define CPG_BUS_PERI_CPU_MSTOP (0xB70) +#define CPG_BUS_PERI_DDR_MSTOP (0xB74) +#define CPG_BUS_REG0_MSTOP (0xB7C) +#define CPG_BUS_REG1_MSTOP (0xB80) +#define CPG_BUS_TZCDDR_MSTOP (0xB84) +#define CPG_MHU_MSTOP (0xB88) +#define CPG_BUS_MCPU3_MSTOP (0xB90) +#define CPG_BUS_PERI_CPU2_MSTOP (0xB94)#define CPG_OTHERFUNC1_REG (0xBE8)#define CPG_SIPLL5_STBY_RESETB BIT(0)
Signature · 1 line
2.43.0
PATCH v3 10/18 clk: renesas: rzg2l: Postpone updating priv->clks[]
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 2f96afdffad4ef74e3c511207058c41c54a2d014 upstream.
Since the sibling data is filled after the priv->clks[] array entry is populated, the first clock that is probed and has a sibling will temporarily behave as its own sibling until its actual sibling is populated. To avoid any issues, postpone updating priv->clks[] until after the sibling is populated.
[claudiu.beznea: fixed conflict by keeping the code from commit
2f96afdffad4ef74e3c511207058c41c54a2d014]
--- drivers/clk/renesas/rzg2l-cpg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +3 -3
@@ -1400,9 +1400,6 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod,if (IS_ERR (clk)) goto fail; -dev_dbg (dev,"Module clock %pC at %lu Hz\n" , clk,clk_get_rate (clk)); - priv->clks[id] = clk; -if (mod->is_coupled) {struct mstp_clock *sibling;
@@ -1414,6 +1411,9 @@ rzg2l_cpg_register_mod_clk(const struct rzg2l_mod_clk *mod, } } +dev_dbg (dev,"Module clock %pC at %lu Hz\n" , clk,clk_get_rate (clk)); + priv->clks[id] = clk; +return ; fail:
Signature · 1 line
2.43.0
PATCH v3 11/18 clk: renesas: rzg2l: Move pointers after hw member
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit a68ea80f85bbf7b69f69ef9e17e3e1be14d948c8 upstream.
Reorder the pointer members in struct mstp_clock so they appear immediately after the hw member. This helps avoid potential padding and eliminates the need for any calculations in the to_mod_clock() macro. As struct clk_hw currently contains only pointers, placing it first also avoids padding.
--- drivers/clk/renesas/rzg2l-cpg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +4 -4
@@ -1194,19 +1194,19 @@ rzg2l_cpg_register_core_clk(const struct cpg_core_clk *core,* struct mstp_clock - MSTP gating clock * * @hw: handle between common and hardware-specific interfaces +* @priv: CPG/MSTP private data +* @sibling: pointer to the other coupled clock * @off: register offset * @bit: ON/MON bit * @enabled: soft state of the clock, if it is coupled with another clock -* @priv: CPG/MSTP private data -* @sibling: pointer to the other coupled clock */ struct mstp_clock {struct clk_hw hw; +struct rzg2l_cpg_priv *priv; +struct mstp_clock *sibling;u16 off;u8 bit;bool enabled; -struct rzg2l_cpg_priv *priv; -struct mstp_clock *sibling; };#define to_mod_clock (_hw) container_of(_hw, struct mstp_clock, hw)
Signature · 1 line
2.43.0
PATCH v3 12/18 clk: renesas: rzg2l: Add macro to loop through module clocks
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 3fd4a8bb4b63b886a7a11444f85000ea90d2617f upstream.
Add a macro to iterate over the module clocks array. This will be useful in the upcoming commits that move MSTOP support into the clock enable/disable APIs.
[claudiu.beznea: add the it parameter to for_each_mod_clock() to avoid
compilation errors]
--- drivers/clk/renesas/rzg2l-cpg.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +9 -8
@@ -1211,6 +1211,13 @@ struct mstp_clock {#define to_mod_clock (_hw) container_of(_hw, struct mstp_clock, hw) +#define for_each_mod_clock (it, mod_clock, hw, priv) \ + for (it = 0; (priv) && it < (priv)->num_mod_clks; it++) \ + if ((priv)->clks[(priv)->num_core_clks + it] == ERR_PTR(-ENOENT)) \ + continue; \ + else if (((hw) = __clk_get_hw((priv)->clks[(priv)->num_core_clks + it])) && \ + ((mod_clock) = to_mod_clock(hw))) +static int rzg2l_mod_clock_endisable (struct clk_hw *hw,bool enable) {struct mstp_clock *clock =to_mod_clock (hw);
@@ -1323,17 +1330,11 @@ static struct mstp_clock *rzg2l_mod_clock__get_sibling(struct mstp_clock *clock, struct rzg2l_cpg_priv *priv) { +struct mstp_clock *clk;struct clk_hw *hw;unsigned int i; -for (i =0 ; i < priv->num_mod_clks; i++) { -struct mstp_clock *clk; - -if (priv->clks[priv->num_core_clks + i] ==ERR_PTR (-ENOENT )) -continue ; - - hw =__clk_get_hw (priv->clks[priv->num_core_clks + i]); - clk =to_mod_clock (hw); +for_each_mod_clock (i, clk, hw, priv) {if (clock->off == clk->off && clock->bit == clk->bit)return clk; }
Signature · 1 line
2.43.0
PATCH v3 13/18 clk: renesas: rzg2l: Add support for MSTOP in clock enable/disable API
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 5cd33db5695693c3b4b9d5fc5e2be70c3efa99dd upstream.
The RZ/{G2L,V2L,G3S} CPG versions support a feature called MSTOP. Each module has one or more MSTOP bits associated with it, and these bits need to be configured along with the module clocks. Setting the MSTOP bits switches the module between normal and standby states.
Previously, MSTOP support was abstracted through power domains (struct generic_pm_domain::{power_on, power_off} APIs). With this abstraction, the order of setting the MSTOP and CLKON bits was as follows:
Previous Order:
A/ Switching to Normal State (e.g., during probe):
1/ Clear module MSTOP bit
2/ Set module CLKON bit
B/ Switching to Standby State (e.g., during remove):
1/ Clear CLKON bit
2/ Set MSTOP bit
However, in some cases (when the clock is disabled through devres), the order may have been (due to the issue described in link section):
1/ Set MSTOP bit
2/ Clear CLKON bit
Recently, the hardware team has suggested that the correct order to set the MSTOP and CLKON bits is:
Updated Order:
A/ Switching to Normal State (e.g., during probe):
1/ Set CLKON bit
2/ Clear MSTOP bit
B/ Switching to Standby State (e.g., during remove):
1/ Set MSTOP bit
2/ Clear CLKON bit
To prevent future issues due to incorrect ordering, the MSTOP setup has now been implemented in rzg2l_mod_clock_endisable(), ensuring compliance with the sequence suggested in Figure 41.5: Module Standby Mode Procedure from the RZ/G3S HW manual, Rev1.10.
Additionally, since multiple clocks of a single module may be mapped to a single MSTOP bit, MSTOP setup is reference-counted.
Furthermore, as all modules start in the normal state after reset, if the module clocks are disabled, the module state is switched to standby. This prevents keeping the module in an invalid state, as recommended by the hardware team.
[claudiu.beznea:
- dropped USB clocks from r9108g045-cpg.c as these are not integrated in v5.10 CIP
- dropped cperi, PWM, csi from r9a08g011-cpg.c as these are not integrated in v5.10 CIP
- fixed conflict in rzg2l-cpg.c by mixing code
- used spin_lock_irqsave()/spin_unlock_irqrestore() as cleanup.h helpers are not available in v5.10 CIP
- updated for_each_mod_clock()]
--- drivers/clk/renesas/r9a07g043-cpg.c | 132 +++++++------- drivers/clk/renesas/r9a07g044-cpg.c | 168 +++++++++--------- drivers/clk/renesas/r9a08g045-cpg.c | 96 +++++------ drivers/clk/renesas/r9a09g011-cpg.c | 92 +++++----- drivers/clk/renesas/rzg2l-cpg.c | 256 +++++++++++++++++++++++++++- drivers/clk/renesas/rzg2l-cpg.h | 15 +- 6 files changed, 509 insertions(+), 250 deletions(-)
drivers/clk/renesas/r9a07g043-cpg.c +66 -66
@@ -164,143 +164,143 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {static const struct rzg2l_mod_clk r9a07g043_mod_clks[] = { #ifdef CONFIG_ARM64DEF_MOD ("gic" ,R9A07G043_GIC600_GICCLK ,R9A07G043_CLK_P1 , -0x514 ,0 ), +0x514 ,0 ,0 ),DEF_MOD ("ia55_pclk" ,R9A07G043_IA55_PCLK ,R9A07G043_CLK_P2 , -0x518 ,0 ), +0x518 ,0 ,0 ),DEF_MOD ("ia55_clk" ,R9A07G043_IA55_CLK ,R9A07G043_CLK_P1 , -0x518 ,1 ), +0x518 ,1 ,0 ), #endif #ifdef CONFIG_RISCVDEF_MOD ("iax45_pclk" ,R9A07G043_IAX45_PCLK ,R9A07G043_CLK_P2 , -0x518 ,0 ), +0x518 ,0 ,0 ),DEF_MOD ("iax45_clk" ,R9A07G043_IAX45_CLK ,R9A07G043_CLK_P1 , -0x518 ,1 ), +0x518 ,1 ,0 ), #endifDEF_MOD ("dmac_aclk" ,R9A07G043_DMAC_ACLK ,R9A07G043_CLK_P1 , -0x52c ,0 ), +0x52c ,0 ,0 ),DEF_MOD ("dmac_pclk" ,R9A07G043_DMAC_PCLK ,CLK_P1_DIV2 , -0x52c ,1 ), +0x52c ,1 ,0 ),DEF_MOD ("ostm0_pclk" ,R9A07G043_OSTM0_PCLK ,R9A07G043_CLK_P0 , -0x534 ,0 ), +0x534 ,0 ,0 ),DEF_MOD ("ostm1_pclk" ,R9A07G043_OSTM1_PCLK ,R9A07G043_CLK_P0 , -0x534 ,1 ), +0x534 ,1 ,0 ),DEF_MOD ("ostm2_pclk" ,R9A07G043_OSTM2_PCLK ,R9A07G043_CLK_P0 , -0x534 ,2 ), +0x534 ,2 ,0 ),DEF_MOD ("mtu_x_mck" ,R9A07G043_MTU_X_MCK_MTU3 ,R9A07G043_CLK_P0 , -0x538 ,0 ), +0x538 ,0 ,0 ),DEF_MOD ("wdt0_pclk" ,R9A07G043_WDT0_PCLK ,R9A07G043_CLK_P0 , -0x548 ,0 ), +0x548 ,0 ,0 ),DEF_MOD ("wdt0_clk" ,R9A07G043_WDT0_CLK ,R9A07G043_OSCCLK , -0x548 ,1 ), +0x548 ,1 ,0 ),DEF_MOD ("spi_clk2" ,R9A07G043_SPI_CLK2 ,R9A07G043_CLK_SPI1 , -0x550 ,0 ), +0x550 ,0 ,0 ),DEF_MOD ("spi_clk" ,R9A07G043_SPI_CLK ,R9A07G043_CLK_SPI0 , -0x550 ,1 ), +0x550 ,1 ,0 ),DEF_MOD ("sdhi0_imclk" ,R9A07G043_SDHI0_IMCLK ,CLK_SD0_DIV4 , -0x554 ,0 ), +0x554 ,0 ,0 ),DEF_MOD ("sdhi0_imclk2" ,R9A07G043_SDHI0_IMCLK2 ,CLK_SD0_DIV4 , -0x554 ,1 ), +0x554 ,1 ,0 ),DEF_MOD ("sdhi0_clk_hs" ,R9A07G043_SDHI0_CLK_HS ,R9A07G043_CLK_SD0 , -0x554 ,2 ), +0x554 ,2 ,0 ),DEF_MOD ("sdhi0_aclk" ,R9A07G043_SDHI0_ACLK ,R9A07G043_CLK_P1 , -0x554 ,3 ), +0x554 ,3 ,0 ),DEF_MOD ("sdhi1_imclk" ,R9A07G043_SDHI1_IMCLK ,CLK_SD1_DIV4 , -0x554 ,4 ), +0x554 ,4 ,0 ),DEF_MOD ("sdhi1_imclk2" ,R9A07G043_SDHI1_IMCLK2 ,CLK_SD1_DIV4 , -0x554 ,5 ), +0x554 ,5 ,0 ),DEF_MOD ("sdhi1_clk_hs" ,R9A07G043_SDHI1_CLK_HS ,R9A07G043_CLK_SD1 , -0x554 ,6 ), +0x554 ,6 ,0 ),DEF_MOD ("sdhi1_aclk" ,R9A07G043_SDHI1_ACLK ,R9A07G043_CLK_P1 , -0x554 ,7 ), +0x554 ,7 ,0 ), #ifdef CONFIG_ARM64DEF_MOD ("cru_sysclk" ,R9A07G043_CRU_SYSCLK ,CLK_M2_DIV2 , -0x564 ,0 ), +0x564 ,0 ,0 ),DEF_MOD ("cru_vclk" ,R9A07G043_CRU_VCLK ,R9A07G043_CLK_M2 , -0x564 ,1 ), +0x564 ,1 ,0 ),DEF_MOD ("cru_pclk" ,R9A07G043_CRU_PCLK ,R9A07G043_CLK_ZT , -0x564 ,2 ), +0x564 ,2 ,0 ),DEF_MOD ("cru_aclk" ,R9A07G043_CRU_ACLK ,R9A07G043_CLK_M0 , -0x564 ,3 ), +0x564 ,3 ,0 ),DEF_COUPLED ("lcdc_clk_a" ,R9A07G043_LCDC_CLK_A ,R9A07G043_CLK_M0 , -0x56c ,0 ), +0x56c ,0 ,0 ),DEF_COUPLED ("lcdc_clk_p" ,R9A07G043_LCDC_CLK_P ,R9A07G043_CLK_ZT , -0x56c ,0 ), +0x56c ,0 ,0 ),DEF_MOD ("lcdc_clk_d" ,R9A07G043_LCDC_CLK_D ,R9A07G043_CLK_M3 , -0x56c ,1 ), +0x56c ,1 ,0 ), #endifDEF_MOD ("ssi0_pclk" ,R9A07G043_SSI0_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,0 ), +0x570 ,0 ,0 ),DEF_MOD ("ssi0_sfr" ,R9A07G043_SSI0_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,1 ), +0x570 ,1 ,0 ),DEF_MOD ("ssi1_pclk" ,R9A07G043_SSI1_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,2 ), +0x570 ,2 ,0 ),DEF_MOD ("ssi1_sfr" ,R9A07G043_SSI1_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,3 ), +0x570 ,3 ,0 ),DEF_MOD ("ssi2_pclk" ,R9A07G043_SSI2_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,4 ), +0x570 ,4 ,0 ),DEF_MOD ("ssi2_sfr" ,R9A07G043_SSI2_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,5 ), +0x570 ,5 ,0 ),DEF_MOD ("ssi3_pclk" ,R9A07G043_SSI3_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,6 ), +0x570 ,6 ,0 ),DEF_MOD ("ssi3_sfr" ,R9A07G043_SSI3_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,7 ), +0x570 ,7 ,0 ),DEF_MOD ("usb0_host" ,R9A07G043_USB_U2H0_HCLK ,R9A07G043_CLK_P1 , -0x578 ,0 ), +0x578 ,0 ,0 ),DEF_MOD ("usb1_host" ,R9A07G043_USB_U2H1_HCLK ,R9A07G043_CLK_P1 , -0x578 ,1 ), +0x578 ,1 ,0 ),DEF_MOD ("usb0_func" ,R9A07G043_USB_U2P_EXR_CPUCLK ,R9A07G043_CLK_P1 , -0x578 ,2 ), +0x578 ,2 ,0 ),DEF_MOD ("usb_pclk" ,R9A07G043_USB_PCLK ,R9A07G043_CLK_P1 , -0x578 ,3 ), +0x578 ,3 ,0 ),DEF_COUPLED ("eth0_axi" ,R9A07G043_ETH0_CLK_AXI ,R9A07G043_CLK_M0 , -0x57c ,0 ), +0x57c ,0 ,0 ),DEF_COUPLED ("eth0_chi" ,R9A07G043_ETH0_CLK_CHI ,R9A07G043_CLK_ZT , -0x57c ,0 ), +0x57c ,0 ,0 ),DEF_COUPLED ("eth1_axi" ,R9A07G043_ETH1_CLK_AXI ,R9A07G043_CLK_M0 , -0x57c ,1 ), +0x57c ,1 ,0 ),DEF_COUPLED ("eth1_chi" ,R9A07G043_ETH1_CLK_CHI ,R9A07G043_CLK_ZT , -0x57c ,1 ), +0x57c ,1 ,0 ),DEF_MOD ("i2c0" ,R9A07G043_I2C0_PCLK ,R9A07G043_CLK_P0 , -0x580 ,0 ), +0x580 ,0 ,0 ),DEF_MOD ("i2c1" ,R9A07G043_I2C1_PCLK ,R9A07G043_CLK_P0 , -0x580 ,1 ), +0x580 ,1 ,0 ),DEF_MOD ("i2c2" ,R9A07G043_I2C2_PCLK ,R9A07G043_CLK_P0 , -0x580 ,2 ), +0x580 ,2 ,0 ),DEF_MOD ("i2c3" ,R9A07G043_I2C3_PCLK ,R9A07G043_CLK_P0 , -0x580 ,3 ), +0x580 ,3 ,0 ),DEF_MOD ("scif0" ,R9A07G043_SCIF0_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,0 ), +0x584 ,0 ,0 ),DEF_MOD ("scif1" ,R9A07G043_SCIF1_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,1 ), +0x584 ,1 ,0 ),DEF_MOD ("scif2" ,R9A07G043_SCIF2_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,2 ), +0x584 ,2 ,0 ),DEF_MOD ("scif3" ,R9A07G043_SCIF3_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,3 ), +0x584 ,3 ,0 ),DEF_MOD ("scif4" ,R9A07G043_SCIF4_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,4 ), +0x584 ,4 ,0 ),DEF_MOD ("sci0" ,R9A07G043_SCI0_CLKP ,R9A07G043_CLK_P0 , -0x588 ,0 ), +0x588 ,0 ,0 ),DEF_MOD ("sci1" ,R9A07G043_SCI1_CLKP ,R9A07G043_CLK_P0 , -0x588 ,1 ), +0x588 ,1 ,0 ),DEF_MOD ("rspi0" ,R9A07G043_RSPI0_CLKB ,R9A07G043_CLK_P0 , -0x590 ,0 ), +0x590 ,0 ,0 ),DEF_MOD ("rspi1" ,R9A07G043_RSPI1_CLKB ,R9A07G043_CLK_P0 , -0x590 ,1 ), +0x590 ,1 ,0 ),DEF_MOD ("rspi2" ,R9A07G043_RSPI2_CLKB ,R9A07G043_CLK_P0 , -0x590 ,2 ), +0x590 ,2 ,0 ),DEF_MOD ("canfd" ,R9A07G043_CANFD_PCLK ,R9A07G043_CLK_P0 , -0x594 ,0 ), +0x594 ,0 ,0 ),DEF_MOD ("gpio" ,R9A07G043_GPIO_HCLK ,R9A07G043_OSCCLK , -0x598 ,0 ), +0x598 ,0 ,0 ),DEF_MOD ("adc_adclk" ,R9A07G043_ADC_ADCLK ,R9A07G043_CLK_TSU , -0x5a8 ,0 ), +0x5a8 ,0 ,0 ),DEF_MOD ("adc_pclk" ,R9A07G043_ADC_PCLK ,R9A07G043_CLK_P0 , -0x5a8 ,1 ), +0x5a8 ,1 ,0 ),DEF_MOD ("tsu_pclk" ,R9A07G043_TSU_PCLK ,R9A07G043_CLK_TSU , -0x5ac ,0 ), +0x5ac ,0 ,0 ), #ifdef CONFIG_RISCVDEF_MOD ("nceplic_aclk" ,R9A07G043_NCEPLIC_ACLK ,R9A07G043_CLK_P1 , -0x608 ,0 ), +0x608 ,0 ,0 ), #endif };
drivers/clk/renesas/r9a07g044-cpg.c +84 -84
260 lines not on this page · raw message
drivers/clk/renesas/r9a08g045-cpg.c +48 -48
102 lines not on this page · raw message
drivers/clk/renesas/r9a09g011-cpg.c +46 -46
98 lines not on this page · raw message
drivers/clk/renesas/rzg2l-cpg.c +255 -1
357 lines not on this page · raw message
drivers/clk/renesas/rzg2l-cpg.h +10 -5
@@ -82,6 +82,8 @@#define SEL_PLL6_2 SEL_PLL_PACK(CPG_PL6_ETH_SSEL, 0, 1)#define SEL_GPU2 SEL_PLL_PACK(CPG_PL6_SSEL, 12, 1) +#define MSTOP (name, bitmask) ((CPG_##name##_MSTOP) << 16 | (bitmask)) +#define EXTAL_FREQ_IN_MEGA_HZ (24)/**
@@ -201,6 +203,7 @@ enum clk_types {* @name: handle between common and hardware-specific interfaces * @id: clock index in array containing all Core and Module Clocks * @parent: id of parent clock +* @mstop_conf: MSTOP configuration * @off: register offset * @bit: ON/MON bit * @is_coupled: flag to indicate coupled clock
@@ -209,26 +212,28 @@ struct rzg2l_mod_clk {const char *name;unsigned int id;unsigned int parent; +u32 mstop_conf;u16 off;u8 bit;bool is_coupled; }; -#define DEF_MOD_BASE (_name, _id, _parent, _off, _bit, _is_coupled) \ +#define DEF_MOD_BASE (_name, _id, _parent, _off, _bit, _mstop_conf, _is_coupled) \ { \ .name = _name, \ .id = MOD_CLK_BASE + (_id), \ .parent = (_parent), \ + .mstop_conf = (_mstop_conf), \ .off = (_off), \ .bit = (_bit), \ .is_coupled = (_is_coupled), \ } -#define DEF_MOD (_name, _id, _parent, _off, _bit) \ - DEF_MOD_BASE(_name, _id, _parent, _off, _bit, false) +#define DEF_MOD (_name, _id, _parent, _off, _bit, _mstop_conf) \ + DEF_MOD_BASE(_name, _id, _parent, _off, _bit, _mstop_conf, false) -#define DEF_COUPLED (_name, _id, _parent, _off, _bit) \ - DEF_MOD_BASE(_name, _id, _parent, _off, _bit, true) +#define DEF_COUPLED (_name, _id, _parent, _off, _bit, _mstop_conf) \ + DEF_MOD_BASE(_name, _id, _parent, _off, _bit, _mstop_conf, true)/** * struct rzg2l_reset - Reset definitions
Signature · 1 line
2.43.0
PATCH v3 14/18 clk: renesas: r9a08g045: Drop power domain instantiation
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit c4969595274609055c71cbe831c2989361730876 upstream.
Since the configuration order between the individual MSTOP and CLKON bits cannot be preserved with the power domain abstraction, drop the power domain instantiations.
[claudiu.beznea: dropped USB clocks as these are not integrated
in v5.10 CIP]
--- drivers/clk/renesas/r9a08g045-cpg.c | 129 ++++++++++++++++++---------- 1 file changed, 86 insertions(+), 43 deletions(-)
drivers/clk/renesas/r9a08g045-cpg.c +86 -43
@@ -191,54 +191,97 @@ static const struct cpg_core_clk r9a08g045_core_clks[] __initconst = { };static const struct rzg2l_mod_clk r9a08g045_mod_clks[] = { -DEF_MOD ("gic_gicclk" ,R9A08G045_GIC600_GICCLK ,R9A08G045_CLK_P1 ,0x514 ,0 ,0 ), -DEF_MOD ("ia55_pclk" ,R9A08G045_IA55_PCLK ,R9A08G045_CLK_P2 ,0x518 ,0 ,0 ), -DEF_MOD ("ia55_clk" ,R9A08G045_IA55_CLK ,R9A08G045_CLK_P1 ,0x518 ,1 ,0 ), -DEF_MOD ("dmac_aclk" ,R9A08G045_DMAC_ACLK ,R9A08G045_CLK_P3 ,0x52c ,0 ,0 ), -DEF_MOD ("dmac_pclk" ,R9A08G045_DMAC_PCLK ,CLK_P3_DIV2 ,0x52c ,1 ,0 ), -DEF_MOD ("wdt0_pclk" ,R9A08G045_WDT0_PCLK ,R9A08G045_CLK_P0 ,0x548 ,0 ,0 ), -DEF_MOD ("wdt0_clk" ,R9A08G045_WDT0_CLK ,R9A08G045_OSCCLK ,0x548 ,1 ,0 ), -DEF_MOD ("sdhi0_imclk" ,R9A08G045_SDHI0_IMCLK ,CLK_SD0_DIV4 ,0x554 ,0 ,0 ), -DEF_MOD ("sdhi0_imclk2" ,R9A08G045_SDHI0_IMCLK2 ,CLK_SD0_DIV4 ,0x554 ,1 ,0 ), -DEF_MOD ("sdhi0_clk_hs" ,R9A08G045_SDHI0_CLK_HS ,R9A08G045_CLK_SD0 ,0x554 ,2 ,0 ), -DEF_MOD ("sdhi0_aclk" ,R9A08G045_SDHI0_ACLK ,R9A08G045_CLK_P1 ,0x554 ,3 ,0 ), -DEF_MOD ("sdhi1_imclk" ,R9A08G045_SDHI1_IMCLK ,CLK_SD1_DIV4 ,0x554 ,4 ,0 ), -DEF_MOD ("sdhi1_imclk2" ,R9A08G045_SDHI1_IMCLK2 ,CLK_SD1_DIV4 ,0x554 ,5 ,0 ), -DEF_MOD ("sdhi1_clk_hs" ,R9A08G045_SDHI1_CLK_HS ,R9A08G045_CLK_SD1 ,0x554 ,6 ,0 ), -DEF_MOD ("sdhi1_aclk" ,R9A08G045_SDHI1_ACLK ,R9A08G045_CLK_P1 ,0x554 ,7 ,0 ), -DEF_MOD ("sdhi2_imclk" ,R9A08G045_SDHI2_IMCLK ,CLK_SD2_DIV4 ,0x554 ,8 ,0 ), -DEF_MOD ("sdhi2_imclk2" ,R9A08G045_SDHI2_IMCLK2 ,CLK_SD2_DIV4 ,0x554 ,9 ,0 ), -DEF_MOD ("sdhi2_clk_hs" ,R9A08G045_SDHI2_CLK_HS ,R9A08G045_CLK_SD2 ,0x554 ,10 ,0 ), -DEF_MOD ("sdhi2_aclk" ,R9A08G045_SDHI2_ACLK ,R9A08G045_CLK_P1 ,0x554 ,11 ,0 ), -DEF_MOD ("ssi0_pclk2" ,R9A08G045_SSI0_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,0 ,0 ), -DEF_MOD ("ssi0_sfr" ,R9A08G045_SSI0_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,1 ,0 ), -DEF_MOD ("ssi1_pclk2" ,R9A08G045_SSI1_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,2 ,0 ), -DEF_MOD ("ssi1_sfr" ,R9A08G045_SSI1_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,3 ,0 ), -DEF_MOD ("ssi2_pclk2" ,R9A08G045_SSI2_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,4 ,0 ), -DEF_MOD ("ssi2_sfr" ,R9A08G045_SSI2_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,5 ,0 ), -DEF_MOD ("ssi3_pclk2" ,R9A08G045_SSI3_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,6 ,0 ), -DEF_MOD ("ssi3_sfr" ,R9A08G045_SSI3_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,7 ,0 ), -DEF_COUPLED ("eth0_axi" ,R9A08G045_ETH0_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,0 ,0 ), +DEF_MOD ("gic_gicclk" ,R9A08G045_GIC600_GICCLK ,R9A08G045_CLK_P1 ,0x514 ,0 , +MSTOP (BUS_ACPU ,BIT (3 ))), +DEF_MOD ("ia55_pclk" ,R9A08G045_IA55_PCLK ,R9A08G045_CLK_P2 ,0x518 ,0 , +MSTOP (BUS_PERI_CPU ,BIT (13 ))), +DEF_MOD ("ia55_clk" ,R9A08G045_IA55_CLK ,R9A08G045_CLK_P1 ,0x518 ,1 , +MSTOP (BUS_PERI_CPU ,BIT (13 ))), +DEF_MOD ("dmac_aclk" ,R9A08G045_DMAC_ACLK ,R9A08G045_CLK_P3 ,0x52c ,0 , +MSTOP (BUS_REG1 ,BIT (2 ))), +DEF_MOD ("dmac_pclk" ,R9A08G045_DMAC_PCLK ,CLK_P3_DIV2 ,0x52c ,1 , +MSTOP (BUS_REG1 ,BIT (3 ))), +DEF_MOD ("wdt0_pclk" ,R9A08G045_WDT0_PCLK ,R9A08G045_CLK_P0 ,0x548 ,0 , +MSTOP (BUS_REG0 ,BIT (0 ))), +DEF_MOD ("wdt0_clk" ,R9A08G045_WDT0_CLK ,R9A08G045_OSCCLK ,0x548 ,1 , +MSTOP (BUS_REG0 ,BIT (0 ))), +DEF_MOD ("sdhi0_imclk" ,R9A08G045_SDHI0_IMCLK ,CLK_SD0_DIV4 ,0x554 ,0 , +MSTOP (BUS_PERI_COM ,BIT (0 ))), +DEF_MOD ("sdhi0_imclk2" ,R9A08G045_SDHI0_IMCLK2 ,CLK_SD0_DIV4 ,0x554 ,1 , +MSTOP (BUS_PERI_COM ,BIT (0 ))), +DEF_MOD ("sdhi0_clk_hs" ,R9A08G045_SDHI0_CLK_HS ,R9A08G045_CLK_SD0 ,0x554 ,2 , +MSTOP (BUS_PERI_COM ,BIT (0 ))), +DEF_MOD ("sdhi0_aclk" ,R9A08G045_SDHI0_ACLK ,R9A08G045_CLK_P1 ,0x554 ,3 , +MSTOP (BUS_PERI_COM ,BIT (0 ))), +DEF_MOD ("sdhi1_imclk" ,R9A08G045_SDHI1_IMCLK ,CLK_SD1_DIV4 ,0x554 ,4 , +MSTOP (BUS_PERI_COM ,BIT (1 ))), +DEF_MOD ("sdhi1_imclk2" ,R9A08G045_SDHI1_IMCLK2 ,CLK_SD1_DIV4 ,0x554 ,5 , +MSTOP (BUS_PERI_COM ,BIT (1 ))), +DEF_MOD ("sdhi1_clk_hs" ,R9A08G045_SDHI1_CLK_HS ,R9A08G045_CLK_SD1 ,0x554 ,6 , +MSTOP (BUS_PERI_COM ,BIT (1 ))), +DEF_MOD ("sdhi1_aclk" ,R9A08G045_SDHI1_ACLK ,R9A08G045_CLK_P1 ,0x554 ,7 , +MSTOP (BUS_PERI_COM ,BIT (1 ))), +DEF_MOD ("sdhi2_imclk" ,R9A08G045_SDHI2_IMCLK ,CLK_SD2_DIV4 ,0x554 ,8 , +MSTOP (BUS_PERI_COM ,BIT (11 ))), +DEF_MOD ("sdhi2_imclk2" ,R9A08G045_SDHI2_IMCLK2 ,CLK_SD2_DIV4 ,0x554 ,9 , +MSTOP (BUS_PERI_COM ,BIT (11 ))), +DEF_MOD ("sdhi2_clk_hs" ,R9A08G045_SDHI2_CLK_HS ,R9A08G045_CLK_SD2 ,0x554 ,10 , +MSTOP (BUS_PERI_COM ,BIT (11 ))), +DEF_MOD ("sdhi2_aclk" ,R9A08G045_SDHI2_ACLK ,R9A08G045_CLK_P1 ,0x554 ,11 , +MSTOP (BUS_PERI_COM ,BIT (11 ))), +DEF_MOD ("ssi0_pclk2" ,R9A08G045_SSI0_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,0 , +MSTOP (BUS_MCPU1 ,BIT (10 ))), +DEF_MOD ("ssi0_sfr" ,R9A08G045_SSI0_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,1 , +MSTOP (BUS_MCPU1 ,BIT (10 ))), +DEF_MOD ("ssi1_pclk2" ,R9A08G045_SSI1_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,2 , +MSTOP (BUS_MCPU1 ,BIT (11 ))), +DEF_MOD ("ssi1_sfr" ,R9A08G045_SSI1_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,3 , +MSTOP (BUS_MCPU1 ,BIT (11 ))), +DEF_MOD ("ssi2_pclk2" ,R9A08G045_SSI2_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,4 , +MSTOP (BUS_MCPU1 ,BIT (12 ))), +DEF_MOD ("ssi2_sfr" ,R9A08G045_SSI2_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,5 , +MSTOP (BUS_MCPU1 ,BIT (12 ))), +DEF_MOD ("ssi3_pclk2" ,R9A08G045_SSI3_PCLK2 ,R9A08G045_CLK_P0 ,0x570 ,6 , +MSTOP (BUS_MCPU1 ,BIT (13 ))), +DEF_MOD ("ssi3_sfr" ,R9A08G045_SSI3_PCLK_SFR ,R9A08G045_CLK_P0 ,0x570 ,7 , +MSTOP (BUS_MCPU1 ,BIT (13 ))), +DEF_COUPLED ("eth0_axi" ,R9A08G045_ETH0_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,0 , +MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_COUPLED ("eth0_chi" ,R9A08G045_ETH0_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,0 ,0 ),DEF_MOD ("eth0_refclk" ,R9A08G045_ETH0_REFCLK ,R9A08G045_CLK_HP ,0x57c ,8 ,0 ), -DEF_COUPLED ("eth1_axi" ,R9A08G045_ETH1_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,1 ,0 ), +DEF_COUPLED ("eth1_axi" ,R9A08G045_ETH1_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,1 , +MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_COUPLED ("eth1_chi" ,R9A08G045_ETH1_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,1 ,0 ),DEF_MOD ("eth1_refclk" ,R9A08G045_ETH1_REFCLK ,R9A08G045_CLK_HP ,0x57c ,9 ,0 ), -DEF_MOD ("i2c0_pclk" ,R9A08G045_I2C0_PCLK ,R9A08G045_CLK_P0 ,0x580 ,0 ,0 ), -DEF_MOD ("i2c1_pclk" ,R9A08G045_I2C1_PCLK ,R9A08G045_CLK_P0 ,0x580 ,1 ,0 ), -DEF_MOD ("i2c2_pclk" ,R9A08G045_I2C2_PCLK ,R9A08G045_CLK_P0 ,0x580 ,2 ,0 ), -DEF_MOD ("i2c3_pclk" ,R9A08G045_I2C3_PCLK ,R9A08G045_CLK_P0 ,0x580 ,3 ,0 ), -DEF_MOD ("scif0_clk_pck" ,R9A08G045_SCIF0_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,0 ,0 ), -DEF_MOD ("scif1_clk_pck" ,R9A08G045_SCIF1_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,1 ,0 ), -DEF_MOD ("scif2_clk_pck" ,R9A08G045_SCIF2_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,2 ,0 ), -DEF_MOD ("scif3_clk_pck" ,R9A08G045_SCIF3_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,3 ,0 ), -DEF_MOD ("scif4_clk_pck" ,R9A08G045_SCIF4_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,4 ,0 ), -DEF_MOD ("scif5_clk_pck" ,R9A08G045_SCIF5_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,5 ,0 ), +DEF_MOD ("i2c0_pclk" ,R9A08G045_I2C0_PCLK ,R9A08G045_CLK_P0 ,0x580 ,0 , +MSTOP (BUS_MCPU2 ,BIT (10 ))), +DEF_MOD ("i2c1_pclk" ,R9A08G045_I2C1_PCLK ,R9A08G045_CLK_P0 ,0x580 ,1 , +MSTOP (BUS_MCPU2 ,BIT (11 ))), +DEF_MOD ("i2c2_pclk" ,R9A08G045_I2C2_PCLK ,R9A08G045_CLK_P0 ,0x580 ,2 , +MSTOP (BUS_MCPU2 ,BIT (12 ))), +DEF_MOD ("i2c3_pclk" ,R9A08G045_I2C3_PCLK ,R9A08G045_CLK_P0 ,0x580 ,3 , +MSTOP (BUS_MCPU2 ,BIT (13 ))), +DEF_MOD ("scif0_clk_pck" ,R9A08G045_SCIF0_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,0 , +MSTOP (BUS_MCPU2 ,BIT (1 ))), +DEF_MOD ("scif1_clk_pck" ,R9A08G045_SCIF1_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,1 , +MSTOP (BUS_MCPU2 ,BIT (2 ))), +DEF_MOD ("scif2_clk_pck" ,R9A08G045_SCIF2_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,2 , +MSTOP (BUS_MCPU2 ,BIT (3 ))), +DEF_MOD ("scif3_clk_pck" ,R9A08G045_SCIF3_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,3 , +MSTOP (BUS_MCPU2 ,BIT (4 ))), +DEF_MOD ("scif4_clk_pck" ,R9A08G045_SCIF4_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,4 , +MSTOP (BUS_MCPU2 ,BIT (5 ))), +DEF_MOD ("scif5_clk_pck" ,R9A08G045_SCIF5_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,5 , +MSTOP (BUS_MCPU3 ,BIT (4 ))),DEF_MOD ("gpio_hclk" ,R9A08G045_GPIO_HCLK ,R9A08G045_OSCCLK ,0x598 ,0 ,0 ), -DEF_MOD ("adc_adclk" ,R9A08G045_ADC_ADCLK ,R9A08G045_CLK_TSU ,0x5a8 ,0 ,0 ), -DEF_MOD ("adc_pclk" ,R9A08G045_ADC_PCLK ,R9A08G045_CLK_TSU ,0x5a8 ,1 ,0 ), -DEF_MOD ("tsu_pclk" ,R9A08G045_TSU_PCLK ,R9A08G045_CLK_TSU ,0x5ac ,0 ,0 ), -DEF_MOD ("vbat_bclk" ,R9A08G045_VBAT_BCLK ,R9A08G045_OSCCLK ,0x614 ,0 ,0 ), +DEF_MOD ("adc_adclk" ,R9A08G045_ADC_ADCLK ,R9A08G045_CLK_TSU ,0x5a8 ,0 , +MSTOP (BUS_MCPU2 ,BIT (14 ))), +DEF_MOD ("adc_pclk" ,R9A08G045_ADC_PCLK ,R9A08G045_CLK_TSU ,0x5a8 ,1 , +MSTOP (BUS_MCPU2 ,BIT (14 ))), +DEF_MOD ("tsu_pclk" ,R9A08G045_TSU_PCLK ,R9A08G045_CLK_TSU ,0x5ac ,0 , +MSTOP (BUS_MCPU2 ,BIT (15 ))), +DEF_MOD ("vbat_bclk" ,R9A08G045_VBAT_BCLK ,R9A08G045_OSCCLK ,0x614 ,0 , +MSTOP (BUS_MCPU3 ,GENMASK (8 ,7 ))), };static const struct rzg2l_reset r9a08g045_resets[] = {
Signature · 1 line
2.43.0
PATCH v3 15/18 clk: renesas: r9a08g045: Add MSTOP for coupled clocks as well
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 0ab2d84f94dae48c3e7605cdc99dbb4e7c7b206a upstream.
If MSTOP is not added for both clocks in a coupled pair, and the clocks are not disabled in the reverse order of their enable sequence, the MSTOP may remain enabled when disabling the clocks.
This happens because rzg2l_mod_clock_endisable() executes for coupled clocks only when a single clock from the pair is enabled. If one clock has no MSTOP defined, it can result in the MSTOP configuration being left active when the clocks are disabled out of order (i.e., not in the reverse order of enabling).
--- drivers/clk/renesas/r9a08g045-cpg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clk/renesas/r9a08g045-cpg.c +4 -2
@@ -247,11 +247,13 @@ static const struct rzg2l_mod_clk r9a08g045_mod_clks[] = { MSTOP(BUS_MCPU1, BIT(13))),DEF_COUPLED ("eth0_axi" ,R9A08G045_ETH0_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,0 ,MSTOP (BUS_PERI_COM ,BIT (2 ))), -DEF_COUPLED ("eth0_chi" ,R9A08G045_ETH0_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,0 ,0 ), +DEF_COUPLED ("eth0_chi" ,R9A08G045_ETH0_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,0 , +MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_MOD ("eth0_refclk" ,R9A08G045_ETH0_REFCLK ,R9A08G045_CLK_HP ,0x57c ,8 ,0 ),DEF_COUPLED ("eth1_axi" ,R9A08G045_ETH1_CLK_AXI ,R9A08G045_CLK_M0 ,0x57c ,1 ,MSTOP (BUS_PERI_COM ,BIT (3 ))), -DEF_COUPLED ("eth1_chi" ,R9A08G045_ETH1_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,1 ,0 ), +DEF_COUPLED ("eth1_chi" ,R9A08G045_ETH1_CLK_CHI ,R9A08G045_CLK_ZT ,0x57c ,1 , +MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_MOD ("eth1_refclk" ,R9A08G045_ETH1_REFCLK ,R9A08G045_CLK_HP ,0x57c ,9 ,0 ),DEF_MOD ("i2c0_pclk" ,R9A08G045_I2C0_PCLK ,R9A08G045_CLK_P0 ,0x580 ,0 , MSTOP(BUS_MCPU2, BIT(10))),
Signature · 1 line
2.43.0
PATCH v3 16/18 clk: renesas: r9a08g045: Add MSTOP for GPIO
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit f0cb3463d0244765ab66792a88dc5e2152c130e1 upstream.
The GPIO module also supports MSTOP. Add it in the description of the gpio clock.
--- drivers/clk/renesas/r9a08g045-cpg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/renesas/r9a08g045-cpg.c +2 -1
@@ -275,7 +275,8 @@ static const struct rzg2l_mod_clk r9a08g045_mod_clks[] = { MSTOP(BUS_MCPU2, BIT(5))),DEF_MOD ("scif5_clk_pck" ,R9A08G045_SCIF5_CLK_PCK ,R9A08G045_CLK_P0 ,0x584 ,5 ,MSTOP (BUS_MCPU3 ,BIT (4 ))), -DEF_MOD ("gpio_hclk" ,R9A08G045_GPIO_HCLK ,R9A08G045_OSCCLK ,0x598 ,0 ,0 ), +DEF_MOD ("gpio_hclk" ,R9A08G045_GPIO_HCLK ,R9A08G045_OSCCLK ,0x598 ,0 , +MSTOP (BUS_PERI_CPU ,BIT (6 ))),DEF_MOD ("adc_adclk" ,R9A08G045_ADC_ADCLK ,R9A08G045_CLK_TSU ,0x5a8 ,0 ,MSTOP (BUS_MCPU2 ,BIT (14 ))), DEF_MOD("adc_pclk", R9A08G045_ADC_PCLK, R9A08G045_CLK_TSU, 0x5a8, 1,
Signature · 1 line
2.43.0
PATCH v3 17/18 clk: renesas: r9a07g044: Add MSTOP for RZ/G2L
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 56de5e305d4ba25eed5740b338f7ecb8cf342aa6 upstream.
Add MSTOP configuration for all the module clocks on the RZ/G2L based SoCs (RZ/G2L, RZ/G2LC, RZ/V2L).
--- drivers/clk/renesas/r9a07g044-cpg.c | 154 ++++++++++++++-------------- drivers/clk/renesas/rzg2l-cpg.h | 1 + 2 files changed, 78 insertions(+), 77 deletions(-)
drivers/clk/renesas/r9a07g044-cpg.c +77 -77
@@ -242,163 +242,163 @@ static const struct { } mod_clks = { .common = {DEF_MOD ("gic" ,R9A07G044_GIC600_GICCLK ,R9A07G044_CLK_P1 , -0x514 ,0 ,0 ), +0x514 ,0 ,MSTOP (BUS_REG1 ,BIT (7 ))),DEF_MOD ("ia55_pclk" ,R9A07G044_IA55_PCLK ,R9A07G044_CLK_P2 , -0x518 ,0 ,0 ), +0x518 ,0 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))),DEF_MOD ("ia55_clk" ,R9A07G044_IA55_CLK ,R9A07G044_CLK_P1 , -0x518 ,1 ,0 ), +0x518 ,1 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))),DEF_MOD ("dmac_aclk" ,R9A07G044_DMAC_ACLK ,R9A07G044_CLK_P1 , -0x52c ,0 ,0 ), +0x52c ,0 ,MSTOP (BUS_REG1 ,BIT (2 ))),DEF_MOD ("dmac_pclk" ,R9A07G044_DMAC_PCLK ,CLK_P1_DIV2 , -0x52c ,1 ,0 ), +0x52c ,1 ,MSTOP (BUS_REG1 ,BIT (3 ))),DEF_MOD ("ostm0_pclk" ,R9A07G044_OSTM0_PCLK ,R9A07G044_CLK_P0 , -0x534 ,0 ,0 ), +0x534 ,0 ,MSTOP (BUS_REG0 ,BIT (4 ))),DEF_MOD ("ostm1_pclk" ,R9A07G044_OSTM1_PCLK ,R9A07G044_CLK_P0 , -0x534 ,1 ,0 ), +0x534 ,1 ,MSTOP (BUS_REG0 ,BIT (5 ))),DEF_MOD ("ostm2_pclk" ,R9A07G044_OSTM2_PCLK ,R9A07G044_CLK_P0 , -0x534 ,2 ,0 ), +0x534 ,2 ,MSTOP (BUS_REG0 ,BIT (6 ))),DEF_MOD ("mtu_x_mck" ,R9A07G044_MTU_X_MCK_MTU3 ,R9A07G044_CLK_P0 , -0x538 ,0 ,0 ), +0x538 ,0 ,MSTOP (BUS_MCPU1 ,BIT (2 ))),DEF_MOD ("gpt_pclk" ,R9A07G044_GPT_PCLK ,R9A07G044_CLK_P0 , -0x540 ,0 ,0 ), +0x540 ,0 ,MSTOP (BUS_MCPU1 ,BIT (4 ))),DEF_MOD ("poeg_a_clkp" ,R9A07G044_POEG_A_CLKP ,R9A07G044_CLK_P0 , -0x544 ,0 ,0 ), +0x544 ,0 ,MSTOP (BUS_MCPU1 ,BIT (5 ))),DEF_MOD ("poeg_b_clkp" ,R9A07G044_POEG_B_CLKP ,R9A07G044_CLK_P0 , -0x544 ,1 ,0 ), +0x544 ,1 ,MSTOP (BUS_MCPU1 ,BIT (6 ))),DEF_MOD ("poeg_c_clkp" ,R9A07G044_POEG_C_CLKP ,R9A07G044_CLK_P0 , -0x544 ,2 ,0 ), +0x544 ,2 ,MSTOP (BUS_MCPU1 ,BIT (7 ))),DEF_MOD ("poeg_d_clkp" ,R9A07G044_POEG_D_CLKP ,R9A07G044_CLK_P0 , -0x544 ,3 ,0 ), +0x544 ,3 ,MSTOP (BUS_MCPU1 ,BIT (8 ))),DEF_MOD ("wdt0_pclk" ,R9A07G044_WDT0_PCLK ,R9A07G044_CLK_P0 , -0x548 ,0 ,0 ), +0x548 ,0 ,MSTOP (BUS_REG0 ,BIT (2 ))),DEF_MOD ("wdt0_clk" ,R9A07G044_WDT0_CLK ,R9A07G044_OSCCLK , -0x548 ,1 ,0 ), +0x548 ,1 ,MSTOP (BUS_REG0 ,BIT (2 ))),DEF_MOD ("wdt1_pclk" ,R9A07G044_WDT1_PCLK ,R9A07G044_CLK_P0 , -0x548 ,2 ,0 ), +0x548 ,2 ,MSTOP (BUS_REG0 ,BIT (3 ))),DEF_MOD ("wdt1_clk" ,R9A07G044_WDT1_CLK ,R9A07G044_OSCCLK , -0x548 ,3 ,0 ), +0x548 ,3 ,MSTOP (BUS_REG0 ,BIT (3 ))),DEF_MOD ("spi_clk2" ,R9A07G044_SPI_CLK2 ,R9A07G044_CLK_SPI1 , -0x550 ,0 ,0 ), +0x550 ,0 ,MSTOP (BUS_MCPU1 ,BIT (1 ))),DEF_MOD ("spi_clk" ,R9A07G044_SPI_CLK ,R9A07G044_CLK_SPI0 , -0x550 ,1 ,0 ), +0x550 ,1 ,MSTOP (BUS_MCPU1 ,BIT (1 ))),DEF_MOD ("sdhi0_imclk" ,R9A07G044_SDHI0_IMCLK ,CLK_SD0_DIV4 , -0x554 ,0 ,0 ), +0x554 ,0 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_imclk2" ,R9A07G044_SDHI0_IMCLK2 ,CLK_SD0_DIV4 , -0x554 ,1 ,0 ), +0x554 ,1 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_clk_hs" ,R9A07G044_SDHI0_CLK_HS ,R9A07G044_CLK_SD0 , -0x554 ,2 ,0 ), +0x554 ,2 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_aclk" ,R9A07G044_SDHI0_ACLK ,R9A07G044_CLK_P1 , -0x554 ,3 ,0 ), +0x554 ,3 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi1_imclk" ,R9A07G044_SDHI1_IMCLK ,CLK_SD1_DIV4 , -0x554 ,4 ,0 ), +0x554 ,4 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_imclk2" ,R9A07G044_SDHI1_IMCLK2 ,CLK_SD1_DIV4 , -0x554 ,5 ,0 ), +0x554 ,5 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_clk_hs" ,R9A07G044_SDHI1_CLK_HS ,R9A07G044_CLK_SD1 , -0x554 ,6 ,0 ), +0x554 ,6 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_aclk" ,R9A07G044_SDHI1_ACLK ,R9A07G044_CLK_P1 , -0x554 ,7 ,0 ), +0x554 ,7 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("gpu_clk" ,R9A07G044_GPU_CLK ,R9A07G044_CLK_G , -0x558 ,0 ,0 ), +0x558 ,0 ,MSTOP (BUS_REG1 ,BIT (4 ))),DEF_MOD ("gpu_axi_clk" ,R9A07G044_GPU_AXI_CLK ,R9A07G044_CLK_P1 ,0x558 ,1 ,0 ),DEF_MOD ("gpu_ace_clk" ,R9A07G044_GPU_ACE_CLK ,R9A07G044_CLK_P1 ,0x558 ,2 ,0 ),DEF_MOD ("cru_sysclk" ,R9A07G044_CRU_SYSCLK ,CLK_M2_DIV2 , -0x564 ,0 ,0 ), +0x564 ,0 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_vclk" ,R9A07G044_CRU_VCLK ,R9A07G044_CLK_M2 , -0x564 ,1 ,0 ), +0x564 ,1 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_pclk" ,R9A07G044_CRU_PCLK ,R9A07G044_CLK_ZT , -0x564 ,2 ,0 ), +0x564 ,2 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_aclk" ,R9A07G044_CRU_ACLK ,R9A07G044_CLK_M0 , -0x564 ,3 ,0 ), +0x564 ,3 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("dsi_pll_clk" ,R9A07G044_MIPI_DSI_PLLCLK ,R9A07G044_CLK_M1 , -0x568 ,0 ,0 ), +0x568 ,0 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_MOD ("dsi_sys_clk" ,R9A07G044_MIPI_DSI_SYSCLK ,CLK_M2_DIV2 , -0x568 ,1 ,0 ), +0x568 ,1 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_MOD ("dsi_aclk" ,R9A07G044_MIPI_DSI_ACLK ,R9A07G044_CLK_P1 , -0x568 ,2 ,0 ), +0x568 ,2 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_MOD ("dsi_pclk" ,R9A07G044_MIPI_DSI_PCLK ,R9A07G044_CLK_P2 , -0x568 ,3 ,0 ), +0x568 ,3 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_MOD ("dsi_vclk" ,R9A07G044_MIPI_DSI_VCLK ,R9A07G044_CLK_M3 , -0x568 ,4 ,0 ), +0x568 ,4 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_MOD ("dsi_lpclk" ,R9A07G044_MIPI_DSI_LPCLK ,R9A07G044_CLK_M4 , -0x568 ,5 ,0 ), +0x568 ,5 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (6 ,5 ))),DEF_COUPLED ("lcdc_a" ,R9A07G044_LCDC_CLK_A ,R9A07G044_CLK_M0 , -0x56c ,0 ,0 ), +0x56c ,0 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (8 ,7 ))),DEF_COUPLED ("lcdc_p" ,R9A07G044_LCDC_CLK_P ,R9A07G044_CLK_ZT , -0x56c ,0 ,0 ), +0x56c ,0 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (8 ,7 ))),DEF_MOD ("lcdc_clk_d" ,R9A07G044_LCDC_CLK_D ,R9A07G044_CLK_M3 , -0x56c ,1 ,0 ), +0x56c ,1 ,MSTOP (BUS_PERI_VIDEO ,BIT (9 ))),DEF_MOD ("ssi0_pclk" ,R9A07G044_SSI0_PCLK2 ,R9A07G044_CLK_P0 , -0x570 ,0 ,0 ), +0x570 ,0 ,MSTOP (BUS_MCPU1 ,BIT (10 ))),DEF_MOD ("ssi0_sfr" ,R9A07G044_SSI0_PCLK_SFR ,R9A07G044_CLK_P0 , -0x570 ,1 ,0 ), +0x570 ,1 ,MSTOP (BUS_MCPU1 ,BIT (10 ))),DEF_MOD ("ssi1_pclk" ,R9A07G044_SSI1_PCLK2 ,R9A07G044_CLK_P0 , -0x570 ,2 ,0 ), +0x570 ,2 ,MSTOP (BUS_MCPU1 ,BIT (11 ))),DEF_MOD ("ssi1_sfr" ,R9A07G044_SSI1_PCLK_SFR ,R9A07G044_CLK_P0 , -0x570 ,3 ,0 ), +0x570 ,3 ,MSTOP (BUS_MCPU1 ,BIT (11 ))),DEF_MOD ("ssi2_pclk" ,R9A07G044_SSI2_PCLK2 ,R9A07G044_CLK_P0 , -0x570 ,4 ,0 ), +0x570 ,4 ,MSTOP (BUS_MCPU1 ,BIT (12 ))),DEF_MOD ("ssi2_sfr" ,R9A07G044_SSI2_PCLK_SFR ,R9A07G044_CLK_P0 , -0x570 ,5 ,0 ), +0x570 ,5 ,MSTOP (BUS_MCPU1 ,BIT (12 ))),DEF_MOD ("ssi3_pclk" ,R9A07G044_SSI3_PCLK2 ,R9A07G044_CLK_P0 , -0x570 ,6 ,0 ), +0x570 ,6 ,MSTOP (BUS_MCPU1 ,BIT (13 ))),DEF_MOD ("ssi3_sfr" ,R9A07G044_SSI3_PCLK_SFR ,R9A07G044_CLK_P0 , -0x570 ,7 ,0 ), +0x570 ,7 ,MSTOP (BUS_MCPU1 ,BIT (13 ))),DEF_MOD ("usb0_host" ,R9A07G044_USB_U2H0_HCLK ,R9A07G044_CLK_P1 , -0x578 ,0 ,0 ), +0x578 ,0 ,MSTOP (BUS_PERI_COM ,BIT (5 ))),DEF_MOD ("usb1_host" ,R9A07G044_USB_U2H1_HCLK ,R9A07G044_CLK_P1 , -0x578 ,1 ,0 ), +0x578 ,1 ,MSTOP (BUS_PERI_COM ,BIT (7 ))),DEF_MOD ("usb0_func" ,R9A07G044_USB_U2P_EXR_CPUCLK ,R9A07G044_CLK_P1 , -0x578 ,2 ,0 ), +0x578 ,2 ,MSTOP (BUS_PERI_COM ,BIT (6 ))),DEF_MOD ("usb_pclk" ,R9A07G044_USB_PCLK ,R9A07G044_CLK_P1 , -0x578 ,3 ,0 ), +0x578 ,3 ,MSTOP (BUS_PERI_COM ,BIT (4 ))),DEF_COUPLED ("eth0_axi" ,R9A07G044_ETH0_CLK_AXI ,R9A07G044_CLK_M0 , -0x57c ,0 ,0 ), +0x57c ,0 ,MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_COUPLED ("eth0_chi" ,R9A07G044_ETH0_CLK_CHI ,R9A07G044_CLK_ZT , -0x57c ,0 ,0 ), +0x57c ,0 ,MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_COUPLED ("eth1_axi" ,R9A07G044_ETH1_CLK_AXI ,R9A07G044_CLK_M0 , -0x57c ,1 ,0 ), +0x57c ,1 ,MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_COUPLED ("eth1_chi" ,R9A07G044_ETH1_CLK_CHI ,R9A07G044_CLK_ZT , -0x57c ,1 ,0 ), +0x57c ,1 ,MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_MOD ("i2c0" ,R9A07G044_I2C0_PCLK ,R9A07G044_CLK_P0 , -0x580 ,0 ,0 ), +0x580 ,0 ,MSTOP (BUS_MCPU2 ,BIT (10 ))),DEF_MOD ("i2c1" ,R9A07G044_I2C1_PCLK ,R9A07G044_CLK_P0 , -0x580 ,1 ,0 ), +0x580 ,1 ,MSTOP (BUS_MCPU2 ,BIT (11 ))),DEF_MOD ("i2c2" ,R9A07G044_I2C2_PCLK ,R9A07G044_CLK_P0 , -0x580 ,2 ,0 ), +0x580 ,2 ,MSTOP (BUS_MCPU2 ,BIT (12 ))),DEF_MOD ("i2c3" ,R9A07G044_I2C3_PCLK ,R9A07G044_CLK_P0 , -0x580 ,3 ,0 ), +0x580 ,3 ,MSTOP (BUS_MCPU2 ,BIT (13 ))),DEF_MOD ("scif0" ,R9A07G044_SCIF0_CLK_PCK ,R9A07G044_CLK_P0 , -0x584 ,0 ,0 ), +0x584 ,0 ,MSTOP (BUS_MCPU2 ,BIT (1 ))),DEF_MOD ("scif1" ,R9A07G044_SCIF1_CLK_PCK ,R9A07G044_CLK_P0 , -0x584 ,1 ,0 ), +0x584 ,1 ,MSTOP (BUS_MCPU2 ,BIT (2 ))),DEF_MOD ("scif2" ,R9A07G044_SCIF2_CLK_PCK ,R9A07G044_CLK_P0 , -0x584 ,2 ,0 ), +0x584 ,2 ,MSTOP (BUS_MCPU2 ,BIT (3 ))),DEF_MOD ("scif3" ,R9A07G044_SCIF3_CLK_PCK ,R9A07G044_CLK_P0 , -0x584 ,3 ,0 ), +0x584 ,3 ,MSTOP (BUS_MCPU2 ,BIT (4 ))),DEF_MOD ("scif4" ,R9A07G044_SCIF4_CLK_PCK ,R9A07G044_CLK_P0 , -0x584 ,4 ,0 ), +0x584 ,4 ,MSTOP (BUS_MCPU2 ,BIT (5 ))),DEF_MOD ("sci0" ,R9A07G044_SCI0_CLKP ,R9A07G044_CLK_P0 , -0x588 ,0 ,0 ), +0x588 ,0 ,MSTOP (BUS_MCPU2 ,BIT (7 ))),DEF_MOD ("sci1" ,R9A07G044_SCI1_CLKP ,R9A07G044_CLK_P0 , -0x588 ,1 ,0 ), +0x588 ,1 ,MSTOP (BUS_MCPU2 ,BIT (8 ))),DEF_MOD ("rspi0" ,R9A07G044_RSPI0_CLKB ,R9A07G044_CLK_P0 , -0x590 ,0 ,0 ), +0x590 ,0 ,MSTOP (BUS_MCPU1 ,BIT (14 ))),DEF_MOD ("rspi1" ,R9A07G044_RSPI1_CLKB ,R9A07G044_CLK_P0 , -0x590 ,1 ,0 ), +0x590 ,1 ,MSTOP (BUS_MCPU1 ,BIT (15 ))),DEF_MOD ("rspi2" ,R9A07G044_RSPI2_CLKB ,R9A07G044_CLK_P0 , -0x590 ,2 ,0 ), +0x590 ,2 ,MSTOP (BUS_MCPU2 ,BIT (0 ))),DEF_MOD ("canfd" ,R9A07G044_CANFD_PCLK ,R9A07G044_CLK_P0 , -0x594 ,0 ,0 ), +0x594 ,0 ,MSTOP (BUS_MCPU2 ,BIT (9 ))),DEF_MOD ("gpio" ,R9A07G044_GPIO_HCLK ,R9A07G044_OSCCLK , -0x598 ,0 ,0 ), +0x598 ,0 ,MSTOP (BUS_PERI_CPU ,BIT (6 ))),DEF_MOD ("adc_adclk" ,R9A07G044_ADC_ADCLK ,R9A07G044_CLK_TSU , -0x5a8 ,0 ,0 ), +0x5a8 ,0 ,MSTOP (BUS_MCPU2 ,BIT (14 ))),DEF_MOD ("adc_pclk" ,R9A07G044_ADC_PCLK ,R9A07G044_CLK_P0 , -0x5a8 ,1 ,0 ), +0x5a8 ,1 ,MSTOP (BUS_MCPU2 ,BIT (14 ))),DEF_MOD ("tsu_pclk" ,R9A07G044_TSU_PCLK ,R9A07G044_CLK_TSU , -0x5ac ,0 ,0 ), +0x5ac ,0 ,MSTOP (BUS_MCPU2 ,BIT (15 ))), }, #ifdef CONFIG_CLK_R9A07G054 .drp = {
drivers/clk/renesas/rzg2l-cpg.h +1 -0
@@ -34,6 +34,7 @@#define CPG_BUS_PERI_COM_MSTOP (0xB6C)#define CPG_BUS_PERI_CPU_MSTOP (0xB70)#define CPG_BUS_PERI_DDR_MSTOP (0xB74) +#define CPG_BUS_PERI_VIDEO_MSTOP (0xB78)#define CPG_BUS_REG0_MSTOP (0xB7C)#define CPG_BUS_REG1_MSTOP (0xB80)#define CPG_BUS_TZCDDR_MSTOP (0xB84)
Signature · 1 line
2.43.0
PATCH v3 18/18 clk: renesas: r9a07g043: Add MSTOP for RZ/G2UL
In reply to ClaudiuFrom: Claudiu Beznea <[email protected]>
commit 0f078d37aeeefa197f4ffff6acd677cd3220a070 upstream.
Add MSTOP configuration for all the module clocks on the RZ/G2UL based SoCs (RZ/G2UL, RZ/Five).
--- drivers/clk/renesas/r9a07g043-cpg.c | 132 ++++++++++++++-------------- 1 file changed, 66 insertions(+), 66 deletions(-)
drivers/clk/renesas/r9a07g043-cpg.c +66 -66
@@ -164,143 +164,143 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {static const struct rzg2l_mod_clk r9a07g043_mod_clks[] = { #ifdef CONFIG_ARM64DEF_MOD ("gic" ,R9A07G043_GIC600_GICCLK ,R9A07G043_CLK_P1 , -0x514 ,0 ,0 ), +0x514 ,0 ,MSTOP (BUS_REG1 ,BIT (7 ))),DEF_MOD ("ia55_pclk" ,R9A07G043_IA55_PCLK ,R9A07G043_CLK_P2 , -0x518 ,0 ,0 ), +0x518 ,0 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))),DEF_MOD ("ia55_clk" ,R9A07G043_IA55_CLK ,R9A07G043_CLK_P1 , -0x518 ,1 ,0 ), +0x518 ,1 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))), #endif #ifdef CONFIG_RISCVDEF_MOD ("iax45_pclk" ,R9A07G043_IAX45_PCLK ,R9A07G043_CLK_P2 , -0x518 ,0 ,0 ), +0x518 ,0 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))),DEF_MOD ("iax45_clk" ,R9A07G043_IAX45_CLK ,R9A07G043_CLK_P1 , -0x518 ,1 ,0 ), +0x518 ,1 ,MSTOP (BUS_PERI_CPU ,BIT (13 ))), #endifDEF_MOD ("dmac_aclk" ,R9A07G043_DMAC_ACLK ,R9A07G043_CLK_P1 , -0x52c ,0 ,0 ), +0x52c ,0 ,MSTOP (BUS_REG1 ,BIT (2 ))),DEF_MOD ("dmac_pclk" ,R9A07G043_DMAC_PCLK ,CLK_P1_DIV2 , -0x52c ,1 ,0 ), +0x52c ,1 ,MSTOP (BUS_REG1 ,BIT (3 ))),DEF_MOD ("ostm0_pclk" ,R9A07G043_OSTM0_PCLK ,R9A07G043_CLK_P0 , -0x534 ,0 ,0 ), +0x534 ,0 ,MSTOP (BUS_REG0 ,BIT (4 ))),DEF_MOD ("ostm1_pclk" ,R9A07G043_OSTM1_PCLK ,R9A07G043_CLK_P0 , -0x534 ,1 ,0 ), +0x534 ,1 ,MSTOP (BUS_REG0 ,BIT (5 ))),DEF_MOD ("ostm2_pclk" ,R9A07G043_OSTM2_PCLK ,R9A07G043_CLK_P0 , -0x534 ,2 ,0 ), +0x534 ,2 ,MSTOP (BUS_REG0 ,BIT (6 ))),DEF_MOD ("mtu_x_mck" ,R9A07G043_MTU_X_MCK_MTU3 ,R9A07G043_CLK_P0 , -0x538 ,0 ,0 ), +0x538 ,0 ,MSTOP (BUS_MCPU1 ,BIT (2 ))),DEF_MOD ("wdt0_pclk" ,R9A07G043_WDT0_PCLK ,R9A07G043_CLK_P0 , -0x548 ,0 ,0 ), +0x548 ,0 ,MSTOP (BUS_REG0 ,BIT (2 ))),DEF_MOD ("wdt0_clk" ,R9A07G043_WDT0_CLK ,R9A07G043_OSCCLK , -0x548 ,1 ,0 ), +0x548 ,1 ,MSTOP (BUS_REG0 ,BIT (2 ))),DEF_MOD ("spi_clk2" ,R9A07G043_SPI_CLK2 ,R9A07G043_CLK_SPI1 , -0x550 ,0 ,0 ), +0x550 ,0 ,MSTOP (BUS_MCPU1 ,BIT (1 ))),DEF_MOD ("spi_clk" ,R9A07G043_SPI_CLK ,R9A07G043_CLK_SPI0 , -0x550 ,1 ,0 ), +0x550 ,1 ,MSTOP (BUS_MCPU1 ,BIT (1 ))),DEF_MOD ("sdhi0_imclk" ,R9A07G043_SDHI0_IMCLK ,CLK_SD0_DIV4 , -0x554 ,0 ,0 ), +0x554 ,0 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_imclk2" ,R9A07G043_SDHI0_IMCLK2 ,CLK_SD0_DIV4 , -0x554 ,1 ,0 ), +0x554 ,1 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_clk_hs" ,R9A07G043_SDHI0_CLK_HS ,R9A07G043_CLK_SD0 , -0x554 ,2 ,0 ), +0x554 ,2 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi0_aclk" ,R9A07G043_SDHI0_ACLK ,R9A07G043_CLK_P1 , -0x554 ,3 ,0 ), +0x554 ,3 ,MSTOP (BUS_PERI_COM ,BIT (0 ))),DEF_MOD ("sdhi1_imclk" ,R9A07G043_SDHI1_IMCLK ,CLK_SD1_DIV4 , -0x554 ,4 ,0 ), +0x554 ,4 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_imclk2" ,R9A07G043_SDHI1_IMCLK2 ,CLK_SD1_DIV4 , -0x554 ,5 ,0 ), +0x554 ,5 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_clk_hs" ,R9A07G043_SDHI1_CLK_HS ,R9A07G043_CLK_SD1 , -0x554 ,6 ,0 ), +0x554 ,6 ,MSTOP (BUS_PERI_COM ,BIT (1 ))),DEF_MOD ("sdhi1_aclk" ,R9A07G043_SDHI1_ACLK ,R9A07G043_CLK_P1 , -0x554 ,7 ,0 ), +0x554 ,7 ,MSTOP (BUS_PERI_COM ,BIT (1 ))), #ifdef CONFIG_ARM64DEF_MOD ("cru_sysclk" ,R9A07G043_CRU_SYSCLK ,CLK_M2_DIV2 , -0x564 ,0 ,0 ), +0x564 ,0 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_vclk" ,R9A07G043_CRU_VCLK ,R9A07G043_CLK_M2 , -0x564 ,1 ,0 ), +0x564 ,1 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_pclk" ,R9A07G043_CRU_PCLK ,R9A07G043_CLK_ZT , -0x564 ,2 ,0 ), +0x564 ,2 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_MOD ("cru_aclk" ,R9A07G043_CRU_ACLK ,R9A07G043_CLK_M0 , -0x564 ,3 ,0 ), +0x564 ,3 ,MSTOP (BUS_PERI_VIDEO ,BIT (3 ))),DEF_COUPLED ("lcdc_clk_a" ,R9A07G043_LCDC_CLK_A ,R9A07G043_CLK_M0 , -0x56c ,0 ,0 ), +0x56c ,0 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (8 ,7 ))),DEF_COUPLED ("lcdc_clk_p" ,R9A07G043_LCDC_CLK_P ,R9A07G043_CLK_ZT , -0x56c ,0 ,0 ), +0x56c ,0 ,MSTOP (BUS_PERI_VIDEO ,GENMASK (8 ,7 ))),DEF_MOD ("lcdc_clk_d" ,R9A07G043_LCDC_CLK_D ,R9A07G043_CLK_M3 , -0x56c ,1 ,0 ), +0x56c ,1 ,MSTOP (BUS_PERI_VIDEO ,BIT (9 ))), #endifDEF_MOD ("ssi0_pclk" ,R9A07G043_SSI0_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,0 ,0 ), +0x570 ,0 ,MSTOP (BUS_MCPU1 ,BIT (10 ))),DEF_MOD ("ssi0_sfr" ,R9A07G043_SSI0_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,1 ,0 ), +0x570 ,1 ,MSTOP (BUS_MCPU1 ,BIT (10 ))),DEF_MOD ("ssi1_pclk" ,R9A07G043_SSI1_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,2 ,0 ), +0x570 ,2 ,MSTOP (BUS_MCPU1 ,BIT (11 ))),DEF_MOD ("ssi1_sfr" ,R9A07G043_SSI1_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,3 ,0 ), +0x570 ,3 ,MSTOP (BUS_MCPU1 ,BIT (11 ))),DEF_MOD ("ssi2_pclk" ,R9A07G043_SSI2_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,4 ,0 ), +0x570 ,4 ,MSTOP (BUS_MCPU1 ,BIT (12 ))),DEF_MOD ("ssi2_sfr" ,R9A07G043_SSI2_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,5 ,0 ), +0x570 ,5 ,MSTOP (BUS_MCPU1 ,BIT (12 ))),DEF_MOD ("ssi3_pclk" ,R9A07G043_SSI3_PCLK2 ,R9A07G043_CLK_P0 , -0x570 ,6 ,0 ), +0x570 ,6 ,MSTOP (BUS_MCPU1 ,BIT (13 ))),DEF_MOD ("ssi3_sfr" ,R9A07G043_SSI3_PCLK_SFR ,R9A07G043_CLK_P0 , -0x570 ,7 ,0 ), +0x570 ,7 ,MSTOP (BUS_MCPU1 ,BIT (13 ))),DEF_MOD ("usb0_host" ,R9A07G043_USB_U2H0_HCLK ,R9A07G043_CLK_P1 , -0x578 ,0 ,0 ), +0x578 ,0 ,MSTOP (BUS_PERI_COM ,BIT (5 ))),DEF_MOD ("usb1_host" ,R9A07G043_USB_U2H1_HCLK ,R9A07G043_CLK_P1 , -0x578 ,1 ,0 ), +0x578 ,1 ,MSTOP (BUS_PERI_COM ,BIT (7 ))),DEF_MOD ("usb0_func" ,R9A07G043_USB_U2P_EXR_CPUCLK ,R9A07G043_CLK_P1 , -0x578 ,2 ,0 ), +0x578 ,2 ,MSTOP (BUS_PERI_COM ,BIT (6 ))),DEF_MOD ("usb_pclk" ,R9A07G043_USB_PCLK ,R9A07G043_CLK_P1 , -0x578 ,3 ,0 ), +0x578 ,3 ,MSTOP (BUS_PERI_COM ,BIT (4 ))),DEF_COUPLED ("eth0_axi" ,R9A07G043_ETH0_CLK_AXI ,R9A07G043_CLK_M0 , -0x57c ,0 ,0 ), +0x57c ,0 ,MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_COUPLED ("eth0_chi" ,R9A07G043_ETH0_CLK_CHI ,R9A07G043_CLK_ZT , -0x57c ,0 ,0 ), +0x57c ,0 ,MSTOP (BUS_PERI_COM ,BIT (2 ))),DEF_COUPLED ("eth1_axi" ,R9A07G043_ETH1_CLK_AXI ,R9A07G043_CLK_M0 , -0x57c ,1 ,0 ), +0x57c ,1 ,MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_COUPLED ("eth1_chi" ,R9A07G043_ETH1_CLK_CHI ,R9A07G043_CLK_ZT , -0x57c ,1 ,0 ), +0x57c ,1 ,MSTOP (BUS_PERI_COM ,BIT (3 ))),DEF_MOD ("i2c0" ,R9A07G043_I2C0_PCLK ,R9A07G043_CLK_P0 , -0x580 ,0 ,0 ), +0x580 ,0 ,MSTOP (BUS_MCPU2 ,BIT (10 ))),DEF_MOD ("i2c1" ,R9A07G043_I2C1_PCLK ,R9A07G043_CLK_P0 , -0x580 ,1 ,0 ), +0x580 ,1 ,MSTOP (BUS_MCPU2 ,BIT (11 ))),DEF_MOD ("i2c2" ,R9A07G043_I2C2_PCLK ,R9A07G043_CLK_P0 , -0x580 ,2 ,0 ), +0x580 ,2 ,MSTOP (BUS_MCPU2 ,BIT (12 ))),DEF_MOD ("i2c3" ,R9A07G043_I2C3_PCLK ,R9A07G043_CLK_P0 , -0x580 ,3 ,0 ), +0x580 ,3 ,MSTOP (BUS_MCPU2 ,BIT (13 ))),DEF_MOD ("scif0" ,R9A07G043_SCIF0_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,0 ,0 ), +0x584 ,0 ,MSTOP (BUS_MCPU2 ,BIT (1 ))),DEF_MOD ("scif1" ,R9A07G043_SCIF1_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,1 ,0 ), +0x584 ,1 ,MSTOP (BUS_MCPU2 ,BIT (2 ))),DEF_MOD ("scif2" ,R9A07G043_SCIF2_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,2 ,0 ), +0x584 ,2 ,MSTOP (BUS_MCPU2 ,BIT (3 ))),DEF_MOD ("scif3" ,R9A07G043_SCIF3_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,3 ,0 ), +0x584 ,3 ,MSTOP (BUS_MCPU2 ,BIT (4 ))),DEF_MOD ("scif4" ,R9A07G043_SCIF4_CLK_PCK ,R9A07G043_CLK_P0 , -0x584 ,4 ,0 ), +0x584 ,4 ,MSTOP (BUS_MCPU2 ,BIT (5 ))),DEF_MOD ("sci0" ,R9A07G043_SCI0_CLKP ,R9A07G043_CLK_P0 , -0x588 ,0 ,0 ), +0x588 ,0 ,MSTOP (BUS_MCPU2 ,BIT (7 ))),DEF_MOD ("sci1" ,R9A07G043_SCI1_CLKP ,R9A07G043_CLK_P0 , -0x588 ,1 ,0 ), +0x588 ,1 ,MSTOP (BUS_MCPU2 ,BIT (8 ))),DEF_MOD ("rspi0" ,R9A07G043_RSPI0_CLKB ,R9A07G043_CLK_P0 , -0x590 ,0 ,0 ), +0x590 ,0 ,MSTOP (BUS_MCPU1 ,BIT (14 ))),DEF_MOD ("rspi1" ,R9A07G043_RSPI1_CLKB ,R9A07G043_CLK_P0 , -0x590 ,1 ,0 ), +0x590 ,1 ,MSTOP (BUS_MCPU1 ,BIT (15 ))),DEF_MOD ("rspi2" ,R9A07G043_RSPI2_CLKB ,R9A07G043_CLK_P0 , -0x590 ,2 ,0 ), +0x590 ,2 ,MSTOP (BUS_MCPU2 ,BIT (0 ))),DEF_MOD ("canfd" ,R9A07G043_CANFD_PCLK ,R9A07G043_CLK_P0 , -0x594 ,0 ,0 ), +0x594 ,0 ,MSTOP (BUS_MCPU2 ,BIT (9 ))),DEF_MOD ("gpio" ,R9A07G043_GPIO_HCLK ,R9A07G043_OSCCLK , -0x598 ,0 ,0 ), +0x598 ,0 ,MSTOP (BUS_PERI_CPU ,BIT (6 ))),DEF_MOD ("adc_adclk" ,R9A07G043_ADC_ADCLK ,R9A07G043_CLK_TSU , -0x5a8 ,0 ,0 ), +0x5a8 ,0 ,MSTOP (BUS_MCPU2 ,BIT (14 ))),DEF_MOD ("adc_pclk" ,R9A07G043_ADC_PCLK ,R9A07G043_CLK_P0 , -0x5a8 ,1 ,0 ), +0x5a8 ,1 ,MSTOP (BUS_MCPU2 ,BIT (14 ))),DEF_MOD ("tsu_pclk" ,R9A07G043_TSU_PCLK ,R9A07G043_CLK_TSU , -0x5ac ,0 ,0 ), +0x5ac ,0 ,MSTOP (BUS_MCPU2 ,BIT (15 ))), #ifdef CONFIG_RISCVDEF_MOD ("nceplic_aclk" ,R9A07G043_NCEPLIC_ACLK ,R9A07G043_CLK_P1 , -0x608 ,0 ,0 ), +0x608 ,0 ,MSTOP (BUS_REG1 ,BIT (7 ))), #endif };
Signature · 1 line
2.43.0
Pavel Machek
AppliedHi!
Quoted 6 lines
Series backports the MSTOP (Module Stop) support for the Renesas RZ/G2L, RZ/G2LC, RZ/G2UL, RZ/G3S, RZ/Five, RZ/V2L SoCs.
The purpose of MSTOP is to reduce power consumption by stopping unnecessary module's functions.
Quoted 7 lines
If any master accesses a module that has the clock stopped and the MSTOP bit set, a bus error will occur.
Due to this, to avoid CPU generating synchronous aborts, changes to PM domain specific code were needed. The changes backported in this series were adjusted to be executed only for the above mentioned Renesas SoCs.
Thank you, applied and pushed out.
Best regards,
Pavel
Signature · 1 line
In cooperation with Nabla.