* [PATCH] OHCI: add PowerPC 440EP/440EPx support @ 2007-10-08 14:25 Valentine Barshak 2007-10-08 15:01 ` [linux-usb-devel] " David Brownell 0 siblings, 1 reply; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 14:25 UTC (permalink / raw) To: linuxppc-dev; +Cc: linux-usb-devel PowerPC 440EP 440EPx OHCI controller needs frame number value shift. Signed-off-by: Valentine Barshak <vbarshak@ru•mvista.com> --- drivers/usb/host/ohci.h | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -pruN linux-2.6.orig/drivers/usb/host/ohci.h linux-2.6/drivers/usb/host/ohci.h --- linux-2.6.orig/drivers/usb/host/ohci.h 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci.h 2007-10-08 17:55:43.000000000 +0400 @@ -612,7 +612,7 @@ static inline u32 hc32_to_cpup (const st * to arch/powerpc */ -#ifdef CONFIG_STB03xxx +#if defined(CONFIG_STB03xxx) || defined(CONFIG_440EP) || defined(CONFIG_440EPX) #define OHCI_BE_FRAME_NO_SHIFT 16 #else #define OHCI_BE_FRAME_NO_SHIFT 0 ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 14:25 [PATCH] OHCI: add PowerPC 440EP/440EPx support Valentine Barshak @ 2007-10-08 15:01 ` David Brownell 2007-10-08 16:06 ` Valentine Barshak 0 siblings, 1 reply; 11+ messages in thread From: David Brownell @ 2007-10-08 15:01 UTC (permalink / raw) To: vbarshak, linuxppc-dev; +Cc: linux-usb-devel > @@ -612,7 +612,7 @@ static inline u32 hc32_to_cpup (const st > * to arch/powerpc > */ > > -#ifdef CONFIG_STB03xxx > +#if defined(CONFIG_STB03xxx) || defined(CONFIG_440EP) || defined(CONFIG_440EPX) > #define OHCI_BE_FRAME_NO_SHIFT 16 > #else > #define OHCI_BE_FRAME_NO_SHIFT 0 Near as I can tell, the original code is wrong ... the hcca->frame_no byte offset is fully specified, so that shift should always be 16. - Dave ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 15:01 ` [linux-usb-devel] " David Brownell @ 2007-10-08 16:06 ` Valentine Barshak 2007-10-08 16:19 ` David Brownell 0 siblings, 1 reply; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 16:06 UTC (permalink / raw) To: David Brownell; +Cc: linuxppc-dev, linux-usb-devel David Brownell wrote: >> @@ -612,7 +612,7 @@ static inline u32 hc32_to_cpup (const st >> * to arch/powerpc >> */ >> >> -#ifdef CONFIG_STB03xxx >> +#if defined(CONFIG_STB03xxx) || defined(CONFIG_440EP) || defined(CONFIG_440EPX) >> #define OHCI_BE_FRAME_NO_SHIFT 16 >> #else >> #define OHCI_BE_FRAME_NO_SHIFT 0 > > Near as I can tell, the original code is wrong ... the hcca->frame_no > byte offset is fully specified, so that shift should always be 16. > > - Dave > Are you saying that it should always be #define OHCI_BE_FRAME_NO_SHIFT 16 for big endian platforms? ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 16:06 ` Valentine Barshak @ 2007-10-08 16:19 ` David Brownell 2007-10-08 16:54 ` [PATCH] USB: Add frame_no big endian OHCI quirk Valentine Barshak 2007-10-08 17:39 ` [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support Kumar Gala 0 siblings, 2 replies; 11+ messages in thread From: David Brownell @ 2007-10-08 16:19 UTC (permalink / raw) To: vbarshak; +Cc: linuxppc-dev, linux-usb-devel > > Near as I can tell, the original code is wrong ... the hcca->frame_no > > byte offset is fully specified, so that shift should always be 16. > > Are you saying that it should always be #define OHCI_BE_FRAME_NO_SHIFT > 16 for big endian platforms? More than that, I'm saying that shouldn't even be a #define! The default should be that drivers expect chips to follow the interface specs. Any value other than 16 violates the OHCI spec. However, based on one other post, I suspect at least one Freescale part will need to declare a chip quirk for this case. - Dave ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] USB: Add frame_no big endian OHCI quirk. 2007-10-08 16:19 ` David Brownell @ 2007-10-08 16:54 ` Valentine Barshak 2007-10-08 16:58 ` [linux-usb-devel] " Valentine Barshak 2007-10-08 18:41 ` Valentine Barshak 2007-10-08 17:39 ` [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support Kumar Gala 1 sibling, 2 replies; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 16:54 UTC (permalink / raw) To: linuxppc-dev; +Cc: david-b, linux-usb-devel Add OHCI big endian frame_no quirk. The frame_no value stored in the HCCA is a 16 bit field at a specific offset, but since not all CPUs can do 16-bit memory accesses it's used as a 32 bit field. And that's why big-endian OHCI will shift 16 bits, unless the spec is not followed. Currently there's one MPC52xx platform that doesn't need the shift. This case is hanled using big endian frame_no quirk. Signed-off-by: Valentine Barshak <vbarshak@ru•mvista.com> --- drivers/usb/host/ohci-ppc-of.c | 5 ++++- drivers/usb/host/ohci.h | 13 ++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff -pruN linux-2.6.orig/drivers/usb/host/ohci.h linux-2.6/drivers/usb/host/ohci.h --- linux-2.6.orig/drivers/usb/host/ohci.h 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci.h 2007-10-08 20:39:28.000000000 +0400 @@ -398,6 +398,7 @@ struct ohci_hcd { #define OHCI_QUIRK_BE_MMIO 0x10 /* BE registers */ #define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/ #define OHCI_QUIRK_NEC 0x40 /* lost interrupts */ +#define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ // there are also chip quirks/bugs in init logic struct work_struct nec_work; /* Worker for NEC quirk */ @@ -607,15 +608,12 @@ static inline u32 hc32_to_cpup (const st /* HCCA frame number is 16 bits, but is accessed as 32 bits since not all * hardware handles 16 bit reads. That creates a different confusion on * some big-endian SOC implementations. Same thing happens with PSW access. - * - * FIXME: Deal with that as a runtime quirk when STB03xxx is ported over - * to arch/powerpc */ -#ifdef CONFIG_STB03xxx -#define OHCI_BE_FRAME_NO_SHIFT 16 +#ifdef CONFIG_PPC_MPC52xx +#define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO) #else -#define OHCI_BE_FRAME_NO_SHIFT 0 +#define big_endian_frame_no_quirk(ohci) 0 #endif static inline u16 ohci_frame_no(const struct ohci_hcd *ohci) @@ -623,7 +621,8 @@ static inline u16 ohci_frame_no(const st u32 tmp; if (big_endian_desc(ohci)) { tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no); - tmp >>= OHCI_BE_FRAME_NO_SHIFT; + if (!big_endian_frame_no_quirk(ohci)) + tmp >>= 16; } else tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no); diff -pruN linux-2.6.orig/drivers/usb/host/ohci-ppc-of.c linux-2.6/drivers/usb/host/ohci-ppc-of.c --- linux-2.6.orig/drivers/usb/host/ohci-ppc-of.c 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci-ppc-of.c 2007-10-08 20:42:53.000000000 +0400 @@ -134,8 +134,11 @@ ohci_hcd_ppc_of_probe(struct of_device * } ohci = hcd_to_ohci(hcd); - if (is_bigendian) + if (is_bigendian) { ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; + if (of_device_is_compatible(dn, "mpc5200-ohci")) + ohci->flags |= OHCI_QUIRK_FRAME_NO; + } ohci_hcd_init(ohci); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] USB: Add frame_no big endian OHCI quirk. 2007-10-08 16:54 ` [PATCH] USB: Add frame_no big endian OHCI quirk Valentine Barshak @ 2007-10-08 16:58 ` Valentine Barshak 2007-10-08 18:41 ` Valentine Barshak 1 sibling, 0 replies; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 16:58 UTC (permalink / raw) To: linuxppc-dev; +Cc: david-b, linux-usb-devel I've tested this patch only on PowerPC 440EPx Sequoia. So, this needs to be tested at least on mpc52xx. Thanks, Valentine. ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] USB: Add frame_no big endian OHCI quirk 2007-10-08 16:54 ` [PATCH] USB: Add frame_no big endian OHCI quirk Valentine Barshak 2007-10-08 16:58 ` [linux-usb-devel] " Valentine Barshak @ 2007-10-08 18:41 ` Valentine Barshak 2007-10-08 18:52 ` [linux-usb-devel] " Dale Farnsworth 1 sibling, 1 reply; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 18:41 UTC (permalink / raw) To: linuxppc-dev; +Cc: david-b, linux-usb-devel Add OHCI big endian frame_no quirk. The frame_no value stored in the HCCA is a 16 bit field at a specific offset, but since not all CPUs can do 16-bit memory accesses it's used as a 32 bit field. And that's why big-endian OHCI will shift 16 bits, unless the spec is not followed. Currently there's one MPC52xx platform that doesn't need the shift. This case is hanled using big endian frame_no quirk. Signed-off-by: Valentine Barshak <vbarshak@ru•mvista.com> --- drivers/usb/host/ohci-ppc-of.c | 5 ++++- drivers/usb/host/ohci-ppc-soc.c | 5 +++++ drivers/usb/host/ohci.h | 13 ++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff -pruN linux-2.6.orig/drivers/usb/host/ohci.h linux-2.6/drivers/usb/host/ohci.h --- linux-2.6.orig/drivers/usb/host/ohci.h 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci.h 2007-10-08 20:39:28.000000000 +0400 @@ -398,6 +398,7 @@ struct ohci_hcd { #define OHCI_QUIRK_BE_MMIO 0x10 /* BE registers */ #define OHCI_QUIRK_ZFMICRO 0x20 /* Compaq ZFMicro chipset*/ #define OHCI_QUIRK_NEC 0x40 /* lost interrupts */ +#define OHCI_QUIRK_FRAME_NO 0x80 /* no big endian frame_no shift */ // there are also chip quirks/bugs in init logic struct work_struct nec_work; /* Worker for NEC quirk */ @@ -607,15 +608,12 @@ static inline u32 hc32_to_cpup (const st /* HCCA frame number is 16 bits, but is accessed as 32 bits since not all * hardware handles 16 bit reads. That creates a different confusion on * some big-endian SOC implementations. Same thing happens with PSW access. - * - * FIXME: Deal with that as a runtime quirk when STB03xxx is ported over - * to arch/powerpc */ -#ifdef CONFIG_STB03xxx -#define OHCI_BE_FRAME_NO_SHIFT 16 +#ifdef CONFIG_PPC_MPC52xx +#define big_endian_frame_no_quirk(ohci) (ohci->flags & OHCI_QUIRK_FRAME_NO) #else -#define OHCI_BE_FRAME_NO_SHIFT 0 +#define big_endian_frame_no_quirk(ohci) 0 #endif static inline u16 ohci_frame_no(const struct ohci_hcd *ohci) @@ -623,7 +621,8 @@ static inline u16 ohci_frame_no(const st u32 tmp; if (big_endian_desc(ohci)) { tmp = be32_to_cpup((__force __be32 *)&ohci->hcca->frame_no); - tmp >>= OHCI_BE_FRAME_NO_SHIFT; + if (!big_endian_frame_no_quirk(ohci)) + tmp >>= 16; } else tmp = le32_to_cpup((__force __le32 *)&ohci->hcca->frame_no); diff -pruN linux-2.6.orig/drivers/usb/host/ohci-ppc-of.c linux-2.6/drivers/usb/host/ohci-ppc-of.c --- linux-2.6.orig/drivers/usb/host/ohci-ppc-of.c 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci-ppc-of.c 2007-10-08 20:42:53.000000000 +0400 @@ -134,8 +134,11 @@ ohci_hcd_ppc_of_probe(struct of_device * } ohci = hcd_to_ohci(hcd); - if (is_bigendian) + if (is_bigendian) { ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; + if (of_device_is_compatible(dn, "mpc5200-ohci")) + ohci->flags |= OHCI_QUIRK_FRAME_NO; + } ohci_hcd_init(ohci); diff -pruN linux-2.6.orig/drivers/usb/host/ohci-ppc-soc.c linux-2.6/drivers/usb/host/ohci-ppc-soc.c --- linux-2.6.orig/drivers/usb/host/ohci-ppc-soc.c 2007-10-08 16:30:28.000000000 +0400 +++ linux-2.6/drivers/usb/host/ohci-ppc-soc.c 2007-10-08 22:31:44.000000000 +0400 @@ -73,6 +73,11 @@ static int usb_hcd_ppc_soc_probe(const s ohci = hcd_to_ohci(hcd); ohci->flags |= OHCI_QUIRK_BE_MMIO | OHCI_QUIRK_BE_DESC; + +#ifdef CONFIG_PPC_MPC52xx + /* MPC52xx doesn't need frame_no shift */ + ohci->flags |= OHCI_QUIRK_FRAME_NO; +#endif ohci_hcd_init(ohci); retval = usb_add_hcd(hcd, irq, IRQF_DISABLED); ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] USB: Add frame_no big endian OHCI quirk 2007-10-08 18:41 ` Valentine Barshak @ 2007-10-08 18:52 ` Dale Farnsworth 0 siblings, 0 replies; 11+ messages in thread From: Dale Farnsworth @ 2007-10-08 18:52 UTC (permalink / raw) To: Valentine Barshak; +Cc: david-b, linuxppc-dev, linux-usb-devel On Mon, Oct 08, 2007 at 10:41:40PM +0400, Valentine Barshak wrote: > Add OHCI big endian frame_no quirk. > The frame_no value stored in the HCCA is a 16 bit field > at a specific offset, but since not all CPUs can do 16-bit > memory accesses it's used as a 32 bit field. > And that's why big-endian OHCI will shift 16 bits, > unless the spec is not followed. Currently there's one MPC52xx > platform that doesn't need the shift. This case is hanled > using big endian frame_no quirk. > > Signed-off-by: Valentine Barshak <vbarshak@ru•mvista.com> Acked-by: Dale Farnsworth <dale@farnsworth•org> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 16:19 ` David Brownell 2007-10-08 16:54 ` [PATCH] USB: Add frame_no big endian OHCI quirk Valentine Barshak @ 2007-10-08 17:39 ` Kumar Gala 2007-10-08 17:42 ` Valentine Barshak 1 sibling, 1 reply; 11+ messages in thread From: Kumar Gala @ 2007-10-08 17:39 UTC (permalink / raw) To: David Brownell; +Cc: linuxppc-dev, linux-usb-devel On Oct 8, 2007, at 11:19 AM, David Brownell wrote: >>> Near as I can tell, the original code is wrong ... the hcca- >>> >frame_no >>> byte offset is fully specified, so that shift should always be 16. >> >> Are you saying that it should always be #define >> OHCI_BE_FRAME_NO_SHIFT >> 16 for big endian platforms? > > More than that, I'm saying that shouldn't even be a #define! The > default should be that drivers expect chips to follow the interface > specs. Any value other than 16 violates the OHCI spec. > > However, based on one other post, I suspect at least one Freescale > part will need to declare a chip quirk for this case. Which Freescale part do you think needs this? - k ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 17:39 ` [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support Kumar Gala @ 2007-10-08 17:42 ` Valentine Barshak 2007-10-08 19:45 ` David Brownell 0 siblings, 1 reply; 11+ messages in thread From: Valentine Barshak @ 2007-10-08 17:42 UTC (permalink / raw) To: Kumar Gala; +Cc: David Brownell, linuxppc-dev, linux-usb-devel Kumar Gala wrote: > > On Oct 8, 2007, at 11:19 AM, David Brownell wrote: > >>>> Near as I can tell, the original code is wrong ... the hcca->frame_no >>>> byte offset is fully specified, so that shift should always be 16. >>> >>> Are you saying that it should always be #define OHCI_BE_FRAME_NO_SHIFT >>> 16 for big endian platforms? >> >> More than that, I'm saying that shouldn't even be a #define! The >> default should be that drivers expect chips to follow the interface >> specs. Any value other than 16 violates the OHCI spec. >> >> However, based on one other post, I suspect at least one Freescale >> part will need to declare a chip quirk for this case. > > Which Freescale part do you think needs this? > > - k I've looked at drivers/usb/host/Kconfig It seems to be MPC52xx. David, is that the one you mentioned? Thanks, Valentine. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support 2007-10-08 17:42 ` Valentine Barshak @ 2007-10-08 19:45 ` David Brownell 0 siblings, 0 replies; 11+ messages in thread From: David Brownell @ 2007-10-08 19:45 UTC (permalink / raw) To: vbarshak, galak; +Cc: linuxppc-dev, linux-usb-devel > >> However, based on one other post, I suspect at least one Freescale > >> part will need to declare a chip quirk for this case. > > > > Which Freescale part do you think needs this? > > I've looked at drivers/usb/host/Kconfig > It seems to be MPC52xx. > David, is that the one you mentioned? I wasn't the one to mention it. It was someone else in this thread. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-10-08 19:45 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-10-08 14:25 [PATCH] OHCI: add PowerPC 440EP/440EPx support Valentine Barshak 2007-10-08 15:01 ` [linux-usb-devel] " David Brownell 2007-10-08 16:06 ` Valentine Barshak 2007-10-08 16:19 ` David Brownell 2007-10-08 16:54 ` [PATCH] USB: Add frame_no big endian OHCI quirk Valentine Barshak 2007-10-08 16:58 ` [linux-usb-devel] " Valentine Barshak 2007-10-08 18:41 ` Valentine Barshak 2007-10-08 18:52 ` [linux-usb-devel] " Dale Farnsworth 2007-10-08 17:39 ` [linux-usb-devel] [PATCH] OHCI: add PowerPC 440EP/440EPx support Kumar Gala 2007-10-08 17:42 ` Valentine Barshak 2007-10-08 19:45 ` David Brownell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox