Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp193684rdb; Thu, 5 Oct 2023 23:49:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5Z2631HZnkbHH5Z9hAMIPE34YsjoVZCJ2pCNp6GAWvFzA4QfST97HHVGqns4QCKHzKgmA X-Received: by 2002:a05:6a00:1392:b0:692:6d3f:483f with SMTP id t18-20020a056a00139200b006926d3f483fmr8807356pfg.27.1696574951440; Thu, 05 Oct 2023 23:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696574951; cv=none; d=google.com; s=arc-20160816; b=J57csBDYzJWxQOy7zvHWgv5DS2AqDFbDRDJx1v1WGQGrpb+Of+k95G4FyFwWIKoKKr PR+Jft1XTOH8eZqTgB5I9jvHareQH1LFnzEPFCeWTu5HJr4fJcimjNor8J14EQvBzweQ 1av84sScFvpvWH6qDAyTb5EGIACQ0eC8JdtY9eYcPu4NANT5tVnpnoXN+nko801HvBK9 4JdtcPRkYD68OSy0xSzot5s0McdZmD25u4my1HsciOFLgkb7UafCSEjqx1nN0KcarsAf vgDDpVNFIFWc/LM1nOqXyGAhX1JvKKXgSu/m5rF01v1HYi+crcL2rJPGV5C6j36ZEVUW 9NAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mO/HF0HBlJ2Jej01g1aJHNBVplRdvJlEtkw7wkfb7oc=; fh=bD0irRExCR9U/CdLuI02LRr7jOWxzGkti19Icxfbv34=; b=DyC7hvYWk9RSQkKVhjQEt3gld0PYJfYz7J/eZ2F1v7l6zPQKgEM8rH2lpyY5RTrvKW kbRggBuxld5LhAMs2G6SJqk6N6RHCVm+bnE1QX3IGNASjS3+Z5qYAVxZ1dm+AJp4ELaf Ux8ak5CGWesvd3BdACXazXzgiVtsHGguLCSS2fjJ3xPNg/iporGwB2DDiovHyR3YlPIg mOESZvTtq3gfFcyLusnjPkqGs9YSvF5slFs84KqZhHi8mdyCPde2nipskc2WszhdFlSC KCO+7EBl6KdaE803mqaatHPB1aeJflEjC91bzA6DTLPalR+XNPAfhofRPaUJhkUQX1NQ 8zbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=n9VfNPG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id ea20-20020a056a004c1400b0068fe12efae9si890500pfb.15.2023.10.05.23.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 23:49:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=n9VfNPG4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2B46F80CD710; Thu, 5 Oct 2023 23:49:09 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229650AbjJFGtA (ORCPT + 99 others); Fri, 6 Oct 2023 02:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbjJFGs6 (ORCPT ); Fri, 6 Oct 2023 02:48:58 -0400 Received: from mail-vk1-xa29.google.com (mail-vk1-xa29.google.com [IPv6:2607:f8b0:4864:20::a29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19556F0 for ; Thu, 5 Oct 2023 23:48:57 -0700 (PDT) Received: by mail-vk1-xa29.google.com with SMTP id 71dfb90a1353d-49dd3bb5348so719803e0c.0 for ; Thu, 05 Oct 2023 23:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1696574936; x=1697179736; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mO/HF0HBlJ2Jej01g1aJHNBVplRdvJlEtkw7wkfb7oc=; b=n9VfNPG43PZykPiJD9d/kOVQZJ+Ok4amJ7LFHcRq4SeymchD72kUOoB63ixgxRXZKf JTz3sljJDPWIvW8OuOFmihmVuwNe5/IZWQbAGDAlrXVv1MrMv4AdWui0q2UD8e73DAum SBmx9FxGZHcu/Y+TrTd9aLhTHrYny0DC06/3mKmtDu+hewf9zooOb7FF507DKnqvYIuc yIgla7cwuZxeq2aM/gQ7qELzaAIk87ATXPQ4Rs9X543OakX3rb244auYay80MnBf4WDl bGlG9zrzS8n4nEaKozCfToSS2MgqlkCs/acZAchSyl6ROtIkltCOLL6zDSA/Nnd3GAGG ciTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696574936; x=1697179736; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mO/HF0HBlJ2Jej01g1aJHNBVplRdvJlEtkw7wkfb7oc=; b=crFs8CV9cHa1r8nsExlLgJM2GF0k3yjUWrvnlIwffA6GjNJPh3h/BJ79duqNk9SBwZ 4vQVABpky71xMYGop4t9Tqo8bfSeJdI0EkgVlUh2f1VvZc6flvkMJvPz4647WeTOo8mf ztduHJsWRpFDMpyVyt43s7dKzDojGfMEAB4DEQME7WmvL6h5qnxguHQtHRbztarszCP1 QX65DX5q2TwV7muPDV+g3wdNtbGzDMsvtF+N1pss3UEy0SKWh1LqMNyNOXVR95FnvAqR UFpcDcXhmglBCzub1EdAfoXF4HmpB7Po68wuQ0qwyTwpRjF8NBS5yrlhH5nMB1pHHOK7 gr8Q== X-Gm-Message-State: AOJu0Yxf8BQ37GWNgQHwUu9Swxo44E288Lon0iOl1bTvcIabUcoF7s7m OMDctmEt2ZMzomEdbqoEEY3LSL11Cwm57qrQS/Aw/Q== X-Received: by 2002:a1f:cbc5:0:b0:49d:9916:5747 with SMTP id b188-20020a1fcbc5000000b0049d99165747mr7103460vkg.13.1696574936048; Thu, 05 Oct 2023 23:48:56 -0700 (PDT) MIME-Version: 1.0 References: <20231004-pxa-gpio-v5-0-d99ae6fceea8@skole.hr> <20231004-pxa-gpio-v5-1-d99ae6fceea8@skole.hr> In-Reply-To: <20231004-pxa-gpio-v5-1-d99ae6fceea8@skole.hr> From: Bartosz Golaszewski Date: Fri, 6 Oct 2023 08:48:45 +0200 Message-ID: Subject: Re: [PATCH RFC v5 1/6] ARM: pxa: Convert Spitz OHCI to GPIO descriptors To: =?UTF-8?Q?Duje_Mihanovi=C4=87?= Cc: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Russell King , Alan Stern , Greg Kroah-Hartman , Linus Walleij , Andy Shevchenko , Dmitry Torokhov , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-input@vger.kernel.org, linux-spi@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 05 Oct 2023 23:49:09 -0700 (PDT) On Wed, Oct 4, 2023 at 4:56=E2=80=AFPM Duje Mihanovi=C4=87 wrote: > > Sharp's Spitz board still uses the legacy GPIO interface for controlling > a GPIO pin related to the USB host controller. > > Convert this function to use the new GPIO descriptor interface. > > Reviewed-by: Linus Walleij > Signed-off-by: Duje Mihanovi=C4=87 > --- > arch/arm/mach-pxa/spitz.c | 13 ++++++------- > drivers/usb/host/ohci-pxa27x.c | 7 +++++++ > 2 files changed, 13 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c > index cc691b199429..535e2b2e997b 100644 > --- a/arch/arm/mach-pxa/spitz.c > +++ b/arch/arm/mach-pxa/spitz.c > @@ -649,23 +649,22 @@ static inline void spitz_mmc_init(void) {} > * USB Host > ***********************************************************************= *******/ > #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) > +GPIO_LOOKUP_SINGLE(spitz_usb_host_gpio_table, "pxa27x-ohci", "gpio-pxa", > + SPITZ_GPIO_USB_HOST, "usb-host", GPIO_ACTIVE_LOW); > + > static int spitz_ohci_init(struct device *dev) > { > - int err; > - > - err =3D gpio_request(SPITZ_GPIO_USB_HOST, "USB_HOST"); > - if (err) > - return err; > + gpiod_add_lookup_table(&spitz_usb_host_gpio_table); > > /* Only Port 2 is connected, setup USB Port 2 Output Control Regi= ster */ > UP2OCR =3D UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE= ; > > - return gpio_direction_output(SPITZ_GPIO_USB_HOST, 1); > + return 0; > } > > static void spitz_ohci_exit(struct device *dev) > { > - gpio_free(SPITZ_GPIO_USB_HOST); > + gpiod_remove_lookup_table(&spitz_usb_host_gpio_table); > } > > static struct pxaohci_platform_data spitz_ohci_platform_data =3D { > diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27= x.c > index 357d9aee38a3..876842b940c0 100644 > --- a/drivers/usb/host/ohci-pxa27x.c > +++ b/drivers/usb/host/ohci-pxa27x.c > @@ -121,6 +121,7 @@ struct pxa27x_ohci { > void __iomem *mmio_base; > struct regulator *vbus[3]; > bool vbus_enabled[3]; > + struct gpio_desc *usb_host; > }; > > #define to_pxa27x_ohci(hcd) (struct pxa27x_ohci *)(hcd_to_ohci(hcd)->= priv) > @@ -447,6 +448,10 @@ static int ohci_hcd_pxa27x_probe(struct platform_dev= ice *pdev) > pxa_ohci =3D to_pxa27x_ohci(hcd); > pxa_ohci->clk =3D usb_clk; > pxa_ohci->mmio_base =3D (void __iomem *)hcd->regs; > + pxa_ohci->usb_host =3D gpiod_get_optional(&pdev->dev, "usb-host",= GPIOD_OUT_LOW); Any reason not to use devm_gpiod_get_optional()? Bart > + if (IS_ERR(pxa_ohci->usb_host)) > + return dev_err_probe(&pdev->dev, PTR_ERR(pxa_ohci->usb_ho= st), > + "failed to get USB host GPIO\n"); > > for (i =3D 0; i < 3; ++i) { > char name[6]; > @@ -512,6 +517,8 @@ static void ohci_hcd_pxa27x_remove(struct platform_de= vice *pdev) > for (i =3D 0; i < 3; ++i) > pxa27x_ohci_set_vbus_power(pxa_ohci, i, false); > > + gpiod_put(pxa_ohci->usb_host); > + > usb_put_hcd(hcd); > } > > > -- > 2.42.0 > >