[PATCH resend v3] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Tested-by: Aaro Koskinen aaro.koski...@iki.fi Acked-by: Alan Stern st...@rowland.harvard.edu --- arch/mips/cavium-octeon/octeon-platform.c |4 +--- drivers/usb/host/ehci-platform.c |3 ++- include/linux/usb/ehci_pdriver.h |1 + 3 files changed, 4 insertions(+), 4 deletions(-) Patch rebased on usb-testing as of v3.19-rc2-21-g1d97869. Thanks, Andreas diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index eea60b6..12410a2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { #ifdef __BIG_ENDIAN .big_endian_mmio= 1, #endif + .dma_mask_64= 1, .power_on = octeon_ehci_power_on, .power_off = octeon_ehci_power_off, }; @@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev) octeon2_usb_clocks_stop(); } -static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); - static int __init octeon_ehci_device_init(void) { struct platform_device *pd; @@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void) if (!pd) return 0; - pd-dev.dma_mask = octeon_ehci_dma_mask; pd-dev.platform_data = octeon_ehci_pdata; octeon_ehci_hw_start(pd-dev); diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 28aae64..63f2622 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev) if (!pdata) pdata = ehci_platform_defaults; - err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32)); + err = dma_coerce_mask_and_coherent(dev-dev, + pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); if (err) return err; diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index 6287b39..db0431b 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -48,6 +48,7 @@ struct usb_ehci_pdata { unsignedbig_endian_mmio:1; unsignedno_io_watchdog:1; unsignedreset_on_resume:1; + unsigneddma_mask_64:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- 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 2/2 resend v2] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
On Tue, Jan 06, 2015 at 10:49:40AM -0500, Alan Stern wrote: On Tue, 6 Jan 2015, Andreas Herrmann wrote: ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Tested-by: Aaro Koskinen aaro.koski...@iki.fi Acked-by: Alan Stern st...@rowland.harvard.edu Is something like this also needed for ohci-platform? No, I don't think so. Or are all OHCI implementations restricted to 32-bit DMA masks? AFAIK OHCI supports only 32-bit memory addressing. Alan Stern 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
[PATCH 1/2 resend v2] USB: host: Remove hard-coded octeon platform information for ehci/ohci
Instead rely on device tree information for ehci and ohci. This was suggested with http://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mipsi=1401358203-60225-4-git-send-email-alex.smith%40imgtec.com The device tree will *always* have correct ehci/ohci clock configuration, so use it. This allows us to remove a big chunk of platform configuration code from octeon-platform.c. More or less I rebased that patch on Alan's work to remove ehci-octeon and ohci-octeon drivers. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Acked-by: Ralf Baechle r...@linux-mips.org Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- arch/mips/cavium-octeon/octeon-platform.c | 148 - drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ohci-platform.c |1 + 3 files changed, 64 insertions(+), 86 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index b67ddf0..eea60b6 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -77,7 +77,7 @@ static DEFINE_MUTEX(octeon2_usb_clocks_mutex); static int octeon2_usb_clock_start_cnt; -static void octeon2_usb_clocks_start(void) +static void octeon2_usb_clocks_start(struct device *dev) { u64 div; union cvmx_uctlx_if_ena if_ena; @@ -86,6 +86,8 @@ static void octeon2_usb_clocks_start(void) union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; int i; unsigned long io_clk_64_to_ns; + u32 clock_rate = 1200; + bool is_crystal_clock = false; mutex_lock(octeon2_usb_clocks_mutex); @@ -96,6 +98,28 @@ static void octeon2_usb_clocks_start(void) io_clk_64_to_ns = 640ull / octeon_get_io_clock_rate(); + if (dev-of_node) { + struct device_node *uctl_node; + const char *clock_type; + + uctl_node = of_get_parent(dev-of_node); + if (!uctl_node) { + dev_err(dev, No UCTL device node\n); + goto exit; + } + i = of_property_read_u32(uctl_node, +refclk-frequency, clock_rate); + if (i) { + dev_err(dev, No UCTL \refclk-frequency\\n); + goto exit; + } + i = of_property_read_string(uctl_node, + refclk-type, clock_type); + + if (!i strcmp(crystal, clock_type) == 0) + is_crystal_clock = true; + } + /* * Step 1: Wait for voltages stable. That surely happened * before starting the kernel. @@ -126,9 +150,22 @@ static void octeon2_usb_clocks_start(void) 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; + clk_rst_ctl.s.p_refclk_sel = is_crystal_clock ? 0 : 1; + switch (clock_rate) { + default: + pr_err(Invalid UCTL clock rate of %u, using 1200 instead\n, + clock_rate); + /* Fall through */ + case 1200: + clk_rst_ctl.s.p_refclk_div = 0; + break; + case 2400: + clk_rst_ctl.s.p_refclk_div = 1; + break; + case 4800: + clk_rst_ctl.s.p_refclk_div = 2; + break; + } cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); /* 3c */ @@ -259,7 +296,7 @@ static void octeon2_usb_clocks_stop(void) static int octeon_ehci_power_on(struct platform_device *pdev) { - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(pdev-dev); return 0; } @@ -277,11 +314,11 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { .power_off = octeon_ehci_power_off, }; -static void __init octeon_ehci_hw_start(void) +static void __init octeon_ehci_hw_start(struct device *dev) { union cvmx_uctlx_ehci_ctl ehci_ctl; - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(dev); ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); /* Use 64-bit addressing. */ @@ -299,59 +336,28 @@ static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); static int __init octeon_ehci_device_init(void) { struct platform_device *pd; + struct device_node *ehci_node; int ret = 0; - struct resource usb_resources[] = { - { - .flags = IORESOURCE_MEM, - }, { - .flags = IORESOURCE_IRQ, - } - }; - - /* Only Octeon2 has ehci/ohci */ - if (!OCTEON_IS_MODEL
[PATCH 2/2 resend v2] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- arch/mips/cavium-octeon/octeon-platform.c |4 +--- drivers/usb/host/ehci-platform.c |3 ++- include/linux/usb/ehci_pdriver.h |1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index eea60b6..12410a2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { #ifdef __BIG_ENDIAN .big_endian_mmio= 1, #endif + .dma_mask_64= 1, .power_on = octeon_ehci_power_on, .power_off = octeon_ehci_power_off, }; @@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev) octeon2_usb_clocks_stop(); } -static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); - static int __init octeon_ehci_device_init(void) { struct platform_device *pd; @@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void) if (!pd) return 0; - pd-dev.dma_mask = octeon_ehci_dma_mask; pd-dev.platform_data = octeon_ehci_pdata; octeon_ehci_hw_start(pd-dev); diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 29b244c..75631b9 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev) if (!pdata) pdata = ehci_platform_defaults; - err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32)); + err = dma_coerce_mask_and_coherent(dev-dev, + pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); if (err) return err; diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index 7eb4dcd..f69529e 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsignedbig_endian_desc:1; unsignedbig_endian_mmio:1; unsignedno_io_watchdog:1; + unsigneddma_mask_64:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- 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 0/2 resend v2] USB: host: Misc patches to remove hard-coded octeon platform information
On Tue, Jan 06, 2015 at 01:46:44PM +0100, Andreas Herrmann wrote: This is a re-submission of patches 2 and 3 from http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrm...@caviumnetworks.com (Only patch 1/3 made it into usb-next and meanwhile is in mainline.) Please apply. Thanks, Andreas PS: It's v2 as with last submission I hit the merge window. Patches are rebased to v3.19-rc2. Only change is usage of a permanent link for the mail referenced in commit message of patch 2/2. In fact I meant commit message of patch 1 of 2. 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
[PATCH 0/2 resend v2] USB: host: Misc patches to remove hard-coded octeon platform information
This is a re-submission of patches 2 and 3 from http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrm...@caviumnetworks.com (Only patch 1/3 made it into usb-next and meanwhile is in mainline.) Please apply. Thanks, Andreas PS: It's v2 as with last submission I hit the merge window. Patches are rebased to v3.19-rc2. Only change is usage of a permanent link for the mail referenced in commit message of patch 2/2. -- 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 0/2 resend] USB: host: Misc patches to remove hard-coded octeon platform information
This is a re-submission of patches 2 and 3 from http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrm...@caviumnetworks.com (Only patch 1/3 made it into usb-next and meanwhile is in mainline.) Please apply. 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
[PATCH 2/2 resend] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- arch/mips/cavium-octeon/octeon-platform.c |4 +--- drivers/usb/host/ehci-platform.c |3 ++- include/linux/usb/ehci_pdriver.h |1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index eea60b6..12410a2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { #ifdef __BIG_ENDIAN .big_endian_mmio= 1, #endif + .dma_mask_64= 1, .power_on = octeon_ehci_power_on, .power_off = octeon_ehci_power_off, }; @@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev) octeon2_usb_clocks_stop(); } -static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); - static int __init octeon_ehci_device_init(void) { struct platform_device *pd; @@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void) if (!pd) return 0; - pd-dev.dma_mask = octeon_ehci_dma_mask; pd-dev.platform_data = octeon_ehci_pdata; octeon_ehci_hw_start(pd-dev); diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 5b8533f..37abbe2 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev) if (!pdata) pdata = ehci_platform_defaults; - err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32)); + err = dma_coerce_mask_and_coherent(dev-dev, + pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); if (err) return err; diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index 7eb4dcd..f69529e 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsignedbig_endian_desc:1; unsignedbig_endian_mmio:1; unsignedno_io_watchdog:1; + unsigneddma_mask_64:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- 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/2 resend] USB: host: Remove hard-coded octeon platform information for ehci/ohci
Instead rely on device tree information for ehci and ohci. This was suggested with http://www.linux-mips.org/archives/linux-mips/2014-05/msg00307.html The device tree will *always* have correct ehci/ohci clock configuration, so use it. This allows us to remove a big chunk of platform configuration code from octeon-platform.c. More or less I rebased that patch on Alan's work to remove ehci-octeon and ohci-octeon drivers. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Acked-by: Ralf Baechle r...@linux-mips.org Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- arch/mips/cavium-octeon/octeon-platform.c | 148 - drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ohci-platform.c |1 + 3 files changed, 64 insertions(+), 86 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index b67ddf0..eea60b6 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -77,7 +77,7 @@ static DEFINE_MUTEX(octeon2_usb_clocks_mutex); static int octeon2_usb_clock_start_cnt; -static void octeon2_usb_clocks_start(void) +static void octeon2_usb_clocks_start(struct device *dev) { u64 div; union cvmx_uctlx_if_ena if_ena; @@ -86,6 +86,8 @@ static void octeon2_usb_clocks_start(void) union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; int i; unsigned long io_clk_64_to_ns; + u32 clock_rate = 1200; + bool is_crystal_clock = false; mutex_lock(octeon2_usb_clocks_mutex); @@ -96,6 +98,28 @@ static void octeon2_usb_clocks_start(void) io_clk_64_to_ns = 640ull / octeon_get_io_clock_rate(); + if (dev-of_node) { + struct device_node *uctl_node; + const char *clock_type; + + uctl_node = of_get_parent(dev-of_node); + if (!uctl_node) { + dev_err(dev, No UCTL device node\n); + goto exit; + } + i = of_property_read_u32(uctl_node, +refclk-frequency, clock_rate); + if (i) { + dev_err(dev, No UCTL \refclk-frequency\\n); + goto exit; + } + i = of_property_read_string(uctl_node, + refclk-type, clock_type); + + if (!i strcmp(crystal, clock_type) == 0) + is_crystal_clock = true; + } + /* * Step 1: Wait for voltages stable. That surely happened * before starting the kernel. @@ -126,9 +150,22 @@ static void octeon2_usb_clocks_start(void) 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; + clk_rst_ctl.s.p_refclk_sel = is_crystal_clock ? 0 : 1; + switch (clock_rate) { + default: + pr_err(Invalid UCTL clock rate of %u, using 1200 instead\n, + clock_rate); + /* Fall through */ + case 1200: + clk_rst_ctl.s.p_refclk_div = 0; + break; + case 2400: + clk_rst_ctl.s.p_refclk_div = 1; + break; + case 4800: + clk_rst_ctl.s.p_refclk_div = 2; + break; + } cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); /* 3c */ @@ -259,7 +296,7 @@ static void octeon2_usb_clocks_stop(void) static int octeon_ehci_power_on(struct platform_device *pdev) { - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(pdev-dev); return 0; } @@ -277,11 +314,11 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { .power_off = octeon_ehci_power_off, }; -static void __init octeon_ehci_hw_start(void) +static void __init octeon_ehci_hw_start(struct device *dev) { union cvmx_uctlx_ehci_ctl ehci_ctl; - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(dev); ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); /* Use 64-bit addressing. */ @@ -299,59 +336,28 @@ static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); static int __init octeon_ehci_device_init(void) { struct platform_device *pd; + struct device_node *ehci_node; int ret = 0; - struct resource usb_resources[] = { - { - .flags = IORESOURCE_MEM, - }, { - .flags = IORESOURCE_IRQ, - } - }; - - /* Only Octeon2 has ehci/ohci */ - if (!OCTEON_IS_MODEL(OCTEON_CN63XX)) + ehci_node
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 st...@rowland.harvard.edu Remove special-purpose octeon drivers and instead use ehci-platform and ohci-platform as suggested with http://marc.info/?l=linux-mipsm=140139694721623w=2 [andreas.herrmann: fixed compile error] Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Signed-off-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Acked-by: Ralf Baechle r...@linux-mips.org Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- 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
[PATCH 1/3 v2] USB: host: Remove ehci-octeon and ohci-octeon drivers
From: Alan Stern st...@rowland.harvard.edu Remove special-purpose octeon drivers and instead use ehci-platform and ohci-platform as suggested with http://marc.info/?l=linux-mipsm=140139694721623w=2 [andreas.herrmann: fixed compile error] Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Signed-off-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com Acked-by: Ralf Baechle r...@linux-mips.org Tested-by: Aaro Koskinen aaro.koski...@iki.fi --- 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| 182 --- drivers/usb/host/octeon2-common.c | 200 - drivers/usb/host/ohci-hcd.c |5 - drivers/usb/host/ohci-octeon.c| 196 - 9 files changed, 285 insertions(+), 599 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 There was a conflict with commits 073153bf22764 (host: ehci-octeon: remove duplicate check on resource) c6d413cebd82c (host: ohci-octeon: remove duplicate check on resource) I rebased the patch to your usb-next branch as of v3.18-rc4-66-g69b7290. Patch 2 and 3 of the series should apply w/o issues. Thanks, Andreas 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 linux/delay.h #include linux/init.h #include linux/irq.h #include linux/i2c.h #include linux/usb.h #include linux/dma-mapping.h #include linux/module.h +#include linux/mutex.h #include linux/slab.h #include linux/platform_device.h #include linux/of_platform.h #include linux/of_fdt.h #include linux/libfdt.h +#include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/octeon/octeon.h #include asm/octeon/cvmx-rnm-defs.h #include asm/octeon/cvmx-helper.h #include asm/octeon/cvmx-helper-board.h +#include asm/octeon/cvmx-uctlx-defs.h /* 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
Re: [PATCH 3/3] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
On Thu, Nov 13, 2014 at 08:44:17PM -0800, Florian Fainelli wrote: 2014-11-13 13:36 GMT-08:00 Andreas Herrmann andreas.herrm...@caviumnetworks.com: ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Why not just allow enforcing an arbitrary DMA mask? I thought about that but as it's currently just 32 or 64 bits a flag is sufficient. (At the moment I am not aware that other ehci-platform devices would require something else.) I'll change the flag to a mask if desired. Alan, what's your opinion about this? Andreas Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com --- arch/mips/cavium-octeon/octeon-platform.c |4 +--- drivers/usb/host/ehci-platform.c |3 ++- include/linux/usb/ehci_pdriver.h |1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index eea60b6..12410a2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { #ifdef __BIG_ENDIAN .big_endian_mmio= 1, #endif + .dma_mask_64= 1, .power_on = octeon_ehci_power_on, .power_off = octeon_ehci_power_off, }; @@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev) octeon2_usb_clocks_stop(); } -static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); - static int __init octeon_ehci_device_init(void) { struct platform_device *pd; @@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void) if (!pd) return 0; - pd-dev.dma_mask = octeon_ehci_dma_mask; pd-dev.platform_data = octeon_ehci_pdata; octeon_ehci_hw_start(pd-dev); diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2da18ea..6df808b 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev) if (!pdata) pdata = ehci_platform_defaults; - err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32)); + err = dma_coerce_mask_and_coherent(dev-dev, + pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); if (err) return err; diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index 7eb4dcd..f69529e 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsignedbig_endian_desc:1; unsignedbig_endian_mmio:1; unsignedno_io_watchdog:1; + unsigneddma_mask_64:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- Florian -- 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 st...@rowland.harvard.edu From: Alan Stern st...@rowland.harvard.edu 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-mipsm=140139694721623w=2 [andreas.herrmann: fixed compile error] Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com --- 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 r...@linux-mips.org Acked-by: Ralf Baechle r...@linux-mips.org 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 0/3] USB: host: Misc patches to remove hard-coded octeon platform information
On Thu, Nov 13, 2014 at 05:13:36PM -0500, Alan Stern wrote: On Thu, 13 Nov 2014, Andreas Herrmann wrote: Hi Alan, With following patches I want to base octeon ehci/ohci device configuration on device tree information. I picked up patches that were submitted in May. See http://marc.info/?l=linux-usbm=140135823325811w=2 and http://marc.info/?l=linux-mipsm=140139694721623w=2 Patch #1 is your untested preliminary pass to remove [oe]hci-octeon drivers. Patch #2 is the removal of hard-coded platform information (but now rebased on your patch) Patch #3 adapts dma_mask for ehci (as used in ehci-octeon) Overall diffstat is arch/mips/cavium-octeon/octeon-platform.c | 380 +++-- 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/ehci-platform.c |4 +- drivers/usb/host/octeon2-common.c | 200 --- drivers/usb/host/ohci-hcd.c |5 - drivers/usb/host/ohci-octeon.c| 202 --- drivers/usb/host/ohci-platform.c |1 + include/linux/usb/ehci_pdriver.h |1 + 12 files changed, 330 insertions(+), 678 deletions(-) Patches are based on v3.18-rc4-65-g2c54396 Comments welcome. At a very quick first glance, it looks great. Have you tested it thoroughly? [sorry have to use another mail account, so far your mail didn't show up at my caviumnetworks account] I've tested it only on an EdgeRouterPro (Octeon II system, which I have on-site). octeon_ehci_device_init and octeon_ohci_device_init run way before ehci-platform and ohci-platform probe for devices. So everything should be initialized orderly. With current mainline (w/o these patches) USB doesn't work on my EdgeRouterPro due to an (inappropriate) OCTEON_IS_MODEL check. I'd say having the patches in linux-next for awhile wouldn't hurt. 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
[PATCH 1/3] USB: host: Remove ehci-octeon and ohci-octeon drivers
From: Alan Stern st...@rowland.harvard.edu From: Alan Stern st...@rowland.harvard.edu Remove special-purpose octeon drivers and instead use ehci-platform and ohci-platform as suggested with http://marc.info/?l=linux-mipsm=140139694721623w=2 [andreas.herrmann: fixed compile error] Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com --- 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 linux/delay.h #include linux/init.h #include linux/irq.h #include linux/i2c.h #include linux/usb.h #include linux/dma-mapping.h #include linux/module.h +#include linux/mutex.h #include linux/slab.h #include linux/platform_device.h #include linux/of_platform.h #include linux/of_fdt.h #include linux/libfdt.h +#include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/octeon/octeon.h #include asm/octeon/cvmx-rnm-defs.h #include asm/octeon/cvmx-helper.h #include asm/octeon/cvmx-helper-board.h +#include asm/octeon/cvmx-uctlx-defs.h /* 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
[PATCH 2/3] USB: host: Remove hard-coded octeon platform information for ehci/ohci
Instead rely on device tree information for ehci and ohci. This was suggested with http://www.linux-mips.org/archives/linux-mips/2014-05/msg00307.html The device tree will *always* have correct ehci/ohci clock configuration, so use it. This allows us to remove a big chunk of platform configuration code from octeon-platform.c. More or less I rebased that patch on Alan's work to remove ehci-octeon and ohci-octeon drivers. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com --- arch/mips/cavium-octeon/octeon-platform.c | 148 - drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ohci-platform.c |1 + 3 files changed, 64 insertions(+), 86 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index b67ddf0..eea60b6 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -77,7 +77,7 @@ static DEFINE_MUTEX(octeon2_usb_clocks_mutex); static int octeon2_usb_clock_start_cnt; -static void octeon2_usb_clocks_start(void) +static void octeon2_usb_clocks_start(struct device *dev) { u64 div; union cvmx_uctlx_if_ena if_ena; @@ -86,6 +86,8 @@ static void octeon2_usb_clocks_start(void) union cvmx_uctlx_uphy_portx_ctl_status port_ctl_status; int i; unsigned long io_clk_64_to_ns; + u32 clock_rate = 1200; + bool is_crystal_clock = false; mutex_lock(octeon2_usb_clocks_mutex); @@ -96,6 +98,28 @@ static void octeon2_usb_clocks_start(void) io_clk_64_to_ns = 640ull / octeon_get_io_clock_rate(); + if (dev-of_node) { + struct device_node *uctl_node; + const char *clock_type; + + uctl_node = of_get_parent(dev-of_node); + if (!uctl_node) { + dev_err(dev, No UCTL device node\n); + goto exit; + } + i = of_property_read_u32(uctl_node, +refclk-frequency, clock_rate); + if (i) { + dev_err(dev, No UCTL \refclk-frequency\\n); + goto exit; + } + i = of_property_read_string(uctl_node, + refclk-type, clock_type); + + if (!i strcmp(crystal, clock_type) == 0) + is_crystal_clock = true; + } + /* * Step 1: Wait for voltages stable. That surely happened * before starting the kernel. @@ -126,9 +150,22 @@ static void octeon2_usb_clocks_start(void) 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; + clk_rst_ctl.s.p_refclk_sel = is_crystal_clock ? 0 : 1; + switch (clock_rate) { + default: + pr_err(Invalid UCTL clock rate of %u, using 1200 instead\n, + clock_rate); + /* Fall through */ + case 1200: + clk_rst_ctl.s.p_refclk_div = 0; + break; + case 2400: + clk_rst_ctl.s.p_refclk_div = 1; + break; + case 4800: + clk_rst_ctl.s.p_refclk_div = 2; + break; + } cvmx_write_csr(CVMX_UCTLX_CLK_RST_CTL(0), clk_rst_ctl.u64); /* 3c */ @@ -259,7 +296,7 @@ static void octeon2_usb_clocks_stop(void) static int octeon_ehci_power_on(struct platform_device *pdev) { - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(pdev-dev); return 0; } @@ -277,11 +314,11 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { .power_off = octeon_ehci_power_off, }; -static void __init octeon_ehci_hw_start(void) +static void __init octeon_ehci_hw_start(struct device *dev) { union cvmx_uctlx_ehci_ctl ehci_ctl; - octeon2_usb_clocks_start(); + octeon2_usb_clocks_start(dev); ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); /* Use 64-bit addressing. */ @@ -299,59 +336,28 @@ static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); static int __init octeon_ehci_device_init(void) { struct platform_device *pd; + struct device_node *ehci_node; int ret = 0; - struct resource usb_resources[] = { - { - .flags = IORESOURCE_MEM, - }, { - .flags = IORESOURCE_IRQ, - } - }; - - /* Only Octeon2 has ehci/ohci */ - if (!OCTEON_IS_MODEL(OCTEON_CN63XX)) + ehci_node = of_find_node_by_name(NULL, ehci); + if (!ehci_node) return 0
[PATCH 0/3] USB: host: Misc patches to remove hard-coded octeon platform information
Hi Alan, With following patches I want to base octeon ehci/ohci device configuration on device tree information. I picked up patches that were submitted in May. See http://marc.info/?l=linux-usbm=140135823325811w=2 and http://marc.info/?l=linux-mipsm=140139694721623w=2 Patch #1 is your untested preliminary pass to remove [oe]hci-octeon drivers. Patch #2 is the removal of hard-coded platform information (but now rebased on your patch) Patch #3 adapts dma_mask for ehci (as used in ehci-octeon) Overall diffstat is arch/mips/cavium-octeon/octeon-platform.c | 380 +++-- 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/ehci-platform.c |4 +- drivers/usb/host/octeon2-common.c | 200 --- drivers/usb/host/ohci-hcd.c |5 - drivers/usb/host/ohci-octeon.c| 202 --- drivers/usb/host/ohci-platform.c |1 + include/linux/usb/ehci_pdriver.h |1 + 12 files changed, 330 insertions(+), 678 deletions(-) Patches are based on v3.18-rc4-65-g2c54396 Comments welcome. 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
[PATCH 3/3] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
ehci-octeon driver used a 64-bit dma_mask. With removal of ehci-octeon and usage of ehci-platform ehci dma_mask is now limited to 32 bits (coerced in ehci_platform_probe). Provide a flag in ehci platform data to allow use of 64 bits for dma_mask. Cc: David Daney david.da...@cavium.com Cc: Alex Smith alex.sm...@imgtec.com Cc: Alan Stern st...@rowland.harvard.edu Signed-off-by: Andreas Herrmann andreas.herrm...@caviumnetworks.com --- arch/mips/cavium-octeon/octeon-platform.c |4 +--- drivers/usb/host/ehci-platform.c |3 ++- include/linux/usb/ehci_pdriver.h |1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index eea60b6..12410a2 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -310,6 +310,7 @@ static struct usb_ehci_pdata octeon_ehci_pdata = { #ifdef __BIG_ENDIAN .big_endian_mmio= 1, #endif + .dma_mask_64= 1, .power_on = octeon_ehci_power_on, .power_off = octeon_ehci_power_off, }; @@ -331,8 +332,6 @@ static void __init octeon_ehci_hw_start(struct device *dev) octeon2_usb_clocks_stop(); } -static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); - static int __init octeon_ehci_device_init(void) { struct platform_device *pd; @@ -347,7 +346,6 @@ static int __init octeon_ehci_device_init(void) if (!pd) return 0; - pd-dev.dma_mask = octeon_ehci_dma_mask; pd-dev.platform_data = octeon_ehci_pdata; octeon_ehci_hw_start(pd-dev); diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 2da18ea..6df808b 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -155,7 +155,8 @@ static int ehci_platform_probe(struct platform_device *dev) if (!pdata) pdata = ehci_platform_defaults; - err = dma_coerce_mask_and_coherent(dev-dev, DMA_BIT_MASK(32)); + err = dma_coerce_mask_and_coherent(dev-dev, + pdata-dma_mask_64 ? DMA_BIT_MASK(64) : DMA_BIT_MASK(32)); if (err) return err; diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index 7eb4dcd..f69529e 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsignedbig_endian_desc:1; unsignedbig_endian_mmio:1; unsignedno_io_watchdog:1; + unsigneddma_mask_64:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- 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