[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <813f4985-6ea2-6db1-be65-44bd012843ae@denx.de>
Date: Thu, 20 Dec 2018 02:10:03 +0100
From: Marek Vasut <marex@...x.de>
To: Tristram.Ha@...rochip.com
Cc: vivien.didelot@...oirfairelinux.com, UNGLinuxDriver@...rochip.com,
netdev@...r.kernel.org, sergio.paracuellos@...il.com,
andrew@...n.ch, dan.carpenter@...cle.com, pavel@....cz,
f.fainelli@...il.com
Subject: Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver
On 12/20/2018 12:31 AM, Marek Vasut wrote:
> On 12/20/2018 12:11 AM, Marek Vasut wrote:
>> On 12/19/2018 11:30 PM, Tristram.Ha@...rochip.com wrote:
>>>> Can this use regmap instead ?
>>>>
>>>
>>> To tell the truth I do not know how.
>>>
>>> Some customers, like Sergio, seem to be using KSZ9897 with I2C in their projects
>>> and so cannot wait further.
>>
>> Well, I just did 'git grep regmap_i2c drivers' and 'git grep regmap_spi
>> drivers/' and found eg.
>> drivers/iio/pressure/zpa2326_i2c.c
>> drivers/iio/pressure/zpa2326_spi.c
>>
>> There's plenty of drivers using regmap in drivers/ to demonstrate how to
>> use it. And there's always include/linux/regmap.h .
>>
>> In this specific (DSA) case, register either regmap_spi or regmap_i2c in
>> the ksz_switch_register(), pop the regmap pointer into ksz_device and
>> then use it in ksz_read*()/ksz_write*(). You can then, in a subsequent
>> patch, massage the regmap accesses directly into the code instead and
>> drop the ksz_read*()/ksz_write*() functions altogether, since those
>> would be just regmap function wrappers.
>>
>> And if you're still lost, I can start on the conversion myself.
>
> Actually, wait a few hours, I'll try to prepare a regmap patchset.
Try this [1], it should be a start. The last two patches might need some
adjustments, so please test and let me know how that works (or better
yet, provide fixes). Adding i2c regmap should then be trivial :)
[1] https://patchwork.ozlabs.org/cover/1016432/
--
Best regards,
Marek Vasut
Powered by blists - more mailing lists