Re: [PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
On Mon, Nov 24, 2014 at 05:21:34PM -0800, Greg KH wrote: > On Thu, Nov 13, 2014 at 10:36:28PM +0100, Andreas Herrmann wrote: > > From: Alan Stern > > > > Remove special-purpose octeon drivers and instead use ehci-platform > > and ohci-platform as suggested with > > http://marc.info/?l=linux-mips&m=140139694721623&w=2 > > > > [andreas.herrmann: > > fixed compile error] > > > > Cc: David Daney > > Cc: Alex Smith > > Signed-off-by: Alan Stern > > Signed-off-by: Andreas Herrmann > > Acked-by: Ralf Baechle > > Tested-by: Aaro Koskinen > > --- > > arch/mips/cavium-octeon/octeon-platform.c | 274 > > - > > arch/mips/configs/cavium_octeon_defconfig |3 + > > drivers/usb/host/Kconfig | 18 +- > > drivers/usb/host/Makefile |1 - > > drivers/usb/host/ehci-hcd.c |5 - > > drivers/usb/host/ehci-octeon.c| 188 > > drivers/usb/host/octeon2-common.c | 200 - > > drivers/usb/host/ohci-hcd.c |5 - > > drivers/usb/host/ohci-octeon.c| 202 - > > 9 files changed, 285 insertions(+), 611 deletions(-) > > delete mode 100644 drivers/usb/host/ehci-octeon.c > > delete mode 100644 drivers/usb/host/octeon2-common.c > > delete mode 100644 drivers/usb/host/ohci-octeon.c > > This doesn't apply to my usb-next or usb-testing branch of usb.git on > git.kernel.org, so I can't apply it :( Sorry, I need to rebase it (on usb-next). Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
On Thu, Nov 13, 2014 at 10:36:28PM +0100, Andreas Herrmann wrote: > From: Alan Stern > > Remove special-purpose octeon drivers and instead use ehci-platform > and ohci-platform as suggested with > http://marc.info/?l=linux-mips&m=140139694721623&w=2 > > [andreas.herrmann: > fixed compile error] > > Cc: David Daney > Cc: Alex Smith > Signed-off-by: Alan Stern > Signed-off-by: Andreas Herrmann > Acked-by: Ralf Baechle > Tested-by: Aaro Koskinen > --- > arch/mips/cavium-octeon/octeon-platform.c | 274 > - > arch/mips/configs/cavium_octeon_defconfig |3 + > drivers/usb/host/Kconfig | 18 +- > drivers/usb/host/Makefile |1 - > drivers/usb/host/ehci-hcd.c |5 - > drivers/usb/host/ehci-octeon.c| 188 > drivers/usb/host/octeon2-common.c | 200 - > drivers/usb/host/ohci-hcd.c |5 - > drivers/usb/host/ohci-octeon.c| 202 - > 9 files changed, 285 insertions(+), 611 deletions(-) > delete mode 100644 drivers/usb/host/ehci-octeon.c > delete mode 100644 drivers/usb/host/octeon2-common.c > delete mode 100644 drivers/usb/host/ohci-octeon.c This doesn't apply to my usb-next or usb-testing branch of usb.git on git.kernel.org, so I can't apply it :( -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
On Fri, Nov 14, 2014 at 10:31:51AM +0100, Ralf Baechle wrote: > On Thu, Nov 13, 2014 at 10:36:28PM +0100, Andreas Herrmann wrote: > > > From: Alan Stern > > > > From: Alan Stern > > Is there an echo? Oops. > Is there an echo? LOL. > > Remove special-purpose octeon drivers and instead use ehci-platform > > and ohci-platform as suggested with > > http://marc.info/?l=linux-mips&m=140139694721623&w=2 > > > > [andreas.herrmann: > > fixed compile error] > > > > Cc: David Daney > > Cc: Alex Smith > > Cc: Alan Stern > > Signed-off-by: Alan Stern > > Signed-off-by: Andreas Herrmann > > --- > > arch/mips/cavium-octeon/octeon-platform.c | 274 > > - > > arch/mips/configs/cavium_octeon_defconfig |3 + > > drivers/usb/host/Kconfig | 18 +- > > drivers/usb/host/Makefile |1 - > > drivers/usb/host/ehci-hcd.c |5 - > > drivers/usb/host/ehci-octeon.c| 188 > > drivers/usb/host/octeon2-common.c | 200 - > > drivers/usb/host/ohci-hcd.c |5 - > > drivers/usb/host/ohci-octeon.c| 202 - > > 9 files changed, 285 insertions(+), 611 deletions(-) > > delete mode 100644 drivers/usb/host/ehci-octeon.c > > delete mode 100644 drivers/usb/host/octeon2-common.c > > delete mode 100644 drivers/usb/host/ohci-octeon.c > > For the MIPS bits: > > For the MIPS bits: > > Acked-by: Ralf Baechle > > Acked-by: Ralf Baechle > > Ralf > > Ralf Double thanks, Andreas -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
On Thu, Nov 13, 2014 at 10:36:28PM +0100, Andreas Herrmann wrote: > From: Alan Stern > > From: Alan Stern Is there an echo? Is there an echo? > Remove special-purpose octeon drivers and instead use ehci-platform > and ohci-platform as suggested with > http://marc.info/?l=linux-mips&m=140139694721623&w=2 > > [andreas.herrmann: > fixed compile error] > > Cc: David Daney > Cc: Alex Smith > Cc: Alan Stern > Signed-off-by: Alan Stern > Signed-off-by: Andreas Herrmann > --- > arch/mips/cavium-octeon/octeon-platform.c | 274 > - > arch/mips/configs/cavium_octeon_defconfig |3 + > drivers/usb/host/Kconfig | 18 +- > drivers/usb/host/Makefile |1 - > drivers/usb/host/ehci-hcd.c |5 - > drivers/usb/host/ehci-octeon.c| 188 > drivers/usb/host/octeon2-common.c | 200 - > drivers/usb/host/ohci-hcd.c |5 - > drivers/usb/host/ohci-octeon.c| 202 - > 9 files changed, 285 insertions(+), 611 deletions(-) > delete mode 100644 drivers/usb/host/ehci-octeon.c > delete mode 100644 drivers/usb/host/octeon2-common.c > delete mode 100644 drivers/usb/host/ohci-octeon.c For the MIPS bits: For the MIPS bits: Acked-by: Ralf Baechle Acked-by: Ralf Baechle Ralf Ralf -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
From: Alan Stern From: Alan Stern Remove special-purpose octeon drivers and instead use ehci-platform and ohci-platform as suggested with http://marc.info/?l=linux-mips&m=140139694721623&w=2 [andreas.herrmann: fixed compile error] Cc: David Daney Cc: Alex Smith Cc: Alan Stern Signed-off-by: Alan Stern Signed-off-by: Andreas Herrmann --- arch/mips/cavium-octeon/octeon-platform.c | 274 - arch/mips/configs/cavium_octeon_defconfig |3 + drivers/usb/host/Kconfig | 18 +- drivers/usb/host/Makefile |1 - drivers/usb/host/ehci-hcd.c |5 - drivers/usb/host/ehci-octeon.c| 188 drivers/usb/host/octeon2-common.c | 200 - drivers/usb/host/ohci-hcd.c |5 - drivers/usb/host/ohci-octeon.c| 202 - 9 files changed, 285 insertions(+), 611 deletions(-) delete mode 100644 drivers/usb/host/ehci-octeon.c delete mode 100644 drivers/usb/host/octeon2-common.c delete mode 100644 drivers/usb/host/ohci-octeon.c diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 6df0f4d..b67ddf0 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -7,22 +7,27 @@ * Copyright (C) 2008 Wind River Systems */ +#include #include #include #include #include #include #include +#include #include #include #include #include #include +#include +#include #include #include #include #include +#include /* Octeon Random Number Generator. */ static int __init octeon_rng_device_init(void) @@ -68,6 +73,229 @@ device_initcall(octeon_rng_device_init); #ifdef CONFIG_USB +static DEFINE_MUTEX(octeon2_usb_clocks_mutex); + +static int octeon2_usb_clock_start_cnt; + +static void octeon2_usb_clocks_start(void) +{ + u64 div; + union cvmx_uctlx_if_ena if_ena; + union cvmx_uctlx_clk_rst_ctl clk_rst_ctl; + union cvmx_uctlx_uphy_ctl_status uphy_ctl_status; + union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; + int i; + unsigned long io_clk_64_to_ns; + + + mutex_lock(&octeon2_usb_clocks_mutex); + + octeon2_usb_clock_start_cnt++; + if (octeon2_usb_clock_start_cnt != 1) + goto exit; + + io_clk_64_to_ns = 640ull / octeon_get_io_clock_rate(); + + /* +* Step 1: Wait for voltages stable. That surely happened +* before starting the kernel. +* +* Step 2: Enable SCLK of UCTL by writing UCTL0_IF_ENA[EN] = 1 +*/ + if_ena.u64 = 0; + if_ena.s.en = 1; + cvmx_write_csr(CVMX_UCTLX_IF_ENA(0), if_ena.u64); + + /* Step 3: Configure the reference clock, PHY, and HCLK */ + clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); + + /* +* If the UCTL looks like it has already been started, skip +* the initialization, otherwise bus errors are obtained. +*/ + if (clk_rst_ctl.s.hrst) + goto end_clock; + /* 3a */ + clk_rst_ctl.s.p_por = 1; + clk_rst_ctl.s.hrst = 0; + clk_rst_ctl.s.p_prst = 0; + clk_rst_ctl.s.h_clkdiv_rst = 0; + clk_rst_ctl.s.o_clkdiv_rst = 0; + clk_rst_ctl.s.h_clkdiv_en = 0; + clk_rst_ctl.s.o_clkdiv_en = 0; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); + + /* 3b */ + /* 12MHz crystal. */ + clk_rst_ctl.s.p_refclk_sel = 0; + clk_rst_ctl.s.p_refclk_div = 0; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); + + /* 3c */ + div = octeon_get_io_clock_rate() / 13000ull; + + switch (div) { + case 0: + div = 1; + break; + case 1: + case 2: + case 3: + case 4: + break; + case 5: + div = 4; + break; + case 6: + case 7: + div = 6; + break; + case 8: + case 9: + case 10: + case 11: + div = 8; + break; + default: + div = 12; + break; + } + clk_rst_ctl.s.h_div = div; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); + /* Read it back, */ + clk_rst_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_CLK_RST_CTL(0)); + clk_rst_ctl.s.h_clkdiv_en = 1; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); + /* 3d */ + clk_rst_ctl.s.h_clkdiv_rst = 1; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); + + /* 3e: delay 64 io clocks */ + ndelay(io_clk_64_to_ns); + + /* +* Step 4: Program the power-on reset field in the UCTL +* clock-reset-control register. +*/ + clk_rst_ctl.s.p_por = 0; + cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk