Re: [PATCH 2/3] USB: EHCI: make ehci_read_frame_index platform independent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 10, 2012 at 03:07:39PM -0400, Alan Stern wrote:
> In preparation for splitting the ehci-hcd driver into a core library
> and separate platform-specific driver modules, this patch (as1617)
> changes the way ehci_read_frame_index() is handled.
> 
> Since the same core library will have to work with both PCI and
> non-PCI platforms, the quirk handler routine will be compiled
> unconditionally.  The decision about whether to call it or simply to
> read the frame index register is made at run time, based on whether
> the frame_index_bug quirk flag is set.
> 
> Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

Acked-by: Felipe Balbi <balbi@xxxxxx>

> 
> ---
> 
>  drivers/usb/host/ehci-hcd.c   |   27 ++++++++++++++++++++++++++-
>  drivers/usb/host/ehci-sched.c |   23 -----------------------
>  drivers/usb/host/ehci.h       |   16 ----------------
>  3 files changed, 26 insertions(+), 40 deletions(-)
> 
> Index: usb-3.6/drivers/usb/host/ehci-hcd.c
> ===================================================================
> --- usb-3.6.orig/drivers/usb/host/ehci-hcd.c
> +++ usb-3.6/drivers/usb/host/ehci-hcd.c
> @@ -118,9 +118,34 @@ MODULE_PARM_DESC(hird, "host initiated r
>  /*-------------------------------------------------------------------------*/
>  
>  #include "ehci.h"
> -#include "ehci-dbg.c"
>  #include "pci-quirks.h"
>  
> +/*
> + * The MosChip MCS9990 controller updates its microframe counter
> + * a little before the frame counter, and occasionally we will read
> + * the invalid intermediate value.  Avoid problems by checking the
> + * microframe number (the low-order 3 bits); if they are 0 then
> + * re-read the register to get the correct value.
> + */
> +static unsigned ehci_moschip_read_frame_index(struct ehci_hcd *ehci)
> +{
> +	unsigned uf;
> +
> +	uf = ehci_readl(ehci, &ehci->regs->frame_index);
> +	if (unlikely((uf & 7) == 0))
> +		uf = ehci_readl(ehci, &ehci->regs->frame_index);
> +	return uf;
> +}
> +
> +static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
> +{
> +	if (ehci->frame_index_bug)
> +		return ehci_moschip_read_frame_index(ehci);
> +	return ehci_readl(ehci, &ehci->regs->frame_index);
> +}
> +
> +#include "ehci-dbg.c"
> +
>  /*-------------------------------------------------------------------------*/
>  
>  /*
> Index: usb-3.6/drivers/usb/host/ehci-sched.c
> ===================================================================
> --- usb-3.6.orig/drivers/usb/host/ehci-sched.c
> +++ usb-3.6/drivers/usb/host/ehci-sched.c
> @@ -36,29 +36,6 @@
>  
>  static int ehci_get_frame (struct usb_hcd *hcd);
>  
> -#ifdef CONFIG_PCI
> -
> -static unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
> -{
> -	unsigned uf;
> -
> -	/*
> -	 * The MosChip MCS9990 controller updates its microframe counter
> -	 * a little before the frame counter, and occasionally we will read
> -	 * the invalid intermediate value.  Avoid problems by checking the
> -	 * microframe number (the low-order 3 bits); if they are 0 then
> -	 * re-read the register to get the correct value.
> -	 */
> -	uf = ehci_readl(ehci, &ehci->regs->frame_index);
> -	if (unlikely(ehci->frame_index_bug && ((uf & 7) == 0)))
> -		uf = ehci_readl(ehci, &ehci->regs->frame_index);
> -	return uf;
> -}
> -
> -#endif
> -
> -/*-------------------------------------------------------------------------*/
> -
>  /*
>   * periodic_next_shadow - return "next" pointer on shadow list
>   * @periodic: host pointer to qh/itd/sitd
> Index: usb-3.6/drivers/usb/host/ehci.h
> ===================================================================
> --- usb-3.6.orig/drivers/usb/host/ehci.h
> +++ usb-3.6/drivers/usb/host/ehci.h
> @@ -777,22 +777,6 @@ static inline u32 hc32_to_cpup (const st
>  	static inline void ehci_vdbg(struct ehci_hcd *ehci, ...) {}
>  #endif
>  
> -#ifdef CONFIG_PCI
> -
> -/* For working around the MosChip frame-index-register bug */
> -static unsigned ehci_read_frame_index(struct ehci_hcd *ehci);
> -
> -#else
> -
> -static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci)
> -{
> -	return ehci_readl(ehci, &ehci->regs->frame_index);
> -}
> -
> -#endif
> -
> -/*-------------------------------------------------------------------------*/
> -
>  #ifndef DEBUG
>  #define STUB_DEBUG_FILES
>  #endif	/* DEBUG */
> 

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux