Skip to content

Commit

Permalink
tgupdate: merge t/upstream base into t/upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
matttbe committed Aug 19, 2024
2 parents e2b0735 + d0c398f commit 372c0d2
Show file tree
Hide file tree
Showing 51 changed files with 5,697 additions and 514 deletions.
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/net/dsa/microchip,ksz.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ properties:
Set if the output SYNCLKO clock should be disabled. Do not mix with
microchip,synclko-125.

microchip,pme-active-high:
$ref: /schemas/types.yaml#/definitions/flag
description:
Indicates if the PME pin polarity is active-high.

microchip,io-drive-strength-microamp:
description:
IO Pad Drive Strength
Expand Down
2 changes: 1 addition & 1 deletion Documentation/devicetree/bindings/net/mdio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ description:

properties:
$nodename:
pattern: "^mdio(@.*)?"
pattern: '^mdio(-(bus|external))?(@.+|-([0-9]+))?$'

"#address-cells":
const: 1
Expand Down
10 changes: 5 additions & 5 deletions Documentation/networking/multi-pf-netdev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ The relation between PF, irq, napi, and queue can be observed via netlink spec::
Here you can clearly observe our channels distribution policy::

$ ls /proc/irq/{36,39,40,41,42}/mlx5* -d -1
/proc/irq/36/mlx5_comp1@pci:0000:08:00.0
/proc/irq/39/mlx5_comp1@pci:0000:09:00.0
/proc/irq/40/mlx5_comp2@pci:0000:08:00.0
/proc/irq/41/mlx5_comp2@pci:0000:09:00.0
/proc/irq/42/mlx5_comp3@pci:0000:08:00.0
/proc/irq/36/mlx5_comp0@pci:0000:08:00.0
/proc/irq/39/mlx5_comp0@pci:0000:09:00.0
/proc/irq/40/mlx5_comp1@pci:0000:08:00.0
/proc/irq/41/mlx5_comp1@pci:0000:09:00.0
/proc/irq/42/mlx5_comp2@pci:0000:08:00.0

Steering
========
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/dsa/microchip/ksz8.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ int ksz8_reset_switch(struct ksz_device *dev);
int ksz8_switch_init(struct ksz_device *dev);
void ksz8_switch_exit(struct ksz_device *dev);
int ksz8_change_mtu(struct ksz_device *dev, int port, int mtu);
int ksz8_pme_write8(struct ksz_device *dev, u32 reg, u8 value);
int ksz8_pme_pread8(struct ksz_device *dev, int port, int offset, u8 *data);
int ksz8_pme_pwrite8(struct ksz_device *dev, int port, int offset, u8 data);
void ksz8_phylink_mac_link_up(struct phylink_config *config,
struct phy_device *phydev, unsigned int mode,
phy_interface_t interface, int speed, int duplex,
Expand Down
94 changes: 92 additions & 2 deletions drivers/net/dsa/microchip/ksz8795.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,
bits, set ? bits : 0);
}

/**
* ksz8_ind_write8 - EEE/ACL/PME indirect register write
* @dev: The device structure.
* @table: Function & table select, register 110.
* @addr: Indirect access control, register 111.
* @data: The data to be written.
*
* This function performs an indirect register write for EEE, ACL or
* PME switch functionalities. Both 8-bit registers 110 and 111 are
* written at once with ksz_write16, using the serial multiple write
* functionality.
*
* Return: 0 on success, or an error code on failure.
*/
static int ksz8_ind_write8(struct ksz_device *dev, u8 table, u16 addr, u8 data)
{
const u16 *regs;
Expand All @@ -58,6 +72,59 @@ static int ksz8_ind_write8(struct ksz_device *dev, u8 table, u16 addr, u8 data)
return ret;
}

/**
* ksz8_ind_read8 - EEE/ACL/PME indirect register read
* @dev: The device structure.
* @table: Function & table select, register 110.
* @addr: Indirect access control, register 111.
* @val: The value read.
*
* This function performs an indirect register read for EEE, ACL or
* PME switch functionalities. Both 8-bit registers 110 and 111 are
* written at once with ksz_write16, using the serial multiple write
* functionality.
*
* Return: 0 on success, or an error code on failure.
*/
static int ksz8_ind_read8(struct ksz_device *dev, u8 table, u16 addr, u8 *val)
{
const u16 *regs;
u16 ctrl_addr;
int ret = 0;

regs = dev->info->regs;

mutex_lock(&dev->alu_mutex);

ctrl_addr = IND_ACC_TABLE(table | TABLE_READ) | addr;
ret = ksz_write16(dev, regs[REG_IND_CTRL_0], ctrl_addr);
if (!ret)
ret = ksz_read8(dev, regs[REG_IND_BYTE], val);

mutex_unlock(&dev->alu_mutex);

return ret;
}

int ksz8_pme_write8(struct ksz_device *dev, u32 reg, u8 value)
{
return ksz8_ind_write8(dev, (u8)(reg >> 8), (u8)(reg), value);
}

int ksz8_pme_pread8(struct ksz_device *dev, int port, int offset, u8 *data)
{
u8 table = (u8)(offset >> 8 | (port + 1));

return ksz8_ind_read8(dev, table, (u8)(offset), data);
}

int ksz8_pme_pwrite8(struct ksz_device *dev, int port, int offset, u8 data)
{
u8 table = (u8)(offset >> 8 | (port + 1));

return ksz8_ind_write8(dev, table, (u8)(offset), data);
}

int ksz8_reset_switch(struct ksz_device *dev)
{
if (ksz_is_ksz88x3(dev)) {
Expand Down Expand Up @@ -1545,6 +1612,7 @@ static void ksz8795_cpu_interface_select(struct ksz_device *dev, int port)

void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port)
{
const u16 *regs = dev->info->regs;
struct dsa_switch *ds = dev->ds;
const u32 *masks;
int queues;
Expand Down Expand Up @@ -1575,6 +1643,13 @@ void ksz8_port_setup(struct ksz_device *dev, int port, bool cpu_port)
member = BIT(dsa_upstream_port(ds, port));

ksz8_cfg_port_member(dev, port, member);

/* Disable all WoL options by default. Otherwise
* ksz_switch_macaddr_get/put logic will not work properly.
* CPU port 4 has no WoL functionality.
*/
if (ksz_is_ksz87xx(dev) && !cpu_port)
ksz8_pme_pwrite8(dev, port, regs[REG_PORT_PME_CTRL], 0);
}

static void ksz88x3_config_rmii_clk(struct ksz_device *dev)
Expand Down Expand Up @@ -1790,7 +1865,8 @@ int ksz8_enable_stp_addr(struct ksz_device *dev)
int ksz8_setup(struct dsa_switch *ds)
{
struct ksz_device *dev = ds->priv;
int i;
const u16 *regs = dev->info->regs;
int i, ret = 0;

ds->mtu_enforcement_ingress = true;

Expand Down Expand Up @@ -1829,7 +1905,21 @@ int ksz8_setup(struct dsa_switch *ds)
for (i = 0; i < (dev->info->num_vlans / 4); i++)
ksz8_r_vlan_entries(dev, i);

return ksz8_handle_global_errata(ds);
/* Make sure PME (WoL) is not enabled. If requested, it will
* be enabled by ksz_wol_pre_shutdown(). Otherwise, some PMICs
* do not like PME events changes before shutdown. PME only
* available on KSZ87xx family.
*/
if (ksz_is_ksz87xx(dev)) {
ret = ksz8_pme_write8(dev, regs[REG_SW_PME_CTRL], 0);
if (!ret)
ret = ksz_rmw8(dev, REG_INT_ENABLE, INT_PME, 0);
}

if (!ret)
return ksz8_handle_global_errata(ds);
else
return ret;
}

void ksz8_get_caps(struct ksz_device *dev, int port,
Expand Down
Loading

0 comments on commit 372c0d2

Please sign in to comment.