Re: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-15 Thread Florian Fainelli
On 05/15/2017 02:01 PM, woojung@microchip.com wrote: >>> +static const struct ksz_chip_data ksz_switch_chips[] = { >>> + { >>> + .chip_id = 0x00947700, >>> + .dev_name = "KSZ9477", >>> + .num_vlans = 4096, >>> + .num_alus = 4096, >>> +

RE: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-15 Thread Woojung.Huh
> > +static const struct ksz_chip_data ksz_switch_chips[] = { > > + { > > + .chip_id = 0x00947700, > > + .dev_name = "KSZ9477", > > + .num_vlans = 4096, > > + .num_alus = 4096, > > + .num_statics = 16, > > + .enabled_ports = 0x1F, /*

RE: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-15 Thread Woojung.Huh
> >> + dev->vlan_cache = devm_kmalloc_array(dev->dev, > >> + sizeof(struct vlan_table), > >> + dev->num_vlans, GFP_KERNEL); > > > > You should check, but i think devm_kmalloc_array sets the allocated > > memory to 0. > >

Re: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-14 Thread Sergei Shtylyov
Hello! On 5/13/2017 5:56 PM, Andrew Lunn wrote: [...] +static int ksz_reset_switch(struct dsa_switch *ds) +{ + struct ksz_device *dev = ds->priv; + u8 data8; + u16 data16; + u32 data32; + ... + + memset(dev->vlan_cache, 0, sizeof(*dev->vlan_cache) *

Re: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-13 Thread Andrew Lunn
> +static int get_vlan_table(struct dsa_switch *ds, u16 vid, u32 *vlan_table) > +{ > + struct ksz_device *dev = ds->priv; > + u8 data; > + int timeout = 1000; > + > + ksz_write16(dev, REG_SW_VLAN_ENTRY_INDEX__2, vid & VLAN_INDEX_M); > + ksz_write8(dev, REG_SW_VLAN_CTRL,

Re: [PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-13 Thread Andrew Lunn
On Fri, May 12, 2017 at 08:07:58PM +, woojung@microchip.com wrote: > +static void ksz_config_cpu_port(struct dsa_switch *ds) > +{ > + struct ksz_device *dev = ds->priv; > + int i; > + > + ds->num_ports = dev->port_cnt; > + > + for (i = 0; i < ds->num_ports; i++) { > +

[PATCH v2 net-next 3/5] dsa: add DSA switch driver for Microchip KSZ9477

2017-05-12 Thread Woojung.Huh
From: Woojung Huh The KSZ9477 is a fully integrated layer 2, managed, 7 ports GigE switch with numerous advanced features. 5 ports incorporate 10/100/1000 Mbps PHYs. The other 2 ports have interfaces that can be configured as SGMII, RGMII, MII or RMII. Either of these