Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1617903

Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303

From Andrew Lunn <andrew@lunn.ch>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303
Date 2017-04-06 14:00 +0200
Message-ID <ttef0-81k-21@gated-at.bofh.it> (permalink)
References <tsPqh-Mk-1@gated-at.bofh.it> <tsPqh-Mk-7@gated-at.bofh.it> <tsXHc-66T-23@gated-at.bofh.it> <ttcPV-7fO-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> > > +static int lan9303_phy_write(struct dsa_switch *ds, int phy, int regnum,
> > > +			          u16 val) 
> > > +{
> > > +	struct lan9303 *chip = ds_to_lan9303(ds);
> > > +	int phy_base = chip->phy_addr_sel_strap;
> > > +
> > > +	if (phy == phy_base)
> > > +		return lan9303_virt_phy_reg_write(chip, regnum, val);
> > > +	if (phy > phy_base + 2)
> > > +		return -ENODEV;
> > > +
> > > +	return lan9303_phy_reg_write(chip, phy, regnum, val);
> >
> > Does the MDIO bus go to the outside world? Could there be external
> > PHYs?
> 
> ???? This device includes two phys (at port 1 and 2) and these functions are
> called to detect their state.

Some switches have the MDIO bus available on pins. It is then possible
to connect additional PHYs on the MDIO bus. If their is an external
MDIO bus, you should remove the test for phy > phy_base + 2, and allow
the full range of 32. 

> > > +static void lan9303_port_disable(struct dsa_switch *ds, int port,
> > > +				 struct phy_device *phy)
> > > +{
> > > +	struct lan9303 *chip = ds_to_lan9303(ds);
> > > +	int rc;
> > > +
> > > +	/* disable internal data handling */
> > > +	switch (port) {
> > > +	case 1:
> > > +		rc = lan9303_phy_reg_write(chip, chip->phy_addr_sel_strap + 1,
> > > +					   0, BIT(14) | BIT(11));
> > > +		rc += lan9303_write_switch_reg(chip, LAN9303_MAC_RX_CFG_1,
> > > +					       0x02);
> > > +		rc += lan9303_write_switch_reg(chip, LAN9303_MAC_TX_CFG_1,
> > > +					       0x56);
> >
> > It seems odd that port_enable does not touch the PHY, but port_disable
> > does. What is this doing?
> 
> My experience is, the framework powers up the phys by its own in conjunction
> with calling lan9303_port_enable(), but do not power down them in conjunction
> with calling lan9303_port_disable(). In v2 I do not touch the phy anymore.

So this is touching the BMCR_PDOWN bit? Using the #define would of
helped explain this.

       Andrew

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

net: dsa: add SMSC/Microchip LAN9303 three port ethernet switch driver Juergen Borleis <jbe@pengutronix.de> - 2017-04-05 11:30 +0200
  [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303 Juergen Borleis <jbe@pengutronix.de> - 2017-04-05 11:30 +0200
    Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the  SMSC-LAN9303 Andrew Lunn <andrew@lunn.ch> - 2017-04-05 20:20 +0200
      Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303 Juergen Borleis <jbe@pengutronix.de> - 2017-04-06 12:30 +0200
        Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the  SMSC-LAN9303 Andrew Lunn <andrew@lunn.ch> - 2017-04-06 14:00 +0200
          Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303 Juergen Borleis <jbe@pengutronix.de> - 2017-04-06 15:50 +0200
      Re: [PATCH 2/4] net: dsa: add new DSA switch driver for the SMSC-LAN9303 Juergen Borleis <jbe@pengutronix.de> - 2017-04-06 12:50 +0200
  [PATCH 1/4] net: dsa: add support for the SMSC-LAN9303 tagging format Juergen Borleis <jbe@pengutronix.de> - 2017-04-05 11:30 +0200
    Re: [PATCH 1/4] net: dsa: add support for the SMSC-LAN9303 tagging  format Andrew Lunn <andrew@lunn.ch> - 2017-04-05 19:20 +0200
      Re: [PATCH 1/4] net: dsa: add support for the SMSC-LAN9303 tagging format Juergen Borleis <jbe@pengutronix.de> - 2017-04-06 15:40 +0200
  [PATCH 3/4] net: dsa: LAN9303: add I2C managed mode support Juergen Borleis <jbe@pengutronix.de> - 2017-04-05 11:30 +0200
    Re: [PATCH 3/4] net: dsa: LAN9303: add I2C managed mode support Andrew Lunn <andrew@lunn.ch> - 2017-04-05 20:30 +0200
      Re: [PATCH 3/4] net: dsa: LAN9303: add I2C managed mode support Juergen Borleis <jbe@pengutronix.de> - 2017-04-06 15:50 +0200
        Re: [PATCH 3/4] net: dsa: LAN9303: add I2C managed mode support Florian Fainelli <f.fainelli@gmail.com> - 2017-04-06 16:00 +0200
  [PATCH 4/4] net: dsa: LAN9303: add MDIO managed mode support Juergen Borleis <jbe@pengutronix.de> - 2017-04-05 11:30 +0200
    Re: [PATCH 4/4] net: dsa: LAN9303: add MDIO managed mode support Andrew Lunn <andrew@lunn.ch> - 2017-04-05 21:40 +0200
      Re: [PATCH 4/4] net: dsa: LAN9303: add MDIO managed mode support Florian Fainelli <f.fainelli@gmail.com> - 2017-04-06 16:00 +0200
        Re: [PATCH 4/4] net: dsa: LAN9303: add MDIO managed mode support Andrew Lunn <andrew@lunn.ch> - 2017-04-06 16:30 +0200

csiph-web