From patchwork Fri Jul 3 12:21:22 2020
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pratyush Yadav
X-Patchwork-Id: 1322354
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=MwyT1XK+;
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) server-digest
SHA256)
(No client certificate requested)
by ozlabs.org (Postfix) with ESMTPS id 49yvGS2TKfz9sPF
for ; Fri, 3 Jul 2020 22:21:50 +1000 (AEST)
Received: from h2850616.stratoserver.net (localhost [IPv6:::1])
by phobos.denx.de (Postfix) with ESMTP id 08C1881B47;
Fri, 3 Jul 2020 14:21:37 +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="MwyT1XK+";
dkim-atps=neutral
Received: by phobos.denx.de (Postfix, from userid 109)
id EB36081B7F; Fri, 3 Jul 2020 14:21:34 +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,RCVD_IN_MSPIKE_H3,
RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham
autolearn_force=no version=3.4.2
Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142])
(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 A29DC80E58
for ; Fri, 3 Jul 2020 14:21:30 +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 fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 063CLSUo114140;
Fri, 3 Jul 2020 07:21:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com;
s=ti-com-17Q1; t=1593778888;
bh=kpGmGL5louRgV4MVDCyJK3ipnQLGNGXbI5hxAss0mqA=;
h=From:To:CC:Subject:Date;
b=MwyT1XK+DhwD5ePKd9gla7Lm1gDKzYOjRTvpYLgOUdiId3qdL+yh5dyX0Z5RmYPXg
sUwgTHOF5BK47D2KCuKob0RKn/L1WdeDvu7lesjxKwj1vJj/tVRZGepNpoh0zf1IQ+
J6LpTTOacshiKC8iqu3O9qHotPm6qCTFfRHXK0Pk=
Received: from DLEE115.ent.ti.com (dlee115.ent.ti.com [157.170.170.26])
by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTP id 063CLS8W088750;
Fri, 3 Jul 2020 07:21:28 -0500
Received: from DLEE105.ent.ti.com (157.170.170.35) by DLEE115.ent.ti.com
(157.170.170.26) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Fri, 3 Jul
2020 07:21:27 -0500
Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE105.ent.ti.com
(157.170.170.35) 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, 3 Jul 2020 07:21:27 -0500
Received: from pratyush-OptiPlex-790.dhcp.ti.com (ileax41-snat.itg.ti.com
[10.172.224.153])
by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 063CLPaR060615;
Fri, 3 Jul 2020 07:21:26 -0500
From: Pratyush Yadav
To: Simon Glass ,
CC: Pratyush Yadav , Vignesh Raghavendra ,
Sekhar Nori
Subject: [PATCH v3 0/2] gpio: Add a managed API
Date: Fri, 3 Jul 2020 17:51:22 +0530
Message-ID: <20200703122124.29854-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.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.3 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 fount 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 v3:
- Add a blank line before return in devm_gpiod_get_index().
- Add Simon's Reviwed-by in both patches.
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 merged.
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. 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 | 71 ++++++++++++++++++++++++++
include/asm-generic/gpio.h | 47 +++++++++++++++++
test/dm/gpio.c | 102 +++++++++++++++++++++++++++++++++++++
4 files changed, 230 insertions(+)
---
2.27.0