From: manjunath.goudar@linaro.org (Manjunath Goudar)
To: linux-arm-kernel@lists.infradead.org
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 [thread overview]
Message-ID: <1369307506-4458-3-git-send-email-manjunath.goudar@linaro.org> (raw)
In-Reply-To: <1369307506-4458-1-git-send-email-manjunath.goudar@linaro.org>
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 <manjunath.goudar@linaro.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg KH <greg@kroah.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: linux-usb at 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 */
--
1.7.9.5
next prev parent reply other threads:[~2013-05-23 11:11 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1365746856-7772-2-git-send-email-manjunath.goudar@linaro.org>
2013-05-07 9:50 ` [RFC PATCH 0/2] USB: OHCI: Start splitting up the driver Manjunath Goudar
2013-05-07 9:50 ` [RFC PATCH 1/2] USB: OHCI: prepare to make ohci-hcd a library module Manjunath Goudar
2013-05-07 15:15 ` Alan Stern
2013-05-07 9:50 ` [RFC PATCH 2/2] USB: OHCI: make ohci-pci a separate driver Manjunath Goudar
2013-05-23 11:11 ` [RFC V6 PATCH 0/3] USB: OHCI: Start splitting up the driver Manjunath Goudar
2013-05-23 11:11 ` [RFC V6 PATCH 1/3] USB: OHCI: prepare to make ohci-hcd a library module Manjunath Goudar
2013-05-23 14:27 ` Alan Stern
2013-05-23 11:11 ` Manjunath Goudar [this message]
2013-05-23 13:26 ` [RFC PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver Arnd Bergmann
2013-05-23 14:30 ` Alan Stern
2013-05-23 11:11 ` [RFC V6 PATCH 3/3] USB: OHCI: " Manjunath Goudar
2013-05-23 14:37 ` Alan Stern
2013-05-23 17:01 ` Arnd Bergmann
2013-05-23 17:37 ` Alan Stern
2013-05-23 17:42 ` Arnd Bergmann
2013-05-27 12:25 ` [RFC V7 PATCH 0/3] USB: OHCI: Start splitting up the driver Manjunath Goudar
2013-05-27 12:25 ` [RFC V7 PATCH 1/3] USB: OHCI: prepare to make ohci-hcd a library module Manjunath Goudar
2013-05-27 14:54 ` Alan Stern
2013-05-27 12:25 ` [RFC V7 PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver Manjunath Goudar
2013-05-27 14:55 ` Alan Stern
2013-05-27 12:25 ` [RFC V7 PATCH 3/3] USB: OHCI: " Manjunath Goudar
2013-05-27 14:58 ` Alan Stern
2013-05-27 20:38 ` Arnd Bergmann
2013-05-27 13:29 ` [RFC V7 PATCH 0/3] USB: OHCI: Start splitting up the driver Viresh Kumar
2013-05-28 13:04 ` [PATCH V8 " Manjunath Goudar
2013-05-28 13:04 ` [PATCH V8 1/3] USB: OHCI: prepare to make ohci-hcd a library module Manjunath Goudar
2013-05-28 13:04 ` [PATCH V8 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver Manjunath Goudar
2013-05-28 13:04 ` [PATCH V8 3/3] USB: OHCI: " Manjunath Goudar
2013-05-28 15:27 ` Alan Stern
2013-05-28 20:11 ` [PATCH V8 0/3] USB: OHCI: Start splitting up the driver Arnd Bergmann
2013-05-29 16:21 ` Alan Stern
2013-05-29 18:08 ` Arnd Bergmann
2013-05-29 18:16 ` Alan Stern
2013-05-29 22:02 ` Arnd Bergmann
2013-05-31 14:12 ` Alan Stern
2013-05-31 14:57 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369307506-4458-3-git-send-email-manjunath.goudar@linaro.org \
--to=manjunath.goudar@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).