Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
On Tue, Jun 21, 2016 at 7:10 AM, Tan Jui Neewrote: > This driver uses the P2SB hide/unhide mechanism cooperatively > to pass the PCI BAR address to the gpio platform driver. > > Signed-off-by: Tan Jui Nee > --- > 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. I guess this patch will also change, also fix the screamings from the build robot please. Yours, Linus Walleij
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
On Tue, Jun 21, 2016 at 7:10 AM, Tan Jui Nee wrote: > This driver uses the P2SB hide/unhide mechanism cooperatively > to pass the PCI BAR address to the gpio platform driver. > > Signed-off-by: Tan Jui Nee > --- > 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. I guess this patch will also change, also fix the screamings from the build robot please. Yours, Linus Walleij
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
Hi, [auto build test ERROR on tip/x86/core] [also build test ERROR on v4.7-rc4 next-20160620] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027 config: x86_64-lkp (attached as .config) compiler: gcc-4.9 (Debian 4.9.3-14) 4.9.3 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): >> drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to >> incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc': >> drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct >> pinctrl_pin_desc' apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u", ^ >> drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect >> [-Wunused-value] drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' if (apl_pinctrl_pdata.name) ^ drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name, ret); ^ >> drivers/mfd/lpc_ich.c:1169:5: warning: format '%s' expects argument of type >> 'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=] drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' kfree(apl_pinctrl_pdata.name); ^ drivers/mfd/lpc_ich.c: At top level: drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used [-Wunused-function] static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset) ^ vim +175 drivers/mfd/lpc_ich.c 169 static struct mfd_cell apl_gpio_devices[] = { 170 { 171 .name = "apl-pinctrl", 172 .id = 0, 173 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 174 .resources = apl_gpio_io_res, > 175 .pdata_size = sizeof(apl_pinctrl_pdata), 176 .platform_data = _pinctrl_pdata, 177 .ignore_resource_conflicts = true, 178 }, 179 { 180 .name = "apl-pinctrl", 181 .id = 1, 182 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 183 .resources = apl_gpio_io_res, 184 .pdata_size = sizeof(apl_pinctrl_pdata), 185 .platform_data = _pinctrl_pdata, 186 .ignore_resource_conflicts = true, 187 }, 188 { 189 .name = "apl-pinctrl", 190 .id = 2, 191 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 192 .resources = apl_gpio_io_res, > 193 .pdata_size = sizeof(apl_pinctrl_pdata), 194 .platform_data = _pinctrl_pdata, 195 .ignore_resource_conflicts = true, 196 }, 197 { 198 .name = "apl-pinctrl", 199 .id = 3, 200 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 201 .resources = apl_gpio_io_res, > 202 .pdata_size = sizeof(apl_pinctrl_pdata), 203 .platform_data = _pinctrl_pdata, 204 .ignore_resource_conflicts = true, 205 }, --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
Hi, [auto build test ERROR on tip/x86/core] [also build test ERROR on v4.7-rc4 next-20160620] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027 config: x86_64-lkp (attached as .config) compiler: gcc-4.9 (Debian 4.9.3-14) 4.9.3 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): >> drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to >> incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc': >> drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct >> pinctrl_pin_desc' apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u", ^ >> drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect >> [-Wunused-value] drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' if (apl_pinctrl_pdata.name) ^ drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name, ret); ^ >> drivers/mfd/lpc_ich.c:1169:5: warning: format '%s' expects argument of type >> 'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=] drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' kfree(apl_pinctrl_pdata.name); ^ drivers/mfd/lpc_ich.c: At top level: drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used [-Wunused-function] static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset) ^ vim +175 drivers/mfd/lpc_ich.c 169 static struct mfd_cell apl_gpio_devices[] = { 170 { 171 .name = "apl-pinctrl", 172 .id = 0, 173 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 174 .resources = apl_gpio_io_res, > 175 .pdata_size = sizeof(apl_pinctrl_pdata), 176 .platform_data = _pinctrl_pdata, 177 .ignore_resource_conflicts = true, 178 }, 179 { 180 .name = "apl-pinctrl", 181 .id = 1, 182 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 183 .resources = apl_gpio_io_res, 184 .pdata_size = sizeof(apl_pinctrl_pdata), 185 .platform_data = _pinctrl_pdata, 186 .ignore_resource_conflicts = true, 187 }, 188 { 189 .name = "apl-pinctrl", 190 .id = 2, 191 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 192 .resources = apl_gpio_io_res, > 193 .pdata_size = sizeof(apl_pinctrl_pdata), 194 .platform_data = _pinctrl_pdata, 195 .ignore_resource_conflicts = true, 196 }, 197 { 198 .name = "apl-pinctrl", 199 .id = 3, 200 .num_resources = ARRAY_SIZE(apl_gpio_io_res), 201 .resources = apl_gpio_io_res, > 202 .pdata_size = sizeof(apl_pinctrl_pdata), 203 .platform_data = _pinctrl_pdata, 204 .ignore_resource_conflicts = true, 205 }, --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
Hi, [auto build test ERROR on tip/x86/core] [also build test ERROR on v4.7-rc4 next-20160620] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027 config: x86_64-randconfig-i0-201625 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc': drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u", ^ drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect [-Wunused-value] drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' if (apl_pinctrl_pdata.name) ^~ drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name, ret); ^ drivers/mfd/lpc_ich.c:1168:37: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=] "Failed to add Apollo Lake GPIO %s: %d\n", ^ drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' kfree(apl_pinctrl_pdata.name); ^ drivers/mfd/lpc_ich.c: At top level: >> drivers/mfd/lpc_ich.c:167:32: error: storage size of 'apl_pinctrl_pdata' >> isn't known static struct pinctrl_pin_desc apl_pinctrl_pdata; ^ drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used [-Wunused-function] static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset) ^~~~ vim +167 drivers/mfd/lpc_ich.c 161 APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"), 162 DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET, 163 APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"), 164 DEFINE_RES_IRQ(APL_GPIO_IRQ), 165 }; 166 > 167 static struct pinctrl_pin_desc apl_pinctrl_pdata; 168 169 static struct mfd_cell apl_gpio_devices[] = { 170 { --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
Hi, [auto build test ERROR on tip/x86/core] [also build test ERROR on v4.7-rc4 next-20160620] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Tan-Jui-Nee/pinctrl-broxton-enable-platform-device-in-the-absent-of-ACPI-enumeration/20160621-132027 config: x86_64-randconfig-i0-201625 (attached as .config) compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All errors (new ones prefixed by >>): drivers/mfd/lpc_ich.c:175:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:184:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:193:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c:202:23: error: invalid application of 'sizeof' to incomplete type 'struct pinctrl_pin_desc' .pdata_size = sizeof(apl_pinctrl_pdata), ^ drivers/mfd/lpc_ich.c: In function 'lpc_ich_misc': drivers/mfd/lpc_ich.c:1154:3: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name = kasprintf(GFP_KERNEL, "%u", ^ drivers/mfd/lpc_ich.c:1154:3: warning: statement with no effect [-Wunused-value] drivers/mfd/lpc_ich.c:1158:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' if (apl_pinctrl_pdata.name) ^~ drivers/mfd/lpc_ich.c:1169:5: error: invalid use of undefined type 'struct pinctrl_pin_desc' apl_pinctrl_pdata.name, ret); ^ drivers/mfd/lpc_ich.c:1168:37: warning: format '%s' expects argument of type 'char *', but argument 3 has type 'struct mfd_cell *' [-Wformat=] "Failed to add Apollo Lake GPIO %s: %d\n", ^ drivers/mfd/lpc_ich.c:1171:2: error: invalid use of undefined type 'struct pinctrl_pin_desc' kfree(apl_pinctrl_pdata.name); ^ drivers/mfd/lpc_ich.c: At top level: >> drivers/mfd/lpc_ich.c:167:32: error: storage size of 'apl_pinctrl_pdata' >> isn't known static struct pinctrl_pin_desc apl_pinctrl_pdata; ^ drivers/mfd/lpc_ich.c:1131:12: warning: 'lpc_ich_misc' defined but not used [-Wunused-function] static int lpc_ich_misc(struct pci_dev *dev, enum lpc_chipsets chipset) ^~~~ vim +167 drivers/mfd/lpc_ich.c 161 APL_GPIO_WEST_NPIN * SZ_8, "apl_pinctrl_w"), 162 DEFINE_RES_MEM_NAMED(APL_GPIO_SOUTHWEST_OFFSET, 163 APL_GPIO_SOUTHWEST_NPIN * SZ_8, "apl_pinctrl_sw"), 164 DEFINE_RES_IRQ(APL_GPIO_IRQ), 165 }; 166 > 167 static struct pinctrl_pin_desc apl_pinctrl_pdata; 168 169 static struct mfd_cell apl_gpio_devices[] = { 170 { --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
This driver uses the P2SB hide/unhide mechanism cooperatively to pass the PCI BAR address to the gpio platform driver. Signed-off-by: Tan Jui Nee--- 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 arch/x86/Kconfig | 10 drivers/mfd/Kconfig | 3 +- drivers/mfd/lpc_ich.c | 126 ++ 3 files changed, 138 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d305d81..520edd3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -604,6 +604,16 @@ config IOSF_MBI_DEBUG If you don't require the option or are in doubt, say N. +config X86_INTEL_NON_ACPI + bool "Enable support non-ACPI Intel platforms" + select PINCTRL + ---help--- + Select this option to enables MMIO BAR access over the P2SB for + non-ACPI Intel SoC platforms. This driver uses the P2SB hide/unhide + mechanism cooperatively to pass the PCI BAR address to the platform + driver, currently GPIO on the following SoC products. + - Apollo Lake + config P2SB tristate depends on PCI diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..dc4e543 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -369,8 +369,9 @@ config MFD_INTEL_QUARK_I2C_GPIO config LPC_ICH tristate "Intel ICH LPC" - depends on PCI + depends on X86 && PCI select MFD_CORE + select P2SB help The LPC bridge function of the Intel ICH provides support for many functional units. This driver provides needed support for diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index bd3aa45..a64854d 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c @@ -68,6 +68,10 @@ #include #include #include +#include +#include + +#include #define ACPIBASE 0x40 #define ACPIBASE_GPE_OFF 0x28 @@ -94,6 +98,21 @@ #define wdt_mem_res(i) wdt_res(ICH_RES_MEM_OFF, i) #define wdt_res(b, i) (_ich_res[(b) + (i)]) +/* Offset data for Apollo Lake GPIO communities */ +#define APL_GPIO_SOUTHWEST_OFFSET 0xc0 +#define APL_GPIO_NORTHWEST_OFFSET 0xc4 +#define APL_GPIO_NORTH_OFFSET 0xc5 +#define APL_GPIO_WEST_OFFSET 0xc7 + +#define APL_GPIO_SOUTHWEST_NPIN43 +#define APL_GPIO_NORTHWEST_NPIN77 +#define APL_GPIO_NORTH_NPIN78 +#define APL_GPIO_WEST_NPIN 47 + +#define APL_GPIO_IRQ 14 + +#define PCI_IDSEL_P2SB 0x0d + struct lpc_ich_priv { int chipset; @@ -133,6 +152,59 @@ static struct resource gpio_ich_res[] = { }, }; +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, + 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 pinctrl_pin_desc apl_pinctrl_pdata; + +static struct mfd_cell apl_gpio_devices[] = { + { + .name = "apl-pinctrl", + .id = 0, + .num_resources = ARRAY_SIZE(apl_gpio_io_res), + .resources = apl_gpio_io_res, + .pdata_size = sizeof(apl_pinctrl_pdata), + .platform_data = _pinctrl_pdata, + .ignore_resource_conflicts = true, + }, + { + .name = "apl-pinctrl", + .id = 1, + .num_resources =
[PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
This driver uses the P2SB hide/unhide mechanism cooperatively to pass the PCI BAR address to the gpio platform driver. Signed-off-by: Tan Jui Nee --- 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 arch/x86/Kconfig | 10 drivers/mfd/Kconfig | 3 +- drivers/mfd/lpc_ich.c | 126 ++ 3 files changed, 138 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d305d81..520edd3 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -604,6 +604,16 @@ config IOSF_MBI_DEBUG If you don't require the option or are in doubt, say N. +config X86_INTEL_NON_ACPI + bool "Enable support non-ACPI Intel platforms" + select PINCTRL + ---help--- + Select this option to enables MMIO BAR access over the P2SB for + non-ACPI Intel SoC platforms. This driver uses the P2SB hide/unhide + mechanism cooperatively to pass the PCI BAR address to the platform + driver, currently GPIO on the following SoC products. + - Apollo Lake + config P2SB tristate depends on PCI diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 1bcf601..dc4e543 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -369,8 +369,9 @@ config MFD_INTEL_QUARK_I2C_GPIO config LPC_ICH tristate "Intel ICH LPC" - depends on PCI + depends on X86 && PCI select MFD_CORE + select P2SB help The LPC bridge function of the Intel ICH provides support for many functional units. This driver provides needed support for diff --git a/drivers/mfd/lpc_ich.c b/drivers/mfd/lpc_ich.c index bd3aa45..a64854d 100644 --- a/drivers/mfd/lpc_ich.c +++ b/drivers/mfd/lpc_ich.c @@ -68,6 +68,10 @@ #include #include #include +#include +#include + +#include #define ACPIBASE 0x40 #define ACPIBASE_GPE_OFF 0x28 @@ -94,6 +98,21 @@ #define wdt_mem_res(i) wdt_res(ICH_RES_MEM_OFF, i) #define wdt_res(b, i) (_ich_res[(b) + (i)]) +/* Offset data for Apollo Lake GPIO communities */ +#define APL_GPIO_SOUTHWEST_OFFSET 0xc0 +#define APL_GPIO_NORTHWEST_OFFSET 0xc4 +#define APL_GPIO_NORTH_OFFSET 0xc5 +#define APL_GPIO_WEST_OFFSET 0xc7 + +#define APL_GPIO_SOUTHWEST_NPIN43 +#define APL_GPIO_NORTHWEST_NPIN77 +#define APL_GPIO_NORTH_NPIN78 +#define APL_GPIO_WEST_NPIN 47 + +#define APL_GPIO_IRQ 14 + +#define PCI_IDSEL_P2SB 0x0d + struct lpc_ich_priv { int chipset; @@ -133,6 +152,59 @@ static struct resource gpio_ich_res[] = { }, }; +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, + 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 pinctrl_pin_desc apl_pinctrl_pdata; + +static struct mfd_cell apl_gpio_devices[] = { + { + .name = "apl-pinctrl", + .id = 0, + .num_resources = ARRAY_SIZE(apl_gpio_io_res), + .resources = apl_gpio_io_res, + .pdata_size = sizeof(apl_pinctrl_pdata), + .platform_data = _pinctrl_pdata, + .ignore_resource_conflicts = true, + }, + { + .name = "apl-pinctrl", + .id = 1, + .num_resources = ARRAY_SIZE(apl_gpio_io_res), +