From patchwork Tue Apr 9 22:30:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2418091 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id DD7243FC71 for ; Tue, 9 Apr 2013 22:31:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754977Ab3DIWb1 (ORCPT ); Tue, 9 Apr 2013 18:31:27 -0400 Received: from mail-la0-f46.google.com ([209.85.215.46]:41048 "EHLO mail-la0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751808Ab3DIWb0 (ORCPT ); Tue, 9 Apr 2013 18:31:26 -0400 Received: by mail-la0-f46.google.com with SMTP id ea20so628347lab.33 for ; Tue, 09 Apr 2013 15:31:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:cc:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=ye9OVBH79CXfCz6QUpNf+iYociUA+t8Zm9DJuzQHKv0=; b=Y5YngW606g1AM/6/dM3X1HBCcygEbpc8syxLg/IWEnJyY80Ib2yEnn5h+WvfnGRC/P GuNM17LTzVHphs+Up/eHFMTGLS2T4qQ6zf5GSpxwc2dcvC34IqV9NSAmYdOngoAacaAs DAD+6Hm4iODKEx5Pxd5dE/G3Y8WoFHVaIJkJuWlS5JqHvCMdquQBMSF1+HX0SnXTV9Ad XHk1Ap08U0wwbyOhAAxjdUYPDG5aGbPEyk7i61NKARjpPqGLA97HLfnuIQgeLC1NnYwx NsDxtA+amoSF7a3GXHmwXJFcSZrYfx0R+caDMYaio/eFU3qRVT6oDKPyNYFltqUEdj6P j4zA== X-Received: by 10.112.133.72 with SMTP id pa8mr11354811lbb.114.1365546685415; Tue, 09 Apr 2013 15:31:25 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-87-206.pppoe.mtu-net.ru. [91.79.87.206]) by mx.google.com with ESMTPS id p1sm1753558lae.0.2013.04.09.15.31.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Apr 2013 15:31:24 -0700 (PDT) To: linux-usb@vger.kernel.org, stern@rowland.harvard.edu, gregkh@linuxfoundation.org Subject: [PATCH v3 2/9] ehci-platform: add pre_setup() method to platform data Cc: linux-sh@vger.kernel.org From: Sergei Shtylyov Organization: Cogent Embedded Date: Wed, 10 Apr 2013 02:30:24 +0400 MIME-Version: 1.0 Message-Id: <201304100230.24883.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQkmFnPogo6ugfb9pucULHbWQi8txU4wHndRHJLhJUquGqLore01yn0YVAp0jN6Hv8LfanFk Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Sometimes there is a need to initialize some non-standard registers mapped to the EHCI region before accessing the standard EHCI registers. Add pre_setup() method with 'struct usb_hcd *' parameter to be called just before ehci_setup() to the 'ehci-platform' driver's platform data for this purpose... While at it, add the missing incomplete declaration of 'struct platform_device' to ... The patch has been tested on the Marzen and BOCK-W boards. Suggested-by: Alan Stern Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto Acked-by: Simon Horman Acked-by: Alan Stern --- Changes since version 2: - replaced #include with incomplete declarations of 'struct platform_device' and 'struct usb_hcd'; - added a note about testing to the changelog; - added ACKs from Simon Horman and Kuninori Morimoto. Changes since the original posting: - changed init() method to pre_setup() with different parameters and call site. drivers/usb/host/ehci-platform.c | 6 ++++++ include/linux/usb/ehci_pdriver.h | 4 ++++ 2 files changed, 10 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: renesas/drivers/usb/host/ehci-platform.c =================================================================== --- renesas.orig/drivers/usb/host/ehci-platform.c +++ renesas/drivers/usb/host/ehci-platform.c @@ -46,6 +46,12 @@ static int ehci_platform_reset(struct us ehci->big_endian_desc = pdata->big_endian_desc; ehci->big_endian_mmio = pdata->big_endian_mmio; + if (pdata->pre_setup) { + retval = pdata->pre_setup(hcd); + if (retval < 0) + return retval; + } + ehci->caps = hcd->regs + pdata->caps_offset; retval = ehci_setup(hcd); if (retval) Index: renesas/include/linux/usb/ehci_pdriver.h =================================================================== --- renesas.orig/include/linux/usb/ehci_pdriver.h +++ renesas/include/linux/usb/ehci_pdriver.h @@ -19,6 +19,9 @@ #ifndef __USB_CORE_EHCI_PDRIVER_H #define __USB_CORE_EHCI_PDRIVER_H +struct platform_device; +struct usb_hcd; + /** * struct usb_ehci_pdata - platform_data for generic ehci driver * @@ -50,6 +53,7 @@ struct usb_ehci_pdata { /* Turn on only VBUS suspend power and hotplug detection, * turn off everything else */ void (*power_suspend)(struct platform_device *pdev); + int (*pre_setup)(struct usb_hcd *hcd); }; #endif /* __USB_CORE_EHCI_PDRIVER_H */