[U-Boot] [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver

This driver is tested on Sheevaplug platform
Signed-off-by: Prafulla Wadaskar prafulla@marvell.com --- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-kirkwood.c | 108 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 0 deletions(-) create mode 100644 drivers/usb/host/ehci-kirkwood.c
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index ec1d689..940d4a8 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -37,6 +37,7 @@ COBJS-$(CONFIG_USB_SL811HS) += sl811-hcd.o COBJS-$(CONFIG_USB_EHCI) += ehci-hcd.o COBJS-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o COBJS-$(CONFIG_USB_EHCI_IXP4XX) += ehci-ixp.o +COBJS-$(CONFIG_USB_EHCI_KIRKWOOD) += ehci-kirkwood.o COBJS-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o COBJS-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
diff --git a/drivers/usb/host/ehci-kirkwood.c b/drivers/usb/host/ehci-kirkwood.c new file mode 100644 index 0000000..64997b8 --- /dev/null +++ b/drivers/usb/host/ehci-kirkwood.c @@ -0,0 +1,108 @@ +/* + * (C) Copyright 2009 + * Marvell Semiconductor <www.marvell.com> + * Written-by: Prafulla Wadaskar prafulla@marvell.com + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ + +#include <common.h> +#include <asm/io.h> +#include <usb.h> +#include "ehci.h" +#include "ehci-core.h" +#include <asm/arch/kirkwood.h> + +#define rdl(off) readl(KW_USB20_BASE + (off)) +#define wrl(off, val) writel((val), KW_USB20_BASE + (off)) + +#define USB_WINDOW_CTRL(i) (0x320 + ((i) << 4)) +#define USB_WINDOW_BASE(i) (0x324 + ((i) << 4)) +#define USB_TARGET_DRAM 0x0 + +/* + * USB 2.0 Bridge Address Decoding registers setup + */ +static void usb_brg_adrdec_setup(void) +{ + int i; + u32 size, attrib; + + for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { + + /* Enable DRAM bank */ + switch (i) { + case 0: + attrib = KWCPU_ATTR_DRAM_CS0; + break; + case 1: + attrib = KWCPU_ATTR_DRAM_CS1; + break; + case 2: + attrib = KWCPU_ATTR_DRAM_CS2; + break; + case 3: + attrib = KWCPU_ATTR_DRAM_CS3; + break; + default: + /* invalide bank, disable access */ + attrib = 0; + break; + } + + size = kw_sdram_bs(i); + if ((size) && (attrib)) + wrl(USB_WINDOW_CTRL(i), + KWCPU_WIN_CTRL_DATA(size, USB_TARGET_DRAM, + attrib, KWCPU_WIN_ENABLE)); + else + wrl(USB_WINDOW_CTRL(i), KWCPU_WIN_DISABLE); + + wrl(USB_WINDOW_BASE(i), kw_sdram_bar(i)); + } +} + +/* + * Create the appropriate control structures to manage + * a new EHCI host controller. + */ +int ehci_hcd_init(void) +{ + usb_brg_adrdec_setup(); + + hccr = (struct ehci_hccr *)(KW_USB20_BASE + 0x100); + hcor = (struct ehci_hcor *)((uint32_t) hccr + + HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + + debug("Kirkwood-ehci: init hccr %x and hcor %x hc_length %d\n", + (uint32_t)hccr, (uint32_t)hcor, + (uint32_t)HC_LENGTH(ehci_readl(&hccr->cr_capbase))); + + return 0; +} + +/* + * Destroy the appropriate control structures corresponding + * the the EHCI host controller. + */ +int ehci_hcd_stop(void) +{ + return 0; +} +

-----Original Message----- From: Prafulla Wadaskar [mailto:prafulla@marvell.com] Sent: Monday, June 29, 2009 8:57 PM To: u-boot@lists.denx.de Cc: Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar Subject: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
This driver is tested on Sheevaplug platform
Dear Remy
Sorry for pinging :-) May be this has been skipped from your huge inbox :-) Can you pls kindly provide your feedback on this patch or Shall I repost it?
Regards.. Prafulla . .

Hi,
2009/7/8 Prafulla Wadaskar prafulla@marvell.com:
-----Original Message----- From: Prafulla Wadaskar [mailto:prafulla@marvell.com] Sent: Monday, June 29, 2009 8:57 PM To: u-boot@lists.denx.de Cc: Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar Subject: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver This driver is tested on Sheevaplug platform
Dear Remy
Sorry for pinging :-) May be this has been skipped from your huge inbox :-)
No, it was in there, I just overlooked it...
Can you pls kindly provide your feedback on this patch or Shall I repost it?
This patch looks fine to me. Applied to u-boot-usb.
Thanks.
Remy

On 21:49 Wed 08 Jul , Remy Bohmer wrote:
Hi,
2009/7/8 Prafulla Wadaskar prafulla@marvell.com:
-----Original Message----- From: Prafulla Wadaskar [mailto:prafulla@marvell.com] Sent: Monday, June 29, 2009 8:57 PM To: u-boot@lists.denx.de Cc: Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar Subject: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver This driver is tested on Sheevaplug platform
Dear Remy
Sorry for pinging :-) May be this has been skipped from your huge inbox :-)
No, it was in there, I just overlooked it...
Can you pls kindly provide your feedback on this patch or Shall I repost it?
This patch looks fine to me. Applied to u-boot-usb.
please send the pull request to finsh the sheevaplug support mainline
Best Regards, J.

-----Original Message----- From: l.pinguin@gmail.com [mailto:l.pinguin@gmail.com] On Behalf Of Remy Bohmer Sent: Thursday, July 09, 2009 1:20 AM To: Prafulla Wadaskar Cc: u-boot@lists.denx.de; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare Subject: Re: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
Hi,
2009/7/8 Prafulla Wadaskar prafulla@marvell.com:
-----Original Message----- From: Prafulla Wadaskar [mailto:prafulla@marvell.com] Sent: Monday, June 29, 2009 8:57 PM To: u-boot@lists.denx.de Cc: Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare; Prafulla Wadaskar Subject: [PATCH 5/6] usb: add Marvell Kirkwood ehci host
controller
driver This driver is tested on Sheevaplug platform
Dear Remy
Sorry for pinging :-) May be this has been skipped from your huge inbox :-)
No, it was in there, I just overlooked it...
Can you pls kindly provide your feedback on this patch or
Shall I repost it?
This patch looks fine to me. Applied to u-boot-usb.
Thanks Remy As stated in other email thread too. Now all dependencies for Sheevaplug board support are in accepted state except this patch http://lists.denx.de/pipermail/u-boot/2009-June/055112.html
Regards.. Prafulla . .
Thanks.
Remy

Hello Prafulla,
As stated in other email thread too. Now all dependencies for Sheevaplug board support are in accepted state except this patch http://lists.denx.de/pipermail/u-boot/2009-June/055112.html
I know that but I cannot test it because I do not have the hardware, so I depend on others here. (it might be even you). I already mentioned that I would prefer the cleanup patch from Michael Trimarchi, if it is correct.
At least there is 1 significant difference between your patch and the patch of Michael
Your patch contains this: -------------------------------------------------------- - typeReq = req->request << 8 | req->requesttype; + typeReq = req->request | req->requesttype << 8;
switch (le16_to_cpu(typeReq)) { --------------------------------------------------------
and Michael patch contains this: -------------------------------------------------------- - typeReq = req->request << 8 | req->requesttype; + typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) { + switch (typeReq) { --------------------------------------------------------
So, at least one of them is wrong. This difference is reason enough for me to not pull either patch in until this is clear.
Kind Regards,
Remy

-----Original Message----- From: l.pinguin@gmail.com [mailto:l.pinguin@gmail.com] On Behalf Of Remy Bohmer Sent: Thursday, July 09, 2009 1:00 PM To: Prafulla Wadaskar; Michael Trimarchi Cc: u-boot@lists.denx.de; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare Subject: Re: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
Hello Prafulla,
As stated in other email thread too. Now all dependencies for Sheevaplug board support are in accepted state except this patch http://lists.denx.de/pipermail/u-boot/2009-June/055112.html
I know that but I cannot test it because I do not have the hardware, so I depend on others here. (it might be even you). I already mentioned that I would prefer the cleanup patch from Michael Trimarchi, if it is correct.
At least there is 1 significant difference between your patch and the patch of Michael
Your patch contains this:
- typeReq = req->request << 8 | req->requesttype;
typeReq = req->request | req->requesttype << 8;
switch (le16_to_cpu(typeReq)) {
and Michael patch contains this:
- typeReq = req->request << 8 | req->requesttype;
- typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) {
- switch (typeReq) {
Dear Remy These two lines makes no difference for me since le16_to_cpu macro doesn't change anything for arm little-endian machines (i.e. Sheevaplug) Well.. for big endian machines someone need to check since it swaps bytes.
I think we should not remove this macro since it provides arch specific abstraction.
Regards.. Prafulla . .
So, at least one of them is wrong. This difference is reason enough for me to not pull either patch in until this is clear.
Kind Regards,
Remy

Hi,
At least there is 1 significant difference between your patch and the patch of Michael
Your patch contains this:
- typeReq = req->request << 8 | req->requesttype;
- typeReq = req->request | req->requesttype << 8;
switch (le16_to_cpu(typeReq)) {
and Michael patch contains this:
- typeReq = req->request << 8 | req->requesttype;
- typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) {
- switch (typeReq) {
Dear Remy These two lines makes no difference for me since le16_to_cpu macro doesn't change anything for arm little-endian machines (i.e. Sheevaplug) Well.. for big endian machines someone need to check since it swaps bytes.
Exactly!
I think we should not remove this macro since it provides arch specific abstraction.
Well, that depends, if it is not needed it should be removed... So, still I would not prefer to apply patches from which it is obvious that there is something wrong with it.
Kind Regards,
Remy

Prafulla Wadaskar wrote:
-----Original Message----- From: l.pinguin@gmail.com [mailto:l.pinguin@gmail.com] On Behalf Of Remy Bohmer Sent: Thursday, July 09, 2009 1:00 PM To: Prafulla Wadaskar; Michael Trimarchi Cc: u-boot@lists.denx.de; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare Subject: Re: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
Hello Prafulla,
As stated in other email thread too. Now all dependencies for Sheevaplug board support are in accepted state except this patch http://lists.denx.de/pipermail/u-boot/2009-June/055112.html
I know that but I cannot test it because I do not have the hardware, so I depend on others here. (it might be even you). I already mentioned that I would prefer the cleanup patch from Michael Trimarchi, if it is correct.
At least there is 1 significant difference between your patch and the patch of Michael
Your patch contains this:
- typeReq = req->request << 8 | req->requesttype;
typeReq = req->request | req->requesttype << 8;
switch (le16_to_cpu(typeReq)) {
and Michael patch contains this:
- typeReq = req->request << 8 | req->requesttype;
- typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) {
- switch (typeReq) {
Dear Remy These two lines makes no difference for me since le16_to_cpu macro doesn't change anything for arm little-endian machines (i.e. Sheevaplug) Well.. for big endian machines someone need to check since it swaps bytes.
I think we should not remove this macro since it provides arch specific abstraction.
If you don't remove the macro I think that you have trouble with big endian machines.
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=dr...
line 442
Michael
Regards.. Prafulla . .
So, at least one of them is wrong. This difference is reason enough for me to not pull either patch in until this is clear.
Kind Regards,
Remy

-----Original Message----- From: Michael Trimarchi [mailto:trimarchi@gandalf.sssup.it] Sent: Thursday, July 09, 2009 9:54 PM To: Prafulla Wadaskar Cc: Remy Bohmer; u-boot@lists.denx.de; Prabhanjan Sarnaik; Ronen Shitrit; Ashish Karkare Subject: Re: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
Prafulla Wadaskar wrote:
-----Original Message----- From: l.pinguin@gmail.com [mailto:l.pinguin@gmail.com] On
Behalf Of
Remy Bohmer Sent: Thursday, July 09, 2009 1:00 PM To: Prafulla Wadaskar; Michael Trimarchi Cc: u-boot@lists.denx.de; Prabhanjan Sarnaik; Ronen
Shitrit; Ashish
Karkare Subject: Re: [PATCH 5/6] usb: add Marvell Kirkwood ehci host controller driver
Hello Prafulla,
As stated in other email thread too. Now all dependencies for Sheevaplug board support are in accepted state except this patch http://lists.denx.de/pipermail/u-boot/2009-June/055112.html
I know that but I cannot test it because I do not have the
hardware,
so I depend on others here. (it might be even you). I already mentioned that I would prefer the cleanup patch from Michael Trimarchi, if it is correct.
At least there is 1 significant difference between your
patch and the
patch of Michael
Your patch contains this:
- typeReq = req->request << 8 | req->requesttype;
typeReq = req->request | req->requesttype << 8;
switch (le16_to_cpu(typeReq)) {
and Michael patch contains this:
- typeReq = req->request << 8 | req->requesttype;
- typeReq = req->request | req->requesttype << 8;
- switch (le16_to_cpu(typeReq)) {
- switch (typeReq) {
Dear Remy These two lines makes no difference for me since le16_to_cpu macro doesn't change anything for arm little-endian machines
(i.e. Sheevaplug) Well.. for big endian machines someone need to check since it swaps bytes.
I think we should not remove this macro since it provides
arch specific abstraction.
If you don't remove the macro I think that you have trouble with big endian machines.
Dear Michael At least common change in both the patch can be applied, this will at least resolve fix for little endian machines. We can defer second change until somebody tests it
Regards.. Prafulla . .
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.g
it;a=blob;f=drivers/usb/core/hcd.c;h=95ccfa0b9fc52876f5166b3edea039409adf9a33;hb=HEAD
line 442
Michael
Regards.. Prafulla . .
So, at least one of them is wrong. This difference is reason enough for me to not pull either
patch in
until this is clear.
Kind Regards,
Remy
participants (4)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Michael Trimarchi
-
Prafulla Wadaskar
-
Remy Bohmer