From patchwork Tue Apr 20 14:50:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 1468363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-secospa-onmicrosoft-com header.b=1Mo070dX; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FPmq53lJpz9vDx for ; Wed, 21 Apr 2021 00:51:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E0DCA82B27; Tue, 20 Apr 2021 16:51:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=secospa.onmicrosoft.com header.i=@secospa.onmicrosoft.com header.b="1Mo070dX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 75DF482B2B; Tue, 20 Apr 2021 16:51:23 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FORGED_SPF_HELO,MSGID_FROM_MTA_HEADER,SPF_HELO_PASS autolearn=no autolearn_force=no version=3.4.2 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e1a::622]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2C3A682B1D for ; Tue, 20 Apr 2021 16:51:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=seco.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sean.anderson@seco.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k4q0Bhi5/djk0iQqLsex8RKDlx/MKzZrtUxf3yjiQ13pb95Zq33HipiE9q5hcstZn1py5/sO4vu4shW5ldvXeBlp2rrc8xSsxO1+k4zwsYMaUgFhbNgA6rAae4kqy1gOC36AIs3YLUKhxOJv1PjRweiql0q+dmHsaLJ2fnBlPf6+c3U74aK18e1P1GYX05rqDBMen1KXOTYoTIwY269uLgVy9nYyyKk+pAb1YsEN81QqsxfCEwNHTZN5ePhmViSxxLmVu/a8brz4tH06V8dxLV3X5AFhODtHX6drn+LqyzKjHQVb3DO4xOzAN7L41iof7DJuF/zLm3mQCSJrvh38gw== 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=3JyonNOoyME2zzN5DY8DNrzRnQ1e1bedvPbZ4o8EcpM=; b=Hjo4EIX0iX2C4RPf92FKe1r/l/3IcjO6TWxt3nOZDkgIMZIB+9U13wVn9lrL8blFw/dopM6ckpfVM58cmzvnWPZW8j/KEP8ai92w2mjmQWqwMQ9YlZSw2k3ibJDxdmNMN0k1AXDwKPhNfpzsXJPqn2xv5ArCpz+Mfy/uuz+V8/fqD3zBZFwrxm+lUwr8n6LwsTs/TKTY7SNb1M1anovYMwyPRfIQgf9CY+7wnkUePS56dderagFTlqoUqVfRrI6G6Cf5H4RitGZgFPiW3UC493EJpYj/LjrYFZp86zT9oCalHd9eA7UZcGv4PrPzctTo7jyZ0GrYggC+lBOQFXqB1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secospa.onmicrosoft.com; s=selector2-secospa-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3JyonNOoyME2zzN5DY8DNrzRnQ1e1bedvPbZ4o8EcpM=; b=1Mo070dXR44gU3WSzaFzQkuUN6Zi5T/O96+r1aTg6bED8iK60ssE1G9zu7ixgjkXNavSovaoSZ60niommqM6lveeqdk4FKK8qxs9O+l2IIKfgDmzvN48NtVviN3HLwbxNbmC1gHe94YlA95WvBhMPd7f6oNeIXlziAg+NpBaNms= Authentication-Results: konsulko.com; dkim=none (message not signed) header.d=none;konsulko.com; dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) by DB9PR03MB7243.eurprd03.prod.outlook.com (2603:10a6:10:220::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Tue, 20 Apr 2021 14:51:15 +0000 Received: from DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::9181:c45f:b367:9bdc]) by DB7PR03MB4523.eurprd03.prod.outlook.com ([fe80::9181:c45f:b367:9bdc%5]) with mapi id 15.20.4065.020; Tue, 20 Apr 2021 14:51:15 +0000 From: Sean Anderson To: Tom Rini , u-boot@lists.denx.de Cc: Simon Glass , Sean Anderson , Alexandru Gagniuc , Bin Meng , Claudiu Manoil , Dario Binacchi , Etienne Carriere , Heiko Schocher , Jean-Jacques Hiblot , Marek Vasut , Mario Six , Michal Simek , Patrick Delaunay , Philippe Reynes , Pratyush Yadav , Wolfgang Wallner Subject: [PATCH v4 0/5] sysinfo: Add gpio sysinfo driver Date: Tue, 20 Apr 2021 10:50:53 -0400 Message-Id: <20210420145058.3934010-1-sean.anderson@seco.com> X-Mailer: git-send-email 2.25.1 X-Originating-IP: [50.195.82.171] X-ClientProxiedBy: BL1PR13CA0424.namprd13.prod.outlook.com (2603:10b6:208:2c3::9) To DB7PR03MB4523.eurprd03.prod.outlook.com (2603:10a6:10:19::27) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from plantagenet.inhand.com (50.195.82.171) by BL1PR13CA0424.namprd13.prod.outlook.com (2603:10b6:208:2c3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4065.8 via Frontend Transport; Tue, 20 Apr 2021 14:51:13 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7a54ea9e-9157-45ea-188a-08d9040bbf5a X-MS-TrafficTypeDiagnostic: DB9PR03MB7243: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K1YEQhTHfX06XjOyb7/a9tICpgMM9UEp9uwIfAaNHXHMph2QTCoPo+thAOhs0thH4ZNxzU7gLYSW+313GiGXb6ktT0WuMrIl8fButH6iY2ZyYo/0wH9DsGvJ3mLzN0AiJdRZtWY/HZ4qWPliEJ15FyMYyMbAeTig0KB2W8TD1TWHGKWG7NV647OWlpBcRrYBUAVsMv6aq+qhdyLupeEYN3ulTlIAli/5ClJBZVpbSC5D2DlgbncG/YdXzJwVD0I0ioPeiuYf1TvCH4VqN9ipEoHYtReYGNO4BKWEgos/qh7kriFSUnXS32/8t5AQHAH5rAfPx0AVxJrrBza1bkGym1O9h8y62NLeOZyJQMP8YgucdQ5MHZManICZ47ETYzrl89klT1I51ybmIPdn0W7aQ2sPC8gxUIhJPrde3z1U1qStYcRWFCvD509a3mAhxif0vMlIlzGsU/QVZlo5mWFDI22EtjPXstNtwkA0Mxr0ByKndK/wAicVm1M/tBXXKhuFCj2qum9TEd4EV/xwq8bQJgGLuwqBIQP5B8WQIAUfjLNaBSxV0kcdYiqV/zR0z2zf1+cpR1G8zZ7+zUFgRNysLqePq/jHV80KJIKyj5FB0mKUxK4GShEyqJwhYb5Chhcyd453mDfOA5V6yYS1TfDZyp0ZxnVVeE/fLG6CHlyz5TimmQKD5OrS9xp8tz8jPDwqCy3AZcfz/rq0QM79ekidKjreFlFyRQR00r8iuzuahyk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR03MB4523.eurprd03.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(16526019)(44832011)(498600001)(7416002)(8936002)(1076003)(966005)(2906002)(186003)(6486002)(86362001)(66946007)(38350700002)(66556008)(4326008)(6666004)(38100700002)(8676002)(6512007)(6506007)(66476007)(26005)(956004)(54906003)(83380400001)(5660300002)(2616005)(52116002)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: vqOgJFxLd5guurzFovbkdYypbFz54CWx6DivLEZmOVo53KQN8hu1JhEgPq22oSzrbKQE6REJQ8g2IgncsBltyvVYuBkNzqjxETkOnzaeL+tGs4JUR5aOPOnCyq9tWkcjd02hp5B6nNAQ9W13T6JsMnwxkjw63RxvEu9M94OEfjKOIXV79U62gePbgAXenidU62ecB2Z54qfi9amCTIJMgyoyAtKHXVX6ULET56iDe2jn/kwIgNFA40IT8Imgc0HEkxnvEaPU75594YW5/3cMKkhqh+B18RKgI9biYKeG+GRBMaLMeR0lelp7ZCCu0tnzSq1brRJSx2HAwho7KFhs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ea-188a-08d9040bbf5a X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4523.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2021 14:51:15.3028 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9qmi31ItMtrLGxKqRsSOUPh8pBGlL01xmG3EqYLpgb1lSQHBbtCbsRtopmZbpOSA8FRmqZ6izZo/LhsbXiZBkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR03MB7243 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean This series adds a GPIO sysinfo driver using the dm_gpio_get_values_as_int_base3 function. The board revision is mapped based in devicetree properties. This series is based on Simon's GPIO series [1]. [1] https://patchwork.ozlabs.org/project/uboot/list/?series=228126 Changes in v4: - Enable sysinfo_gpio test for sandbox - Fix test failure caused by uninitialized variable - Rebase onto u-boot/master Changes in v3: - Fix assuming any nonzero return of dev_count_phandle_with_args was an error. - Fix assuming nonzero return from dm_gpio_get_values_as_int_base3 is an error. - Move detected bool into sysinfo_priv struct - Rebase onto u-boot/next - Use SYSINFO_ID_BOARD_MODEL instead of SYSINFO_ID_REVISION Changes in v2: - Document sysinfo_gpio_priv - Enforce sysinfo detect ordering in uclass. Users must still call sysinfo_detect beforehand. - Fix unbalanced brace in sysinfo_gpio_get_int - Modify sysinfo test to check for detect() ordering. - Refactor driver to take advantage of the uclass detect ordering guarantee. - Reorder includes - Set BOARD_HWVERSION to SYSINFO_ID_REVISION, as they represent the same content. - Use enums instead of defines for sysinfo ids Sean Anderson (5): dm: gpio: Fix gpio_get_list_count failing with livetree sysinfo: Use global sysinfo IDs for existing sysinfo drivers sysinfo: Require that sysinfo_detect be called before other methods sysinfo: Add gpio-sysinfo driver test: Add gpio-sysinfo test arch/sandbox/dts/test.dts | 7 + common/spl/spl_fit.c | 4 + configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_noinst_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + .../sysinfo/gpio-sysinfo.txt | 37 +++++ drivers/gpio/gpio-uclass.c | 6 +- drivers/sysinfo/Kconfig | 8 + drivers/sysinfo/Makefile | 1 + drivers/sysinfo/gazerbeam.h | 8 +- drivers/sysinfo/gpio.c | 141 ++++++++++++++++++ drivers/sysinfo/sandbox.h | 2 +- drivers/sysinfo/sysinfo-uclass.c | 29 +++- include/sysinfo.h | 26 ++-- test/dm/Makefile | 1 + test/dm/sysinfo-gpio.c | 69 +++++++++ test/dm/sysinfo.c | 25 ++-- 19 files changed, 342 insertions(+), 27 deletions(-) create mode 100644 doc/device-tree-bindings/sysinfo/gpio-sysinfo.txt create mode 100644 drivers/sysinfo/gpio.c create mode 100644 test/dm/sysinfo-gpio.c