lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 Oct 2016 20:17:44 +0200
From:   Jeroen Hofstee <jhofstee@...tronenergy.com>
To:     Tony Lindgren <tony@...mide.com>
CC:     <netdev@...r.kernel.org>, Mugunthan V N <mugunthanvnm@...com>,
        "Grygorii Strashko" <grygorii.strashko@...com>,
        "open list:TI ETHERNET SWITCH DRIVER (CPSW)" 
        <linux-omap@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] net: cpsw: fix obtaining mac address for am3517

Hello Tony,

On 28-10-16 17:52, Tony Lindgren wrote:
> * Jeroen Hofstee <jhofstee@...tronenergy.com> [161028 08:33]:
>> Commit b6745f6e4e63 ("drivers: net: cpsw: davinci_emac: move reading mac
>> id to common file") did not only move the code for an am3517, it also
>> added the slave parameter, resulting in an invalid (all zero) mac address
>> being returned for an am3517, since it only has a single emac and the slave
>> parameter is pointing to the second. So simply always read the first and
>> valid mac-address for a ti,am3517-emac.
> And others davinci_emac.c users can have more than one. So is the
> reason the slave parameter points to the second instance because
> of the location in the hardware?

Sort of, the slave parameter gets determined by the fact if there is one
or two register range(s) associated with the davinci_emac. In davinci_emac.c

     res_ctrl = platform_get_resource(pdev, IORESOURCE_MEM, 1);
     ...
     rc = davinci_emac_try_get_mac(pdev, res_ctrl ? 0 : 1,
                           priv->mac_addr);

So it there are two ranges, the slave param becomes 0. It there is only 
one, it
will be 1. Since the am3517 only has a single regs entry it ends up with 
slave 1,
while there is only a single davinci_emac.

Regards,
Jeroen

arch/arm/boot/dts/dm816x.dtsi
-----------------------------
eth0: ethernet@...00000 {
     compatible = "ti,dm816-emac";
     ti,hwmods = "emac0";
     reg = <0x4a100000 0x800
            0x4a100900 0x3700>;
     clocks = <&sysclk24_ck>;
     syscon = <&scm_conf>;
     ti,davinci-ctrl-reg-offset = <0>;
     ti,davinci-ctrl-mod-reg-offset = <0x900>;
     ti,davinci-ctrl-ram-offset = <0x2000>;
     ti,davinci-ctrl-ram-size = <0x2000>;
     interrupts = <40 41 42 43>;
     phy-handle = <&phy0>;
};

eth1: ethernet@...20000 {
     compatible = "ti,dm816-emac";
     ti,hwmods = "emac1";
     reg = <0x4a120000 0x4000>;
     clocks = <&sysclk24_ck>;
     syscon = <&scm_conf>;
     ti,davinci-ctrl-reg-offset = <0>;
     ti,davinci-ctrl-mod-reg-offset = <0x900>;
     ti,davinci-ctrl-ram-offset = <0x2000>;
     ti,davinci-ctrl-ram-size = <0x2000>;
     interrupts = <44 45 46 47>;
     phy-handle = <&phy1>;
};

arch/arm/boot/dts/am3517.dtsi
-------------------------------
davinci_emac: ethernet@...c000000 {
     compatible = "ti,am3517-emac";
     ti,hwmods = "davinci_emac";
     status = "disabled";
     reg = <0x5c000000 0x30000>;
     interrupts = <67 68 69 70>;
     syscon = <&scm_conf>;
     ti,davinci-ctrl-reg-offset = <0x10000>;
     ti,davinci-ctrl-mod-reg-offset = <0>;
     ti,davinci-ctrl-ram-offset = <0x20000>;
     ti,davinci-ctrl-ram-size = <0x2000>;
     ti,davinci-rmii-en = /bits/ 8 <1>;
     local-mac-address = [ 00 00 00 00 00 00 ];
};

Powered by blists - more mailing lists