2022-05-14 03:25:51

by Henning Schild

[permalink] [raw]
Subject: [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio

changed since v2:
- put GPIO led module under same config switch
- some style changes from review
- init gpios with gpiod_get_index and drop gpiod_set_value
- drop bogus "if" from watchdog Kconfig

changed since v1:
- rebased
- split p1 into p1-3

This switches the simatic-ipc modules to using the upcoming p2sb
interface introduced by Andy with
"platform/x86: introduce p2sb_bar() helper".
The series relies on these p2sb changes already applied and Andy will
likely take them into his series at some point.

It also switches to one apollo lake device to using gpio leds.

Henning Schild (4):
leds: simatic-ipc-leds: convert to use P2SB accessor
watchdog: simatic-ipc-wdt: convert to use P2SB accessor
platform/x86: simatic-ipc: drop custom P2SB bar code
leds: simatic-ipc-leds-gpio: add GPIO version of Siemens driver

drivers/leds/simple/Kconfig | 6 +-
drivers/leds/simple/Makefile | 1 +
drivers/leds/simple/simatic-ipc-leds-gpio.c | 105 ++++++++++++++++++
drivers/leds/simple/simatic-ipc-leds.c | 80 +------------
drivers/platform/x86/simatic-ipc.c | 43 +------
drivers/watchdog/Kconfig | 1 +
drivers/watchdog/simatic-ipc-wdt.c | 15 +--
.../platform_data/x86/simatic-ipc-base.h | 2 -
8 files changed, 126 insertions(+), 127 deletions(-)
create mode 100644 drivers/leds/simple/simatic-ipc-leds-gpio.c

--
2.35.1



2022-05-14 04:15:15

by Henning Schild

[permalink] [raw]
Subject: [PATCH v3 3/4] platform/x86: simatic-ipc: drop custom P2SB bar code

The two drivers that used to use this have been switched over to the
common P2SB accessor, so this code is not needed any longer.

Signed-off-by: Henning Schild <[email protected]>
---
drivers/platform/x86/simatic-ipc.c | 38 -------------------
.../platform_data/x86/simatic-ipc-base.h | 2 -
2 files changed, 40 deletions(-)

diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c
index b599cda5ba3c..26c35e1660cb 100644
--- a/drivers/platform/x86/simatic-ipc.c
+++ b/drivers/platform/x86/simatic-ipc.c
@@ -101,44 +101,6 @@ static int register_platform_devices(u32 station_id)
return 0;
}

-/* FIXME: this should eventually be done with generic P2SB discovery code
- * the individual drivers for watchdogs and LEDs access memory that implements
- * GPIO, but pinctrl will not come up because of missing ACPI entries
- *
- * While there is no conflict a cleaner solution would be to somehow bring up
- * pinctrl even with these ACPI entries missing, and base the drivers on pinctrl.
- * After which the following function could be dropped, together with the code
- * poking the memory.
- */
-/*
- * Get membase address from PCI, used in leds and wdt module. Here we read
- * the bar0. The final address calculation is done in the appropriate modules
- */
-u32 simatic_ipc_get_membase0(unsigned int p2sb)
-{
- struct pci_bus *bus;
- u32 bar0 = 0;
- /*
- * The GPIO memory is in bar0 of the hidden P2SB device.
- * Unhide the device to have a quick look at it, before we hide it
- * again.
- * Also grab the pci rescan lock so that device does not get discovered
- * and remapped while it is visible.
- * This code is inspired by drivers/mfd/lpc_ich.c
- */
- bus = pci_find_bus(0, 0);
- pci_lock_rescan_remove();
- pci_bus_write_config_byte(bus, p2sb, 0xE1, 0x0);
- pci_bus_read_config_dword(bus, p2sb, PCI_BASE_ADDRESS_0, &bar0);
-
- bar0 &= ~0xf;
- pci_bus_write_config_byte(bus, p2sb, 0xE1, 0x1);
- pci_unlock_rescan_remove();
-
- return bar0;
-}
-EXPORT_SYMBOL(simatic_ipc_get_membase0);
-
static int __init simatic_ipc_init_module(void)
{
const struct dmi_system_id *match;
diff --git a/include/linux/platform_data/x86/simatic-ipc-base.h b/include/linux/platform_data/x86/simatic-ipc-base.h
index 62d2bc774067..39fefd48cf4d 100644
--- a/include/linux/platform_data/x86/simatic-ipc-base.h
+++ b/include/linux/platform_data/x86/simatic-ipc-base.h
@@ -24,6 +24,4 @@ struct simatic_ipc_platform {
u8 devmode;
};

-u32 simatic_ipc_get_membase0(unsigned int p2sb);
-
#endif /* __PLATFORM_DATA_X86_SIMATIC_IPC_BASE_H */
--
2.35.1


2022-05-23 16:22:58

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 3/4] platform/x86: simatic-ipc: drop custom P2SB bar code

On Fri, May 13, 2022 at 10:36:51AM +0200, Henning Schild wrote:
> The two drivers that used to use this have been switched over to the
> common P2SB accessor, so this code is not needed any longer.

Hans, in order to minimize the risk of not getting this into next cycle, I
would like to collect your tag (if you have no objection) and then, when I send
a new version of the P2SB series with this series together, we would everything
ready to be taken by Lee.

--
With Best Regards,
Andy Shevchenko



2022-05-23 16:24:27

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio

On Fri, May 13, 2022 at 10:36:48AM +0200, Henning Schild wrote:
> changed since v2:
> - put GPIO led module under same config switch
> - some style changes from review
> - init gpios with gpiod_get_index and drop gpiod_set_value
> - drop bogus "if" from watchdog Kconfig
>
> changed since v1:
> - rebased
> - split p1 into p1-3
>
> This switches the simatic-ipc modules to using the upcoming p2sb
> interface introduced by Andy with
> "platform/x86: introduce p2sb_bar() helper".
> The series relies on these p2sb changes already applied and Andy will
> likely take them into his series at some point.
>
> It also switches to one apollo lake device to using gpio leds.

Hmm... This series misses LEDS maintainer. Okay, I will include them when
sending v6 after v5.19-rc1.

--
With Best Regards,
Andy Shevchenko



2022-06-07 17:38:04

by Henning Schild

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio

Am Tue, 7 Jun 2022 18:18:05 +0300
schrieb Andy Shevchenko <[email protected]>:

> On Mon, May 23, 2022 at 07:24:08PM +0300, Andy Shevchenko wrote:
> > On Fri, May 13, 2022 at 10:36:48AM +0200, Henning Schild wrote:
> > > changed since v2:
> > > - put GPIO led module under same config switch
> > > - some style changes from review
> > > - init gpios with gpiod_get_index and drop gpiod_set_value
> > > - drop bogus "if" from watchdog Kconfig
> > >
> > > changed since v1:
> > > - rebased
> > > - split p1 into p1-3
> > >
> > > This switches the simatic-ipc modules to using the upcoming p2sb
> > > interface introduced by Andy with
> > > "platform/x86: introduce p2sb_bar() helper".
> > > The series relies on these p2sb changes already applied and Andy
> > > will likely take them into his series at some point.
> > >
> > > It also switches to one apollo lake device to using gpio leds.
> >
> > Hmm... This series misses LEDS maintainer. Okay, I will include
> > them when sending v6 after v5.19-rc1.
>
> I have sent v6 [1], please make sure everything is okay.

I received that and had a quick look over my bits. That all looked like
i sent it so i have no reason to doubt it would be working as expected.

In the coming two weeks i will not be able to get my hands on hardware,
so can not test but am pretty sure it is not needed another time.

regards,
Henning

> [1]:
> https://lore.kernel.org/platform-driver-x86/[email protected]/


2022-06-08 03:15:47

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] simatic-ipc additions to p2sb apl lake gpio

On Mon, May 23, 2022 at 07:24:08PM +0300, Andy Shevchenko wrote:
> On Fri, May 13, 2022 at 10:36:48AM +0200, Henning Schild wrote:
> > changed since v2:
> > - put GPIO led module under same config switch
> > - some style changes from review
> > - init gpios with gpiod_get_index and drop gpiod_set_value
> > - drop bogus "if" from watchdog Kconfig
> >
> > changed since v1:
> > - rebased
> > - split p1 into p1-3
> >
> > This switches the simatic-ipc modules to using the upcoming p2sb
> > interface introduced by Andy with
> > "platform/x86: introduce p2sb_bar() helper".
> > The series relies on these p2sb changes already applied and Andy will
> > likely take them into his series at some point.
> >
> > It also switches to one apollo lake device to using gpio leds.
>
> Hmm... This series misses LEDS maintainer. Okay, I will include them when
> sending v6 after v5.19-rc1.

I have sent v6 [1], please make sure everything is okay.

[1]: https://lore.kernel.org/platform-driver-x86/[email protected]/

--
With Best Regards,
Andy Shevchenko