[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CABb+yY3jMLYx3fTSuHfhfR9HDvDqzqDyYGz7T=5k4-HLfcJukg@mail.gmail.com>
Date: Sat, 23 Dec 2017 20:31:27 +0530
From: Jassi Brar <jassisinghbrar@...il.com>
To: Ard Biesheuvel <ard.biesheuvel@...aro.org>
Cc: "<netdev@...r.kernel.org>" <netdev@...r.kernel.org>,
Devicetree List <devicetree@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Arnd Bergmann <arnd.bergmann@...aro.org>,
Andrew Lunn <andrew@...n.ch>, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Masami Hiramatsu <masami.hiramatsu@...aro.org>,
Jassi Brar <jaswinder.singh@...aro.org>
Subject: Re: [PATCHv4 2/3] net: socionext: Add Synquacer NetSec driver
On Sat, Dec 23, 2017 at 4:09 PM, Ard Biesheuvel
<ard.biesheuvel@...aro.org> wrote:
> On 23 December 2017 at 05:45, <jassisinghbrar@...il.com> wrote:
>> From: Jassi Brar <jaswinder.singh@...aro.org>
>>
>> This driver adds support for Socionext "netsec" IP Gigabit
>> Ethernet + PHY IP used in the Synquacer SC2A11 SoC.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@...aro.org>
>> Signed-off-by: Jassi Brar <jaswinder.singh@...aro.org>
>> ---
>> drivers/net/ethernet/Kconfig | 1 +
>> drivers/net/ethernet/Makefile | 1 +
>> drivers/net/ethernet/socionext/Kconfig | 29 +
>> drivers/net/ethernet/socionext/Makefile | 1 +
>> drivers/net/ethernet/socionext/netsec.c | 1844 +++++++++++++++++++++++++++++++
>> 5 files changed, 1876 insertions(+)
>> create mode 100644 drivers/net/ethernet/socionext/Kconfig
>> create mode 100644 drivers/net/ethernet/socionext/Makefile
>> create mode 100644 drivers/net/ethernet/socionext/netsec.c
>>
> ...
>> diff --git a/drivers/net/ethernet/socionext/netsec.c b/drivers/net/ethernet/socionext/netsec.c
>> new file mode 100644
>> index 0000000..6af047b
>> --- /dev/null
>> +++ b/drivers/net/ethernet/socionext/netsec.c
> ...
>> +static int netsec_netdev_load_ucode_region(struct netsec_priv *priv, u32 reg,
>> + u32 addr_h, u32 addr_l, u32 size)
>> +{
>> + u64 base = (u64)addr_h << 32 | addr_l;
>> + void __iomem *ucode;
>> + u32 i;
>> +
>> + ucode = ioremap(base, size * sizeof(u32));
>> + if (!ucode)
>> + return -ENOMEM;
>> +
>> + for (i = 0; i < size; i++)
>> + netsec_write(priv, reg, readl(ucode + i));
>> +
>
> This is incorrect. The microcode is written one u32 word at a time,
> and indexing ucode like this results in byte indexing, not u32
> indexing.
>
Ouch! careless mistake. I was too eager to get done with netsec before
I leave for holidays.
> I changed the ucode declaration locally to
>
> u32 __iomem *ucode;
>
> and now everything works fine again.
>
Or we keep the void pointer but do readl(ucode + i * 4) ?
>
>> + iounmap(ucode);
>> + return 0;
>> +}
>> +
> ...
>> +static int netsec_register_mdio(struct netsec_priv *priv, u32 phy_addr)
>> +{
>> + struct mii_bus *bus;
>> + int ret;
>> +
>> + bus = devm_mdiobus_alloc(priv->dev);
>> + if (!bus)
>> + return -ENOMEM;
>> +
>> + snprintf(bus->id, MII_BUS_ID_SIZE, "%s", dev_name(priv->dev));
>> + bus->priv = priv;
>> + bus->name = "SNI NETSEC MDIO";
>> + bus->read = netsec_phy_read;
>> + bus->write = netsec_phy_write;
>> + bus->parent = priv->dev;
>> + priv->mii_bus = bus;
>> +
>> + if (dev_of_node(priv->dev)) {
>> + struct device_node *mdio_node, *parent = dev_of_node(priv->dev);
>> +
>> + mdio_node = of_get_child_by_name(parent, "mdio");
>> + if (mdio_node) {
>> + parent = mdio_node;
>> + } else {
>> + /* older f/w doesn't populate the mdio subnode,
>> + * allow relaxed upgrade of f/w in due time.
>> + */
>> + dev_err(priv->dev, "Upgrade f/w for mdio subnode!\n");
>
> I wouldn't mind if you dropped this fallback altogether, and would
> simply stick with the new binding only. However, if you prefer to keep
> it, could you change this to dev_info()? It is not really an error
> condition, and dev_err/dev_warns have the annoying tendency to pierce
> through 'quiet' boot splashes.
>
Yes, it should have been dev_info. But I would like to keep it,
atleast for a couple months. For example, my board needs jtag to
upgrade f/w.
Thanks.
Powered by blists - more mailing lists