From patchwork Thu May 23 11:11:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjunath.goudar@linaro.org X-Patchwork-Id: 17111 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qe0-f72.google.com (mail-qe0-f72.google.com [209.85.128.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D3F4C2395B for ; Thu, 23 May 2013 11:12:57 +0000 (UTC) Received: by mail-qe0-f72.google.com with SMTP id b4sf4302312qen.3 for ; Thu, 23 May 2013 04:12:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=suUzxHVMW9lrW5ApQzBniakUMfR5Z/Lta5MUmkKog+g=; b=KNvHmdjdAEj7BeUxJUfmf4qqUWneapiH+Vwmkzk9I459KCOMDSa+D/vqeya6RQ7o4k GBQXi7XlieuELv6XS4fm0GLLPpCfdpJh6kHdOEyvZIFbT0km4zBXl3/C5E2ytTOgV3pl A+M2letRCNj5k17bjPAY4g5O01sRVPElW1yqr0j4Xee7ygMqNZZG7DhRIZz9SvrlIprj tMuFSPIb1ho1Zz6HMjv1HxW0EZmqp630UmHGAIjDBrmQh482IIHjj8D+NdkshKiBoJOr ktdN5M3MnG68kWFz2+8LU2h6BQ44JutjKKZBZtHZd3hN1ex1kWtiPOJdL8ZiQitF03Uc cNcw== X-Received: by 10.224.217.195 with SMTP id hn3mr6118855qab.5.1369307522893; Thu, 23 May 2013 04:12:02 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.137 with SMTP id lk9ls1388206qeb.68.gmail; Thu, 23 May 2013 04:12:02 -0700 (PDT) X-Received: by 10.58.243.102 with SMTP id wx6mr2949899vec.26.1369307522697; Thu, 23 May 2013 04:12:02 -0700 (PDT) Received: from mail-vb0-x22e.google.com (mail-vb0-x22e.google.com [2607:f8b0:400c:c02::22e]) by mx.google.com with ESMTPS id t8si6016164vcz.74.2013.05.23.04.12.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 04:12:02 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22e; Received: by mail-vb0-f46.google.com with SMTP id 11so2009074vbe.19 for ; Thu, 23 May 2013 04:12:02 -0700 (PDT) X-Received: by 10.52.233.34 with SMTP id tt2mr4085830vdc.70.1369307522524; Thu, 23 May 2013 04:12:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp45457vcs; Thu, 23 May 2013 04:12:01 -0700 (PDT) X-Received: by 10.68.24.232 with SMTP id x8mr12526903pbf.150.1369307521271; Thu, 23 May 2013 04:12:01 -0700 (PDT) Received: from mail-pb0-x22b.google.com (mail-pb0-x22b.google.com [2607:f8b0:400e:c01::22b]) by mx.google.com with ESMTPS id wx5si8720886pbc.203.2013.05.23.04.12.00 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 04:12:01 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::22b is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=2607:f8b0:400e:c01::22b; Received: by mail-pb0-f43.google.com with SMTP id ma3so2787825pbc.16 for ; Thu, 23 May 2013 04:12:00 -0700 (PDT) X-Received: by 10.68.189.36 with SMTP id gf4mr7298053pbc.73.1369307520888; Thu, 23 May 2013 04:12:00 -0700 (PDT) Received: from localhost.localdomain ([223.239.130.234]) by mx.google.com with ESMTPSA id ra4sm12411546pab.9.2013.05.23.04.11.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 04:12:00 -0700 (PDT) From: Manjunath Goudar To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, patches@linaro.org, stern@rowland.harvard.edu, arnd@linaro.org, linaro-dev@lists.linaro.org, Manjunath Goudar , Arnd Bergmann , Greg KH Subject: [RFC PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver Date: Thu, 23 May 2013 16:41:45 +0530 Message-Id: <1369307506-4458-3-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1369307506-4458-1-git-send-email-manjunath.goudar@linaro.org> References: <1365746856-7772-2-git-send-email-manjunath.goudar@linaro.org> <1369307506-4458-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQnhnzFSZfAWXWX19eaRqr2jcakzAAlE+hTV6ucaYHYhjrUed7MwmAMDv5cTlyRE64WfUZqb X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Note that this changes is part of separating the ohci pci host controller driver from ohci-hcd host code. This contains : -Moved sb800_prefetch() function from ohci-pci.c to pci-quirks.c file and EXPORTed, this is part of the effort to move the ohci pci related code to generic pci code. -Passed "pci_dev" argument instead of "ohci_hcd" in sb800_prefetch() function to avoid extra include file in pci-quirks.c. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Greg KH Cc: Alan Stern Cc: linux-usb@vger.kernel.org --- drivers/usb/host/ohci-hcd.c | 11 +---------- drivers/usb/host/ohci-pci.c | 13 ------------- drivers/usb/host/ohci-q.c | 6 ++++-- drivers/usb/host/pci-quirks.c | 12 ++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 5 files changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 13ebbb7..2490b81 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -80,15 +80,6 @@ static const char hcd_name [] = "ohci_hcd"; static void ohci_dump (struct ohci_hcd *ohci, int verbose); static void ohci_stop (struct usb_hcd *hcd); -#ifdef CONFIG_PCI -static void sb800_prefetch(struct ohci_hcd *ohci, int on); -#else -static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) -{ - return; -} -#endif - #include "ohci-hub.c" #include "ohci-dbg.c" @@ -1275,7 +1266,7 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ohci_platform_driver #endif -#if !defined(PCI_DRIVER) && \ +#if !defined(PCI_DRIVER) && \ !defined(PLATFORM_DRIVER) && \ !defined(OMAP1_PLATFORM_DRIVER) && \ !defined(OMAP3_PLATFORM_DRIVER) && \ diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c index 2c27a5f..c3fa936 100644 --- a/drivers/usb/host/ohci-pci.c +++ b/drivers/usb/host/ohci-pci.c @@ -168,19 +168,6 @@ static int ohci_quirk_amd700(struct usb_hcd *hcd) return 0; } -static void sb800_prefetch(struct ohci_hcd *ohci, int on) -{ - struct pci_dev *pdev; - u16 misc; - - pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); - pci_read_config_word(pdev, 0x50, &misc); - if (on == 0) - pci_write_config_word(pdev, 0x50, misc & 0xfcff); - else - pci_write_config_word(pdev, 0x50, misc | 0x0300); -} - /* List of quirks for OHCI */ static const struct pci_device_id ohci_pci_quirks[] = { { diff --git a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c index 88731b7..78e0095 100644 --- a/drivers/usb/host/ohci-q.c +++ b/drivers/usb/host/ohci-q.c @@ -41,6 +41,7 @@ finish_urb(struct ohci_hcd *ohci, struct urb *urb, int status) __releases(ohci->lock) __acquires(ohci->lock) { + struct pci_dev *pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); // ASSERT (urb->hcpriv != 0); urb_free_priv (ohci, urb->hcpriv); @@ -55,7 +56,7 @@ __acquires(ohci->lock) if (quirk_amdiso(ohci)) usb_amd_quirk_pll_enable(); if (quirk_amdprefetch(ohci)) - sb800_prefetch(ohci, 0); + sb800_prefetch(pdev, 0); } break; case PIPE_INTERRUPT: @@ -580,6 +581,7 @@ static void td_submit_urb ( struct urb *urb ) { struct urb_priv *urb_priv = urb->hcpriv; + struct pci_dev *pdev = to_pci_dev(ohci_to_hcd(ohci)->self.controller); dma_addr_t data; int data_len = urb->transfer_buffer_length; int cnt = 0; @@ -689,7 +691,7 @@ static void td_submit_urb ( if (quirk_amdiso(ohci)) usb_amd_quirk_pll_disable(); if (quirk_amdprefetch(ohci)) - sb800_prefetch(ohci, 1); + sb800_prefetch(pdev, 1); } periodic = ohci_to_hcd(ohci)->self.bandwidth_isoc_reqs++ == 0 && ohci_to_hcd(ohci)->self.bandwidth_int_reqs == 0; diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index 4c338ec..5f01540 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -91,6 +91,18 @@ static struct amd_chipset_info { static DEFINE_SPINLOCK(amd_lock); +void sb800_prefetch(struct pci_dev *pdev, int on) +{ + u16 misc; + + pci_read_config_word(pdev, 0x50, &misc); + if (on == 0) + pci_write_config_word(pdev, 0x50, misc & 0xfcff); + else + pci_write_config_word(pdev, 0x50, misc | 0x0300); +} +EXPORT_SYMBOL_GPL(sb800_prefetch); + int usb_amd_find_chipset_info(void) { u8 rev = 0; diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h index 7f69a39..7c5fbc1 100644 --- a/drivers/usb/host/pci-quirks.h +++ b/drivers/usb/host/pci-quirks.h @@ -11,11 +11,13 @@ void usb_amd_quirk_pll_enable(void); bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); void usb_disable_xhci_ports(struct pci_dev *xhci_pdev); +void sb800_prefetch(struct pci_dev *pdev, int on); #else static inline void usb_amd_quirk_pll_disable(void) {} static inline void usb_amd_quirk_pll_enable(void) {} static inline void usb_amd_dev_put(void) {} static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {} +static inline void sb800_prefetch(struct pci_dev *pdev, int on) {} #endif /* CONFIG_PCI */ #endif /* __LINUX_USB_PCI_QUIRKS_H */