Thread (17 messages) 17 messages, 5 authors, 2017-05-15

Re: [PATCH v3 4/6] bus: add driver for the Technologic Systems NBUS

From: Linus Walleij <hidden>
Date: 2017-05-11 13:56:24
Also in: linux-arm-kernel, linux-watchdog, lkml

On Fri, May 5, 2017 at 9:32 PM, Sebastien Bourdelin
[off-list ref] wrote:
This driver implements a GPIOs bit-banged bus, called the NBUS by
Technologic Systems. It is used to communicate with the peripherals in
the FPGA on the TS-4600 SoM.

Signed-off-by: Sebastien Bourdelin <redacted>
---
Changes v2 -> v3:
This driver is pretty.
Reviewed-by: Linus Walleij <redacted>

For future development (that is not about this patch, please
merge this):
+static int ts_nbus_read_byte(struct ts_nbus *ts_nbus, u8 *val)
+{
+       struct gpio_descs *gpios = ts_nbus->data;
+       int ret, i;
+
+       *val = 0;
+       for (i = 0; i < 8; i++) {
+               ret = gpiod_get_value_cansleep(gpios->desc[i]);
+               if (ret < 0)
+                       return ret;
+               if (ret)
+                       *val |= BIT(i);
+       }
+
+       return 0;
+}
That makes it pretty obvious that we really need gpiod_get_array_cansleep()
does it not. That would just become some single register read in
this case.

If you get some time one of these days and wand to have a go at adding
it to gpiolib using this driver as a testbed, do not hesitate.

Yours,
Linus Walleij
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help