From patchwork Wed Aug 24 14:03:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henning Schild X-Patchwork-Id: 600125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57E4EC48BEA for ; Wed, 24 Aug 2022 14:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238148AbiHXOEG (ORCPT ); Wed, 24 Aug 2022 10:04:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238097AbiHXOEF (ORCPT ); Wed, 24 Aug 2022 10:04:05 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2041.outbound.protection.outlook.com [40.107.105.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2364B8688E; Wed, 24 Aug 2022 07:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HgPhZcmtR2KxuSfpOV8YiM+TlIwo5bMg2H+t7ByJOwxLL2RSUh1QxOdfXInNGC6ZNCnqVHzM+iVG33UUTn6rL2XjGf6R5xBUBR7rbZLCtGWkYM+wIfRR+4IJG1YZDcvjze+GiNGOR0KZWP6Yl4b308wH8/6HjJtkPwA7OFNx9q+Us1Esoz2x/4XxPbra0S0IrXppfP1w8zAwn3Sow+8I3KCWB0FsauJRxnBgdtMEVoA0U1iKxiR+5S6CkwNdoXjHpj24KMSEQ3oL7l3GX7CkTu9efIzsFrZy1/bgwTR3KG+u7w4qL2Ja6fLt9+E66Ug9OD44C2EOgr/Elk3UlXBb6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vY+IRD8AQL5pNUkJbuEwvcnKMHAvl/E2ZEMYnI9zJmE=; b=OJqN0V0Pqk5ikeIiVOuuwFTheRBJLSCxEMwgELwqk+5Gip84w/7Gt3PQ4j1cIfhmZkWH+LLvcxJfWwChc4XmNg7gpUdD/LlFO6w0WU9h2QBSv/KA8T2lW/QUuebuIw+hUu2X8gENZOfDCxm8wJokuZXUWsa19kLpNnWY8224JIQTXGNo3s6AhJmi8Rx0q4ldAaBceEGLnCvrm9REr+Xr/AMgvCIcPVDWlYWBwuEicnAllfrgkDUehQICs0o3zgkXtLbGieFVmFhsm9DhRBvym15H/cVwz0wv8/newFutBzWJRP4YcrvXhR1P2Zu+9hik6VVucWeOdz4ySrlaT0LTaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 194.138.21.76) smtp.rcpttodomain=linaro.org smtp.mailfrom=siemens.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vY+IRD8AQL5pNUkJbuEwvcnKMHAvl/E2ZEMYnI9zJmE=; b=QZOS68FJGqSBaqgNBUg6+h3mlOqRxek1/1HJp1yzMr8Wg3qIyircCNNRCXLISbKhRuppWO3K3EGeTT2u4YHvRZCszDIdUtI+HcLiGiNx+XFz70DKLeeb4EVp6O3Ugm/zqwaxQoRHKKoIXR8wIiF8A8q3igdAxQBQ5scl+giR+Q2IYnPXCZj15EtpxHiuddcsDRTa5I4I0qQRM3wx3sk4JzSI+b4060r8PjVqV428Dinl3///rpFFwMrcO5Ncbf5T9J/DNhAzoUUAlzqslcVXKp7syzlctTKw+I2s5i5O9/pfu5nijUyDRB93V/8ZWeddFGJnzmxMdHyR+NGn93fIag== Received: from DB9PR02CA0030.eurprd02.prod.outlook.com (2603:10a6:10:1d9::35) by VI1PR10MB2224.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:89::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Wed, 24 Aug 2022 14:03:59 +0000 Received: from DB5EUR01FT009.eop-EUR01.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::1a) by DB9PR02CA0030.outlook.office365.com (2603:10a6:10:1d9::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:03:59 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 194.138.21.76) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=siemens.com; Received-SPF: Fail (protection.outlook.com: domain of siemens.com does not designate 194.138.21.76 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.76; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.76) by DB5EUR01FT009.mail.protection.outlook.com (10.152.4.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:03:59 +0000 Received: from DEMCHDC89XA.ad011.siemens.net (139.25.226.103) by DEMCHDC8VSA.ad011.siemens.net (194.138.21.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Wed, 24 Aug 2022 16:03:58 +0200 Received: from md1za8fc.ad001.siemens.net (139.25.0.80) by DEMCHDC89XA.ad011.siemens.net (139.25.226.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Wed, 24 Aug 2022 16:03:57 +0200 From: Henning Schild To: Linus Walleij , Bartosz Golaszewski , Pavel Machek , Hans de Goede , Mark Gross , Andy Shevchenko , Lee Jones , , , , CC: Sheng-Yuan Huang , Tasanakorn Phaipool , , Henning Schild Subject: [PATCH v5 1/5] gpio-f7188x: Add GPIO support for Nuvoton NCT6116 Date: Wed, 24 Aug 2022 16:03:43 +0200 Message-ID: <20220824140347.1842-2-henning.schild@siemens.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824140347.1842-1-henning.schild@siemens.com> References: <20220824140347.1842-1-henning.schild@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.80] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC89XA.ad011.siemens.net (139.25.226.103) X-TM-AS-Product-Ver: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-AS-Result: No-10--9.558100-8.000000 X-TMASE-MatchedRID: 4hNj2i8ecmwnajXSbZssErN5pka0DGqI47cLULZlxOVkGI+vgRTxME+c rEA4+nhZEmx/CUhRV0GhAqHLqD5GgW7iQTMjrcXyIyjGuFgTWAqmWOD8X0TFhCfphWrcxCwjP6T ki+9nU38HZBaLwEXlKIpbwG9fIuITxDz7g9Od+jiMiT1/gSrRziLSA2Bw59G2hjlBjwpom1OsU/ iX0A2wj4vTOLR19hMMHR687uSBjUkAR2M5455n91jt7H32pJq0gQFyHQeFnIN/OBWacv+iVX/0y Dqj7AyLVWQnHKxp38hGVKommfqPJwpcjQYVE58IpbJMDIZ4m6+DrlECq0GE4mNW0DAjL5p+XGjQ f7uckKtGRWxg7mLXKMTr/G24o7RrCnOJY6i7X33k53wLsyYs5QwhA/znOS/bb/oIJuUAIuF9LQi nZ4QefPcjNeVeWlqY+gtHj7OwNO0LH2qjGZLbHeK7e9vioFO+EPjsoCTRPWYlbza6rYgu5uVR+x t+73YO X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.558100-8.000000 X-TMASE-Version: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-SNTS-SMTP: 7911DB83ADFA2519C4AB3A2571267570AD7C3AC21E91D91B4DF10BA40E342D552000:8 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c3b15f3-6e72-4a1b-962e-08da85d97dfd X-MS-TrafficTypeDiagnostic: VI1PR10MB2224:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AnA8y5No7v0l36BYxy3W+dnF4Yai+hR69I+sjgWBUoJrid/D6PM6vzNfrHJxh4u+2z5vHpxEPthIV4sE3qgDGieXkWMjFvO0abuafUvwlQ7gXh0gUTIHgfic5nzpy+lW4r3CgHOZojowozfwn2kiNqJgP/RwroqLvq8WSXGmbQttM26rw72qEmqSuExD2AX17QkGYnosDqkCttSRKRzkaVHeUc3J/iH6op9C4vV2Jt7NalvYPYVdj3oPrVj0YPjbjNwveW7riVSWr3BqIPfpYKPKlJbr2bRd0UGdisnQd+GJdOttoAIrrDYJ/S56dKtky89pDCRJamG2oCrRCYUPAC2WMWEN1BdFIy+KqWcQSxEKUyWK1015STEfklSVdsplhZzuqb3/OArtoEkdVfGzlY7KDIkhoJli00BdQyetWMWh3Oz/ejoGKgbIXyS7G4JQ53kt9efyWAYzVnsfFlRbq4hLvxDuks/mCSbTlRXc8BdLjjKUm+Qqn1+vdlYeeZFvFDgo/g0Qk5c7DYotmvvjwTQUzJlL6gZ2W6YQl4FpyBWQYqKL1uva6EnmtVa7meNWkpO76pMkQRArUuw+X3KctqLWNvZFzpveN/p66PsLrYnWpP8I6JJbcN2u3yz/27yoE2aQalUaWcjmaty/aVytcIvrCIQLQxZusR1bW2s98TW8qAczXzTqH/yiLRPWQIO0+WjTxm4cBSnA1gtYZIlMp2PrAHSx6+OZoppNFYHMtt0zCh+DyYzNBsNphrVgKU4uJz5H/pynGDMeuLXO1ATKf1rRircnL0DdU77yft1Rc2/fs6ulpkJGfTWYl7a1ls3ocQC+bPVeYpc9I0n/TPipeoATX2ju5tT5T8dH/TYTaEr78vI0sEsFj8eN6M5v4MdW2PqI7L+AOGDSHSpIfOLEsA== X-Forefront-Antispam-Report: CIP:194.138.21.76; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(136003)(346002)(39860400002)(396003)(46966006)(36840700001)(40470700004)(34020700004)(82310400005)(83380400001)(4326008)(40460700003)(40480700001)(921005)(81166007)(36756003)(356005)(36860700001)(82740400003)(70586007)(8676002)(70206006)(8936002)(316002)(7416002)(5660300002)(44832011)(26005)(478600001)(107886003)(6666004)(186003)(956004)(54906003)(82960400001)(110136005)(41300700001)(2906002)(86362001)(47076005)(1076003)(336012)(2616005)(16526019)(83996005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 14:03:59.3811 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c3b15f3-6e72-4a1b-962e-08da85d97dfd X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.76]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT009.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2224 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Add GPIO support for Nuvoton NCT6116 chip. Nuvoton SuperIO chips are very similar to the ones from Fintek. In other subsystems they also share drivers and are called a family of drivers. For the GPIO subsystem the only difference is that the direction bit is reversed and that there is only one data bit per pin. On the SuperIO level the logical device is another one. On a chip level we do not have a manufacturer ID to check and also no revision. Signed-off-by: Henning Schild --- drivers/gpio/Kconfig | 3 +- drivers/gpio/gpio-f7188x.c | 106 ++++++++++++++++++++++++++++--------- 2 files changed, 83 insertions(+), 26 deletions(-) diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 0642f579196f..3f64345fe40b 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -874,10 +874,11 @@ config GPIO_104_IDI_48 module parameter. config GPIO_F7188X - tristate "F71869, F71869A, F71882FG, F71889F and F81866 GPIO support" + tristate "Fintek and Nuvoton Super-I/O GPIO support" help This option enables support for GPIOs found on Fintek Super-I/O chips F71869, F71869A, F71882FG, F71889F and F81866. + As well as Nuvoton Super-I/O chip NCT6116D. To compile this driver as a module, choose M here: the module will be called f7188x-gpio. diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c index 18a3147f5a42..b73bf28bf347 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* - * GPIO driver for Fintek Super-I/O F71869, F71869A, F71882, F71889 and F81866 + * GPIO driver for Fintek and Nuvoton Super-I/O chips * * Copyright (C) 2010-2013 LaCie * @@ -21,23 +21,36 @@ */ #define SIO_LDSEL 0x07 /* Logical device select */ #define SIO_DEVID 0x20 /* Device ID (2 bytes) */ -#define SIO_DEVREV 0x22 /* Device revision */ -#define SIO_MANID 0x23 /* Fintek ID (2 bytes) */ -#define SIO_LD_GPIO 0x06 /* GPIO logical device */ #define SIO_UNLOCK_KEY 0x87 /* Key to enable Super-I/O */ #define SIO_LOCK_KEY 0xAA /* Key to disable Super-I/O */ -#define SIO_FINTEK_ID 0x1934 /* Manufacturer ID */ +/* + * Fintek devices. + */ +#define SIO_FINTEK_DEVREV 0x22 /* Fintek Device revision */ +#define SIO_FINTEK_MANID 0x23 /* Fintek ID (2 bytes) */ + +#define SIO_FINTEK_ID 0x1934 /* Manufacturer ID */ + #define SIO_F71869_ID 0x0814 /* F71869 chipset ID */ #define SIO_F71869A_ID 0x1007 /* F71869A chipset ID */ #define SIO_F71882_ID 0x0541 /* F71882 chipset ID */ #define SIO_F71889_ID 0x0909 /* F71889 chipset ID */ #define SIO_F71889A_ID 0x1005 /* F71889A chipset ID */ #define SIO_F81866_ID 0x1010 /* F81866 chipset ID */ -#define SIO_F81804_ID 0x1502 /* F81804 chipset ID, same for f81966 */ +#define SIO_F81804_ID 0x1502 /* F81804 chipset ID, same for F81966 */ #define SIO_F81865_ID 0x0704 /* F81865 chipset ID */ +#define SIO_LD_GPIO_FINTEK 0x06 /* GPIO logical device */ + +/* + * Nuvoton devices. + */ +#define SIO_NCT6116D_ID 0xD283 /* NCT6116D chipset ID */ + +#define SIO_LD_GPIO_NUVOTON 0x07 /* GPIO logical device */ + enum chips { f71869, @@ -48,6 +61,7 @@ enum chips { f81866, f81804, f81865, + nct6116d, }; static const char * const f7188x_names[] = { @@ -59,10 +73,12 @@ static const char * const f7188x_names[] = { "f81866", "f81804", "f81865", + "nct6116d", }; struct f7188x_sio { int addr; + int device; enum chips type; }; @@ -170,6 +186,9 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset, /* Output mode register (0:open drain 1:push-pull). */ #define gpio_out_mode(base) (base + 3) +#define gpio_dir_invert(type) ((type) == nct6116d) +#define gpio_data_single(type) ((type) == nct6116d) + static struct f7188x_gpio_bank f71869_gpio_bank[] = { F7188X_GPIO_BANK(0, 6, 0xF0), F7188X_GPIO_BANK(10, 8, 0xE0), @@ -254,6 +273,17 @@ static struct f7188x_gpio_bank f81865_gpio_bank[] = { F7188X_GPIO_BANK(60, 5, 0x90), }; +static struct f7188x_gpio_bank nct6116d_gpio_bank[] = { + F7188X_GPIO_BANK(0, 8, 0xE0), + F7188X_GPIO_BANK(10, 8, 0xE4), + F7188X_GPIO_BANK(20, 8, 0xE8), + F7188X_GPIO_BANK(30, 8, 0xEC), + F7188X_GPIO_BANK(40, 8, 0xF0), + F7188X_GPIO_BANK(50, 8, 0xF4), + F7188X_GPIO_BANK(60, 8, 0xF8), + F7188X_GPIO_BANK(70, 1, 0xFC), +}; + static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) { int err; @@ -264,13 +294,16 @@ static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) err = superio_enter(sio->addr); if (err) return err; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); superio_exit(sio->addr); - if (dir & 1 << offset) + if (gpio_dir_invert(sio->type)) + dir = ~dir; + + if (dir & BIT(offset)) return GPIO_LINE_DIRECTION_OUT; return GPIO_LINE_DIRECTION_IN; @@ -286,10 +319,14 @@ static int f7188x_gpio_direction_in(struct gpio_chip *chip, unsigned offset) err = superio_enter(sio->addr); if (err) return err; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); - dir &= ~BIT(offset); + + if (gpio_dir_invert(sio->type)) + dir |= BIT(offset); + else + dir &= ~BIT(offset); superio_outb(sio->addr, gpio_dir(bank->regbase), dir); superio_exit(sio->addr); @@ -307,11 +344,11 @@ static int f7188x_gpio_get(struct gpio_chip *chip, unsigned offset) err = superio_enter(sio->addr); if (err) return err; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); dir = !!(dir & BIT(offset)); - if (dir) + if (gpio_data_single(sio->type) || dir) data = superio_inb(sio->addr, gpio_data_out(bank->regbase)); else data = superio_inb(sio->addr, gpio_data_in(bank->regbase)); @@ -332,7 +369,7 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip, err = superio_enter(sio->addr); if (err) return err; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase)); if (value) @@ -342,7 +379,10 @@ static int f7188x_gpio_direction_out(struct gpio_chip *chip, superio_outb(sio->addr, gpio_data_out(bank->regbase), data_out); dir = superio_inb(sio->addr, gpio_dir(bank->regbase)); - dir |= BIT(offset); + if (gpio_dir_invert(sio->type)) + dir &= ~BIT(offset); + else + dir |= BIT(offset); superio_outb(sio->addr, gpio_dir(bank->regbase), dir); superio_exit(sio->addr); @@ -360,7 +400,7 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value) err = superio_enter(sio->addr); if (err) return; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); data_out = superio_inb(sio->addr, gpio_data_out(bank->regbase)); if (value) @@ -388,7 +428,7 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset, err = superio_enter(sio->addr); if (err) return err; - superio_select(sio->addr, SIO_LD_GPIO); + superio_select(sio->addr, sio->device); data = superio_inb(sio->addr, gpio_out_mode(bank->regbase)); if (param == PIN_CONFIG_DRIVE_OPEN_DRAIN) @@ -449,6 +489,10 @@ static int f7188x_gpio_probe(struct platform_device *pdev) data->nr_bank = ARRAY_SIZE(f81865_gpio_bank); data->bank = f81865_gpio_bank; break; + case nct6116d: + data->nr_bank = ARRAY_SIZE(nct6116d_gpio_bank); + data->bank = nct6116d_gpio_bank; + break; default: return -ENODEV; } @@ -479,18 +523,15 @@ static int __init f7188x_find(int addr, struct f7188x_sio *sio) { int err; u16 devid; + u16 manid; err = superio_enter(addr); if (err) return err; err = -ENODEV; - devid = superio_inw(addr, SIO_MANID); - if (devid != SIO_FINTEK_ID) { - pr_debug(DRVNAME ": Not a Fintek device at 0x%08x\n", addr); - goto err; - } + sio->device = SIO_LD_GPIO_FINTEK; devid = superio_inw(addr, SIO_DEVID); switch (devid) { case SIO_F71869_ID: @@ -517,17 +558,32 @@ static int __init f7188x_find(int addr, struct f7188x_sio *sio) case SIO_F81865_ID: sio->type = f81865; break; + case SIO_NCT6116D_ID: + sio->device = SIO_LD_GPIO_NUVOTON; + sio->type = nct6116d; + break; default: - pr_info(DRVNAME ": Unsupported Fintek device 0x%04x\n", devid); + pr_info(DRVNAME ": Unsupported device 0x%04x\n", devid); goto err; } + + /* double check manufacturer where possible */ + if (sio->type != nct6116d) { + manid = superio_inw(addr, SIO_FINTEK_MANID); + if (manid != SIO_FINTEK_ID) { + pr_debug(DRVNAME ": Not a Fintek device at 0x%08x\n", addr); + goto err; + } + } + sio->addr = addr; err = 0; - pr_info(DRVNAME ": Found %s at %#x, revision %d\n", + pr_info(DRVNAME ": Found %s at %#x\n", f7188x_names[sio->type], - (unsigned int) addr, - (int) superio_inb(addr, SIO_DEVREV)); + (unsigned int)addr); + if (sio->type != nct6116d) + pr_info(DRVNAME ": revision %d\n", superio_inb(addr, SIO_FINTEK_DEVREV)); err: superio_exit(addr); From patchwork Wed Aug 24 14:03:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henning Schild X-Patchwork-Id: 599852 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAAC2C00140 for ; Wed, 24 Aug 2022 14:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238006AbiHXOEE (ORCPT ); Wed, 24 Aug 2022 10:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237109AbiHXOED (ORCPT ); Wed, 24 Aug 2022 10:04:03 -0400 Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130077.outbound.protection.outlook.com [40.107.13.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C019C86047; Wed, 24 Aug 2022 07:04:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WYb1K/R0mn6JQYuI1/Rcyeh4pFnkDlUYmAdtzNCEIwC05jRPyueDNrDJ/Az8TR2HQKLYRaMy8ZkZqaGiQJ6qJm0qjiYSL4AttG3lOlSLsMaYoTNqR66ys9B3ztxSYYIUf/V8U/ManhlCxyDgOYyVyCLkmOz/SUZJ2T2fBoGcZD54oHGOPSuq8jf6yw4pytQmEgAmlTfi1AbOkri5SONCkLpW7tTAOaFMJ0WylN3707VtavGAONKrGx/+IEx+5vEbgS1FMnsIT5uVsUo87+qVx/kJ3dtv8iE73wx4sZu/xZ5qp5EmeP/Str3iZa/3x0U+xwVpuWb4RSb7ZddBMkiTQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NAdhPMocuYIFDzOXVOIhxiwfy7Lh+/B542eZ9Qc3eiU=; b=Se1DUSVBqxQIC6oknV5y7nov+ua3YEEqg6DnhJZgARAmI9oHH17jp2mSWIkJ53mN3MO1DceIPl+APoNDeDSIxCNKzrwVv1vRIPGDHFs2ZsqxqpGB8AoKHYZ56I1J5oUAhMY5fzqahZlBWtuNtuiUw9amc8NTIReenizRz8JZCZYoQtAkt401p/EytLbXIhwYprEZjQDE4a99VOTvHCP5jNd8WIS7J3buhU7dMZw832M7TgN+oRfYLtCRxs3Gy4ZN3fYl5K0PDcjbfdEwwD3uvxCW9R5JX/bVvZ82KQERPop8geExrHVXyVesZBXGOU1+yY4MWDywmVwWZH5YQXASeg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 194.138.21.75) smtp.rcpttodomain=linaro.org smtp.mailfrom=siemens.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NAdhPMocuYIFDzOXVOIhxiwfy7Lh+/B542eZ9Qc3eiU=; b=jsC0OjzRzMEEwgg9o//BB/AsNbMpkAuoAz0qhldKKeqGeq/wEj2irXHFLa9JD6JFpofnHSgu0p6dERkWhDtT6bWeqKJ43cKdAv5ar+8ZX3w4YT+9ZcVKwB+nZ3NcYwGszi4afnaCuSUqk8L8pH6xAmgBPvr9QD3SNuiFy1XaS+nnoeeYCuRtln5H86WvOAtEHZQxJ/N1FWrlx5XCPu/yy1plJh74cEXAR17HpKBliRtxcWKfTXft54+ve+7zjbFzRrYs7CuXNAkl3bbgrshk8VhDaiaIMYR3EWRJsXbLIIPJMYHw6UFIq+KJ6KTF80N1xUjkAVHtxXD1+SpgzG4wiA== Received: from GV3P280CA0052.SWEP280.PROD.OUTLOOK.COM (2603:10a6:150:9::6) by GV1PR10MB6010.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:150:5d::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.16; Wed, 24 Aug 2022 14:03:59 +0000 Received: from HE1EUR01FT025.eop-EUR01.prod.protection.outlook.com (2603:10a6:150:9:cafe::7f) by GV3P280CA0052.outlook.office365.com (2603:10a6:150:9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.16 via Frontend Transport; Wed, 24 Aug 2022 14:03:59 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 194.138.21.75) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=siemens.com; Received-SPF: Fail (protection.outlook.com: domain of siemens.com does not designate 194.138.21.75 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.75; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.75) by HE1EUR01FT025.mail.protection.outlook.com (10.152.0.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:03:58 +0000 Received: from DEMCHDC89XA.ad011.siemens.net (139.25.226.103) by DEMCHDC8VRA.ad011.siemens.net (194.138.21.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Wed, 24 Aug 2022 16:03:58 +0200 Received: from md1za8fc.ad001.siemens.net (139.25.0.80) by DEMCHDC89XA.ad011.siemens.net (139.25.226.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Wed, 24 Aug 2022 16:03:58 +0200 From: Henning Schild To: Linus Walleij , Bartosz Golaszewski , Pavel Machek , Hans de Goede , Mark Gross , Andy Shevchenko , Lee Jones , , , , CC: Sheng-Yuan Huang , Tasanakorn Phaipool , , Henning Schild Subject: [PATCH v5 2/5] gpio-f7188x: use unique labels for banks/chips Date: Wed, 24 Aug 2022 16:03:44 +0200 Message-ID: <20220824140347.1842-3-henning.schild@siemens.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824140347.1842-1-henning.schild@siemens.com> References: <20220824140347.1842-1-henning.schild@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.80] X-ClientProxiedBy: DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) To DEMCHDC89XA.ad011.siemens.net (139.25.226.103) X-TM-AS-Product-Ver: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-AS-Result: No-10--9.309700-8.000000 X-TMASE-MatchedRID: D+XfgODzmzordWdGoKfUymdUGQPHutoBOT0VlJjRfnH27WtDgGBc8tGO cAfHKa6uB2QWi8BF5ShpRezoWC5XLXFnQp1moK9xjO5iMKbqS0z7XyLXPDdLs6chFrOB9kanCy8 7Unb7MRibKItl61J/yZ+inTK0bC9eKrauXd3MZDVENTKcqcJOap8S2Wughs08CwBu4RolLn4r79 Ggi/FvwJ6EY745USl+ X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--9.309700-8.000000 X-TMASE-Version: SMEX-14.0.0.3080-8.6.1018-26680.007 X-TM-SNTS-SMTP: 11880E53CE8DC5DC6E99F7093A5821D6EE537A25DA6431365C0FCD49B2BEE4D82000:8 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4bcaf5a5-3414-4414-f6eb-08da85d97db1 X-MS-TrafficTypeDiagnostic: GV1PR10MB6010:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eETL5gGlDCkrDBph7ywbD0qY39OrtUeNl/ILrURgA4RkY+DRwHoyQxqxTZoI5uV8TJSCY9m7lNWfk7FR3MkVFNh12E1Ke/jZ6XCKW3RptBCNK3ghsTdlX3Er4VPoris2h60PfwEymdzwlQ5EOPeMkDdQFnvTGReNBpRVtOFEFd/LYWOHFQ8LTdl5Jl6g+nrg8Lmp+fh7ApqjjDiVWru6I5jfVUQ2jeGrt93/2RVv8KSI0CU3hB4c6RvYjRvb/vQ3Ae20bRcF/2ucRcTASEzNgt7Qth4BoxRBQhaKN49lnmTfNuZi8raWLGYTtZXys+KWcIMCtvfGOu7LuPTD8al1e46YRGli+8Ik61KqPrGzfL1Zk9ih6rrrA1/Dr/c1SwNSlsynRJPcZw/TwwOrVoA2Z83Ywt8bMtYY1/9T1yJ2slH75fBZHVgkRbFNRphWof0wC2/UKmuDWGJgaEP0wUYGwJusdLs5Wh3yb9iipT3GVYKQdv7x1Cx/kCz8lBumRBN+C6PGowaaQXAE8+0jTw3eVbM4FPpm44E6GcR0Lw+s3Ti/YS9pNJ+/qDxMFpFRESKw6oh+0S+z25HTWoLliP2jBZsjSkoaeJNwutTi+zdbdi9US2eaKZ6dIvj1VHG5yq0aqML1m2nwMb1hKnQ+wUkibypQB/llCrHwVvPb9/YYa5GXtb9DZqzzZBhKiwJ45stDVpoN+yfbYe7odlFmxYmmPLeNC1A460j1aRZDOxExHPS+6GZp0lthVZ8DkZbRY81nrdWmX1wRhqrjp38BpPG01GZ3XnruR+RTeVZJHWF3l02ldHLOT7WiUw2O8ibLLvjansjjl+4ya1G6X1cAMnmxSQGxGgdP6YasYjSYbnHi9esSf+pYIoOl/gTVOQ1bJ3+8W+8CNXwZL/zlnKLaagTkCw== X-Forefront-Antispam-Report: CIP:194.138.21.75; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(396003)(136003)(39860400002)(346002)(376002)(40470700004)(46966006)(36840700001)(921005)(5660300002)(6666004)(8936002)(86362001)(2906002)(82960400001)(44832011)(36756003)(26005)(40460700003)(478600001)(110136005)(356005)(54906003)(7416002)(81166007)(316002)(82740400003)(40480700001)(34020700004)(41300700001)(36860700001)(4326008)(336012)(16526019)(83380400001)(186003)(956004)(1076003)(2616005)(70586007)(107886003)(8676002)(82310400005)(47076005)(70206006)(83996005)(36900700001)(2101003); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 14:03:58.8620 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bcaf5a5-3414-4414-f6eb-08da85d97db1 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.75]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT025.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR10MB6010 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org So that drivers building on top can find those pins with GPIO_LOOKUP helpers. Reviewed-by: Andy Shevchenko Reviewed-by: Linus Walleij Acked-by: Simon Guinot Signed-off-by: Henning Schild --- drivers/gpio/gpio-f7188x.c | 138 ++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 69 deletions(-) diff --git a/drivers/gpio/gpio-f7188x.c b/drivers/gpio/gpio-f7188x.c index b73bf28bf347..565840586150 100644 --- a/drivers/gpio/gpio-f7188x.c +++ b/drivers/gpio/gpio-f7188x.c @@ -162,10 +162,10 @@ static void f7188x_gpio_set(struct gpio_chip *chip, unsigned offset, int value); static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset, unsigned long config); -#define F7188X_GPIO_BANK(_base, _ngpio, _regbase) \ +#define F7188X_GPIO_BANK(_base, _ngpio, _regbase, _label) \ { \ .chip = { \ - .label = DRVNAME, \ + .label = _label, \ .owner = THIS_MODULE, \ .get_direction = f7188x_gpio_get_direction, \ .direction_input = f7188x_gpio_direction_in, \ @@ -190,98 +190,98 @@ static int f7188x_gpio_set_config(struct gpio_chip *chip, unsigned offset, #define gpio_data_single(type) ((type) == nct6116d) static struct f7188x_gpio_bank f71869_gpio_bank[] = { - F7188X_GPIO_BANK(0, 6, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 5, 0xA0), - F7188X_GPIO_BANK(60, 6, 0x90), + F7188X_GPIO_BANK(0, 6, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 5, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 6, 0x90, DRVNAME "-6"), }; static struct f7188x_gpio_bank f71869a_gpio_bank[] = { - F7188X_GPIO_BANK(0, 6, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 5, 0xA0), - F7188X_GPIO_BANK(60, 8, 0x90), - F7188X_GPIO_BANK(70, 8, 0x80), + F7188X_GPIO_BANK(0, 6, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 5, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 8, 0x90, DRVNAME "-6"), + F7188X_GPIO_BANK(70, 8, 0x80, DRVNAME "-7"), }; static struct f7188x_gpio_bank f71882_gpio_bank[] = { - F7188X_GPIO_BANK(0, 8, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 4, 0xC0), - F7188X_GPIO_BANK(40, 4, 0xB0), + F7188X_GPIO_BANK(0, 8, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 4, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 4, 0xB0, DRVNAME "-4"), }; static struct f7188x_gpio_bank f71889a_gpio_bank[] = { - F7188X_GPIO_BANK(0, 7, 0xF0), - F7188X_GPIO_BANK(10, 7, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 5, 0xA0), - F7188X_GPIO_BANK(60, 8, 0x90), - F7188X_GPIO_BANK(70, 8, 0x80), + F7188X_GPIO_BANK(0, 7, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 7, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 5, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 8, 0x90, DRVNAME "-6"), + F7188X_GPIO_BANK(70, 8, 0x80, DRVNAME "-7"), }; static struct f7188x_gpio_bank f71889_gpio_bank[] = { - F7188X_GPIO_BANK(0, 7, 0xF0), - F7188X_GPIO_BANK(10, 7, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 5, 0xA0), - F7188X_GPIO_BANK(60, 8, 0x90), - F7188X_GPIO_BANK(70, 8, 0x80), + F7188X_GPIO_BANK(0, 7, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 7, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 5, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 8, 0x90, DRVNAME "-6"), + F7188X_GPIO_BANK(70, 8, 0x80, DRVNAME "-7"), }; static struct f7188x_gpio_bank f81866_gpio_bank[] = { - F7188X_GPIO_BANK(0, 8, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 8, 0xA0), - F7188X_GPIO_BANK(60, 8, 0x90), - F7188X_GPIO_BANK(70, 8, 0x80), - F7188X_GPIO_BANK(80, 8, 0x88), + F7188X_GPIO_BANK(0, 8, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 8, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 8, 0x90, DRVNAME "-6"), + F7188X_GPIO_BANK(70, 8, 0x80, DRVNAME "-7"), + F7188X_GPIO_BANK(80, 8, 0x88, DRVNAME "-8"), }; static struct f7188x_gpio_bank f81804_gpio_bank[] = { - F7188X_GPIO_BANK(0, 8, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(50, 8, 0xA0), - F7188X_GPIO_BANK(60, 8, 0x90), - F7188X_GPIO_BANK(70, 8, 0x80), - F7188X_GPIO_BANK(90, 8, 0x98), + F7188X_GPIO_BANK(0, 8, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(50, 8, 0xA0, DRVNAME "-3"), + F7188X_GPIO_BANK(60, 8, 0x90, DRVNAME "-4"), + F7188X_GPIO_BANK(70, 8, 0x80, DRVNAME "-5"), + F7188X_GPIO_BANK(90, 8, 0x98, DRVNAME "-6"), }; static struct f7188x_gpio_bank f81865_gpio_bank[] = { - F7188X_GPIO_BANK(0, 8, 0xF0), - F7188X_GPIO_BANK(10, 8, 0xE0), - F7188X_GPIO_BANK(20, 8, 0xD0), - F7188X_GPIO_BANK(30, 8, 0xC0), - F7188X_GPIO_BANK(40, 8, 0xB0), - F7188X_GPIO_BANK(50, 8, 0xA0), - F7188X_GPIO_BANK(60, 5, 0x90), + F7188X_GPIO_BANK(0, 8, 0xF0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE0, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xD0, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xC0, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xB0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 8, 0xA0, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 5, 0x90, DRVNAME "-6"), }; static struct f7188x_gpio_bank nct6116d_gpio_bank[] = { - F7188X_GPIO_BANK(0, 8, 0xE0), - F7188X_GPIO_BANK(10, 8, 0xE4), - F7188X_GPIO_BANK(20, 8, 0xE8), - F7188X_GPIO_BANK(30, 8, 0xEC), - F7188X_GPIO_BANK(40, 8, 0xF0), - F7188X_GPIO_BANK(50, 8, 0xF4), - F7188X_GPIO_BANK(60, 8, 0xF8), - F7188X_GPIO_BANK(70, 1, 0xFC), + F7188X_GPIO_BANK(0, 8, 0xE0, DRVNAME "-0"), + F7188X_GPIO_BANK(10, 8, 0xE4, DRVNAME "-1"), + F7188X_GPIO_BANK(20, 8, 0xE8, DRVNAME "-2"), + F7188X_GPIO_BANK(30, 8, 0xEC, DRVNAME "-3"), + F7188X_GPIO_BANK(40, 8, 0xF0, DRVNAME "-4"), + F7188X_GPIO_BANK(50, 8, 0xF4, DRVNAME "-5"), + F7188X_GPIO_BANK(60, 8, 0xF8, DRVNAME "-6"), + F7188X_GPIO_BANK(70, 1, 0xFC, DRVNAME "-7"), }; static int f7188x_gpio_get_direction(struct gpio_chip *chip, unsigned offset) From patchwork Wed Aug 24 14:03:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henning Schild X-Patchwork-Id: 599850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57A5AC3F6B0 for ; Wed, 24 Aug 2022 14:04:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238809AbiHXOET (ORCPT ); Wed, 24 Aug 2022 10:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238483AbiHXOEQ (ORCPT ); Wed, 24 Aug 2022 10:04:16 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2078.outbound.protection.outlook.com [40.107.21.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9227096FD8; Wed, 24 Aug 2022 07:04:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VjPi+DFzLk+RIs2TYOEzKdTjpEQPLtPMMDXkf6kXaaykmMPE9ewc838vgK9x031UmXg1TNxEuerNGLJ/VsAeZ/GfscYx/frG6B96RO/Yx2Q6Ne1iyV7/iHN+2rgIbbcnZF9yeKka+jcc5Xg7WrIAsReQ+TlcdMgwoKYNa0hAAVNcbrXv2tPvjHLBFiSzaYR3AGKqLAPX/5RHKZq3rByfF2AJ0X3gqbzXaReeP428A9wcddcSQXnZO789tFx2/wGpU1cDIsgncuuLW75XNNlKzkiwlRfHzb73eopwLst+/hsUK6jITGgM3IvfujGzbRzuof0SAttIJThXpEowuQsE/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T+2bViNTZBcxo0DYtI+egJrMHPDUebydfxh/wJvFVUo=; b=HqkwFsZTLPgouZn1jh/Acmq6xTeWOzGm82GL84vV321kKycQOYLzQaRCaAk5swZ/+Z0ePIZoaAFkwdKEqegPmHVO8QOhw3eFJmJkifcEHN+pgKTYtOOl25GBGdphWkA9tYVQQA8RmVQSIBYEKZM5dWgKYbcRpOYlpjB0LrHn0H02+iM6gbJZGtFHJ9e/ylcf8EwXul+HthV0eFpQJg3nJnaLTunvMbfgyc05TDZzBNJKGCq7SY+zxCDhHcgjWlKLDiHzXxkcSZj3ordkxWjibRWRVm/PTDjoIef48F7T24TGjWKIjcpP38FnuMzuUzzPxpd+y+8j7TqNYPRNfj5TLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 194.138.21.74) smtp.rcpttodomain=linaro.org smtp.mailfrom=siemens.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T+2bViNTZBcxo0DYtI+egJrMHPDUebydfxh/wJvFVUo=; b=J50nK9aOucw4EWy+DO6ndLVR/4HO51NH8j0SzDKWXGxIsoYWsYGkEKrv2I/dyn8sN6HxiGRhepnCeYwj2numZQ0Vw5yLaIflI/DWg6gu/lp1d9WdZUBmKn9oOUuMMTuQ+tnMuhWa7JbHRYlIBWLeWpHx+SVuA2MzYRJdRQbym54sEJ1ScKp835RCauNDv1l7VIBTpJCDcDYQA6vKIDQvbTtyhSteVs6xxjJDqPqX9utaAUfK0dogWv8wsBydrNr/kZDCIAspp/4jppkNRd1V0ga9fq1UFgRCTPiuTx3BJtkWverI6Lyz45b4EgP0H6KvvSCjkYc+XLp4mRUrtx3QNA== Received: from DB6P191CA0017.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::27) by AM9PR10MB4197.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:1ff::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15; Wed, 24 Aug 2022 14:04:12 +0000 Received: from DB5EUR01FT085.eop-EUR01.prod.protection.outlook.com (2603:10a6:6:28:cafe::e0) by DB6P191CA0017.outlook.office365.com (2603:10a6:6:28::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 194.138.21.74) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=siemens.com; Received-SPF: Fail (protection.outlook.com: domain of siemens.com does not designate 194.138.21.74 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.74; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.74) by DB5EUR01FT085.mail.protection.outlook.com (10.152.5.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:04:11 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VQA.ad011.siemens.net (194.138.21.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Wed, 24 Aug 2022 16:04:11 +0200 Received: from md1za8fc.ad001.siemens.net (139.25.0.80) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Wed, 24 Aug 2022 16:04:09 +0200 From: Henning Schild To: Linus Walleij , Bartosz Golaszewski , Pavel Machek , Hans de Goede , Mark Gross , Andy Shevchenko , Lee Jones , , , , CC: Sheng-Yuan Huang , Tasanakorn Phaipool , , Henning Schild Subject: [PATCH v5 3/5] leds: simatic-ipc-leds-gpio: add new model 227G Date: Wed, 24 Aug 2022 16:03:45 +0200 Message-ID: <20220824140347.1842-4-henning.schild@siemens.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824140347.1842-1-henning.schild@siemens.com> References: <20220824140347.1842-1-henning.schild@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.80] X-ClientProxiedBy: DEMCHDC89XA.ad011.siemens.net (139.25.226.103) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 05109a20-0f60-45d1-f2d1-08da85d9857e X-MS-TrafficTypeDiagnostic: AM9PR10MB4197:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yuMLARvgakdg0WHhY+myRmglHNOruygRrruQ+U3HHB7DIS5P3OC5zBdVSEaImT7XKkl/tMgkxfcfrjYidt/jFkdCbk0bjo1Lo1aUBeJzoXBR92+iEECYE68eJ162w2p9tUs1C+dcFdfpk6u7xGq6tcs6lwIr/gg+8bZn85hP/HgGRADBrgjphtpieEHS65ni4QvROwUe4htmFtQT4vnbIAhbpO05biWHrECC9M6IOmuJ0AGRLgAH/2M/rCLR+LTepED7pG8y6bUt9HhlECKS2q8pApO2hqXYMOrr/L+Lg1D7MEMrhLisk9trdWhH9dHvJDzV+32TCGBCP0MAExkchlaCKcr9V3jTX/0r1birFD7ZJ21Cr+AYIznQHoHiqjRrVbxB7SfpIh/KislmEh0ickMwVKAwIcl+b+sRu443hJLwl+lTsRE+620Dpal6YYjltkOBoPQQm2aeWL9sKzLsj5blDjvBR3RzFhXRppk60a7e8NdABTi8Gw+cPcJQMbFbXpJ31+7jNWc4rg+qiOC1cDGYwqYEOPfc5Zh6m+tKqq/dv9Ii6zgx1DkT+BOnYMPX92eHhJMAEG0ZDdXhp9IazSy/JRCWAxeJ27k9dP7shAK5voGY3QkhxmOueSsfCz8bqZ/TsC6PZ9XKG0mD8wDz9OVEAg13UbpsmXDIQudkRRMTG4h1bOX/yiyQ1PR76HYxVCiHuh4dAaJSdFql9CxphIQeQLcGI1W8FORXw8YFqrpmiShVc2QrvbIyg/V3f1AHxYOXaPkYzLrG0M/p3j3fhbZOZcS5SU0VwYMGPSbgfpRy16+byD11Pn1EU47cLytNsICDGN2iq72mjJhCpTNk9egsPP22fxWltq+qnLgJlx0C/7WodudIfU+ig+W8nMpx X-Forefront-Antispam-Report: CIP:194.138.21.74; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:hybrid.siemens.com; CAT:NONE; SFS:(13230016)(4636009)(376002)(136003)(39860400002)(396003)(346002)(46966006)(36840700001)(40470700004)(8676002)(4326008)(316002)(70206006)(54906003)(110136005)(82310400005)(40480700001)(70586007)(40460700003)(44832011)(8936002)(7416002)(5660300002)(2906002)(82740400003)(36860700001)(34020700004)(36756003)(86362001)(82960400001)(356005)(921005)(7596003)(7636003)(41300700001)(26005)(6666004)(107886003)(478600001)(47076005)(83380400001)(956004)(186003)(16526019)(2616005)(1076003)(336012)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 14:04:11.9808 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05109a20-0f60-45d1-f2d1-08da85d9857e X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.74]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT085.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB4197 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This adds support of the Siemens Simatic IPC227G. Its LEDs are connected to GPIO pins provided by the gpio-f7188x module. We make sure that gets loaded, if not enabled in the kernel config no LED support will be available. Reviewed-by: Andy Shevchenko Reviewed-by: Hans de Goede Signed-off-by: Henning Schild --- drivers/leds/simple/simatic-ipc-leds-gpio.c | 42 ++++++++++++++++--- drivers/platform/x86/simatic-ipc.c | 4 +- .../platform_data/x86/simatic-ipc-base.h | 1 + include/linux/platform_data/x86/simatic-ipc.h | 1 + 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio.c b/drivers/leds/simple/simatic-ipc-leds-gpio.c index 4c9e663a90ba..0d73dcbeec2d 100644 --- a/drivers/leds/simple/simatic-ipc-leds-gpio.c +++ b/drivers/leds/simple/simatic-ipc-leds-gpio.c @@ -13,28 +13,45 @@ #include #include #include +#include -static struct gpiod_lookup_table simatic_ipc_led_gpio_table = { +struct gpiod_lookup_table *simatic_ipc_led_gpio_table; + +static struct gpiod_lookup_table simatic_ipc_led_gpio_table_127e = { .dev_id = "leds-gpio", .table = { - GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 51, NULL, 0, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 52, NULL, 1, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 53, NULL, 2, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 57, NULL, 3, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 58, NULL, 4, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 60, NULL, 5, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 51, NULL, 0, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 56, NULL, 6, GPIO_ACTIVE_LOW), GPIO_LOOKUP_IDX("apollolake-pinctrl.0", 59, NULL, 7, GPIO_ACTIVE_HIGH), }, }; +static struct gpiod_lookup_table simatic_ipc_led_gpio_table_227g = { + .dev_id = "leds-gpio", + .table = { + GPIO_LOOKUP_IDX("gpio-f7188x-2", 0, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-2", 1, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-2", 2, NULL, 2, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-2", 3, NULL, 3, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-2", 4, NULL, 4, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-2", 5, NULL, 5, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("gpio-f7188x-3", 6, NULL, 6, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio-f7188x-3", 7, NULL, 7, GPIO_ACTIVE_HIGH), + } +}; + static const struct gpio_led simatic_ipc_gpio_leds[] = { - { .name = "green:" LED_FUNCTION_STATUS "-3" }, { .name = "red:" LED_FUNCTION_STATUS "-1" }, { .name = "green:" LED_FUNCTION_STATUS "-1" }, { .name = "red:" LED_FUNCTION_STATUS "-2" }, { .name = "green:" LED_FUNCTION_STATUS "-2" }, { .name = "red:" LED_FUNCTION_STATUS "-3" }, + { .name = "green:" LED_FUNCTION_STATUS "-3" }, }; static const struct gpio_led_platform_data simatic_ipc_gpio_leds_pdata = { @@ -46,7 +63,7 @@ static struct platform_device *simatic_leds_pdev; static int simatic_ipc_leds_gpio_remove(struct platform_device *pdev) { - gpiod_remove_lookup_table(&simatic_ipc_led_gpio_table); + gpiod_remove_lookup_table(simatic_ipc_led_gpio_table); platform_device_unregister(simatic_leds_pdev); return 0; @@ -54,10 +71,25 @@ static int simatic_ipc_leds_gpio_remove(struct platform_device *pdev) static int simatic_ipc_leds_gpio_probe(struct platform_device *pdev) { + const struct simatic_ipc_platform *plat = pdev->dev.platform_data; struct gpio_desc *gpiod; int err; - gpiod_add_lookup_table(&simatic_ipc_led_gpio_table); + switch (plat->devmode) { + case SIMATIC_IPC_DEVICE_127E: + simatic_ipc_led_gpio_table = &simatic_ipc_led_gpio_table_127e; + break; + case SIMATIC_IPC_DEVICE_227G: + if (!IS_ENABLED(CONFIG_GPIO_F7188X)) + return -ENODEV; + request_module("gpio-f7188x"); + simatic_ipc_led_gpio_table = &simatic_ipc_led_gpio_table_227g; + break; + default: + return -ENODEV; + } + + gpiod_add_lookup_table(simatic_ipc_led_gpio_table); simatic_leds_pdev = platform_device_register_resndata(NULL, "leds-gpio", PLATFORM_DEVID_NONE, NULL, 0, &simatic_ipc_gpio_leds_pdata, diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c index ca3647b751d5..1825ef21a86d 100644 --- a/drivers/platform/x86/simatic-ipc.c +++ b/drivers/platform/x86/simatic-ipc.c @@ -41,6 +41,7 @@ static struct { {SIMATIC_IPC_IPC127E, SIMATIC_IPC_DEVICE_127E, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC227D, SIMATIC_IPC_DEVICE_227D, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC227E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_227E}, + {SIMATIC_IPC_IPC227G, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC277E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_227E}, {SIMATIC_IPC_IPC427D, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC427E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_427E}, @@ -65,7 +66,8 @@ static int register_platform_devices(u32 station_id) } if (ledmode != SIMATIC_IPC_DEVICE_NONE) { - if (ledmode == SIMATIC_IPC_DEVICE_127E) + if (ledmode == SIMATIC_IPC_DEVICE_127E || + ledmode == SIMATIC_IPC_DEVICE_227G) pdevname = KBUILD_MODNAME "_leds_gpio"; platform_data.devmode = ledmode; ipc_led_platform_device = diff --git a/include/linux/platform_data/x86/simatic-ipc-base.h b/include/linux/platform_data/x86/simatic-ipc-base.h index 39fefd48cf4d..57d6a10dfc9e 100644 --- a/include/linux/platform_data/x86/simatic-ipc-base.h +++ b/include/linux/platform_data/x86/simatic-ipc-base.h @@ -19,6 +19,7 @@ #define SIMATIC_IPC_DEVICE_427E 2 #define SIMATIC_IPC_DEVICE_127E 3 #define SIMATIC_IPC_DEVICE_227E 4 +#define SIMATIC_IPC_DEVICE_227G 5 struct simatic_ipc_platform { u8 devmode; diff --git a/include/linux/platform_data/x86/simatic-ipc.h b/include/linux/platform_data/x86/simatic-ipc.h index f3b76b39776b..7a2e79f3be0b 100644 --- a/include/linux/platform_data/x86/simatic-ipc.h +++ b/include/linux/platform_data/x86/simatic-ipc.h @@ -31,6 +31,7 @@ enum simatic_ipc_station_ids { SIMATIC_IPC_IPC427E = 0x00000A01, SIMATIC_IPC_IPC477E = 0x00000A02, SIMATIC_IPC_IPC127E = 0x00000D01, + SIMATIC_IPC_IPC227G = 0x00000F01, }; static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len) From patchwork Wed Aug 24 14:03:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henning Schild X-Patchwork-Id: 599851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09233C38145 for ; Wed, 24 Aug 2022 14:04:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238625AbiHXOES (ORCPT ); Wed, 24 Aug 2022 10:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238567AbiHXOEQ (ORCPT ); Wed, 24 Aug 2022 10:04:16 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2079.outbound.protection.outlook.com [40.107.22.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B57897537; Wed, 24 Aug 2022 07:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YcFh/Qpf2YXD+krknC5uAljfcDZBaYSyy53vHLRLgA8SA4HruoV79bZfDjdS+96v+ea8IdQx3xm+JqCwqv4ERF2syoGXyWXzDj2aqmfi2zfhh2Te+GY8I5oQzsMVDkwlPQcvBTh7fD3I0Ov/E3b5ab/MzJLWjqA4G6Sly4M9TZ/kmYYh3fpRcRNHeE3iEstwCxxtiQP1ZVrjs7036VuRu1QJ9aI74bGdEOWOJfzXVXFvE6x3+ovge9ogdQ/suViePeqYeLRLLowiXYVJ7ZEIp7TcFCCKxXO4UYqnDPRbJIvBHmFn9TzvMYbLOpPz9rqPvoUvTvD8hwWqQWcFXaL7wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h/r+FQX2eliYY+NZbS2M+ZUIIXNF73vRJLxYe4sDdtk=; b=mODw8oa3pf1vveJCsidZW/dJwhEyKT5smbqGHL95tjirUozfOTvAowqgzYyqS0E8lNVvrHpk4w3uQvtjQYmon3U4N2jdmIxWECUMvY34qXtakdvrd4NJZ9cmhBvK/z3pZVSWGE/+Y/y7LHqQmBvTb6rTET+XiWlQsrleZ7vLMztI6ZkqeYcfJ/oyWhJm1E5+8zJ5/xYLmq4GrXK2AOIxA0xXwAAyLp5boCki7wrIig39KxmpxNCQt2X9TKnbX7OjTswTWenV9Un1gOaskWiVsR+DTHgn3JakV4ge9PiOoyXFoGiTXHRyhNIXSWA409mxw2Enfc6VbwCOZZNORvkL6Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 194.138.21.75) smtp.rcpttodomain=linaro.org smtp.mailfrom=siemens.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=h/r+FQX2eliYY+NZbS2M+ZUIIXNF73vRJLxYe4sDdtk=; b=ovAi6tWbNcUTKAqp1xkoxzCRShYf5EEiTSaE5JcawhFIuEkC86fLTt0hcRqBj53iBzlGNJA7Xb6PvsNgHAT5uqJqaUEYdYnS42QRZ8PLHi/8Na61TrZ4K+oSpsOQ8ELOAGvhk2fAqTDlMfdOiVXgIgWvcG3uZRV42Webh9+DNzC2zNyBptS1a85Z4Ot5s6HeV6me1EguR+9crWUmLk88kH1XsapqrLGRli/iXM2APUck7OimLBgj3e3v86x3rKzQdDTqTJ5lKK0Itxyzok3F0Xlea87aib0/Y84ok1MPa2UubvzutU7JmJXPV2nXt9DEE4NE9KpqVd0eUifWs4q0gA== Received: from OL1P279CA0054.NORP279.PROD.OUTLOOK.COM (2603:10a6:e10:14::23) by VI1PR10MB2000.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:803:38::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.19; Wed, 24 Aug 2022 14:04:12 +0000 Received: from HE1EUR01FT021.eop-EUR01.prod.protection.outlook.com (2603:10a6:e10:14:cafe::87) by OL1P279CA0054.outlook.office365.com (2603:10a6:e10:14::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 194.138.21.75) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=siemens.com; Received-SPF: Fail (protection.outlook.com: domain of siemens.com does not designate 194.138.21.75 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.75; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.75) by HE1EUR01FT021.mail.protection.outlook.com (10.152.0.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:04:12 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VRA.ad011.siemens.net (194.138.21.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Wed, 24 Aug 2022 16:04:11 +0200 Received: from md1za8fc.ad001.siemens.net (139.25.0.80) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Wed, 24 Aug 2022 16:04:10 +0200 From: Henning Schild To: Linus Walleij , Bartosz Golaszewski , Pavel Machek , Hans de Goede , Mark Gross , Andy Shevchenko , Lee Jones , , , , CC: Sheng-Yuan Huang , Tasanakorn Phaipool , , Henning Schild Subject: [PATCH v5 4/5] platform/x86: simatic-ipc: enable watchdog for 227G Date: Wed, 24 Aug 2022 16:03:46 +0200 Message-ID: <20220824140347.1842-5-henning.schild@siemens.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824140347.1842-1-henning.schild@siemens.com> References: <20220824140347.1842-1-henning.schild@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.80] X-ClientProxiedBy: DEMCHDC89XA.ad011.siemens.net (139.25.226.103) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eb59e553-8f38-4acc-e938-08da85d98595 X-MS-TrafficTypeDiagnostic: VI1PR10MB2000:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: DamgJOvxkJQ0gwYpdDff8PdkLJ9Y5DlBdTyngia4qL73m0KYYqI/BIyEKoHbI/Vi4TtukAEhF5Zj/VHJk5bMtkmZ8Qfs6T1aRpiX0SgFB74G9k8TNvv4XNTN99TlDIgfozu9GagMzamhXq3MLV4zzGMLJnLFW7L2SzCD5KWfCZ7MaOa5qSphiO03PlsC5V4f+JHvw9Jx8u1zwFRdJuQHH94Z8XrNvNQ0lLUI9gTbP2twpX6TzIxalAVuYSwGPFuUFtMTK+zQA+RJV8bFfNOjyoByL3hebYrd1u0sStLNhtOabyP2yxn0jOMrDNQyu4qHXjgLL7eigdf/rpXZeX3EnLGOZuo1BVa53oZm92Yb4Xx8onPBFPaQoQdOpOnFKVq91CGYk0rHAm/yrHgUF4eQj/07EMQsbAYQ6BQL+EQ7p0k2sx3ZHPZlcLQroS0r6i8l5zTQDW+Jc0+ul27I7DPbXKtjwCGXYa6n299fWZAammod9fkxStjUNYBhivHtNakgoJn5wMpm4jJci2HzLpM786UbBsxMpMcyFP2YVjYh2htISn3V6BT2kHrnYxMiSb9gScoHMyC341RWWAMHT2eB7jz+TMhRkYw1Ka6HnRyEs5FbM3hRysP122Of2xujOhvQi4QuoH28sD9jOk99sCJykBc7Fg4G9EsIWSYHoKxLpXkTav23yj8d/oYSWMXCQ4hYE1qQ0KLZlJM+9m9NQuXUECwm0n41+Qxd2pIqb5kgU0YH6NEplJuBsuM7HQvIN28ElzTEGT1JUkr/BcQcd5wtHptX+POy2e8u5k9AO+VR6fFslDaLuP/EGuj6VcBPP33L5l5bCNFKDW9nWD/avm11YRD9a2KZ3h/mBmCk0NR5LvKZkw9N8tWCjcdmc1+msP+pBYrHbWR4rAKLM6pIj9eeTw== X-Forefront-Antispam-Report: CIP:194.138.21.75; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230016)(4636009)(376002)(346002)(136003)(396003)(39860400002)(40470700004)(46966006)(36840700001)(110136005)(36756003)(40460700003)(316002)(54906003)(478600001)(4326008)(8676002)(86362001)(7416002)(41300700001)(82960400001)(921005)(107886003)(6666004)(356005)(8936002)(4744005)(70586007)(5660300002)(70206006)(44832011)(81166007)(2906002)(26005)(186003)(956004)(82310400005)(2616005)(36860700001)(1076003)(16526019)(83380400001)(34020700004)(336012)(82740400003)(47076005)(40480700001)(2101003)(83996005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 14:04:12.0844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eb59e553-8f38-4acc-e938-08da85d98595 X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.75]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: HE1EUR01FT021.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR10MB2000 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org Just load the watchdog module, after having identified that machine. That watchdog module does not have any autoloading support. Reviewed-by: Andy Shevchenko Signed-off-by: Henning Schild --- drivers/platform/x86/simatic-ipc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c index 1825ef21a86d..8dd686d1c9f1 100644 --- a/drivers/platform/x86/simatic-ipc.c +++ b/drivers/platform/x86/simatic-ipc.c @@ -96,6 +96,9 @@ static int register_platform_devices(u32 station_id) ipc_wdt_platform_device->name); } + if (station_id == SIMATIC_IPC_IPC227G) + request_module("w83627hf_wdt"); + if (ledmode == SIMATIC_IPC_DEVICE_NONE && wdtmode == SIMATIC_IPC_DEVICE_NONE) { pr_warn("unsupported IPC detected, station id=%08x\n", From patchwork Wed Aug 24 14:03:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henning Schild X-Patchwork-Id: 600124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 291C6C48BE4 for ; Wed, 24 Aug 2022 14:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238863AbiHXOEU (ORCPT ); Wed, 24 Aug 2022 10:04:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238516AbiHXOEQ (ORCPT ); Wed, 24 Aug 2022 10:04:16 -0400 Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80078.outbound.protection.outlook.com [40.107.8.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3104B97ED8; Wed, 24 Aug 2022 07:04:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gNIGL66POaQirop0pZMBsOORAZBO5u6g3Oo8joRtbNXmqbWP3HwHpPdoE8Vy8tZYosHPGjGuz3zZqbwswLoIWS3XOwpupQt56UVEcUolpUEs+8Y5CCGvKQEkbx7Csg1SXHTkBPLFReLcd9w0mxrP24fllK+7hRduTHWcMVj7ToMR3H1bu6RFVg/biilPTSxcp2s34qNNAgNVjPv/jqYFC0Q8L+zTyR4I8gllZJ4VV1FgGdus6QQj89sO7rlCKhuo8j8Jl7++YxIOiwia4rGDa/sz/809rfuQsdVBRkSm7poiVM+HQOSm6nw25UJl1ySWZCF4Ks/ZueijeE/OU8pW/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=CoeqWO5jn+/1Y3EBaDcSz5dtAsOK/vG3RHWEKr4jE9U=; b=LAROHh8yR/8PZUlb/bu4o5a4nTGHv4FVyFFtEBJymeelD7bZmQIEUmXFoZ8GgIHAfYsNwpXES/Buhg3+24qi9McuNl0oBOC34Dnms8VhRt7sBjUZF39DYvihEOOsIPG0l25wsiGYC1fiPfbLySn0l888hgYqd2KHqzPMzQQeV08FQG9rWEwax3nL8A0VlM9bNwQmDLgmlnzRJtfwrQjc2mGVw1t+SWnxNrRZJw1ZySbgYnhWuC+2WgEK48hzkenIG9LpAN/JqlmOF77a/YqQt/u1S8gfhTQddhI6zhmYFTWckKCsgK+odSjmSm1DFnSWggoojDe7+p2ly2rJztB6tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 194.138.21.74) smtp.rcpttodomain=linaro.org smtp.mailfrom=siemens.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=siemens.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=siemens.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CoeqWO5jn+/1Y3EBaDcSz5dtAsOK/vG3RHWEKr4jE9U=; b=EYnMIq/ibSsMys2xC7qQ9zH6fgMaAu+zXuWJhD2CWbJMUVuge8kj1BLT9BqASu4tYlg9NzwBg6II7miAZ8CyObJcvy3WKsQAKMqsbVHrcguT6eGCJ07s/I6yYPJcuufFomKiQndLp9jimInhGKyLE34U1+JA07oHm+dMcXtfxfdVBj8wDfbcDwTnEeYBNTBEAOskv8+CAW51XJPcSm88QZJ4NIm4v7MuYgF2HPLroBfsGR/7R1Vcyo02j9yN/3d3CWlxe2dqeTGAFgLfijfc2NDGCDpgMsek/wHeEa3uv/zscUudyDu5H1KNL1NuUHdTVM7l09AJ9IkcSRAAqwQyWA== Received: from DB6P191CA0018.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::28) by AM0PR10MB2289.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:dd::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5546.21; Wed, 24 Aug 2022 14:04:12 +0000 Received: from DB5EUR01FT085.eop-EUR01.prod.protection.outlook.com (2603:10a6:6:28:cafe::1e) by DB6P191CA0018.outlook.office365.com (2603:10a6:6:28::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.14 via Frontend Transport; Wed, 24 Aug 2022 14:04:12 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 194.138.21.74) smtp.mailfrom=siemens.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=siemens.com; Received-SPF: Fail (protection.outlook.com: domain of siemens.com does not designate 194.138.21.74 as permitted sender) receiver=protection.outlook.com; client-ip=194.138.21.74; helo=hybrid.siemens.com; Received: from hybrid.siemens.com (194.138.21.74) by DB5EUR01FT085.mail.protection.outlook.com (10.152.5.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5566.15 via Frontend Transport; Wed, 24 Aug 2022 14:04:12 +0000 Received: from DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) by DEMCHDC8VQA.ad011.siemens.net (194.138.21.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.9; Wed, 24 Aug 2022 16:04:11 +0200 Received: from md1za8fc.ad001.siemens.net (139.25.0.80) by DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.9; Wed, 24 Aug 2022 16:04:10 +0200 From: Henning Schild To: Linus Walleij , Bartosz Golaszewski , Pavel Machek , Hans de Goede , Mark Gross , Andy Shevchenko , Lee Jones , , , , CC: Sheng-Yuan Huang , Tasanakorn Phaipool , , Henning Schild Subject: [PATCH v5 5/5] platform/x86: simatic-ipc: add new model 427G Date: Wed, 24 Aug 2022 16:03:47 +0200 Message-ID: <20220824140347.1842-6-henning.schild@siemens.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220824140347.1842-1-henning.schild@siemens.com> References: <20220824140347.1842-1-henning.schild@siemens.com> MIME-Version: 1.0 X-Originating-IP: [139.25.0.80] X-ClientProxiedBy: DEMCHDC89XA.ad011.siemens.net (139.25.226.103) To DEMCHDC8A0A.ad011.siemens.net (139.25.226.106) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a1a8de5c-7eeb-4bf8-a132-08da85d985ae X-MS-TrafficTypeDiagnostic: AM0PR10MB2289:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LEeF8rjMJe7EMwGhe1ttdhbZPVouO5OBbzyBMFPBf1KpnpCZpNupiEw2Z9qdXz6FUThNp6x/dph4C8FzrzP3MPD5qYPgDjQv30/syWi6xYBVK5yx/3l/H7KQpU5xEBc9F2OUZlaTZrbDaFtKvPDYulk6d2LZpQQjzclgiOlu5J/gVT8603P3ezn8EHg+jY0aGNyJoyoyu69tn54bkaSO75b2hCWfxGB+0LFGmY2LsPk8+QtbkXbz8dWnqxF6UOuI/SGcNgTttYLOWzJUOSMGJDp8hIrgGTzesAFubepyMxg6XyzFLR4KbGqCTBLZegLWr3WtTh5yCXJcdOi/PJQ6Ge3asVxEoc9gQtjyGA7ZOibLLEO8A01G0Z3CA7ZyfKuH4006aitZda3azvteQQEiopuoW/JDWhAH6t6RdZCED0ODKFobXyAFY+2AcIiQbOaqFwSk4cLvvk2QSz95c8iwp6m2dATdGywiPl9Sq5YS5kgj0LfTd+ELxcqUAS/GUlcgeNvoxwC9jyncol+xbj6WGDzXX18qRth6v3SzMXDT+xk774caH2ywypha8Zh/MPBi0k7XyWopuHPZTtZu1793VrJy26Z9nEijI+NRsQ13ah9nOHwUGehjyC+edoqK7TCncC+Pxob6uSzozENh12Jp2oOEh9A+ATSlI3LX5FeGkvA7b23T3MKU4eefCpAb9COOtZrDvM5Q3Pq7+TtvLkSt3/++10YfVmxo2rSuHBcjOZhC0+20bDs1ZFxr0jG+Usg2aeupXcG9WMgIJ6MOpM+8mfPQmAiBj4dKG35ODVWH+xVMxgV3TWqFPFPy1pL8/VQRYcl6vMFp8aWIfMKBp4qA7iiM6+bu52EKoIeOINuS7uM= X-Forefront-Antispam-Report: CIP:194.138.21.74; CTRY:DE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:hybrid.siemens.com; PTR:hybrid.siemens.com; CAT:NONE; SFS:(13230016)(4636009)(396003)(376002)(346002)(39860400002)(136003)(46966006)(36840700001)(40470700004)(34020700004)(86362001)(36860700001)(40460700003)(82960400001)(7596003)(356005)(7636003)(82740400003)(921005)(70586007)(70206006)(54906003)(8936002)(316002)(110136005)(2906002)(8676002)(44832011)(4326008)(1076003)(40480700001)(956004)(107886003)(336012)(16526019)(83380400001)(2616005)(26005)(82310400005)(186003)(5660300002)(6666004)(47076005)(478600001)(41300700001)(36756003)(7416002)(2101003)(83996005); DIR:OUT; SFP:1101; X-OriginatorOrg: siemens.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2022 14:04:12.2776 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a1a8de5c-7eeb-4bf8-a132-08da85d985ae X-MS-Exchange-CrossTenant-Id: 38ae3bcd-9579-4fd4-adda-b42e1495d55a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=38ae3bcd-9579-4fd4-adda-b42e1495d55a; Ip=[194.138.21.74]; Helo=[hybrid.siemens.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR01FT085.eop-EUR01.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR10MB2289 Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org This adds support for the Siemens Simatic IPC427G. A board which basically works like the 227G added in a previous patch. So all there is to do is to add the station_id and make it take all the 227G branches. Reviewed-by: Andy Shevchenko Signed-off-by: Henning Schild --- drivers/platform/x86/simatic-ipc.c | 11 +++++++---- include/linux/platform_data/x86/simatic-ipc.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c index 8dd686d1c9f1..ca76076fc706 100644 --- a/drivers/platform/x86/simatic-ipc.c +++ b/drivers/platform/x86/simatic-ipc.c @@ -41,11 +41,12 @@ static struct { {SIMATIC_IPC_IPC127E, SIMATIC_IPC_DEVICE_127E, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC227D, SIMATIC_IPC_DEVICE_227D, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC227E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_227E}, - {SIMATIC_IPC_IPC227G, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_NONE}, + {SIMATIC_IPC_IPC227G, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G}, {SIMATIC_IPC_IPC277E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_227E}, {SIMATIC_IPC_IPC427D, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_NONE}, {SIMATIC_IPC_IPC427E, SIMATIC_IPC_DEVICE_427E, SIMATIC_IPC_DEVICE_427E}, {SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_427E}, + {SIMATIC_IPC_IPC427G, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G}, }; static int register_platform_devices(u32 station_id) @@ -82,6 +83,11 @@ static int register_platform_devices(u32 station_id) ipc_led_platform_device->name); } + if (wdtmode == SIMATIC_IPC_DEVICE_227G) { + request_module("w83627hf_wdt"); + return 0; + } + if (wdtmode != SIMATIC_IPC_DEVICE_NONE) { platform_data.devmode = wdtmode; ipc_wdt_platform_device = @@ -96,9 +102,6 @@ static int register_platform_devices(u32 station_id) ipc_wdt_platform_device->name); } - if (station_id == SIMATIC_IPC_IPC227G) - request_module("w83627hf_wdt"); - if (ledmode == SIMATIC_IPC_DEVICE_NONE && wdtmode == SIMATIC_IPC_DEVICE_NONE) { pr_warn("unsupported IPC detected, station id=%08x\n", diff --git a/include/linux/platform_data/x86/simatic-ipc.h b/include/linux/platform_data/x86/simatic-ipc.h index 7a2e79f3be0b..632320ec8f08 100644 --- a/include/linux/platform_data/x86/simatic-ipc.h +++ b/include/linux/platform_data/x86/simatic-ipc.h @@ -32,6 +32,7 @@ enum simatic_ipc_station_ids { SIMATIC_IPC_IPC477E = 0x00000A02, SIMATIC_IPC_IPC127E = 0x00000D01, SIMATIC_IPC_IPC227G = 0x00000F01, + SIMATIC_IPC_IPC427G = 0x00001001, }; static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len)