From patchwork Thu Aug 8 21:22:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 170846 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9116212ile; Thu, 8 Aug 2019 14:26:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqypkJVDH+h/MpBCriKUQnh/cDhvoNuH85pVfrEHO+Kxk7B7c6k9nkXLjy0fQg8N5qOadI8c X-Received: by 2002:a63:1749:: with SMTP id 9mr14795784pgx.0.1565299564083; Thu, 08 Aug 2019 14:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565299564; cv=none; d=google.com; s=arc-20160816; b=vtKmV26fTmPx+Ehsu5t1gK6kvE1stF0GPsIfmGH08seO70FfeE8kK2e8CFFqaHzZk7 R3vc4sH0PWnH5PtmZoyKrZTHRXPRZuO6LTUuI6WNcBpILVdMEcvOQqIcz3ZwsZm2ZaL/ l2cCT1OnGL+aEXlmzRN3Su99f+C/FQDM5j3KMlfvUQrpqpaXpTJr3OXaiMn9oKQrdSgR OC0shdLIogRurIo5nMe13uczH8gzUMgcTJqqs/HEtCG4Yop0YAdwf8WD0XsNRTgOSoT2 HnwKYGMXFdkMhccAYqngPqmBUj3vrUP0GR9UX3hA1VKDp1dORNxRlkT5wllz4PsNgOJp 1otw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=l4u64pnobZAUCMRoNNjb47SRkt50+b3p2gCuGVn2dA0=; b=WL2cOjxD7TXZpY1hNRABddr3H2dFH6K6IaQzA1HLzmaaAMb88jcAcTygS704zXNBCL +q8H5UqGC+2l5Go8lwkaqs2+ysyXfL2kcOx5Zx73gQ2fB0nrXwsbsOAFhEdRzWkp2KAI +RH7Fmyu4wsiZWf4Bhn+nz3/yQVys0MxNfXQMzkWeqv7Ut5MfWXIBfWaOHs61HRd/E2c +hoFV0D6VMtPA2y4wdgfknyjNZ/cbXzfuW/7l+A0JpE7kqBklmr3DNfSyvhGtRLWi/NY x/a4zAipKiOhgPbnJoKR+ss81PKj3yknp885KweTbbGpxco7ysVAQwN/HImIZnnx9ptk OdWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s66si57037900pfs.120.2019.08.08.14.26.03; Thu, 08 Aug 2019 14:26:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404223AbfHHV0C (ORCPT + 28 others); Thu, 8 Aug 2019 17:26:02 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:55247 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732327AbfHHV0C (ORCPT ); Thu, 8 Aug 2019 17:26:02 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mw9oq-1iCGs209Ey-00s26z; Thu, 08 Aug 2019 23:25:38 +0200 From: Arnd Bergmann To: Tony Lindgren , Aaro Koskinen , Alan Stern , Greg Kroah-Hartman Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Linus Walleij , Bartlomiej Zolnierkiewicz , Tomi Valkeinen , Arnd Bergmann , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 04/22] ARM: omap1: move ohci phy power handling to board files Date: Thu, 8 Aug 2019 23:22:13 +0200 Message-Id: <20190808212234.2213262-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190808212234.2213262-1-arnd@arndb.de> References: <20190808212234.2213262-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:JOVFoCl4IruBbAq2/W1OlJMnj12jnk0BHfRQXLRVUPvFZ/BkWjI uD870aw7Nu4aFsXKVZbyOS2BCbOqI07ZhFAWvSwi4NG4uZ1+QamwJP0M6iA8Jg5QY+yKiJ9 FFGQEDAlfr7xfXu1qdu6NG5x3iX8cZp+MSbat54QEbZgActZKFxkdfnbAn/mrCp0j7TFIgV ut/HF1/KnWdMc3jRtw0bQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Jn6kNrwoVF4=:pCDRiVB9Isdg8kO0ofwjp2 soKcsJ+YtWwpsoePvFK1hEhCFfG56WIGFwrUfTlQeOfHiZdg9FMCwe4dEEmrZFIfWtSXwLYZc WumvnzBi1xjf75bSlL4sAxaGa8HwBy8H53910AwuWPrsax6RHBLYdxL1ptcCd+w7ba1HxGvsA 5nxXrpTUYNKeo7ZiW09lDNQpFPGgWbpr/AQMvPAl14ocFTTgKL1XPramCztSH2CB/LtyGesCZ 7Osuk84eDaQ4mK4VJJq1wnJLZRSp7Z8hrK0RuzIuCq68iyJO94QOdfX6EG+QzmQrj0L9LlAkO nKQ3ikWxui4qBk+L1m/LM5NDm5YI2hAAZsSjO2PGCyBa6UFAW4z438Db0iETqhFul4zdi2tdG EfAniHmbEJwIMUZVz/4ECg2KqpPdfYkadSr82eHYTup/SM9skbd1b5cY6Icz7GIXwOXrx8tIy 2qRpX8J25iLXTVN+N5Dk0v4UQ8AOYJSf9qi1afc4IMCNeVbMRHw4ZXxCEM9lMI2tDHEKJD18d /THATWQ/ZJNHp0TAk7HNXwum++xETK3EoAtWNonxczmYFVpM//uB2LZe6u3VzyByA3r2essjt pPhcw9L1rBZmthSiIfGfGqcPOC+CvOd0vCVB01+3BYD/xjzOB3KeCLnWlVZ+UqKaTePFFi+Hv 80npCWaPfK8bSnEF5dgXWnwbLLKVbzfDiwaM2dGp/f5xKmLD16Ma/iO7L25I4r5xxQa/Icebm 4Bx5L+EzhOBSXP8MutPHKlSKQDG63P9nKXRO2A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Two boards require a a special handler to control their transceiver power. Move the corresponding code into the board files and out of the common code. The osk board already has a dependency on TPS65010, this adds another one, with the same hack to get it to compile with CONFIG_TPS65010=m. Signed-off-by: Arnd Bergmann --- arch/arm/mach-omap1/board-innovator.c | 19 +++++++++++++++++ arch/arm/mach-omap1/board-osk.c | 19 +++++++++++++++++ drivers/usb/host/ohci-omap.c | 28 ++----------------------- include/linux/platform_data/usb-omap1.h | 2 ++ 4 files changed, 42 insertions(+), 26 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c index 2425f1bacb33..653af63320a8 100644 --- a/arch/arm/mach-omap1/board-innovator.c +++ b/arch/arm/mach-omap1/board-innovator.c @@ -290,6 +290,23 @@ static void __init innovator_init_smc91x(void) } #ifdef CONFIG_ARCH_OMAP15XX +/* + * Board specific gang-switched transceiver power on/off. + */ +static int innovator_omap_ohci_transceiver_power(int on) +{ + if (on) + __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) + | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), + INNOVATOR_FPGA_CAM_USB_CONTROL); + else + __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) + & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), + INNOVATOR_FPGA_CAM_USB_CONTROL); + + return 0; +} + static struct omap_usb_config innovator1510_usb_config __initdata = { /* for bundled non-standard host and peripheral cables */ .hmc_mode = 4, @@ -300,6 +317,8 @@ static struct omap_usb_config innovator1510_usb_config __initdata = { .register_dev = 1, .pins[0] = 2, + + .transceiver_power = innovator_omap_ohci_transceiver_power, }; static const struct omap_lcd_config innovator1510_lcd_config __initconst = { diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c index 4df15e693b6e..3be7b3b580d3 100644 --- a/arch/arm/mach-omap1/board-osk.c +++ b/arch/arm/mach-omap1/board-osk.c @@ -278,6 +278,23 @@ static void __init osk_init_cf(void) irq_set_irq_type(gpio_to_irq(62), IRQ_TYPE_EDGE_FALLING); } +/* + * Board specific gang-switched transceiver power on/off. + * NOTE: OSK supplies power from DC, not battery. + */ +static int osk_omap_ohci_transceiver_power(int on) +{ + if (!IS_BUILTIN(CONFIG_TPS65010)) + return -ENXIO; + + if (on) + tps65010_set_gpio_out_value(GPIO1, LOW); + else + tps65010_set_gpio_out_value(GPIO1, HIGH); + + return 0; +} + static struct omap_usb_config osk_usb_config __initdata = { /* has usb host connector (A) ... for development it can also * be used, with a NONSTANDARD gender-bending cable/dongle, as @@ -292,6 +309,8 @@ static struct omap_usb_config osk_usb_config __initdata = { .rwc = 1, #endif .pins[0] = 2, + + .transceiver_power = osk_omap_ohci_transceiver_power, }; #ifdef CONFIG_OMAP_OSK_MISTRAL diff --git a/drivers/usb/host/ohci-omap.c b/drivers/usb/host/ohci-omap.c index f7efe65f01c5..e92ef3231f2c 100644 --- a/drivers/usb/host/ohci-omap.c +++ b/drivers/usb/host/ohci-omap.c @@ -77,31 +77,6 @@ static void omap_ohci_clock_power(int on) } } -/* - * Board specific gang-switched transceiver power on/off. - * NOTE: OSK supplies power from DC, not battery. - */ -static int omap_ohci_transceiver_power(int on) -{ - if (on) { - if (machine_is_omap_innovator() && cpu_is_omap1510()) - __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) - | ((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), - INNOVATOR_FPGA_CAM_USB_CONTROL); - else if (machine_is_omap_osk()) - tps65010_set_gpio_out_value(GPIO1, LOW); - } else { - if (machine_is_omap_innovator() && cpu_is_omap1510()) - __raw_writeb(__raw_readb(INNOVATOR_FPGA_CAM_USB_CONTROL) - & ~((1 << 5/*usb1*/) | (1 << 3/*usb2*/)), - INNOVATOR_FPGA_CAM_USB_CONTROL); - else if (machine_is_omap_osk()) - tps65010_set_gpio_out_value(GPIO1, HIGH); - } - - return 0; -} - #ifdef CONFIG_USB_OTG static void start_hnp(struct ohci_hcd *ohci) @@ -213,7 +188,8 @@ static int ohci_omap_reset(struct usb_hcd *hcd) } /* FIXME hub_wq hub requests should manage power switching */ - omap_ohci_transceiver_power(1); + if (config->transceiver_power) + config->transceiver_power(1); /* board init will have already handled HMC and mux setup. * any external transceiver should already be initialized diff --git a/include/linux/platform_data/usb-omap1.h b/include/linux/platform_data/usb-omap1.h index 878e572a78bf..e7b8dc92a269 100644 --- a/include/linux/platform_data/usb-omap1.h +++ b/include/linux/platform_data/usb-omap1.h @@ -50,6 +50,8 @@ struct omap_usb_config { int (*ocpi_enable)(void); void (*lb_reset)(void); + + int (*transceiver_power)(int on); }; #endif /* __LINUX_USB_OMAP1_H */