diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-01-18 10:18:55 +0000 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2022-01-18 10:18:55 +0000 |
commit | 51efd61e20a08e1a262c3b8b6219600ebca2006c (patch) | |
tree | 887b7604bffd071d5a07640040cc8c9d7f7b09a6 /drivers/net/dsa/mv88e6xxx/global2_scratch.c | |
parent | 956c86b60ce352b3e195c6f0700a07176989d356 (diff) | |
parent | e2365fc3e4a0e134ee7f875ce71f0abaaeb4552d (diff) |
Merge branches 'mvebu-cpuidle' and 'mvneta' into clearfog
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/global2_scratch.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/global2_scratch.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/global2_scratch.c b/drivers/net/dsa/mv88e6xxx/global2_scratch.c index eda710062933..a9d6e40321a2 100644 --- a/drivers/net/dsa/mv88e6xxx/global2_scratch.c +++ b/drivers/net/dsa/mv88e6xxx/global2_scratch.c @@ -289,3 +289,31 @@ int mv88e6xxx_g2_scratch_gpio_set_smi(struct mv88e6xxx_chip *chip, return mv88e6xxx_g2_scratch_write(chip, misc_cfg, val); } + +/** + * mv88e6352_g2_scratch_port_has_serdes - indicate if a port can have a serdes + * @chip: chip private data + * @port: port number to check for serdes + * + * Indicates whether the port may have a serdes attached according to the + * pin strapping. Returns negative error number, 0 if the port is not + * configured to have a serdes, and 1 if the port is configured to have a + * serdes attached. + */ +int mv88e6352_g2_scratch_port_has_serdes(struct mv88e6xxx_chip *chip, int port) +{ + u8 config3, p; + int err; + + err = mv88e6xxx_g2_scratch_read(chip, MV88E6352_G2_SCRATCH_CONFIG_DATA3, + &config3); + if (err) + return err; + + if (config3 & MV88E6352_G2_SCRATCH_CONFIG_DATA3_S_SEL) + p = 5; + else + p = 4; + + return port == p; +} |