Commit f78a2517 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: dsa: sja1105: use sja1105_xfer_u32 for the reset procedure

Using sja1105_xfer_buf results in a higher overhead and is harder to
read.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fd6f2c25
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <linux/packing.h> #include <linux/packing.h>
#include "sja1105.h" #include "sja1105.h"
#define SJA1105_SIZE_RESET_CMD 4
struct sja1105_chunk { struct sja1105_chunk {
u8 *buf; u8 *buf;
size_t len; size_t len;
...@@ -179,28 +177,20 @@ static int sja1105et_reset_cmd(struct dsa_switch *ds) ...@@ -179,28 +177,20 @@ static int sja1105et_reset_cmd(struct dsa_switch *ds)
{ {
struct sja1105_private *priv = ds->priv; struct sja1105_private *priv = ds->priv;
const struct sja1105_regs *regs = priv->info->regs; const struct sja1105_regs *regs = priv->info->regs;
u8 packed_buf[SJA1105_SIZE_RESET_CMD] = {0}; u32 cold_reset = BIT(3);
const int size = SJA1105_SIZE_RESET_CMD;
u64 cold_rst = 1;
sja1105_pack(packed_buf, &cold_rst, 3, 3, size);
return sja1105_xfer_buf(priv, SPI_WRITE, regs->rgu, packed_buf, /* Cold reset */
SJA1105_SIZE_RESET_CMD); return sja1105_xfer_u32(priv, SPI_WRITE, regs->rgu, &cold_reset, NULL);
} }
static int sja1105pqrs_reset_cmd(struct dsa_switch *ds) static int sja1105pqrs_reset_cmd(struct dsa_switch *ds)
{ {
struct sja1105_private *priv = ds->priv; struct sja1105_private *priv = ds->priv;
const struct sja1105_regs *regs = priv->info->regs; const struct sja1105_regs *regs = priv->info->regs;
u8 packed_buf[SJA1105_SIZE_RESET_CMD] = {0}; u32 cold_reset = BIT(2);
const int size = SJA1105_SIZE_RESET_CMD;
u64 cold_rst = 1;
sja1105_pack(packed_buf, &cold_rst, 2, 2, size);
return sja1105_xfer_buf(priv, SPI_WRITE, regs->rgu, packed_buf, /* Cold reset */
SJA1105_SIZE_RESET_CMD); return sja1105_xfer_u32(priv, SPI_WRITE, regs->rgu, &cold_reset, NULL);
} }
int sja1105_inhibit_tx(const struct sja1105_private *priv, int sja1105_inhibit_tx(const struct sja1105_private *priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment