From 197c0ce9b85f079062027dc23f8116b77da223c9 Mon Sep 17 00:00:00 2001 From: Daniel Badea Date: Tue, 9 Aug 2011 12:44:11 +0300 Subject: [PATCH] PXE boot stop USB but keep clocks running --- board/ti/panda/ehci-panda.c | 1 + common/cmd_bootm.c | 2 +- common/cmd_pxecfg.c | 5 ++++ drivers/usb/host/ehci-omap4.c | 44 ++++++++++++++-------------------------- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/board/ti/panda/ehci-panda.c b/board/ti/panda/ehci-panda.c index b1e247c..6eb38c0 100644 --- a/board/ti/panda/ehci-panda.c +++ b/board/ti/panda/ehci-panda.c @@ -56,4 +56,5 @@ int ehci_hcd_stop(void) omap_set_gpio_dataout(GPIO_HUB_NRESET, 0); omap_free_gpio(GPIO_HUB_POWER); omap_free_gpio(GPIO_HUB_NRESET); + return 0; } diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index 1966da4..bb96644 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -1209,7 +1209,7 @@ U_BOOT_CMD( #ifdef CONFIG_SILENT_CONSOLE static void fixup_silent_linux () { - char buf[256], *start, *end; + char buf[512], *start, *end; char *cmdline = getenv ("bootargs"); /* Only fix cmdline when requested */ diff --git a/common/cmd_pxecfg.c b/common/cmd_pxecfg.c index 694a212..fb6a512 100644 --- a/common/cmd_pxecfg.c +++ b/common/cmd_pxecfg.c @@ -433,6 +433,11 @@ static void label_boot(struct pxecfg_label *label) */ bootm_argv[3] = getenv("fdtaddr"); + /* Linux kernel 2.6.35 doesn't see USB Eth. device after + * "usb start" is issues in u-Boot. Force stop. + */ + usb_stop(); + if (bootm_argv[3]) do_bootm(NULL, 0, 4, bootm_argv); else diff --git a/drivers/usb/host/ehci-omap4.c b/drivers/usb/host/ehci-omap4.c index 19cd286..73dd1ee 100644 --- a/drivers/usb/host/ehci-omap4.c +++ b/drivers/usb/host/ehci-omap4.c @@ -227,42 +227,30 @@ int omap4_ehci_hcd_stop(void) unsigned base = get_timer(0); writel(OMAP4_UHH_SYSCONFIG_SOFTRESET, UHH_BASE + OMAP_UHH_SYSCONFIG); + writel(EHCI_INSNREG04_DISABLE_UNSUSPEND, EHCI_BASE + EHCI_INSNREG04); -#if 0 - /* We get timeout here */ - while (!(readl(UHH_BASE + OMAP_UHH_SYSSTATUS) & (1 << 0))) - if (get_timer(base) > CONFIG_SYS_HZ) { - printf("OMAP4 EHCI error: reset UHH 0 timeout\n"); - return -ETIMEDOUT; - } - - while (!(readl(UHH_BASE + OMAP_UHH_SYSSTATUS) & (1 << 1))) - if (get_timer(base) > CONFIG_SYS_HZ) { - printf("OMAP4 EHCI error: reset UHH 1 timeout\n"); - return -ETIMEDOUT; - } - - while (!(readl(UHH_BASE + OMAP_UHH_SYSSTATUS) & (1 << 2))) + writel(ULPI_FUNC_CTRL_RESET, EHCI_BASE + EHCI_INSNREG05_ULPI); + /* Wait for ULPI access completion */ + while ((readl(EHCI_BASE + EHCI_INSNREG05_ULPI) + & (1 << EHCI_INSNREG05_ULPI_CONTROL_SHIFT))) if (get_timer(base) > CONFIG_SYS_HZ) { - printf("OMAP4 EHCI error: reset UHH 2 timeout\n"); - return -ETIMEDOUT; + printf("OMAP4 EHCI error: timeout resetting phy\n"); + return -1; } -#endif - - writel((1 << 1), TLL_BASE + OMAP_USBTLL_SYSCONFIG); + /* perform TLL soft reset, and wait until reset is complete */ + writel(OMAP_USBTLL_SYSCONFIG_SOFTRESET, + TLL_BASE + OMAP_USBTLL_SYSCONFIG); - while (!(readl(TLL_BASE + OMAP_USBTLL_SYSSTATUS) & (1 << 0))) + /* Wait for TLL reset to complete */ + while (!(readl(TLL_BASE + OMAP_USBTLL_SYSSTATUS) + & OMAP_USBTLL_SYSSTATUS_RESETDONE)) if (get_timer(base) > CONFIG_SYS_HZ) { - printf("OMAP4 EHCI error: reset TLL timeout\n"); - return -ETIMEDOUT; + printf("OMAP4 EHCI error: timeout resetting TLL\n"); + return -1; } - /* Disable clocks */ - sr32((void *)0x4a0093e0, 0, 32, 0); - sr32((void *)0x4a009368, 0, 32, 0); - sr32((void *)0x4a0093d0, 0, 32, 0); - sr32((void *)0x4A009358, 0, 32, 0); + /* Do not disable clocks */ return 0; } -- 1.6.0.6