Commit 6ce93484 authored by Stefan Wahren's avatar Stefan Wahren Committed by Jakub Kicinski
Browse files

net: vertexcom: mse102x: Implement flag for valid CMD



After removal of the invalid command counter only a relevant debug
message is left, which can be cumbersome. So add a new flag to debugfs,
which indicates whether the driver has ever received a valid CMD.
This helps to differentiate between general and temporary receive
issues.

Signed-off-by: default avatarStefan Wahren <wahrenst@gmx.net>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250509120435.43646-5-wahrenst@gmx.net


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent aeb90c40
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
#include <linux/cache.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/string_choices.h>

#include <linux/spi/spi.h>
#include <linux/of_net.h>
@@ -84,6 +85,8 @@ struct mse102x_net_spi {
	struct spi_message	spi_msg;
	struct spi_transfer	spi_xfer;

	bool			valid_cmd_received;

#ifdef CONFIG_DEBUG_FS
	struct dentry		*device_root;
#endif
@@ -107,6 +110,8 @@ static int mse102x_info_show(struct seq_file *s, void *what)
		   (unsigned long)mses->spi_xfer.effective_speed_hz);
	seq_printf(s, "SPI mode                : %x\n",
		   mses->spidev->mode);
	seq_printf(s, "Received valid CMD once : %s\n",
		   str_yes_no(mses->valid_cmd_received));

	return 0;
}
@@ -196,6 +201,7 @@ static int mse102x_rx_cmd_spi(struct mse102x_net *mse, u8 *rxb)
		ret = -EIO;
	} else {
		memcpy(rxb, trx + 2, 2);
		mses->valid_cmd_received = true;
	}

	return ret;