From patchwork Mon Nov 30 11:04:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 335332 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D1A7C64E8A for ; Mon, 30 Nov 2020 11:07:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF84E2076E for ; Mon, 30 Nov 2020 11:07:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mysnt.onmicrosoft.com header.i=@mysnt.onmicrosoft.com header.b="bkaGmmrU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726828AbgK3LHD (ORCPT ); Mon, 30 Nov 2020 06:07:03 -0500 Received: from mail-eopbgr30136.outbound.protection.outlook.com ([40.107.3.136]:7771 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726345AbgK3LHC (ORCPT ); Mon, 30 Nov 2020 06:07:02 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PIlVrFiUY7HY/pdZOd8lADotpjMIGAGML2Q2E2znlNIeGN8wgw6QZrIDdztipvBJrzYEmQtVwEZ0zo0Vg+53ht0Q2KAlf8wpGuj0LHxZaakuos4WZCfh+7H+AE8ZW429lT9iLIg/r6Ee3hEYDsDYuag9DJ7cZJ5R2mbrsMXTHy9ModLbMy0PzTtXnTkRk/LF9SiaYsYgb3fdpaPHX6qzskxH4gVSBMr4CHm60MZDAfHmvXwNolwcJeXDuYeL97iBxYoYwl0MEeRUUJ159vCdJaSFj0mOzBv1vMN3TwPZiGlQqCJO+/duQLw2frTMG0SemrktaYIaDF7/rs2Glf27jQ== 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-SenderADCheck; bh=dUaJY7H2/xYjdqK7u0vsVk948Vdpp6mlyRYfIXVtwhs=; b=bFqxq3rOVEansJa/ZQ/gX9FI1yxhJTnE2jweivyCqP1hR5FNLIdplj6D3wc4kiSvRQ7lTBKqeUEsQEBYfVeHA4oYXYzhygnFU/1nCHWcEXxXe5n2/CerTWSyGoWyJ0AiN3j5Xg1mx3/0ejvjpV3vtadnGUvdFhBPFfS3ZP2NRHWcwqd/U2mQcNfv+n8Zcf78wMIHSy3KJPYc+2jxHB/4U7ha7TiYiwianmfhuHSbANiNCVfFq23gl+rF07U9kvA8yzAWGXyF7yBuJyMxGAKVljMMVvZsQG3dzTLPM4MdDFNkMsyNPmuJOA2XX9yAZ+1LA7k6VhIU2PWnMhRd+L6MoQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kontron.de; dmarc=pass action=none header.from=kontron.de; dkim=pass header.d=kontron.de; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mysnt.onmicrosoft.com; s=selector2-mysnt-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=dUaJY7H2/xYjdqK7u0vsVk948Vdpp6mlyRYfIXVtwhs=; b=bkaGmmrUbEX+GV8L0uWMSbguUTbeDT9MKVpqU+zUzqFiwpmA/6pIo3yphzZYvw1SjN+6XJiKA9cy1vLEBKxNp6S2bSlSFtEqFwxx+HfrvNPh1DMWdRkOj1T2mPvKPqy1TY6oSAJ2/B1HyrbJqCpz9Yc7qXGLqYrk7cR+o86rW6g= Authentication-Results: effinnov.com; dkim=none (message not signed) header.d=none; effinnov.com; dmarc=none action=none header.from=kontron.de; Received: from AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:157::14) by AM9PR10MB4402.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:20b:269::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.22; Mon, 30 Nov 2020 11:06:12 +0000 Received: from AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM ([fe80::9d5:953d:42a3:f862]) by AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM ([fe80::9d5:953d:42a3:f862%7]) with mapi id 15.20.3611.031; Mon, 30 Nov 2020 11:06:12 +0000 From: Schrempf Frieder To: Charles Gorand , =?utf-8?q?Cl=C3=A9ment_P?= =?utf-8?q?errochaud?= , Frieder Schrempf Cc: Andy Shevchenko , "David S. Miller" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nfc@lists.01.org, netdev@vger.kernel.org, Stephan Gerhold Subject: [PATCH] NFC: nxp-nci: Make firmware GPIO pin optional Date: Mon, 30 Nov 2020 12:04:42 +0100 Message-Id: <20201130110447.16891-1-frieder.schrempf@kontron.de> X-Mailer: git-send-email 2.17.1 X-Originating-IP: [46.142.77.113] X-ClientProxiedBy: AM7PR04CA0003.eurprd04.prod.outlook.com (2603:10a6:20b:110::13) To AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:208:157::14) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from fs-work.localdomain (46.142.77.113) by AM7PR04CA0003.eurprd04.prod.outlook.com (2603:10a6:20b:110::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3611.20 via Frontend Transport; Mon, 30 Nov 2020 11:06:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d8cc93e9-0864-4d5a-bb01-08d8951ff274 X-MS-TrafficTypeDiagnostic: AM9PR10MB4402: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sA19WqVjsjCsNjoq15JVXb4GvP63dViLXqDDFWfz8J7jWpA6RG8Fz1/Mwx+8qb+xjyWIusktL0ni3vc/wWATKH3+KWmhMLOMhv3WM+0eeeqbwgC7Kd9jfFR462hvo8LX9DjK7az/jqFTUe8ph4tymPtJH5vpO/KNZ3A84GFQNKosfU5u4eMoqh/gNHMsexJ8RYKksP/LJiGyn7ZyoivdPqgN8wn4KykWorO6TrWxb1oK3QQ0t9Zox8N/Dh3VifMIH3K4zAT+N1NigdN2wbCuVmGRTfWERw6bzfaqwwzMtEMB7g0IFkVrC/pMlw65DsAE2z/PoJRG7UWQy7v8EFdGzQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(136003)(366004)(396003)(346002)(376002)(2906002)(1076003)(6486002)(8936002)(478600001)(5660300002)(4326008)(8676002)(66946007)(86362001)(66476007)(66556008)(36756003)(52116002)(6666004)(6512007)(54906003)(83380400001)(16526019)(316002)(7049001)(110136005)(2616005)(186003)(26005)(6506007)(956004); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData: Fa4jlFQVo4Oc7xoafkMIQKv/Ip6fckLJPJ2dKXDc7j1J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thSource: AM0PR10MB2963.EURPRD10.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2020 11:06:11.8765 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8c9d3c97-3fd9-41c8-a2b1-646f3942daf1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9vuSxMiZwSCNd+p++EIundfCdFlSCkTDjlzebHfwmauJnjt9WNalCLHonedwUN9wdnLehX34+ABU97mhRUW61O0ymT0qZxReZyii8MEkuUQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR10MB4402 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Frieder Schrempf There are other NXP NCI compatible NFC controllers such as the PN7150 that use an integrated firmware and therefore do not have a GPIO to select firmware downloading mode. To support these kind of chips, let's make the firmware GPIO optional. Signed-off-by: Frieder Schrempf --- Documentation/devicetree/bindings/net/nfc/nxp-nci.txt | 2 +- drivers/nfc/nxp-nci/i2c.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt index cfaf88998918..cb2385c277d0 100644 --- a/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt +++ b/Documentation/devicetree/bindings/net/nfc/nxp-nci.txt @@ -6,11 +6,11 @@ Required properties: - reg: address on the bus - interrupts: GPIO interrupt to which the chip is connected - enable-gpios: Output GPIO pin used for enabling/disabling the chip -- firmware-gpios: Output GPIO pin used to enter firmware download mode Optional SoC Specific Properties: - pinctrl-names: Contains only one value - "default". - pintctrl-0: Specifies the pin control groups used for this controller. +- firmware-gpios: Output GPIO pin used to enter firmware download mode Example (for ARM-based BeagleBone with NPC100 NFC controller on I2C2): diff --git a/drivers/nfc/nxp-nci/i2c.c b/drivers/nfc/nxp-nci/i2c.c index 9f60e4dc5a90..528893686e18 100644 --- a/drivers/nfc/nxp-nci/i2c.c +++ b/drivers/nfc/nxp-nci/i2c.c @@ -47,7 +47,8 @@ static int nxp_nci_i2c_set_mode(void *phy_id, { struct nxp_nci_i2c_phy *phy = (struct nxp_nci_i2c_phy *) phy_id; - gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0); + if (phy->gpiod_fw) + gpiod_set_value(phy->gpiod_fw, (mode == NXP_NCI_MODE_FW) ? 1 : 0); gpiod_set_value(phy->gpiod_en, (mode != NXP_NCI_MODE_COLD) ? 1 : 0); usleep_range(10000, 15000); @@ -286,7 +287,7 @@ static int nxp_nci_i2c_probe(struct i2c_client *client, return PTR_ERR(phy->gpiod_en); } - phy->gpiod_fw = devm_gpiod_get(dev, "firmware", GPIOD_OUT_LOW); + phy->gpiod_fw = devm_gpiod_get_optional(dev, "firmware", GPIOD_OUT_LOW); if (IS_ERR(phy->gpiod_fw)) { nfc_err(dev, "Failed to get FW gpio\n"); return PTR_ERR(phy->gpiod_fw);