Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1685784 > unrolled thread
| Started by | Oleksij Rempel <o.rempel@pengutronix.de> |
|---|---|
| First post | 2017-07-12 15:50 +0200 |
| Last post | 2017-07-13 09:50 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH v1] spi: loopback-test: provide loop request option. Oleksij Rempel <o.rempel@pengutronix.de> - 2017-07-12 15:50 +0200
Re: [PATCH v1] spi: loopback-test: provide loop request option. Oleksij Rempel <ore@pengutronix.de> - 2017-07-13 07:00 +0200
Re: [PATCH v1] spi: loopback-test: provide loop request option. Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2017-07-13 09:50 +0200
| From | Oleksij Rempel <o.rempel@pengutronix.de> |
|---|---|
| Date | 2017-07-12 15:50 +0200 |
| Subject | [PATCH v1] spi: loopback-test: provide loop request option. |
| Message-ID | <u2qbD-pT-7@gated-at.bofh.it> |
From: Oleksij Rempel <linux@rempel-privat.de>
Provide a module parameter to request internal
loop by the SPI master controller.
This should make loop testing easier without extra HW modification.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
drivers/spi/spi-loopback-test.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c
index f4875f177df0..34e1544d7d0e 100644
--- a/drivers/spi/spi-loopback-test.c
+++ b/drivers/spi/spi-loopback-test.c
@@ -51,6 +51,14 @@ MODULE_PARM_DESC(loopback,
"is checked to match tx_buf after the spi_message " \
"is executed");
+/* the device is jumpered for loopback - enabling some rx_buf tests */
+int loop_req;
+module_param(loop_req, int, 0);
+MODULE_PARM_DESC(loop_req,
+ "if set enable controller will be asked to enable " \
+ "test loop mode. If supported, MISO and MOSI will be " \
+ "jumpered by SPI controller");
+
/* run only a specific test */
int run_only_test = -1;
module_param(run_only_test, int, 0);
@@ -313,6 +321,16 @@ static int spi_loopback_test_probe(struct spi_device *spi)
{
int ret;
+ if (loop_req) {
+ spi->mode = SPI_LOOP | spi->mode;
+ ret = spi_setup(spi);
+ if (ret) {
+ dev_err(&spi->dev, "SPI setup wasn't successful %d\n", ret);
+ dev_err(&spi->dev, "SPI_LOOP is not supported by SPI master.");
+ return -ENODEV;
+ }
+ }
+
dev_info(&spi->dev, "Executing spi-loopback-tests\n");
ret = spi_test_run_tests(spi, spi_tests);
--
2.11.0
[toc] | [next] | [standalone]
| From | Oleksij Rempel <ore@pengutronix.de> |
|---|---|
| Date | 2017-07-13 07:00 +0200 |
| Message-ID | <u2Eoh-10Y-3@gated-at.bofh.it> |
| In reply to | #1685784 |
On 12.07.2017 15:40, Oleksij Rempel wrote:
> From: Oleksij Rempel <linux@rempel-privat.de>
>
> Provide a module parameter to request internal
> loop by the SPI master controller.
> This should make loop testing easier without extra HW modification.
>
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
> drivers/spi/spi-loopback-test.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c
> index f4875f177df0..34e1544d7d0e 100644
> --- a/drivers/spi/spi-loopback-test.c
> +++ b/drivers/spi/spi-loopback-test.c
> @@ -51,6 +51,14 @@ MODULE_PARM_DESC(loopback,
> "is checked to match tx_buf after the spi_message " \
> "is executed");
>
> +/* the device is jumpered for loopback - enabling some rx_buf tests */
> +int loop_req;
> +module_param(loop_req, int, 0);
> +MODULE_PARM_DESC(loop_req,
> + "if set enable controller will be asked to enable " \
i need to correct this ^^^.
And wait if there any other comments :)
> + "test loop mode. If supported, MISO and MOSI will be " \
> + "jumpered by SPI controller");
> +
> /* run only a specific test */
> int run_only_test = -1;
> module_param(run_only_test, int, 0);
> @@ -313,6 +321,16 @@ static int spi_loopback_test_probe(struct spi_device *spi)
> {
> int ret;
>
> + if (loop_req) {
> + spi->mode = SPI_LOOP | spi->mode;
> + ret = spi_setup(spi);
> + if (ret) {
> + dev_err(&spi->dev, "SPI setup wasn't successful %d\n", ret);
> + dev_err(&spi->dev, "SPI_LOOP is not supported by SPI master.");
> + return -ENODEV;
> + }
> + }
> +
> dev_info(&spi->dev, "Executing spi-loopback-tests\n");
>
> ret = spi_test_run_tests(spi, spi_tests);
>
[toc] | [prev] | [next] | [standalone]
| From | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> |
|---|---|
| Date | 2017-07-13 09:50 +0200 |
| Message-ID | <u2H2O-2IC-37@gated-at.bofh.it> |
| In reply to | #1685784 |
On Wed, Jul 12, 2017 at 03:40:20PM +0200, Oleksij Rempel wrote:
> From: Oleksij Rempel <linux@rempel-privat.de>
>
> Provide a module parameter to request internal
> loop by the SPI master controller.
> This should make loop testing easier without extra HW modification.
>
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
> drivers/spi/spi-loopback-test.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c
> index f4875f177df0..34e1544d7d0e 100644
> --- a/drivers/spi/spi-loopback-test.c
> +++ b/drivers/spi/spi-loopback-test.c
> @@ -51,6 +51,14 @@ MODULE_PARM_DESC(loopback,
> "is checked to match tx_buf after the spi_message " \
> "is executed");
>
> +/* the device is jumpered for loopback - enabling some rx_buf tests */
> +int loop_req;
> +module_param(loop_req, int, 0);
> +MODULE_PARM_DESC(loop_req,
> + "if set enable controller will be asked to enable " \
> + "test loop mode. If supported, MISO and MOSI will be " \
> + "jumpered by SPI controller");
> +
> /* run only a specific test */
> int run_only_test = -1;
> module_param(run_only_test, int, 0);
> @@ -313,6 +321,16 @@ static int spi_loopback_test_probe(struct spi_device *spi)
> {
> int ret;
>
> + if (loop_req) {
> + spi->mode = SPI_LOOP | spi->mode;
> + ret = spi_setup(spi);
> + if (ret) {
> + dev_err(&spi->dev, "SPI setup wasn't successful %d\n", ret);
> + dev_err(&spi->dev, "SPI_LOOP is not supported by SPI master.");
Why two error messages here? What about:
dev_err(&spi->dev, "SPI setup with SPI_LOOP failed (%d)\n", ret);
These lines are > 80 chars, so you should break them.
> + return -ENODEV;
return ret?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web