From patchwork Thu Jul 10 07:54:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 4521601 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C06C0BEEAA for ; Thu, 10 Jul 2014 07:54:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CF94D20218 for ; Thu, 10 Jul 2014 07:54:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D6DAC201F7 for ; Thu, 10 Jul 2014 07:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbaGJHyO (ORCPT ); Thu, 10 Jul 2014 03:54:14 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:62725 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751539AbaGJHyM (ORCPT ); Thu, 10 Jul 2014 03:54:12 -0400 Received: by mail-wi0-f173.google.com with SMTP id cc10so4029890wib.12 for ; Thu, 10 Jul 2014 00:54:11 -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=Z4G9t28VsMBMi/3MaPJWmwNt0CGOyhQKDWuJ0YTn9kA=; b=ooUnmkDqqgusBlOgwPaPHFxdmKq6pihK0LbOqylGGZY30EEhDVAt2a1SezEZ7ihvWr MOQqA0CLNq3J+vtr5ZEAZHYChEYbe6PGDzcPIT7KCPBQmyLPzD/XA/Ay8JY7ehkG0ZQO 8t6WFbahJX5sxW9a90cdj6wtqa+ORf8lGlq1o8mDVX4MkrEaBjkZXrKjPZYxwZOa9uIq 6dVXgA8t2VY9qL3ZVdq3L5ALETmnC1m3JoysT7xbzByhn92VVdXYHLKrwMmf5Q0yqkXs qxJPByQMipyWvIVBacQHRtUqwp50SyDI0wu9Jr52gVivXRtLYvXtxP//NHLXKLUab8ST SZrg== X-Received: by 10.180.82.199 with SMTP id k7mr17474872wiy.34.1404978850968; Thu, 10 Jul 2014 00:54:10 -0700 (PDT) Received: from groucho.site ([109.201.154.150]) by mx.google.com with ESMTPSA id ft17sm108639800wjc.14.2014.07.10.00.54.09 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Jul 2014 00:54:10 -0700 (PDT) From: Ulrich Hecht X-Google-Original-From: Ulrich Hecht To: linux-sh@vger.kernel.org, horms@verge.net.au, kuninori.morimoto.gx@gmail.com 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 v2 2/2] ARM: shmobile: lager: remove USBHS callbacks Date: Thu, 10 Jul 2014 09:54:00 +0200 Message-Id: <1404978840-31917-3-git-send-email-ulrich.hecht+renesas@gmail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1404978840-31917-1-git-send-email-ulrich.hecht+renesas@gmail.com> References: <1404978840-31917-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 | 126 ++++------------------------------- 1 file changed, 13 insertions(+), 113 deletions(-) diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index b8b2b44..c2a14c7 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -420,117 +420,17 @@ 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, - USB_ENDPOINT_XFER_ISOC, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_INT, - USB_ENDPOINT_XFER_INT, - USB_ENDPOINT_XFER_INT, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - USB_ENDPOINT_XFER_BULK, - 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, + /* 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 +440,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 */