USB: ehci-pci: Add support for Intel Quark X1000 USB host controller
Subsystems (3)
PATCH 1/1 USB: ehci-pci: Add support for Intel Quark X1000 USB host controller
From: "Alvin (Weike) Chen" <[email protected]>
Hi,
Intel Quark X1000 consists of one USB host controller which can be PCI enumerated. But the exsiting EHCI-PCI framework doesn't support it. Thus, we enable it to support Intel Quark X1000 USB host controller by adding pci quirks to configure buffer i/o threshold value to half.
Bryan O'Donoghue (1):
Quark USB host
drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)
Signature · 1 line
1.7.9.5
PATCH 1/1 USB: ehci-pci: USB host controller support for Intel Quark X1000
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)
drivers/usb/host/ehci-pci.c +4 -0
@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev))) +usb_set_qrk_bulk_thresh (pdev); +return 0 ; }
drivers/usb/host/pci-quirks.c +42 -0
48 lines not on this page · raw message
drivers/usb/host/pci-quirks.h +2 -0
@@ -14,6 +14,8 @@ void usb_amd_quirk_pll_enable(void);void usb_enable_intel_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); +bool usb_is_intel_qrk (struct pci_dev *pdev); +void usb_set_qrk_bulk_thresh (struct pci_dev *pdev);#else struct pci_dev ;static inline void usb_amd_quirk_pll_disable (void ) {}
Signature · 1 line
1.7.9.5
Re: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
Hello.
Quoted 19 lines · Alvin
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
Signed-off-by Bryan O'Donoghue <[email protected]>Signed-off-by Alvin (Weike) Chen <[email protected]>--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)drivers/usb/host/ehci-pci.c +0
-0
drivers/usb/host/ehci-pci.c static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) · line 54
Quoted 5 lines
drivers/usb/host/ehci-pci.c +2
-0@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev)))
Please run your patch thru scripts/checkpatch.pl -- space needed after *if*.
Quoted 11 lines
drivers/usb/host/ehci-pci.c +2
-0+usb_set_qrk_bulk_thresh (pdev); +return 0 ; }drivers/usb/host/pci-quirks.c +0
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,return -ETIMEDOUT ;
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 833
Quoted 10 lines
drivers/usb/host/pci-quirks.c +8
-0} +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) +{ +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk);
Why not use DECLARE_PCI_FIXUP_FINAL() instead?
Quoted 18 lines
drivers/usb/host/pci-quirks.c +18
-0+ +#define EHCI_INSNREG01 0x84 +#define EHCI_INSNREG01_THRESH 0x007F007F/* Threshold value */ +void usb_set_qrk_bulk_thresh (struct pci_dev *pdev) +{ +void __iomem *base, *op_reg_base; +u8 cap_length; +u32 val; + +if (!mmio_resource_enabled (pdev,0 )) +return ; + + base =pci_ioremap_bar (pdev,0 ); +if (base ==NULL ) +return ; + + cap_length =readb (base); + op_reg_base = base + cap_length;
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 10 lines
drivers/usb/host/pci-quirks.c +10
-0+ + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ; + +writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);
I doubt these dev_printk() calls are really useful. But if the are, it's
worth merging them into one call.
WBR, Sergei
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
See my comments below:
Quoted 5 lines
drivers/usb/host/ehci-pci.c static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) · line 54
Quoted 2 lines
drivers/usb/host/ehci-pci.c +2
-0+/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev)))Please run your patch thru
scripts/checkpatch.pl-- space needed after
*if*.
OK, I will improve it in the PATCH v2.
Quoted 15 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask,
Quoted 11 lines
drivers/usb/host/ehci-pci.c +2
-0+usb_set_qrk_bulk_thresh (pdev); +return 0 ; }(quoted diff) +0
-0
b/drivers/usb/host/pci-quirks.cindex 00661d3..1ea8803 100644drivers/usb/host/pci-quirks.c +0
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask,u32 done,
Quoted 3 lines
drivers/usb/host/pci-quirks.c +0
-0return -ETIMEDOUT ; }
Quoted 10 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 833
Quoted 7 lines
drivers/usb/host/pci-quirks.c +7
-0+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) { +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk);Why not use
DECLARE_PCI_FIXUP_FINAL()instead?
Alan Stern suggests me to move 'usb_is_intel_qrk' and 'usb_set_qrk_bulk_thresh' to ehci-pci.c.
Since no other modules call these two functions, I will move them to ehci-pci.c as static functions, so no necessary to export them out.
Quoted 22 lines
Quoted 22 lines
drivers/usb/host/pci-quirks.c +22
-0+ +#define EHCI_INSNREG01 0x84 +#define EHCI_INSNREG01_THRESH 0x007F007F/* Threshold value */ +void usb_set_qrk_bulk_thresh (struct pci_dev *pdev) { +void __iomem *base, *op_reg_base; +u8 cap_length; +u32 val; + +if (!mmio_resource_enabled (pdev,0 )) +return ; + + base =pci_ioremap_bar (pdev,0 ); +if (base ==NULL ) +return ; + + cap_length =readb (base); + op_reg_base = base + cap_length; + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ;
Quoted 8 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 5 lines
drivers/usb/host/pci-quirks.c +5
-0+ +writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);I doubt these
dev_printk()calls are really useful. But if the are, it's worth
merging them into one call.
Actually, the dev_printk calls is not necessary, I will remove them in the PATCH v2.
Quoted 2 lines
WBR, Sergei
Greg Kroah-Hartman
maintainerRe: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
In reply to Chen, AlvinQuoted 19 lines · Alvin
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
Signed-off-by Bryan O'Donoghue <[email protected]>Signed-off-by Alvin (Weike) Chen <[email protected]>--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)drivers/usb/host/ehci-pci.c +0
-0
drivers/usb/host/ehci-pci.c static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) · line 54
Quoted 5 lines
drivers/usb/host/ehci-pci.c +2
-0@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev)))
Why unlikely()? Have you measured a speed difference here? And this is a _very_ slow path, what does that speed difference you measured help with?
thanks,
greg k-h
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
See my comments below:
Quoted 31 lines
-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Tuesday, June 24, 2014 9:25 PM
To: Chen, Alvin
Cc: Alan Stern; [email protected]; [email protected]; Ong, Boon Leong
Subject: Re: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000Quoted 11 lines · Alvin
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
Signed-off-by Bryan O'Donoghue <[email protected]>Signed-off-by Alvin (Weike) Chen <[email protected]>--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42+++++++++++++++++++++++++++++++++++++++++
drivers/usb/host/ehci-pci.c static int ehci_pci_reinit(struct ehci_hcd *ehci, struct
Quoted 8 lines
drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)drivers/usb/host/ehci-pci.c +0
-0@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct
pci_dev*pdev)
Quoted 9 lines
drivers/usb/host/ehci-pci.c static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev) · line 54
Quoted 5 lines
drivers/usb/host/ehci-pci.c +2
-0if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev)))Why
unlikely()? Have you measured a speed difference here? And this is a _very_ slow path, what does that speed difference you measured help with?
Actually, 'unlikely' is not necessary, I will remove it in PATCH v2.
Quoted 3 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerRe: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
In reply to Chen, AlvinQuoted 6 lines · Alvin
drivers/usb/host/pci-quirks.c +0
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,return -ETIMEDOUT ;
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 833
Quoted 10 lines
drivers/usb/host/pci-quirks.c +8
-0} +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) +{ +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk);
There is no lack of vowels available to you, please use them.
greg k-h
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
Quoted 21 lines
-----Original Message-----
From: Greg Kroah-Hartman [mailto:[email protected]]
Sent: Tuesday, June 24, 2014 9:25 PM
To: Chen, Alvin
Cc: Alan Stern; [email protected]; [email protected]; Ong, Boon Leong
Subject: Re: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask,
Quoted 5 lines · Alvin
(quoted diff) +0
-0
b/drivers/usb/host/pci-quirks.cindex 00661d3..1ea8803 100644drivers/usb/host/pci-quirks.c +0
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask,u32 done,
Quoted 3 lines
drivers/usb/host/pci-quirks.c +0
-0return -ETIMEDOUT ; }
Quoted 10 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 833
Quoted 7 lines
drivers/usb/host/pci-quirks.c +7
-0+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) { +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk);There is no lack of vowels available to you, please use them.
OK, I will change ' usb_is_intel_qrk ' to ' usb_is_intel_quark'.
Quoted 1 line
greg k-h
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
From: Chen, Alvin
Quoted 21 lines
Quoted 10 lines · Alvin
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask,
Quoted 5 lines
(quoted diff) +0
-0
b/drivers/usb/host/pci-quirks.cindex 00661d3..1ea8803 100644drivers/usb/host/pci-quirks.c +0
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask,u32 done,
Quoted 3 lines
drivers/usb/host/pci-quirks.c +0
-0return -ETIMEDOUT ; }Quoted 10 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 833
Quoted 7 lines
drivers/usb/host/pci-quirks.c +7
-0+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) { +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk);There is no lack of vowels available to you, please use them.
Quoted 1 line
OK, I will change '
usb_is_intel_qrk' to 'usb_is_intel_quark'.
Or even usb_is_intel_quark_x1000() ?
David
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
Quoted 5 lines
Quoted 2 lines
OK, I will change '
usb_is_intel_qrk' to 'usb_is_intel_quark'.Or even
usb_is_intel_quark_x1000()?
OK, I will change the function name as your suggestion to make it more specific.
Quoted 3 lines
David
Alan Stern
maintainerRe: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
In reply to Chen, AlvinQuoted 5 lines · Alvin
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
What is the packet buffer in/out threshold value and why does it need to be reconfigured to half?
Quoted 57 lines
Signed-off-by Bryan O'Donoghue <[email protected]>Signed-off-by Alvin (Weike) Chen <[email protected]>--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)drivers/usb/host/ehci-pci.c +4
-0@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev))) +usb_set_qrk_bulk_thresh (pdev); +return 0 ; }drivers/usb/host/pci-quirks.c +26
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,return -ETIMEDOUT ; } +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939 +bool usb_is_intel_qrk (struct pci_dev *pdev) +{ +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk); + +#define EHCI_INSNREG01 0x84 +#define EHCI_INSNREG01_THRESH 0x007F007F/* Threshold value */ +void usb_set_qrk_bulk_thresh (struct pci_dev *pdev) +{ +void __iomem *base, *op_reg_base; +u8 cap_length; +u32 val; + +if (!mmio_resource_enabled (pdev,0 )) +return ; + + base =pci_ioremap_bar (pdev,0 ); +if (base ==NULL ) +return ; + + cap_length =readb (base); + op_reg_base = base + cap_length;
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 10 lines
drivers/usb/host/pci-quirks.c +10
-0+ + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ; + +writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);
What good will these log messages do anybody? Is there any reason not to make them debug messages? Or even leave them out entirely, since you pretty much know beforehand what they're going to say?
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 866
Quoted 5 lines
drivers/usb/host/pci-quirks.c +5
-0+ +iounmap (base); + +} +EXPORT_SYMBOL_GPL (usb_set_qrk_bulk_thresh);
None of this material belongs in pci-quirks.c. Please move it into ehci-pci.c.
Alan Stern
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
Quoted 8 lines
Quoted 3 lines
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half
What is the packet buffer in/out threshold value and why does it need to be reconfigured to half?
I go through the hardware specification carefully again. The EHCI buffer packet depth can be 512 bytes, and the in/out threshold is programmable and can be programmed to 512 bytes (0x80 DWord) only when isochronous/interrupt transactions are not initiated by the host controller. The default threshold value for Quark X1000 is 0x20 DWord, so this patch try to program it as maximal as possible, and it is 0x7F Dword since the host controller initiates isochronous/interrupt transactions .
I will update the description in PATCH v2.
Quoted 5 lines
Quoted 5 lines
drivers/usb/host/pci-quirks.c +5
-0+ val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ; +
Quoted 9 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 4 lines
drivers/usb/host/pci-quirks.c +4
-0+writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);What good will these log messages do anybody? Is there any reason not to make them debug messages? Or even leave them out entirely, since you pretty much know beforehand what they're going to say?
These messages are not necessary, I will remove them.
Quoted 8 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 866
Quoted 5 lines
drivers/usb/host/pci-quirks.c +5
-0+ +iounmap (base); + +} +EXPORT_SYMBOL_GPL (usb_set_qrk_bulk_thresh);None of this material belongs in
pci-quirks.c. Please move it intoehci-pci.c.
OK. I will move them to ehci-pci.c, since these two functions will not be called by other modules.
Quoted 1 line
Alan Stern
Re: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
In reply to Chen, AlvinQuoted 6 lines · Alvin Chen
From: Bryan O'Donoghue <[email protected]>
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
Please add more detailed description. For example, why is it necessary to reconfigure the threshold value?
Quoted 33 lines
Signed-off-by Bryan O'Donoghue <[email protected]>Signed-off-by Alvin (Weike) Chen <[email protected]>--- drivers/usb/host/ehci-pci.c | 4 ++++ drivers/usb/host/pci-quirks.c | 42 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/host/pci-quirks.h | 2 ++ 3 files changed, 48 insertions(+)drivers/usb/host/ehci-pci.c +4
-0@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct pci_dev *pdev)if (!retval)ehci_dbg (ehci,"MWI active\n" ); +/* Reset the threshold limit */ +if (unlikely (usb_is_intel_qrk (pdev))) +usb_set_qrk_bulk_thresh (pdev); +return 0 ; }drivers/usb/host/pci-quirks.c +1
-0@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,return -ETIMEDOUT ; } +#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC 0x0939
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 836
Quoted 10 lines
drivers/usb/host/pci-quirks.c +10
-0+bool usb_is_intel_qrk (struct pci_dev *pdev) +{ +return pdev->vendor ==PCI_VENDOR_ID_INTEL && + pdev->device ==PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC ; + +} +EXPORT_SYMBOL_GPL (usb_is_intel_qrk); + +#define EHCI_INSNREG01 0x84 +#define EHCI_INSNREG01_THRESH 0x007F007F/* Threshold value */
What does this magic number mean?
Would you make it more readable?
Quoted 15 lines
drivers/usb/host/pci-quirks.c +15
-0+void usb_set_qrk_bulk_thresh (struct pci_dev *pdev) +{ +void __iomem *base, *op_reg_base; +u8 cap_length; +u32 val; + +if (!mmio_resource_enabled (pdev,0 )) +return ; + + base =pci_ioremap_bar (pdev,0 ); +if (base ==NULL ) +return ; + + cap_length =readb (base); + op_reg_base = base + cap_length;
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 10 lines
drivers/usb/host/pci-quirks.c +10
-0+ + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ; + +writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);
As Alan Stern said, These INFO message are noisy.
DEBUG level looks better.
Best regards,
Jingoo Han
Quoted 24 lines
drivers/usb/host/pci-quirks.c +6
-0+ +iounmap (base); + +} +EXPORT_SYMBOL_GPL (usb_set_qrk_bulk_thresh); +/* * Intel's Panther Point chipset has two host controllers (EHCI and xHCI) that * share some number of ports. These ports can be switched between either drivers/usb/host/pci-quirks.h +2
-1@@ -14,6 +14,8 @@ void usb_amd_quirk_pll_enable(void);void usb_enable_intel_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); +bool usb_is_intel_qrk (struct pci_dev *pdev); +void usb_set_qrk_bulk_thresh (struct pci_dev *pdev);#else struct pci_dev ;static inline void usb_amd_quirk_pll_disable (void ) {} --1.7.9.5
RE: [PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000
Quoted 7 lines
Quoted 3 lines
This patch is to enable USB host controller for Intel Quark X1000. Add pci quirks to adjust the packet buffer in/out threshold value, and ensure EHCI packet buffer i/o threshold value is reconfigured to half.
Please add more detailed description. For example, why is it necessary to reconfigure the threshold value?
This patch try to reconfigure the threshold value as maximal (0x7F DWord) as possible since the default value is just 0x20 DWord, and I will update the description.
Quoted 7 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 836
Quoted 4 lines
drivers/usb/host/pci-quirks.c +3
-0+ +#define EHCI_INSNREG01 0x84 +#define EHCI_INSNREG01_THRESH 0x007F007F/* Threshold value */ What does this magic number mean?
Would you make it more readable?
0x84 is the register offset, and the high word of '0x007F007F' is the out threshold and the low word is the in threshold. I will use some micros to make it more readable to avoid magic number in PATCH v2.
Quoted 19 lines
Quoted 19 lines
drivers/usb/host/pci-quirks.c +19
-0+void usb_set_qrk_bulk_thresh (struct pci_dev *pdev) { +void __iomem *base, *op_reg_base; +u8 cap_length; +u32 val; + +if (!mmio_resource_enabled (pdev,0 )) +return ; + + base =pci_ioremap_bar (pdev,0 ); +if (base ==NULL ) +return ; + + cap_length =readb (base); + op_reg_base = base + cap_length; + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val); + + val =EHCI_INSNREG01_THRESH ;
Quoted 8 lines
drivers/usb/host/pci-quirks.c static int handshake(void __iomem *ptr, u32 mask, u32 done, · line 861
Quoted 5 lines
drivers/usb/host/pci-quirks.c +5
-0+ +writel (val, op_reg_base +EHCI_INSNREG01 ); + + val =readl (op_reg_base +EHCI_INSNREG01 ); +dev_printk (KERN_INFO , &pdev->dev,"INSNREG01 is 0x%08x\n" , val);As Alan Stern said, These INFO message are noisy.
DEBUG level looks better.
These messages are not necessary, I will remove them.
Quoted 6 lines
Best regards,
Jingoo HanQuoted 3 lines
+
--
1.7.9.5