soc: add polarfire soc system controller
Subsystems (3)
[email protected]
maintainerv2 cover soc: add polarfire soc system controller
From: Conor Dooley <[email protected]>
Changes since v1:
- system controller is now an mfd
- parentage is now used to get the device node on the system controller
- mpfs_sys_controller_get() now updates the reference count
- "polarfire-soc" in compat string changed to "mpfs"
Depends on [0] to change the compat string in the dt-binding.
@Arnd Bergmann:
I sent the first version of this patch in November & you (along with requesting referencing counting) wanted me to check if the driver was bound to the specific device [1]. I have taken another look at this driver now and I am still none the wiser as to how I should do this.
As I said in the previous thread, I checked other driver but was not able to find any examples of of_find_device_by_node() where the binding of the driver was checked. If you could point me towards an example that would be great.
Thanks,
Conor.
For some extra context, the device tree entry for this driver will look like:
syscontroller: syscontroller {
compatible = "microchip,mpfs-sys-controller", "simple-mfd";
mboxes = <&mbox 0>;
hwrandom: hwrandom {
compatible = "microchip,mpfs-rng";
};
sysserv: sysserv {
compatible = "microchip,mpfs-generic-service";
};
};and the mpfs_sys_controller_get() function is called in, for example, the mpfs-rng driver:
node_pointer = of_get_parent(dev->of_node);
if (!node_pointer) {
dev_err(&pdev->dev,
"Failed to find mpfs system controller node\n");
return -ENODEV;
}rng_priv->sys_controller = mpfs_sys_controller_get(&pdev->dev, node_pointer);
[0] https://lore.kernel.org/linux-riscv/CAMuHMdWTjrAiHosU0cGyJYkK=9JzNgHb=tjHXPdYxTWmkVzeYQ@mail.gmail.com/T/
[1] https://lore.kernel.org/linux-riscv/CAK8P3a1m_LhOg5JGMqPz6sohJa2hPZ3GN-jQDPxigZ5DaqAGxQ@mail.gmail.com/
Conor Dooley (1):
soc: add polarfire soc system controller
drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/microchip/Kconfig | 10 ++ drivers/soc/microchip/Makefile | 1 + drivers/soc/microchip/mpfs-sys-controller.c | 169 ++++++++++++++++++++ include/soc/microchip/mpfs.h | 3 +- 6 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/microchip/Kconfig create mode 100644 drivers/soc/microchip/Makefile create mode 100644 drivers/soc/microchip/mpfs-sys-controller.c
Signature · 7 lines
2.33.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
[email protected]
maintainerPATCH v2 1/1 soc: add polarfire soc system controller
From: Conor Dooley <[email protected]>
This driver provides an interface for other drivers to access the functions of the system controller on the Microchip PolarFire SoC.
--- drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/microchip/Kconfig | 10 ++ drivers/soc/microchip/Makefile | 1 + drivers/soc/microchip/mpfs-sys-controller.c | 169 ++++++++++++++++++++ include/soc/microchip/mpfs.h | 3 +- 6 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/microchip/Kconfig create mode 100644 drivers/soc/microchip/Makefile create mode 100644 drivers/soc/microchip/mpfs-sys-controller.c
drivers/soc/Kconfig +1 -0
@@ -12,6 +12,7 @@ source "drivers/soc/imx/Kconfig" source "drivers/soc/ixp4xx/Kconfig" source "drivers/soc/litex/Kconfig" source "drivers/soc/mediatek/Kconfig" +source "drivers/soc/microchip/Kconfig" source "drivers/soc/qcom/Kconfig" source "drivers/soc/renesas/Kconfig" source "drivers/soc/rockchip/Kconfig"
drivers/soc/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-y += ixp4xx/ obj-$(CONFIG_SOC_XWAY) += lantiq/ obj-$(CONFIG_LITEX_SOC_CONTROLLER) += litex/ obj-y += mediatek/ +obj-y += microchip/ obj-y += amlogic/ obj-y += qcom/ obj-y += renesas/
drivers/soc/microchip/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +config POLARFIRE_SOC_SYS_CTRL + tristate "POLARFIRE_SOC_SYS_CTRL" + depends on POLARFIRE_SOC_MAILBOX + help + This driver adds support for the PolarFire SoC (MPFS) system controller. + + To compile this driver as a module, choose M here. the + module will be called mpfs_system_controller. + + If unsure, say N.
drivers/soc/microchip/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_POLARFIRE_SOC_SYS_CTRL) += mpfs-sys-controller.o
drivers/soc/microchip/mpfs-sys-controller.c new file +169 -0
169 lines not on this page · raw message
include/soc/microchip/mpfs.h +2 -1
@@ -36,7 +36,8 @@ struct mpfs_mss_response {int mpfs_blocking_transaction (struct mpfs_sys_controller *mpfs_client,void *msg); -struct mpfs_sys_controller *mpfs_sys_controller_get (struct device_node *mailbox_node); +struct mpfs_sys_controller *mpfs_sys_controller_get (struct device *dev, +struct device_node *sys_ctrl_node);#endif /* if IS_ENABLED(CONFIG_POLARFIRE_SOC_SYS_CTRL) */
Signature · 7 lines
2.33.1 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv
[email protected]
maintainerQuoted 10 lines · On 20/12/2021 14:44, [email protected] wrote:
From: Conor Dooley <[email protected]>
Changes since v1:
- system controller is now an mfd
- parentage is now used to get the device node on the system controller
-mpfs_sys_controller_get()now updates the reference count
- "polarfire-soc" in compat string changed to "mpfs"Depends on [0] to change the compat string in the dt-binding.
Hey Arnd, if you could take a look at this it'd be great
Quoted 55 lines
@Arnd Bergmann:
I sent the first version of this patch in November & you (along with requesting referencing counting) wanted me to check if the driver was bound to the specific device [1]. I have taken another look at this driver now and I am still none the wiser as to how I should do this.As I said in the previous thread, I checked other drivers but was not able to find any examples of
of_find_device_by_node()where the binding of the driver was checked. If you could point me towards an example that would be great.Thanks,
Conor.For some extra context, the device tree entry for this driver will look like:
syscontroller: syscontroller { compatible = "microchip,mpfs-sys-controller", "simple-mfd"; mboxes = <&mbox 0>; hwrandom: hwrandom { compatible = "microchip,mpfs-rng"; }; sysserv: sysserv { compatible = "microchip,mpfs-generic-service"; }; };and the
mpfs_sys_controller_get()function is called in, for example, the mpfs-rng driver:
node_pointer=of_get_parent(dev->of_node);if (!node_pointer) { dev_err(&pdev->dev, "Failed to find mpfs system controller node\n"); return -ENODEV; }
rng_priv->sys_controller=mpfs_sys_controller_get(&pdev->dev, node_pointer);[0] https://lore.kernel.org/linux-riscv/CAMuHMdWTjrAiHosU0cGyJYkK=9JzNgHb=tjHXPdYxTWmkVzeYQ@mail.gmail.com/T/
[1] https://lore.kernel.org/linux-riscv/CAK8P3a1m_LhOg5JGMqPz6sohJa2hPZ3GN-jQDPxigZ5DaqAGxQ@mail.gmail.com/Conor Dooley (1):
soc: add polarfire soc system controllerdrivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/microchip/Kconfig | 10 ++ drivers/soc/microchip/Makefile | 1 + drivers/soc/microchip/mpfs-sys-controller.c | 169 ++++++++++++++++++++ include/soc/microchip/mpfs.h | 3 +- 6 files changed, 184 insertions(+), 1 deletion(-)
Quoted 4 lines
create mode 100644
drivers/soc/microchip/Kconfigcreate mode 100644drivers/soc/microchip/Makefilecreate mode 100644drivers/soc/microchip/mpfs-sys-controller.c
_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv