From patchwork Tue Jul 8 14:59:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 4505771 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DC2959F392 for ; Tue, 8 Jul 2014 15:00:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C68082015D for ; Tue, 8 Jul 2014 15:00:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A03062013D for ; Tue, 8 Jul 2014 15:00:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbaGHPAI (ORCPT ); Tue, 8 Jul 2014 11:00:08 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:63587 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751566AbaGHPAG (ORCPT ); Tue, 8 Jul 2014 11:00:06 -0400 Received: by mail-wg0-f52.google.com with SMTP id b13so5992802wgh.11 for ; Tue, 08 Jul 2014 08:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=a9tACKb747G9zQgREgr3fBXbzkqc73jqaCZ/OKK9m/0=; b=S8Xr75WXtleYlCz4qORviXZ5MXzf6JwPMO91EZEIwMek0Z6pZHzbMUoyt4YhwTink1 bV/JJN0T5BWzXX1a5GJlA13b0qorjnjOe8R7C44Zv4sXPK6UOJJvdJtfaujLMzqsnmw5 otgKSYxhSm+IJs5tPXvi9dpokXm+xTg4C7y5Xj+m5vTYxkwX7sM6s/jLp+ewFGx5izn2 uIRp3PWD3aCaZkxQsk46/2VTUphz3sJ9by1fRXgrD6BZk1asZFHY+MYz1FsnkCneNYs3 Y6SSwXwZlrau4jYk28xN6ACADlPcUH3r9NTP3WKyA+k+qTQtny48MQiymYTCsgJlsgpm V+jw== X-Received: by 10.180.79.201 with SMTP id l9mr4620041wix.60.1404831604245; Tue, 08 Jul 2014 08:00:04 -0700 (PDT) Received: from groucho.site ([109.201.154.150]) by mx.google.com with ESMTPSA id 10sm59900832wjr.22.2014.07.08.08.00.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 Jul 2014 08:00:03 -0700 (PDT) From: Ulrich Hecht X-Google-Original-From: Ulrich Hecht To: linux-sh@vger.kernel.org, horms@verge.net.au Cc: yoshihiro.shimoda.uh@renesas.com, magnus.damm@gmail.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Ulrich Hecht Subject: [PATCH 2/2] ARM: shmobile: lager: remove USBHS callbacks Date: Tue, 8 Jul 2014 16:59:31 +0200 Message-Id: <1404831571-19817-2-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1404831571-19817-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1404831571-19817-1-git-send-email-ulrich.hecht+renesas@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Let the driver handle initialization and power control. Signed-off-by: Ulrich Hecht --- arch/arm/mach-shmobile/board-lager.c | 109 +++++------------------------------ 1 file changed, 15 insertions(+), 94 deletions(-) diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index b8b2b44..0138bc5 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -420,84 +420,6 @@ static const struct resource usbhs_resources[] __initconst = { DEFINE_RES_IRQ(gic_spi(107)), }; -struct usbhs_private { - struct renesas_usbhs_platform_info info; - struct usb_phy *phy; -}; - -#define usbhs_get_priv(pdev) \ - container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info) - -static int usbhs_power_ctrl(struct platform_device *pdev, - void __iomem *base, int enable) -{ - struct usbhs_private *priv = usbhs_get_priv(pdev); - - if (!priv->phy) - return -ENODEV; - - if (enable) { - int retval = usb_phy_init(priv->phy); - - if (!retval) - retval = usb_phy_set_suspend(priv->phy, 0); - return retval; - } - - usb_phy_set_suspend(priv->phy, 1); - usb_phy_shutdown(priv->phy); - return 0; -} - -static int usbhs_hardware_init(struct platform_device *pdev) -{ - struct usbhs_private *priv = usbhs_get_priv(pdev); - struct usb_phy *phy; - int ret; - - /* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5 - * setting to avoid VBUS short circuit due to wrong cable. - * PWEN should be pulled up high if USB Function is selected by SW5 - */ - gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */ - if (!gpio_get_value(RCAR_GP_PIN(5, 18))) { - pr_warn("Error: USB Function not selected - check SW5 + SW6\n"); - ret = -ENOTSUPP; - goto error; - } - - phy = usb_get_phy_dev(&pdev->dev, 0); - if (IS_ERR(phy)) { - ret = PTR_ERR(phy); - goto error; - } - - priv->phy = phy; - return 0; - error: - gpio_free(RCAR_GP_PIN(5, 18)); - return ret; -} - -static int usbhs_hardware_exit(struct platform_device *pdev) -{ - struct usbhs_private *priv = usbhs_get_priv(pdev); - - if (!priv->phy) - return 0; - - usb_put_phy(priv->phy); - priv->phy = NULL; - - gpio_free(RCAR_GP_PIN(5, 18)); - return 0; -} - -static int usbhs_get_id(struct platform_device *pdev) -{ - return USBHS_GADGET; -} - static u32 lager_usbhs_pipe_type[] = { USB_ENDPOINT_XFER_CONTROL, USB_ENDPOINT_XFER_ISOC, @@ -517,20 +439,19 @@ static u32 lager_usbhs_pipe_type[] = { USB_ENDPOINT_XFER_BULK, }; -static struct usbhs_private usbhs_priv __initdata = { - .info = { - .platform_callback = { - .power_ctrl = usbhs_power_ctrl, - .hardware_init = usbhs_hardware_init, - .hardware_exit = usbhs_hardware_exit, - .get_id = usbhs_get_id, - }, - .driver_param = { - .buswait_bwait = 4, - .pipe_type = lager_usbhs_pipe_type, - .pipe_size = ARRAY_SIZE(lager_usbhs_pipe_type), - }, - } +static struct renesas_usbhs_platform_info usbhs_info __initdata = { + .driver_param = { + .buswait_bwait = 4, + .type = USBHS_TYPE_R8A7790, + .pipe_type = lager_usbhs_pipe_type, + .pipe_size = ARRAY_SIZE(lager_usbhs_pipe_type), + /* USB0 Function - use PWEN as GPIO input to detect DIP + * Switch SW5 setting to avoid VBUS short circuit due to + * wrong cable. PWEN should be pulled up high if USB + * Function is selected by SW5. + */ + .enable_gpio = RCAR_GP_PIN(5, 18), + }, }; static void __init lager_register_usbhs(void) @@ -540,8 +461,8 @@ static void __init lager_register_usbhs(void) "renesas_usbhs", -1, usbhs_resources, ARRAY_SIZE(usbhs_resources), - &usbhs_priv.info, - sizeof(usbhs_priv.info)); + &usbhs_info, + sizeof(usbhs_info)); } /* USBHS PHY */