[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171105235900.GB24822@lunn.ch>
Date: Mon, 6 Nov 2017 00:59:00 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Vivien Didelot <vivien.didelot@...oirfairelinux.com>,
Florian Fainelli <f.fainelli@...il.com>,
netdev@...r.kernel.org,
Antti Seppälä <a.seppala@...il.com>,
Roman Yeryomin <roman@...em.lv>,
Colin Leitner <colin.leitner@...glemail.com>,
Gabor Juhos <juhosg@...nwrt.org>
Subject: Re: [PATCH 4/4] RFC: net: dsa: realtek-smi: Add Realtek SMI driver
Hi Linus
> +static int realtek_smi_read_reg(struct realtek_smi *smi, u32 addr, u32 *data)
> +{
> + unsigned long flags;
> + u8 lo = 0;
> + u8 hi = 0;
> + int ret;
> +
> + spin_lock_irqsave(&smi->lock, flags);
> +
> + realtek_smi_start(smi);
> +
> + /* send READ command */
> + ret = realtek_smi_write_byte(smi, smi->cmd_read);
> + if (ret)
> + goto out;
> +
> + /* set ADDR[7:0] */
> + ret = realtek_smi_write_byte(smi, addr & 0xff);
> + if (ret)
> + goto out;
> +
> + /* set ADDR[15:8] */
> + ret = realtek_smi_write_byte(smi, addr >> 8);
> + if (ret)
> + goto out;
> +
> + /* read DATA[7:0] */
> + realtek_smi_read_byte0(smi, &lo);
> + /* read DATA[15:8] */
> + realtek_smi_read_byte1(smi, &hi);
> +
> + *data = ((u32) lo) | (((u32) hi) << 8);
If i'm reading this correct, addr is a u16 and data is also u16? So
it is pretty similar to SMI.
I'm wondering if this should be modelled as a normal MDIO bus? Put the
driver as drivers/net/mdio-realtek.c?
I need to study the rest of the code to see if this is a good idea or
not.
Andrew
Powered by blists - more mailing lists