mvneta: SGMII-based in-band link status signaling
Subsystems (6)
cover mvneta: SGMII-based in-band link status signaling
Hello.
The following patches are needed when mvneta is used in SGMII mode without MDIO.
PATCH 1/6 restructure of_phy_register_fixed_link() for further modifications
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
--- drivers/of/of_mdio.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
drivers/of/of_mdio.c +18 -14
@@ -301,22 +301,26 @@ int of_phy_register_fixed_link(struct device_node *np) "asym-pause");of_node_put (fixed_link_node); phy =fixed_phy_register (PHY_POLL , &status, np); - return IS_ERR(phy) ? PTR_ERR(phy) : 0; - } - -/* Old binding */ - fixed_link_prop =of_get_property (np,"fixed-link" , &len); -if (fixed_link_prop && len == (5 *sizeof (__be32))) { - status.link =1 ; - status.duplex =be32_to_cpu (fixed_link_prop[1 ]); - status.speed =be32_to_cpu (fixed_link_prop[2 ]); - status.pause =be32_to_cpu (fixed_link_prop[3 ]); - status.asym_pause =be32_to_cpu (fixed_link_prop[4 ]); - phy =fixed_phy_register (PHY_POLL , &status, np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; +if (IS_ERR (phy)) + return PTR_ERR(phy); + }else { +/* Old binding */ + fixed_link_prop =of_get_property (np,"fixed-link" , &len); +if (fixed_link_prop && len == (5 *sizeof (__be32))) { + status.link =1 ; + status.duplex =be32_to_cpu (fixed_link_prop[1 ]); + status.speed =be32_to_cpu (fixed_link_prop[2 ]); + status.pause =be32_to_cpu (fixed_link_prop[3 ]); + status.asym_pause =be32_to_cpu (fixed_link_prop[4 ]); + phy =fixed_phy_register (PHY_POLL , &status, np); +if (IS_ERR (phy)) +return PTR_ERR (phy); + }else { +return -ENODEV ; + } } -return -ENODEV ; +return 0 ; }EXPORT_SYMBOL (of_phy_register_fixed_link);#endif
Signature · 1 line
1.7.9.5
PATCH 2/6 pass phy_device instead of net_device to fixed_phy link_update() function
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- Looking up phy_device pointer from net_device requires poking into private data. This may be problematic if phy is handled separately from net_device.
Pass phy_device pointer to link_update() function because looking up net_device pointer from phy_device is trivial.
--- drivers/net/phy/fixed_phy.c | 7 +++---- include/linux/phy_fixed.h | 4 ++-- net/dsa/slave.c | 3 ++- 3 files changed, 7 insertions(+), 7 deletions(-)
drivers/net/phy/fixed_phy.c +1 -1
@@ -36,7 +36,7 @@ struct fixed_phy {u16 regs[MII_REGS_NUM ];struct phy_device *phydev;struct fixed_phy_status status; -int (*link_update)(struct net_device *,struct fixed_phy_status *); +int (*link_update)(struct phy_device *,struct fixed_phy_status *);struct list_head node; };
@@ -139,8 +139,7 @@ static int fixed_mdio_read(struct mii_bus *bus, int
phy_addr, int reg_num)
if (fp->addr == phy_addr) {
/* Issue callback if user registered it. */
if (fp->link_update) {
- fp->link_update(fp->phydev->attached_dev,
- &fp->status);
+ fp->link_update(fp->phydev, &fp->status);
fixed_phy_update_regs(fp);
}
return fp->regs[reg_num];@@ -162,7 +161,7 @@ static int fixed_mdio_write(struct mii_bus *bus, int phy_addr, int reg_num,
* May be useful for PHY's that need to be software-driven. */
int fixed_phy_set_link_update(struct phy_device *phydev,
- int (*link_update)(struct net_device *,
+ int (*link_update)(struct phy_device *,
struct fixed_phy_status *))
{
struct fixed_mdio_bus *fmb = &platform_fmb;include/linux/phy_fixed.h +0 -0
@@ -19,7 +19,7 @@ extern struct phy_device *fixed_phy_register(unsigned
int irq,
struct device_node *np);
extern void fixed_phy_del(int phy_addr);
extern int fixed_phy_set_link_update(struct phy_device *phydev,
- int (*link_update)(struct net_device *,
+ int (*link_update)(struct phy_device *,
struct fixed_phy_status *));
#else
static inline int fixed_phy_add(unsigned int irq, int phy_id,
@@ -38,7 +38,7 @@ static inline int fixed_phy_del(int phy_addr)
return -ENODEV; }
static inline int fixed_phy_set_link_update(struct phy_device *phydev,
- int (*link_update)(struct net_device *,
+ int (*link_update)(struct phy_device *,
struct fixed_phy_status *))
{
return -ENODEV;net/dsa/slave.c +0 -0
@@ -500,9 +500,10 @@ static void dsa_slave_adjust_link(struct net_device
*dev)
phy_print_status(p->phy);
}
-static int dsa_slave_fixed_link_update(struct net_device *dev, +static int dsa_slave_fixed_link_update(struct phy_device *phy,
struct fixed_phy_status *status)
{
+ struct net_device *dev = phy->attached_dev;
struct dsa_slave_priv *p = netdev_priv(dev);
struct dsa_switch *ds = p->parent;Signature · 1 line
1.7.9.5
PATCH 3/6 fixed_phy: add fixed_phy_unregister()
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- A counterpart of fixed_phy_register().
Can be used on failure path.
--- drivers/net/phy/fixed_phy.c | 11 +++++++++++ drivers/net/phy/phy_device.c | 7 +++++++ include/linux/phy.h | 1 + include/linux/phy_fixed.h | 4 ++++ 4 files changed, 23 insertions(+)
drivers/net/phy/fixed_phy.c +11 -0
@@ -275,6 +275,17 @@ struct phy_device *fixed_phy_register(unsigned int irq, }EXPORT_SYMBOL_GPL (fixed_phy_register); +void fixed_phy_unregister (struct phy_device *phy) +{ +struct device_node *np = phy->dev.of_node; + +fixed_phy_del (phy->addr); +phy_device_unregister (phy); +phy_device_free (phy); +of_node_put (np); +} +EXPORT_SYMBOL_GPL (fixed_phy_unregister); +static int __init fixed_mdio_bus_init (void ) {struct fixed_mdio_bus *fmb = &platform_fmb;
drivers/net/phy/phy_device.c +7 -0
@@ -375,6 +375,13 @@ int phy_device_register(struct phy_device *phydev) }EXPORT_SYMBOL (phy_device_register); +void phy_device_unregister (struct phy_device *phydev) +{ + phydev->bus->phy_map[phydev->addr] =NULL ; +device_del (&phydev->dev); +} +EXPORT_SYMBOL (phy_device_unregister); +/** * phy_find_first - finds the first PHY device on the bus * @bus: the target MII bus
include/linux/phy.h +0 -0
@@ -714,6 +714,7 @@ struct phy_device *phy_device_create(struct mii_bus
*bus, int addr, int phy_id,
struct phy_c45_device_ids *c45_ids);
struct phy_device *get_phy_device(struct mii_bus *bus, int addr, boolis_c45);
int phy_device_register(struct phy_device *phy);
+void phy_device_unregister(struct phy_device *phydev);
int phy_init_hw(struct phy_device *phydev);
int phy_suspend(struct phy_device *phydev);
int phy_resume(struct phy_device *phydev);
include/linux/phy_fixed.h +1 -0
@@ -17,6 +17,7 @@ extern int fixed_phy_add(unsigned int irq, int phy_id,extern struct phy_device *fixed_phy_register (unsigned int irq,struct fixed_phy_status *status,struct device_node *np); +extern void fixed_phy_unregister (struct phy_device *phy);extern void fixed_phy_del (int phy_addr); extern int fixed_phy_set_link_update(struct phy_device *phydev, int (*link_update)(struct phy_device *,
@@ -33,6 +34,9 @@ static inline struct phy_device
*fixed_phy_register(unsigned int irq,
{
return ERR_PTR(-ENODEV); }
+static inline void fixed_phy_unregister(struct phy_device *phy) +{
+}
static inline int fixed_phy_del(int phy_addr)
{
return -ENODEV;Signature · 1 line
1.7.9.5
PATCH 4/6 of: add API for changing parameters of fixed link
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
--- drivers/of/of_mdio.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++ include/linux/of_mdio.h | 17 +++++++++++ 2 files changed, 89 insertions(+)
drivers/of/of_mdio.c +0 -0
@@ -251,6 +251,69 @@ struct phy_device *of_phy_attach(struct net_device
*dev,
EXPORT_SYMBOL(of_phy_attach);
#if defined(CONFIG_FIXED_PHY)
+struct fixed_link_data {
+ struct fixed_phy_status status;
+ struct fixed_phy_status changed;
+};
+
+static int of_phy_fixed_link_update(struct phy_device *phy,
+ struct fixed_phy_status *status)
+{
+ struct fixed_link_data *priv = phy->priv;
+
+ if (priv->changed.link) {
+ status->link = priv->status.link;
+ priv->changed.link = 0;
+ }
+ if (priv->changed.speed) {
+ status->speed = priv->status.speed;
+ priv->changed.speed = 0;
+ }
+ if (priv->changed.duplex) {
+ status->duplex = priv->status.duplex;
+ priv->changed.duplex = 0;
+ }
+ if (priv->changed.pause) {
+ status->pause = priv->status.pause;
+ priv->changed.pause = 0;
+ }
+ if (priv->changed.asym_pause) {
+ status->asym_pause = priv->status.asym_pause;
+ priv->changed.asym_pause = 0;
+ }
+ return 0;
+}
+
+int of_phy_fixed_link_set_link(struct phy_device *phy, int link) +{
+ struct fixed_link_data *priv = phy->priv;
+
+ priv->status.link = link; + priv->changed.link = 1; + return 0;
+}
+EXPORT_SYMBOL(of_phy_fixed_link_set_link);
+
+int of_phy_fixed_link_set_speed(struct phy_device *phy, int speed) +{
+ struct fixed_link_data *priv = phy->priv;
+
+ priv->status.speed = speed; + priv->changed.speed = 1; + return 0;
+}
+EXPORT_SYMBOL(of_phy_fixed_link_set_speed);
+
+int of_phy_fixed_link_set_duplex(struct phy_device *phy, int duplex) +{
+ struct fixed_link_data *priv = phy->priv;
+
+ priv->status.duplex = duplex; + priv->changed.duplex = 1; + return 0;
+}
+EXPORT_SYMBOL(of_phy_fixed_link_set_duplex);
+
/*
* of_phy_is_fixed_link() and of_phy_register_fixed_link() must
* support two DT bindings:
@@ -287,6 +350,7 @@ int of_phy_register_fixed_link(struct device_node *np)
const __be32 *fixed_link_prop;
int len;
struct phy_device *phy;+ struct fixed_link_data *priv;
/* New binding */
fixed_link_node = of_get_child_by_name(np, "fixed-link");
@@ -320,6 +384,14 @@ int of_phy_register_fixed_link(struct device_node *np)
}
}+ priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ if (!priv) {
+ fixed_phy_unregister(phy);
+ return -ENOMEM;
+ }
+ memset(&priv->changed, 0, sizeof(priv->changed));
+ phy->priv = priv;
+ fixed_phy_set_link_update(phy, of_phy_fixed_link_update);
return 0; }
EXPORT_SYMBOL(of_phy_register_fixed_link);
include/linux/of_mdio.h +0 -0
@@ -65,6 +65,9 @@ static inline struct mii_bus *of_mdio_find_bus(struct
device_node *mdio_np)
#if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY)
extern int of_phy_register_fixed_link(struct device_node *np); extern bool of_phy_is_fixed_link(struct device_node *np);
+extern int of_phy_fixed_link_set_link(struct phy_device *phy, int link); +extern int of_phy_fixed_link_set_speed(struct phy_device *phy, int speed); +extern int of_phy_fixed_link_set_duplex(struct phy_device *phy, int duplex);
#else
static inline int of_phy_register_fixed_link(struct device_node *np) {
@@ -74,6 +77,20 @@ static inline bool of_phy_is_fixed_link(struct device_node *np)
{
return false; }
+static inline int of_phy_fixed_link_set_link(struct phy_device *phy, int link)
+{
+ return -ENOSYS;
+}
+static inline int of_phy_fixed_link_set_speed(struct phy_device *phy,
+ int speed)
+{
+ return -ENOSYS;
+}
+static inline int of_phy_fixed_link_set_duplex(struct phy_device *phy,
+ int duplex)
+{
+ return -ENOSYS;
+}
#endif
Signature · 1 line
1.7.9.5
PATCH 5/6 mvneta: implement SGMII-based in-band link status signaling
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- When MDIO bus is unavailable (common setup for SGMII), the in-band signalling must be used to correctly track link status.
--- drivers/net/ethernet/marvell/mvneta.c | 94 +++++++++++++++++++++++++++++---- 1 file changed, 83 insertions(+), 11 deletions(-)
(quoted diff) +0 -0
b/drivers/net/ethernet/marvell/mvneta.c
index 96208f1..44d2655 100644
drivers/net/ethernet/marvell/mvneta.c +0 -0
@@ -122,6 +122,7 @@#define MVNETA_TX_INTR_MASK_ALL (0xff << 0)#define MVNETA_RX_INTR_MASK (nr_rxqs) (((1 << nr_rxqs) - 1)
<< 8)
#define MVNETA_RX_INTR_MASK_ALL (0xff << 8) +#define MVNETA_MISCINTR_INTR_MASK BIT(31)
#define MVNETA_INTR_OLD_CAUSE 0x25a8
#define MVNETA_INTR_OLD_MASK 0x25ac
@@ -180,9 +181,11 @@
#define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c
#define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0)
#define MVNETA_GMAC_FORCE_LINK_PASS BIT(1)
+#define MVNETA_GMAC_INBAND_AN_ENABLE BIT(2)
#define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5)
#define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6)
#define MVNETA_GMAC_AN_SPEED_EN BIT(7)
+#define MVNETA_GMAC_AN_FLOW_CTRL_EN BIT(11)
#define MVNETA_GMAC_CONFIG_FULL_DUPLEX BIT(12)
#define MVNETA_GMAC_AN_DUPLEX_EN BIT(13)
#define MVNETA_MIB_COUNTERS_BASE 0x3080
@@ -304,6 +307,7 @@ struct mvneta_port {
unsigned int link;
unsigned int duplex;
unsigned int speed;+ int inband_status;
};
/* The mvneta_tx_desc and mvneta_rx_desc structures describe the
@@ -994,6 +998,17 @@ static void mvneta_defaults_set(struct mvneta_port *pp)
val &= ~MVNETA_PHY_POLLING_ENABLE;
mvreg_write(pp, MVNETA_UNIT_CONTROL, val);+ if (pp->inband_status) {
+ val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
+ val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
+ MVNETA_GMAC_FORCE_LINK_DOWN);
+ val |= MVNETA_GMAC_INBAND_AN_ENABLE |
+ MVNETA_GMAC_AN_SPEED_EN |
+ MVNETA_GMAC_AN_FLOW_CTRL_EN |
+ MVNETA_GMAC_AN_DUPLEX_EN;
+ mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+ }
+
mvneta_set_ucast_table(pp, -1);
mvneta_set_special_mcast_table(pp, -1);
mvneta_set_other_mcast_table(pp, -1);
@@ -2043,6 +2058,21 @@ static irqreturn_t mvneta_isr(int irq, void *dev_id)
return IRQ_HANDLED;}
+static void mvneta_get_phy_status(struct mvneta_port *pp,
+ struct fixed_phy_status *r_stat)
+{
+ u32 gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS);
+
+ r_stat->link = !!(gmac_stat & MVNETA_GMAC_LINK_UP);
+ if (gmac_stat & MVNETA_GMAC_SPEED_1000)
+ r_stat->speed = SPEED_1000;
+ else if (gmac_stat & MVNETA_GMAC_SPEED_100)
+ r_stat->speed = SPEED_100;
+ else
+ r_stat->speed = SPEED_10;
+ r_stat->duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX);
+}
+
/* NAPI handler
* Bits 0 - 7 of the causeRxTx register indicate that are transmitted
* packets on the corresponding TXQ (Bit 0 is for TX queue 1).
@@ -2063,8 +2093,29 @@ static int mvneta_poll(struct napi_struct *napi, int budget)
}
/* Read cause register */- cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE) &
- (MVNETA_RX_INTR_MASK(rxq_number) |MVNETA_TX_INTR_MASK(txq_number));
+ cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE);
+ if (cause_rx_tx & MVNETA_MISCINTR_INTR_MASK) {
+ u32 cause_misc = mvreg_read(pp, MVNETA_INTR_MISC_CAUSE);
+
+ mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0);
+ if (pp->inband_status && (cause_misc &
+ (MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ MVNETA_CAUSE_LINK_CHANGE |
+ MVNETA_CAUSE_PSC_SYNC_CHANGE))) {
+ struct fixed_phy_status phy_stat;
+
+ mvneta_get_phy_status(pp, &phy_stat);
+ if (pp->link != phy_stat.link)
+ of_phy_fixed_link_set_link(pp->phy_dev,
+ phy_stat.link);
+ if (pp->speed != phy_stat.speed)
+ of_phy_fixed_link_set_speed(pp->phy_dev,
+ phy_stat.speed);
+ if (pp->duplex != phy_stat.duplex)
+ of_phy_fixed_link_set_duplex(pp->phy_dev,
+ phy_stat.duplex);
+ }
+ }
/* Release Tx descriptors */
if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) {
@@ -2109,7 +2160,9 @@ static int mvneta_poll(struct napi_struct *napi,
int budget)
napi_complete(napi);
local_irq_save(flags);
mvreg_write(pp, MVNETA_INTR_NEW_MASK,
- MVNETA_RX_INTR_MASK(rxq_number) |
MVNETA_TX_INTR_MASK(txq_number));
+ MVNETA_RX_INTR_MASK(rxq_number) |
+ MVNETA_TX_INTR_MASK(txq_number) |
+ MVNETA_MISCINTR_INTR_MASK);
local_irq_restore(flags);
}@@ -2373,7 +2426,13 @@ static void mvneta_start_dev(struct mvneta_port *pp)
/* Unmask interrupts */
mvreg_write(pp, MVNETA_INTR_NEW_MASK,
- MVNETA_RX_INTR_MASK(rxq_number) |
MVNETA_TX_INTR_MASK(txq_number));
+ MVNETA_RX_INTR_MASK(rxq_number) |
+ MVNETA_TX_INTR_MASK(txq_number) |
+ MVNETA_MISCINTR_INTR_MASK);
+ mvreg_write(pp, MVNETA_INTR_MISC_MASK,
+ MVNETA_CAUSE_PHY_STATUS_CHANGE |
+ MVNETA_CAUSE_LINK_CHANGE |
+ MVNETA_CAUSE_PSC_SYNC_CHANGE); phy_start(pp->phy_dev);
netif_tx_start_all_queues(pp->dev);@@ -2523,9 +2582,7 @@ static void mvneta_adjust_link(struct net_device *ndev)
val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG); val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED |
MVNETA_GMAC_CONFIG_GMII_SPEED |
- MVNETA_GMAC_CONFIG_FULL_DUPLEX | - MVNETA_GMAC_AN_SPEED_EN | - MVNETA_GMAC_AN_DUPLEX_EN); + MVNETA_GMAC_CONFIG_FULL_DUPLEX);
if (phydev->duplex)
val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX;@@ -2554,12 +2611,24 @@ static void mvneta_adjust_link(struct net_device *ndev)
if (status_change) {
if (phydev->link) {- u32 val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
- val |= (MVNETA_GMAC_FORCE_LINK_PASS |
- MVNETA_GMAC_FORCE_LINK_DOWN);
- mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+ if (!pp->inband_status) {
+ u32 val = mvreg_read(pp,
+ MVNETA_GMAC_AUTONEG_CONFIG);
+ val &= ~MVNETA_GMAC_FORCE_LINK_DOWN;
+ val |= MVNETA_GMAC_FORCE_LINK_PASS;
+ mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
+ val);
+ }
mvneta_port_up(pp);
} else {
+ if (!pp->inband_status) {
+ u32 val = mvreg_read(pp,
+ MVNETA_GMAC_AUTONEG_CONFIG);
+ val &= ~MVNETA_GMAC_FORCE_LINK_PASS;
+ val |= MVNETA_GMAC_FORCE_LINK_DOWN;
+ mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG,
+ val);
+ }
mvneta_port_down(pp);
}
phy_print_status(phydev);
@@ -2934,6 +3003,7 @@ static int mvneta_probe(struct platform_device *pdev)
char hw_mac_addr[ETH_ALEN];
const char *mac_from;
int phy_mode;
+ int fixed_phy = 0;
int err;
/* Our multiqueue support is not complete, so for now, only
@@ -2967,6 +3037,7 @@ static int mvneta_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "cannot register fixed PHY\n");
goto err_free_irq;
}+ fixed_phy = 1;
/* In the case of a fixed PHY, the DT node associated
* to the PHY is the Ethernet MAC DT node.
@@ -2990,6 +3061,7 @@ static int mvneta_probe(struct platform_device *pdev)
pp = netdev_priv(dev);
pp->phy_node = phy_node;
pp->phy_interface = phy_mode;+ pp->inband_status = (phy_mode == PHY_INTERFACE_MODE_SGMII) &&fixed_phy;
pp->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(pp->clk)) {Signature · 1 line
1.7.9.5
PATCH 6/6 mvneta: port marvell's official in-band status enabling procedure
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=- This is a back-port of official marvell's patch.
It changes nothing visible for me but looks reasonable.
--- drivers/net/ethernet/marvell/mvneta.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
(quoted diff) +0 -0
b/drivers/net/ethernet/marvell/mvneta.c
index 44d2655..5dc7416 100644
drivers/net/ethernet/marvell/mvneta.c +3 -0
@@ -100,6 +100,8 @@#define MVNETA_TXQ_CMD 0x2448#define MVNETA_TXQ_DISABLE_SHIFT 8#define MVNETA_TXQ_ENABLE_MASK 0x000000ff +#define MVNETA_GMAC_CLOCK_DIVIDER 0x24f4 +#define MVNETA_GMAC_1MS_CLOCK_ENABLE BIT(31)#define MVNETA_ACC_MODE 0x2500#define MVNETA_CPU_MAP (cpu) (0x2540 + ((cpu) << 2))#define MVNETA_CPU_RXQ_ACCESS_ALL_MASK 0x000000ff
@@ -166,6 +168,7 @@#define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc#define MVNETA_GMAC0_PORT_ENABLE BIT(0)#define MVNETA_GMAC_CTRL_2 0x2c08 +#define MVNETA_GMAC2_INBAND_AN_ENABLE BIT(0)#define MVNETA_GMAC2_PCS_ENABLE BIT(3)#define MVNETA_GMAC2_PORT_RGMII BIT(4)#define MVNETA_GMAC2_PORT_RESET BIT(6)
@@ -1001,12 +1004,15 @@ static void mvneta_defaults_set(struct
mvneta_port *pp)
if (pp->inband_status) {
val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG);
val &= ~(MVNETA_GMAC_FORCE_LINK_PASS |
- MVNETA_GMAC_FORCE_LINK_DOWN);
+ MVNETA_GMAC_FORCE_LINK_DOWN |
+ MVNETA_GMAC_AN_FLOW_CTRL_EN);
val |= MVNETA_GMAC_INBAND_AN_ENABLE |
MVNETA_GMAC_AN_SPEED_EN |
- MVNETA_GMAC_AN_FLOW_CTRL_EN |
MVNETA_GMAC_AN_DUPLEX_EN;
mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val);
+ val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER);
+ val |= MVNETA_GMAC_1MS_CLOCK_ENABLE;
+ mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val);
}
mvneta_set_ucast_table(pp, -1);
@@ -2979,6 +2985,9 @@ static int mvneta_port_power_up(struct mvneta_port
*pp, int phy_mode)
return -EINVAL;
}+ if (pp->inband_status)
+ ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE;
+
/* Cancel Port Reset */
ctrl &= ~MVNETA_GMAC2_PORT_RESET;
mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl);Signature · 1 line
1.7.9.5
David Miller
maintainerRe: [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function
In reply to Stas SergeevFrom: Stas Sergeev <[email protected]>
Date: Thu, 26 Mar 2015 19:00:01 +0300
Quoted 1 line
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
Don't put this into youro commit messages, ever.
Re: [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function
27.03.2015 01:49, David Miller пишет:
Quoted 5 lines
From: Stas Sergeev <[email protected]>
Date: Thu, 26 Mar 2015 19:00:01 +0300Quoted 1 line
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
Don't put this into youro commit messages, ever.
I'll remove the silly thunderbird-patch-inline plugin (that adds this line) and will try to convince thunderbird not to break indentation, oh...
Re: [PATCH 2/6] pass phy_device instead of net_device to fixed_phy link_update() function
Dear Stas Sergeev,
Quoted 2 lines · Stas Sergeev
I'll remove the silly thunderbird-patch-inline plugin (that adds this line) and will try to convince thunderbird not to break indentation, oh...
Or you start using 'git send-email', which will do the right thing for you.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
Re: [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications
In reply to Stas SergeevHello.
Quoted 1 line · Stas Sergeev
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
Hm, why? You could have put a proper change log here...
Also, threading the patches one after the other is a bad idea, please post
them all as a replies to the patchset summary (0/6).
Quoted 10 lines
Signed-off-by Stas Sergeev <[email protected]>--- drivers/of/of_mdio.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)drivers/of/of_mdio.c +0
-0
drivers/of/of_mdio.c int of_phy_register_fixed_link(struct device_node *np) · line 305
Quoted 5 lines
drivers/of/of_mdio.c +0
-2@@ -301,22 +301,26 @@ int of_phy_register_fixed_link(struct device_node *np) "asym-pause");of_node_put (fixed_link_node); phy =fixed_phy_register (PHY_POLL , &status, np); -return IS_ERR (phy) ?PTR_ERR (phy) :0 ; - }
Unfortunately, your patch has been whitespace-damaged by your mailer, with
all tabs converted to spaces.
WBR, Sergei
Re: [PATCH 1/6] restructure of_phy_register_fixed_link() for further modifications
26.03.2015 22:01, Sergei Shtylyov пишет:
Quoted 7 lines
Hello.
Quoted 1 line · Stas Sergeev
-=-=-=-=-=-=-=-=-=# Don't remove this line #=-=-=-=-=-=-=-=-=-
Hm, why?
Because I used some stupid thunderbird-patch-inline plugin that adds that line:
http://www.floc.net/doc/git/contrib/thunderbird-patch-inline/README
Quoted 3 lines
You could have put a proper change log here...
Also, threading the patches one after the other is a bad idea,
please post them all as a replies to the patchset summary (0/6).
Ok.
Quoted 2 lines
Unfortunately, your patch has been whitespace-damaged by your
mailer, with all tabs converted to spaces.
So the plugin didn't work as expected. :(
Hello,
Quoted 4 lines · Stas Sergeev
Hello.
The following patches are needed when mvneta is used in SGMII mode without MDIO.
Would you mind using scripts/get_maintainer.pl such that the relevant people who have touched this code in the past can be CC'd?
Your patches are barely readable, let alone that you have provided little to explanation as to why you are making such invasive changes.
Signature · 1 line
Florian
26.03.2015 20:13, Florian Fainelli пишет:
Quoted 5 lines
Hello,
Quoted 2 lines · Stas Sergeev
Hello.
Quoted 7 lines
Quoted 2 lines
The following patches are needed when mvneta is used in SGMII mode without MDIO.
Would you mind using
scripts/get_maintainer.plsuch that the relevant people who have touched this code in the past can be CC'd?Your patches are barely readable, let alone that you have provided little to explanation as to why you are making such invasive changes.
OK, will re-send tomorrow with more explanations and CCs. Still not sure about "barely readable" though - I made them through checkpatch.pl.
Quoted 8 lines · Stas Sergeev
26.03.2015 20:13, Florian Fainelli пишет:
Quoted 7 lines
Hello,
Quoted 4 lines · Stas Sergeev
Hello.
The following patches are needed when mvneta is used in SGMII mode without MDIO.
Quoted 8 lines
Quoted 5 lines
Would you mind using
scripts/get_maintainer.plsuch that the relevant people who have touched this code in the past can be CC'd?Your patches are barely readable, let alone that you have provided little to explanation as to why you are making such invasive changes.
OK, will re-send tomorrow with more explanations and CCs. Still not sure about "barely readable" though - I made them through checkpatch.pl.
Your commit messages are very scarce, you need to explain more what you are doing an why.
Signature · 1 line
Florian
26.03.2015 20:29, Florian Fainelli пишет:
Quoted 12 lines · Stas Sergeev
Quoted 11 lines
26.03.2015 20:13, Florian Fainelli пишет:
Quoted 10 lines
Hello,
Quoted 4 lines · Stas Sergeev
Hello.
The following patches are needed when mvneta is used in SGMII mode without MDIO.
Would you mind using
scripts/get_maintainer.plsuch that the relevant people who have touched this code in the past can be CC'd?
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Your patches are barely readable, let alone that you have provided little to explanation as to why you are making such invasive changes.
OK, will re-send tomorrow with more explanations and CCs. Still not sure about "barely readable" though - I made them through checkpatch.pl.
Your commit messages are very scarce, you need to explain more what you are doing an why.
That's OK, will do, thanks.
You said that my patches and barely readable AND have little explanation, so I thought you mean the code changes itself are barely readable too.