Message ID | 20231001-vf610-gpio-v5-4-8d873a8f224a@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2a8e:b0:403:3b70:6f57 with SMTP id in14csp766259vqb; Sun, 1 Oct 2023 01:28:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEbOU/WyhksqTE0qR/qchQrSKOew+CxuMi5M25JuvBh56DlfKQfFRxxtf/lj2fpmrtGlJ+k X-Received: by 2002:a05:6870:9128:b0:1d5:a905:5681 with SMTP id o40-20020a056870912800b001d5a9055681mr9960838oae.26.1696148885383; Sun, 01 Oct 2023 01:28:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696148885; cv=pass; d=google.com; s=arc-20160816; b=acB5r5JF5VQ1ibmBU0ZHTHD2Chj7YJguF431M43j/Z9Wfr2lOBcJ2+8wcofifRW1Qr Ro2129E3juliMcFcP5jDv22wKWouh2oH92247myn245eGU/d+WTfX3MHIyyj9MMERB3C 25cjcIul6XEaBLXtkIIPkc/V/W9lN3dbdcXvip0wWaKqgI/A3ZTxcENC5mt4yz7OfIkr 0WADbfy3lDUBZEWxGUNQzD9DL/XoRg0UJ9InAmzfd8qOLzDWerll+O53wLjWzJIDtQj3 6Ds14ic5Qni9KAlgx8nNWgfIqN7X/0FPrpnT5645O/OjF+2oDP2CNtZdVqt+PQZhovgw eATg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:cc:to:in-reply-to:references :message-id:content-transfer-encoding:subject:date:from :dkim-signature; bh=mr7sQz1yoHoDuwKLC2NruYcIIU1j0vmnjyNrB72diAQ=; fh=f7iHUwjMuOlQJJZNtht8HlAjyfLwMcbEze07uludsH4=; b=B2684OJ1sEUdms6uoGE3CdIHJ/IUvQ2j1b2hAGQWn3EJvaB3SrFYgby/WFr/zUC9tc 8Plyw6XzrE2vKKfRJPEEUROpTyMF/9KFjNY/5cilp9xqUC46NL9j+2poorUNi/S0EbV5 zMidOjMUNedLoopJcjAw084FWk4Tc0U5vFNzJuz9FCr+McNqNbJEnA4Bp1kk1fEuclwI 5V+Adjopaghn6zzc0bqN5xGnTRdKlg4dPqaHvWiX9GPu/JX2wRR8WVyMA+jnWlLgb8Iq iU6crbE0zA0WC45i9kS2VVNutd98zFy5Orfb1X6qCLYYfJMaqixDtyusor3MiTWTThbX FPFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=TemXA3fw; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q78-20020a632a51000000b005533cf1fdbfsi25748526pgq.629.2023.10.01.01.28.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Oct 2023 01:28:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=TemXA3fw; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id D873680B5A23; Sun, 1 Oct 2023 01:23:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234575AbjJAIXt (ORCPT <rfc822;chrisfriedt@gmail.com> + 19 others); Sun, 1 Oct 2023 04:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234576AbjJAIXs (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 1 Oct 2023 04:23:48 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2065.outbound.protection.outlook.com [40.107.21.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E9911B; Sun, 1 Oct 2023 01:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l3Za+OfG33BffKw7MNF01hVeVC4mPnK2z73Bv9p2E6pPPqS/CsIp+f7g9nccKhi3j58/LVI3fjotIkOEFZtGLG73iyXBof8ajR34hNEMMad3FEE1FTiDn5+LbYCizkbwzXie4pN6PCrBI8c6wcgNpkrR0GqLe/EflAhh3N+bAG+dHEkRFua++a9nKwLYw9i5vSyGal7vWoXSBcBv4aVeYt9lq36r6Gs0k3Z2LD5cIRaXPadGn9wR+jDElKo8j+T5/u9QQTlOFUW9rdnleeh8bgLDJnMf82nxtNQgoZKCkWfXISeC63BYf5rGQXacUTNUsxOEXqcQLugvt3KDVIz2iA== 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=mr7sQz1yoHoDuwKLC2NruYcIIU1j0vmnjyNrB72diAQ=; b=DGUJNp8VD+e+09cU1R6fT8AOJW50rh8RvoFV36m5yYV6IS2xFluvTibbCajKtG3amrhR5ZraZvkFZnzN4rXME6J739rn/Q9UVdnhmNtcHU1BEXOHd7JnlIR+4K/FBCt28l2foZ/cZThyb6AwY6jZFmO6yTysI7fxYYZ+0wzEGYxMi7BZnGyoIbLHamPzd0sA46D1A7jJsGZRg0BvsmaMoU4R/EQI+Kd1Y+04V6721ggbNfvnv2QrGN8icaZ4SrotGkZoDxuxQF0845l0I456bhxWQN8/xEe2oUo8miuqo3yIVHpPgn3u0gWa/+aFNyxvFQGEpLGE2CFPrIkEEgb1Mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mr7sQz1yoHoDuwKLC2NruYcIIU1j0vmnjyNrB72diAQ=; b=TemXA3fwm0L0NDzSUnu3wOsguaL6tGUtcXmX8Mi109NXCMIx4Hb4nuLBSB9m/v/D/VB1c0bbF93nCSm5L8bK47dZKsd/6VorOyTM9nidmFJ/JyTAl2v4OApVruu+q3dpX+OM2KBqZqRVPTHMmvkXtPB4OamgOfDYToj2NfuvOh8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) by PR3PR04MB7417.eurprd04.prod.outlook.com (2603:10a6:102:8e::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.28; Sun, 1 Oct 2023 08:23:38 +0000 Received: from DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b]) by DU0PR04MB9417.eurprd04.prod.outlook.com ([fe80::2b3:d8de:95c8:b28b%3]) with mapi id 15.20.6838.024; Sun, 1 Oct 2023 08:23:38 +0000 From: "Peng Fan (OSS)" <peng.fan@oss.nxp.com> Date: Sun, 01 Oct 2023 16:27:55 +0800 Subject: [PATCH v5 4/7] gpio: vf610: add i.MX8ULP of_device_id entry Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20231001-vf610-gpio-v5-4-8d873a8f224a@nxp.com> References: <20231001-vf610-gpio-v5-0-8d873a8f224a@nxp.com> In-Reply-To: <20231001-vf610-gpio-v5-0-8d873a8f224a@nxp.com> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Andy Shevchenko <andy@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Stefan Agner <stefan@agner.ch>, Shawn Guo <shawnguo@kernel.org>, Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix Kernel Team <kernel@pengutronix.de>, Fabio Estevam <festevam@gmail.com>, NXP Linux Team <linux-imx@nxp.com>, Marco Felsch <m.felsch@pengutronix.de> Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan <peng.fan@nxp.com> X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1696148883; l=3444; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=F3ztsSlGWjYD7DS0l/EdF5KdUwt2G4UpUATZtl+c9F4=; b=KegxZZA5ODS4A6WjEfyRVj6thifs1w4UZjMjP9asJG7GUhUggfSs/8EIHD/jtC54xnc/YlAc9 uQAdHW//zQCBMrr9QjeUWr9c99ON7nCFdUl7zJGdUr/Aqia1aGegznk X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SG2PR02CA0131.apcprd02.prod.outlook.com (2603:1096:4:188::6) To DU0PR04MB9417.eurprd04.prod.outlook.com (2603:10a6:10:358::11) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU0PR04MB9417:EE_|PR3PR04MB7417:EE_ X-MS-Office365-Filtering-Correlation-Id: 36104f56-5653-4af9-5dfe-08dbc257b6b5 X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RX2//Lzc2NGi/TYjs+cALM9CzWWfqEj+PGBLwP2q2M3Ytlh59HXSVOJuJh/n/tGqijUcvj3eEgY9r8QU7ULBmZRnOmGaehR1Ewsa1rUajdMjYBdgMdiWzZPwpOREOdhnx/H78V4wszl5JnxPPSDQh1RwUAd1VvVTYeQPsnzofjBZQKGznNOrqJ4wOCV1WUjE/FTrTE0JpX/Y5QRBn5fISMSvB/CQo4HBqYvOOqnvaaeklU3jd9yja4WxkvGjkAsiQWusbB1cjQw4ey695qrMdhPPd7UfS2TFCUUlpu9sK2uBGBE8rO2NVdMkz28ZoNt43Rd/x5GylX7m+cH/aDOAd80hcjmWzo9ZYtqSosnX/hev4hBbjiIiKPYIakvtNNo2XfxTT7fbvUzESD9pGnAfvb1CyFdFkJdprmFbW3V6vO4g24O392KB2t2GK2OLSf+z4BicWz6PIeEMlf38846iRgc2nmXVz4+sT6R4iwT+7tIapIMduSCRrdJlAhZz+EM2J0w3qNUTGhDg1p/nF6nJrPudUeAVYAjxxiRfECpSdvxZgZrIy/L3NIyWlAj+1LyOBkX+bOA3Dy2/JpuXeFq+xsAGtHBPC8QxR1antwqwBWiqv/okcWtFG4Mm9vcJQUSW0ztuzApH82LhM2ddwCbdNA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU0PR04MB9417.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(366004)(396003)(376002)(136003)(230922051799003)(64100799003)(1800799009)(451199024)(186009)(41300700001)(316002)(26005)(2906002)(110136005)(7416002)(8676002)(5660300002)(66556008)(66476007)(66946007)(8936002)(4326008)(478600001)(6666004)(6486002)(52116002)(6506007)(9686003)(6512007)(36756003)(86362001)(83380400001)(38100700002)(38350700002)(921005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?/mI46jB9+H0IYxzLpxzaIuk8Oh9Z?= =?utf-8?q?/+fcL1nrZSXjuhl/y8S/Z2OEjPLETioy2KGTsdEA2XLZrJRAiNxmki9sGckIk2pm1?= =?utf-8?q?aa19darJ9HTqBKYDH0Gjv1BPZNE2I31wF/QySZZZynlF5m6kQaPKbUas+0uwPl6HF?= =?utf-8?q?2oJpmNpxs4GcPSVP3He43nB/B06Yzglz9o4I/1Ih7VMIV8TsQ/e5vThXidzcadoc3?= =?utf-8?q?WRn942g/DshaSv/R+BnALs6CNLnWPfkfEeQu2JNM8dZJXLWBfJYNykG4R4OCChyTj?= =?utf-8?q?8SoIGiEpbzuX4xdqovhZ3IEiHFQi2m64fKHkxOwCURIWPCXyRtrCJLnf5P5eMDQ+a?= =?utf-8?q?b16pPP4G67UAra1h8dv6GxuJgPgTcvdVc/uCmgNV8hpEkVEWPJ7Cf6TX9HbLDTBPH?= =?utf-8?q?ZiBm2RwJpv31Q2CA72vPYiuLiuCKnQ7OkucG3y7W4tb7/eVNZhHMIqZZoyydeDUdh?= =?utf-8?q?DbOOQoFMe6azZAOwsDBTXzdm9AkO1nJ2JifJndb42mGEdPHYFW2bBQjfg1jJHgiyE?= =?utf-8?q?0t+gBFO0RZA+6hEQuncMMiMQC7QMT8lY1HcZGQQfGm9X99l+fSqeC9Obpkq9uLo7v?= =?utf-8?q?dVCE0QeugYIC7/k2kxzEi44+MuitAhzxd8I9fcsd/xrMVvCtZ0ddCFkLpteiG2GXo?= =?utf-8?q?KIVVRKq/KfM+IMtPh7kixFjaIQHa8/UK1m2vPUn16e0sK9ZIXUpTYTrglPtNu1tkN?= =?utf-8?q?odCOX2lamMFud/h5biZy9q067OzSWDeGuPdtpKYZfMbv8fsfWdbd74Eowi01XbrhE?= =?utf-8?q?qKwePWOyfa1dkayMdAFMmTsgUSuqrRLsKWdX0DQu6ibKF5nCjSMdlCBMe7MwuIAGu?= =?utf-8?q?3RsSNWOdTYwF16vIcp95rdKPoidr1Q9CDOjfQ9LwaTOAQ3HttuQeWITOu7z1j83/w?= =?utf-8?q?qoY+4o4HlAs1Ai577Qj/RXl7ApaCGga/Vl0y0IXD1/c5pY1MqGepSAmjes91b2iNS?= =?utf-8?q?AUZwLGn/ZheYB7SEFQJC2QH+XFRJ4m+UOLiqDrtGotE3PC9wlIrGrxxGbq7hUbIkS?= =?utf-8?q?1ziix1EhhDa/NbVHl8L2GqprzihfjnjEARk9R16ghfnrsBP6HEvXLZCMIyuskTw1g?= =?utf-8?q?aEKyAvWvwsT1W4OC59S4LAlcDL+64ylHZf948ibJoPvdNy0K1V8Qe3IsS69qhV01T?= =?utf-8?q?aUKrjBYJN5oHr8OsLgpxs9u/+zlAjy+mP5VpIlvJ7wmYD1M9snWyIgnBANpE5zeSj?= =?utf-8?q?9CsHrOiYe4qPB4QUc2JUILUuVa9E2zlg3SvVU/BGW133LoTrtRBghog5aN/+Vekr9?= =?utf-8?q?p7T89ro1hY/354N5FyEWz2+SZXN+bJrAn0ktekcm/dTAqJVby6jdzuqS66WJfWTjp?= =?utf-8?q?kkoK5l5RXrfSd7OwnejoHPkFtPYDx3DZuQDq3gxwOmIhIGoW7krTbqNbU+vgz6e+Y?= =?utf-8?q?XnaN6ZEyJh6iX3VJEVtPAnXfLmo0QCFaatbwiQv/U4Z+fvjgeFPaelyt5QV548SSn?= =?utf-8?q?1rjAfdPzDigQ97QGXLbfWx1Md3hZk+RIIHQXCtbnlBNbJnArIlm1rxbCwNFkKRS0x?= =?utf-8?q?3rQ+4ATe7iiQ?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 36104f56-5653-4af9-5dfe-08dbc257b6b5 X-MS-Exchange-CrossTenant-AuthSource: DU0PR04MB9417.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2023 08:23:38.7723 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6nAJ7SA4rjCwjNgleYgipbcvFzeocv7SPUBGsTXTNG08qelmKityjSXhlTF6Rv128ytyw5TZi+3GJaf359vNuA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7417 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sun, 01 Oct 2023 01:23:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778541013253722184 X-GMAIL-MSGID: 1778541013253722184 |
Series |
gpio: update i.MX93/8ULP and support i.MX95
|
|
Commit Message
Peng Fan (OSS)
Oct. 1, 2023, 8:27 a.m. UTC
From: Peng Fan <peng.fan@nxp.com> i.MX8ULP/93 GPIO supports similar feature as i.MX7ULP GPIO, but i.MX8ULP is actually not hardware compatible with i.MX7ULP. i.MX8ULP only has one register base, not two bases. i.MX8ULP and i.MX93 actually has two interrupts for each gpio controller, one for Trustzone non-secure world, one for secure world. Although the Linux Kernel driver gpio-vf610.c could work with fsl,imx7ulp-gpio compatible, it is based on some tricks did in device tree with some offset added to base address. Add a new of_device_id entry for i.MX8ULP. But to make the driver could also support old bindings, check the compatible string first, before check the device data. Signed-off-by: Peng Fan <peng.fan@nxp.com> --- drivers/gpio/gpio-vf610.c | 47 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 7 deletions(-)
Comments
On Sun, Oct 1, 2023 at 10:23 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote: > > From: Peng Fan <peng.fan@nxp.com> > > i.MX8ULP/93 GPIO supports similar feature as i.MX7ULP GPIO, but i.MX8ULP is > actually not hardware compatible with i.MX7ULP. i.MX8ULP only has one > register base, not two bases. i.MX8ULP and i.MX93 actually has two > interrupts for each gpio controller, one for Trustzone non-secure world, > one for secure world. > > Although the Linux Kernel driver gpio-vf610.c could work with > fsl,imx7ulp-gpio compatible, it is based on some tricks did in device tree > with some offset added to base address. > > Add a new of_device_id entry for i.MX8ULP. But to make the driver could > also support old bindings, check the compatible string first, before > check the device data. > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > --- > drivers/gpio/gpio-vf610.c | 47 ++++++++++++++++++++++++++++++++++++++++------- > 1 file changed, 40 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c > index dbc7ba0ee72c..8e12706c0b22 100644 > --- a/drivers/gpio/gpio-vf610.c > +++ b/drivers/gpio/gpio-vf610.c > @@ -25,6 +25,7 @@ > struct fsl_gpio_soc_data { > /* SoCs has a Port Data Direction Register (PDDR) */ > bool have_paddr; > + bool have_dual_base; > }; > > struct vf610_gpio_port { > @@ -60,13 +61,26 @@ struct vf610_gpio_port { > #define PORT_INT_EITHER_EDGE 0xb > #define PORT_INT_LOGIC_ONE 0xc > > +#define IMX8ULP_GPIO_BASE_OFF 0x40 > +#define IMX8ULP_BASE_OFF 0x80 > + > +static const struct fsl_gpio_soc_data vf610_data = { > + .have_dual_base = true, > +}; > + > static const struct fsl_gpio_soc_data imx_data = { > .have_paddr = true, > + .have_dual_base = true, > +}; > + > +static const struct fsl_gpio_soc_data imx8ulp_data = { > + .have_paddr = true, > }; > > static const struct of_device_id vf610_gpio_dt_ids[] = { > - { .compatible = "fsl,vf610-gpio", .data = NULL, }, > + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, > { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, }, > + { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, > { /* sentinel */ } > }; > > @@ -263,19 +277,38 @@ static int vf610_gpio_probe(struct platform_device *pdev) > struct gpio_irq_chip *girq; > int i; > int ret; > + bool dual_base; > > port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); > if (!port) > return -ENOMEM; > > port->sdata = of_device_get_match_data(dev); > - port->base = devm_platform_ioremap_resource(pdev, 0); > - if (IS_ERR(port->base)) > - return PTR_ERR(port->base); > > - port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > - if (IS_ERR(port->gpio_base)) > - return PTR_ERR(port->gpio_base); > + dual_base = port->sdata->have_dual_base; > + > + /* support old compatible strings */ > + if (device_is_compatible(dev, "fsl,imx7ulp-gpio") && > + (device_is_compatible(dev, "fsl,imx93-gpio") || Why not just add this compatible to vf610_gpio_dt_ids? Bart > + (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) > + dual_base = true; > + > + if (dual_base) { > + port->base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(port->base)) > + return PTR_ERR(port->base); > + > + port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > + if (IS_ERR(port->gpio_base)) > + return PTR_ERR(port->gpio_base); > + } else { > + port->base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(port->base)) > + return PTR_ERR(port->base); > + > + port->gpio_base = port->base + IMX8ULP_GPIO_BASE_OFF; > + port->base = port->base + IMX8ULP_BASE_OFF; > + } > > port->irq = platform_get_irq(pdev, 0); > if (port->irq < 0) > > -- > 2.37.1 >
> Subject: Re: [PATCH v5 4/7] gpio: vf610: add i.MX8ULP of_device_id entry > > On Sun, Oct 1, 2023 at 10:23 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> > wrote: > > > > From: Peng Fan <peng.fan@nxp.com> > > > > i.MX8ULP/93 GPIO supports similar feature as i.MX7ULP GPIO, but > > i.MX8ULP is actually not hardware compatible with i.MX7ULP. i.MX8ULP > > only has one register base, not two bases. i.MX8ULP and i.MX93 > > actually has two interrupts for each gpio controller, one for > > Trustzone non-secure world, one for secure world. > > > > Although the Linux Kernel driver gpio-vf610.c could work with > > fsl,imx7ulp-gpio compatible, it is based on some tricks did in device > > tree with some offset added to base address. > > > > Add a new of_device_id entry for i.MX8ULP. But to make the driver > > could also support old bindings, check the compatible string first, > > before check the device data. > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > --- > > drivers/gpio/gpio-vf610.c | 47 > > ++++++++++++++++++++++++++++++++++++++++------- > > 1 file changed, 40 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c > > index dbc7ba0ee72c..8e12706c0b22 100644 > > --- a/drivers/gpio/gpio-vf610.c > > +++ b/drivers/gpio/gpio-vf610.c > > @@ -25,6 +25,7 @@ > > struct fsl_gpio_soc_data { > > /* SoCs has a Port Data Direction Register (PDDR) */ > > bool have_paddr; > > + bool have_dual_base; > > }; > > > > struct vf610_gpio_port { > > @@ -60,13 +61,26 @@ struct vf610_gpio_port { > > #define PORT_INT_EITHER_EDGE 0xb > > #define PORT_INT_LOGIC_ONE 0xc > > > > +#define IMX8ULP_GPIO_BASE_OFF 0x40 > > +#define IMX8ULP_BASE_OFF 0x80 > > + > > +static const struct fsl_gpio_soc_data vf610_data = { > > + .have_dual_base = true, > > +}; > > + > > static const struct fsl_gpio_soc_data imx_data = { > > .have_paddr = true, > > + .have_dual_base = true, > > +}; > > + > > +static const struct fsl_gpio_soc_data imx8ulp_data = { > > + .have_paddr = true, > > }; > > > > static const struct of_device_id vf610_gpio_dt_ids[] = { > > - { .compatible = "fsl,vf610-gpio", .data = NULL, }, > > + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, > > { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, }, > > + { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, > > { /* sentinel */ } > > }; > > > > @@ -263,19 +277,38 @@ static int vf610_gpio_probe(struct > platform_device *pdev) > > struct gpio_irq_chip *girq; > > int i; > > int ret; > > + bool dual_base; > > > > port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); > > if (!port) > > return -ENOMEM; > > > > port->sdata = of_device_get_match_data(dev); > > - port->base = devm_platform_ioremap_resource(pdev, 0); > > - if (IS_ERR(port->base)) > > - return PTR_ERR(port->base); > > > > - port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > > - if (IS_ERR(port->gpio_base)) > > - return PTR_ERR(port->gpio_base); > > + dual_base = port->sdata->have_dual_base; > > + > > + /* support old compatible strings */ > > + if (device_is_compatible(dev, "fsl,imx7ulp-gpio") && > > + (device_is_compatible(dev, "fsl,imx93-gpio") || > > Why not just add this compatible to vf610_gpio_dt_ids? "fsl,imx93-gpio", "fsl,imx7ulp-gpio" is not a correct entry combination. This is to support legacy old compatible strings. Thanks, Peng. > > Bart > > > + (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) > > + dual_base = true; > > + > > + if (dual_base) { > > + port->base = devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(port->base)) > > + return PTR_ERR(port->base); > > + > > + port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > > + if (IS_ERR(port->gpio_base)) > > + return PTR_ERR(port->gpio_base); > > + } else { > > + port->base = devm_platform_ioremap_resource(pdev, 0); > > + if (IS_ERR(port->base)) > > + return PTR_ERR(port->base); > > + > > + port->gpio_base = port->base + IMX8ULP_GPIO_BASE_OFF; > > + port->base = port->base + IMX8ULP_BASE_OFF; > > + } > > > > port->irq = platform_get_irq(pdev, 0); > > if (port->irq < 0) > > > > -- > > 2.37.1 > >
Hi Peng, On 23-10-02, Peng Fan wrote: > > Subject: Re: [PATCH v5 4/7] gpio: vf610: add i.MX8ULP of_device_id entry > > > > On Sun, Oct 1, 2023 at 10:23 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> > > wrote: > > > > > > From: Peng Fan <peng.fan@nxp.com> > > > > > > i.MX8ULP/93 GPIO supports similar feature as i.MX7ULP GPIO, but > > > i.MX8ULP is actually not hardware compatible with i.MX7ULP. i.MX8ULP > > > only has one register base, not two bases. i.MX8ULP and i.MX93 > > > actually has two interrupts for each gpio controller, one for > > > Trustzone non-secure world, one for secure world. > > > > > > Although the Linux Kernel driver gpio-vf610.c could work with > > > fsl,imx7ulp-gpio compatible, it is based on some tricks did in device > > > tree with some offset added to base address. > > > > > > Add a new of_device_id entry for i.MX8ULP. But to make the driver > > > could also support old bindings, check the compatible string first, > > > before check the device data. > > > > > > Signed-off-by: Peng Fan <peng.fan@nxp.com> > > > --- > > > drivers/gpio/gpio-vf610.c | 47 > > > ++++++++++++++++++++++++++++++++++++++++------- > > > 1 file changed, 40 insertions(+), 7 deletions(-) > > > > > > diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c > > > index dbc7ba0ee72c..8e12706c0b22 100644 > > > --- a/drivers/gpio/gpio-vf610.c > > > +++ b/drivers/gpio/gpio-vf610.c > > > @@ -25,6 +25,7 @@ > > > struct fsl_gpio_soc_data { > > > /* SoCs has a Port Data Direction Register (PDDR) */ > > > bool have_paddr; > > > + bool have_dual_base; > > > }; > > > > > > struct vf610_gpio_port { > > > @@ -60,13 +61,26 @@ struct vf610_gpio_port { > > > #define PORT_INT_EITHER_EDGE 0xb > > > #define PORT_INT_LOGIC_ONE 0xc > > > > > > +#define IMX8ULP_GPIO_BASE_OFF 0x40 > > > +#define IMX8ULP_BASE_OFF 0x80 > > > + > > > +static const struct fsl_gpio_soc_data vf610_data = { > > > + .have_dual_base = true, > > > +}; > > > + > > > static const struct fsl_gpio_soc_data imx_data = { > > > .have_paddr = true, > > > + .have_dual_base = true, > > > +}; > > > + > > > +static const struct fsl_gpio_soc_data imx8ulp_data = { > > > + .have_paddr = true, > > > }; > > > > > > static const struct of_device_id vf610_gpio_dt_ids[] = { > > > - { .compatible = "fsl,vf610-gpio", .data = NULL, }, > > > + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, > > > { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, }, > > > + { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, > > > { /* sentinel */ } > > > }; > > > > > > @@ -263,19 +277,38 @@ static int vf610_gpio_probe(struct > > platform_device *pdev) > > > struct gpio_irq_chip *girq; > > > int i; > > > int ret; > > > + bool dual_base; > > > > > > port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); > > > if (!port) > > > return -ENOMEM; > > > > > > port->sdata = of_device_get_match_data(dev); > > > - port->base = devm_platform_ioremap_resource(pdev, 0); > > > - if (IS_ERR(port->base)) > > > - return PTR_ERR(port->base); > > > > > > - port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > > > - if (IS_ERR(port->gpio_base)) > > > - return PTR_ERR(port->gpio_base); > > > + dual_base = port->sdata->have_dual_base; > > > + > > > + /* support old compatible strings */ > > > + if (device_is_compatible(dev, "fsl,imx7ulp-gpio") && > > > + (device_is_compatible(dev, "fsl,imx93-gpio") || > > > > Why not just add this compatible to vf610_gpio_dt_ids? > > "fsl,imx93-gpio", "fsl,imx7ulp-gpio" is not a correct entry > combination. This is to support legacy old compatible > strings. The "/* support old compatible strings */" may a bit misleading here? Should we be a bit more verbose for the reader of the code, e.g.: /* * Handle legacy compatible combinations which used two * reg values for the i.MX8ULP and i.MX93. */ Regards, Marco > > Thanks, > Peng. > > > > Bart > > > > > + (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) > > > + dual_base = true; > > > + > > > + if (dual_base) { > > > + port->base = devm_platform_ioremap_resource(pdev, 0); > > > + if (IS_ERR(port->base)) > > > + return PTR_ERR(port->base); > > > + > > > + port->gpio_base = devm_platform_ioremap_resource(pdev, 1); > > > + if (IS_ERR(port->gpio_base)) > > > + return PTR_ERR(port->gpio_base); > > > + } else { > > > + port->base = devm_platform_ioremap_resource(pdev, 0); > > > + if (IS_ERR(port->base)) > > > + return PTR_ERR(port->base); > > > + > > > + port->gpio_base = port->base + IMX8ULP_GPIO_BASE_OFF; > > > + port->base = port->base + IMX8ULP_BASE_OFF; > > > + } > > > > > > port->irq = platform_get_irq(pdev, 0); > > > if (port->irq < 0) > > > > > > -- > > > 2.37.1 > > >
diff --git a/drivers/gpio/gpio-vf610.c b/drivers/gpio/gpio-vf610.c index dbc7ba0ee72c..8e12706c0b22 100644 --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@ -25,6 +25,7 @@ struct fsl_gpio_soc_data { /* SoCs has a Port Data Direction Register (PDDR) */ bool have_paddr; + bool have_dual_base; }; struct vf610_gpio_port { @@ -60,13 +61,26 @@ struct vf610_gpio_port { #define PORT_INT_EITHER_EDGE 0xb #define PORT_INT_LOGIC_ONE 0xc +#define IMX8ULP_GPIO_BASE_OFF 0x40 +#define IMX8ULP_BASE_OFF 0x80 + +static const struct fsl_gpio_soc_data vf610_data = { + .have_dual_base = true, +}; + static const struct fsl_gpio_soc_data imx_data = { .have_paddr = true, + .have_dual_base = true, +}; + +static const struct fsl_gpio_soc_data imx8ulp_data = { + .have_paddr = true, }; static const struct of_device_id vf610_gpio_dt_ids[] = { - { .compatible = "fsl,vf610-gpio", .data = NULL, }, + { .compatible = "fsl,vf610-gpio", .data = &vf610_data }, { .compatible = "fsl,imx7ulp-gpio", .data = &imx_data, }, + { .compatible = "fsl,imx8ulp-gpio", .data = &imx8ulp_data, }, { /* sentinel */ } }; @@ -263,19 +277,38 @@ static int vf610_gpio_probe(struct platform_device *pdev) struct gpio_irq_chip *girq; int i; int ret; + bool dual_base; port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL); if (!port) return -ENOMEM; port->sdata = of_device_get_match_data(dev); - port->base = devm_platform_ioremap_resource(pdev, 0); - if (IS_ERR(port->base)) - return PTR_ERR(port->base); - port->gpio_base = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(port->gpio_base)) - return PTR_ERR(port->gpio_base); + dual_base = port->sdata->have_dual_base; + + /* support old compatible strings */ + if (device_is_compatible(dev, "fsl,imx7ulp-gpio") && + (device_is_compatible(dev, "fsl,imx93-gpio") || + (device_is_compatible(dev, "fsl,imx8ulp-gpio")))) + dual_base = true; + + if (dual_base) { + port->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(port->base)) + return PTR_ERR(port->base); + + port->gpio_base = devm_platform_ioremap_resource(pdev, 1); + if (IS_ERR(port->gpio_base)) + return PTR_ERR(port->gpio_base); + } else { + port->base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(port->base)) + return PTR_ERR(port->base); + + port->gpio_base = port->base + IMX8ULP_GPIO_BASE_OFF; + port->base = port->base + IMX8ULP_BASE_OFF; + } port->irq = platform_get_irq(pdev, 0); if (port->irq < 0)