Message ID | 1457577257-4936-2-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Hi, Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> writes: > [ text/plain ] > On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) of > HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit > address memory pointers actually. So, in this case, this driver should > call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in xhci_gen_setup(). > Otherwise, the xHCI controller will be died after a usb device is > connected if it runs on above 4GB physical memory environment. > > So, this patch adds a new quirk XHCI_CLEAR_AC64 to resolve such an issue. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > --- > drivers/usb/host/xhci.c | 10 ++++++++++ > drivers/usb/host/xhci.h | 1 + > 2 files changed, 11 insertions(+) > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index d51ee0c..4b5e979 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -4948,6 +4948,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) > return retval; > xhci_dbg(xhci, "Reset complete\n"); > > + /* > + * On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) > + * of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit > + * address memory pointers actually. So, this driver clears the AC64 > + * bit of xhci->hcc_params to call dma_set_coherent_mask(dev, > + * DMA_BIT_MASK(32)) in this xhci_gen_setup(). > + */ > + if (xhci->quirks & XHCI_CLEAR_AC64) > + xhci->hcc_params &= ~BIT(0); > + > /* Set dma_mask and coherent_dma_mask to 64-bits, > * if xHC supports 64-bit addressing */ > if (HCC_64BIT_ADDR(xhci->hcc_params) && > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h > index e293e09..1963148 100644 > --- a/drivers/usb/host/xhci.h > +++ b/drivers/usb/host/xhci.h > @@ -1641,6 +1641,7 @@ struct xhci_hcd { > #define XHCI_PME_STUCK_QUIRK (1 << 20) > #define XHCI_MTK_HOST (1 << 21) > #define XHCI_SSIC_PORT_UNUSED (1 << 22) > +#define XHCI_CLEAR_AC64 (1 << 23) hmm, the quirk isn't really CLEAR_AC64, that's the workaround. How about calling this XHCI_NO_64BIT_SUPPORT ? or something along those lines.
Hi, > Hi, > > Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> writes: > > [ text/plain ] > > On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) of > > HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit > > address memory pointers actually. So, in this case, this driver should > > call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in xhci_gen_setup(). > > Otherwise, the xHCI controller will be died after a usb device is > > connected if it runs on above 4GB physical memory environment. > > > > So, this patch adds a new quirk XHCI_CLEAR_AC64 to resolve such an issue. > > > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > > --- > > drivers/usb/host/xhci.c | 10 ++++++++++ > > drivers/usb/host/xhci.h | 1 + > > 2 files changed, 11 insertions(+) > > > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > > index d51ee0c..4b5e979 100644 > > --- a/drivers/usb/host/xhci.c > > +++ b/drivers/usb/host/xhci.c > > @@ -4948,6 +4948,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) > > return retval; > > xhci_dbg(xhci, "Reset complete\n"); > > > > + /* > > + * On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) > > + * of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit > > + * address memory pointers actually. So, this driver clears the AC64 > > + * bit of xhci->hcc_params to call dma_set_coherent_mask(dev, > > + * DMA_BIT_MASK(32)) in this xhci_gen_setup(). > > + */ > > + if (xhci->quirks & XHCI_CLEAR_AC64) > > + xhci->hcc_params &= ~BIT(0); > > + > > /* Set dma_mask and coherent_dma_mask to 64-bits, > > * if xHC supports 64-bit addressing */ > > if (HCC_64BIT_ADDR(xhci->hcc_params) && > > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h > > index e293e09..1963148 100644 > > --- a/drivers/usb/host/xhci.h > > +++ b/drivers/usb/host/xhci.h > > @@ -1641,6 +1641,7 @@ struct xhci_hcd { > > #define XHCI_PME_STUCK_QUIRK (1 << 20) > > #define XHCI_MTK_HOST (1 << 21) > > #define XHCI_SSIC_PORT_UNUSED (1 << 22) > > +#define XHCI_CLEAR_AC64 (1 << 23) > > hmm, the quirk isn't really CLEAR_AC64, that's the workaround. How about > calling this XHCI_NO_64BIT_SUPPORT ? or something along those lines. Thank you for the suggestion. I agree with you. So, I will change the name to XHCI_NO_64BIT_SUPPORT. Best regards, Yoshihiro Shimoda > -- > balbi
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index d51ee0c..4b5e979 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -4948,6 +4948,16 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) return retval; xhci_dbg(xhci, "Reset complete\n"); + /* + * On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) + * of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit + * address memory pointers actually. So, this driver clears the AC64 + * bit of xhci->hcc_params to call dma_set_coherent_mask(dev, + * DMA_BIT_MASK(32)) in this xhci_gen_setup(). + */ + if (xhci->quirks & XHCI_CLEAR_AC64) + xhci->hcc_params &= ~BIT(0); + /* Set dma_mask and coherent_dma_mask to 64-bits, * if xHC supports 64-bit addressing */ if (HCC_64BIT_ADDR(xhci->hcc_params) && diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index e293e09..1963148 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1641,6 +1641,7 @@ struct xhci_hcd { #define XHCI_PME_STUCK_QUIRK (1 << 20) #define XHCI_MTK_HOST (1 << 21) #define XHCI_SSIC_PORT_UNUSED (1 << 22) +#define XHCI_CLEAR_AC64 (1 << 23) unsigned int num_active_eps; unsigned int limit_active_eps; /* There are two roothubs to keep track of bus suspend info for */
On some xHCI controllers (e.g. R-Car SoCs), the AC64 bit (bit 0) of HCCPARAMS1 is set to 1. However, the xHCs don't support 64-bit address memory pointers actually. So, in this case, this driver should call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in xhci_gen_setup(). Otherwise, the xHCI controller will be died after a usb device is connected if it runs on above 4GB physical memory environment. So, this patch adds a new quirk XHCI_CLEAR_AC64 to resolve such an issue. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/usb/host/xhci.c | 10 ++++++++++ drivers/usb/host/xhci.h | 1 + 2 files changed, 11 insertions(+)