From 37ccad07fd050815890ba222892169e7bcda1dec Mon Sep 17 00:00:00 2001 From: Ciprian Marian Costea Date: Mon, 26 May 2025 19:32:59 +0300 Subject: [PATCH 1/4] MAINTAINERS: add NXP S32G RTC driver Add the NXP S32G RTC driver as maintained so further patches on this driver can be reviewed under this architecture. Signed-off-by: Ciprian Marian Costea Signed-off-by: Shawn Guo --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index a92290fffa16..f9b72cefdb24 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3001,8 +3001,10 @@ R: Ghennadi Procopciuc R: NXP S32 Linux Team L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/rtc/nxp,s32g-rtc.yaml F: arch/arm64/boot/dts/freescale/s32g*.dts* F: drivers/pinctrl/nxp/ +F: drivers/rtc/rtc-s32g.c ARM/NXP S32G/S32R DWMAC ETHERNET DRIVER M: Jan Petrous From 796cba2dd4d9fb72c2de8fceb4e5c67a6f3c3f9a Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Tue, 10 Jun 2025 12:01:49 -0400 Subject: [PATCH 2/4] bus: add driver for IMX AIPSTZ bridge The secure AHB to IP Slave (AIPSTZ) bus bridge provides access control configurations meant to restrict access to certain peripherals. Some of the configurations include: 1) Marking masters as trusted for R/W. Based on this (and the configuration of the accessed peripheral), the bridge may choose to abort the R/W transactions issued by certain masters. 2) Allowing/disallowing write accesses to peripherals. Add driver for this IP. Since there's currently no framework for access controllers (and since there's currently no need for having flexibility w.r.t the configurations) all this driver does is it applies a relaxed, "default" configuration, in which all masters are trusted for R/W. Note that some instances of this IP (e.g: AIPSTZ5 on i.MX8MP) may be tied to a power domain and may lose their configuration when the domain is powered off. This is why the configuration has to be restored when the domain is powered on. Co-developed-by: Daniel Baluta Signed-off-by: Daniel Baluta Signed-off-by: Laurentiu Mihalcea Signed-off-by: Shawn Guo --- drivers/bus/Kconfig | 6 +++ drivers/bus/Makefile | 1 + drivers/bus/imx-aipstz.c | 96 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 drivers/bus/imx-aipstz.c diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index ff669a8ccad9..fe7600283e70 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -87,6 +87,12 @@ config HISILICON_LPC Driver to enable I/O access to devices attached to the Low Pin Count bus on the HiSilicon Hip06/7 SoC. +config IMX_AIPSTZ + tristate "Support for IMX Secure AHB to IP Slave bus (AIPSTZ) bridge" + depends on ARCH_MXC + help + Enable support for IMX AIPSTZ bridge. + config IMX_WEIM bool "Freescale EIM DRIVER" depends on ARCH_MXC || COMPILE_TEST diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index cddd4984d6af..8e693fe8a03a 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -15,6 +15,7 @@ obj-$(CONFIG_FSL_MC_BUS) += fsl-mc/ obj-$(CONFIG_BT1_APB) += bt1-apb.o obj-$(CONFIG_BT1_AXI) += bt1-axi.o +obj-$(CONFIG_IMX_AIPSTZ) += imx-aipstz.o obj-$(CONFIG_IMX_WEIM) += imx-weim.o obj-$(CONFIG_INTEL_IXP4XX_EB) += intel-ixp4xx-eb.o obj-$(CONFIG_MIPS_CDMM) += mips_cdmm.o diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c new file mode 100644 index 000000000000..6610251f41c7 --- /dev/null +++ b/drivers/bus/imx-aipstz.c @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright 2025 NXP + */ + +#include +#include +#include +#include +#include +#include + +#define IMX_AIPSTZ_MPR0 0x0 + +struct imx_aipstz_config { + u32 mpr0; +}; + +struct imx_aipstz_data { + void __iomem *base; + const struct imx_aipstz_config *default_cfg; +}; + +static void imx_aipstz_apply_default(struct imx_aipstz_data *data) +{ + writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0); +} + +static int imx_aipstz_probe(struct platform_device *pdev) +{ + struct imx_aipstz_data *data; + + data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); + if (!data) + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed to allocate data memory\n"); + + data->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL); + if (IS_ERR(data->base)) + return dev_err_probe(&pdev->dev, -ENOMEM, + "failed to get/ioremap AC memory\n"); + + data->default_cfg = of_device_get_match_data(&pdev->dev); + + imx_aipstz_apply_default(data); + + dev_set_drvdata(&pdev->dev, data); + + pm_runtime_set_active(&pdev->dev); + devm_pm_runtime_enable(&pdev->dev); + + return devm_of_platform_populate(&pdev->dev); +} + +static int imx_aipstz_runtime_resume(struct device *dev) +{ + struct imx_aipstz_data *data = dev_get_drvdata(dev); + + /* restore potentially lost configuration during domain power-off */ + imx_aipstz_apply_default(data); + + return 0; +} + +static const struct dev_pm_ops imx_aipstz_pm_ops = { + RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) +}; + +/* + * following configuration is equivalent to: + * masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege + */ +static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = { + .mpr0 = 0x77777777, +}; + +static const struct of_device_id imx_aipstz_of_ids[] = { + { .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg }, + { } +}; +MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids); + +static struct platform_driver imx_aipstz_of_driver = { + .probe = imx_aipstz_probe, + .driver = { + .name = "imx-aipstz", + .of_match_table = imx_aipstz_of_ids, + .pm = pm_ptr(&imx_aipstz_pm_ops), + }, +}; +module_platform_driver(imx_aipstz_of_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("IMX secure AHB to IP Slave bus (AIPSTZ) bridge driver"); +MODULE_AUTHOR("Laurentiu Mihalcea "); From 486225f952c04a618312e68a68044256559b974a Mon Sep 17 00:00:00 2001 From: Peng Fan Date: Mon, 7 Jul 2025 14:37:53 +0800 Subject: [PATCH 3/4] MAINTAINERS: Update i.MX entry Add two patterns: - Documentation/devicetree/bindings/firmware/fsl* - Documentation/devicetree/bindings/firmware/nxp* Signed-off-by: Peng Fan Signed-off-by: Shawn Guo --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index f9b72cefdb24..7080e3eca238 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2586,6 +2586,8 @@ L: imx@lists.linux.dev L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git +F: Documentation/devicetree/bindings/firmware/fsl* +F: Documentation/devicetree/bindings/firmware/nxp* F: arch/arm/boot/dts/nxp/imx/ F: arch/arm/boot/dts/nxp/mxs/ F: arch/arm64/boot/dts/freescale/ From 5080cf6339d387720cb8def1001c61c779d9edcb Mon Sep 17 00:00:00 2001 From: Laurentiu Mihalcea Date: Mon, 7 Jul 2025 19:46:27 -0400 Subject: [PATCH 4/4] bus: imx-aipstz: allow creating pdevs for child buses devm_of_platform_populate() passes a NULL as the bus OF match table to the underlying of_platform_populate(), meaning child bus devices of the AIPSTZ bridge will not have its children devices created. Since some SoCs (e.g. i.MX8MP) use this particular setup (e.g. SPBA bus, which is a child of AIPSTZ5 and has multiple child nodes), the driver needs to support it. Therefore, replace devm_of_platform_populate() with of_platform_populate() and pass a reference to the bus OF match table to it. For now, the only possible child buses are simple buses. Since the usage of devres is dropped, the complementary operation of of_platform_populate() needs to be called during the driver's removal. Signed-off-by: Laurentiu Mihalcea Fixes: 796cba2dd4d9 ("bus: add driver for IMX AIPSTZ bridge") Reported-by: Alexander Stein Closes: https://lore.kernel.org/lkml/5029548.31r3eYUQgx@steina-w/#t Tested-by: Alexander Stein Signed-off-by: Shawn Guo --- drivers/bus/imx-aipstz.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/bus/imx-aipstz.c b/drivers/bus/imx-aipstz.c index 6610251f41c7..5fdf377f5d06 100644 --- a/drivers/bus/imx-aipstz.c +++ b/drivers/bus/imx-aipstz.c @@ -26,6 +26,11 @@ static void imx_aipstz_apply_default(struct imx_aipstz_data *data) writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0); } +static const struct of_device_id imx_aipstz_match_table[] = { + { .compatible = "simple-bus", }, + { } +}; + static int imx_aipstz_probe(struct platform_device *pdev) { struct imx_aipstz_data *data; @@ -49,7 +54,13 @@ static int imx_aipstz_probe(struct platform_device *pdev) pm_runtime_set_active(&pdev->dev); devm_pm_runtime_enable(&pdev->dev); - return devm_of_platform_populate(&pdev->dev); + return of_platform_populate(pdev->dev.of_node, imx_aipstz_match_table, + NULL, &pdev->dev); +} + +static void imx_aipstz_remove(struct platform_device *pdev) +{ + of_platform_depopulate(&pdev->dev); } static int imx_aipstz_runtime_resume(struct device *dev) @@ -83,6 +94,7 @@ MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids); static struct platform_driver imx_aipstz_of_driver = { .probe = imx_aipstz_probe, + .remove = imx_aipstz_remove, .driver = { .name = "imx-aipstz", .of_match_table = imx_aipstz_of_ids,