Skip to content
  1. Jun 06, 2019
  2. Jun 05, 2019
    • David S. Miller's avatar
      Merge branch 'net-dsa-mv88e6xxx-support-for-mv88e6250' · 2a99283c
      David S. Miller authored
      
      
      Rasmus Villemoes says:
      
      ====================
      net: dsa: mv88e6xxx: support for mv88e6250
      
      This adds support for the mv88e6250 chip. Initially based on the
      mv88e6240, this time around, I've been through each ->ops callback and
      checked that it makes sense, either replacing with a 6250 specific
      variant or dropping it if no equivalent functionality seems to exist
      for the 6250. Along the way, I found a few oddities in the existing
      code, mostly sent as separate patches/questions.
      
      The one relevant to the 6250 is the ieee_pri_map callback, where the
      existing mv88e6085_g1_ieee_pri_map() is actually wrong for many of the
      existing users. I've put the mv88e6250_g1_ieee_pri_map() patch first
      in case some of the existing chips get switched over to use that and
      it is deemed important enough for -stable.
      
      v4:
      - fix style issue in 1/10
      - add Andrew's reviewed-by to 1,6,7,8,9,10.
      
      v3:
      - rebase on top of net-next/master
      - add reviewed-bys to patches unchanged from v2 (2,3,4,5)
      - add 6250-specific ->ieee_pri_map, ->port_set_speed, ->port_link_state (1,6,7)
      - in addition, use mv88e6065_phylink_validate for ->phylink_validate,
        and don't implement ->port_get_cmode, ->port_set_jumbo_size,
        ->port_disable_learn_limit, ->rmu_disable
      - drop ptp support
      - add patch adding the compatible string to the DT binding (9)
      - add small refactoring patch (10)
      
      v2:
      - rebase on top of net-next/master
      - add reviewed-by to two patches unchanged from v1 (2,3)
      - add separate watchdog_ops
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2a99283c
    • Rasmus Villemoes's avatar
      net: dsa: mv88e6xxx: refactor mv88e6352_g1_reset · 7358fd80
      Rasmus Villemoes authored
      
      
      The new mv88e6250_g1_reset() is identical to mv88e6352_g1_reset() except
      for the call of mv88e6352_g1_wait_ppu_polling(), so refactor the 6352
      version in term of the 6250 one. No functional change.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7358fd80
    • Rasmus Villemoes's avatar
      dt-bindings: net: dsa: marvell: add "marvell,mv88e6250" compatible string · dabde0da
      Rasmus Villemoes authored
      
      
      The mv88e6250 has port_base_addr 0x8 or 0x18 (depending on
      configuration pins), so it constitutes a new family and hence needs
      its own compatible string.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dabde0da
    • Rasmus Villemoes's avatar
      net: dsa: mv88e6xxx: add support for mv88e6250 · 1f71836f
      Rasmus Villemoes authored
      
      
      This adds support for the Marvell 88E6250. I've checked that each
      member in the ops-structure makes sense, and basic switchdev
      functionality works fine.
      
      It uses the new dual_chip option, and since its port registers start
      at SMI address 0x08 or 0x18 (i.e., always sw_addr + 0x08), we need to
      introduce a new compatible string in order for the auto-identification
      in mv88e6xxx_detect() to work.
      
      The chip has four per port 16-bits statistics registers, two of which
      correspond to the existing "sw_in_filtered" and "sw_out_filtered" (but
      at offsets 0x13 and 0x10 rather than 0x12 and 0x13, because why should
      this be easy...). Wiring up those four statistics seems to require
      introducing a STATS_TYPE_PORT_6250 bit or similar, which seems a tad
      ugly, so for now this just allows access to the STATS_TYPE_BANK0 ones.
      
      The chip does have ptp support, and the existing
      mv88e6352_{gpio,avb,ptp}_ops at first glance seem like they would work
      out-of-the-box, but for simplicity (and lack of testing) I'm eliding
      this.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1f71836f
    • Rasmus Villemoes's avatar
      net: dsa: mv88e6xxx: implement port_link_state for mv88e6250 · ce91c453
      Rasmus Villemoes authored
      
      
      The mv88e6250 has a rather different way of reporting the link, speed
      and duplex status. A simple difference is that the link bit is bit 12
      rather than bit 11 of the port status register.
      
      It gets more complicated for speed and duplex, which do not have
      separate fields. Instead, there's a four-bit PortMode field, and
      decoding that depends on whether it's a phy or mii port. For the phy
      ports, only four of the 16 values have defined meaning; the rest are
      called "reserved", so returning {SPEED,DUPLEX}_UNKNOWN seems
      reasonable.
      
      For the mii ports, most possible values are documented (0x3 and 0x5
      are reserved), but I'm unable to make sense of them all. Since the
      bits simply reflect the Px_MODE[3:0] configuration pins, just support
      the subset that I'm certain about. Support for other setups can be
      added later.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ce91c453
    • Rasmus Villemoes's avatar
      net: dsa: mv88e6xxx: implement port_set_speed for mv88e6250 · a528e5be
      Rasmus Villemoes authored
      
      
      The data sheet also mentions the possibility of selecting 200 Mbps for
      the MII ports (ports 5 and 6) by setting the ForceSpd field to
      0x2 (aka MV88E6065_PORT_MAC_CTL_SPEED_200). However, there's a note
      that "actual speed is determined by bit 8 above", and flipping back a
      page, one finds that bits 13:8 are reserved...
      
      So without further information on what bit 8 means, let's stick to
      supporting just 10 and 100 Mbps on all ports.
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a528e5be
    • Rasmus Villemoes's avatar
      net: dsa: mv88e6xxx: implement watchdog_ops for mv88e6250 · 855cdfde
      Rasmus Villemoes authored
      
      
      The MV88E6352_G2_WDOG_CTL_* bits almost, but not quite, describe the
      watchdog control register on the mv88e6250. Among those actually
      referenced in the code, only QC_ENABLE differs (bit 6 rather than bit
      5).
      
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
      Signed-off-by: default avatarRasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      855cdfde