From patchwork Mon May 27 12:25:49 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: 17216 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 79E72238E8 for ; Mon, 27 May 2013 12:27:25 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id 10sf5284948lbf.0 for ; Mon, 27 May 2013 05:26:20 -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=IrmYfDc4fXQCD4PAYSJukcj7Oh3VG9T74tikO0NKlrw=; b=kAC+jhjKhHfATZh1Sx1BNV3npXpE4NnbpVZSsj461HMl6Qv8uvzaK7/h8Q6GwxzU2V bS/hWd8dVvVg+r/G/ZjltAIbaxDb0uqeqw4GA4icVx+1eKEpXAfL2GaeLQ0WhYS8Qmz/ 7NB4qcWsR2FnzW0C3WbYbbrzbjqLCuhIrvHBtcxw3XPDuBl/42QmkRq9w5XGxTJ0esdq HnfillZq/IWfc/BIpNg/YwV6lLsfjn+1PwQF8OgP8ObsfSRYkEHPqBTDlMOWgZU8Snku LUZtmF87AkLIewEz6SEa5VrGVepfPLOBQtAgIWGSrxwFuDOOLiARBNNiSk5dvU7ZJeUw K1KA== X-Received: by 10.180.109.111 with SMTP id hr15mr3451189wib.1.1369657579966; Mon, 27 May 2013 05:26:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.106.195 with SMTP id gw3ls805318wib.51.gmail; Mon, 27 May 2013 05:26:19 -0700 (PDT) X-Received: by 10.180.88.231 with SMTP id bj7mr8392717wib.5.1369657579890; Mon, 27 May 2013 05:26:19 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id cj3si4124316wib.39.2013.05.27.05.26.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 May 2013 05:26:19 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::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:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id oz10so1439111veb.5 for ; Mon, 27 May 2013 05:26:18 -0700 (PDT) X-Received: by 10.58.172.67 with SMTP id ba3mr14846722vec.58.1369657578667; Mon, 27 May 2013 05:26:18 -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 c10csp74697vcs; Mon, 27 May 2013 05:26:18 -0700 (PDT) X-Received: by 10.52.21.227 with SMTP id y3mr9949687vde.49.1369657578208; Mon, 27 May 2013 05:26:18 -0700 (PDT) Received: from mail-vb0-x22c.google.com (mail-vb0-x22c.google.com [2607:f8b0:400c:c02::22c]) by mx.google.com with ESMTPS id sa4si16651530vdc.23.2013.05.27.05.26.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 May 2013 05:26:18 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22c is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=2607:f8b0:400c:c02::22c; Received: by mail-vb0-f44.google.com with SMTP id i3so2831807vbh.17 for ; Mon, 27 May 2013 05:26:18 -0700 (PDT) X-Received: by 10.58.107.104 with SMTP id hb8mr14863199veb.50.1369657578100; Mon, 27 May 2013 05:26:18 -0700 (PDT) Received: from manjunath-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id ho10sm20128095vdb.7.2013.05.27.05.26.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 May 2013 05:26:17 -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 V7 PATCH 2/3] USB: OHCI: Generic changes to make ohci-pci a separate driver Date: Mon, 27 May 2013 17:55:49 +0530 Message-Id: <1369657550-24101-3-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1369657550-24101-1-git-send-email-manjunath.goudar@linaro.org> References: <1365746856-7772-2-git-send-email-manjunath.goudar@linaro.org> <1369657550-24101-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQm+Yv1cOC5N8ewRkK9R7C70Nl3pWXYELUczhms1/WJ7zRk9Gc2+/q0kAPVrPGGziFLGtfRQ X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::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 "device" argument instead of "ohci_hcd" in sb800_prefetch() function to avoid extra include file in pci-quirks.c. V2: -Passed "device" argment instead of "pci_dev", then we use to_pci_dev() to get the "pci_dev" structure. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Greg KH Cc: Alan Stern Cc: linux-usb@vger.kernel.org Acked-by: Alan Stern --- drivers/usb/host/ohci-hcd.c | 9 --------- drivers/usb/host/ohci-pci.c | 13 ------------- drivers/usb/host/ohci-q.c | 6 ++++-- drivers/usb/host/pci-quirks.c | 13 +++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 5 files changed, 19 insertions(+), 24 deletions(-) diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 13ebbb7..82f586a 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" 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..df4a670 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 device *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(dev, 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 device *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(dev, 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..b9848e4 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -91,6 +91,19 @@ static struct amd_chipset_info { static DEFINE_SPINLOCK(amd_lock); +void sb800_prefetch(struct device *dev, int on) +{ + u16 misc; + struct pci_dev *pdev = to_pci_dev(dev); + + 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..4b8a209 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 device *dev, 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 device *dev, int on) {} #endif /* CONFIG_PCI */ #endif /* __LINUX_USB_PCI_QUIRKS_H */