Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1648025 > unrolled thread
| Started by | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| First post | 2017-05-23 15:20 +0200 |
| Last post | 2017-05-24 22:50 +0200 |
| Articles | 16 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v6 net-next 00/17] net: qualcomm: add QCA7000 UART driver Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 07/17] net: qca_spi: remove QCASPI_MTU Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 09/17] net: qca_spi: Clarify MODULE_DESCRIPTION Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 03/17] net: qca_7k: Use BIT macro Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 14/17] dt-bindings: qca7000: rename binding Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 10/17] net: qualcomm: rename qca_framing.c to qca_7k_common.c Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 04/17] net: qca_spi: Use SET_NETDEV_DEV() Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 12/17] net: qualcomm: make qca_7k_common a separate kernel module Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 06/17] net: qualcomm: Improve readability of length defines Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 05/17] net: qualcomm: use net_device_ops instead of direct call Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 15/17] dt-bindings: slave-device: add current-speed property Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 02/17] net: qca_framing: use u16 for frame offset Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
[PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-23 15:20 +0200
Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes David Miller <davem@davemloft.net> - 2017-05-24 21:50 +0200
Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes Stefan Wahren <stefan.wahren@i2se.com> - 2017-05-24 22:10 +0200
Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes David Miller <davem@davemloft.net> - 2017-05-24 22:50 +0200
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 00/17] net: qualcomm: add QCA7000 UART driver |
| Message-ID | <tKhTb-3GR-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 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: remove unnecessary 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 | 28 --
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, 630 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]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 07/17] net: qca_spi: remove QCASPI_MTU |
| Message-ID | <tKhTc-3GR-19@gated-at.bofh.it> |
| In reply to | #1648025 |
There is no need for an additional MTU define.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index f155548..7464628 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -69,7 +69,6 @@ static int qcaspi_pluggable = QCASPI_PLUGGABLE_MIN;
module_param(qcaspi_pluggable, int, 0);
MODULE_PARM_DESC(qcaspi_pluggable, "Pluggable SPI connection (yes/no).");
-#define QCASPI_MTU QCAFRM_MAX_MTU
#define QCASPI_TX_TIMEOUT (1 * HZ)
#define QCASPI_QCA7K_REBOOT_TIME_MS 1000
@@ -746,7 +745,7 @@ qcaspi_netdev_init(struct net_device *dev)
{
struct qcaspi *qca = netdev_priv(dev);
- dev->mtu = QCASPI_MTU;
+ dev->mtu = QCAFRM_MAX_MTU;
dev->type = ARPHRD_ETHER;
qca->clkspeed = qcaspi_clkspeed;
qca->burst_len = qcaspi_burst_len;
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 09/17] net: qca_spi: Clarify MODULE_DESCRIPTION |
| Message-ID | <tKhTc-3GR-21@gated-at.bofh.it> |
| In reply to | #1648025 |
Since this driver is specific to the QCA7000, we should make the module
description more precisely.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 50adc4f..ee90af3 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -999,7 +999,7 @@ static struct spi_driver qca_spi_driver = {
};
module_spi_driver(qca_spi_driver);
-MODULE_DESCRIPTION("Qualcomm Atheros SPI Driver");
+MODULE_DESCRIPTION("Qualcomm Atheros QCA7000 SPI Driver");
MODULE_AUTHOR("Qualcomm Atheros Communications");
MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
MODULE_LICENSE("Dual BSD/GPL");
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 03/17] net: qca_7k: Use BIT macro |
| Message-ID | <tKhTc-3GR-23@gated-at.bofh.it> |
| In reply to | #1648025 |
Use the BIT macro for the CONFIG and INT register values. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> --- drivers/net/ethernet/qualcomm/qca_7k.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/qca_7k.h b/drivers/net/ethernet/qualcomm/qca_7k.h index 1cad851..4047f0a 100644 --- a/drivers/net/ethernet/qualcomm/qca_7k.h +++ b/drivers/net/ethernet/qualcomm/qca_7k.h @@ -54,15 +54,15 @@ #define SPI_REG_ACTION_CTRL 0x1B00 /* SPI_CONFIG register definition; */ -#define QCASPI_SLAVE_RESET_BIT (1 << 6) +#define QCASPI_SLAVE_RESET_BIT BIT(6) /* INTR_CAUSE/ENABLE register definition. */ -#define SPI_INT_WRBUF_BELOW_WM (1 << 10) -#define SPI_INT_CPU_ON (1 << 6) -#define SPI_INT_ADDR_ERR (1 << 3) -#define SPI_INT_WRBUF_ERR (1 << 2) -#define SPI_INT_RDBUF_ERR (1 << 1) -#define SPI_INT_PKT_AVLBL (1 << 0) +#define SPI_INT_WRBUF_BELOW_WM BIT(10) +#define SPI_INT_CPU_ON BIT(6) +#define SPI_INT_ADDR_ERR BIT(3) +#define SPI_INT_WRBUF_ERR BIT(2) +#define SPI_INT_RDBUF_ERR BIT(1) +#define SPI_INT_PKT_AVLBL BIT(0) void qcaspi_spi_error(struct qcaspi *qca); int qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result); -- 2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 14/17] dt-bindings: qca7000: rename binding |
| Message-ID | <tKhTc-3GR-31@gated-at.bofh.it> |
| In reply to | #1648025 |
Before we can merge the QCA7000 UART binding the document needs to be
renamed.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
.../devicetree/bindings/net/{qca-qca7000-spi.txt => qca,qca7000.txt} | 0
1 file changed, 0 insertions(+), 0 deletions(-)
rename Documentation/devicetree/bindings/net/{qca-qca7000-spi.txt => qca,qca7000.txt} (100%)
diff --git a/Documentation/devicetree/bindings/net/qca-qca7000-spi.txt b/Documentation/devicetree/bindings/net/qca,qca7000.txt
similarity index 100%
rename from Documentation/devicetree/bindings/net/qca-qca7000-spi.txt
rename to Documentation/devicetree/bindings/net/qca,qca7000.txt
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 10/17] net: qualcomm: rename qca_framing.c to qca_7k_common.c |
| Message-ID | <tKhTd-3GR-39@gated-at.bofh.it> |
| In reply to | #1648025 |
As preparation for the upcoming UART driver we need a module
which contains common functions for both interfaces. The module
qca_framing is a good candidate but renaming to qca_7k_common would
make it clear.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/Makefile | 2 +-
drivers/net/ethernet/qualcomm/{qca_framing.c => qca_7k_common.c} | 2 +-
drivers/net/ethernet/qualcomm/{qca_framing.h => qca_7k_common.h} | 0
drivers/net/ethernet/qualcomm/qca_spi.c | 2 +-
drivers/net/ethernet/qualcomm/qca_spi.h | 2 +-
5 files changed, 4 insertions(+), 4 deletions(-)
rename drivers/net/ethernet/qualcomm/{qca_framing.c => qca_7k_common.c} (99%)
rename drivers/net/ethernet/qualcomm/{qca_framing.h => qca_7k_common.h} (100%)
diff --git a/drivers/net/ethernet/qualcomm/Makefile b/drivers/net/ethernet/qualcomm/Makefile
index aacb0a5..5e17bf1 100644
--- a/drivers/net/ethernet/qualcomm/Makefile
+++ b/drivers/net/ethernet/qualcomm/Makefile
@@ -3,6 +3,6 @@
#
obj-$(CONFIG_QCA7000) += qcaspi.o
-qcaspi-objs := qca_spi.o qca_framing.o qca_7k.o qca_debug.o
+qcaspi-objs := qca_spi.o qca_7k_common.o qca_7k.o qca_debug.o
obj-y += emac/
diff --git a/drivers/net/ethernet/qualcomm/qca_framing.c b/drivers/net/ethernet/qualcomm/qca_7k_common.c
similarity index 99%
rename from drivers/net/ethernet/qualcomm/qca_framing.c
rename to drivers/net/ethernet/qualcomm/qca_7k_common.c
index 2341f2b..6d17fbd 100644
--- a/drivers/net/ethernet/qualcomm/qca_framing.c
+++ b/drivers/net/ethernet/qualcomm/qca_7k_common.c
@@ -23,7 +23,7 @@
#include <linux/kernel.h>
-#include "qca_framing.h"
+#include "qca_7k_common.h"
u16
qcafrm_create_header(u8 *buf, u16 length)
diff --git a/drivers/net/ethernet/qualcomm/qca_framing.h b/drivers/net/ethernet/qualcomm/qca_7k_common.h
similarity index 100%
rename from drivers/net/ethernet/qualcomm/qca_framing.h
rename to drivers/net/ethernet/qualcomm/qca_7k_common.h
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index ee90af3..43cc7de 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -43,8 +43,8 @@
#include <linux/types.h>
#include "qca_7k.h"
+#include "qca_7k_common.h"
#include "qca_debug.h"
-#include "qca_framing.h"
#include "qca_spi.h"
#define MAX_DMA_BURST_LEN 5000
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h
index 064853d..fc4beb1 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.h
+++ b/drivers/net/ethernet/qualcomm/qca_spi.h
@@ -32,7 +32,7 @@
#include <linux/spi/spi.h>
#include <linux/types.h>
-#include "qca_framing.h"
+#include "qca_7k_common.h"
#define QCASPI_DRV_VERSION "0.2.7-i"
#define QCASPI_DRV_NAME "qcaspi"
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 04/17] net: qca_spi: Use SET_NETDEV_DEV() |
| Message-ID | <tKhTc-3GR-37@gated-at.bofh.it> |
| In reply to | #1648025 |
Use SET_NETDEV_DEV() in qca_spi to create the "/sys/class/net/<if>/device"
symlink.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_spi.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 24ca7df..0c3fdee 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -894,6 +894,7 @@ qca_spi_probe(struct spi_device *spi)
return -ENOMEM;
qcaspi_netdev_setup(qcaspi_devs);
+ SET_NETDEV_DEV(qcaspi_devs, &spi->dev);
qca = netdev_priv(qcaspi_devs);
if (!qca) {
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 12/17] net: qualcomm: make qca_7k_common a separate kernel module |
| Message-ID | <tKhTd-3GR-41@gated-at.bofh.it> |
| In reply to | #1648025 |
In order to share common functions between QCA7000 SPI and UART protocol
driver the qca_7k_common needs to be a separate kernel module.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/Kconfig | 8 +++++++-
drivers/net/ethernet/qualcomm/Makefile | 5 +++--
drivers/net/ethernet/qualcomm/qca_7k_common.c | 10 ++++++++++
3 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig
index d7720bf..b4c369d 100644
--- a/drivers/net/ethernet/qualcomm/Kconfig
+++ b/drivers/net/ethernet/qualcomm/Kconfig
@@ -16,7 +16,13 @@ config NET_VENDOR_QUALCOMM
if NET_VENDOR_QUALCOMM
config QCA7000
- tristate "Qualcomm Atheros QCA7000 support"
+ tristate
+ help
+ This enables support for the Qualcomm Atheros QCA7000.
+
+config QCA7000_SPI
+ tristate "Qualcomm Atheros QCA7000 SPI support"
+ select QCA7000
depends on SPI_MASTER && OF
---help---
This SPI protocol driver supports the Qualcomm Atheros QCA7000.
diff --git a/drivers/net/ethernet/qualcomm/Makefile b/drivers/net/ethernet/qualcomm/Makefile
index 5e17bf1..65556ca 100644
--- a/drivers/net/ethernet/qualcomm/Makefile
+++ b/drivers/net/ethernet/qualcomm/Makefile
@@ -2,7 +2,8 @@
# Makefile for the Qualcomm network device drivers.
#
-obj-$(CONFIG_QCA7000) += qcaspi.o
-qcaspi-objs := qca_spi.o qca_7k_common.o qca_7k.o qca_debug.o
+obj-$(CONFIG_QCA7000) += qca_7k_common.o
+obj-$(CONFIG_QCA7000_SPI) += qcaspi.o
+qcaspi-objs := qca_7k.o qca_debug.o qca_spi.o
obj-y += emac/
diff --git a/drivers/net/ethernet/qualcomm/qca_7k_common.c b/drivers/net/ethernet/qualcomm/qca_7k_common.c
index 0d3daa9..6b511f0 100644
--- a/drivers/net/ethernet/qualcomm/qca_7k_common.c
+++ b/drivers/net/ethernet/qualcomm/qca_7k_common.c
@@ -21,7 +21,9 @@
* by an atheros frame while transmitted over a serial channel;
*/
+#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/module.h>
#include "qca_7k_common.h"
@@ -46,6 +48,7 @@ qcafrm_create_header(u8 *buf, u16 length)
return QCAFRM_HEADER_LEN;
}
+EXPORT_SYMBOL_GPL(qcafrm_create_header);
u16
qcafrm_create_footer(u8 *buf)
@@ -57,6 +60,7 @@ qcafrm_create_footer(u8 *buf)
buf[1] = 0x55;
return QCAFRM_FOOTER_LEN;
}
+EXPORT_SYMBOL_GPL(qcafrm_create_footer);
/* Gather received bytes and try to extract a full ethernet frame by
* following a simple state machine.
@@ -154,3 +158,9 @@ qcafrm_fsm_decode(struct qcafrm_handle *handle, u8 *buf, u16 buf_len, u8 recv_by
return ret;
}
+EXPORT_SYMBOL_GPL(qcafrm_fsm_decode);
+
+MODULE_DESCRIPTION("Qualcomm Atheros QCA7000 common");
+MODULE_AUTHOR("Qualcomm Atheros Communications");
+MODULE_AUTHOR("Stefan Wahren <stefan.wahren@i2se.com>");
+MODULE_LICENSE("Dual BSD/GPL");
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 06/17] net: qualcomm: Improve readability of length defines |
| Message-ID | <tKhTd-3GR-43@gated-at.bofh.it> |
| In reply to | #1648025 |
In order to avoid mixing things up, make the MTU and frame length
defines easier to read.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_framing.c | 2 +-
drivers/net/ethernet/qualcomm/qca_framing.h | 8 ++++----
drivers/net/ethernet/qualcomm/qca_spi.c | 12 ++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_framing.c b/drivers/net/ethernet/qualcomm/qca_framing.c
index faa924c..2341f2b 100644
--- a/drivers/net/ethernet/qualcomm/qca_framing.c
+++ b/drivers/net/ethernet/qualcomm/qca_framing.c
@@ -117,7 +117,7 @@ qcafrm_fsm_decode(struct qcafrm_handle *handle, u8 *buf, u16 buf_len, u8 recv_by
break;
case QCAFRM_WAIT_RSVD_BYTE2:
len = handle->offset;
- if (len > buf_len || len < QCAFRM_ETHMINLEN) {
+ if (len > buf_len || len < QCAFRM_MIN_LEN) {
ret = QCAFRM_INVLEN;
handle->state = QCAFRM_HW_LEN0;
} else {
diff --git a/drivers/net/ethernet/qualcomm/qca_framing.h b/drivers/net/ethernet/qualcomm/qca_framing.h
index 8b385e6..5df7c65 100644
--- a/drivers/net/ethernet/qualcomm/qca_framing.h
+++ b/drivers/net/ethernet/qualcomm/qca_framing.h
@@ -44,12 +44,12 @@
#define QCAFRM_INVFRAME (QCAFRM_ERR_BASE - 4)
/* Min/Max Ethernet MTU: 46/1500 */
-#define QCAFRM_ETHMINMTU (ETH_ZLEN - ETH_HLEN)
-#define QCAFRM_ETHMAXMTU ETH_DATA_LEN
+#define QCAFRM_MIN_MTU (ETH_ZLEN - ETH_HLEN)
+#define QCAFRM_MAX_MTU ETH_DATA_LEN
/* Min/Max frame lengths */
-#define QCAFRM_ETHMINLEN (QCAFRM_ETHMINMTU + ETH_HLEN)
-#define QCAFRM_ETHMAXLEN (QCAFRM_ETHMAXMTU + VLAN_ETH_HLEN)
+#define QCAFRM_MIN_LEN (QCAFRM_MIN_MTU + ETH_HLEN)
+#define QCAFRM_MAX_LEN (QCAFRM_MAX_MTU + VLAN_ETH_HLEN)
/* QCA7K header len */
#define QCAFRM_HEADER_LEN 8
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 7e039e3..f155548 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -69,7 +69,7 @@ static int qcaspi_pluggable = QCASPI_PLUGGABLE_MIN;
module_param(qcaspi_pluggable, int, 0);
MODULE_PARM_DESC(qcaspi_pluggable, "Pluggable SPI connection (yes/no).");
-#define QCASPI_MTU QCAFRM_ETHMAXMTU
+#define QCASPI_MTU QCAFRM_MAX_MTU
#define QCASPI_TX_TIMEOUT (1 * HZ)
#define QCASPI_QCA7K_REBOOT_TIME_MS 1000
@@ -403,7 +403,7 @@ qcaspi_tx_ring_has_space(struct tx_ring *txr)
if (txr->skb[txr->tail])
return 0;
- return (txr->size + QCAFRM_ETHMAXLEN < QCASPI_HW_BUF_LEN) ? 1 : 0;
+ return (txr->size + QCAFRM_MAX_LEN < QCASPI_HW_BUF_LEN) ? 1 : 0;
}
/* Flush the tx ring. This function is only safe to
@@ -667,8 +667,8 @@ qcaspi_netdev_xmit(struct sk_buff *skb, struct net_device *dev)
struct sk_buff *tskb;
u8 pad_len = 0;
- if (skb->len < QCAFRM_ETHMINLEN)
- pad_len = QCAFRM_ETHMINLEN - skb->len;
+ if (skb->len < QCAFRM_MIN_LEN)
+ pad_len = QCAFRM_MIN_LEN - skb->len;
if (qca->txr.skb[qca->txr.tail]) {
netdev_warn(qca->net_dev, "queue was unexpectedly full!\n");
@@ -805,8 +805,8 @@ qcaspi_netdev_setup(struct net_device *dev)
dev->tx_queue_len = 100;
/* MTU range: 46 - 1500 */
- dev->min_mtu = QCAFRM_ETHMINMTU;
- dev->max_mtu = QCAFRM_ETHMAXMTU;
+ dev->min_mtu = QCAFRM_MIN_MTU;
+ dev->max_mtu = QCAFRM_MAX_MTU;
qca = netdev_priv(dev);
memset(qca, 0, sizeof(struct qcaspi));
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 05/17] net: qualcomm: use net_device_ops instead of direct call |
| Message-ID | <tKhTd-3GR-49@gated-at.bofh.it> |
| In reply to | #1648025 |
There is no need to export qcaspi_netdev_open and qcaspi_netdev_close
because they are also accessible via the net_device_ops.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_debug.c | 5 +++--
drivers/net/ethernet/qualcomm/qca_spi.c | 4 ++--
drivers/net/ethernet/qualcomm/qca_spi.h | 3 ---
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_debug.c b/drivers/net/ethernet/qualcomm/qca_debug.c
index d145df9..92b6be9 100644
--- a/drivers/net/ethernet/qualcomm/qca_debug.c
+++ b/drivers/net/ethernet/qualcomm/qca_debug.c
@@ -275,6 +275,7 @@ qcaspi_get_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
static int
qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
{
+ const struct net_device_ops *ops = dev->netdev_ops;
struct qcaspi *qca = netdev_priv(dev);
if ((ring->rx_pending) ||
@@ -283,13 +284,13 @@ qcaspi_set_ringparam(struct net_device *dev, struct ethtool_ringparam *ring)
return -EINVAL;
if (netif_running(dev))
- qcaspi_netdev_close(dev);
+ ops->ndo_stop(dev);
qca->txr.count = max_t(u32, ring->tx_pending, TX_RING_MIN_LEN);
qca->txr.count = min_t(u16, qca->txr.count, TX_RING_MAX_LEN);
if (netif_running(dev))
- qcaspi_netdev_open(dev);
+ ops->ndo_open(dev);
return 0;
}
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 0c3fdee..7e039e3 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -603,7 +603,7 @@ qcaspi_intr_handler(int irq, void *data)
return IRQ_HANDLED;
}
-int
+static int
qcaspi_netdev_open(struct net_device *dev)
{
struct qcaspi *qca = netdev_priv(dev);
@@ -640,7 +640,7 @@ qcaspi_netdev_open(struct net_device *dev)
return 0;
}
-int
+static int
qcaspi_netdev_close(struct net_device *dev)
{
struct qcaspi *qca = netdev_priv(dev);
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.h b/drivers/net/ethernet/qualcomm/qca_spi.h
index 6e31a0e..064853d 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.h
+++ b/drivers/net/ethernet/qualcomm/qca_spi.h
@@ -108,7 +108,4 @@ struct qcaspi {
u16 burst_len;
};
-int qcaspi_netdev_open(struct net_device *dev);
-int qcaspi_netdev_close(struct net_device *dev);
-
#endif /* _QCA_SPI_H */
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 15/17] dt-bindings: slave-device: add current-speed property |
| Message-ID | <tKhTd-3GR-53@gated-at.bofh.it> |
| In reply to | #1648025 |
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]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 02/17] net: qca_framing: use u16 for frame offset |
| Message-ID | <tKhTd-3GR-51@gated-at.bofh.it> |
| In reply to | #1648025 |
It doesn't make sense to use a signed variable for offset here, so
fix it up.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
drivers/net/ethernet/qualcomm/qca_framing.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/qualcomm/qca_framing.h b/drivers/net/ethernet/qualcomm/qca_framing.h
index d5e795d..8b385e6 100644
--- a/drivers/net/ethernet/qualcomm/qca_framing.h
+++ b/drivers/net/ethernet/qualcomm/qca_framing.h
@@ -103,7 +103,7 @@ struct qcafrm_handle {
enum qcafrm_state state;
/* Offset in buffer (borrowed for length too) */
- s16 offset;
+ u16 offset;
/* Frame length as kept by this module */
u16 len;
--
2.1.4
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-23 15:20 +0200 |
| Subject | [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes |
| Message-ID | <tKhTd-3GR-55@gated-at.bofh.it> |
| In reply to | #1648025 |
Most of the includes in qca_7k.c are unnecessary so we better remove them. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> --- drivers/net/ethernet/qualcomm/qca_7k.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c index f0066fb..557d53c 100644 --- a/drivers/net/ethernet/qualcomm/qca_7k.c +++ b/drivers/net/ethernet/qualcomm/qca_7k.c @@ -23,11 +23,7 @@ * kernel-based SPI device. */ -#include <linux/init.h> -#include <linux/module.h> -#include <linux/moduleparam.h> #include <linux/spi/spi.h> -#include <linux/version.h> #include "qca_7k.h" -- 2.1.4
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-05-24 21:50 +0200 |
| Subject | Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes |
| Message-ID | <tKKsa-6vf-9@gated-at.bofh.it> |
| In reply to | #1648041 |
From: Stefan Wahren <stefan.wahren@i2se.com> Date: Tue, 23 May 2017 15:12:37 +0200 > Most of the includes in qca_7k.c are unnecessary so we better remove them. > > Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> > --- > drivers/net/ethernet/qualcomm/qca_7k.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c > index f0066fb..557d53c 100644 > --- a/drivers/net/ethernet/qualcomm/qca_7k.c > +++ b/drivers/net/ethernet/qualcomm/qca_7k.c > @@ -23,11 +23,7 @@ > * kernel-based SPI device. > */ > > -#include <linux/init.h> > -#include <linux/module.h> > -#include <linux/moduleparam.h> > #include <linux/spi/spi.h> > -#include <linux/version.h> > > #include "qca_7k.h" > > -- > 2.1.4 > Changes like this drive me crazy. The only reason you can remove those headers is because you are obtaining things indirectly via qca_7k.h And if that is indeed the case, you are also getting qca_spi.h which in turn includes linux/spi/spi.h So you could have removed that as well. But seriously, it is so much harder to understand a driver and what interfaces it needs via header files when you hide _all_ of it behind these local private header files which just include _everything_ and then _every_ foo.c file in your driver gets _all_ of those kernel headers whether they need it or not. So if just one foo.c file needs 20 extra kernel headers than the rest of the files in the driver, every foo.c file eats that cost of including them. I really don't like when drivers move in this direction for that reason. And at best, as described at the beginning of my response, this change is incomplete.
[toc] | [prev] | [next] | [standalone]
| From | Stefan Wahren <stefan.wahren@i2se.com> |
|---|---|
| Date | 2017-05-24 22:10 +0200 |
| Subject | Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes |
| Message-ID | <tKKLw-6SV-11@gated-at.bofh.it> |
| In reply to | #1649896 |
> David Miller <davem@davemloft.net> hat am 24. Mai 2017 um 21:41 geschrieben: > > > From: Stefan Wahren <stefan.wahren@i2se.com> > Date: Tue, 23 May 2017 15:12:37 +0200 > > > Most of the includes in qca_7k.c are unnecessary so we better remove them. > > > > Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> > > --- > > drivers/net/ethernet/qualcomm/qca_7k.c | 4 ---- > > 1 file changed, 4 deletions(-) > > > > diff --git a/drivers/net/ethernet/qualcomm/qca_7k.c b/drivers/net/ethernet/qualcomm/qca_7k.c > > index f0066fb..557d53c 100644 > > --- a/drivers/net/ethernet/qualcomm/qca_7k.c > > +++ b/drivers/net/ethernet/qualcomm/qca_7k.c > > @@ -23,11 +23,7 @@ > > * kernel-based SPI device. > > */ > > > > -#include <linux/init.h> > > -#include <linux/module.h> > > -#include <linux/moduleparam.h> > > #include <linux/spi/spi.h> > > -#include <linux/version.h> > > > > #include "qca_7k.h" > > > > -- > > 2.1.4 > > > > Changes like this drive me crazy. > > The only reason you can remove those headers is because you are obtaining > things indirectly via qca_7k.h > > And if that is indeed the case, you are also getting qca_spi.h which > in turn includes linux/spi/spi.h > > So you could have removed that as well. > > But seriously, it is so much harder to understand a driver and what > interfaces it needs via header files when you hide _all_ of it behind > these local private header files which just include _everything_ > and then _every_ foo.c file in your driver gets _all_ of those kernel > headers whether they need it or not. > > So if just one foo.c file needs 20 extra kernel headers than the rest > of the files in the driver, every foo.c file eats that cost of > including them. > > I really don't like when drivers move in this direction for that > reason. And at best, as described at the beginning of my response, > this change is incomplete. > The intension of this change wasn't to hide the includes into qca_7k.h AFAIK these ones above aren't necessary (no init, no kernel module, no kernel parameter, no kernel version) for this C file. So i will double check it.
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-05-24 22:50 +0200 |
| Subject | Re: [PATCH v6 net-next 01/17] net: qualcomm: remove unnecessary includes |
| Message-ID | <tKLod-76t-13@gated-at.bofh.it> |
| In reply to | #1649906 |
From: Stefan Wahren <stefan.wahren@i2se.com> Date: Wed, 24 May 2017 22:05:26 +0200 (CEST) > AFAIK these ones above aren't necessary (no init, no kernel module, > no kernel parameter, no kernel version) for this C file. So i will > double check it. You need the endianness translators like cpu_to_be32() or whatever, so you need to figure out where you are getting that once these explicit headers are removed. And see, it's probably hidden inside of the private header's includes. So we can't tell.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web