diff options
| author | Krzysztof Kozlowski <krzk@kernel.org> | 2026-10-01 12:41:57 +0200 |
|---|---|---|
| committer | Krzysztof Kozlowski <krzk@kernel.org> | 2026-10-01 12:41:57 +0200 |
| commit | 829945bdb7b3aee2e4381325b04b0b1d313292f1 (patch) | |
| tree | 58e85e40093b83c924cd78b50bb6d1984fa4b5cd /drivers | |
| parent | cee9395acd8043be0644b25c34bfa86623f2b935 (diff) | |
| parent | 10eeafc3e90ebbe6627a7d471b86af889d7b07e5 (diff) | |
Merge tag 'renesas-drivers-for-v7.4-tag1' of https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel into soc/drivers
Renesas driver updates for v7.4
- Register the SYSC power sequencer on RZ/G2L,
- Add hwspinlock support for R-Car V4H, V4M, and X5H,
- Add initial support for RZ/G2M v3.0,
- Miscellaneous fixes and improvements.
* tag 'renesas-drivers-for-v7.4-tag1' of https://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-devel:
soc: renesas: rcar-rst: Add support for RZ/G2M v3.0
soc: renesas: Identify RZ/G2M v3.0 SoC
soc: renesas: rcar-mfis: Add hwspinlock support
soc: renesas: Kconfig: Select POWER_SEQUENCING_RENESAS_PWRRDY for R9A08G046
soc: renesas: rz-sysc: Register auxiliary device for PWRRDY power sequencer
soc: renesas: rcar-mfis: Convert spinlock to raw_spinlock
soc: renesas: Expand MFIS acronym in RCAR_MFIS help description
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/soc/renesas/Kconfig | 19 | ||||
| -rw-r--r-- | drivers/soc/renesas/r9a08g046-sysc.c | 1 | ||||
| -rw-r--r-- | drivers/soc/renesas/rcar-mfis.c | 62 | ||||
| -rw-r--r-- | drivers/soc/renesas/rcar-rst.c | 1 | ||||
| -rw-r--r-- | drivers/soc/renesas/renesas-soc.c | 3 | ||||
| -rw-r--r-- | drivers/soc/renesas/rz-sysc.c | 5 | ||||
| -rw-r--r-- | drivers/soc/renesas/rz-sysc.h | 2 |
7 files changed, 84 insertions, 9 deletions
diff --git a/drivers/soc/renesas/Kconfig b/drivers/soc/renesas/Kconfig index eb8ac0d47d9d..0f6d53abd86c 100644 --- a/drivers/soc/renesas/Kconfig +++ b/drivers/soc/renesas/Kconfig @@ -227,6 +227,13 @@ config ARCH_R8A774A1 help This enables support for the Renesas RZ/G2M SoC. +config ARCH_R8A774A3 + bool "ARM64 Platform support for R8A774A3 (RZ/G2M v3.0)" + default y if ARCH_RENESAS + select ARCH_RCAR_GEN3 + help + This enables support for the Renesas RZ/G2M SoC (version 3.0). + config ARCH_R8A774B1 bool "ARM64 Platform support for R8A774B1 (RZ/G2N)" default y if ARCH_RENESAS @@ -468,11 +475,12 @@ endif # RISCV config RCAR_MFIS tristate "Renesas R-Car MFIS driver" depends on ARCH_RENESAS || COMPILE_TEST - depends on MAILBOX + depends on MAILBOX && HWSPINLOCK help - Select this option to enable the Renesas R-Car MFIS core driver for - the MFIS device found on SoCs like R-Car. On families like Gen5, this - is needed to communicate with the SCP. + Select this option to enable support for the Renesas R-Car + Multifunctional Interface (MFIS) device found on SoCs like R-Car. + On families like R-Car Gen5, this is needed to communicate with the + SCP. config PWC_RZV2M bool "Renesas RZ/V2M PWC support" if COMPILE_TEST @@ -486,6 +494,7 @@ config RZN1_IRQMUX config SYSC_RZ bool "System controller for RZ SoCs" if COMPILE_TEST select MFD_SYSCON + select AUXILIARY_BUS config SYSC_R9A08G045 bool "Renesas System controller support for R9A08G045 (RZ/G3S)" if COMPILE_TEST @@ -494,6 +503,8 @@ config SYSC_R9A08G045 config SYSC_R9A08G046 bool "Renesas System controller support for R9A08G046 (RZ/G3L)" if COMPILE_TEST select SYSC_RZ + select POWER_SEQUENCING + select POWER_SEQUENCING_RENESAS_PWRRDY config SYS_R9A09G047 bool "Renesas System controller support for R9A09G047 (RZ/G3E)" if COMPILE_TEST diff --git a/drivers/soc/renesas/r9a08g046-sysc.c b/drivers/soc/renesas/r9a08g046-sysc.c index 90db9d383539..cd129c727461 100644 --- a/drivers/soc/renesas/r9a08g046-sysc.c +++ b/drivers/soc/renesas/r9a08g046-sysc.c @@ -76,6 +76,7 @@ static const struct rz_sysc_soc_id_init_data rzg3l_sysc_soc_id_init_data __initc .devid_offset = 0xa04, .revision_mask = GENMASK(31, 28), .specific_id_mask = GENMASK(27, 0), + .pwrrdy_pwrseq = true, }; const struct rz_sysc_init_data rzg3l_sysc_init_data __initconst = { diff --git a/drivers/soc/renesas/rcar-mfis.c b/drivers/soc/renesas/rcar-mfis.c index 3435c3e16198..d5bbc3077373 100644 --- a/drivers/soc/renesas/rcar-mfis.c +++ b/drivers/soc/renesas/rcar-mfis.c @@ -8,6 +8,7 @@ */ #include <dt-bindings/soc/renesas,r8a78000-mfis.h> #include <linux/device.h> +#include <linux/hwspinlock.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/kernel.h> @@ -19,12 +20,18 @@ #include <linux/platform_device.h> #include <linux/spinlock.h> +/* FIXME: hwspinlock core refactoring to not need internal header is on-going */ +#include "../../hwspinlock/hwspinlock_internal.h" + +#define MFISLCKR0 0xc0 +#define MFISLCKR8 0x0724 #define MFISWPCNTR 0x0900 #define MFISWACNTR 0x0904 #define MFIS_X5H_IICR(i) ((i) * 0x1000 + 0x00) #define MFIS_X5H_EICR(i) ((i) * 0x1000 + 0x04) +#define MFIS_NUM_LOCKS 64 #define MFIS_UNPROTECT_KEY 0xACCE0000 struct mfis_priv; @@ -42,6 +49,7 @@ struct mfis_info { unsigned int mb_tx_uses_eicr:1; unsigned int mb_channels_are_unidir:1; u32 (*mb_calc_reg)(u32 chan_num, bool tx_uses_eicr, bool is_only_rx); + int hwsp_base_id; }; struct mfis_chan_priv { @@ -50,7 +58,7 @@ struct mfis_chan_priv { }; struct mfis_priv { - spinlock_t unprotect_lock; /* guards access to the unprotection reg */ + raw_spinlock_t unprotect_lock; /* guards access to unprotection reg */ struct device *dev; struct mfis_reg common_reg; struct mfis_reg mbox_reg; @@ -59,6 +67,9 @@ struct mfis_priv { /* mailbox private data */ struct mbox_controller mbox; struct mfis_chan_priv *chan_privs; + + /* hwspinlock private data */ + struct hwspinlock_device bank; /* flex array inside, must be last! */ }; static u32 mfis_read(struct mfis_reg *mreg, unsigned int reg) @@ -80,13 +91,45 @@ static void mfis_write(struct mfis_reg *mreg, u32 reg, u32 val) unprotect_code = (MFIS_UNPROTECT_KEY & ~unprotect_mask) | ((mreg->start + reg) & unprotect_mask); - spin_lock_irqsave(&priv->unprotect_lock, flags); + raw_spin_lock_irqsave(&priv->unprotect_lock, flags); iowrite32(unprotect_code, priv->common_reg.base + MFISWACNTR); iowrite32(val, mreg->base + reg); - spin_unlock_irqrestore(&priv->unprotect_lock, flags); + raw_spin_unlock_irqrestore(&priv->unprotect_lock, flags); } /******************************************************** + * HW Spinlocks * + ********************************************************/ + +#define MFISLCKR8_CH_OFS (MFISLCKR8 - 8 * sizeof(u32)) + +static int rcar_mfis_hwsp_trylock(struct hwspinlock *lock) +{ + struct mfis_priv *priv = lock->priv; + int id = hwlock_to_id(lock) - lock->bank->base_id; + u32 val, reg; + + reg = id * sizeof(u32) + (id < 8 ? MFISLCKR0 : MFISLCKR8_CH_OFS); + val = mfis_read(&priv->common_reg, reg); + return !val; +} + +static void rcar_mfis_hwsp_unlock(struct hwspinlock *lock) +{ + struct mfis_priv *priv = lock->priv; + int id = hwlock_to_id(lock) - lock->bank->base_id; + u32 reg; + + reg = id * sizeof(u32) + (id < 8 ? MFISLCKR0 : MFISLCKR8_CH_OFS); + mfis_write(&priv->common_reg, reg, 0); +} + +static const struct hwspinlock_ops rcar_mfis_hwsp_ops = { + .trylock = rcar_mfis_hwsp_trylock, + .unlock = rcar_mfis_hwsp_unlock, +}; + +/******************************************************** * Mailbox * ********************************************************/ @@ -314,7 +357,7 @@ static int mfis_probe(struct platform_device *pdev) struct mfis_priv *priv; int ret; - priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); + priv = devm_kzalloc(dev, struct_size(priv, bank.lock, MFIS_NUM_LOCKS), GFP_KERNEL); if (!priv) return -ENOMEM; @@ -323,7 +366,7 @@ static int mfis_probe(struct platform_device *pdev) if (!priv->info) return -ENOENT; - spin_lock_init(&priv->unprotect_lock); + raw_spin_lock_init(&priv->unprotect_lock); ret = mfis_reg_probe(pdev, priv, &priv->common_reg, "common", true); if (ret) @@ -333,6 +376,14 @@ static int mfis_probe(struct platform_device *pdev) if (ret) return ret; + for (unsigned int ch = 0; ch < MFIS_NUM_LOCKS; ch++) + priv->bank.lock[ch].priv = priv; + + ret = devm_hwspin_lock_register(dev, &priv->bank, &rcar_mfis_hwsp_ops, + priv->info->hwsp_base_id, MFIS_NUM_LOCKS); + if (ret) + return ret; + return mfis_mb_probe(priv); } @@ -357,6 +408,7 @@ static const struct mfis_info mfis_info_r8a78000_scp = { .mb_tx_uses_eicr = true, .mb_channels_are_unidir = true, .mb_calc_reg = mfis_mb_r8a78000_calc_reg, + .hwsp_base_id = MFIS_NUM_LOCKS, }; static const struct of_device_id mfis_mfd_of_match[] = { diff --git a/drivers/soc/renesas/rcar-rst.c b/drivers/soc/renesas/rcar-rst.c index 0541990901fc..26f976880d3f 100644 --- a/drivers/soc/renesas/rcar-rst.c +++ b/drivers/soc/renesas/rcar-rst.c @@ -93,6 +93,7 @@ static const struct of_device_id rcar_rst_matches[] __initconst = { { .compatible = "renesas,r8a77470-rst", .data = &rcar_rst_gen2 }, /* RZ/G2 is handled like R-Car Gen3 */ { .compatible = "renesas,r8a774a1-rst", .data = &rcar_rst_gen3 }, + { .compatible = "renesas,r8a774a3-rst", .data = &rcar_rst_gen3 }, { .compatible = "renesas,r8a774b1-rst", .data = &rcar_rst_gen3 }, { .compatible = "renesas,r8a774c0-rst", .data = &rcar_rst_gen3 }, { .compatible = "renesas,r8a774e1-rst", .data = &rcar_rst_gen3 }, diff --git a/drivers/soc/renesas/renesas-soc.c b/drivers/soc/renesas/renesas-soc.c index 18acca73064c..5a5d05013eb7 100644 --- a/drivers/soc/renesas/renesas-soc.c +++ b/drivers/soc/renesas/renesas-soc.c @@ -312,6 +312,9 @@ static const struct of_device_id renesas_socs[] __initconst __maybe_unused = { #ifdef CONFIG_ARCH_R8A774A1 { .compatible = "renesas,r8a774a1", .data = &soc_rz_g2m }, #endif +#ifdef CONFIG_ARCH_R8A774A3 + { .compatible = "renesas,r8a774a3", .data = &soc_rz_g2m }, +#endif #ifdef CONFIG_ARCH_R8A774B1 { .compatible = "renesas,r8a774b1", .data = &soc_rz_g2n }, #endif diff --git a/drivers/soc/renesas/rz-sysc.c b/drivers/soc/renesas/rz-sysc.c index 161e8c38eea6..0e92c415d4be 100644 --- a/drivers/soc/renesas/rz-sysc.c +++ b/drivers/soc/renesas/rz-sysc.c @@ -5,6 +5,7 @@ * Copyright (C) 2024 Renesas Electronics Corp. */ +#include <linux/auxiliary_bus.h> #include <linux/bitfield.h> #include <linux/cleanup.h> #include <linux/io.h> @@ -149,6 +150,10 @@ static int rz_sysc_probe(struct platform_device *pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); + if (data->soc_id_init_data->pwrrdy_pwrseq && + !devm_auxiliary_device_create(dev, "pwrseq-pwrrdy", regmap)) + return -ENODEV; + return of_syscon_register_regmap(dev->of_node, regmap); } diff --git a/drivers/soc/renesas/rz-sysc.h b/drivers/soc/renesas/rz-sysc.h index 921ee0d26c47..e55f3258d703 100644 --- a/drivers/soc/renesas/rz-sysc.h +++ b/drivers/soc/renesas/rz-sysc.h @@ -20,6 +20,7 @@ * @revision_mask: SYSC SoC ID revision mask * @specific_id_mask: SYSC SoC ID specific ID mask * @print_id: print SoC-specific extended device identification + * @pwrrdy_pwrseq: has pwrrdy register controlled through power sequencer */ struct rz_sysc_soc_id_init_data { const char * const family; @@ -29,6 +30,7 @@ struct rz_sysc_soc_id_init_data { u32 specific_id_mask; void (*print_id)(struct device *dev, void __iomem *sysc_base, struct soc_device_attribute *soc_dev_attr); + bool pwrrdy_pwrseq; }; /** |
