2019-05-27 14:55:01 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2016-06-06 14:30:02 +08:00
|
|
|
/* Freescale QUICC Engine HDLC Device Driver
|
|
|
|
*
|
|
|
|
* Copyright 2016 Freescale Semiconductor Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/dma-mapping.h>
|
|
|
|
#include <linux/hdlc.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
#include <linux/of_address.h>
|
|
|
|
#include <linux/of_irq.h>
|
|
|
|
#include <linux/of_platform.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/sched.h>
|
|
|
|
#include <linux/skbuff.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <linux/stddef.h>
|
|
|
|
#include <soc/fsl/qe/qe_tdm.h>
|
|
|
|
#include <uapi/linux/if_arp.h>
|
|
|
|
|
|
|
|
#include "fsl_ucc_hdlc.h"
|
|
|
|
|
|
|
|
#define DRV_DESC "Freescale QE UCC HDLC Driver"
|
|
|
|
#define DRV_NAME "ucc_hdlc"
|
|
|
|
|
|
|
|
#define TDM_PPPOHT_SLIC_MAXIN
|
2018-10-22 20:55:50 +08:00
|
|
|
#define RX_BD_ERRORS (R_CD_S | R_OV_S | R_CR_S | R_AB_S | R_NO_S | R_LG_S)
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
static struct ucc_tdm_info utdm_primary_info = {
|
|
|
|
.uf_info = {
|
|
|
|
.tsa = 0,
|
|
|
|
.cdp = 0,
|
|
|
|
.cds = 1,
|
|
|
|
.ctsp = 1,
|
|
|
|
.ctss = 1,
|
|
|
|
.revd = 0,
|
|
|
|
.urfs = 256,
|
|
|
|
.utfs = 256,
|
|
|
|
.urfet = 128,
|
|
|
|
.urfset = 192,
|
|
|
|
.utfet = 128,
|
|
|
|
.utftt = 0x40,
|
|
|
|
.ufpt = 256,
|
|
|
|
.mode = UCC_FAST_PROTOCOL_MODE_HDLC,
|
|
|
|
.ttx_trx = UCC_FAST_GUMR_TRANSPARENT_TTX_TRX_NORMAL,
|
|
|
|
.tenc = UCC_FAST_TX_ENCODING_NRZ,
|
|
|
|
.renc = UCC_FAST_RX_ENCODING_NRZ,
|
|
|
|
.tcrc = UCC_FAST_16_BIT_CRC,
|
|
|
|
.synl = UCC_FAST_SYNC_LEN_NOT_USED,
|
|
|
|
},
|
|
|
|
|
|
|
|
.si_info = {
|
|
|
|
#ifdef TDM_PPPOHT_SLIC_MAXIN
|
|
|
|
.simr_rfsd = 1,
|
|
|
|
.simr_tfsd = 2,
|
|
|
|
#else
|
|
|
|
.simr_rfsd = 0,
|
|
|
|
.simr_tfsd = 0,
|
|
|
|
#endif
|
|
|
|
.simr_crt = 0,
|
|
|
|
.simr_sl = 0,
|
|
|
|
.simr_ce = 1,
|
|
|
|
.simr_fe = 1,
|
|
|
|
.simr_gm = 0,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2020-01-14 22:54:48 +08:00
|
|
|
static struct ucc_tdm_info utdm_info[UCC_MAX_NUM];
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
static int uhdlc_init(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
|
|
|
struct ucc_tdm_info *ut_info;
|
|
|
|
struct ucc_fast_info *uf_info;
|
|
|
|
u32 cecr_subblock;
|
|
|
|
u16 bd_status;
|
|
|
|
int ret, i;
|
|
|
|
void *bd_buffer;
|
|
|
|
dma_addr_t bd_dma_addr;
|
2019-11-28 22:55:49 +08:00
|
|
|
s32 riptr;
|
|
|
|
s32 tiptr;
|
2016-06-06 14:30:02 +08:00
|
|
|
u32 gumr;
|
|
|
|
|
|
|
|
ut_info = priv->ut_info;
|
|
|
|
uf_info = &ut_info->uf_info;
|
|
|
|
|
|
|
|
if (priv->tsa) {
|
|
|
|
uf_info->tsa = 1;
|
|
|
|
uf_info->ctsp = 1;
|
2018-09-03 20:47:29 +08:00
|
|
|
uf_info->cds = 1;
|
|
|
|
uf_info->ctss = 1;
|
|
|
|
} else {
|
|
|
|
uf_info->cds = 0;
|
|
|
|
uf_info->ctsp = 0;
|
|
|
|
uf_info->ctss = 0;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
2017-05-17 23:24:38 +08:00
|
|
|
|
|
|
|
/* This sets HPM register in CMXUCR register which configures a
|
|
|
|
* open drain connected HDLC bus
|
|
|
|
*/
|
|
|
|
if (priv->hdlc_bus)
|
|
|
|
uf_info->brkpt_support = 1;
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
uf_info->uccm_mask = ((UCC_HDLC_UCCE_RXB | UCC_HDLC_UCCE_RXF |
|
|
|
|
UCC_HDLC_UCCE_TXB) << 16);
|
|
|
|
|
|
|
|
ret = ucc_fast_init(uf_info, &priv->uccf);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(priv->dev, "Failed to init uccf.");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->uf_regs = priv->uccf->uf_regs;
|
|
|
|
ucc_fast_disable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
/* Loopback mode */
|
|
|
|
if (priv->loopback) {
|
|
|
|
dev_info(priv->dev, "Loopback Mode\n");
|
2017-05-17 23:24:36 +08:00
|
|
|
/* use the same clock when work in loopback */
|
|
|
|
qe_setbrg(ut_info->uf_info.rx_clock, 20000000, 1);
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
gumr = ioread32be(&priv->uf_regs->gumr);
|
|
|
|
gumr |= (UCC_FAST_GUMR_LOOPBACK | UCC_FAST_GUMR_CDS |
|
|
|
|
UCC_FAST_GUMR_TCI);
|
|
|
|
gumr &= ~(UCC_FAST_GUMR_CTSP | UCC_FAST_GUMR_RSYN);
|
|
|
|
iowrite32be(gumr, &priv->uf_regs->gumr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize SI */
|
|
|
|
if (priv->tsa)
|
|
|
|
ucc_tdm_init(priv->utdm, priv->ut_info);
|
|
|
|
|
|
|
|
/* Write to QE CECR, UCCx channel to Stop Transmission */
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
|
|
|
|
ret = qe_issue_cmd(QE_STOP_TX, cecr_subblock,
|
|
|
|
QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
|
|
|
|
/* Set UPSMR normal mode (need fixed)*/
|
|
|
|
iowrite32be(0, &priv->uf_regs->upsmr);
|
|
|
|
|
2017-05-17 23:24:38 +08:00
|
|
|
/* hdlc_bus mode */
|
|
|
|
if (priv->hdlc_bus) {
|
|
|
|
u32 upsmr;
|
|
|
|
|
|
|
|
dev_info(priv->dev, "HDLC bus Mode\n");
|
|
|
|
upsmr = ioread32be(&priv->uf_regs->upsmr);
|
|
|
|
|
|
|
|
/* bus mode and retransmit enable, with collision window
|
|
|
|
* set to 8 bytes
|
|
|
|
*/
|
|
|
|
upsmr |= UCC_HDLC_UPSMR_RTE | UCC_HDLC_UPSMR_BUS |
|
|
|
|
UCC_HDLC_UPSMR_CW8;
|
|
|
|
iowrite32be(upsmr, &priv->uf_regs->upsmr);
|
|
|
|
|
|
|
|
/* explicitly disable CDS & CTSP */
|
|
|
|
gumr = ioread32be(&priv->uf_regs->gumr);
|
|
|
|
gumr &= ~(UCC_FAST_GUMR_CDS | UCC_FAST_GUMR_CTSP);
|
|
|
|
/* set automatic sync to explicitly ignore CD signal */
|
|
|
|
gumr |= UCC_FAST_GUMR_SYNL_AUTO;
|
|
|
|
iowrite32be(gumr, &priv->uf_regs->gumr);
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->rx_ring_size = RX_BD_RING_LEN;
|
|
|
|
priv->tx_ring_size = TX_BD_RING_LEN;
|
|
|
|
/* Alloc Rx BD */
|
|
|
|
priv->rx_bd_base = dma_alloc_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
RX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
&priv->dma_rx_bd, GFP_KERNEL);
|
|
|
|
|
|
|
|
if (!priv->rx_bd_base) {
|
|
|
|
dev_err(priv->dev, "Cannot allocate MURAM memory for RxBDs\n");
|
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_uccf;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alloc Tx BD */
|
|
|
|
priv->tx_bd_base = dma_alloc_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
TX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
&priv->dma_tx_bd, GFP_KERNEL);
|
|
|
|
|
|
|
|
if (!priv->tx_bd_base) {
|
|
|
|
dev_err(priv->dev, "Cannot allocate MURAM memory for TxBDs\n");
|
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_rx_bd;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Alloc parameter ram for ucc hdlc */
|
2017-05-22 15:31:15 +08:00
|
|
|
priv->ucc_pram_offset = qe_muram_alloc(sizeof(struct ucc_hdlc_param),
|
2016-06-06 14:30:02 +08:00
|
|
|
ALIGNMENT_OF_UCC_HDLC_PRAM);
|
|
|
|
|
2019-11-28 22:55:49 +08:00
|
|
|
if (priv->ucc_pram_offset < 0) {
|
2016-08-28 18:40:41 +08:00
|
|
|
dev_err(priv->dev, "Can not allocate MURAM for hdlc parameter.\n");
|
2016-06-06 14:30:02 +08:00
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_tx_bd;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:
kzalloc(a * b, gfp)
with:
kcalloc(a * b, gfp)
as well as handling cases of:
kzalloc(a * b * c, gfp)
with:
kzalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kzalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kzalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 05:03:40 +08:00
|
|
|
priv->rx_skbuff = kcalloc(priv->rx_ring_size,
|
|
|
|
sizeof(*priv->rx_skbuff),
|
2016-06-06 14:30:02 +08:00
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv->rx_skbuff)
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_ucc_pram;
|
2016-06-06 14:30:02 +08:00
|
|
|
|
treewide: kzalloc() -> kcalloc()
The kzalloc() function has a 2-factor argument form, kcalloc(). This
patch replaces cases of:
kzalloc(a * b, gfp)
with:
kcalloc(a * b, gfp)
as well as handling cases of:
kzalloc(a * b * c, gfp)
with:
kzalloc(array3_size(a, b, c), gfp)
as it's slightly less ugly than:
kzalloc_array(array_size(a, b), c, gfp)
This does, however, attempt to ignore constant size factors like:
kzalloc(4 * 1024, gfp)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
kzalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
kzalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
kzalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
kzalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
kzalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_ID)
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_ID
+ COUNT_ID, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (COUNT_CONST)
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * COUNT_CONST
+ COUNT_CONST, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_ID)
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_ID
+ COUNT_ID, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (COUNT_CONST)
+ COUNT_CONST, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * COUNT_CONST
+ COUNT_CONST, sizeof(THING)
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
- kzalloc
+ kcalloc
(
- SIZE * COUNT
+ COUNT, SIZE
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
kzalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
kzalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
kzalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
kzalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
kzalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
kzalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products,
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(
- (E1) * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * E3
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- (E1) * (E2) * (E3)
+ array3_size(E1, E2, E3)
, ...)
|
kzalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants,
// keeping sizeof() as the second factor argument.
@@
expression THING, E1, E2;
type TYPE;
constant C1, C2, C3;
@@
(
kzalloc(sizeof(THING) * C2, ...)
|
kzalloc(sizeof(TYPE) * C2, ...)
|
kzalloc(C1 * C2 * C3, ...)
|
kzalloc(C1 * C2, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * (E2)
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(TYPE) * E2
+ E2, sizeof(TYPE)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * (E2)
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- sizeof(THING) * E2
+ E2, sizeof(THING)
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * E2
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- (E1) * (E2)
+ E1, E2
, ...)
|
- kzalloc
+ kcalloc
(
- E1 * E2
+ E1, E2
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-13 05:03:40 +08:00
|
|
|
priv->tx_skbuff = kcalloc(priv->tx_ring_size,
|
|
|
|
sizeof(*priv->tx_skbuff),
|
2016-06-06 14:30:02 +08:00
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv->tx_skbuff)
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_rx_skbuff;
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
priv->skb_curtx = 0;
|
|
|
|
priv->skb_dirtytx = 0;
|
|
|
|
priv->curtx_bd = priv->tx_bd_base;
|
|
|
|
priv->dirty_tx = priv->tx_bd_base;
|
|
|
|
priv->currx_bd = priv->rx_bd_base;
|
|
|
|
priv->currx_bdnum = 0;
|
|
|
|
|
|
|
|
/* init parameter base */
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
|
|
|
|
ret = qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, cecr_subblock,
|
|
|
|
QE_CR_PROTOCOL_UNSPECIFIED, priv->ucc_pram_offset);
|
|
|
|
|
|
|
|
priv->ucc_pram = (struct ucc_hdlc_param __iomem *)
|
|
|
|
qe_muram_addr(priv->ucc_pram_offset);
|
|
|
|
|
|
|
|
/* Zero out parameter ram */
|
|
|
|
memset_io(priv->ucc_pram, 0, sizeof(struct ucc_hdlc_param));
|
|
|
|
|
|
|
|
/* Alloc riptr, tiptr */
|
|
|
|
riptr = qe_muram_alloc(32, 32);
|
2019-11-28 22:55:49 +08:00
|
|
|
if (riptr < 0) {
|
2016-06-06 14:30:02 +08:00
|
|
|
dev_err(priv->dev, "Cannot allocate MURAM mem for Receive internal temp data pointer\n");
|
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_tx_skbuff;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
tiptr = qe_muram_alloc(32, 32);
|
2019-11-28 22:55:49 +08:00
|
|
|
if (tiptr < 0) {
|
2016-06-06 14:30:02 +08:00
|
|
|
dev_err(priv->dev, "Cannot allocate MURAM mem for Transmit internal temp data pointer\n");
|
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_riptr;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
2019-11-28 22:55:51 +08:00
|
|
|
if (riptr != (u16)riptr || tiptr != (u16)tiptr) {
|
|
|
|
dev_err(priv->dev, "MURAM allocation out of addressable range\n");
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto free_tiptr;
|
|
|
|
}
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
/* Set RIPTR, TIPTR */
|
|
|
|
iowrite16be(riptr, &priv->ucc_pram->riptr);
|
|
|
|
iowrite16be(tiptr, &priv->ucc_pram->tiptr);
|
|
|
|
|
|
|
|
/* Set MRBLR */
|
|
|
|
iowrite16be(MAX_RX_BUF_LENGTH, &priv->ucc_pram->mrblr);
|
|
|
|
|
|
|
|
/* Set RBASE, TBASE */
|
|
|
|
iowrite32be(priv->dma_rx_bd, &priv->ucc_pram->rbase);
|
|
|
|
iowrite32be(priv->dma_tx_bd, &priv->ucc_pram->tbase);
|
|
|
|
|
|
|
|
/* Set RSTATE, TSTATE */
|
|
|
|
iowrite32be(BMR_GBL | BMR_BIG_ENDIAN, &priv->ucc_pram->rstate);
|
|
|
|
iowrite32be(BMR_GBL | BMR_BIG_ENDIAN, &priv->ucc_pram->tstate);
|
|
|
|
|
|
|
|
/* Set C_MASK, C_PRES for 16bit CRC */
|
|
|
|
iowrite32be(CRC_16BIT_MASK, &priv->ucc_pram->c_mask);
|
|
|
|
iowrite32be(CRC_16BIT_PRES, &priv->ucc_pram->c_pres);
|
|
|
|
|
|
|
|
iowrite16be(MAX_FRAME_LENGTH, &priv->ucc_pram->mflr);
|
|
|
|
iowrite16be(DEFAULT_RFTHR, &priv->ucc_pram->rfthr);
|
|
|
|
iowrite16be(DEFAULT_RFTHR, &priv->ucc_pram->rfcnt);
|
2018-09-03 20:47:28 +08:00
|
|
|
iowrite16be(priv->hmask, &priv->ucc_pram->hmask);
|
2016-06-06 14:30:02 +08:00
|
|
|
iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr1);
|
|
|
|
iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr2);
|
|
|
|
iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr3);
|
|
|
|
iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr4);
|
|
|
|
|
|
|
|
/* Get BD buffer */
|
cross-tree: phase out dma_zalloc_coherent()
We already need to zero out memory for dma_alloc_coherent(), as such
using dma_zalloc_coherent() is superflous. Phase it out.
This change was generated with the following Coccinelle SmPL patch:
@ replace_dma_zalloc_coherent @
expression dev, size, data, handle, flags;
@@
-dma_zalloc_coherent(dev, size, handle, flags)
+dma_alloc_coherent(dev, size, handle, flags)
Suggested-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
[hch: re-ran the script on the latest tree]
Signed-off-by: Christoph Hellwig <hch@lst.de>
2019-01-04 16:23:09 +08:00
|
|
|
bd_buffer = dma_alloc_coherent(priv->dev,
|
|
|
|
(RX_BD_RING_LEN + TX_BD_RING_LEN) * MAX_RX_BUF_LENGTH,
|
|
|
|
&bd_dma_addr, GFP_KERNEL);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
if (!bd_buffer) {
|
|
|
|
dev_err(priv->dev, "Could not allocate buffer descriptors\n");
|
|
|
|
ret = -ENOMEM;
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_tiptr;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
priv->rx_buffer = bd_buffer;
|
|
|
|
priv->tx_buffer = bd_buffer + RX_BD_RING_LEN * MAX_RX_BUF_LENGTH;
|
|
|
|
|
|
|
|
priv->dma_rx_addr = bd_dma_addr;
|
|
|
|
priv->dma_tx_addr = bd_dma_addr + RX_BD_RING_LEN * MAX_RX_BUF_LENGTH;
|
|
|
|
|
|
|
|
for (i = 0; i < RX_BD_RING_LEN; i++) {
|
|
|
|
if (i < (RX_BD_RING_LEN - 1))
|
|
|
|
bd_status = R_E_S | R_I_S;
|
|
|
|
else
|
|
|
|
bd_status = R_E_S | R_I_S | R_W_S;
|
|
|
|
|
|
|
|
iowrite16be(bd_status, &priv->rx_bd_base[i].status);
|
|
|
|
iowrite32be(priv->dma_rx_addr + i * MAX_RX_BUF_LENGTH,
|
|
|
|
&priv->rx_bd_base[i].buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < TX_BD_RING_LEN; i++) {
|
|
|
|
if (i < (TX_BD_RING_LEN - 1))
|
|
|
|
bd_status = T_I_S | T_TC_S;
|
|
|
|
else
|
|
|
|
bd_status = T_I_S | T_TC_S | T_W_S;
|
|
|
|
|
|
|
|
iowrite16be(bd_status, &priv->tx_bd_base[i].status);
|
|
|
|
iowrite32be(priv->dma_tx_addr + i * MAX_RX_BUF_LENGTH,
|
|
|
|
&priv->tx_bd_base[i].buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2016-07-15 10:38:25 +08:00
|
|
|
free_tiptr:
|
2016-06-06 14:30:02 +08:00
|
|
|
qe_muram_free(tiptr);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_riptr:
|
2016-06-06 14:30:02 +08:00
|
|
|
qe_muram_free(riptr);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_tx_skbuff:
|
2016-06-06 14:30:02 +08:00
|
|
|
kfree(priv->tx_skbuff);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_rx_skbuff:
|
2016-06-06 14:30:02 +08:00
|
|
|
kfree(priv->rx_skbuff);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_ucc_pram:
|
2016-06-06 14:30:02 +08:00
|
|
|
qe_muram_free(priv->ucc_pram_offset);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_tx_bd:
|
2016-06-06 14:30:02 +08:00
|
|
|
dma_free_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
TX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->tx_bd_base, priv->dma_tx_bd);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_rx_bd:
|
2016-06-06 14:30:02 +08:00
|
|
|
dma_free_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
RX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->rx_bd_base, priv->dma_rx_bd);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_uccf:
|
2016-06-06 14:30:02 +08:00
|
|
|
ucc_fast_free(priv->uccf);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static netdev_tx_t ucc_hdlc_tx(struct sk_buff *skb, struct net_device *dev)
|
|
|
|
{
|
|
|
|
hdlc_device *hdlc = dev_to_hdlc(dev);
|
|
|
|
struct ucc_hdlc_private *priv = (struct ucc_hdlc_private *)hdlc->priv;
|
|
|
|
struct qe_bd __iomem *bd;
|
|
|
|
u16 bd_status;
|
|
|
|
unsigned long flags;
|
|
|
|
u16 *proto_head;
|
|
|
|
|
|
|
|
switch (dev->type) {
|
|
|
|
case ARPHRD_RAWHDLC:
|
|
|
|
if (skb_headroom(skb) < HDLC_HEAD_LEN) {
|
|
|
|
dev->stats.tx_dropped++;
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
netdev_err(dev, "No enough space for hdlc head\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
skb_push(skb, HDLC_HEAD_LEN);
|
|
|
|
|
|
|
|
proto_head = (u16 *)skb->data;
|
|
|
|
*proto_head = htons(DEFAULT_HDLC_HEAD);
|
|
|
|
|
|
|
|
dev->stats.tx_bytes += skb->len;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARPHRD_PPP:
|
|
|
|
proto_head = (u16 *)skb->data;
|
|
|
|
if (*proto_head != htons(DEFAULT_PPP_HEAD)) {
|
|
|
|
dev->stats.tx_dropped++;
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
netdev_err(dev, "Wrong ppp header\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev->stats.tx_bytes += skb->len;
|
|
|
|
break;
|
|
|
|
|
2018-09-03 20:47:27 +08:00
|
|
|
case ARPHRD_ETHER:
|
|
|
|
dev->stats.tx_bytes += skb->len;
|
|
|
|
break;
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
default:
|
|
|
|
dev->stats.tx_dropped++;
|
|
|
|
dev_kfree_skb(skb);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2018-11-07 16:09:45 +08:00
|
|
|
netdev_sent_queue(dev, skb->len);
|
2016-06-06 14:30:02 +08:00
|
|
|
spin_lock_irqsave(&priv->lock, flags);
|
|
|
|
|
|
|
|
/* Start from the next BD that should be filled */
|
|
|
|
bd = priv->curtx_bd;
|
|
|
|
bd_status = ioread16be(&bd->status);
|
|
|
|
/* Save the skb pointer so we can free it later */
|
|
|
|
priv->tx_skbuff[priv->skb_curtx] = skb;
|
|
|
|
|
|
|
|
/* Update the current skb pointer (wrapping if this was the last) */
|
|
|
|
priv->skb_curtx =
|
|
|
|
(priv->skb_curtx + 1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
|
|
|
|
|
|
|
|
/* copy skb data to tx buffer for sdma processing */
|
|
|
|
memcpy(priv->tx_buffer + (be32_to_cpu(bd->buf) - priv->dma_tx_addr),
|
|
|
|
skb->data, skb->len);
|
|
|
|
|
|
|
|
/* set bd status and length */
|
|
|
|
bd_status = (bd_status & T_W_S) | T_R_S | T_I_S | T_L_S | T_TC_S;
|
|
|
|
|
|
|
|
iowrite16be(skb->len, &bd->length);
|
2017-03-14 09:38:33 +08:00
|
|
|
iowrite16be(bd_status, &bd->status);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
/* Move to next BD in the ring */
|
|
|
|
if (!(bd_status & T_W_S))
|
|
|
|
bd += 1;
|
|
|
|
else
|
|
|
|
bd = priv->tx_bd_base;
|
|
|
|
|
|
|
|
if (bd == priv->dirty_tx) {
|
|
|
|
if (!netif_queue_stopped(dev))
|
|
|
|
netif_stop_queue(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->curtx_bd = bd;
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&priv->lock, flags);
|
|
|
|
|
|
|
|
return NETDEV_TX_OK;
|
|
|
|
}
|
|
|
|
|
2018-10-22 20:55:50 +08:00
|
|
|
static int hdlc_tx_restart(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
|
|
|
u32 cecr_subblock;
|
|
|
|
|
|
|
|
cecr_subblock =
|
|
|
|
ucc_fast_get_qe_cr_subblock(priv->ut_info->uf_info.ucc_num);
|
|
|
|
|
|
|
|
qe_issue_cmd(QE_RESTART_TX, cecr_subblock,
|
|
|
|
QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
static int hdlc_tx_done(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
|
|
|
/* Start from the next BD that should be filled */
|
|
|
|
struct net_device *dev = priv->ndev;
|
2018-11-07 16:09:45 +08:00
|
|
|
unsigned int bytes_sent = 0;
|
|
|
|
int howmany = 0;
|
2016-06-06 14:30:02 +08:00
|
|
|
struct qe_bd *bd; /* BD pointer */
|
|
|
|
u16 bd_status;
|
2018-10-22 20:55:50 +08:00
|
|
|
int tx_restart = 0;
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
bd = priv->dirty_tx;
|
|
|
|
bd_status = ioread16be(&bd->status);
|
|
|
|
|
|
|
|
/* Normal processing. */
|
|
|
|
while ((bd_status & T_R_S) == 0) {
|
|
|
|
struct sk_buff *skb;
|
|
|
|
|
2018-10-22 20:55:50 +08:00
|
|
|
if (bd_status & T_UN_S) { /* Underrun */
|
|
|
|
dev->stats.tx_fifo_errors++;
|
|
|
|
tx_restart = 1;
|
|
|
|
}
|
|
|
|
if (bd_status & T_CT_S) { /* Carrier lost */
|
|
|
|
dev->stats.tx_carrier_errors++;
|
|
|
|
tx_restart = 1;
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
/* BD contains already transmitted buffer. */
|
|
|
|
/* Handle the transmitted buffer and release */
|
|
|
|
/* the BD to be used with the current frame */
|
|
|
|
|
|
|
|
skb = priv->tx_skbuff[priv->skb_dirtytx];
|
|
|
|
if (!skb)
|
|
|
|
break;
|
2018-11-07 16:09:45 +08:00
|
|
|
howmany++;
|
|
|
|
bytes_sent += skb->len;
|
2016-06-06 14:30:02 +08:00
|
|
|
dev->stats.tx_packets++;
|
|
|
|
memset(priv->tx_buffer +
|
|
|
|
(be32_to_cpu(bd->buf) - priv->dma_tx_addr),
|
|
|
|
0, skb->len);
|
2019-02-06 00:14:51 +08:00
|
|
|
dev_consume_skb_irq(skb);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
priv->tx_skbuff[priv->skb_dirtytx] = NULL;
|
|
|
|
priv->skb_dirtytx =
|
|
|
|
(priv->skb_dirtytx +
|
|
|
|
1) & TX_RING_MOD_MASK(TX_BD_RING_LEN);
|
|
|
|
|
|
|
|
/* We freed a buffer, so now we can restart transmission */
|
|
|
|
if (netif_queue_stopped(dev))
|
|
|
|
netif_wake_queue(dev);
|
|
|
|
|
|
|
|
/* Advance the confirmation BD pointer */
|
|
|
|
if (!(bd_status & T_W_S))
|
|
|
|
bd += 1;
|
|
|
|
else
|
|
|
|
bd = priv->tx_bd_base;
|
|
|
|
bd_status = ioread16be(&bd->status);
|
|
|
|
}
|
|
|
|
priv->dirty_tx = bd;
|
|
|
|
|
2018-10-22 20:55:50 +08:00
|
|
|
if (tx_restart)
|
|
|
|
hdlc_tx_restart(priv);
|
|
|
|
|
2018-11-07 16:09:45 +08:00
|
|
|
netdev_completed_queue(dev, howmany, bytes_sent);
|
2016-06-06 14:30:02 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int hdlc_rx_done(struct ucc_hdlc_private *priv, int rx_work_limit)
|
|
|
|
{
|
|
|
|
struct net_device *dev = priv->ndev;
|
2017-05-17 23:24:33 +08:00
|
|
|
struct sk_buff *skb = NULL;
|
2016-06-06 14:30:02 +08:00
|
|
|
hdlc_device *hdlc = dev_to_hdlc(dev);
|
|
|
|
struct qe_bd *bd;
|
2017-03-14 09:38:33 +08:00
|
|
|
u16 bd_status;
|
2016-06-06 14:30:02 +08:00
|
|
|
u16 length, howmany = 0;
|
|
|
|
u8 *bdbuffer;
|
|
|
|
|
|
|
|
bd = priv->currx_bd;
|
|
|
|
bd_status = ioread16be(&bd->status);
|
|
|
|
|
|
|
|
/* while there are received buffers and BD is full (~R_E) */
|
|
|
|
while (!((bd_status & (R_E_S)) || (--rx_work_limit < 0))) {
|
2018-10-22 20:55:50 +08:00
|
|
|
if (bd_status & (RX_BD_ERRORS)) {
|
|
|
|
dev->stats.rx_errors++;
|
|
|
|
|
|
|
|
if (bd_status & R_CD_S)
|
|
|
|
dev->stats.collisions++;
|
|
|
|
if (bd_status & R_OV_S)
|
|
|
|
dev->stats.rx_fifo_errors++;
|
|
|
|
if (bd_status & R_CR_S)
|
|
|
|
dev->stats.rx_crc_errors++;
|
|
|
|
if (bd_status & R_AB_S)
|
|
|
|
dev->stats.rx_over_errors++;
|
|
|
|
if (bd_status & R_NO_S)
|
|
|
|
dev->stats.rx_frame_errors++;
|
|
|
|
if (bd_status & R_LG_S)
|
|
|
|
dev->stats.rx_length_errors++;
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
goto recycle;
|
|
|
|
}
|
|
|
|
bdbuffer = priv->rx_buffer +
|
|
|
|
(priv->currx_bdnum * MAX_RX_BUF_LENGTH);
|
|
|
|
length = ioread16be(&bd->length);
|
|
|
|
|
|
|
|
switch (dev->type) {
|
|
|
|
case ARPHRD_RAWHDLC:
|
|
|
|
bdbuffer += HDLC_HEAD_LEN;
|
|
|
|
length -= (HDLC_HEAD_LEN + HDLC_CRC_SIZE);
|
|
|
|
|
|
|
|
skb = dev_alloc_skb(length);
|
|
|
|
if (!skb) {
|
|
|
|
dev->stats.rx_dropped++;
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
skb_put(skb, length);
|
|
|
|
skb->len = length;
|
|
|
|
skb->dev = dev;
|
|
|
|
memcpy(skb->data, bdbuffer, length);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case ARPHRD_PPP:
|
2018-09-03 20:47:27 +08:00
|
|
|
case ARPHRD_ETHER:
|
2016-06-06 14:30:02 +08:00
|
|
|
length -= HDLC_CRC_SIZE;
|
|
|
|
|
|
|
|
skb = dev_alloc_skb(length);
|
|
|
|
if (!skb) {
|
|
|
|
dev->stats.rx_dropped++;
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
skb_put(skb, length);
|
|
|
|
skb->len = length;
|
|
|
|
skb->dev = dev;
|
|
|
|
memcpy(skb->data, bdbuffer, length);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
dev->stats.rx_packets++;
|
|
|
|
dev->stats.rx_bytes += skb->len;
|
|
|
|
howmany++;
|
|
|
|
if (hdlc->proto)
|
|
|
|
skb->protocol = hdlc_type_trans(skb, dev);
|
|
|
|
netif_receive_skb(skb);
|
|
|
|
|
|
|
|
recycle:
|
2018-10-22 20:55:50 +08:00
|
|
|
iowrite16be((bd_status & R_W_S) | R_E_S | R_I_S, &bd->status);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
/* update to point at the next bd */
|
|
|
|
if (bd_status & R_W_S) {
|
|
|
|
priv->currx_bdnum = 0;
|
|
|
|
bd = priv->rx_bd_base;
|
|
|
|
} else {
|
|
|
|
if (priv->currx_bdnum < (RX_BD_RING_LEN - 1))
|
|
|
|
priv->currx_bdnum += 1;
|
|
|
|
else
|
|
|
|
priv->currx_bdnum = RX_BD_RING_LEN - 1;
|
|
|
|
|
|
|
|
bd += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
bd_status = ioread16be(&bd->status);
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->currx_bd = bd;
|
|
|
|
return howmany;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ucc_hdlc_poll(struct napi_struct *napi, int budget)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = container_of(napi,
|
|
|
|
struct ucc_hdlc_private,
|
|
|
|
napi);
|
|
|
|
int howmany;
|
|
|
|
|
|
|
|
/* Tx event processing */
|
|
|
|
spin_lock(&priv->lock);
|
2017-05-17 23:24:34 +08:00
|
|
|
hdlc_tx_done(priv);
|
2016-06-06 14:30:02 +08:00
|
|
|
spin_unlock(&priv->lock);
|
|
|
|
|
|
|
|
howmany = 0;
|
|
|
|
howmany += hdlc_rx_done(priv, budget - howmany);
|
|
|
|
|
|
|
|
if (howmany < budget) {
|
2017-01-31 00:22:01 +08:00
|
|
|
napi_complete_done(napi, howmany);
|
2019-11-28 22:55:08 +08:00
|
|
|
qe_setbits_be32(priv->uccf->p_uccm,
|
|
|
|
(UCCE_HDLC_RX_EVENTS | UCCE_HDLC_TX_EVENTS) << 16);
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return howmany;
|
|
|
|
}
|
|
|
|
|
|
|
|
static irqreturn_t ucc_hdlc_irq_handler(int irq, void *dev_id)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = (struct ucc_hdlc_private *)dev_id;
|
|
|
|
struct net_device *dev = priv->ndev;
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
u32 ucce;
|
|
|
|
u32 uccm;
|
|
|
|
|
|
|
|
uccf = priv->uccf;
|
|
|
|
|
|
|
|
ucce = ioread32be(uccf->p_ucce);
|
|
|
|
uccm = ioread32be(uccf->p_uccm);
|
|
|
|
ucce &= uccm;
|
|
|
|
iowrite32be(ucce, uccf->p_ucce);
|
|
|
|
if (!ucce)
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
if ((ucce >> 16) & (UCCE_HDLC_RX_EVENTS | UCCE_HDLC_TX_EVENTS)) {
|
|
|
|
if (napi_schedule_prep(&priv->napi)) {
|
|
|
|
uccm &= ~((UCCE_HDLC_RX_EVENTS | UCCE_HDLC_TX_EVENTS)
|
|
|
|
<< 16);
|
|
|
|
iowrite32be(uccm, uccf->p_uccm);
|
|
|
|
__napi_schedule(&priv->napi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Errors and other events */
|
|
|
|
if (ucce >> 16 & UCC_HDLC_UCCE_BSY)
|
2018-10-22 20:55:50 +08:00
|
|
|
dev->stats.rx_missed_errors++;
|
2016-06-06 14:30:02 +08:00
|
|
|
if (ucce >> 16 & UCC_HDLC_UCCE_TXE)
|
|
|
|
dev->stats.tx_errors++;
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uhdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|
|
|
{
|
|
|
|
const size_t size = sizeof(te1_settings);
|
|
|
|
te1_settings line;
|
|
|
|
struct ucc_hdlc_private *priv = netdev_priv(dev);
|
|
|
|
|
|
|
|
if (cmd != SIOCWANDEV)
|
|
|
|
return hdlc_ioctl(dev, ifr, cmd);
|
|
|
|
|
|
|
|
switch (ifr->ifr_settings.type) {
|
|
|
|
case IF_GET_IFACE:
|
|
|
|
ifr->ifr_settings.type = IF_IFACE_E1;
|
|
|
|
if (ifr->ifr_settings.size < size) {
|
|
|
|
ifr->ifr_settings.size = size; /* data size wanted */
|
|
|
|
return -ENOBUFS;
|
|
|
|
}
|
2016-07-14 19:16:53 +08:00
|
|
|
memset(&line, 0, sizeof(line));
|
2016-06-06 14:30:02 +08:00
|
|
|
line.clock_type = priv->clocking;
|
|
|
|
|
|
|
|
if (copy_to_user(ifr->ifr_settings.ifs_ifsu.sync, &line, size))
|
|
|
|
return -EFAULT;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return hdlc_ioctl(dev, ifr, cmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uhdlc_open(struct net_device *dev)
|
|
|
|
{
|
|
|
|
u32 cecr_subblock;
|
|
|
|
hdlc_device *hdlc = dev_to_hdlc(dev);
|
|
|
|
struct ucc_hdlc_private *priv = hdlc->priv;
|
|
|
|
struct ucc_tdm *utdm = priv->utdm;
|
|
|
|
|
|
|
|
if (priv->hdlc_busy != 1) {
|
|
|
|
if (request_irq(priv->ut_info->uf_info.irq,
|
|
|
|
ucc_hdlc_irq_handler, 0, "hdlc", priv))
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(
|
|
|
|
priv->ut_info->uf_info.ucc_num);
|
|
|
|
|
|
|
|
qe_issue_cmd(QE_INIT_TX_RX, cecr_subblock,
|
|
|
|
QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
|
|
|
|
ucc_fast_enable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
/* Enable the TDM port */
|
|
|
|
if (priv->tsa)
|
|
|
|
utdm->si_regs->siglmr1_h |= (0x1 << utdm->tdm_port);
|
|
|
|
|
|
|
|
priv->hdlc_busy = 1;
|
|
|
|
netif_device_attach(priv->ndev);
|
|
|
|
napi_enable(&priv->napi);
|
2018-11-07 16:09:45 +08:00
|
|
|
netdev_reset_queue(dev);
|
2016-06-06 14:30:02 +08:00
|
|
|
netif_start_queue(dev);
|
|
|
|
hdlc_open(dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void uhdlc_memclean(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
2019-11-28 22:55:50 +08:00
|
|
|
qe_muram_free(ioread16be(&priv->ucc_pram->riptr));
|
|
|
|
qe_muram_free(ioread16be(&priv->ucc_pram->tiptr));
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
if (priv->rx_bd_base) {
|
|
|
|
dma_free_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
RX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->rx_bd_base, priv->dma_rx_bd);
|
|
|
|
|
|
|
|
priv->rx_bd_base = NULL;
|
|
|
|
priv->dma_rx_bd = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->tx_bd_base) {
|
|
|
|
dma_free_coherent(priv->dev,
|
2017-05-17 23:24:35 +08:00
|
|
|
TX_BD_RING_LEN * sizeof(struct qe_bd),
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->tx_bd_base, priv->dma_tx_bd);
|
|
|
|
|
|
|
|
priv->tx_bd_base = NULL;
|
|
|
|
priv->dma_tx_bd = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->ucc_pram) {
|
|
|
|
qe_muram_free(priv->ucc_pram_offset);
|
|
|
|
priv->ucc_pram = NULL;
|
|
|
|
priv->ucc_pram_offset = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
kfree(priv->rx_skbuff);
|
|
|
|
priv->rx_skbuff = NULL;
|
|
|
|
|
|
|
|
kfree(priv->tx_skbuff);
|
|
|
|
priv->tx_skbuff = NULL;
|
|
|
|
|
|
|
|
if (priv->uf_regs) {
|
|
|
|
iounmap(priv->uf_regs);
|
|
|
|
priv->uf_regs = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->uccf) {
|
|
|
|
ucc_fast_free(priv->uccf);
|
|
|
|
priv->uccf = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->rx_buffer) {
|
|
|
|
dma_free_coherent(priv->dev,
|
|
|
|
RX_BD_RING_LEN * MAX_RX_BUF_LENGTH,
|
|
|
|
priv->rx_buffer, priv->dma_rx_addr);
|
|
|
|
priv->rx_buffer = NULL;
|
|
|
|
priv->dma_rx_addr = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->tx_buffer) {
|
|
|
|
dma_free_coherent(priv->dev,
|
|
|
|
TX_BD_RING_LEN * MAX_RX_BUF_LENGTH,
|
|
|
|
priv->tx_buffer, priv->dma_tx_addr);
|
|
|
|
priv->tx_buffer = NULL;
|
|
|
|
priv->dma_tx_addr = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uhdlc_close(struct net_device *dev)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = dev_to_hdlc(dev)->priv;
|
|
|
|
struct ucc_tdm *utdm = priv->utdm;
|
|
|
|
u32 cecr_subblock;
|
|
|
|
|
|
|
|
napi_disable(&priv->napi);
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(
|
|
|
|
priv->ut_info->uf_info.ucc_num);
|
|
|
|
|
|
|
|
qe_issue_cmd(QE_GRACEFUL_STOP_TX, cecr_subblock,
|
|
|
|
(u8)QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
qe_issue_cmd(QE_CLOSE_RX_BD, cecr_subblock,
|
|
|
|
(u8)QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
|
|
|
|
if (priv->tsa)
|
|
|
|
utdm->si_regs->siglmr1_h &= ~(0x1 << utdm->tdm_port);
|
|
|
|
|
|
|
|
ucc_fast_disable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
free_irq(priv->ut_info->uf_info.irq, priv);
|
|
|
|
netif_stop_queue(dev);
|
2018-11-07 16:09:45 +08:00
|
|
|
netdev_reset_queue(dev);
|
2016-06-06 14:30:02 +08:00
|
|
|
priv->hdlc_busy = 0;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ucc_hdlc_attach(struct net_device *dev, unsigned short encoding,
|
|
|
|
unsigned short parity)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = dev_to_hdlc(dev)->priv;
|
|
|
|
|
|
|
|
if (encoding != ENCODING_NRZ &&
|
|
|
|
encoding != ENCODING_NRZI)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (parity != PARITY_NONE &&
|
|
|
|
parity != PARITY_CRC32_PR1_CCITT &&
|
2018-09-03 20:47:26 +08:00
|
|
|
parity != PARITY_CRC16_PR0_CCITT &&
|
2016-06-06 14:30:02 +08:00
|
|
|
parity != PARITY_CRC16_PR1_CCITT)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
priv->encoding = encoding;
|
|
|
|
priv->parity = parity;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
static void store_clk_config(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
|
|
|
struct qe_mux *qe_mux_reg = &qe_immr->qmx;
|
|
|
|
|
|
|
|
/* store si clk */
|
|
|
|
priv->cmxsi1cr_h = ioread32be(&qe_mux_reg->cmxsi1cr_h);
|
|
|
|
priv->cmxsi1cr_l = ioread32be(&qe_mux_reg->cmxsi1cr_l);
|
|
|
|
|
|
|
|
/* store si sync */
|
|
|
|
priv->cmxsi1syr = ioread32be(&qe_mux_reg->cmxsi1syr);
|
|
|
|
|
|
|
|
/* store ucc clk */
|
|
|
|
memcpy_fromio(priv->cmxucr, qe_mux_reg->cmxucr, 4 * sizeof(u32));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void resume_clk_config(struct ucc_hdlc_private *priv)
|
|
|
|
{
|
|
|
|
struct qe_mux *qe_mux_reg = &qe_immr->qmx;
|
|
|
|
|
|
|
|
memcpy_toio(qe_mux_reg->cmxucr, priv->cmxucr, 4 * sizeof(u32));
|
|
|
|
|
|
|
|
iowrite32be(priv->cmxsi1cr_h, &qe_mux_reg->cmxsi1cr_h);
|
|
|
|
iowrite32be(priv->cmxsi1cr_l, &qe_mux_reg->cmxsi1cr_l);
|
|
|
|
|
|
|
|
iowrite32be(priv->cmxsi1syr, &qe_mux_reg->cmxsi1syr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uhdlc_suspend(struct device *dev)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = dev_get_drvdata(dev);
|
|
|
|
struct ucc_fast __iomem *uf_regs;
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!netif_running(priv->ndev))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
netif_device_detach(priv->ndev);
|
|
|
|
napi_disable(&priv->napi);
|
|
|
|
|
|
|
|
uf_regs = priv->uf_regs;
|
|
|
|
|
|
|
|
/* backup gumr guemr*/
|
|
|
|
priv->gumr = ioread32be(&uf_regs->gumr);
|
|
|
|
priv->guemr = ioread8(&uf_regs->guemr);
|
|
|
|
|
|
|
|
priv->ucc_pram_bak = kmalloc(sizeof(*priv->ucc_pram_bak),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!priv->ucc_pram_bak)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
/* backup HDLC parameter */
|
|
|
|
memcpy_fromio(priv->ucc_pram_bak, priv->ucc_pram,
|
|
|
|
sizeof(struct ucc_hdlc_param));
|
|
|
|
|
|
|
|
/* store the clk configuration */
|
|
|
|
store_clk_config(priv);
|
|
|
|
|
|
|
|
/* save power */
|
|
|
|
ucc_fast_disable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int uhdlc_resume(struct device *dev)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = dev_get_drvdata(dev);
|
2016-07-31 19:14:23 +08:00
|
|
|
struct ucc_tdm *utdm;
|
2016-06-06 14:30:02 +08:00
|
|
|
struct ucc_tdm_info *ut_info;
|
|
|
|
struct ucc_fast __iomem *uf_regs;
|
|
|
|
struct ucc_fast_private *uccf;
|
|
|
|
struct ucc_fast_info *uf_info;
|
2019-12-28 11:09:47 +08:00
|
|
|
int i;
|
2016-06-06 14:30:02 +08:00
|
|
|
u32 cecr_subblock;
|
|
|
|
u16 bd_status;
|
|
|
|
|
|
|
|
if (!priv)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
if (!netif_running(priv->ndev))
|
|
|
|
return 0;
|
|
|
|
|
2016-07-31 19:14:23 +08:00
|
|
|
utdm = priv->utdm;
|
2016-06-06 14:30:02 +08:00
|
|
|
ut_info = priv->ut_info;
|
|
|
|
uf_info = &ut_info->uf_info;
|
|
|
|
uf_regs = priv->uf_regs;
|
|
|
|
uccf = priv->uccf;
|
|
|
|
|
|
|
|
/* restore gumr guemr */
|
|
|
|
iowrite8(priv->guemr, &uf_regs->guemr);
|
|
|
|
iowrite32be(priv->gumr, &uf_regs->gumr);
|
|
|
|
|
|
|
|
/* Set Virtual Fifo registers */
|
|
|
|
iowrite16be(uf_info->urfs, &uf_regs->urfs);
|
|
|
|
iowrite16be(uf_info->urfet, &uf_regs->urfet);
|
|
|
|
iowrite16be(uf_info->urfset, &uf_regs->urfset);
|
|
|
|
iowrite16be(uf_info->utfs, &uf_regs->utfs);
|
|
|
|
iowrite16be(uf_info->utfet, &uf_regs->utfet);
|
|
|
|
iowrite16be(uf_info->utftt, &uf_regs->utftt);
|
|
|
|
/* utfb, urfb are offsets from MURAM base */
|
|
|
|
iowrite32be(uccf->ucc_fast_tx_virtual_fifo_base_offset, &uf_regs->utfb);
|
|
|
|
iowrite32be(uccf->ucc_fast_rx_virtual_fifo_base_offset, &uf_regs->urfb);
|
|
|
|
|
|
|
|
/* Rx Tx and sync clock routing */
|
|
|
|
resume_clk_config(priv);
|
|
|
|
|
|
|
|
iowrite32be(uf_info->uccm_mask, &uf_regs->uccm);
|
|
|
|
iowrite32be(0xffffffff, &uf_regs->ucce);
|
|
|
|
|
|
|
|
ucc_fast_disable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
/* rebuild SIRAM */
|
|
|
|
if (priv->tsa)
|
|
|
|
ucc_tdm_init(priv->utdm, priv->ut_info);
|
|
|
|
|
|
|
|
/* Write to QE CECR, UCCx channel to Stop Transmission */
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
|
2019-12-28 11:09:47 +08:00
|
|
|
qe_issue_cmd(QE_STOP_TX, cecr_subblock,
|
|
|
|
(u8)QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
/* Set UPSMR normal mode */
|
|
|
|
iowrite32be(0, &uf_regs->upsmr);
|
|
|
|
|
|
|
|
/* init parameter base */
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(uf_info->ucc_num);
|
2019-12-28 11:09:47 +08:00
|
|
|
qe_issue_cmd(QE_ASSIGN_PAGE_TO_DEVICE, cecr_subblock,
|
|
|
|
QE_CR_PROTOCOL_UNSPECIFIED, priv->ucc_pram_offset);
|
2016-06-06 14:30:02 +08:00
|
|
|
|
|
|
|
priv->ucc_pram = (struct ucc_hdlc_param __iomem *)
|
|
|
|
qe_muram_addr(priv->ucc_pram_offset);
|
|
|
|
|
|
|
|
/* restore ucc parameter */
|
|
|
|
memcpy_toio(priv->ucc_pram, priv->ucc_pram_bak,
|
|
|
|
sizeof(struct ucc_hdlc_param));
|
|
|
|
kfree(priv->ucc_pram_bak);
|
|
|
|
|
|
|
|
/* rebuild BD entry */
|
|
|
|
for (i = 0; i < RX_BD_RING_LEN; i++) {
|
|
|
|
if (i < (RX_BD_RING_LEN - 1))
|
|
|
|
bd_status = R_E_S | R_I_S;
|
|
|
|
else
|
|
|
|
bd_status = R_E_S | R_I_S | R_W_S;
|
|
|
|
|
|
|
|
iowrite16be(bd_status, &priv->rx_bd_base[i].status);
|
|
|
|
iowrite32be(priv->dma_rx_addr + i * MAX_RX_BUF_LENGTH,
|
|
|
|
&priv->rx_bd_base[i].buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < TX_BD_RING_LEN; i++) {
|
|
|
|
if (i < (TX_BD_RING_LEN - 1))
|
|
|
|
bd_status = T_I_S | T_TC_S;
|
|
|
|
else
|
|
|
|
bd_status = T_I_S | T_TC_S | T_W_S;
|
|
|
|
|
|
|
|
iowrite16be(bd_status, &priv->tx_bd_base[i].status);
|
|
|
|
iowrite32be(priv->dma_tx_addr + i * MAX_RX_BUF_LENGTH,
|
|
|
|
&priv->tx_bd_base[i].buf);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if hdlc is busy enable TX and RX */
|
|
|
|
if (priv->hdlc_busy == 1) {
|
|
|
|
cecr_subblock = ucc_fast_get_qe_cr_subblock(
|
|
|
|
priv->ut_info->uf_info.ucc_num);
|
|
|
|
|
|
|
|
qe_issue_cmd(QE_INIT_TX_RX, cecr_subblock,
|
|
|
|
(u8)QE_CR_PROTOCOL_UNSPECIFIED, 0);
|
|
|
|
|
|
|
|
ucc_fast_enable(priv->uccf, COMM_DIR_RX | COMM_DIR_TX);
|
|
|
|
|
|
|
|
/* Enable the TDM port */
|
|
|
|
if (priv->tsa)
|
|
|
|
utdm->si_regs->siglmr1_h |= (0x1 << utdm->tdm_port);
|
|
|
|
}
|
|
|
|
|
|
|
|
napi_enable(&priv->napi);
|
|
|
|
netif_device_attach(priv->ndev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct dev_pm_ops uhdlc_pm_ops = {
|
|
|
|
.suspend = uhdlc_suspend,
|
|
|
|
.resume = uhdlc_resume,
|
|
|
|
.freeze = uhdlc_suspend,
|
|
|
|
.thaw = uhdlc_resume,
|
|
|
|
};
|
|
|
|
|
|
|
|
#define HDLC_PM_OPS (&uhdlc_pm_ops)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define HDLC_PM_OPS NULL
|
|
|
|
|
|
|
|
#endif
|
netdev: pass the stuck queue to the timeout handler
This allows incrementing the correct timeout statistic without any mess.
Down the road, devices can learn to reset just the specific queue.
The patch was generated with the following script:
use strict;
use warnings;
our $^I = '.bak';
my @work = (
["arch/m68k/emu/nfeth.c", "nfeth_tx_timeout"],
["arch/um/drivers/net_kern.c", "uml_net_tx_timeout"],
["arch/um/drivers/vector_kern.c", "vector_net_tx_timeout"],
["arch/xtensa/platforms/iss/network.c", "iss_net_tx_timeout"],
["drivers/char/pcmcia/synclink_cs.c", "hdlcdev_tx_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/infiniband/ulp/ipoib/ipoib_main.c", "ipoib_timeout"],
["drivers/message/fusion/mptlan.c", "mpt_lan_tx_timeout"],
["drivers/misc/sgi-xp/xpnet.c", "xpnet_dev_tx_timeout"],
["drivers/net/appletalk/cops.c", "cops_timeout"],
["drivers/net/arcnet/arcdevice.h", "arcnet_timeout"],
["drivers/net/arcnet/arcnet.c", "arcnet_timeout"],
["drivers/net/arcnet/com20020.c", "arcnet_timeout"],
["drivers/net/ethernet/3com/3c509.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c515.c", "corkscrew_timeout"],
["drivers/net/ethernet/3com/3c574_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c589_cs.c", "el3_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/3c59x.c", "vortex_tx_timeout"],
["drivers/net/ethernet/3com/typhoon.c", "typhoon_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390.h", "eip_tx_timeout"],
["drivers/net/ethernet/8390/8390.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/8390p.c", "eip_tx_timeout"],
["drivers/net/ethernet/8390/ax88796.c", "ax_ei_tx_timeout"],
["drivers/net/ethernet/8390/axnet_cs.c", "axnet_tx_timeout"],
["drivers/net/ethernet/8390/etherh.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/hydra.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mac8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/mcf8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/lib8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/8390/ne2k-pci.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/pcnet_cs.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/smc-ultra.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/wd.c", "ei_tx_timeout"],
["drivers/net/ethernet/8390/zorro8390.c", "__ei_tx_timeout"],
["drivers/net/ethernet/adaptec/starfire.c", "tx_timeout"],
["drivers/net/ethernet/agere/et131x.c", "et131x_tx_timeout"],
["drivers/net/ethernet/allwinner/sun4i-emac.c", "emac_timeout"],
["drivers/net/ethernet/alteon/acenic.c", "ace_watchdog"],
["drivers/net/ethernet/amazon/ena/ena_netdev.c", "ena_tx_timeout"],
["drivers/net/ethernet/amd/7990.h", "lance_tx_timeout"],
["drivers/net/ethernet/amd/7990.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/a2065.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/am79c961a.c", "am79c961_timeout"],
["drivers/net/ethernet/amd/amd8111e.c", "amd8111e_tx_timeout"],
["drivers/net/ethernet/amd/ariadne.c", "ariadne_tx_timeout"],
["drivers/net/ethernet/amd/atarilance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/au1000_eth.c", "au1000_tx_timeout"],
["drivers/net/ethernet/amd/declance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/lance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/mvme147.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/ni65.c", "ni65_timeout"],
["drivers/net/ethernet/amd/nmclan_cs.c", "mace_tx_timeout"],
["drivers/net/ethernet/amd/pcnet32.c", "pcnet32_tx_timeout"],
["drivers/net/ethernet/amd/sunlance.c", "lance_tx_timeout"],
["drivers/net/ethernet/amd/xgbe/xgbe-drv.c", "xgbe_tx_timeout"],
["drivers/net/ethernet/apm/xgene-v2/main.c", "xge_timeout"],
["drivers/net/ethernet/apm/xgene/xgene_enet_main.c", "xgene_enet_timeout"],
["drivers/net/ethernet/apple/macmace.c", "mace_tx_timeout"],
["drivers/net/ethernet/atheros/ag71xx.c", "ag71xx_tx_timeout"],
["drivers/net/ethernet/atheros/alx/main.c", "alx_tx_timeout"],
["drivers/net/ethernet/atheros/atl1c/atl1c_main.c", "atl1c_tx_timeout"],
["drivers/net/ethernet/atheros/atl1e/atl1e_main.c", "atl1e_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl1.c", "atlx_tx_timeout"],
["drivers/net/ethernet/atheros/atlx/atl2.c", "atl2_tx_timeout"],
["drivers/net/ethernet/broadcom/b44.c", "b44_tx_timeout"],
["drivers/net/ethernet/broadcom/bcmsysport.c", "bcm_sysport_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2.c", "bnx2_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c", "bnx2x_tx_timeout"],
["drivers/net/ethernet/broadcom/bnxt/bnxt.c", "bnxt_tx_timeout"],
["drivers/net/ethernet/broadcom/genet/bcmgenet.c", "bcmgenet_timeout"],
["drivers/net/ethernet/broadcom/sb1250-mac.c", "sbmac_tx_timeout"],
["drivers/net/ethernet/broadcom/tg3.c", "tg3_tx_timeout"],
["drivers/net/ethernet/calxeda/xgmac.c", "xgmac_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_main.c", "liquidio_tx_timeout"],
["drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c", "lio_vf_rep_tx_timeout"],
["drivers/net/ethernet/cavium/thunder/nicvf_main.c", "nicvf_tx_timeout"],
["drivers/net/ethernet/cirrus/cs89x0.c", "net_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cisco/enic/enic_main.c", "enic_tx_timeout"],
["drivers/net/ethernet/cortina/gemini.c", "gmac_tx_timeout"],
["drivers/net/ethernet/davicom/dm9000.c", "dm9000_timeout"],
["drivers/net/ethernet/dec/tulip/de2104x.c", "de_tx_timeout"],
["drivers/net/ethernet/dec/tulip/tulip_core.c", "tulip_tx_timeout"],
["drivers/net/ethernet/dec/tulip/winbond-840.c", "tx_timeout"],
["drivers/net/ethernet/dlink/dl2k.c", "rio_tx_timeout"],
["drivers/net/ethernet/dlink/sundance.c", "tx_timeout"],
["drivers/net/ethernet/emulex/benet/be_main.c", "be_tx_timeout"],
["drivers/net/ethernet/ethoc.c", "ethoc_tx_timeout"],
["drivers/net/ethernet/faraday/ftgmac100.c", "ftgmac100_tx_timeout"],
["drivers/net/ethernet/fealnx.c", "fealnx_tx_timeout"],
["drivers/net/ethernet/freescale/dpaa/dpaa_eth.c", "dpaa_tx_timeout"],
["drivers/net/ethernet/freescale/fec_main.c", "fec_timeout"],
["drivers/net/ethernet/freescale/fec_mpc52xx.c", "mpc52xx_fec_tx_timeout"],
["drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c", "fs_timeout"],
["drivers/net/ethernet/freescale/gianfar.c", "gfar_timeout"],
["drivers/net/ethernet/freescale/ucc_geth.c", "ucc_geth_timeout"],
["drivers/net/ethernet/fujitsu/fmvj18x_cs.c", "fjn_tx_timeout"],
["drivers/net/ethernet/google/gve/gve_main.c", "gve_tx_timeout"],
["drivers/net/ethernet/hisilicon/hip04_eth.c", "hip04_timeout"],
["drivers/net/ethernet/hisilicon/hix5hd2_gmac.c", "hix5hd2_net_timeout"],
["drivers/net/ethernet/hisilicon/hns/hns_enet.c", "hns_nic_net_timeout"],
["drivers/net/ethernet/hisilicon/hns3/hns3_enet.c", "hns3_nic_net_timeout"],
["drivers/net/ethernet/huawei/hinic/hinic_main.c", "hinic_tx_timeout"],
["drivers/net/ethernet/i825xx/82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/ether1.c", "ether1_timeout"],
["drivers/net/ethernet/i825xx/lib82596.c", "i596_tx_timeout"],
["drivers/net/ethernet/i825xx/sun3_82586.c", "sun3_82586_timeout"],
["drivers/net/ethernet/ibm/ehea/ehea_main.c", "ehea_tx_watchdog"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/emac/core.c", "emac_tx_timeout"],
["drivers/net/ethernet/ibm/ibmvnic.c", "ibmvnic_tx_timeout"],
["drivers/net/ethernet/intel/e100.c", "e100_tx_timeout"],
["drivers/net/ethernet/intel/e1000/e1000_main.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/e1000e/netdev.c", "e1000_tx_timeout"],
["drivers/net/ethernet/intel/fm10k/fm10k_netdev.c", "fm10k_tx_timeout"],
["drivers/net/ethernet/intel/i40e/i40e_main.c", "i40e_tx_timeout"],
["drivers/net/ethernet/intel/iavf/iavf_main.c", "iavf_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/ice/ice_main.c", "ice_tx_timeout"],
["drivers/net/ethernet/intel/igb/igb_main.c", "igb_tx_timeout"],
["drivers/net/ethernet/intel/igbvf/netdev.c", "igbvf_tx_timeout"],
["drivers/net/ethernet/intel/ixgb/ixgb_main.c", "ixgb_tx_timeout"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_debugfs.c", "adapter->netdev->netdev_ops->ndo_tx_timeout(adapter->netdev);"],
["drivers/net/ethernet/intel/ixgbe/ixgbe_main.c", "ixgbe_tx_timeout"],
["drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c", "ixgbevf_tx_timeout"],
["drivers/net/ethernet/jme.c", "jme_tx_timeout"],
["drivers/net/ethernet/korina.c", "korina_tx_timeout"],
["drivers/net/ethernet/lantiq_etop.c", "ltq_etop_tx_timeout"],
["drivers/net/ethernet/marvell/mv643xx_eth.c", "mv643xx_eth_tx_timeout"],
["drivers/net/ethernet/marvell/pxa168_eth.c", "pxa168_eth_tx_timeout"],
["drivers/net/ethernet/marvell/skge.c", "skge_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/marvell/sky2.c", "sky2_tx_timeout"],
["drivers/net/ethernet/mediatek/mtk_eth_soc.c", "mtk_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx4/en_netdev.c", "mlx4_en_tx_timeout"],
["drivers/net/ethernet/mellanox/mlx5/core/en_main.c", "mlx5e_tx_timeout"],
["drivers/net/ethernet/micrel/ks8842.c", "ks8842_tx_timeout"],
["drivers/net/ethernet/micrel/ksz884x.c", "netdev_tx_timeout"],
["drivers/net/ethernet/microchip/enc28j60.c", "enc28j60_tx_timeout"],
["drivers/net/ethernet/microchip/encx24j600.c", "encx24j600_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.h", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/sonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/jazzsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/macsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/natsemi/natsemi.c", "ns_tx_timeout"],
["drivers/net/ethernet/natsemi/ns83820.c", "ns83820_tx_timeout"],
["drivers/net/ethernet/natsemi/xtsonic.c", "sonic_tx_timeout"],
["drivers/net/ethernet/neterion/s2io.h", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/s2io.c", "s2io_tx_watchdog"],
["drivers/net/ethernet/neterion/vxge/vxge-main.c", "vxge_tx_watchdog"],
["drivers/net/ethernet/netronome/nfp/nfp_net_common.c", "nfp_net_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/nvidia/forcedeth.c", "nv_tx_timeout"],
["drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c", "pch_gbe_tx_timeout"],
["drivers/net/ethernet/packetengines/hamachi.c", "hamachi_tx_timeout"],
["drivers/net/ethernet/packetengines/yellowfin.c", "yellowfin_tx_timeout"],
["drivers/net/ethernet/pensando/ionic/ionic_lif.c", "ionic_tx_timeout"],
["drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c", "netxen_tx_timeout"],
["drivers/net/ethernet/qlogic/qla3xxx.c", "ql3xxx_tx_timeout"],
["drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c", "qlcnic_tx_timeout"],
["drivers/net/ethernet/qualcomm/emac/emac.c", "emac_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_spi.c", "qcaspi_netdev_tx_timeout"],
["drivers/net/ethernet/qualcomm/qca_uart.c", "qcauart_netdev_tx_timeout"],
["drivers/net/ethernet/rdc/r6040.c", "r6040_tx_timeout"],
["drivers/net/ethernet/realtek/8139cp.c", "cp_tx_timeout"],
["drivers/net/ethernet/realtek/8139too.c", "rtl8139_tx_timeout"],
["drivers/net/ethernet/realtek/atp.c", "tx_timeout"],
["drivers/net/ethernet/realtek/r8169_main.c", "rtl8169_tx_timeout"],
["drivers/net/ethernet/renesas/ravb_main.c", "ravb_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/renesas/sh_eth.c", "sh_eth_tx_timeout"],
["drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c", "sxgbe_tx_timeout"],
["drivers/net/ethernet/seeq/ether3.c", "ether3_timeout"],
["drivers/net/ethernet/seeq/sgiseeq.c", "timeout"],
["drivers/net/ethernet/sfc/efx.c", "efx_watchdog"],
["drivers/net/ethernet/sfc/falcon/efx.c", "ef4_watchdog"],
["drivers/net/ethernet/sgi/ioc3-eth.c", "ioc3_timeout"],
["drivers/net/ethernet/sgi/meth.c", "meth_tx_timeout"],
["drivers/net/ethernet/silan/sc92031.c", "sc92031_tx_timeout"],
["drivers/net/ethernet/sis/sis190.c", "sis190_tx_timeout"],
["drivers/net/ethernet/sis/sis900.c", "sis900_tx_timeout"],
["drivers/net/ethernet/smsc/epic100.c", "epic_tx_timeout"],
["drivers/net/ethernet/smsc/smc911x.c", "smc911x_timeout"],
["drivers/net/ethernet/smsc/smc9194.c", "smc_timeout"],
["drivers/net/ethernet/smsc/smc91c92_cs.c", "smc_tx_timeout"],
["drivers/net/ethernet/smsc/smc91x.c", "smc_timeout"],
["drivers/net/ethernet/stmicro/stmmac/stmmac_main.c", "stmmac_tx_timeout"],
["drivers/net/ethernet/sun/cassini.c", "cas_tx_timeout"],
["drivers/net/ethernet/sun/ldmvsw.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/niu.c", "niu_tx_timeout"],
["drivers/net/ethernet/sun/sunbmac.c", "bigmac_tx_timeout"],
["drivers/net/ethernet/sun/sungem.c", "gem_tx_timeout"],
["drivers/net/ethernet/sun/sunhme.c", "happy_meal_tx_timeout"],
["drivers/net/ethernet/sun/sunqe.c", "qe_tx_timeout"],
["drivers/net/ethernet/sun/sunvnet.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.c", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/sun/sunvnet_common.h", "sunvnet_tx_timeout_common"],
["drivers/net/ethernet/synopsys/dwc-xlgmac-net.c", "xlgmac_tx_timeout"],
["drivers/net/ethernet/ti/cpmac.c", "cpmac_tx_timeout"],
["drivers/net/ethernet/ti/cpsw.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.c", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/cpsw_priv.h", "cpsw_ndo_tx_timeout"],
["drivers/net/ethernet/ti/davinci_emac.c", "emac_dev_tx_timeout"],
["drivers/net/ethernet/ti/netcp_core.c", "netcp_ndo_tx_timeout"],
["drivers/net/ethernet/ti/tlan.c", "tlan_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.h", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_net.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/ps3_gelic_wireless.c", "gelic_net_tx_timeout"],
["drivers/net/ethernet/toshiba/spider_net.c", "spider_net_tx_timeout"],
["drivers/net/ethernet/toshiba/tc35815.c", "tc35815_tx_timeout"],
["drivers/net/ethernet/via/via-rhine.c", "rhine_tx_timeout"],
["drivers/net/ethernet/wiznet/w5100.c", "w5100_tx_timeout"],
["drivers/net/ethernet/wiznet/w5300.c", "w5300_tx_timeout"],
["drivers/net/ethernet/xilinx/xilinx_emaclite.c", "xemaclite_tx_timeout"],
["drivers/net/ethernet/xircom/xirc2ps_cs.c", "xirc_tx_timeout"],
["drivers/net/fjes/fjes_main.c", "fjes_tx_retry"],
["drivers/net/slip/slip.c", "sl_tx_timeout"],
["include/linux/usb/usbnet.h", "usbnet_tx_timeout"],
["drivers/net/usb/aqc111.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/asix_devices.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88172a.c", "usbnet_tx_timeout"],
["drivers/net/usb/ax88179_178a.c", "usbnet_tx_timeout"],
["drivers/net/usb/catc.c", "catc_tx_timeout"],
["drivers/net/usb/cdc_mbim.c", "usbnet_tx_timeout"],
["drivers/net/usb/cdc_ncm.c", "usbnet_tx_timeout"],
["drivers/net/usb/dm9601.c", "usbnet_tx_timeout"],
["drivers/net/usb/hso.c", "hso_net_tx_timeout"],
["drivers/net/usb/int51x1.c", "usbnet_tx_timeout"],
["drivers/net/usb/ipheth.c", "ipheth_tx_timeout"],
["drivers/net/usb/kaweth.c", "kaweth_tx_timeout"],
["drivers/net/usb/lan78xx.c", "lan78xx_tx_timeout"],
["drivers/net/usb/mcs7830.c", "usbnet_tx_timeout"],
["drivers/net/usb/pegasus.c", "pegasus_tx_timeout"],
["drivers/net/usb/qmi_wwan.c", "usbnet_tx_timeout"],
["drivers/net/usb/r8152.c", "rtl8152_tx_timeout"],
["drivers/net/usb/rndis_host.c", "usbnet_tx_timeout"],
["drivers/net/usb/rtl8150.c", "rtl8150_tx_timeout"],
["drivers/net/usb/sierra_net.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc75xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/smsc95xx.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9700.c", "usbnet_tx_timeout"],
["drivers/net/usb/sr9800.c", "usbnet_tx_timeout"],
["drivers/net/usb/usbnet.c", "usbnet_tx_timeout"],
["drivers/net/vmxnet3/vmxnet3_drv.c", "vmxnet3_tx_timeout"],
["drivers/net/wan/cosa.c", "cosa_net_timeout"],
["drivers/net/wan/farsync.c", "fst_tx_timeout"],
["drivers/net/wan/fsl_ucc_hdlc.c", "uhdlc_tx_timeout"],
["drivers/net/wan/lmc/lmc_main.c", "lmc_driver_timeout"],
["drivers/net/wan/x25_asy.c", "x25_asy_timeout"],
["drivers/net/wimax/i2400m/netdev.c", "i2400m_tx_timeout"],
["drivers/net/wireless/intel/ipw2x00/ipw2100.c", "ipw2100_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/hostap/hostap_main.c", "prism2_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/main.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco_usb.c", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/orinoco/orinoco.h", "orinoco_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_dev.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.c", "islpci_eth_tx_timeout"],
["drivers/net/wireless/intersil/prism54/islpci_eth.h", "islpci_eth_tx_timeout"],
["drivers/net/wireless/marvell/mwifiex/main.c", "mwifiex_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.c", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/quantenna/qtnfmac/core.h", "qtnf_netdev_tx_timeout"],
["drivers/net/wireless/rndis_wlan.c", "usbnet_tx_timeout"],
["drivers/net/wireless/wl3501_cs.c", "wl3501_tx_timeout"],
["drivers/net/wireless/zydas/zd1201.c", "zd1201_tx_timeout"],
["drivers/s390/net/qeth_core.h", "qeth_tx_timeout"],
["drivers/s390/net/qeth_core_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l2_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/s390/net/qeth_l3_main.c", "qeth_tx_timeout"],
["drivers/staging/ks7010/ks_wlan_net.c", "ks_wlan_tx_timeout"],
["drivers/staging/qlge/qlge_main.c", "qlge_tx_timeout"],
["drivers/staging/rtl8192e/rtl8192e/rtl_core.c", "_rtl92e_tx_timeout"],
["drivers/staging/rtl8192u/r8192U_core.c", "tx_timeout"],
["drivers/staging/unisys/visornic/visornic_main.c", "visornic_xmit_timeout"],
["drivers/staging/wlan-ng/p80211netdev.c", "p80211knetdev_tx_timeout"],
["drivers/tty/n_gsm.c", "gsm_mux_net_tx_timeout"],
["drivers/tty/synclink.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclink_gt.c", "hdlcdev_tx_timeout"],
["drivers/tty/synclinkmp.c", "hdlcdev_tx_timeout"],
["net/atm/lec.c", "lec_tx_timeout"],
["net/bluetooth/bnep/netdev.c", "bnep_net_timeout"]
);
for my $p (@work) {
my @pair = @$p;
my $file = $pair[0];
my $func = $pair[1];
print STDERR $file , ": ", $func,"\n";
our @ARGV = ($file);
while (<ARGV>) {
if (m/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/) {
print STDERR "found $1+$2 in $file\n";
}
if (s/($func\s*\(struct\s+net_device\s+\*[A-Za-z_]?[A-Za-z-0-9_]*)(\))/$1, unsigned int txqueue$2/) {
print STDERR "$func found in $file\n";
}
print;
}
}
where the list of files and functions is simply from:
git grep ndo_tx_timeout, with manual addition of headers
in the rare cases where the function is from a header,
then manually changing the few places which actually
call ndo_tx_timeout.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: Shannon Nelson <snelson@pensando.io>
Reviewed-by: Martin Habets <mhabets@solarflare.com>
changes from v9:
fixup a forward declaration
changes from v9:
more leftovers from v3 change
changes from v8:
fix up a missing direct call to timeout
rebased on net-next
changes from v7:
fixup leftovers from v3 change
changes from v6:
fix typo in rtl driver
changes from v5:
add missing files (allow any net device argument name)
changes from v4:
add a missing driver header
changes from v3:
change queue # to unsigned
Changes from v2:
added headers
Changes from v1:
Fix errors found by kbuild:
generalize the pattern a bit, to pick up
a couple of instances missed by the previous
version.
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-12-10 22:23:51 +08:00
|
|
|
static void uhdlc_tx_timeout(struct net_device *ndev, unsigned int txqueue)
|
2018-09-03 20:47:30 +08:00
|
|
|
{
|
|
|
|
netdev_err(ndev, "%s\n", __func__);
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
static const struct net_device_ops uhdlc_ops = {
|
|
|
|
.ndo_open = uhdlc_open,
|
|
|
|
.ndo_stop = uhdlc_close,
|
|
|
|
.ndo_start_xmit = hdlc_start_xmit,
|
|
|
|
.ndo_do_ioctl = uhdlc_ioctl,
|
2018-09-03 20:47:30 +08:00
|
|
|
.ndo_tx_timeout = uhdlc_tx_timeout,
|
2016-06-06 14:30:02 +08:00
|
|
|
};
|
|
|
|
|
2019-01-03 01:09:53 +08:00
|
|
|
static int hdlc_map_iomem(char *name, int init_flag, void __iomem **ptr)
|
|
|
|
{
|
|
|
|
struct device_node *np;
|
|
|
|
struct platform_device *pdev;
|
|
|
|
struct resource *res;
|
|
|
|
static int siram_init_flag;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
np = of_find_compatible_node(NULL, NULL, name);
|
|
|
|
if (!np)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
pdev = of_find_device_by_node(np);
|
|
|
|
if (!pdev) {
|
|
|
|
pr_err("%pOFn: failed to lookup pdev\n", np);
|
|
|
|
of_node_put(np);
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
of_node_put(np);
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
|
if (!res) {
|
|
|
|
ret = -EINVAL;
|
|
|
|
goto error_put_device;
|
|
|
|
}
|
|
|
|
*ptr = ioremap(res->start, resource_size(res));
|
|
|
|
if (!*ptr) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto error_put_device;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We've remapped the addresses, and we don't need the device any
|
|
|
|
* more, so we should release it.
|
|
|
|
*/
|
|
|
|
put_device(&pdev->dev);
|
|
|
|
|
|
|
|
if (init_flag && siram_init_flag == 0) {
|
|
|
|
memset_io(*ptr, 0, resource_size(res));
|
|
|
|
siram_init_flag = 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error_put_device:
|
|
|
|
put_device(&pdev->dev);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
static int ucc_hdlc_probe(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct device_node *np = pdev->dev.of_node;
|
|
|
|
struct ucc_hdlc_private *uhdlc_priv = NULL;
|
|
|
|
struct ucc_tdm_info *ut_info;
|
2017-05-17 23:24:33 +08:00
|
|
|
struct ucc_tdm *utdm = NULL;
|
2016-06-06 14:30:02 +08:00
|
|
|
struct resource res;
|
|
|
|
struct net_device *dev;
|
|
|
|
hdlc_device *hdlc;
|
|
|
|
int ucc_num;
|
|
|
|
const char *sprop;
|
|
|
|
int ret;
|
|
|
|
u32 val;
|
|
|
|
|
|
|
|
ret = of_property_read_u32_index(np, "cell-index", 0, &val);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "Invalid ucc property\n");
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
|
|
|
ucc_num = val - 1;
|
2018-09-03 20:47:25 +08:00
|
|
|
if (ucc_num > (UCC_MAX_NUM - 1) || ucc_num < 0) {
|
2016-06-06 14:30:02 +08:00
|
|
|
dev_err(&pdev->dev, ": Invalid UCC num\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(&utdm_info[ucc_num], &utdm_primary_info,
|
|
|
|
sizeof(utdm_primary_info));
|
|
|
|
|
|
|
|
ut_info = &utdm_info[ucc_num];
|
|
|
|
ut_info->uf_info.ucc_num = ucc_num;
|
|
|
|
|
|
|
|
sprop = of_get_property(np, "rx-clock-name", NULL);
|
|
|
|
if (sprop) {
|
|
|
|
ut_info->uf_info.rx_clock = qe_clock_source(sprop);
|
|
|
|
if ((ut_info->uf_info.rx_clock < QE_CLK_NONE) ||
|
|
|
|
(ut_info->uf_info.rx_clock > QE_CLK24)) {
|
|
|
|
dev_err(&pdev->dev, "Invalid rx-clock-name property\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dev_err(&pdev->dev, "Invalid rx-clock-name property\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
sprop = of_get_property(np, "tx-clock-name", NULL);
|
|
|
|
if (sprop) {
|
|
|
|
ut_info->uf_info.tx_clock = qe_clock_source(sprop);
|
|
|
|
if ((ut_info->uf_info.tx_clock < QE_CLK_NONE) ||
|
|
|
|
(ut_info->uf_info.tx_clock > QE_CLK24)) {
|
|
|
|
dev_err(&pdev->dev, "Invalid tx-clock-name property\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
dev_err(&pdev->dev, "Invalid tx-clock-name property\n");
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = of_address_to_resource(np, 0, &res);
|
|
|
|
if (ret)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ut_info->uf_info.regs = res.start;
|
|
|
|
ut_info->uf_info.irq = irq_of_parse_and_map(np, 0);
|
|
|
|
|
|
|
|
uhdlc_priv = kzalloc(sizeof(*uhdlc_priv), GFP_KERNEL);
|
|
|
|
if (!uhdlc_priv) {
|
2016-07-15 10:38:25 +08:00
|
|
|
return -ENOMEM;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dev_set_drvdata(&pdev->dev, uhdlc_priv);
|
|
|
|
uhdlc_priv->dev = &pdev->dev;
|
|
|
|
uhdlc_priv->ut_info = ut_info;
|
|
|
|
|
|
|
|
if (of_get_property(np, "fsl,tdm-interface", NULL))
|
|
|
|
uhdlc_priv->tsa = 1;
|
|
|
|
|
|
|
|
if (of_get_property(np, "fsl,ucc-internal-loopback", NULL))
|
|
|
|
uhdlc_priv->loopback = 1;
|
|
|
|
|
2017-05-17 23:24:38 +08:00
|
|
|
if (of_get_property(np, "fsl,hdlc-bus", NULL))
|
|
|
|
uhdlc_priv->hdlc_bus = 1;
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
if (uhdlc_priv->tsa == 1) {
|
|
|
|
utdm = kzalloc(sizeof(*utdm), GFP_KERNEL);
|
|
|
|
if (!utdm) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
dev_err(&pdev->dev, "No mem to alloc ucc tdm data\n");
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_uhdlc_priv;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
uhdlc_priv->utdm = utdm;
|
|
|
|
ret = ucc_of_parse_tdm(np, utdm, ut_info);
|
|
|
|
if (ret)
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_utdm;
|
2019-01-03 01:09:53 +08:00
|
|
|
|
|
|
|
ret = hdlc_map_iomem("fsl,t1040-qe-si", 0,
|
|
|
|
(void __iomem **)&utdm->si_regs);
|
|
|
|
if (ret)
|
|
|
|
goto free_utdm;
|
|
|
|
ret = hdlc_map_iomem("fsl,t1040-qe-siram", 1,
|
|
|
|
(void __iomem **)&utdm->siram);
|
|
|
|
if (ret)
|
|
|
|
goto unmap_si_regs;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
2018-09-03 20:47:28 +08:00
|
|
|
if (of_property_read_u16(np, "fsl,hmask", &uhdlc_priv->hmask))
|
|
|
|
uhdlc_priv->hmask = DEFAULT_ADDR_MASK;
|
|
|
|
|
2016-06-06 14:30:02 +08:00
|
|
|
ret = uhdlc_init(uhdlc_priv);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(&pdev->dev, "Failed to init uhdlc\n");
|
2019-01-03 01:09:53 +08:00
|
|
|
goto undo_uhdlc_init;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
dev = alloc_hdlcdev(uhdlc_priv);
|
|
|
|
if (!dev) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
pr_err("ucc_hdlc: unable to allocate memory\n");
|
2016-07-15 10:38:25 +08:00
|
|
|
goto undo_uhdlc_init;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
uhdlc_priv->ndev = dev;
|
|
|
|
hdlc = dev_to_hdlc(dev);
|
|
|
|
dev->tx_queue_len = 16;
|
|
|
|
dev->netdev_ops = &uhdlc_ops;
|
2018-09-03 20:47:30 +08:00
|
|
|
dev->watchdog_timeo = 2 * HZ;
|
2016-06-06 14:30:02 +08:00
|
|
|
hdlc->attach = ucc_hdlc_attach;
|
|
|
|
hdlc->xmit = ucc_hdlc_tx;
|
|
|
|
netif_napi_add(dev, &uhdlc_priv->napi, ucc_hdlc_poll, 32);
|
|
|
|
if (register_hdlc_device(dev)) {
|
|
|
|
ret = -ENOBUFS;
|
|
|
|
pr_err("ucc_hdlc: unable to register hdlc device\n");
|
2016-07-15 10:38:25 +08:00
|
|
|
goto free_dev;
|
2016-06-06 14:30:02 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
2016-07-15 10:38:25 +08:00
|
|
|
free_dev:
|
|
|
|
free_netdev(dev);
|
|
|
|
undo_uhdlc_init:
|
2019-01-03 01:09:53 +08:00
|
|
|
iounmap(utdm->siram);
|
|
|
|
unmap_si_regs:
|
|
|
|
iounmap(utdm->si_regs);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_utdm:
|
2016-06-06 14:30:02 +08:00
|
|
|
if (uhdlc_priv->tsa)
|
|
|
|
kfree(utdm);
|
2016-07-15 10:38:25 +08:00
|
|
|
free_uhdlc_priv:
|
2016-06-06 14:30:02 +08:00
|
|
|
kfree(uhdlc_priv);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int ucc_hdlc_remove(struct platform_device *pdev)
|
|
|
|
{
|
|
|
|
struct ucc_hdlc_private *priv = dev_get_drvdata(&pdev->dev);
|
|
|
|
|
|
|
|
uhdlc_memclean(priv);
|
|
|
|
|
|
|
|
if (priv->utdm->si_regs) {
|
|
|
|
iounmap(priv->utdm->si_regs);
|
|
|
|
priv->utdm->si_regs = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (priv->utdm->siram) {
|
|
|
|
iounmap(priv->utdm->siram);
|
|
|
|
priv->utdm->siram = NULL;
|
|
|
|
}
|
|
|
|
kfree(priv);
|
|
|
|
|
|
|
|
dev_info(&pdev->dev, "UCC based hdlc module removed\n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct of_device_id fsl_ucc_hdlc_of_match[] = {
|
|
|
|
{
|
|
|
|
.compatible = "fsl,ucc-hdlc",
|
|
|
|
},
|
|
|
|
{},
|
|
|
|
};
|
|
|
|
|
|
|
|
MODULE_DEVICE_TABLE(of, fsl_ucc_hdlc_of_match);
|
|
|
|
|
|
|
|
static struct platform_driver ucc_hdlc_driver = {
|
|
|
|
.probe = ucc_hdlc_probe,
|
|
|
|
.remove = ucc_hdlc_remove,
|
|
|
|
.driver = {
|
|
|
|
.name = DRV_NAME,
|
|
|
|
.pm = HDLC_PM_OPS,
|
|
|
|
.of_match_table = fsl_ucc_hdlc_of_match,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2016-07-19 19:25:16 +08:00
|
|
|
module_platform_driver(ucc_hdlc_driver);
|
2017-02-17 18:31:22 +08:00
|
|
|
MODULE_LICENSE("GPL");
|