USB: host: Misc patches to remove hard-coded octeon platform information
Subsystems (4)
cover 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.herrmann@caviumnetworks.com
(Only patch 1/3 made it into usb-next and meanwhile is in mainline.)
Please apply.
Thanks,
Andreas
PATCH RESEND 1/2 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.
--- 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(-)
arch/mips/cavium-octeon/octeon-platform.c +62 -86
@@ -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 =12000000 ; +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 =64000000000ull /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 12000000 instead\n" , + clock_rate); +/* Fall through */ +case 12000000 : + clk_rst_ctl.s.p_refclk_div =0 ; +break ; +case 24000000 : + clk_rst_ctl.s.p_refclk_div =1 ; +break ; +case 48000000 : + 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 ; -if (octeon_is_simulation () ||usb_disabled ()) -return 0 ;/* No USB in the simulator. */ - - pd =platform_device_alloc ("ehci-platform" ,0 ); -if (!pd) { - ret = -ENOMEM ; - goto out; - } - - usb_resources[0 ].start =0x00016F0000000000ULL ; - usb_resources[0 ].end = usb_resources[0 ].start +0x100 ; - - usb_resources[1 ].start =OCTEON_IRQ_USB0 ; - usb_resources[1 ].end =OCTEON_IRQ_USB0 ; - - ret =platform_device_add_resources (pd, usb_resources, -ARRAY_SIZE (usb_resources)); -if (ret) - goto fail; + pd =of_find_device_by_node (ehci_node); +if (!pd) +return 0 ; pd->dev.dma_mask = &octeon_ehci_dma_mask; pd->dev.platform_data = &octeon_ehci_pdata; -octeon_ehci_hw_start (); - - ret =platform_device_add (pd); -if (ret) - goto fail; +octeon_ehci_hw_start (&pd->dev);return ret; -fail: -platform_device_put (pd); -out: -return ret; }device_initcall (octeon_ehci_device_init);static int octeon_ohci_power_on (struct platform_device *pdev) { -octeon2_usb_clocks_start (); +octeon2_usb_clocks_start (&pdev->dev);return 0 ; }
@@ -369,11 +375,11 @@ static struct usb_ohci_pdata octeon_ohci_pdata = { .power_off = octeon_ohci_power_off, }; -static void __init octeon_ohci_hw_start (void ) +static void __init octeon_ohci_hw_start (struct device *dev) {union cvmx_uctlx_ohci_ctl ohci_ctl; -octeon2_usb_clocks_start (); +octeon2_usb_clocks_start (dev); ohci_ctl.u64 =cvmx_read_csr (CVMX_UCTLX_OHCI_CTL (0 )); ohci_ctl.s.l2c_addr_msb =0 ;
@@ -387,57 +393,27 @@ static void __init octeon_ohci_hw_start(void)static int __init octeon_ohci_device_init (void ) {struct platform_device *pd; +struct device_node *ohci_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 )) + ohci_node =of_find_node_by_name (NULL ,"ohci" ); +if (!ohci_node)return 0 ; -if (octeon_is_simulation () ||usb_disabled ()) -return 0 ;/* No USB in the simulator. */ - - pd =platform_device_alloc ("ohci-platform" ,0 ); -if (!pd) { - ret = -ENOMEM ; - goto out; - } - - usb_resources[0 ].start =0x00016F0000000400ULL ; - usb_resources[0 ].end = usb_resources[0 ].start +0x100 ; - - usb_resources[1 ].start =OCTEON_IRQ_USB0 ; - usb_resources[1 ].end =OCTEON_IRQ_USB0 ; - - ret =platform_device_add_resources (pd, usb_resources, -ARRAY_SIZE (usb_resources)); -if (ret) - goto fail; + pd =of_find_device_by_node (ohci_node); +if (!pd) +return 0 ; pd->dev.platform_data = &octeon_ohci_pdata; -octeon_ohci_hw_start (); - - ret =platform_device_add (pd); -if (ret) - goto fail; +octeon_ohci_hw_start (&pd->dev);return ret; -fail: -platform_device_put (pd); -out: -return ret; }device_initcall (octeon_ohci_device_init);#endif /* CONFIG_USB */ +static struct of_device_id __initdata octeon_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="cavium,octeon-6335-uctl" , },
drivers/usb/host/ehci-platform.c +1 -0
@@ -349,6 +349,7 @@ static const struct of_device_id vt8500_ehci_ids[] = { { .compatible = "via,vt8500-ehci", }, { .compatible = "wm,prizm-ehci", }, { .compatible = "generic-ehci", }, + { .compatible = "cavium,octeon-6335-ehci", }, {} }; MODULE_DEVICE_TABLE(of, vt8500_ehci_ids);
drivers/usb/host/ohci-platform.c +1 -0
@@ -328,6 +328,7 @@ static int ohci_platform_resume(struct device *dev)static const struct of_device_id ohci_platform_ids[] = { { .compatible ="generic-ohci" , }, + { .compatible ="cavium,octeon-6335-ohci" , }, { } };MODULE_DEVICE_TABLE (of, ohci_platform_ids);
Signature · 1 line
1.7.9.5
Re: [PATCH 1/2 resend] USB: host: Remove hard-coded octeon platform information for ehci/ohci
Quoted 4 lines · Andreas Herrmann
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
Please use the permanent link from that page:
The non-permanent links might change.
Ralf
PATCH RESEND 2/2 USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
In reply to Andreas Herrmannehci-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.
--- 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(-)
arch/mips/cavium-octeon/octeon-platform.c +1 -3
@@ -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);
drivers/usb/host/ehci-platform.c +2 -1
@@ -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;
include/linux/usb/ehci_pdriver.h +1 -0
@@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsigned big_endian_desc:1; unsigned big_endian_mmio:1; unsigned no_io_watchdog:1; + unsigned dma_mask_64:1;/* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev);
Signature · 1 line
1.7.9.5
Quoted 5 lines · Andreas Herrmann
This is a re-submission of patches 2 and 3 from
http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrmann@caviumnetworks.com
(Only patch 1/3 made it into usb-next and meanwhile is in mainline.)Please apply.
I'll get to patches after 3.19-rc1 is out, can't do anything with my trees until then, sorry.
greg k-h
v2 cover USB: host: Misc patches to remove hard-coded octeon platform information
In reply to Andreas HerrmannThis is a re-submission of patches 2 and 3 from
http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrmann@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.
PATCH RESEND v2 1/2 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-mips&i=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.
--- 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(-)
arch/mips/cavium-octeon/octeon-platform.c +62 -86
@@ -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 =12000000 ; +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 =64000000000ull /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 12000000 instead\n" , + clock_rate); +/* Fall through */ +case 12000000 : + clk_rst_ctl.s.p_refclk_div =0 ; +break ; +case 24000000 : + clk_rst_ctl.s.p_refclk_div =1 ; +break ; +case 48000000 : + 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 ; -if (octeon_is_simulation () ||usb_disabled ()) -return 0 ;/* No USB in the simulator. */ - - pd =platform_device_alloc ("ehci-platform" ,0 ); -if (!pd) { - ret = -ENOMEM ; - goto out; - } - - usb_resources[0 ].start =0x00016F0000000000ULL ; - usb_resources[0 ].end = usb_resources[0 ].start +0x100 ; - - usb_resources[1 ].start =OCTEON_IRQ_USB0 ; - usb_resources[1 ].end =OCTEON_IRQ_USB0 ; - - ret =platform_device_add_resources (pd, usb_resources, -ARRAY_SIZE (usb_resources)); -if (ret) - goto fail; + pd =of_find_device_by_node (ehci_node); +if (!pd) +return 0 ; pd->dev.dma_mask = &octeon_ehci_dma_mask; pd->dev.platform_data = &octeon_ehci_pdata; -octeon_ehci_hw_start (); - - ret =platform_device_add (pd); -if (ret) - goto fail; +octeon_ehci_hw_start (&pd->dev);return ret; -fail: -platform_device_put (pd); -out: -return ret; }device_initcall (octeon_ehci_device_init);static int octeon_ohci_power_on (struct platform_device *pdev) { -octeon2_usb_clocks_start (); +octeon2_usb_clocks_start (&pdev->dev);return 0 ; }
@@ -369,11 +375,11 @@ static struct usb_ohci_pdata octeon_ohci_pdata = { .power_off = octeon_ohci_power_off, }; -static void __init octeon_ohci_hw_start (void ) +static void __init octeon_ohci_hw_start (struct device *dev) {union cvmx_uctlx_ohci_ctl ohci_ctl; -octeon2_usb_clocks_start (); +octeon2_usb_clocks_start (dev); ohci_ctl.u64 =cvmx_read_csr (CVMX_UCTLX_OHCI_CTL (0 )); ohci_ctl.s.l2c_addr_msb =0 ;
@@ -387,57 +393,27 @@ static void __init octeon_ohci_hw_start(void)static int __init octeon_ohci_device_init (void ) {struct platform_device *pd; +struct device_node *ohci_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 )) + ohci_node =of_find_node_by_name (NULL ,"ohci" ); +if (!ohci_node)return 0 ; -if (octeon_is_simulation () ||usb_disabled ()) -return 0 ;/* No USB in the simulator. */ - - pd =platform_device_alloc ("ohci-platform" ,0 ); -if (!pd) { - ret = -ENOMEM ; - goto out; - } - - usb_resources[0 ].start =0x00016F0000000400ULL ; - usb_resources[0 ].end = usb_resources[0 ].start +0x100 ; - - usb_resources[1 ].start =OCTEON_IRQ_USB0 ; - usb_resources[1 ].end =OCTEON_IRQ_USB0 ; - - ret =platform_device_add_resources (pd, usb_resources, -ARRAY_SIZE (usb_resources)); -if (ret) - goto fail; + pd =of_find_device_by_node (ohci_node); +if (!pd) +return 0 ; pd->dev.platform_data = &octeon_ohci_pdata; -octeon_ohci_hw_start (); - - ret =platform_device_add (pd); -if (ret) - goto fail; +octeon_ohci_hw_start (&pd->dev);return ret; -fail: -platform_device_put (pd); -out: -return ret; }device_initcall (octeon_ohci_device_init);#endif /* CONFIG_USB */ +static struct of_device_id __initdata octeon_ids[] = { { .compatible ="simple-bus" , }, { .compatible ="cavium,octeon-6335-uctl" , },
drivers/usb/host/ehci-platform.c +1 -0
@@ -349,6 +349,7 @@ static const struct of_device_id vt8500_ehci_ids[] = { { .compatible = "via,vt8500-ehci", }, { .compatible = "wm,prizm-ehci", }, { .compatible = "generic-ehci", }, + { .compatible = "cavium,octeon-6335-ehci", }, {} }; MODULE_DEVICE_TABLE(of, vt8500_ehci_ids);
drivers/usb/host/ohci-platform.c +1 -0
@@ -328,6 +328,7 @@ static int ohci_platform_resume(struct device *dev)static const struct of_device_id ohci_platform_ids[] = { { .compatible ="generic-ohci" , }, + { .compatible ="cavium,octeon-6335-ohci" , }, { } };MODULE_DEVICE_TABLE (of, ohci_platform_ids);
Signature · 1 line
1.7.9.5
PATCH RESEND v2 2/2 USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
In reply to Andreas Herrmannehci-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.
--- 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(-)
arch/mips/cavium-octeon/octeon-platform.c +1 -3
@@ -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);
drivers/usb/host/ehci-platform.c +2 -1
@@ -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;
include/linux/usb/ehci_pdriver.h +1 -0
@@ -45,6 +45,7 @@ struct usb_ehci_pdata { unsigned big_endian_desc:1; unsigned big_endian_mmio:1; unsigned no_io_watchdog:1; + unsigned dma_mask_64:1;/* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev);
Signature · 1 line
1.7.9.5
Re: [PATCH 2/2 resend v2] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
Quoted 4 lines · Andreas Herrmann
ehci-octeon driver used a 64-bit
dma_mask. With removal of ehci-octeon and usage of ehci-platform ehcidma_maskis now limited to 32 bits (coerced inehci_platform_probe).
Quoted 8 lines
Provide a flag in ehci platform data to allow use of 64 bits for
dma_mask.Cc David Daney <[email protected]>Cc Alex Smith <[email protected]>Cc Alan Stern <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>Tested-by Aaro Koskinen <[email protected]>
Is something like this also needed for ohci-platform? Or are all OHCI implementations restricted to 32-bit DMA masks?
Alan Stern
Re: [PATCH 2/2 resend v2] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
Quoted 15 lines · Alan Stern
Quoted 4 lines · Andreas Herrmann
ehci-octeon driver used a 64-bit
dma_mask. With removal of ehci-octeon and usage of ehci-platform ehcidma_maskis now limited to 32 bits (coerced inehci_platform_probe).Quoted 8 lines
Provide a flag in ehci platform data to allow use of 64 bits for
dma_mask.Cc David Daney <[email protected]>Cc Alex Smith <[email protected]>Cc Alan Stern <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>Tested-by Aaro Koskinen <[email protected]>
Quoted 3 lines
Acked-by Alan Stern <[email protected]>Is something like this also needed for ohci-platform?
No, I don't think so.
Quoted 1 line
Or are all OHCI implementations restricted to 32-bit DMA masks?
AFAIK OHCI supports only 32-bit memory addressing.
Quoted 1 line
Alan Stern
Andreas
Greg KH
maintainerRe: [PATCH 2/2 resend v2] USB: host: Introduce flag to enable use of 64-bit dma_mask for ehci-platform
In reply to Andreas HerrmannQuoted 12 lines · Andreas Herrmann
ehci-octeon driver used a 64-bit
dma_mask. With removal of ehci-octeon and usage of ehci-platform ehcidma_maskis now limited to 32 bits (coerced inehci_platform_probe).Provide a flag in ehci platform data to allow use of 64 bits for
dma_mask.Cc David Daney <[email protected]>Cc Alex Smith <[email protected]>Signed-off-by Andreas Herrmann <[email protected]>Tested-by Aaro Koskinen <[email protected]>Acked-by Alan Stern <[email protected]>
Quoted 5 lines
--- 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(-)
This no longer applies to my usb-testing branch, can you refresh it and resend?
thanks,
greg k-h
PATCH RESEND v3 1/1 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.
--- 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
arch/mips/cavium-octeon/octeon-platform.c +1 -3
@@ -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);
drivers/usb/host/ehci-platform.c +2 -1
@@ -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;
include/linux/usb/ehci_pdriver.h +1 -0
@@ -48,6 +48,7 @@ struct usb_ehci_pdata { unsigned big_endian_mmio:1; unsigned no_io_watchdog:1; unsigned reset_on_resume:1; + unsigned dma_mask_64:1;/* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev);
Signature · 1 line
1.7.9.5
Quoted 9 lines · Andreas Herrmann
This is a re-submission of patches 2 and 3 from
http://marc.info/?i=1415914590-31647-1-git-send-email-andreas.herrmann@caviumnetworks.com
(Only patch 1/3 made it into usb-next and meanwhile is in mainline.)Please apply.
Thanks,
Quoted 8 lines
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 referencedin commit message of patch 2/2.
In fact I meant commit message of patch 1 of 2.
Andreas