Commit 9711164d authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'net-qualcomm-add-QCA7000-UART-driver'



Stefan Wahren says:

====================
net: qualcomm: add QCA7000 UART driver

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)
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents ae803902 dfc768fb
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
* Qualcomm QCA7000

The QCA7000 is a serial-to-powerline bridge with a host interface which could
be configured either as SPI or UART slave. This configuration is done by
the QCA7000 firmware.

(a) Ethernet over SPI

In order to use the QCA7000 as SPI device it must be defined as a child of a
SPI master in the device tree.

Required properties:
- compatible	    : Should be "qca,qca7000"
- reg		    : Should specify the SPI chip select
- interrupts	    : The first cell should specify the index of the source
		      interrupt and the second cell should specify the trigger
		      type as rising edge
- spi-cpha	    : Must be set
- spi-cpol	    : Must be set

Optional properties:
- interrupt-parent  : Specify the pHandle of the source interrupt
- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at.
		      Numbers smaller than 1000000 or greater than 16000000
		      are invalid. Missing the property will set the SPI
		      frequency to 8000000 Hertz.
- local-mac-address : see ./ethernet.txt
- qca,legacy-mode   : Set the SPI data transfer of the QCA7000 to legacy mode.
		      In this mode the SPI master must toggle the chip select
		      between each data word. In burst mode these gaps aren't
		      necessary, which is faster. This setting depends on how
		      the QCA7000 is setup via GPIO pin strapping. If the
		      property is missing the driver defaults to burst mode.

SPI Example:

/* Freescale i.MX28 SPI master*/
ssp2: spi@80014000 {
	#address-cells = <1>;
	#size-cells = <0>;
	compatible = "fsl,imx28-spi";
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_pins_a>;
	status = "okay";

	qca7000: ethernet@0 {
		compatible = "qca,qca7000";
		reg = <0x0>;
		interrupt-parent = <&gpio3>;      /* GPIO Bank 3 */
		interrupts = <25 0x1>;            /* Index: 25, rising edge */
		spi-cpha;                         /* SPI mode: CPHA=1 */
		spi-cpol;                         /* SPI mode: CPOL=1 */
		spi-max-frequency = <8000000>;    /* freq: 8 MHz */
		local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
	};
};

(b) Ethernet over UART

In order to use the QCA7000 as UART slave it must be defined as a child of a
UART master in the device tree. It is possible to preconfigure the UART
settings of the QCA7000 firmware, but it's not possible to change them during
runtime.

Required properties:
- compatible        : Should be "qca,qca7000"

Optional properties:
- local-mac-address : see ./ethernet.txt
- current-speed     : current baud rate of QCA7000 which defaults to 115200
		      if absent, see also ../serial/slave-device.txt

UART Example:

/* Freescale i.MX28 UART */
auart0: serial@8006a000 {
	compatible = "fsl,imx28-auart", "fsl,imx23-auart";
	reg = <0x8006a000 0x2000>;
	pinctrl-names = "default";
	pinctrl-0 = <&auart0_2pins_a>;
	status = "okay";

	qca7000: ethernet {
		compatible = "qca,qca7000";
		local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
		current-speed = <38400>;
	};
};
+0 −47
Original line number Diff line number Diff line
* Qualcomm QCA7000 (Ethernet over SPI protocol)

Note: The QCA7000 is useable as a SPI device. In this case it must be defined
as a child of a SPI master in the device tree.

Required properties:
- compatible : Should be "qca,qca7000"
- reg : Should specify the SPI chip select
- interrupts : The first cell should specify the index of the source interrupt
  and the second cell should specify the trigger type as rising edge
- spi-cpha : Must be set
- spi-cpol: Must be set

Optional properties:
- interrupt-parent : Specify the pHandle of the source interrupt
- spi-max-frequency : Maximum frequency of the SPI bus the chip can operate at.
  Numbers smaller than 1000000 or greater than 16000000 are invalid. Missing
  the property will set the SPI frequency to 8000000 Hertz.
- local-mac-address: 6 bytes, MAC address
- qca,legacy-mode : Set the SPI data transfer of the QCA7000 to legacy mode.
  In this mode the SPI master must toggle the chip select between each data
  word. In burst mode these gaps aren't necessary, which is faster.
  This setting depends on how the QCA7000 is setup via GPIO pin strapping.
  If the property is missing the driver defaults to burst mode.

Example:

/* Freescale i.MX28 SPI master*/
ssp2: spi@80014000 {
	#address-cells = <1>;
	#size-cells = <0>;
	compatible = "fsl,imx28-spi";
	pinctrl-names = "default";
	pinctrl-0 = <&spi2_pins_a>;
	status = "okay";

	qca7000: ethernet@0 {
		compatible = "qca,qca7000";
		reg = <0x0>;
		interrupt-parent = <&gpio3>;      /* GPIO Bank 3 */
		interrupts = <25 0x1>;            /* Index: 25, rising edge */
		spi-cpha;                         /* SPI mode: CPHA=1 */
		spi-cpol;                         /* SPI mode: CPOL=1 */
		spi-max-frequency = <8000000>;    /* freq: 8 MHz */
		local-mac-address = [ A0 B0 C0 D0 E0 F0 ];
	};
};
+9 −0
Original line number Diff line number Diff line
@@ -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:

+23 −1
Original line number Diff line number Diff line
@@ -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.
@@ -24,6 +30,22 @@ config QCA7000
	  To compile this driver as a module, choose M here. The module
	  will be called qcaspi.

config QCA7000_UART
	tristate "Qualcomm Atheros QCA7000 UART support"
	select QCA7000
	depends on SERIAL_DEV_BUS && OF
	---help---
	  This UART protocol driver supports the Qualcomm Atheros QCA7000.

	  Currently the driver assumes these device UART settings:
	    Data bits: 8
	    Parity: None
	    Stop bits: 1
	    Flow control: None

	  To compile this driver as a module, choose M here. The module
	  will be called qcauart.

config QCOM_EMAC
	tristate "Qualcomm Technologies, Inc. EMAC Gigabit Ethernet support"
	depends on HAS_DMA && HAS_IOMEM
+5 −2
Original line number Diff line number Diff line
@@ -2,7 +2,10 @@
# Makefile for the Qualcomm network device drivers.
#

obj-$(CONFIG_QCA7000) += qcaspi.o
qcaspi-objs := qca_spi.o qca_framing.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-$(CONFIG_QCA7000_UART) += qcauart.o
qcauart-objs := qca_uart.o

obj-y += emac/
Loading