Skip to contentSkip to conversation

x86: Add SCU IPC driver for Intel MID platforms

PATCH Superseded Andy Shevchenko 2 participants 6 messages Mar 15, 2017 – Apr 1, 2017 x86

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 x86: Add SCU IPC driver for Intel MID platforms

From: Felipe Balbi <[email protected]>

Intel MID platforms have few microcontrollers inside SoC, one of them is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

---
 arch/x86/Kconfig           |   2 +
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/scu.h |  28 ++++++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/scu.c         | 168 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 arch/x86/include/asm/scu.h
 create mode 100644 arch/x86/lib/scu.c
arch/x86/Kconfig +2 -0
index dfdd7564ea..9a1ecd7907 100644
@@ -83,6 +83,8 @@ endchoice
 # subarchitectures-specific options below
 config INTEL_MID
 	bool "Intel MID platform support"
+	select REGMAP
+	select SYSCON
 	help
 	  Select to build a U-Boot capable of supporting Intel MID
 	  (Mobile Internet Device) platform systems which do not have
arch/x86/include/asm/cpu.h +1 -0
index c651f2f594..0ee13b1eb1 100644
@@ -54,6 +54,7 @@ enum {
 	X86_NONE,
 	X86_SYSCON_ME,		/* Intel Management Engine */
 	X86_SYSCON_PINCONF,	/* Intel x86 pin configuration */
+	X86_SYSCON_SCU,		/* System Controller Unit */
 };
 
 struct cpuid_result {
arch/x86/include/asm/scu.h new file +28 -0
new file mode 100644
index 0000000000..876363cb5c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2017 Intel Corporation
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _X86_ASM_SCU_IPC_H_
+#define _X86_ASM_SCU_IPC_H_
+
+/* IPC defines the following message types */
+#define IPCMSG_WARM_RESET		0xF0
+#define IPCMSG_COLD_RESET		0xF1
+#define IPCMSG_SOFT_RESET		0xF2
+#define IPCMSG_COLD_BOOT		0xF3
+#define IPCMSG_GET_FW_REVISION		0xF4
+#define IPCMSG_WATCHDOG_TIMER		0xF8	/* Set Kernel Watchdog Threshold */
+
+struct ipc_ifwi_version {
+	u16	minor;
+	u8	major;
+	u8	hardware_id;
+	u32	reserved[3];
+};
+
+/* Issue commands to the SCU with or without data */
+int scu_ipc_simple_command(u32 cmd, u32 sub);
+int scu_ipc_command(u32 cmd, u32 sub, u32 *in, int inlen, u32 *out, int outlen);
+
+#endif	/* _X86_ASM_SCU_IPC_H_ */
arch/x86/lib/Makefile +1 -0
index 1c2c085179..320e45e4a0 100644
@@ -32,6 +32,7 @@ obj-y	+= pirq_routing.o
 obj-y	+= relocate.o
 obj-y += physmem.o
 obj-$(CONFIG_X86_RAMTEST) += ramtest.o
+obj-$(CONFIG_INTEL_MID) += scu.o
 obj-y	+= sections.o
 obj-y += sfi.o
 obj-y	+= string.o
arch/x86/lib/scu.c new file +168 -0

168 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw

PATCH v2 2/2 x86: Introduce minimal PMU driver for Intel MID platforms

This simple PMU driver allows to tyrn power on and off for selected devices. In particularly Intel Tangier needs to power on SDHCI controllers in order to access to them during board initialization.

In the future it might be expanded to cover other Intel MID platforms, that's why it's located under arch/x86/lib and called pmu.c.

---
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/pmu.h |  11 +++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/pmu.c         | 117 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 130 insertions(+)
 create mode 100644 arch/x86/include/asm/pmu.h
 create mode 100644 arch/x86/lib/pmu.c
arch/x86/include/asm/cpu.h +1 -0
index 0ee13b1eb1..c00687a20a 100644
@@ -54,6 +54,7 @@ enum {
 	X86_NONE,
 	X86_SYSCON_ME,		/* Intel Management Engine */
 	X86_SYSCON_PINCONF,	/* Intel x86 pin configuration */
+	X86_SYSCON_PMU,		/* Power Management Unit */
 	X86_SYSCON_SCU,		/* System Controller Unit */
 };
 
arch/x86/include/asm/pmu.h new file +11 -0
new file mode 100644
index 0000000000..96b968ff8f
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2017 Intel Corporation
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#ifndef _X86_ASM_PMU_IPC_H_
+#define _X86_ASM_PMU_IPC_H_
+
+int pmu_turn_power(unsigned int lss, bool on);
+
+#endif	/* _X86_ASM_PMU_IPC_H_ */
arch/x86/lib/Makefile +1 -0
index 320e45e4a0..d1ad37af64 100644
@@ -31,6 +31,7 @@ obj-y	+= pinctrl_ich6.o
 obj-y	+= pirq_routing.o
 obj-y	+= relocate.o
 obj-y += physmem.o
+obj-$(CONFIG_INTEL_MID) += pmu.o
 obj-$(CONFIG_X86_RAMTEST) += ramtest.o
 obj-$(CONFIG_INTEL_MID) += scu.o
 obj-y	+= sections.o
arch/x86/lib/pmu.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v2 1/2 x86: Add SCU IPC driver for Intel MID platforms

In reply to Andy Shevchenko

Hi Andy,

Quoted 10 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

Intel MID platforms have few microcontrollers inside SoC, one of them is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

Quoted 9 lines
---
 arch/x86/Kconfig           |   2 +
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/scu.h |  28 ++++++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/scu.c         | 168 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 arch/x86/include/asm/scu.h
 create mode 100644 arch/x86/lib/scu.c

Since this is a v2 patch can you please include a change log?

Regards,
Simon

#3 lore raw

PATCH v2 1/2 x86: Add SCU IPC driver for Intel MID platforms

Quoted 26 lines · Simon Glass

Hi Andy,

Quoted 18 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

Intel MID platforms have few microcontrollers inside SoC, one of them
is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

---
 arch/x86/Kconfig           |   2 +
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/scu.h |  28 ++++++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/scu.c         | 168
+++++++++++++++++++++++++++++++++++++++++++++

Quoted 3 lines
 5 files changed, 200 insertions(+)

 create mode 100644 arch/x86/include/asm/scu.h
 create mode 100644 arch/x86/lib/scu.c

Quoted 1 line

Since this is a v2 patch can you please include a change log?

Yes.

Common:
- convert to use REGMAP instead of constant addressed IO
- rewrite as UCLASS_SYSCON modules
- move to arch/x86/lib since it's related to x86 only and there are already another UCLASS_SYSCON modules there

SCU:
- convert function documentation to have header and body and be consistent
- shrink header and remove unneeded attributes
- drop busy loop counter from 3m to 100k as per driver in Linux kernel

PMU:
- convert to be more generic and move Tangier related part to its own folder (the latter out of scope of this series)

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#4 lore raw

PATCH v2 1/2 x86: Add SCU IPC driver for Intel MID platforms

Quoted 43 lines · Andy Shevchenko
Quoted 26 lines · Simon Glass

Hi Andy,

Quoted 18 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

Intel MID platforms have few microcontrollers inside SoC, one of them
is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

---
 arch/x86/Kconfig           |   2 +
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/scu.h |  28 ++++++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/scu.c         | 168
+++++++++++++++++++++++++++++++++++++++++++++

Quoted 3 lines
 5 files changed, 200 insertions(+)

 create mode 100644 arch/x86/include/asm/scu.h
 create mode 100644 arch/x86/lib/scu.c

Quoted 1 line

Since this is a v2 patch can you please include a change log?

Yes.

Common:
- convert to use REGMAP instead of constant addressed IO
- rewrite as UCLASS_SYSCON modules
- move to arch/x86/lib since it's related to x86 only and there are already another UCLASS_SYSCON modules there

SCU:
- convert function documentation to have header and body and be consistent
- shrink header and remove unneeded attributes
- drop busy loop counter from 3m to 100k as per driver in Linux kernel

Quoted 3 lines

PMU:
- convert to be more generic and move Tangier related part to its own folder (the latter out of scope of this series)

Should I resend with cover letter and changelog included?

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#5 lore raw

PATCH v2 1/2 x86: Add SCU IPC driver for Intel MID platforms

Hi Andy,

Quoted 44 lines · Andy Shevchenko
Quoted 43 lines · Andy Shevchenko
Quoted 26 lines · Simon Glass

Hi Andy,

Quoted 11 lines · Andy Shevchenko

From: Felipe Balbi <[email protected]>

Intel MID platforms have few microcontrollers inside SoC, one of them
is so called System Controller Unit (SCU).

Here is the driver to communicate with microcontroller.

Quoted 10 lines
---
 arch/x86/Kconfig           |   2 +
 arch/x86/include/asm/cpu.h |   1 +
 arch/x86/include/asm/scu.h |  28 ++++++++
 arch/x86/lib/Makefile      |   1 +
 arch/x86/lib/scu.c         | 168
+++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 200 insertions(+)
 create mode 100644 arch/x86/include/asm/scu.h
 create mode 100644 arch/x86/lib/scu.c
Quoted 1 line

Since this is a v2 patch can you please include a change log?

Yes.

Common:
- convert to use REGMAP instead of constant addressed IO
- rewrite as UCLASS_SYSCON modules
- move to arch/x86/lib since it's related to x86 only and there are already another UCLASS_SYSCON modules there

SCU:
- convert function documentation to have header and body and be consistent
- shrink header and remove unneeded attributes
- drop busy loop counter from 3m to 100k as per driver in Linux kernel

Quoted 5 lines
Quoted 3 lines

PMU:
- convert to be more generic and move Tangier related part to its own folder (the latter out of scope of this series)

Should I resend with cover letter and changelog included?

Yes that's a good idea, thanks.

- Simon