[Patch net-next 5/7] net: dsa: microchip: change the size of reg from u8 to u16

From: Arun Ramadoss
Date: Tue Jun 28 2022 - 13:15:17 EST


The register size for the ksz8 switches is u8 and for ksz9477 series is
u16. To have common struct for ksz series switches the size of reg is
increased from u8 to u16.

Signed-off-by: Arun Ramadoss <arun.ramadoss@xxxxxxxxxxxxx>
---
drivers/net/dsa/microchip/ksz8795.c | 22 +++++++++++-----------
drivers/net/dsa/microchip/ksz_common.c | 4 ++--
drivers/net/dsa/microchip/ksz_common.h | 2 +-
3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index 2b3db33c32ce..264c960f715d 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -45,7 +45,7 @@ static void ksz_port_cfg(struct ksz_device *dev, int port, int offset, u8 bits,

static int ksz8_ind_write8(struct ksz_device *dev, u8 table, u16 addr, u8 data)
{
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;
int ret = 0;

@@ -117,7 +117,7 @@ static void ksz8795_set_prio_queue(struct ksz_device *dev, int port, int queue)
void ksz8_r_mib_cnt(struct ksz_device *dev, int port, u16 addr, u64 *cnt)
{
const u32 *masks;
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;
u32 data;
u8 check;
@@ -153,7 +153,7 @@ static void ksz8795_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
u64 *dropped, u64 *cnt)
{
const u32 *masks;
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;
u32 data;
u8 check;
@@ -205,7 +205,7 @@ static void ksz8863_r_mib_pkt(struct ksz_device *dev, int port, u16 addr,
u64 *dropped, u64 *cnt)
{
u32 *last = (u32 *)dropped;
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;
u32 data;
u32 cur;
@@ -292,7 +292,7 @@ void ksz8_port_init_cnt(struct ksz_device *dev, int port)

static void ksz8_r_table(struct ksz_device *dev, int table, u16 addr, u64 *data)
{
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;

regs = dev->info->regs;
@@ -307,7 +307,7 @@ static void ksz8_r_table(struct ksz_device *dev, int table, u16 addr, u64 *data)

static void ksz8_w_table(struct ksz_device *dev, int table, u16 addr, u64 data)
{
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;

regs = dev->info->regs;
@@ -324,7 +324,7 @@ static int ksz8_valid_dyn_entry(struct ksz_device *dev, u8 *data)
{
int timeout = 100;
const u32 *masks;
- const u8 *regs;
+ const u16 *regs;

masks = dev->info->masks;
regs = dev->info->regs;
@@ -354,7 +354,7 @@ int ksz8_r_dyn_mac_table(struct ksz_device *dev, u16 addr, u8 *mac_addr,
u32 data_hi, data_lo;
const u8 *shifts;
const u32 *masks;
- const u8 *regs;
+ const u16 *regs;
u16 ctrl_addr;
u8 data;
int rc;
@@ -561,7 +561,7 @@ void ksz8_r_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 *val)
{
u8 restart, speed, ctrl, link;
int processed = true;
- const u8 *regs;
+ const u16 *regs;
u8 val1, val2;
u16 data = 0;
u8 p = phy;
@@ -684,7 +684,7 @@ void ksz8_r_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 *val)
void ksz8_w_phy(struct ksz_device *dev, u16 phy, u16 reg, u16 val)
{
u8 restart, speed, ctrl, data;
- const u8 *regs;
+ const u16 *regs;
u8 p = phy;

regs = dev->info->regs;
@@ -1199,7 +1199,7 @@ void ksz8_config_cpu_port(struct dsa_switch *ds)
struct ksz_device *dev = ds->priv;
struct ksz_port *p;
const u32 *masks;
- const u8 *regs;
+ const u16 *regs;
u8 remote;
int i;

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index fa66bd14f66a..4992fea208b1 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -201,7 +201,7 @@ static const struct ksz_dev_ops ksz9477_dev_ops = {
.exit = ksz9477_switch_exit,
};

-static const u8 ksz8795_regs[] = {
+static const u16 ksz8795_regs[] = {
[REG_IND_CTRL_0] = 0x6E,
[REG_IND_DATA_8] = 0x70,
[REG_IND_DATA_CHECK] = 0x72,
@@ -252,7 +252,7 @@ static const u8 ksz8795_shifts[] = {
[DYNAMIC_MAC_SRC_PORT] = 24,
};

-static const u8 ksz8863_regs[] = {
+static const u16 ksz8863_regs[] = {
[REG_IND_CTRL_0] = 0x79,
[REG_IND_DATA_8] = 0x7B,
[REG_IND_DATA_CHECK] = 0x7B,
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index c11adf67757d..18794f571687 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -47,7 +47,7 @@ struct ksz_chip_data {
const struct ksz_mib_names *mib_names;
int mib_cnt;
u8 reg_mib_cnt;
- const u8 *regs;
+ const u16 *regs;
const u32 *masks;
const u8 *shifts;
int stp_ctrl_reg;
--
2.36.1