lkml.org 
[lkml]   [2019]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH net-next 2/3] net: dsa: microchip: add ksz9567 to ksz9477 driver
On Fri, Sep 6, 2019 at 4:42 PM Marek Vasut <marex@denx.de> wrote:
>
> On 9/6/19 11:30 PM, George McCollister wrote:
> > Add support for the KSZ9567 7-Port Gigabit Ethernet Switch to the
> > ksz9477 driver. The KSZ9567 supports both SPI and I2C. Oddly the
> > ksz9567 is already in the device tree binding documentation.
> >
> > Signed-off-by: George McCollister <george.mccollister@gmail.com>
> > ---
> > drivers/net/dsa/microchip/ksz9477.c | 9 +++++++++
> > drivers/net/dsa/microchip/ksz9477_i2c.c | 1 +
> > drivers/net/dsa/microchip/ksz9477_spi.c | 1 +
> > 3 files changed, 11 insertions(+)
> >
> > diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> > index 187be42de5f1..50ffc63d6231 100644
> > --- a/drivers/net/dsa/microchip/ksz9477.c
> > +++ b/drivers/net/dsa/microchip/ksz9477.c
> > @@ -1529,6 +1529,15 @@ static const struct ksz_chip_data ksz9477_switch_chips[] = {
> > .cpu_ports = 0x07, /* can be configured as cpu port */
> > .port_cnt = 3, /* total port count */
> > },
> > + {
> > + .chip_id = 0x00956700,
> > + .dev_name = "KSZ9567",
> > + .num_vlans = 4096,
> > + .num_alus = 4096,
> > + .num_statics = 16,
> > + .cpu_ports = 0x7F, /* can be configured as cpu port */
> > + .port_cnt = 7, /* total physical port count */
>
> I might be wrong, and this is just an idea for future improvement, but
> is .cpu_ports = GEN_MASK(.port_cnt, 0) always ?

GENMASK, not GEN_MASK. And I think it would be .cpu_ports =
GENMASK(.port_cnt - 1, 0).
I'm not sure if it would always be that. TBH I'm not sure if 0x7F is
even correct. For instance if a port has a PHY should it be excluded
from this mask or only if it doesn't support tail tagging? Maybe
someone would hook the CPU port up with a PHY instead of
RGMII/MII/RMII but it seems quite an odd thing to do.

On the KSZ9567R datasheet it shows 1-7 for this so if actually correct
I believe all ports support tail tagging but maybe some other variants
don't:
Port Operation Control 0 Register
Port N: 1-7
Bit 2 - Tail Tag Enable
When tail tagging is enabled for a port, it designates that port to be
the “host” or “CPU” port. Do not enable tail tagging for more than one
port.

My inclination is to leave it as is until a more compelling reason for
changing it arises.

>
> > + },
> > };
> >
> > static int ksz9477_switch_init(struct ksz_device *dev)
> > diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c b/drivers/net/dsa/microchip/ksz9477_i2c.c
> > index 85fd0fb43941..c1548a43b60d 100644
> > --- a/drivers/net/dsa/microchip/ksz9477_i2c.c
> > +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c
> > @@ -77,6 +77,7 @@ MODULE_DEVICE_TABLE(i2c, ksz9477_i2c_id);
> > static const struct of_device_id ksz9477_dt_ids[] = {
> > { .compatible = "microchip,ksz9477" },
> > { .compatible = "microchip,ksz9897" },
> > + { .compatible = "microchip,ksz9567" },
> > {},
> > };
> > MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
> > diff --git a/drivers/net/dsa/microchip/ksz9477_spi.c b/drivers/net/dsa/microchip/ksz9477_spi.c
> > index 2e402e4d866f..f4198d6f72be 100644
> > --- a/drivers/net/dsa/microchip/ksz9477_spi.c
> > +++ b/drivers/net/dsa/microchip/ksz9477_spi.c
> > @@ -81,6 +81,7 @@ static const struct of_device_id ksz9477_dt_ids[] = {
> > { .compatible = "microchip,ksz9893" },
> > { .compatible = "microchip,ksz9563" },
> > { .compatible = "microchip,ksz8563" },
> > + { .compatible = "microchip,ksz9567" },
> > {},
> > };
> > MODULE_DEVICE_TABLE(of, ksz9477_dt_ids);
> >
>
> Reviewed-by: Marek Vasut <marex@denx.de>

Thanks.

>
> --
> Best regards,
> Marek Vasut

\
 
 \ /
  Last update: 2019-09-09 15:33    [W:1.188 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site