Skip to contentSkip to conversation

soc: add polarfire soc system controller

PATCH Superseded [email protected] 2 participants 2 messages Dec 23, 2020 – Jan 5, 2021

Subsystems (3)

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH v3 3/5 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 | 127 ++++++++++++++++++++
 5 files changed, 140 insertions(+)
 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
index 425ab6f7e375..22cb097bcbdc 100644
@@ -9,6 +9,7 @@ source "drivers/soc/bcm/Kconfig"
 source "drivers/soc/fsl/Kconfig"
 source "drivers/soc/imx/Kconfig"
 source "drivers/soc/ixp4xx/Kconfig"
+source "drivers/soc/microchip/Kconfig"
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
 source "drivers/soc/renesas/Kconfig"
drivers/soc/Makefile +1 -0
index 36452bed86ef..fb084cf2d12e 100644
@@ -14,6 +14,7 @@ obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
 obj-y				+= imx/
 obj-$(CONFIG_ARCH_IXP4XX)	+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
+obj-$(CONFIG_SOC_MICROCHIP_POLARFIRE)	+= microchip/
 obj-y				+= mediatek/
 obj-y				+= amlogic/
 obj-y				+= qcom/
drivers/soc/microchip/Kconfig new file +10 -0
new file mode 100644
index 000000000000..eb656b33156b
@@ -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
new file mode 100644
index 000000000000..14489919fe4b
@@ -0,0 +1 @@
+obj-$(CONFIG_POLARFIRE_SOC_SYS_CTRL)	+= mpfs-sys-controller.o
drivers/soc/microchip/mpfs-sys-controller.c new file +127 -0

127 lines not on this page · raw message

Signature · 7 lines
2.17.1


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
#1 lore raw

Hello,

Quoted 7 lines · On Wed, Dec 23, 2020 at 04:33:10PM +0000, [email protected] wrote:

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/Makefile obj-$(CONFIG_ARCH_GEMINI) += gemini/ · line 17

Quoted 7 lines
drivers/soc/Makefile +1 -0
@@ -14,6 +14,7 @@ obj-$(CONFIG_ARCH_GEMINI)	+= gemini/
 obj-y				+= imx/
 obj-$(CONFIG_ARCH_IXP4XX)	+= ixp4xx/
 obj-$(CONFIG_SOC_XWAY)		+= lantiq/
+obj-$(CONFIG_SOC_MICROCHIP_POLARFIRE)	+= microchip/

CONFIG_SOC_MICROCHIP_POLARFIRE is more specific than a flag guarding the microchip directory should (intuitively) be (because there may be Microchip SoCs that are not Microchip PolarFire). Fortunately, since mpfs-sys-controller.o itself is guarded by CONFIG_POLARFIRE_SOC_SYS_CTRL, using "obj-y += microchip/" here should work without a problem.

[...]

Quoted 9 lines
drivers/soc/Makefile +9 -0
+int mpfs_blocking_transaction(struct mpfs_sys_controller *mpfs_client, void *msg,
+			      void *response, u16 response_size_bytes)
+{
+	int ret;
+
+	mpfs_client->response = response;
+	mpfs_client->response_size_bytes = response_size_bytes;
+
+	mutex_lock_interruptible(&transaction_lock);

drivers/soc/Makefile obj-$(CONFIG_ARCH_GEMINI) += gemini/

Quoted 10 lines
drivers/soc/Makefile +10 -0
+
+	reinit_completion(&mpfs_client->c);
+
+	ret = mbox_send_message(mpfs_client->chan, msg);
+	if (ret >= 0) {
+		if (wait_for_completion_timeout(&mpfs_client->c, HZ)) {
+			ret = 0;
+		} else {
+			ret = -ETIMEDOUT;
+			dev_warn(mpfs_client->client.dev, "MPFS sys controller transaction timeout");

\n is missing

drivers/soc/Makefile

Quoted 4 lines
drivers/soc/Makefile +4 -0
+		}
+	} else {
+		dev_err(mpfs_client->client.dev,
+			"mpfs sys controller transaction returned %d\r\n", ret);

\r\n is quite unusual and probably unnecessary in printk-style functions, \n is enough.

drivers/soc/Makefile

Quoted 7 lines
drivers/soc/Makefile +7 -0
+	}
+
+	mutex_unlock(&transaction_lock);
+
+	return ret;
+}
+EXPORT_SYMBOL(mpfs_blocking_transaction);

Best regards,
Jonathan Neuschäfer

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv