Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3634C433F5 for ; Fri, 4 Feb 2022 15:38:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1805D836C1; Fri, 4 Feb 2022 16:38:26 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=ibm.com header.i=@ibm.com header.b="nzAGgPRM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0EA3183A2D; Fri, 4 Feb 2022 16:36:45 +0100 (CET) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 CE9C6839FB for ; Fri, 4 Feb 2022 16:36:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eajames@linux.ibm.com Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 214EZW2I021989; Fri, 4 Feb 2022 15:36:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=edOe2/vkQkBLqKP5l2XuLPDSWJX6LJCzv3yikA+hWCs=; b=nzAGgPRM7LYKLk8ttmI1XzyKHWqLjHWn2bn1qRDrHWHNyPq06v/M4eUv2N1cjc/AOorL i1D8lsEzzMWVzNA2qsqQXa3ujlQHXaI9yTxfO+QII4nA5HoE8bpJ+jSjt047MUPUi0tI goQxYRkiF2ww9DqqS3Q9F8GOhdzFuNo0opY0mYwJ3Ir1hmlDgOhaY0yOzFyUKUDsE9y0 zCbNdJp/xxQXsq9IiiWcfJS5eqi6mmI3G63SBZCJiUpyvL4jwU1PJMn3yrfn3CecqBJP zqszKtSAju/fcdNbiGtINzoVvw1hhr3fycQKp/2rjM22n+Xl2pFrV9C2+xMm1PZWOpPL Mw== Received: from ppma03wdc.us.ibm.com (ba.79.3fa9.ip4.static.sl-reverse.com [169.63.121.186]) by mx0a-001b2d01.pphosted.com with ESMTP id 3e0qx40enm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 15:36:35 +0000 Received: from pps.filterd (ppma03wdc.us.ibm.com [127.0.0.1]) by ppma03wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 214FXNq4006670; Fri, 4 Feb 2022 15:36:34 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma03wdc.us.ibm.com with ESMTP id 3e0r0y59d9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 04 Feb 2022 15:36:34 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 214FaXEb20972020 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 4 Feb 2022 15:36:33 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0C2EF124053; Fri, 4 Feb 2022 15:36:33 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5774C124058; Fri, 4 Feb 2022 15:36:32 +0000 (GMT) Received: from [9.211.47.242] (unknown [9.211.47.242]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 4 Feb 2022 15:36:32 +0000 (GMT) Message-ID: <18343b63-d8f5-3e3e-b425-ce1c6985a166@linux.ibm.com> Date: Fri, 4 Feb 2022 09:36:31 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH] gpio: Enable hogging support in SPL Content-Language: en-US To: Simon Glass Cc: U-Boot Mailing List , Andrew Jeffery References: <20220203223724.38587-1-eajames@linux.ibm.com> From: Eddie James In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: goXhLbHrP8zgWpTHp-WGjms434Okvcak X-Proofpoint-GUID: goXhLbHrP8zgWpTHp-WGjms434Okvcak X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.816,Hydra:6.0.425,FMLib:17.11.62.513 definitions=2022-02-04_07,2022-02-03_01,2021-12-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 lowpriorityscore=0 phishscore=0 clxscore=1015 impostorscore=0 adultscore=0 mlxscore=0 spamscore=0 suspectscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2202040086 X-Mailman-Approved-At: Fri, 04 Feb 2022 16:38:25 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean On 2/4/22 09:24, Simon Glass wrote: > Hi Eddie, > > On Thu, 3 Feb 2022 at 15:37, Eddie James wrote: >> Use the CONFIG macros to conditionally build the GPIO hogging support in >> either the SPL or U-Boot, or both, depending on the configuration. Also >> call the GPIO hog probe function in the common SPL board initialization >> as an equivalent to adding it to the U-Boot init sequence functions. >> >> Signed-off-by: Eddie James >> --- >> common/spl/spl.c | 7 +++++++ >> drivers/gpio/Kconfig | 10 ++++++++++ >> drivers/gpio/gpio-uclass.c | 10 ++++++---- >> 3 files changed, 23 insertions(+), 4 deletions(-) >> >> diff --git a/common/spl/spl.c b/common/spl/spl.c >> index 884102bdea..f667908eec 100644 >> --- a/common/spl/spl.c >> +++ b/common/spl/spl.c >> @@ -20,6 +20,9 @@ >> #include >> #include >> #include >> +#if defined(CONFIG_SPL_GPIO_HOG) > Can you drop this ifdef? Sure. > >> +#include >> +#endif >> #include >> #include >> #include >> @@ -739,6 +742,10 @@ void board_init_r(gd_t *dummy1, ulong dummy2) >> } >> } >> >> +#if defined(CONFIG_SPL_GPIO_HOG) >> + gpio_hog_probe_all(); >> +#endif > if (CONFIG_IS_ENABLED(GPIO_HOG)) Ack. > ... > >> + >> #if CONFIG_IS_ENABLED(BOARD_INIT) >> spl_board_init(); >> #endif >> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig >> index 305a2dc563..4da2bdc10d 100644 >> --- a/drivers/gpio/Kconfig >> +++ b/drivers/gpio/Kconfig >> @@ -57,6 +57,16 @@ config GPIO_HOG >> is a mechanism providing automatic GPIO request and config- >> uration as part of the gpio-controller's driver probe function. >> >> +config SPL_GPIO_HOG >> + bool "Enable GPIO hog support in SPL" >> + depends on SPL_GPIO_SUPPORT > Should it depend on GPIO_HOG? I'm not sure, just a question No, this way the gpio hog support can be configured for either SPL or U-Boot or both. They are the same option just in the different builds. Thanks for the review, Eddie > > >> + default n >> + help >> + Enable gpio hog support in SPL >> + The GPIO chip may contain GPIO hog definitions. GPIO hogging >> + is a mechanism providing automatic GPIO request and config- >> + uration as part of the gpio-controller's driver probe function. >> + >> config DM_GPIO_LOOKUP_LABEL >> bool "Enable searching for gpio labelnames" >> depends on DM_GPIO >> diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c >> index 125ae53d61..bebba620c9 100644 >> --- a/drivers/gpio/gpio-uclass.c >> +++ b/drivers/gpio/gpio-uclass.c >> @@ -1432,9 +1432,6 @@ void devm_gpiod_put(struct udevice *dev, struct gpio_desc *desc) >> >> static int gpio_post_bind(struct udevice *dev) >> { >> - struct udevice *child; >> - ofnode node; >> - >> #if defined(CONFIG_NEEDS_MANUAL_RELOC) >> struct dm_gpio_ops *ops = (struct dm_gpio_ops *)device_get_ops(dev); >> static int reloc_done; >> @@ -1465,7 +1462,11 @@ static int gpio_post_bind(struct udevice *dev) >> } >> #endif >> >> - if (CONFIG_IS_ENABLED(OF_REAL) && IS_ENABLED(CONFIG_GPIO_HOG)) { >> +#if CONFIG_IS_ENABLED(GPIO_HOG) >> + { >> + struct udevice *child; >> + ofnode node; >> + >> dev_for_each_subnode(node, dev) { >> if (ofnode_read_bool(node, "gpio-hog")) { >> const char *name = ofnode_get_name(node); >> @@ -1480,6 +1481,7 @@ static int gpio_post_bind(struct udevice *dev) >> } >> } >> } >> +#endif >> return 0; >> } >> >> -- >> 2.27.0 >>