Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1652476 > unrolled thread

[PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver

Started byStefan Wahren <stefan.wahren@i2se.com>
First post2017-05-29 14:10 +0200
Last post2017-05-30 20:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-29 14:10 +0200
    [PATCH v8 net-next 08/17] net: qualcomm: move qcaspi_tx_cmd to qca_spi.c Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-29 14:10 +0200
    [PATCH v8 net-next 15/17] dt-bindings: slave-device: add current-speed property Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-29 14:10 +0200
    Re: [PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART  driver David Miller <davem@davemloft.net> - 2017-05-30 20:10 +0200

#1652476 — [PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver

FromStefan Wahren <stefan.wahren@i2se.com>
Date2017-05-29 14:10 +0200
Subject[PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver
Message-ID<tMrv3-7MV-3@gated-at.bofh.it>
The Qualcomm QCA7000 HomePlug GreenPHY supports two interfaces:
UART and SPI. This patch series adds the missing support for UART.

This driver based on the Qualcomm code [1], but contains some changes:
* use random MAC address per default
* use net_device_stats from device
* share frame decoding between SPI and UART driver
* improve error handling
* reimplement tty_wakeup with work queue (based on slcan)
* use new serial device bus instead of ldisc

The patches 1 - 3 are just for clean up and are not related to
the UART support. Patch 4 adds SET_NETDEV_DEV() to qca_spi.
Patches 5 - 16 prepare the existing QCA7000 code for UART support.
The last patch contains the new driver.

The code itself has been tested on a Freescale i.MX28 board and
a Raspberry Pi Zero.

Changes in v8:
  * add necessary header includes to qca_7k.c in order to reflect
    dependencies

Changes in v7:
  * fix race between tx workqueue and device deregistration (reported by Lino)

Changes in v6:
  * rebase to current linux-next
  * use SET_NETDEV_DEV() for qca_spi and qca_uart
  * rename binding to qca,qca7000.txt
  * use qca,qca7000 compatible for both driver
  * handle error cases in qca_uart_probe properly
  * fix skb leak in error path of qcauart_netdev_init
  * use dev_kfree_skb_any instead of kfree_skb
  * take care of tx_work on close / remove
  * use devm_kmalloc for tx buffer
  * minor cleanups

Changes in v5:
  * rebase to current linux-next
  * fix alignment issues in rx path
  * fix buffer overrun with big ethernet frames
  * fix init of UART decoding fsm
  * add device UART settings to Kconfig help
  * add current-speed to slave-device binding
  * merge SPI and UART binding document
  * rename qca_common to qca_7k_common
  * drop patch for retrieving UART settings
  * several cleanups

Changes in v4:
  * rebase to current linux-next
  * use parameter -M for git format-patch
  * change order of local variables where possible
  * implement basic serdev support (without hardware flow control)

Changes in v3:
  * rebase to current net-next

Changes in v2:
  * fix build issue by using netif_trans_update() and dev_trans_start()

[1] - https://github.com/IoE/qca7000

Stefan Wahren (17):
  net: qualcomm: qca_7k: clean up header includes
  net: qca_framing: use u16 for frame offset
  net: qca_7k: Use BIT macro
  net: qca_spi: Use SET_NETDEV_DEV()
  net: qualcomm: use net_device_ops instead of direct call
  net: qualcomm: Improve readability of length defines
  net: qca_spi: remove QCASPI_MTU
  net: qualcomm: move qcaspi_tx_cmd to qca_spi.c
  net: qca_spi: Clarify MODULE_DESCRIPTION
  net: qualcomm: rename qca_framing.c to qca_7k_common.c
  net: qualcomm: prepare frame decoding for UART driver
  net: qualcomm: make qca_7k_common a separate kernel module
  dt-bindings: qca7000-spi: Rework binding
  dt-bindings: qca7000: rename binding
  dt-bindings: slave-device: add current-speed property
  dt-bindings: qca7000: append UART interface to binding
  net: qualcomm: add QCA7000 UART driver

 .../devicetree/bindings/net/qca,qca7000.txt        |  88 +++++
 .../devicetree/bindings/net/qca-qca7000-spi.txt    |  47 ---
 .../devicetree/bindings/serial/slave-device.txt    |   9 +
 drivers/net/ethernet/qualcomm/Kconfig              |  24 +-
 drivers/net/ethernet/qualcomm/Makefile             |   7 +-
 drivers/net/ethernet/qualcomm/qca_7k.c             |  30 +-
 drivers/net/ethernet/qualcomm/qca_7k.h             |  15 +-
 .../qualcomm/{qca_framing.c => qca_7k_common.c}    |  26 +-
 .../qualcomm/{qca_framing.h => qca_7k_common.h}    |  24 +-
 drivers/net/ethernet/qualcomm/qca_debug.c          |   5 +-
 drivers/net/ethernet/qualcomm/qca_spi.c            |  48 ++-
 drivers/net/ethernet/qualcomm/qca_spi.h            |   5 +-
 drivers/net/ethernet/qualcomm/qca_uart.c           | 423 +++++++++++++++++++++
 13 files changed, 632 insertions(+), 119 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/qca,qca7000.txt
 delete mode 100644 Documentation/devicetree/bindings/net/qca-qca7000-spi.txt
 rename drivers/net/ethernet/qualcomm/{qca_framing.c => qca_7k_common.c} (85%)
 rename drivers/net/ethernet/qualcomm/{qca_framing.h => qca_7k_common.h} (86%)
 create mode 100644 drivers/net/ethernet/qualcomm/qca_uart.c

-- 
2.1.4

[toc] | [next] | [standalone]


#1652477 — [PATCH v8 net-next 08/17] net: qualcomm: move qcaspi_tx_cmd to qca_spi.c

FromStefan Wahren <stefan.wahren@i2se.com>
Date2017-05-29 14:10 +0200
Subject[PATCH v8 net-next 08/17] net: qualcomm: move qcaspi_tx_cmd to qca_spi.c
Message-ID<tMrEK-865-41@gated-at.bofh.it>
In reply to#1652476
The function qcaspi_tx_cmd() is only called from qca_spi.c. So we better
move it there.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
 drivers/net/ethernet/qualcomm/qca_7k.c  | 24 ------------------------
 drivers/net/ethernet/qualcomm/qca_7k.h  |  1 -
 drivers/net/ethernet/qualcomm/qca_spi.c | 24 ++++++++++++++++++++++++
 3 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c
index e9162e1..ffe7a16 100644
--- a/drivers/net/ethernet/qualcomm/qca_7k.c
+++ b/drivers/net/ethernet/qualcomm/qca_7k.c
@@ -121,27 +121,3 @@ qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value)
 
 	return ret;
 }
-
-int
-qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd)
-{
-	__be16 tx_data;
-	struct spi_message *msg = &qca->spi_msg1;
-	struct spi_transfer *transfer = &qca->spi_xfer1;
-	int ret;
-
-	tx_data = cpu_to_be16(cmd);
-	transfer->len = sizeof(tx_data);
-	transfer->tx_buf = &tx_data;
-	transfer->rx_buf = NULL;
-
-	ret = spi_sync(qca->spi_dev, msg);
-
-	if (!ret)
-		ret = msg->status;
-
-	if (ret)
-		qcaspi_spi_error(qca);
-
-	return ret;
-}
diff --git a/drivers/net/ethernet/qualcomm/qca_7k.h b/drivers/net/ethernet/qualcomm/qca_7k.h
index 4047f0a..27124c2 100644
--- a/drivers/net/ethernet/qualcomm/qca_7k.h
+++ b/drivers/net/ethernet/qualcomm/qca_7k.h
@@ -67,6 +67,5 @@
 void qcaspi_spi_error(struct qcaspi *qca);
 int qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result);
 int qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value);
-int qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd);
 
 #endif /* _QCA_7K_H */
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 7464628..50adc4f 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -192,6 +192,30 @@ qcaspi_read_legacy(struct qcaspi *qca, u8 *dst, u32 len)
 }
 
 static int
+qcaspi_tx_cmd(struct qcaspi *qca, u16 cmd)
+{
+	__be16 tx_data;
+	struct spi_message *msg = &qca->spi_msg1;
+	struct spi_transfer *transfer = &qca->spi_xfer1;
+	int ret;
+
+	tx_data = cpu_to_be16(cmd);
+	transfer->len = sizeof(tx_data);
+	transfer->tx_buf = &tx_data;
+	transfer->rx_buf = NULL;
+
+	ret = spi_sync(qca->spi_dev, msg);
+
+	if (!ret)
+		ret = msg->status;
+
+	if (ret)
+		qcaspi_spi_error(qca);
+
+	return ret;
+}
+
+static int
 qcaspi_tx_frame(struct qcaspi *qca, struct sk_buff *skb)
 {
 	u32 count;
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1652478 — [PATCH v8 net-next 15/17] dt-bindings: slave-device: add current-speed property

FromStefan Wahren <stefan.wahren@i2se.com>
Date2017-05-29 14:10 +0200
Subject[PATCH v8 net-next 15/17] dt-bindings: slave-device: add current-speed property
Message-ID<tMrEK-865-45@gated-at.bofh.it>
In reply to#1652476
This adds a new DT property to define the current baud rate of the
slave device.

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/serial/slave-device.txt | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/slave-device.txt b/Documentation/devicetree/bindings/serial/slave-device.txt
index f660379..40110e0 100644
--- a/Documentation/devicetree/bindings/serial/slave-device.txt
+++ b/Documentation/devicetree/bindings/serial/slave-device.txt
@@ -21,6 +21,15 @@ Optional Properties:
 		  can support. For example, a particular board has some signal
 		  quality issue or the host processor can't support higher
 		  baud rates.
+- current-speed	: The current baud rate the device operates at. This should
+		  only be present in case a driver has no chance to know
+		  the baud rate of the slave device.
+		  Examples:
+		    * device supports auto-baud
+		    * the rate is setup by a bootloader and there is no
+		      way to reset the device
+		    * device baud rate is configured by its firmware but
+		      there is no way to request the actual settings
 
 Example:
 
-- 
2.1.4

[toc] | [prev] | [next] | [standalone]


#1653451 — Re: [PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver

FromDavid Miller <davem@davemloft.net>
Date2017-05-30 20:10 +0200
SubjectRe: [PATCH v8 net-next 00/17] net: qualcomm: add QCA7000 UART driver
Message-ID<tMTKG-2ga-15@gated-at.bofh.it>
In reply to#1652476
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Mon, 29 May 2017 13:57:08 +0200

> The Qualcomm QCA7000 HomePlug GreenPHY supports two interfaces:
> UART and SPI. This patch series adds the missing support for UART.
> 
> This driver based on the Qualcomm code [1], but contains some changes:
> * use random MAC address per default
> * use net_device_stats from device
> * share frame decoding between SPI and UART driver
> * improve error handling
> * reimplement tty_wakeup with work queue (based on slcan)
> * use new serial device bus instead of ldisc
> 
> The patches 1 - 3 are just for clean up and are not related to
> the UART support. Patch 4 adds SET_NETDEV_DEV() to qca_spi.
> Patches 5 - 16 prepare the existing QCA7000 code for UART support.
> The last patch contains the new driver.
> 
> The code itself has been tested on a Freescale i.MX28 board and
> a Raspberry Pi Zero.

Series applied, thank you.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web