net: dsa: b53: Have b53_hdr_setup() enable/disable tagging
Have b53_hdr_setup() check what kind of tagging protocol is configured (Broadcom or none) and apply the correct settings in both cases. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6683ed96b5
commit
cdb583cfe7
@@ -545,6 +545,7 @@ EXPORT_SYMBOL(b53_disable_port);
|
|||||||
|
|
||||||
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
|
void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
|
||||||
{
|
{
|
||||||
|
bool tag_en = !!(ds->ops->get_tag_protocol(ds) == DSA_TAG_PROTO_BRCM);
|
||||||
struct b53_device *dev = ds->priv;
|
struct b53_device *dev = ds->priv;
|
||||||
u8 hdr_ctl, val;
|
u8 hdr_ctl, val;
|
||||||
u16 reg;
|
u16 reg;
|
||||||
@@ -567,7 +568,10 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
|
|||||||
|
|
||||||
/* Enable Broadcom tags for IMP port */
|
/* Enable Broadcom tags for IMP port */
|
||||||
b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
|
b53_read8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, &hdr_ctl);
|
||||||
|
if (tag_en)
|
||||||
hdr_ctl |= val;
|
hdr_ctl |= val;
|
||||||
|
else
|
||||||
|
hdr_ctl &= ~val;
|
||||||
b53_write8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, hdr_ctl);
|
b53_write8(dev, B53_MGMT_PAGE, B53_BRCM_HDR, hdr_ctl);
|
||||||
|
|
||||||
/* Registers below are only accessible on newer devices */
|
/* Registers below are only accessible on newer devices */
|
||||||
@@ -578,14 +582,20 @@ void b53_brcm_hdr_setup(struct dsa_switch *ds, int port)
|
|||||||
* allow us to tag outgoing frames
|
* allow us to tag outgoing frames
|
||||||
*/
|
*/
|
||||||
b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, ®);
|
b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, ®);
|
||||||
|
if (tag_en)
|
||||||
reg &= ~BIT(port);
|
reg &= ~BIT(port);
|
||||||
|
else
|
||||||
|
reg |= BIT(port);
|
||||||
b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, reg);
|
b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_RX_DIS, reg);
|
||||||
|
|
||||||
/* Enable transmission of Broadcom tags from the switch (CPU RX) to
|
/* Enable transmission of Broadcom tags from the switch (CPU RX) to
|
||||||
* allow delivering frames to the per-port net_devices
|
* allow delivering frames to the per-port net_devices
|
||||||
*/
|
*/
|
||||||
b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, ®);
|
b53_read16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, ®);
|
||||||
|
if (tag_en)
|
||||||
reg &= ~BIT(port);
|
reg &= ~BIT(port);
|
||||||
|
else
|
||||||
|
reg |= BIT(port);
|
||||||
b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, reg);
|
b53_write16(dev, B53_MGMT_PAGE, B53_BRCM_HDR_TX_DIS, reg);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(b53_brcm_hdr_setup);
|
EXPORT_SYMBOL(b53_brcm_hdr_setup);
|
||||||
|
Reference in New Issue
Block a user