[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200324071706.GI31519@unicorn.suse.cz>
Date: Tue, 24 Mar 2020 08:17:06 +0100
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Marek Vasut <marex@...x.de>,
"David S . Miller" <davem@...emloft.net>,
Lukas Wunner <lukas@...ner.de>, Petr Stetiar <ynezz@...e.cz>,
YueHaibing <yuehaibing@...wei.com>
Subject: Re: [PATCH 07/14] net: ks8851: Use 16-bit writes to program MAC
address
On Tue, Mar 24, 2020 at 12:42:56AM +0100, Marek Vasut wrote:
> On the SPI variant of KS8851, the MAC address can be programmed with
> either 8/16/32-bit writes. To make it easier to support the 16-bit
> parallel option of KS8851 too, switch both the MAC address programming
> and readout to 16-bit operations.
>
> Remove ks8851_wrreg8() as it is not used anywhere anymore.
>
> There should be no functional change.
>
> Signed-off-by: Marek Vasut <marex@...x.de>
> Cc: David S. Miller <davem@...emloft.net>
> Cc: Lukas Wunner <lukas@...ner.de>
> Cc: Petr Stetiar <ynezz@...e.cz>
> Cc: YueHaibing <yuehaibing@...wei.com>
> ---
[...]
> +
> + for (i = 0; i < ETH_ALEN; i += 2) {
> + val = (dev->dev_addr[i] << 8) | dev->dev_addr[i + 1];
> + ks8851_wrreg16(ks, KS_MAR(i + 1), val);
> + }
[...]
> + for (i = 0; i < ETH_ALEN; i += 2) {
> + reg = ks8851_rdreg16(ks, KS_MAR(i + 1));
> + dev->dev_addr[i] = reg & 0xff;
> + dev->dev_addr[i + 1] = reg >> 8;
> + }
I know nothing about the hardware but this seems inconsistent: while
writing, you put addr[i] into upper part of the 16-bit value and
addr[i+1] into lower but for read you do the opposite. Is it correct?
Michal Kubecek
Powered by blists - more mailing lists