From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 701EBC4320A for ; Wed, 18 Aug 2021 13:07:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 336566102A for ; Wed, 18 Aug 2021 13:07:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 336566102A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NuAf32fIJUvWT2NEOz5+aaoVJj6sN4EccqeLSCc73Ic=; b=iUaLj13zWPTSLSmnsoVko2mXBa 6dkXVS984kLpH1/XXZvbY0+9N24QAAVFY7mll3I+oTweBYZePnxujtWl1mhmire03qb2tNwwzVxdo ZbrsKwNsZs52lAIYQVdtJjM8mO3erhCLJt6gCC7dUKoKGBIh+f9fcRVjjPNkduc2OWSGDsYu5peu9 eh5tHSag0yf13gIcIGSKIWaaCMNbRF9R3jghflGpE6dIVssl+roH/NC83Rd6QCVKdov+SApFUvtdl tc9rMtRecu+G+Zq3/uRsBWHEuGh0LcVRLgAaz7xl6/PSNjp8xZsI3RgxTB1tYutQGEuDbwcEdTMyR 3dg9Xo7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGLGJ-005dbQ-HR; Wed, 18 Aug 2021 13:05:43 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mGLG9-005dYM-8k for linux-arm-kernel@lists.infradead.org; Wed, 18 Aug 2021 13:05:39 +0000 Received: from gallifrey.ext.pengutronix.de ([2001:67c:670:201:5054:ff:fe8d:eefb] helo=[IPv6:::1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mGLG6-0002LF-3u; Wed, 18 Aug 2021 15:05:30 +0200 Subject: Re: [PATCH V3 3/3] gpio: modepin: Add driver support for modepin GPIO controller To: Piyush Mehta , "arnd@arndb.de" , "zou_wei@huawei.com" , "gregkh@linuxfoundation.org" , "linus.walleij@linaro.org" , Michal Simek , Jiaying Liang , "iwamatsu@nigauri.org" , "bgolaszewski@baylibre.com" , "robh+dt@kernel.org" , Rajan Vaja Cc: "devicetree@vger.kernel.org" , Srinivas Goud , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , git , Pengutronix Kernel Team , "linux-arm-kernel@lists.infradead.org" References: <20210818081018.2620544-1-piyush.mehta@xilinx.com> <20210818081018.2620544-4-piyush.mehta@xilinx.com> From: Ahmad Fatoum Message-ID: Date: Wed, 18 Aug 2021 15:05:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-SA-Exim-Connect-IP: 2001:67c:670:201:5054:ff:fe8d:eefb X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210818_060533_404503_2936226F X-CRM114-Status: GOOD ( 31.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Piyush, On 18.08.21 12:09, Piyush Mehta wrote: > Hi Ahmad, > > -----Original Message----- > From: Ahmad Fatoum > Sent: Wednesday, August 18, 2021 2:22 PM > To: Piyush Mehta ; arnd@arndb.de; zou_wei@huawei.com; gregkh@linuxfoundation.org; linus.walleij@linaro.org; Michal Simek ; Jiaying Liang ; iwamatsu@nigauri.org; bgolaszewski@baylibre.com; robh+dt@kernel.org; Rajan Vaja > Cc: linux-gpio@vger.kernel.org; devicetree@vger.kernel.org; git ; Srinivas Goud ; linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Pengutronix Kernel Team > Subject: Re: [PATCH V3 3/3] gpio: modepin: Add driver support for modepin GPIO controller > > On 18.08.21 10:10, Piyush Mehta wrote: >> This patch adds driver support for the zynqmp modepin GPIO controller. >> GPIO modepin driver set and get the value and status of the PS_MODE >> pin, based on device-tree pin configuration. These four mode pins are >> configurable as input/output. The mode pin has a control register, >> which have lower four-bits [0:3] are configurable as input/output, >> next four-bits can be used for reading the data as input[4:7], and >> next setting the output pin state output[8:11]. >> >> Signed-off-by: Piyush Mehta >> Acked-by: Michal Simek >> Reviewed-by: Linus Walleij >> --- > >> +/** >> + * modepin_gpio_dir_in - Set the direction of the specified GPIO pin as input >> + * @chip: gpio_chip instance to be worked on >> + * @pin: gpio pin number within the device >> + * >> + * Return: 0 always >> + */ >> +static int modepin_gpio_dir_in(struct gpio_chip *chip, unsigned int >> +pin) { >> + return 0; >> +} > > You say the gpio controller can configure pins as inputs or outputs. > These pins are controller via firmware driver. We are updating BOOT_PIN_CTRL 0xFF5E0250 register. > [0:3] = When 0, the pins will be inputs from the board to the PS. When 1, the PS will drive these pins Ok. So if you want to configure the pin as input, you should call zynqmp_pm_bootmode_write to write a zero into that bit. But there's only one zynqmp_pm_bootmode_write in the GPIO driver and it's in modepin_gpio_set_value, which does output, not input. If I understand you right, there should be a modepin_gpio_set_value in modepin_gpio_dir_in as well? > Yet, .direction_input is doing nothing. So, it's not clear to me, how this sequence could work: > > - set gpio output high (writes bootmode) > - set gpio to input (no-op, pin will remain high, not high impedance) This is a valid sequence for a GPIO consumer and I don't see how this GPIO driver could honor it. Could you clarify? Cheers, Ahmad > > > > > > > I didn't check the previous discussions, but if this indeed works as intended, the how should be written here into the driver. That is a more useful comment than kernel doc for a stub function. > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel