From patchwork Fri May 29 21:38:06 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 1301028
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=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;
envelope-from=u-boot-bounces@lists.denx.de; receiver=)
Authentication-Results: ozlabs.org;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: ozlabs.org;
dkim=pass (1024-bit key;
unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256
header.s=ti-com-17Q1 header.b=EVgvdCkP;
dkim-atps=neutral
Received: from phobos.denx.de (phobos.denx.de
[IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])
(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 49YdJW34Xvz9sRN
for ; Sat, 30 May 2020 07:39:55 +1000 (AEST)
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
by phobos.denx.de (Postfix) with ESMTP id 362248067C;
Fri, 29 May 2020 23:39:52 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.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=ti.com header.i=@ti.com header.b="EVgvdCkP";
dkim-atps=neutral
Received: by phobos.denx.de (Postfix, from userid 109)
id B594E80680; Fri, 29 May 2020 23:39:50 +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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED
autolearn=ham autolearn_force=no version=3.4.2
Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249])
(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 506FE80679
for ; Fri, 29 May 2020 23:39:47 +0200 (CEST)
Authentication-Results: phobos.denx.de;
dmarc=pass (p=quarantine dis=none) header.from=ti.com
Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=p.yadav@ti.com
Received: from fllv0035.itg.ti.com ([10.64.41.0])
by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 04TLdjXZ040072;
Fri, 29 May 2020 16:39:45 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1590788385;
bh=6U6CdgR0PziWDXxPkyZVVgtCznNsulC9bvkKurQVQYI=;
h=From:To:CC:Subject:Date;
b=EVgvdCkPPuiQuO/J8CLa/OJDKKO5VBwESqKykTlicH7o32HZJhBkbCNq/mgmUkDkM
UyySYrC/iDRnJqjRjrtU05VOJWoX1m+KRB7q8qpEcg+gBgmzloD5PjE+fdhldl9pQc
ZBzFt+LYh+ZC5iJqly1KcFRrZAuBWM1QqNDaNlTA=
Received: from DFLE111.ent.ti.com (dfle111.ent.ti.com [10.64.6.32])
by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04TLdj5r009351;
Fri, 29 May 2020 16:39:45 -0500
Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE111.ent.ti.com
(10.64.6.32) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 29
May 2020 16:38:11 -0500
Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE102.ent.ti.com
(10.64.6.23) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via
Frontend Transport; Fri, 29 May 2020 16:38:11 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 04TLc9Rn078414;
Fri, 29 May 2020 16:38:10 -0500
From: Pratyush Yadav
To: Simon Glass ,
CC: Pratyush Yadav , Vignesh Raghavendra ,
Sekhar Nori
Subject: [PATCH v2 0/2] gpio: Add a managed API
Date: Sat, 30 May 2020 03:08:06 +0530
Message-ID: <20200529213808.2815-1-p.yadav@ti.com>
X-Mailer: git-send-email 2.25.0
MIME-Version: 1.0
X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180
X-BeenThere: u-boot@lists.denx.de
X-Mailman-Version: 2.1.30rc1
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.2 at phobos.denx.de
X-Virus-Status: Clean
Hi,
This is a re-submission of Jean-Jacques' earlier work in October last
year. It can be found at [0]. The goal is to facilitate porting drivers
from the linux kernel. Most of the series will be about adding managed
API to existing infrastructure (GPIO, reset, regmap (already
submitted)).
This particular series is about GPIOs. It adds a managed API using the
API as Linux. To make it 100% compatible with linux, there is a small
deviation from u-boot's way of naming the gpio lists: the managed
equivalent of gpio_request_by_name(..,"blabla-gpios", ...) is
devm_gpiod_get_index(..., "blabla", ...)
Changes in v2:
- The original series had a patch that checked for NULL pointers in the
core GPIO functions. The checks were needed because of the addition of
devm_gpiod_get_index_optional() which would return NULL when when no
GPIO was assigned to the requested function. This is convenient for
drivers that need to handle optional GPIOs.
Simon argued that those should be behind a Kconfig option because of
code size concerns. He also argued against implicit return in the
macro that checked for the optional GPIOs.
This submission removes the controversial patch so that base
functionality can get unblocked.
We still need to take a stance on who is responsible for the NULL
check: the driver or the GPIO core? Do we want to trust drivers to
take care of the NULL checks, or do we want to distrust them and make
sure they don't send us anything bogus in the GPIO core. For now the
responsibility lies on the drivers by default. I will send a separate
RFC of the NULL check patch and we can probably discuss the issue
there.
[0] https://patchwork.ozlabs.org/project/uboot/cover/20191001115130.18886-1-jjhiblot@ti.com/
Jean-Jacques Hiblot (2):
drivers: gpio: Add a managed API to get a GPIO from the device-tree
test: gpio: Add tests for the managed API
arch/sandbox/dts/test.dts | 10 ++++
drivers/gpio/gpio-uclass.c | 70 +++++++++++++++++++++++++
include/asm-generic/gpio.h | 47 +++++++++++++++++
test/dm/gpio.c | 102 +++++++++++++++++++++++++++++++++++++
4 files changed, 229 insertions(+)
---
2.26.2