pinctrl/broxton: enable platform device in the absent of ACPI enumeration
Subsystems (6)
v4 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 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):
x86/platform/p2sb: New Primary to Sideband bridge support driver for
Intel SOC's
Tan Jui Nee (2):
pinctrl/broxton: enable platform device in the absent of ACPI
enumeration
mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in
non-ACPI system
arch/x86/Kconfig | 14 ++++ arch/x86/include/asm/p2sb.h | 27 +++++++ arch/x86/platform/intel/Makefile | 1 + arch/x86/platform/intel/p2sb.c | 99 +++++++++++++++++++++++++ drivers/mfd/Kconfig | 3 +- drivers/mfd/lpc_ich.c | 126 ++++++++++++++++++++++++++++++++ drivers/pinctrl/intel/pinctrl-broxton.c | 43 ++++++++--- 7 files changed, 300 insertions(+), 13 deletions(-) create mode 100644 arch/x86/include/asm/p2sb.h create mode 100644 arch/x86/platform/intel/p2sb.c
Signature · 1 line
1.9.1
PATCH v4 1/3 pinctrl/broxton: enable platform device in the absent of ACPI enumeration
This is to cater the need for non-ACPI system whereby a platform device has to be created in order to bind with the Apollo Lake Pinctrl GPIO platform driver.
---
Changes in V4:
- added Mika's ACK
Changes in V3:
- No change
Changes in V2:
- No change
drivers/pinctrl/intel/pinctrl-broxton.c | 43 ++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-)
drivers/pinctrl/intel/pinctrl-broxton.c +31 -12
@@ -1,7 +1,7 @@/* * Intel Broxton SoC pinctrl/GPIO driver * -* Copyright (C) 2015, Intel Corporation +* Copyright (C) 2015, 2016 Intel Corporation * Author: Mika Westerberg <[email protected]> * * This program is free software; you can redistribute it and/or modify
@@ -1003,29 +1003,46 @@ static const struct acpi_device_id bxt_pinctrl_acpi_match[] = { };MODULE_DEVICE_TABLE (acpi, bxt_pinctrl_acpi_match); +static const struct platform_device_id bxt_pinctrl_platform_ids[] = { + {"apl-pinctrl" , (kernel_ulong_t)&apl_pinctrl_soc_data }, + {"broxton-pinctrl" , (kernel_ulong_t)&bxt_pinctrl_soc_data }, + { }, +}; +static int bxt_pinctrl_probe (struct platform_device *pdev) {const struct intel_pinctrl_soc_data *soc_data =NULL ;const struct intel_pinctrl_soc_data **soc_table; -const struct acpi_device_id *id;struct acpi_device *adev;int i; adev =ACPI_COMPANION (&pdev->dev); -if (!adev) -return -ENODEV ; +if (adev) { +const struct acpi_device_id *id; - id =acpi_match_device (bxt_pinctrl_acpi_match, &pdev->dev); -if (!id) -return -ENODEV ; + id =acpi_match_device (bxt_pinctrl_acpi_match, &pdev->dev); +if (!id) +return -ENODEV ; - soc_table = (const struct intel_pinctrl_soc_data **)id->driver_data; + soc_table = (const struct intel_pinctrl_soc_data **) + id->driver_data; -for (i =0 ; soc_table[i]; i++) { -if (!strcmp (adev->pnp.unique_id, soc_table[i]->uid)) { - soc_data = soc_table[i]; -break ; +for (i =0 ; soc_table[i]; i++) { +if (!strcmp (adev->pnp.unique_id, soc_table[i]->uid)) { + soc_data = soc_table[i]; +break ; + } } + }else { +const struct platform_device_id *pid; + + pid =platform_get_device_id (pdev); +if (!pid) +return -ENODEV ; + + soc_table = (const struct intel_pinctrl_soc_data **) + pid->driver_data; + soc_data = soc_table[pdev->id]; }if (!soc_data)
@@ -1047,6 +1064,7 @@ static struct platform_driver bxt_pinctrl_driver = { .acpi_match_table = bxt_pinctrl_acpi_match, .pm = &bxt_pinctrl_pm_ops, }, + .id_table = bxt_pinctrl_platform_ids, };static int __init bxt_pinctrl_init (void )
@@ -1064,3 +1082,4 @@ module_exit(bxt_pinctrl_exit);MODULE_AUTHOR ("Mika Westerberg <[email protected]>" );MODULE_DESCRIPTION ("Intel Broxton SoC pinctrl/GPIO driver" );MODULE_LICENSE ("GPL v2" ); +MODULE_ALIAS ("platform:broxton-pinctrl" );
Signature · 1 line
1.9.1
PATCH v4 2/3 x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's
In reply to Tan Jui NeeFrom: 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 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/Kconfig | 4 ++ arch/x86/include/asm/p2sb.h | 27 +++++++++++ arch/x86/platform/intel/Makefile | 1 + arch/x86/platform/intel/p2sb.c | 99 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 arch/x86/include/asm/p2sb.h create mode 100644 arch/x86/platform/intel/p2sb.c
arch/x86/Kconfig +4 -0
@@ -604,6 +604,10 @@ config IOSF_MBI_DEBUG If you don't require the option or are in doubt, say N. +config P2SB + tristate + depends on PCI + config X86_RDC321X bool "RDC R-321x SoC" depends on X86_32
arch/x86/include/asm/p2sb.h new file +27 -0
@@ -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 */
arch/x86/platform/intel/Makefile +1 -0
@@ -1 +1,2 @@ obj-$(CONFIG_IOSF_MBI) += iosf_mbi.o +obj-$(CONFIG_P2SB) += p2sb.o
arch/x86/platform/intel/p2sb.c new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 3/3 mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
In reply to Tan Jui NeeThis driver uses the P2SB hide/unhide mechanism cooperatively to pass the PCI BAR address to the gpio platform driver.
---
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(-)
arch/x86/Kconfig +10 -0
@@ -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
drivers/mfd/Kconfig +2 -1
@@ -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
drivers/mfd/lpc_ich.c +126 -0
174 lines not on this page · raw message
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI 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…
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 infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
In reply to Tan Jui Neeurl: 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…
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 = &apl_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 = &apl_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 = &apl_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 = &apl_pinctrl_pdata,
204 .ignore_resource_conflicts = true,
205 },
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Quoted 6 lines · Tan Jui Nee
This is to cater the need for non-ACPI system whereby a platform device has to be created in order to bind with the Apollo Lake Pinctrl GPIO platform driver.
Signed-off-by Tan Jui Nee <[email protected]>Acked-by Mika Westerberg <[email protected]>
This patch is already applied in my tree.
Yours,
Linus Walleij
Re: [PATCH v4 2/3] x86/platform/p2sb: New Primary to Sideband bridge support driver for Intel SOC's
In reply to Tan Jui NeeQuoted 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.Signed-off-by Yong, Jonathan <[email protected]>Signed-off-by Andy Shevchenko <[email protected]>
Quoted 7 lines
---
Changes in V4:
- MoveKconfigoptionCONFIG_X86_INTEL_NON_ACPIfrom
[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.
Waiting for a respin in accordance with Mika's comments.
You don't need to resend patch 1/3 it is already applied.
Yours,
Linus Walleij
Re: [PATCH v4 3/3] mfd: lpc_ich: Add support for Intel Apollo Lake GPIO pinctrl in non-ACPI system
In reply to Tan Jui NeeQuoted 4 lines · Tan Jui Nee
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 <[email protected]>
Quoted 13 lines
---
Changes in V4:
- MoveKconfigoptionCONFIG_X86_INTEL_NON_ACPIfrom
[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.
- SelectCONFIG_P2SBwhenCONFIG_LPC_ICHis enabled.
- Remove #ifdefCONFIG_X86_INTEL_NON_ACPIand use
#ifdefined(CONFIG_X86_INTEL_NON_ACPI)whenlpc_ich_miscis called
as suggested by Lee Jones.
- Use single dimensional array instead of 2D array forapl_gpio_io_resstructure and useDEFINE_RES_IRQfor its IRQ resource.
I guess this patch will also change, also fix the screamings from the build robot please.
Yours,
Linus Walleij