net: dsa: mv88e6xxx: add accessors for PTP/TAI registers
This patch implements support for accessing the Precision Time Protocol and Time Application Interface registers via the AVB register interface in the Global 2 register. The register interface differs slightly between different models; older models use a 3-bit operations field, while newer models use a 2-bit field. The operations values and the special "global port" values are different between the two. This is a similar split to the differences in the "Ingress Rate" register between models, so, like in that case, we call the two variants "6352" and "6390" and create an ops structure to abstract between the two. checkpatch fixups by Andrew Lunn Signed-off-by: Brandon Streiff <brandon.streiff@ni.com> Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
b000be95e5
commit
0d632c3d6f
@@ -146,6 +146,7 @@ struct mv88e6xxx_vtu_entry {
|
||||
|
||||
struct mv88e6xxx_bus_ops;
|
||||
struct mv88e6xxx_irq_ops;
|
||||
struct mv88e6xxx_avb_ops;
|
||||
|
||||
struct mv88e6xxx_irq {
|
||||
u16 masked;
|
||||
@@ -344,6 +345,9 @@ struct mv88e6xxx_ops {
|
||||
struct mv88e6xxx_vtu_entry *entry);
|
||||
int (*vtu_loadpurge)(struct mv88e6xxx_chip *chip,
|
||||
struct mv88e6xxx_vtu_entry *entry);
|
||||
|
||||
/* Interface to the AVB/PTP registers */
|
||||
const struct mv88e6xxx_avb_ops *avb_ops;
|
||||
};
|
||||
|
||||
struct mv88e6xxx_irq_ops {
|
||||
@@ -355,6 +359,24 @@ struct mv88e6xxx_irq_ops {
|
||||
void (*irq_free)(struct mv88e6xxx_chip *chip);
|
||||
};
|
||||
|
||||
struct mv88e6xxx_avb_ops {
|
||||
/* Access port-scoped Precision Time Protocol registers */
|
||||
int (*port_ptp_read)(struct mv88e6xxx_chip *chip, int port, int addr,
|
||||
u16 *data, int len);
|
||||
int (*port_ptp_write)(struct mv88e6xxx_chip *chip, int port, int addr,
|
||||
u16 data);
|
||||
|
||||
/* Access global Precision Time Protocol registers */
|
||||
int (*ptp_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data,
|
||||
int len);
|
||||
int (*ptp_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
|
||||
|
||||
/* Access global Time Application Interface registers */
|
||||
int (*tai_read)(struct mv88e6xxx_chip *chip, int addr, u16 *data,
|
||||
int len);
|
||||
int (*tai_write)(struct mv88e6xxx_chip *chip, int addr, u16 data);
|
||||
};
|
||||
|
||||
#define STATS_TYPE_PORT BIT(0)
|
||||
#define STATS_TYPE_BANK0 BIT(1)
|
||||
#define STATS_TYPE_BANK1 BIT(2)
|
||||
|
Reference in New Issue
Block a user