Re: [PATCH net-next 8/8] net: qualcomm: add QCA7000 UART driver
Hi Marcel, Am 20.09.2016 um 17:32 schrieb Marcel Holtmann: > Hi Stefan, > >> This patch adds the Ethernet over UART driver for the >> Qualcomm QCA7000 HomePlug GreenPHY. >> >> Signed-off-by: Stefan Wahren >> --- >> drivers/net/ethernet/qualcomm/Kconfig | 12 + >> drivers/net/ethernet/qualcomm/Makefile | 2 + >> drivers/net/ethernet/qualcomm/qca_common.h | 6 + >> drivers/net/ethernet/qualcomm/qca_uart.c | 447 >> + >> include/uapi/linux/tty.h | 1 + >> 5 files changed, 468 insertions(+) >> create mode 100644 drivers/net/ethernet/qualcomm/qca_uart.c >> >> diff --git a/drivers/net/ethernet/qualcomm/Kconfig >> b/drivers/net/ethernet/qualcomm/Kconfig >> index 0d33728..0ede46e 100644 >> --- a/drivers/net/ethernet/qualcomm/Kconfig >> +++ b/drivers/net/ethernet/qualcomm/Kconfig >> @@ -30,6 +30,18 @@ config QCA7000_SPI >>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 TTY >> +---help--- >> + This UART protocol driver supports the Qualcomm Atheros QCA7000. >> + The driver implements the tty line discipline N_QCA7K and supports >> + only one netdevice. >> + >> + To compile this driver as a module, choose M here. The module >> + will be called qcauart. >> + > this seems to be another candidate for having a proper UART or serial bus. > Instead of adding one line discipline after another, I think we need to get > quickly to having an enumerable bus here. i noticed Rob's thread about the UART slave device bus and i like the idea. Stefan > > Regards > > Marcel >
Re: [PATCH net-next 8/8] net: qualcomm: add QCA7000 UART driver
> kbuild test robot hat am 20. September 2016 um 16:44 > geschrieben: > > > Hi Stefan, > > [auto build test ERROR on net-next/master] > > url: > > https://github.com/0day-ci/linux/commits/Stefan-Wahren/net-qualcomm-add-QCA7000-UART-driver/20160920-210908 > config: i386-allmodconfig (attached as .config) > compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 > reproduce: > # save the attached .config to linux build tree > make ARCH=i386 > > All errors (new ones prefixed by >>): > >drivers/net/ethernet/qualcomm/qca_uart.c: In function > 'qcauart_netdev_xmit': > >> drivers/net/ethernet/qualcomm/qca_uart.c:302:5: error: 'struct net_device' > >> has no member named 'trans_start'; did you mean 'mem_start'? > dev->trans_start = jiffies; This should be replaced by netif_trans_update(dev) > ^~ >drivers/net/ethernet/qualcomm/qca_uart.c: In function > 'qcauart_netdev_tx_timeout': >drivers/net/ethernet/qualcomm/qca_uart.c:314:29: error: 'struct net_device' > has no member named 'trans_start'; did you mean 'mem_start'? > jiffies, jiffies - dev->trans_start); and this by dev_trans_start(dev) in the next version. Sorry about that :-(
Re: [PATCH net-next 8/8] net: qualcomm: add QCA7000 UART driver
Hi Stefan, > This patch adds the Ethernet over UART driver for the > Qualcomm QCA7000 HomePlug GreenPHY. > > Signed-off-by: Stefan Wahren > --- > drivers/net/ethernet/qualcomm/Kconfig | 12 + > drivers/net/ethernet/qualcomm/Makefile | 2 + > drivers/net/ethernet/qualcomm/qca_common.h | 6 + > drivers/net/ethernet/qualcomm/qca_uart.c | 447 + > include/uapi/linux/tty.h | 1 + > 5 files changed, 468 insertions(+) > create mode 100644 drivers/net/ethernet/qualcomm/qca_uart.c > > diff --git a/drivers/net/ethernet/qualcomm/Kconfig > b/drivers/net/ethernet/qualcomm/Kconfig > index 0d33728..0ede46e 100644 > --- a/drivers/net/ethernet/qualcomm/Kconfig > +++ b/drivers/net/ethernet/qualcomm/Kconfig > @@ -30,6 +30,18 @@ config QCA7000_SPI > 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 TTY > + ---help--- > + This UART protocol driver supports the Qualcomm Atheros QCA7000. > + The driver implements the tty line discipline N_QCA7K and supports > + only one netdevice. > + > + To compile this driver as a module, choose M here. The module > + will be called qcauart. > + this seems to be another candidate for having a proper UART or serial bus. Instead of adding one line discipline after another, I think we need to get quickly to having an enumerable bus here. Regards Marcel
Re: [PATCH net-next 8/8] net: qualcomm: add QCA7000 UART driver
Hi Stefan, [auto build test ERROR on net-next/master] url: https://github.com/0day-ci/linux/commits/Stefan-Wahren/net-qualcomm-add-QCA7000-UART-driver/20160920-210908 config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All errors (new ones prefixed by >>): drivers/net/ethernet/qualcomm/qca_uart.c: In function 'qcauart_netdev_xmit': >> drivers/net/ethernet/qualcomm/qca_uart.c:302:5: error: 'struct net_device' >> has no member named 'trans_start'; did you mean 'mem_start'? dev->trans_start = jiffies; ^~ drivers/net/ethernet/qualcomm/qca_uart.c: In function 'qcauart_netdev_tx_timeout': drivers/net/ethernet/qualcomm/qca_uart.c:314:29: error: 'struct net_device' has no member named 'trans_start'; did you mean 'mem_start'? jiffies, jiffies - dev->trans_start); ^~ vim +302 drivers/net/ethernet/qualcomm/qca_uart.c 296 written = qca->tty->ops->write(qca->tty, qca->xbuff, pos - qca->xbuff); 297 qca->xleft = (pos - qca->xbuff) - written; 298 qca->xhead = qca->xbuff + written; 299 n_stats->tx_bytes += written; 300 spin_unlock(&qca->lock); 301 > 302 dev->trans_start = jiffies; 303 out: 304 kfree_skb(skb); 305 return NETDEV_TX_OK; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip
[PATCH net-next 8/8] net: qualcomm: add QCA7000 UART driver
This patch adds the Ethernet over UART driver for the Qualcomm QCA7000 HomePlug GreenPHY. Signed-off-by: Stefan Wahren --- drivers/net/ethernet/qualcomm/Kconfig | 12 + drivers/net/ethernet/qualcomm/Makefile | 2 + drivers/net/ethernet/qualcomm/qca_common.h | 6 + drivers/net/ethernet/qualcomm/qca_uart.c | 447 + include/uapi/linux/tty.h | 1 + 5 files changed, 468 insertions(+) create mode 100644 drivers/net/ethernet/qualcomm/qca_uart.c diff --git a/drivers/net/ethernet/qualcomm/Kconfig b/drivers/net/ethernet/qualcomm/Kconfig index 0d33728..0ede46e 100644 --- a/drivers/net/ethernet/qualcomm/Kconfig +++ b/drivers/net/ethernet/qualcomm/Kconfig @@ -30,6 +30,18 @@ config QCA7000_SPI 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 TTY + ---help--- + This UART protocol driver supports the Qualcomm Atheros QCA7000. + The driver implements the tty line discipline N_QCA7K and supports + only one netdevice. + + 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" select CRC32 diff --git a/drivers/net/ethernet/qualcomm/Makefile b/drivers/net/ethernet/qualcomm/Makefile index 00d8729..8847db7 100644 --- a/drivers/net/ethernet/qualcomm/Makefile +++ b/drivers/net/ethernet/qualcomm/Makefile @@ -5,5 +5,7 @@ obj-$(CONFIG_QCA7000) += qca_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/ diff --git a/drivers/net/ethernet/qualcomm/qca_common.h b/drivers/net/ethernet/qualcomm/qca_common.h index c93cfdf07..bc38689 100644 --- a/drivers/net/ethernet/qualcomm/qca_common.h +++ b/drivers/net/ethernet/qualcomm/qca_common.h @@ -123,6 +123,12 @@ static inline void qcafrm_fsm_init_spi(struct qcafrm_handle *handle) handle->state = handle->init; } +static inline void qcafrm_fsm_init_uart(struct qcafrm_handle *handle) +{ + handle->init = QCAFRM_WAIT_AA1; + handle->state = handle->init; +} + /* Gather received bytes and try to extract a full Ethernet frame * by following a simple state machine. * diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c new file mode 100644 index 000..f956c83 --- /dev/null +++ b/drivers/net/ethernet/qualcomm/qca_uart.c @@ -0,0 +1,447 @@ +/* + * Copyright (c) 2011, 2012, Qualcomm Atheros Communications Inc. + * Copyright (c) 2016, I2SE GmbH + * + * Permission to use, copy, modify, and/or distribute this software + * for any purpose with or without fee is hereby granted, provided + * that the above copyright notice and this permission notice appear + * in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL + * THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* This module implements the Qualcomm Atheros UART protocol for + * kernel-based UART device; it is essentially an Ethernet-to-UART + * serial converter; + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "qca_common.h" + +#define QCAUART_DRV_VERSION "0.0.6" +#define QCAUART_DRV_NAME "qcauart" +#define QCAUART_TX_TIMEOUT (1 * HZ) + +struct qcauart { + struct net_device *net_dev; + spinlock_t lock;/* transmit lock */ + struct work_struct tx_work; /* Flushes transmit buffer */ + + struct tty_struct *tty; + + unsigned char xbuff[QCAFRM_ETHMAXMTU]; /* transmitter buffer*/ + unsigned char *xhead; /* pointer to next XMIT byte */ + int xleft; /* bytes left in XMIT queue */ + + struct qcafrm_handle frm_handle; + + struct sk_buff *rx_skb; +}; + +static struct net_device *qcauart_dev; + +void +qca_tty_receive(struct tty_struct *tty, const unsigned char *cp, char *fp, + int count) +{ + struct qcauart *qca = tty->disc_data; + struct net_device_stats *n_stats = &qca->net_dev->stats; + int dropped = 0; + + if (!qca->rx_skb) { + qca->rx_skb = netdev_alloc_