Skip to content

Commit

Permalink
Merge branch 'qca_spi-fix-spi-specific-issues'
Browse files Browse the repository at this point in the history
Stefan Wahren says:

====================
qca_spi: Fix SPI specific issues

This small series address two annoying SPI specific issues of
the qca_spi driver.
====================

Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Dec 10, 2024
2 parents 356983f + becc639 commit f136552
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
26 changes: 11 additions & 15 deletions drivers/net/ethernet/qualcomm/qca_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ MODULE_PARM_DESC(qcaspi_burst_len, "Number of data bytes per burst. Use 1-5000."

#define QCASPI_PLUGGABLE_MIN 0
#define QCASPI_PLUGGABLE_MAX 1
static int qcaspi_pluggable = QCASPI_PLUGGABLE_MIN;
static int qcaspi_pluggable = QCASPI_PLUGGABLE_MAX;
module_param(qcaspi_pluggable, int, 0);
MODULE_PARM_DESC(qcaspi_pluggable, "Pluggable SPI connection (yes/no).");

Expand Down Expand Up @@ -818,7 +818,6 @@ qcaspi_netdev_init(struct net_device *dev)

dev->mtu = QCAFRM_MAX_MTU;
dev->type = ARPHRD_ETHER;
qca->clkspeed = qcaspi_clkspeed;
qca->burst_len = qcaspi_burst_len;
qca->spi_thread = NULL;
qca->buffer_size = (QCAFRM_MAX_MTU + VLAN_ETH_HLEN + QCAFRM_HEADER_LEN +
Expand Down Expand Up @@ -909,17 +908,15 @@ qca_spi_probe(struct spi_device *spi)
legacy_mode = of_property_read_bool(spi->dev.of_node,
"qca,legacy-mode");

if (qcaspi_clkspeed == 0) {
if (spi->max_speed_hz)
qcaspi_clkspeed = spi->max_speed_hz;
else
qcaspi_clkspeed = QCASPI_CLK_SPEED;
}
if (qcaspi_clkspeed)
spi->max_speed_hz = qcaspi_clkspeed;
else if (!spi->max_speed_hz)
spi->max_speed_hz = QCASPI_CLK_SPEED;

if ((qcaspi_clkspeed < QCASPI_CLK_SPEED_MIN) ||
(qcaspi_clkspeed > QCASPI_CLK_SPEED_MAX)) {
dev_err(&spi->dev, "Invalid clkspeed: %d\n",
qcaspi_clkspeed);
if (spi->max_speed_hz < QCASPI_CLK_SPEED_MIN ||
spi->max_speed_hz > QCASPI_CLK_SPEED_MAX) {
dev_err(&spi->dev, "Invalid clkspeed: %u\n",
spi->max_speed_hz);
return -EINVAL;
}

Expand All @@ -944,14 +941,13 @@ qca_spi_probe(struct spi_device *spi)
return -EINVAL;
}

dev_info(&spi->dev, "ver=%s, clkspeed=%d, burst_len=%d, pluggable=%d\n",
dev_info(&spi->dev, "ver=%s, clkspeed=%u, burst_len=%d, pluggable=%d\n",
QCASPI_DRV_VERSION,
qcaspi_clkspeed,
spi->max_speed_hz,
qcaspi_burst_len,
qcaspi_pluggable);

spi->mode = SPI_MODE_3;
spi->max_speed_hz = qcaspi_clkspeed;
if (spi_setup(spi) < 0) {
dev_err(&spi->dev, "Unable to setup SPI device\n");
return -EFAULT;
Expand Down
1 change: 0 additions & 1 deletion drivers/net/ethernet/qualcomm/qca_spi.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ struct qcaspi {
#endif

/* user configurable options */
u32 clkspeed;
u8 legacy_mode;
u16 burst_len;
};
Expand Down

0 comments on commit f136552

Please sign in to comment.