From: Grygorii Strashko <[email protected]>
Historically Davinci MDIO driver was created with assumption that
MDIO is standalone device, but for Keystone 2 it's a part
of NETCP module and now NETCP driver requests IO range which
includes MDIO IO range too. This causes Keystone 2 networking stack
failure during the boot.
"netcp-1.0 2620110.netcp: Probe of module(netcp-gbe) failed with -16"
Hence, don't request io address range from Davinci MDIO driver and
just remap it.
Signed-off-by: Grygorii Strashko <[email protected]>
Signed-off-by: Murali Karicheri <[email protected]>
---
drivers/net/ethernet/ti/davinci_mdio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
index 98655b4..b13ec82 100644
--- a/drivers/net/ethernet/ti/davinci_mdio.c
+++ b/drivers/net/ethernet/ti/davinci_mdio.c
@@ -371,7 +371,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
spin_lock_init(&data->lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- data->regs = devm_ioremap_resource(dev, res);
+ data->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
if (IS_ERR(data->regs)) {
ret = PTR_ERR(data->regs);
goto bail_out;
--
1.7.9.5
Keystone netcp driver re-uses davinci mdio driver. So enable it
by default for keystone netcp driver.
Signed-off-by: Murali Karicheri <[email protected]>
---
drivers/net/ethernet/ti/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 3bc992c..945a221 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -88,6 +88,7 @@ config TI_CPTS
config TI_KEYSTONE_NETCP
tristate "TI Keystone NETCP Core Support"
select TI_CPSW_ALE
+ select TI_DAVINCI_MDIO
depends on OF
depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
---help---
--
1.7.9.5
On Tue, Feb 24, 2015 at 9:27 PM, Murali Karicheri <[email protected]> wrote:
> From: Grygorii Strashko <[email protected]>
>
> Historically Davinci MDIO driver was created with assumption that
> MDIO is standalone device, but for Keystone 2 it's a part
> of NETCP module and now NETCP driver requests IO range which
> includes MDIO IO range too. This causes Keystone 2 networking stack
> failure during the boot.
>
> "netcp-1.0 2620110.netcp: Probe of module(netcp-gbe) failed with -16"
>
> Hence, don't request io address range from Davinci MDIO driver and
> just remap it.
>
> Signed-off-by: Grygorii Strashko <[email protected]>
> Signed-off-by: Murali Karicheri <[email protected]>
Acked-by: Lad, Prabhakar <[email protected]>
Cheers,
--Prabhakar Lad
> ---
> drivers/net/ethernet/ti/davinci_mdio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/ti/davinci_mdio.c b/drivers/net/ethernet/ti/davinci_mdio.c
> index 98655b4..b13ec82 100644
> --- a/drivers/net/ethernet/ti/davinci_mdio.c
> +++ b/drivers/net/ethernet/ti/davinci_mdio.c
> @@ -371,7 +371,7 @@ static int davinci_mdio_probe(struct platform_device *pdev)
> spin_lock_init(&data->lock);
>
> res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> - data->regs = devm_ioremap_resource(dev, res);
> + data->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
> if (IS_ERR(data->regs)) {
> ret = PTR_ERR(data->regs);
> goto bail_out;
> --
> 1.7.9.5
>
* Murali Karicheri <[email protected]> [150224 13:31]:
> Keystone netcp driver re-uses davinci mdio driver. So enable it
> by default for keystone netcp driver.
>
> Signed-off-by: Murali Karicheri <[email protected]>
> ---
> drivers/net/ethernet/ti/Kconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
> index 3bc992c..945a221 100644
> --- a/drivers/net/ethernet/ti/Kconfig
> +++ b/drivers/net/ethernet/ti/Kconfig
> @@ -88,6 +88,7 @@ config TI_CPTS
> config TI_KEYSTONE_NETCP
> tristate "TI Keystone NETCP Core Support"
> select TI_CPSW_ALE
> + select TI_DAVINCI_MDIO
> depends on OF
> depends on KEYSTONE_NAVIGATOR_DMA && KEYSTONE_NAVIGATOR_QMSS
> ---help---
These options should be silent Kconfig options if we're selecting
them. Or else you should use depends on instead.
In general using select for driver modules will eventually lead into
randconfig build failures as things change.
Regards,
Tony
* Murali Karicheri <[email protected]> [150224 13:32]:
> From: Grygorii Strashko <[email protected]>
>
> Historically Davinci MDIO driver was created with assumption that
> MDIO is standalone device, but for Keystone 2 it's a part
> of NETCP module and now NETCP driver requests IO range which
> includes MDIO IO range too. This causes Keystone 2 networking stack
> failure during the boot.
>
> "netcp-1.0 2620110.netcp: Probe of module(netcp-gbe) failed with -16"
>
> Hence, don't request io address range from Davinci MDIO driver and
> just remap it.
Best to fix this up properly so you don't have overlapping resources.
You probably want to have the whole hardware driver block defined
in the dts file as a single entry, and then have the modules within
that hardware block use the dt ranges property. This allows you to
do standard Linux drivers without any extra hacks.
Sounds like this following untested imaginary example should do
the trick:
mac: ethernet@deadbeef {
compatible = "ti,cpsw", "simple-bus";
reg = <0xdeadbeef 0x1000>;
ranges = <0 0xdeadbeef 0x2000>;
...
davinci_mdio: mdio@1000 {
reg = <0x1000 0x100>;
...
};
};
That allows you to get rid of all the existing code for dealing
with the chilren with for_each_child_of_node(node, slave_node)
in cpsw_probe_dt() as that all happens automatically for you and
does not cause problems with modules being moved around.
Regards,
Tony
On 02/27/2015 11:29 AM, Tony Lindgren wrote:
> * Murali Karicheri<[email protected]> [150224 13:31]:
>> Keystone netcp driver re-uses davinci mdio driver. So enable it
>> by default for keystone netcp driver.
>>
>> Signed-off-by: Murali Karicheri<[email protected]>
>> ---
>> drivers/net/ethernet/ti/Kconfig | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
>> index 3bc992c..945a221 100644
>> --- a/drivers/net/ethernet/ti/Kconfig
>> +++ b/drivers/net/ethernet/ti/Kconfig
>> @@ -88,6 +88,7 @@ config TI_CPTS
>> config TI_KEYSTONE_NETCP
>> tristate "TI Keystone NETCP Core Support"
>> select TI_CPSW_ALE
>> + select TI_DAVINCI_MDIO
>> depends on OF
>> depends on KEYSTONE_NAVIGATOR_DMA&& KEYSTONE_NAVIGATOR_QMSS
>> ---help---
>
> These options should be silent Kconfig options if we're selecting
> them. Or else you should use depends on instead.
>
Just followed the existing implementation as it made sense.
config TI_DAVINCI_EMAC
tristate "TI DaVinci EMAC Support"
depends on ARM && ( ARCH_DAVINCI || ARCH_OMAP3 )
select TI_DAVINCI_MDIO
select TI_DAVINCI_CPDMA
select PHYLIB
---help---
This driver supports TI's DaVinci Ethernet .
To compile this driver as a module, choose M here: the module
will be called davinci_emac_driver. This is recommended.
config TI_CPSW
tristate "TI CPSW Switch Support"
depends on ARCH_DAVINCI || ARCH_OMAP2PLUS
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
select TI_CPSW_ALE
select MFD_SYSCON
select REGMAP
---help---
This driver supports TI's CPSW Ethernet Switch.
To compile this driver as a module, choose M here: the module
will be called cpsw.
Why it has to be silent options? NetCP driver would require DAVINCI_MDIO
driver to function. So "select" make sense to me instead of "depend".
How do you think depend can be used here?
Murali
> In general using select for driver modules will eventually lead into
> randconfig build failures as things change.
>
> Regards,
>
> Tony
--
Murali Karicheri
Linux Kernel, Texas Instruments