Skip to contentSkip to conversation

pinctrl/broxton: enable platform device in the absent of ACPI enumeration

PATCH In review Tan Jui Nee 5 participants 15 messages Nov 18, 2016 – Nov 21, 2016

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

v11 cover pinctrl/broxton: enable platform device in the absent of ACPI enumeration

Hi,
The patches are to cater the need for non-ACPI system whereby a platform device has to be created in order to bind with Apollo Lake Pinctrl GPIO platform driver.

The MMIO BAR is accessed over the Primary to Sideband bridge (P2SB). Since the BIOS prevents the P2SB device from being enumerated by the PCI subsystem, so we need to hide/unhide P2SB to lookup the P2SB BAR and pass the PCI BAR address to the gpio platform driver.

All these three patches have dependencies on each other.

Changes in V11:
- Select CONFIG_P2SB when CONFIG_X86_INTEL_IVI is enabled instead of CONFIG_LPC_ICH is enabled. This is to fix kbuildbot error.
- Remove duplicated object file lpc_ich-objs in Makefile.
- Put p2sb.h header file in separate section in lpc_ich-apl.c, as asm stuff is platform specific (suggested by Andy).
- Rearrange variable declarations in lpc_ich_add_gpio() function (suggested by Andy).
- Move warn_continue label before if/else statement for the sake of readability (suggested by Andy).
- Add comment to #endif in lpc_ich_apl.h file.

Changes in V10:
- Since P2SB is platform enablement driver and therefore should go into drivers/platform/x86 (suggested by tglx).

Changes in V9:
- Remove the filename from the header of lpc_ich_core.c (suggested by Lee).

Changes in V8:
- Update new file name with lpc_ich_core.c at description of source file.
- Rename source file lpc_ich-apl.c to lpc_ich_apl.c (suggested by Mika).
- Rework Makefile with new source file name lpc_ich_apl.c.

Changes in V7:
- EXPORT_SYMBOL_GPL() and MODULE_LICENSE("GPL v2") are used for new file p2sb.c.
- Split Kconfig option CONFIG_X86_INTEL_IVI to separate patch (suggested by Lee).
- Split new platform enabling into a separate patch.
- Move lpc_chipsets enum's definition into a standalone header file which can be used wherever its definition is needed.
- Add author information and rewrite description of source file lpc_ich-apl.c and lpc_ich_apl.h.
- Sort the header files by alphabetical order in lpc_ich-apl.c.
- Rename header file lpc_ich-apl.h to lpc_ich_apl.h (suggested by Lee).
- Remove unneeded pdata_size and platform_data from mfd_cell. Also, remove unneeded apl_pinctrl_pdata.
- Since variable apl_p2sb is only used once, hence switch it out for the PCI_DEVFN macro (suggested by Lee).
- Define APL_GPIO_COMMUNITY_MAX as total Apollo Lake GPIO communities supported.
- Set resources in mfd_cell for each GPIO community.
- Call p2sb_bar() function once instead of four times inside the for loop. And make p2sb_bar() function just to fill in the base address into a scratch "struct resource" and have the loop do the additions to base/end.
- Remove entire apl_pinctrl_pdata.name memory allocation since it is no longer needed.
- Return ret at the end of lpc_ich_add_gpio() function.

Changes in V6:
- Rename CONFIG_X86_INTEL_APL to CONFIG_X86_INTEL_IVI so that it relates to the actual product, as suggested by Mika.
- Rework Makefile according Andy's comments.
- Rename lpc_ich_misc() to lpc_ich_add_gpio() so that the name should not be so generic, as suggested by Andy.
- Call lpc_ich_add_gpio() via priv->chipset.
- lpc_ich_add_gpio() function will be moved from .../include/linux/mfd/lpc_ich.h to .../drivers/mfd/lpc_ich-apl.h
as this is a part of internal driver interface as suggested by Andy.
- Move enum lpc_chipsets from
.../drivers/mfd/lpc_ich-core.c to .../include/linux/mfd/lpc_ich.h
as lpc_chipsets is also accessed by lpc_ich_add_gpio().
- Check if kasprintf return value for all 4 gpio controllers before proceed to add platform device by using mfd_add_devices().

Changes in V5:
- Split lpc-ich driver into two parts (lpc_ich-core and lpc_ich-apl). The file lpc_ich-apl.c introduces gpio platform driver in MFD.
- Rename Kconfig option CONFIG_X86_INTEL_NON_ACPI to CONFIG_X86_INTEL_APL so that it reflects actual product as suggested by Mika.
- The patch:
[PATCH] pinctrl/broxton: enable platform device in the absent of ACPI enumeration is removed in V5 patch-set as the patch is already applied in Linus' pinctrl tree.

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
[PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's to
[PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
#if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL" to fix kbuildbot error

Andy Shevchenko (1):
drivers/platform/x86/p2sb: New Primary to Sideband bridge support
driver for Intel SOC's

Tan Jui Nee (5):
mfd: lpc_ich: Rename lpc-ich driver
x86/intel-ivi: Add Intel In-Vehicle Infotainment (IVI) systems used in
cars support
mfd: move enum lpc_chipsets into lpc_ich.h
mfd: lpc_ich: Add Device IDs for Intel Apollo Lake PCH
mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in
non-ACPI system

 arch/x86/Kconfig                          |  10 +++
 arch/x86/include/asm/p2sb.h               |  27 +++++++
 drivers/mfd/Makefile                      |   4 +
 drivers/mfd/lpc_ich_apl.c                 | 121 ++++++++++++++++++++++++++++++
 drivers/mfd/lpc_ich_apl.h                 |  28 +++++++
 drivers/mfd/{lpc_ich.c => lpc_ich_core.c} |  84 +++------------------
 drivers/platform/x86/Kconfig              |   4 +
 drivers/platform/x86/Makefile             |   1 +
 drivers/platform/x86/p2sb.c               |  98 ++++++++++++++++++++++++
 include/linux/mfd/lpc_ich.h               |  72 ++++++++++++++++++
 10 files changed, 376 insertions(+), 73 deletions(-)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 drivers/mfd/lpc_ich_apl.c
 create mode 100644 drivers/mfd/lpc_ich_apl.h
 rename drivers/mfd/{lpc_ich.c => lpc_ich_core.c} (93%)
 create mode 100644 drivers/platform/x86/p2sb.c
Signature · 1 line
1.9.1
#1 lore raw

PATCH v11 1/6 drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

From: Andy Shevchenko <[email protected]>

There is already one and at least one more user coming which require an access to Primary to Sideband bridge (P2SB) in order to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

---
Changes in V11:
- No change

Changes in V10:
- Since P2SB is platform enablement driver and therefore should go into drivers/platform/x86 (suggested by tglx).

Changes in V9:
- No change

Changes in V8:
- No change

Changes in V7:

	- EXPORT_SYMBOL_GPL() and MODULE_LICENSE("GPL v2") are used for new file
	  p2sb.c.

Changes in V6:
- No change

Changes in V5:
- No change

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
[PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's to
[PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system since the config is used in latter patch.

Changes in V3:
- No change

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL" to fix kbuildbot error

 arch/x86/include/asm/p2sb.h   | 27 ++++++++++++
 drivers/platform/x86/Kconfig  |  4 ++
 drivers/platform/x86/Makefile |  1 +
 drivers/platform/x86/p2sb.c   | 98 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 130 insertions(+)
 create mode 100644 arch/x86/include/asm/p2sb.h
 create mode 100644 drivers/platform/x86/p2sb.c
arch/x86/include/asm/p2sb.h new file +27 -0
new file mode 100644
index 0000000..686e07b
@@ -0,0 +1,27 @@
+/*
+ * Primary to Sideband bridge (P2SB) access support
+ */
+
+#ifndef P2SB_SYMS_H
+#define P2SB_SYMS_H
+
+#include <linux/ioport.h>
+#include <linux/pci.h>
+
+#if IS_ENABLED(CONFIG_P2SB)
+
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+	struct resource *res);
+
+#else /* CONFIG_P2SB is not set */
+
+static inline
+int p2sb_bar(struct pci_dev *pdev, unsigned int devfn,
+	struct resource *res)
+{
+	return -ENODEV;
+}
+
+#endif /* CONFIG_P2SB */
+
+#endif /* P2SB_SYMS_H */
drivers/platform/x86/Kconfig +4 -0
index b8a21d7..65ef6a0 100644
@@ -1027,4 +1027,8 @@ config INTEL_TELEMETRY
 	  used to get various SoC events and parameters
 	  directly via debugfs files. Various tools may use
 	  this interface for SoC state monitoring.
+
+config P2SB
+	tristate
+	depends on PCI
 endif # X86_PLATFORM_DEVICES
drivers/platform/x86/Makefile +1 -0
index 2efa86d..c39a13d 100644
@@ -71,3 +71,4 @@ obj-$(CONFIG_INTEL_TELEMETRY)	+= intel_telemetry_core.o \
 				   intel_telemetry_pltdrv.o \
 				   intel_telemetry_debugfs.o
 obj-$(CONFIG_INTEL_PMC_CORE)    += intel_pmc_core.o
+obj-$(CONFIG_P2SB)			+= p2sb.o
drivers/platform/x86/p2sb.c new file +98 -0

98 lines not on this page · raw message

Signature · 1 line
1.9.1
Reviewed-by on v11 1/6
#2 lore raw

Re: [PATCH v11 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

Quoted 9 lines · Tan Jui Nee

From: Andy Shevchenko <[email protected]>

There is already one and at least one more user coming which require an access to Primary to Sideband bridge (P2SB) in order to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

#3 lore raw

Re: [PATCH v11 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

In reply to Tan Jui Nee
Quoted 7 lines · Tan Jui Nee

From: Andy Shevchenko <[email protected]>

There is already one and at least one more user coming which require an access to Primary to Sideband bridge (P2SB) in order to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

Quoted 5 lines

---
Changes in V11:
- No change

Any particular reason you ignored my comments to v10 of this patch?

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

RE: [PATCH v11 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

Quoted 25 lines

-----Original Message-----
From: Andy Shevchenko [mailto:[email protected]]
Sent: Friday, November 18, 2016 7:22 PM
To: Tan, Jui Nee <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Yong, Jonathan <[email protected]>; Yu, Ong Hock <[email protected]>; Luck, Tony <[email protected]>; Wan Mohamad, Wan Ahmad Zainie <[email protected]>; Sun, Yunying <[email protected]>
Subject: Re: [PATCH v11 1/6] drivers/platform/x86/p2sb: New Primary to Sideband bridge support driver for Intel SOC's

Quoted 7 lines · Tan Jui Nee

From: Andy Shevchenko <[email protected]>

There is already one and at least one more user coming which require an access to Primary to Sideband bridge (P2SB) in order to get IO or MMIO bar hidden by BIOS.
Create a driver to access P2SB for x86 devices.

Quoted 8 lines
Quoted 5 lines

---
Changes in V11:
- No change

Any particular reason you ignored my comments to v10 of this patch?

Hi Andy,
I am sorry for missing your comments as the email filtered into other folder and I was not aware of that. I will applied your comments into next patch version.

Quoted 3 lines

--
Andy Shevchenko <[email protected]> Intel Finland Oy

#5 lore raw

PATCH v11 2/6 mfd: lpc_ich: Rename lpc-ich driver

In reply to Tan Jui Nee

This patch follows the example of mfd/wm831x to rename the driver from "lpc_ich" to "lpc_ich_core".

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- Remove the filename from the header of lpc_ich_core.c (suggested by Lee).

Changes in V8:
- Update new file name with lpc_ich_core.c at description of source file.
- Rework Makefile with new source file name lpc_ich_apl.c.

Changes in V7:
- No change

Changes in V6:
- none, just a subject line and commit message change.

 drivers/mfd/Makefile                      | 1 +
 drivers/mfd/{lpc_ich.c => lpc_ich_core.c} | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
 rename drivers/mfd/{lpc_ich.c => lpc_ich_core.c} (99%)
drivers/mfd/Makefile +1 -0
index 9834e66..06a91ea 100644
@@ -159,6 +159,7 @@ obj-$(CONFIG_PMIC_ADP5520)	+= adp5520.o
 obj-$(CONFIG_MFD_KEMPLD)	+= kempld-core.o
 obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO)	+= intel_quark_i2c_gpio.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
+lpc_ich-objs		:= lpc_ich_core.o
 obj-$(CONFIG_LPC_ICH)		+= lpc_ich.o
 obj-$(CONFIG_MFD_RDC321X)	+= rdc321x-southbridge.o
 obj-$(CONFIG_MFD_JANZ_CMODIO)	+= janz-cmodio.o
drivers/mfd/lpc_ich_core.c renamed from drivers/mfd/lpc_ich.c +0 -2
similarity index 99%
rename from drivers/mfd/lpc_ich.c
rename to drivers/mfd/lpc_ich_core.c
index c8dee47..7cbe037 100644
@@ -1,6 +1,4 @@
 /*
- *  lpc_ich.c - LPC interface for Intel ICH
- *
  *  LPC bridge function of the Intel ICH contains many other
  *  functional units, such as Interrupt controllers, Timers,
  *  Power Management, System Management, GPIO, RTC, and LPC
Signature · 1 line
1.9.1
#6 lore raw

Re: [PATCH v11 2/6] mfd: lpc_ich: Rename lpc-ich driver

Quoted 22 lines · Tan Jui Nee

This patch follows the example of mfd/wm831x to rename the driver from "lpc_ich" to "lpc_ich_core".

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- Remove the filename from the header of lpc_ich_core.c (suggested by Lee).

Changes in V8:
- Update new file name with lpc_ich_core.c at description of source file.
- Rework Makefile with new source file name lpc_ich_apl.c.

Changes in V7:
- No change

Quoted 7 lines

Changes in V6:
- none, just a subject line and commit message change.

 drivers/mfd/Makefile                      | 1 +
 drivers/mfd/{lpc_ich.c => lpc_ich_core.c} | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
 rename drivers/mfd/{lpc_ich.c => lpc_ich_core.c} (99%)

For my own reference:

Quoted 26 lines
drivers/mfd/Makefile +1 -0
index 9834e66..06a91ea 100644
@@ -159,6 +159,7 @@ obj-$(CONFIG_PMIC_ADP5520)	+= adp5520.o
 obj-$(CONFIG_MFD_KEMPLD)	+= kempld-core.o
 obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO)	+= intel_quark_i2c_gpio.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
+lpc_ich-objs		:= lpc_ich_core.o
 obj-$(CONFIG_LPC_ICH)		+= lpc_ich.o
 obj-$(CONFIG_MFD_RDC321X)	+= rdc321x-southbridge.o
 obj-$(CONFIG_MFD_JANZ_CMODIO)	+= janz-cmodio.o
drivers/mfd/lpc_ich_core.c renamed from drivers/mfd/lpc_ich.c +0 -2
similarity index 99%
rename from drivers/mfd/lpc_ich.c
rename to drivers/mfd/lpc_ich_core.c
index c8dee47..7cbe037 100644
@@ -1,6 +1,4 @@
 /*
- *  lpc_ich.c - LPC interface for Intel ICH
- *
  *  LPC bridge function of the Intel ICH contains many other
  *  functional units, such as Interrupt controllers, Timers,
  *  Power Management, System Management, GPIO, RTC, and LPC
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

PATCH v11 3/6 x86/intel-ivi: Add Intel In-Vehicle Infotainment (IVI) systems used in cars support

In reply to Tan Jui Nee

Add support for non ACPI system, such as system that uses Advanced Boot Loader (ABL) whereby a platform device has to be created in order to bind with PINCTRL/GPIO.

At the moment, Intel Apollo Lake SoC requires P2SB driver to hide and unhide P2SB to lookup P2SB BAR and pass the PCI BAR address to GPIO.

---
Changes in V11:
- Select CONFIG_P2SB when CONFIG_X86_INTEL_IVI is enabled instead of CONFIG_LPC_ICH is enabled. This is to fix kbuildbot error.

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- No change

 arch/x86/Kconfig | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/x86/Kconfig +10 -0
index bada636..6019755 100644
@@ -512,6 +512,16 @@ config X86_INTEL_CE
 	  This option compiles in support for the CE4100 SOC for settop
 	  boxes and media devices.
 
+config X86_INTEL_IVI
+	bool "Intel In-Vehicle Infotainment (IVI) systems used in cars"
+	depends on X86 && PCI
+	select P2SB
+	---help---
+	  Select this option to enable MMIO BAR access over the P2SB for
+	  non-ACPI Intel Apollo Lake SoC platforms. This driver uses the P2SB
+	  hide/unhide mechanism cooperatively to pass the PCI BAR address to
+	  the platform driver, currently GPIO.
+
 config X86_INTEL_MID
 	bool "Intel MID platform support"
 	depends on X86_EXTENDED_PLATFORM
Signature · 1 line
1.9.1
#8 lore raw

Re: [PATCH v11 3/6] x86/intel-ivi: Add Intel In-Vehicle Infotainment (IVI) systems used in cars support

Quoted 7 lines · Tan Jui Nee
arch/x86/Kconfig +0 -0
index bada636..6019755 100644
@@ -512,6 +512,16 @@ config X86_INTEL_CE
 	  This option compiles in support for the CE4100 SOC for settop
 	  boxes and media devices.

arch/x86/Kconfig config X86_INTEL_CE · line 523

Quoted 10 lines
arch/x86/Kconfig +9 -0
 
+config X86_INTEL_IVI
+	bool "Intel In-Vehicle Infotainment (IVI) systems used in cars"
+	depends on X86 && PCI
+	select P2SB
+	---help---
+	  Select this option to enable MMIO BAR access over the P2SB for
+	  non-ACPI Intel Apollo Lake SoC platforms. This driver uses the P2SB
+	  hide/unhide mechanism cooperatively to pass the PCI BAR address to
+	  the platform driver, currently GPIO.

Errm. INTEL_IVI does not enable MMIO BAR access over P2SB, CONFIG_P2SB does.

Thanks,

tglx

#9 lore raw

PATCH v11 4/6 mfd: move enum lpc_chipsets into lpc_ich.h

In reply to Tan Jui Nee

Move the enum's definition into a standalone header file which can be used wherever its definition is needed.

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- No change

 drivers/mfd/lpc_ich_core.c  | 71 ---------------------------------------------
 include/linux/mfd/lpc_ich.h | 71 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 71 deletions(-)
drivers/mfd/lpc_ich_core.c +0 -71
index 7cbe037..920198a 100644
@@ -145,77 +145,6 @@ struct lpc_ich_priv {
 	.ignore_resource_conflicts = true,
 };
 
-/* chipset related info */
-enum lpc_chipsets {
-	LPC_ICH = 0,	/* ICH */
-	LPC_ICH0,	/* ICH0 */
-	LPC_ICH2,	/* ICH2 */
-	LPC_ICH2M,	/* ICH2-M */
-	LPC_ICH3,	/* ICH3-S */
-	LPC_ICH3M,	/* ICH3-M */
-	LPC_ICH4,	/* ICH4 */
-	LPC_ICH4M,	/* ICH4-M */
-	LPC_CICH,	/* C-ICH */
-	LPC_ICH5,	/* ICH5 & ICH5R */
-	LPC_6300ESB,	/* 6300ESB */
-	LPC_ICH6,	/* ICH6 & ICH6R */
-	LPC_ICH6M,	/* ICH6-M */
-	LPC_ICH6W,	/* ICH6W & ICH6RW */
-	LPC_631XESB,	/* 631xESB/632xESB */
-	LPC_ICH7,	/* ICH7 & ICH7R */
-	LPC_ICH7DH,	/* ICH7DH */
-	LPC_ICH7M,	/* ICH7-M & ICH7-U */
-	LPC_ICH7MDH,	/* ICH7-M DH */
-	LPC_NM10,	/* NM10 */
-	LPC_ICH8,	/* ICH8 & ICH8R */
-	LPC_ICH8DH,	/* ICH8DH */
-	LPC_ICH8DO,	/* ICH8DO */
-	LPC_ICH8M,	/* ICH8M */
-	LPC_ICH8ME,	/* ICH8M-E */
-	LPC_ICH9,	/* ICH9 */
-	LPC_ICH9R,	/* ICH9R */
-	LPC_ICH9DH,	/* ICH9DH */
-	LPC_ICH9DO,	/* ICH9DO */
-	LPC_ICH9M,	/* ICH9M */
-	LPC_ICH9ME,	/* ICH9M-E */
-	LPC_ICH10,	/* ICH10 */
-	LPC_ICH10R,	/* ICH10R */
-	LPC_ICH10D,	/* ICH10D */
-	LPC_ICH10DO,	/* ICH10DO */
-	LPC_PCH,	/* PCH Desktop Full Featured */
-	LPC_PCHM,	/* PCH Mobile Full Featured */
-	LPC_P55,	/* P55 */
-	LPC_PM55,	/* PM55 */
-	LPC_H55,	/* H55 */
-	LPC_QM57,	/* QM57 */
-	LPC_H57,	/* H57 */
-	LPC_HM55,	/* HM55 */
-	LPC_Q57,	/* Q57 */
-	LPC_HM57,	/* HM57 */
-	LPC_PCHMSFF,	/* PCH Mobile SFF Full Featured */
-	LPC_QS57,	/* QS57 */
-	LPC_3400,	/* 3400 */
-	LPC_3420,	/* 3420 */
-	LPC_3450,	/* 3450 */
-	LPC_EP80579,	/* EP80579 */
-	LPC_CPT,	/* Cougar Point */
-	LPC_CPTD,	/* Cougar Point Desktop */
-	LPC_CPTM,	/* Cougar Point Mobile */
-	LPC_PBG,	/* Patsburg */
-	LPC_DH89XXCC,	/* DH89xxCC */
-	LPC_PPT,	/* Panther Point */
-	LPC_LPT,	/* Lynx Point */
-	LPC_LPT_LP,	/* Lynx Point-LP */
-	LPC_WBG,	/* Wellsburg */
-	LPC_AVN,	/* Avoton SoC */
-	LPC_BAYTRAIL,   /* Bay Trail SoC */
-	LPC_COLETO,	/* Coleto Creek */
-	LPC_WPT_LP,	/* Wildcat Point-LP */
-	LPC_BRASWELL,	/* Braswell SoC */
-	LPC_LEWISBURG,	/* Lewisburg */
-	LPC_9S,		/* 9 Series */
-};
-
 static struct lpc_ich_info lpc_chipset_info[] = {
 	[LPC_ICH] = {
 		.name = "ICH",
include/linux/mfd/lpc_ich.h +71 -0

75 lines not on this page · raw message

Signature · 1 line
1.9.1
#10 lore raw

Re: [PATCH v11 4/6] mfd: move enum lpc_chipsets into lpc_ich.h

Quoted 15 lines · Tan Jui Nee

Move the enum's definition into a standalone header file which can be used wherever its definition is needed.

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- No change

Quoted 6 lines

Changes in V8:
- No change

 drivers/mfd/lpc_ich_core.c  | 71 ---------------------------------------------
 include/linux/mfd/lpc_ich.h | 71 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+), 71 deletions(-)

For my own reference:

Quoted 162 lines
drivers/mfd/lpc_ich_core.c +0 -71
index 7cbe037..920198a 100644
@@ -145,77 +145,6 @@ struct lpc_ich_priv {
 	.ignore_resource_conflicts = true,
 };
 
-/* chipset related info */
-enum lpc_chipsets {
-	LPC_ICH = 0,	/* ICH */
-	LPC_ICH0,	/* ICH0 */
-	LPC_ICH2,	/* ICH2 */
-	LPC_ICH2M,	/* ICH2-M */
-	LPC_ICH3,	/* ICH3-S */
-	LPC_ICH3M,	/* ICH3-M */
-	LPC_ICH4,	/* ICH4 */
-	LPC_ICH4M,	/* ICH4-M */
-	LPC_CICH,	/* C-ICH */
-	LPC_ICH5,	/* ICH5 & ICH5R */
-	LPC_6300ESB,	/* 6300ESB */
-	LPC_ICH6,	/* ICH6 & ICH6R */
-	LPC_ICH6M,	/* ICH6-M */
-	LPC_ICH6W,	/* ICH6W & ICH6RW */
-	LPC_631XESB,	/* 631xESB/632xESB */
-	LPC_ICH7,	/* ICH7 & ICH7R */
-	LPC_ICH7DH,	/* ICH7DH */
-	LPC_ICH7M,	/* ICH7-M & ICH7-U */
-	LPC_ICH7MDH,	/* ICH7-M DH */
-	LPC_NM10,	/* NM10 */
-	LPC_ICH8,	/* ICH8 & ICH8R */
-	LPC_ICH8DH,	/* ICH8DH */
-	LPC_ICH8DO,	/* ICH8DO */
-	LPC_ICH8M,	/* ICH8M */
-	LPC_ICH8ME,	/* ICH8M-E */
-	LPC_ICH9,	/* ICH9 */
-	LPC_ICH9R,	/* ICH9R */
-	LPC_ICH9DH,	/* ICH9DH */
-	LPC_ICH9DO,	/* ICH9DO */
-	LPC_ICH9M,	/* ICH9M */
-	LPC_ICH9ME,	/* ICH9M-E */
-	LPC_ICH10,	/* ICH10 */
-	LPC_ICH10R,	/* ICH10R */
-	LPC_ICH10D,	/* ICH10D */
-	LPC_ICH10DO,	/* ICH10DO */
-	LPC_PCH,	/* PCH Desktop Full Featured */
-	LPC_PCHM,	/* PCH Mobile Full Featured */
-	LPC_P55,	/* P55 */
-	LPC_PM55,	/* PM55 */
-	LPC_H55,	/* H55 */
-	LPC_QM57,	/* QM57 */
-	LPC_H57,	/* H57 */
-	LPC_HM55,	/* HM55 */
-	LPC_Q57,	/* Q57 */
-	LPC_HM57,	/* HM57 */
-	LPC_PCHMSFF,	/* PCH Mobile SFF Full Featured */
-	LPC_QS57,	/* QS57 */
-	LPC_3400,	/* 3400 */
-	LPC_3420,	/* 3420 */
-	LPC_3450,	/* 3450 */
-	LPC_EP80579,	/* EP80579 */
-	LPC_CPT,	/* Cougar Point */
-	LPC_CPTD,	/* Cougar Point Desktop */
-	LPC_CPTM,	/* Cougar Point Mobile */
-	LPC_PBG,	/* Patsburg */
-	LPC_DH89XXCC,	/* DH89xxCC */
-	LPC_PPT,	/* Panther Point */
-	LPC_LPT,	/* Lynx Point */
-	LPC_LPT_LP,	/* Lynx Point-LP */
-	LPC_WBG,	/* Wellsburg */
-	LPC_AVN,	/* Avoton SoC */
-	LPC_BAYTRAIL,   /* Bay Trail SoC */
-	LPC_COLETO,	/* Coleto Creek */
-	LPC_WPT_LP,	/* Wildcat Point-LP */
-	LPC_BRASWELL,	/* Braswell SoC */
-	LPC_LEWISBURG,	/* Lewisburg */
-	LPC_9S,		/* 9 Series */
-};
-
 static struct lpc_ich_info lpc_chipset_info[] = {
 	[LPC_ICH] = {
 		.name = "ICH",
include/linux/mfd/lpc_ich.h +71 -0
index 2b300b4..42307ee 100644
@@ -43,4 +43,75 @@ struct lpc_ich_info {
 	u8 use_gpio;
 };
 
+/* chipset related info */
+enum lpc_chipsets {
+	LPC_ICH = 0,	/* ICH */
+	LPC_ICH0,	/* ICH0 */
+	LPC_ICH2,	/* ICH2 */
+	LPC_ICH2M,	/* ICH2-M */
+	LPC_ICH3,	/* ICH3-S */
+	LPC_ICH3M,	/* ICH3-M */
+	LPC_ICH4,	/* ICH4 */
+	LPC_ICH4M,	/* ICH4-M */
+	LPC_CICH,	/* C-ICH */
+	LPC_ICH5,	/* ICH5 & ICH5R */
+	LPC_6300ESB,	/* 6300ESB */
+	LPC_ICH6,	/* ICH6 & ICH6R */
+	LPC_ICH6M,	/* ICH6-M */
+	LPC_ICH6W,	/* ICH6W & ICH6RW */
+	LPC_631XESB,	/* 631xESB/632xESB */
+	LPC_ICH7,	/* ICH7 & ICH7R */
+	LPC_ICH7DH,	/* ICH7DH */
+	LPC_ICH7M,	/* ICH7-M & ICH7-U */
+	LPC_ICH7MDH,	/* ICH7-M DH */
+	LPC_NM10,	/* NM10 */
+	LPC_ICH8,	/* ICH8 & ICH8R */
+	LPC_ICH8DH,	/* ICH8DH */
+	LPC_ICH8DO,	/* ICH8DO */
+	LPC_ICH8M,	/* ICH8M */
+	LPC_ICH8ME,	/* ICH8M-E */
+	LPC_ICH9,	/* ICH9 */
+	LPC_ICH9R,	/* ICH9R */
+	LPC_ICH9DH,	/* ICH9DH */
+	LPC_ICH9DO,	/* ICH9DO */
+	LPC_ICH9M,	/* ICH9M */
+	LPC_ICH9ME,	/* ICH9M-E */
+	LPC_ICH10,	/* ICH10 */
+	LPC_ICH10R,	/* ICH10R */
+	LPC_ICH10D,	/* ICH10D */
+	LPC_ICH10DO,	/* ICH10DO */
+	LPC_PCH,	/* PCH Desktop Full Featured */
+	LPC_PCHM,	/* PCH Mobile Full Featured */
+	LPC_P55,	/* P55 */
+	LPC_PM55,	/* PM55 */
+	LPC_H55,	/* H55 */
+	LPC_QM57,	/* QM57 */
+	LPC_H57,	/* H57 */
+	LPC_HM55,	/* HM55 */
+	LPC_Q57,	/* Q57 */
+	LPC_HM57,	/* HM57 */
+	LPC_PCHMSFF,	/* PCH Mobile SFF Full Featured */
+	LPC_QS57,	/* QS57 */
+	LPC_3400,	/* 3400 */
+	LPC_3420,	/* 3420 */
+	LPC_3450,	/* 3450 */
+	LPC_EP80579,	/* EP80579 */
+	LPC_CPT,	/* Cougar Point */
+	LPC_CPTD,	/* Cougar Point Desktop */
+	LPC_CPTM,	/* Cougar Point Mobile */
+	LPC_PBG,	/* Patsburg */
+	LPC_DH89XXCC,	/* DH89xxCC */
+	LPC_PPT,	/* Panther Point */
+	LPC_LPT,	/* Lynx Point */
+	LPC_LPT_LP,	/* Lynx Point-LP */
+	LPC_WBG,	/* Wellsburg */
+	LPC_AVN,	/* Avoton SoC */
+	LPC_BAYTRAIL,   /* Bay Trail SoC */
+	LPC_COLETO,	/* Coleto Creek */
+	LPC_WPT_LP,	/* Wildcat Point-LP */
+	LPC_BRASWELL,	/* Braswell SoC */
+	LPC_LEWISBURG,	/* Lewisburg */
+	LPC_9S,		/* 9 Series */
+};
+
 #endif
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#11 lore raw

PATCH v11 5/6 mfd: lpc_ich: Add Device IDs for Intel Apollo Lake PCH

In reply to Tan Jui Nee

Adding Intel codename Apollo Lake platform device IDs for PCH.

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- No change

 drivers/mfd/lpc_ich_core.c  | 6 ++++++
 include/linux/mfd/lpc_ich.h | 1 +
 2 files changed, 7 insertions(+)
drivers/mfd/lpc_ich_core.c +6 -0
index 920198a..3bb6334 100644
@@ -54,6 +54,7 @@
  *	document number TBD : Wildcat Point-LP
  *	document number TBD : 9 Series
  *	document number TBD : Lewisburg
+ *	document number TBD : Apollo Lake
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -458,6 +459,10 @@ struct lpc_ich_priv {
 		.name = "9 Series",
 		.iTCO_version = 2,
 	},
+	[LPC_APL]  = {
+		.name = "Apollo Lake SoC",
+		.iTCO_version = 5,
+	},
 };
 
 /*
@@ -606,6 +611,7 @@ struct lpc_ich_priv {
 	{ PCI_VDEVICE(INTEL, 0x3b14), LPC_3420},
 	{ PCI_VDEVICE(INTEL, 0x3b16), LPC_3450},
 	{ PCI_VDEVICE(INTEL, 0x5031), LPC_EP80579},
+	{ PCI_VDEVICE(INTEL, 0x5ae8), LPC_APL},
 	{ PCI_VDEVICE(INTEL, 0x8c40), LPC_LPT},
 	{ PCI_VDEVICE(INTEL, 0x8c41), LPC_LPT},
 	{ PCI_VDEVICE(INTEL, 0x8c42), LPC_LPT},
include/linux/mfd/lpc_ich.h +1 -0
index 42307ee..397008c 100644
@@ -112,6 +112,7 @@ enum lpc_chipsets {
 	LPC_BRASWELL,	/* Braswell SoC */
 	LPC_LEWISBURG,	/* Lewisburg */
 	LPC_9S,		/* 9 Series */
+	LPC_APL,	/* Apollo Lake SoC */
 };
 
 #endif
Signature · 1 line
1.9.1
#12 lore raw

Re: [PATCH v11 5/6] mfd: lpc_ich: Add Device IDs for Intel Apollo Lake PCH

Quoted 26 lines · Tan Jui Nee

Adding Intel codename Apollo Lake platform device IDs for PCH.

---
Changes in V11:
- No change

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- No change

 drivers/mfd/lpc_ich_core.c  | 6 ++++++
 include/linux/mfd/lpc_ich.h | 1 +
 2 files changed, 7 insertions(+)
drivers/mfd/lpc_ich_core.c +0 -0
index 920198a..3bb6334 100644

drivers/mfd/lpc_ich_core.c line 57

Quoted 4 lines
drivers/mfd/lpc_ich_core.c +1 -0
@@ -54,6 +54,7 @@
  *	document number TBD : Wildcat Point-LP
  *	document number TBD : 9 Series
  *	document number TBD : Lewisburg
+ *	document number TBD : Apollo Lake

When exactly are you guys going to start filling in these TBD document numbers? Most of these entries are >4 years old!

I suggest you either start populating them, or remove the reference.

Besides that:

For my own reference:

Quoted 34 lines
drivers/mfd/lpc_ich_core.c +5 -0
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -458,6 +459,10 @@ struct lpc_ich_priv {
 		.name = "9 Series",
 		.iTCO_version = 2,
 	},
+	[LPC_APL]  = {
+		.name = "Apollo Lake SoC",
+		.iTCO_version = 5,
+	},
 };
 
 /*
@@ -606,6 +611,7 @@ struct lpc_ich_priv {
 	{ PCI_VDEVICE(INTEL, 0x3b14), LPC_3420},
 	{ PCI_VDEVICE(INTEL, 0x3b16), LPC_3450},
 	{ PCI_VDEVICE(INTEL, 0x5031), LPC_EP80579},
+	{ PCI_VDEVICE(INTEL, 0x5ae8), LPC_APL},
 	{ PCI_VDEVICE(INTEL, 0x8c40), LPC_LPT},
 	{ PCI_VDEVICE(INTEL, 0x8c41), LPC_LPT},
 	{ PCI_VDEVICE(INTEL, 0x8c42), LPC_LPT},
include/linux/mfd/lpc_ich.h +1 -0
index 42307ee..397008c 100644
@@ -112,6 +112,7 @@ enum lpc_chipsets {
 	LPC_BRASWELL,	/* Braswell SoC */
 	LPC_LEWISBURG,	/* Lewisburg */
 	LPC_9S,		/* 9 Series */
+	LPC_APL,	/* Apollo Lake SoC */
 };
 
 #endif
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#13 lore raw

PATCH v11 6/6 mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

In reply to Tan Jui Nee

This driver uses the P2SB hide/unhide mechanism cooperatively to pass the PCI BAR address to the gpio platform driver.

---
Changes in V11:
- Remove duplicated object file lpc_ich-objs in Makefile.
- Put p2sb.h header file in separate section in lpc_ich-apl.c, as asm stuff is platform specific (suggested by Andy).
- Rearrange variable declarations in lpc_ich_add_gpio() function (suggested by Andy).
- Move warn_continue label before if/else statement for the sake of readability (suggested by Andy).
- Add comment to #endif in lpc_ich_apl.h file.

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- Rename source file lpc_ich-apl.c to lpc_ich_apl.c (suggested by Mika).

Changes in V7:
- Add author information and rewrite description of source file lpc_ich-apl.c and lpc_ich_apl.h.
- Sort the header files by alphabetical order in lpc_ich-apl.c.
- Rename header file lpc_ich-apl.h to lpc_ich_apl.h (suggested by Lee).
- Remove unneeded pdata_size and platform_data from mfd_cell. Also, remove unneeded apl_pinctrl_pdata.
- Since variable apl_p2sb is only used once, hence switch it out for the PCI_DEVFN macro (suggested by Lee).
- Define APL_GPIO_COMMUNITY_MAX as total Apollo Lake GPIO communities supported.
- Set resources in mfd_cell for each GPIO community.
- Call p2sb_bar() function once instead of four times inside the for loop. And make p2sb_bar() function just to fill in the base address into a scratch "struct resource" and have the loop do the additions to base/end.
- Remove entire apl_pinctrl_pdata.name memory allocation since it is no longer needed.
- Return ret at the end of lpc_ich_add_gpio() function.

Changes in V6:
- Rename CONFIG_X86_INTEL_APL to CONFIG_X86_INTEL_IVI so that it relates to the actual product, as suggested by Mika.
- Rework Makefile according Andy's comments.
- Rename lpc_ich_misc() to lpc_ich_add_gpio() so that the name should not be so generic, as suggested by Andy.
- Call lpc_ich_add_gpio() via priv->chipset.
- lpc_ich_add_gpio() function will be moved from .../include/linux/mfd/lpc_ich.h to .../drivers/mfd/lpc_ich-apl.h
as this is a part of internal driver interface as suggested by Andy.
- Move enum lpc_chipsets from
.../drivers/mfd/lpc_ich-core.c to .../include/linux/mfd/lpc_ich.h
as lpc_chipsets is also accessed by lpc_ich_add_gpio().
- Check if kasprintf return value for all 4 gpio controllers before proceed to add platform device by using mfd_add_devices().

Changes in V5:
- Split lpc-ich driver into two parts (lpc_ich-core and lpc_ich-apl). The file lpc_ich-apl.c introduces gpio platform driver in MFD.
- Rename Kconfig option CONFIG_X86_INTEL_NON_ACPI to CONFIG_X86_INTEL_APL so that it reflects actual product as suggested by Mika.

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
[PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's to
[PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
#if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL" to fix kbuildbot error

 drivers/mfd/Makefile       |   3 ++
 drivers/mfd/lpc_ich_apl.c  | 121 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/lpc_ich_apl.h  |  28 +++++++++++
 drivers/mfd/lpc_ich_core.c |   5 ++
 4 files changed, 157 insertions(+)
 create mode 100644 drivers/mfd/lpc_ich_apl.c
 create mode 100644 drivers/mfd/lpc_ich_apl.h
drivers/mfd/Makefile +3 -0
index 06a91ea..b7fb703 100644
@@ -161,6 +161,9 @@ obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO)	+= intel_quark_i2c_gpio.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
 lpc_ich-objs		:= lpc_ich_core.o
 obj-$(CONFIG_LPC_ICH)		+= lpc_ich.o
+ifeq ($(CONFIG_X86_INTEL_IVI),y)
+lpc_ich-objs += lpc_ich_apl.o
+endif
 obj-$(CONFIG_MFD_RDC321X)	+= rdc321x-southbridge.o
 obj-$(CONFIG_MFD_JANZ_CMODIO)	+= janz-cmodio.o
 obj-$(CONFIG_MFD_JZ4740_ADC)	+= jz4740-adc.o
drivers/mfd/lpc_ich_apl.c new file +121 -0

121 lines not on this page · raw message

drivers/mfd/lpc_ich_apl.h new file +28 -0
new file mode 100644
index 0000000..6721621
@@ -0,0 +1,28 @@
+/*
+ * Intel In-Vehicle Infotainment (IVI) systems used in cars support
+ *
+ * Copyright (C) 2016, Intel Corporation
+ *
+ * Author: Tan, Jui Nee <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LPC_ICH_APL_H__
+#define __LPC_ICH_APL_H__
+
+#include <linux/pci.h>
+
+#if IS_ENABLED(CONFIG_X86_INTEL_IVI)
+int lpc_ich_add_gpio(struct pci_dev *dev, enum lpc_chipsets chipset);
+#else /* CONFIG_X86_INTEL_IVI is not set */
+static inline int lpc_ich_add_gpio(struct pci_dev *dev,
+	enum lpc_chipsets chipset)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_X86_INTEL_IVI */
+
+#endif /* __LPC_ICH_APL_H__ */
drivers/mfd/lpc_ich_core.c +5 -0
index 3bb6334..25c4d99 100644
@@ -68,6 +68,8 @@
 #include <linux/mfd/lpc_ich.h>
 #include <linux/platform_data/itco_wdt.h>
 
+#include "lpc_ich_apl.h"
+
 #define ACPIBASE		0x40
 #define ACPIBASE_GPE_OFF	0x28
 #define ACPIBASE_GPE_END	0x2f
@@ -1030,6 +1032,9 @@ static int lpc_ich_probe(struct pci_dev *dev,
 			cell_added = true;
 	}
 
+	if (!lpc_ich_add_gpio(dev, priv->chipset))
+		cell_added = true;
+
 	/*
 	 * We only care if at least one or none of the cells registered
 	 * successfully.
Signature · 1 line
1.9.1
#14 lore raw

Re: [PATCH v11 6/6] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system

Quoted 106 lines · Tan Jui Nee

This driver uses the P2SB hide/unhide mechanism cooperatively to pass the PCI BAR address to the gpio platform driver.

---
Changes in V11:
- Remove duplicated object file lpc_ich-objs in Makefile.
- Put p2sb.h header file in separate section in lpc_ich-apl.c, as asm stuff is platform specific (suggested by Andy).
- Rearrange variable declarations in lpc_ich_add_gpio() function (suggested by Andy).
- Move warn_continue label before if/else statement for the sake of readability (suggested by Andy).
- Add comment to #endif in lpc_ich_apl.h file.

Changes in V10:
- No change

Changes in V9:
- No change

Changes in V8:
- Rename source file lpc_ich-apl.c to lpc_ich_apl.c (suggested by Mika).

Changes in V7:
- Add author information and rewrite description of source file lpc_ich-apl.c and lpc_ich_apl.h.
- Sort the header files by alphabetical order in lpc_ich-apl.c.
- Rename header file lpc_ich-apl.h to lpc_ich_apl.h (suggested by Lee).
- Remove unneeded pdata_size and platform_data from mfd_cell. Also, remove unneeded apl_pinctrl_pdata.
- Since variable apl_p2sb is only used once, hence switch it out for the PCI_DEVFN macro (suggested by Lee).
- Define APL_GPIO_COMMUNITY_MAX as total Apollo Lake GPIO communities supported.
- Set resources in mfd_cell for each GPIO community.
- Call p2sb_bar() function once instead of four times inside the for loop. And make p2sb_bar() function just to fill in the base address into a scratch "struct resource" and have the loop do the additions to base/end.
- Remove entire apl_pinctrl_pdata.name memory allocation since it is no longer needed.
- Return ret at the end of lpc_ich_add_gpio() function.

Changes in V6:
- Rename CONFIG_X86_INTEL_APL to CONFIG_X86_INTEL_IVI so that it relates to the actual product, as suggested by Mika.
- Rework Makefile according Andy's comments.
- Rename lpc_ich_misc() to lpc_ich_add_gpio() so that the name should not be so generic, as suggested by Andy.
- Call lpc_ich_add_gpio() via priv->chipset.
- lpc_ich_add_gpio() function will be moved from .../include/linux/mfd/lpc_ich.h to .../drivers/mfd/lpc_ich-apl.h
as this is a part of internal driver interface as suggested by Andy.
- Move enum lpc_chipsets from
.../drivers/mfd/lpc_ich-core.c to .../include/linux/mfd/lpc_ich.h
as lpc_chipsets is also accessed by lpc_ich_add_gpio().
- Check if kasprintf return value for all 4 gpio controllers before proceed to add platform device by using mfd_add_devices().

Changes in V5:
- Split lpc-ich driver into two parts (lpc_ich-core and lpc_ich-apl). The file lpc_ich-apl.c introduces gpio platform driver in MFD.
- Rename Kconfig option CONFIG_X86_INTEL_NON_ACPI to CONFIG_X86_INTEL_APL so that it reflects actual product as suggested by Mika.

Changes in V4:
- Move Kconfig option CONFIG_X86_INTEL_NON_ACPI from
[PATCH 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's to
[PATCH 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system since the config is used in latter patch.
- Select CONFIG_P2SB when CONFIG_LPC_ICH is enabled.
- Remove #ifdef CONFIG_X86_INTEL_NON_ACPI and use
#if defined(CONFIG_X86_INTEL_NON_ACPI) when lpc_ich_misc is called
as suggested by Lee Jones.
- Use single dimensional array instead of 2D array for apl_gpio_io_res structure and use DEFINE_RES_IRQ for its IRQ resource.

Changes in V3:
- Simplify register addresses calculation and use DEFINE_RES_MEM_NAMED defines for apl_gpio_io_res structure
- Define magic number for P2SB PCI ID
- Replace switch-case with if-else since currently we have only one use case
- Only call mfd_add_devices() once for all gpio communities

Changes in V2:
- Add new config option CONFIG_X86_INTEL_NON_ACPI and "select PINCTRL" to fix kbuildbot error

 drivers/mfd/Makefile       |   3 ++
 drivers/mfd/lpc_ich_apl.c  | 121 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/mfd/lpc_ich_apl.h  |  28 +++++++++++
 drivers/mfd/lpc_ich_core.c |   5 ++
 4 files changed, 157 insertions(+)
 create mode 100644 drivers/mfd/lpc_ich_apl.c
 create mode 100644 drivers/mfd/lpc_ich_apl.h
drivers/mfd/Makefile +0 -0
index 06a91ea..b7fb703 100644

drivers/mfd/Makefile obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO) += intel_quark_i2c_gpio.o · line 166

Quoted 6 lines
drivers/mfd/Makefile +3 -0
@@ -161,6 +161,9 @@ obj-$(CONFIG_MFD_INTEL_QUARK_I2C_GPIO)	+= intel_quark_i2c_gpio.o
 obj-$(CONFIG_LPC_SCH)		+= lpc_sch.o
 lpc_ich-objs		:= lpc_ich_core.o
 obj-$(CONFIG_LPC_ICH)		+= lpc_ich.o
+ifeq ($(CONFIG_X86_INTEL_IVI),y)
+lpc_ich-objs += lpc_ich_apl.o
+endif

What's with the iffery?

Quoted 36 lines
drivers/mfd/Makefile +0 -0
 obj-$(CONFIG_MFD_RDC321X)	+= rdc321x-southbridge.o
 obj-$(CONFIG_MFD_JANZ_CMODIO)	+= janz-cmodio.o
 obj-$(CONFIG_MFD_JZ4740_ADC)	+= jz4740-adc.o
drivers/mfd/lpc_ich_apl.c new file +27 -0
new file mode 100644
index 0000000..aef3c13
@@ -0,0 +1,121 @@
+/*
+ * Intel Apollo Lake In-Vehicle Infotainment (IVI) systems used in cars support
+ *
+ * Copyright (C) 2016 Intel Corporation
+ *
+ * Author: Tan, Jui Nee <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/mfd/core.h>
+#include <linux/mfd/lpc_ich.h>
+#include <linux/pci.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include <asm/p2sb.h>
+
+#include "lpc_ich_apl.h"
+
+/* Offset data for Apollo Lake GPIO communities */
+#define APL_GPIO_SOUTHWEST_OFFSET	0xc00000
+#define APL_GPIO_NORTHWEST_OFFSET	0xc40000
+#define APL_GPIO_NORTH_OFFSET		0xc50000
+#define APL_GPIO_WEST_OFFSET		0xc70000
+

drivers/mfd/lpc_ich_apl.c line 37

Quoted 10 lines
drivers/mfd/lpc_ich_apl.c new file +10 -0
+#define APL_GPIO_SOUTHWEST_NPIN		43
+#define APL_GPIO_NORTHWEST_NPIN		77
+#define APL_GPIO_NORTH_NPIN		78
+#define APL_GPIO_WEST_NPIN		47
+
+#define APL_GPIO_COMMUNITY_MAX		4
+
+#define APL_GPIO_IRQ 14
+
+#define PCI_IDSEL_P2SB	0x0d

Please tab all of these out, so they are in a single line. #OCD

Quoted 6 lines
drivers/mfd/lpc_ich_apl.c new file +6 -0
+static struct resource apl_gpio_io_res[] = {
+	DEFINE_RES_MEM_NAMED(APL_GPIO_NORTH_OFFSET,
+		APL_GPIO_NORTH_NPIN * SZ_8, "apl_pinctrl_n"),
+	DEFINE_RES_MEM_NAMED(APL_GPIO_NORTHWEST_OFFSET,
+		APL_GPIO_NORTHWEST_NPIN * SZ_8, "apl_pinctrl_nw"),
+	DEFINE_RES_MEM_NAMED(APL_GPIO_WEST_OFFSET,

drivers/mfd/lpc_ich_apl.c line 54

Quoted 10 lines
drivers/mfd/lpc_ich_apl.c new file +10 -0
+		APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"),
+	DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET,
+		APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"),
+	DEFINE_RES_IRQ(APL_GPIO_IRQ),
+};
+
+static struct mfd_cell apl_gpio_devices[] = {
+	{
+		.name = "apl-pinctrl",
+		.id = 0,

Are you using these IDs for anything specific?

Quoted 18 lines
drivers/mfd/lpc_ich_apl.c new file +18 -0
+		.num_resources = ARRAY_SIZE(apl_gpio_io_res),
+		.resources = &apl_gpio_io_res[0],
+		.ignore_resource_conflicts = true,
+	},
+	{
+		.name = "apl-pinctrl",
+		.id = 1,
+		.num_resources = ARRAY_SIZE(apl_gpio_io_res),
+		.resources = &apl_gpio_io_res[1],
+		.ignore_resource_conflicts = true,
+	},
+	{
+		.name = "apl-pinctrl",
+		.id = 2,
+		.num_resources = ARRAY_SIZE(apl_gpio_io_res),
+		.resources = &apl_gpio_io_res[2],
+		.ignore_resource_conflicts = true,
+	},

drivers/mfd/lpc_ich_apl.c line 82

Quoted 10 lines
drivers/mfd/lpc_ich_apl.c new file +10 -0
+	{
+		.name = "apl-pinctrl",
+		.id = 3,
+		.num_resources = ARRAY_SIZE(apl_gpio_io_res),
+		.resources = &apl_gpio_io_res[3],
+		.ignore_resource_conflicts = true,
+	},
+};
+
+int lpc_ich_add_gpio(struct pci_dev *dev, enum lpc_chipsets chipset)

Why does these need to be in its own file?

Quoted 26 lines
drivers/mfd/lpc_ich_apl.c new file +26 -0
+{
+	struct resource base;
+	unsigned int i;
+	int ret;
+
+	if (chipset != LPC_APL)
+		return -ENODEV;
+	/*
+	 * Apollo lake has 4 gpio controllers,
+	 * handle it a bit differently.
+	 */
+
+	ret = p2sb_bar(dev, PCI_DEVFN(PCI_IDSEL_P2SB, 0), &base);
+	if (ret)
+		goto warn_continue;
+
+	for (i = 0; i < APL_GPIO_COMMUNITY_MAX; i++) {
+		struct resource *res = &apl_gpio_io_res[i];
+
+		/* Fill MEM resource */
+		res->start += base.start;
+		res->end += base.start;
+		res->flags = base.flags;
+
+		res++;
+	}

drivers/mfd/lpc_ich_apl.c line 118

Quoted 10 lines
drivers/mfd/lpc_ich_apl.c new file +10 -0
+
+	ret = mfd_add_devices(&dev->dev, 0,
+		apl_gpio_devices, ARRAY_SIZE(apl_gpio_devices),
+			NULL, 0, NULL);
+
+warn_continue:
+	if (ret)
+		dev_warn(&dev->dev,
+			"Failed to add Apollo Lake GPIO: %d\n",
+				ret);

Incorrect tabbing.

Quoted 50 lines
drivers/mfd/lpc_ich_apl.c new file +2 -0
+	return ret;
+}
drivers/mfd/lpc_ich_apl.h new file +28 -0
new file mode 100644
index 0000000..6721621
@@ -0,0 +1,28 @@
+/*
+ * Intel In-Vehicle Infotainment (IVI) systems used in cars support
+ *
+ * Copyright (C) 2016, Intel Corporation
+ *
+ * Author: Tan, Jui Nee <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __LPC_ICH_APL_H__
+#define __LPC_ICH_APL_H__
+
+#include <linux/pci.h>
+
+#if IS_ENABLED(CONFIG_X86_INTEL_IVI)
+int lpc_ich_add_gpio(struct pci_dev *dev, enum lpc_chipsets chipset);
+#else /* CONFIG_X86_INTEL_IVI is not set */
+static inline int lpc_ich_add_gpio(struct pci_dev *dev,
+	enum lpc_chipsets chipset)
+{
+	return -ENODEV;
+}
+#endif /* CONFIG_X86_INTEL_IVI */
+
+#endif /* __LPC_ICH_APL_H__ */
drivers/mfd/lpc_ich_core.c +2 -0
index 3bb6334..25c4d99 100644
@@ -68,6 +68,8 @@
 #include <linux/mfd/lpc_ich.h>
 #include <linux/platform_data/itco_wdt.h>
 
+#include "lpc_ich_apl.h"
+
 #define ACPIBASE		0x40
 #define ACPIBASE_GPE_OFF	0x28
 #define ACPIBASE_GPE_END	0x2f

drivers/mfd/lpc_ich_core.c static int lpc_ich_probe(struct pci_dev *dev, · line 1035

Quoted 4 lines
drivers/mfd/lpc_ich_core.c +1 -0
@@ -1030,6 +1032,9 @@ static int lpc_ich_probe(struct pci_dev *dev,
 			cell_added = true;
 	}
 
+	if (!lpc_ich_add_gpio(dev, priv->chipset))

This is a non-traditional way of checking for errors. Please use 'ret' instead.

Why isn't it an issue if this fails?

Quoted 5 lines
drivers/mfd/lpc_ich_core.c +2 -0
+		cell_added = true;
+
 	/*
 	 * We only care if at least one or none of the cells registered
 	 * successfully.
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog