Commit c91b7f66 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: bcmgenet: re-align multiple lines correctly

checkpatch.pl flagged a lot of "CHECK: Alignment should match open
parenthesis" checks, fix all of them to make the driver neater. While
at it fix some obvious typos and re-arrange some of the lines to avoid
going over 80 columns.
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5e811b39
...@@ -333,8 +333,7 @@ static inline u32 bcmgenet_tdma_ring_readl(struct bcmgenet_priv *priv, ...@@ -333,8 +333,7 @@ static inline u32 bcmgenet_tdma_ring_readl(struct bcmgenet_priv *priv,
} }
static inline void bcmgenet_tdma_ring_writel(struct bcmgenet_priv *priv, static inline void bcmgenet_tdma_ring_writel(struct bcmgenet_priv *priv,
unsigned int ring, unsigned int ring, u32 val,
u32 val,
enum dma_ring_reg r) enum dma_ring_reg r)
{ {
__raw_writel(val, priv->base + GENET_TDMA_REG_OFF + __raw_writel(val, priv->base + GENET_TDMA_REG_OFF +
...@@ -352,8 +351,7 @@ static inline u32 bcmgenet_rdma_ring_readl(struct bcmgenet_priv *priv, ...@@ -352,8 +351,7 @@ static inline u32 bcmgenet_rdma_ring_readl(struct bcmgenet_priv *priv,
} }
static inline void bcmgenet_rdma_ring_writel(struct bcmgenet_priv *priv, static inline void bcmgenet_rdma_ring_writel(struct bcmgenet_priv *priv,
unsigned int ring, unsigned int ring, u32 val,
u32 val,
enum dma_ring_reg r) enum dma_ring_reg r)
{ {
__raw_writel(val, priv->base + GENET_RDMA_REG_OFF + __raw_writel(val, priv->base + GENET_RDMA_REG_OFF +
...@@ -634,8 +632,8 @@ static int bcmgenet_get_sset_count(struct net_device *dev, int string_set) ...@@ -634,8 +632,8 @@ static int bcmgenet_get_sset_count(struct net_device *dev, int string_set)
} }
} }
static void bcmgenet_get_strings(struct net_device *dev, static void bcmgenet_get_strings(struct net_device *dev, u32 stringset,
u32 stringset, u8 *data) u8 *data)
{ {
int i; int i;
...@@ -669,8 +667,8 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv) ...@@ -669,8 +667,8 @@ static void bcmgenet_update_mib_counters(struct bcmgenet_priv *priv)
case BCMGENET_STAT_RUNT: case BCMGENET_STAT_RUNT:
if (s->type != BCMGENET_STAT_MIB_RX) if (s->type != BCMGENET_STAT_MIB_RX)
offset = BCMGENET_STAT_OFFSET; offset = BCMGENET_STAT_OFFSET;
val = bcmgenet_umac_readl(priv, UMAC_MIB_START + val = bcmgenet_umac_readl(priv,
j + offset); UMAC_MIB_START + j + offset);
break; break;
case BCMGENET_STAT_MISC: case BCMGENET_STAT_MISC:
val = bcmgenet_umac_readl(priv, s->reg_offset); val = bcmgenet_umac_readl(priv, s->reg_offset);
...@@ -856,16 +854,16 @@ static inline void bcmgenet_tx_ring16_int_enable(struct bcmgenet_priv *priv, ...@@ -856,16 +854,16 @@ static inline void bcmgenet_tx_ring16_int_enable(struct bcmgenet_priv *priv,
static inline void bcmgenet_tx_ring_int_enable(struct bcmgenet_priv *priv, static inline void bcmgenet_tx_ring_int_enable(struct bcmgenet_priv *priv,
struct bcmgenet_tx_ring *ring) struct bcmgenet_tx_ring *ring)
{ {
bcmgenet_intrl2_1_writel(priv, bcmgenet_intrl2_1_writel(priv, (1 << ring->index),
(1 << ring->index), INTRL2_CPU_MASK_CLEAR); INTRL2_CPU_MASK_CLEAR);
priv->int1_mask &= ~(1 << ring->index); priv->int1_mask &= ~(1 << ring->index);
} }
static inline void bcmgenet_tx_ring_int_disable(struct bcmgenet_priv *priv, static inline void bcmgenet_tx_ring_int_disable(struct bcmgenet_priv *priv,
struct bcmgenet_tx_ring *ring) struct bcmgenet_tx_ring *ring)
{ {
bcmgenet_intrl2_1_writel(priv, bcmgenet_intrl2_1_writel(priv, (1 << ring->index),
(1 << ring->index), INTRL2_CPU_MASK_SET); INTRL2_CPU_MASK_SET);
priv->int1_mask |= (1 << ring->index); priv->int1_mask |= (1 << ring->index);
} }
...@@ -1173,7 +1171,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1173,7 +1171,8 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
for (i = 0; i < nr_frags; i++) { for (i = 0; i < nr_frags; i++) {
ret = bcmgenet_xmit_frag(dev, ret = bcmgenet_xmit_frag(dev,
&skb_shinfo(skb)->frags[i], &skb_shinfo(skb)->frags[i],
(i == nr_frags - 1) ? DMA_EOP : 0, ring); (i == nr_frags - 1) ? DMA_EOP : 0,
ring);
if (ret) { if (ret) {
ret = NETDEV_TX_OK; ret = NETDEV_TX_OK;
goto out; goto out;
...@@ -1200,16 +1199,14 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1200,16 +1199,14 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
} }
static int bcmgenet_rx_refill(struct bcmgenet_priv *priv, static int bcmgenet_rx_refill(struct bcmgenet_priv *priv, struct enet_cb *cb)
struct enet_cb *cb)
{ {
struct device *kdev = &priv->pdev->dev; struct device *kdev = &priv->pdev->dev;
struct sk_buff *skb; struct sk_buff *skb;
dma_addr_t mapping; dma_addr_t mapping;
int ret; int ret;
skb = netdev_alloc_skb(priv->dev, skb = netdev_alloc_skb(priv->dev, priv->rx_buf_len + SKB_ALIGNMENT);
priv->rx_buf_len + SKB_ALIGNMENT);
if (!skb) if (!skb)
return -ENOMEM; return -ENOMEM;
...@@ -1257,8 +1254,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, ...@@ -1257,8 +1254,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
unsigned int p_index; unsigned int p_index;
unsigned int chksum_ok = 0; unsigned int chksum_ok = 0;
p_index = bcmgenet_rdma_ring_readl(priv, p_index = bcmgenet_rdma_ring_readl(priv, DESC_INDEX, RDMA_PROD_INDEX);
DESC_INDEX, RDMA_PROD_INDEX);
p_index &= DMA_P_INDEX_MASK; p_index &= DMA_P_INDEX_MASK;
if (p_index < priv->rx_c_index) if (p_index < priv->rx_c_index)
...@@ -1283,7 +1279,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, ...@@ -1283,7 +1279,8 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
priv->rx_buf_len, DMA_FROM_DEVICE); priv->rx_buf_len, DMA_FROM_DEVICE);
if (!priv->desc_64b_en) { if (!priv->desc_64b_en) {
dma_length_status = dmadesc_get_length_status(priv, dma_length_status =
dmadesc_get_length_status(priv,
priv->rx_bds + priv->rx_bds +
(priv->rx_read_ptr * (priv->rx_read_ptr *
DMA_DESC_SIZE)); DMA_DESC_SIZE));
...@@ -1300,9 +1297,9 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, ...@@ -1300,9 +1297,9 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
len = dma_length_status >> DMA_BUFLENGTH_SHIFT; len = dma_length_status >> DMA_BUFLENGTH_SHIFT;
netif_dbg(priv, rx_status, dev, netif_dbg(priv, rx_status, dev,
"%s: p_ind=%d c_ind=%d read_ptr=%d len_stat=0x%08x\n", "%s:p_ind=%d c_ind=%d read_ptr=%d len_stat=0x%08x\n",
__func__, p_index, priv->rx_c_index, priv->rx_read_ptr, __func__, p_index, priv->rx_c_index,
dma_length_status); priv->rx_read_ptr, dma_length_status);
rxpktprocessed++; rxpktprocessed++;
...@@ -1318,7 +1315,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, ...@@ -1318,7 +1315,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv,
if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) { if (unlikely(!(dma_flag & DMA_EOP) || !(dma_flag & DMA_SOP))) {
netif_err(priv, rx_status, dev, netif_err(priv, rx_status, dev,
"Droping fragmented packet!\n"); "dropping fragmented packet!\n");
dev->stats.rx_dropped++; dev->stats.rx_dropped++;
dev->stats.rx_errors++; dev->stats.rx_errors++;
dev_kfree_skb_any(cb->skb); dev_kfree_skb_any(cb->skb);
...@@ -1437,8 +1434,7 @@ static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv) ...@@ -1437,8 +1434,7 @@ static void bcmgenet_free_rx_buffers(struct bcmgenet_priv *priv)
} }
} }
static void umac_enable_set(struct bcmgenet_priv *priv, u32 mask, static void umac_enable_set(struct bcmgenet_priv *priv, u32 mask, bool enable)
bool enable)
{ {
u32 reg; u32 reg;
...@@ -1514,7 +1510,8 @@ static int init_umac(struct bcmgenet_priv *priv) ...@@ -1514,7 +1510,8 @@ static int init_umac(struct bcmgenet_priv *priv)
bcmgenet_umac_writel(priv, 0, UMAC_CMD); bcmgenet_umac_writel(priv, 0, UMAC_CMD);
/* clear tx/rx counter */ /* clear tx/rx counter */
bcmgenet_umac_writel(priv, bcmgenet_umac_writel(priv,
MIB_RESET_RX | MIB_RESET_TX | MIB_RESET_RUNT, UMAC_MIB_CTRL); MIB_RESET_RX | MIB_RESET_TX | MIB_RESET_RUNT,
UMAC_MIB_CTRL);
bcmgenet_umac_writel(priv, 0, UMAC_MIB_CTRL); bcmgenet_umac_writel(priv, 0, UMAC_MIB_CTRL);
bcmgenet_umac_writel(priv, ENET_MAX_MTU_SIZE, UMAC_MAX_FRAME_LEN); bcmgenet_umac_writel(priv, ENET_MAX_MTU_SIZE, UMAC_MAX_FRAME_LEN);
...@@ -1554,8 +1551,7 @@ static int init_umac(struct bcmgenet_priv *priv) ...@@ -1554,8 +1551,7 @@ static int init_umac(struct bcmgenet_priv *priv)
if (priv->hw_params->flags & GENET_HAS_MDIO_INTR) if (priv->hw_params->flags & GENET_HAS_MDIO_INTR)
cpu_mask_clear |= UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR; cpu_mask_clear |= UMAC_IRQ_MDIO_DONE | UMAC_IRQ_MDIO_ERROR;
bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, bcmgenet_intrl2_0_writel(priv, cpu_mask_clear, INTRL2_CPU_MASK_CLEAR);
INTRL2_CPU_MASK_CLEAR);
/* Enable rx/tx engine.*/ /* Enable rx/tx engine.*/
dev_dbg(kdev, "done init umac\n"); dev_dbg(kdev, "done init umac\n");
...@@ -1607,8 +1603,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, ...@@ -1607,8 +1603,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
TDMA_FLOW_PERIOD); TDMA_FLOW_PERIOD);
/* Unclassified traffic goes to ring 16 */ /* Unclassified traffic goes to ring 16 */
bcmgenet_tdma_ring_writel(priv, index, bcmgenet_tdma_ring_writel(priv, index,
((size << DMA_RING_SIZE_SHIFT) | RX_BUF_LENGTH), ((size << DMA_RING_SIZE_SHIFT) |
DMA_RING_BUF_SIZE); RX_BUF_LENGTH), DMA_RING_BUF_SIZE);
first_bd = write_ptr; first_bd = write_ptr;
...@@ -1651,13 +1647,14 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv, ...@@ -1651,13 +1647,14 @@ static int bcmgenet_init_rx_ring(struct bcmgenet_priv *priv,
bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_PROD_INDEX); bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_PROD_INDEX);
bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_CONS_INDEX); bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_CONS_INDEX);
bcmgenet_rdma_ring_writel(priv, index, bcmgenet_rdma_ring_writel(priv, index,
((size << DMA_RING_SIZE_SHIFT) | RX_BUF_LENGTH), ((size << DMA_RING_SIZE_SHIFT) |
DMA_RING_BUF_SIZE); RX_BUF_LENGTH), DMA_RING_BUF_SIZE);
bcmgenet_rdma_ring_writel(priv, index, 0, DMA_START_ADDR); bcmgenet_rdma_ring_writel(priv, index, 0, DMA_START_ADDR);
bcmgenet_rdma_ring_writel(priv, index, bcmgenet_rdma_ring_writel(priv, index,
words_per_bd * size - 1, DMA_END_ADDR); words_per_bd * size - 1, DMA_END_ADDR);
bcmgenet_rdma_ring_writel(priv, index, bcmgenet_rdma_ring_writel(priv, index,
(DMA_FC_THRESH_LO << DMA_XOFF_THRESHOLD_SHIFT) | (DMA_FC_THRESH_LO <<
DMA_XOFF_THRESHOLD_SHIFT) |
DMA_FC_THRESH_HI, RDMA_XON_XOFF_THRESH); DMA_FC_THRESH_HI, RDMA_XON_XOFF_THRESH);
bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_READ_PTR); bcmgenet_rdma_ring_writel(priv, index, 0, RDMA_READ_PTR);
...@@ -1789,7 +1786,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv) ...@@ -1789,7 +1786,8 @@ static int bcmgenet_init_dma(struct bcmgenet_priv *priv)
/* initialize special ring 16 */ /* initialize special ring 16 */
bcmgenet_init_tx_ring(priv, DESC_INDEX, GENET_DEFAULT_BD_CNT, bcmgenet_init_tx_ring(priv, DESC_INDEX, GENET_DEFAULT_BD_CNT,
priv->hw_params->tx_queues * priv->hw_params->bds_cnt, priv->hw_params->tx_queues *
priv->hw_params->bds_cnt,
TOTAL_DESC); TOTAL_DESC);
return 0; return 0;
...@@ -1814,8 +1812,8 @@ static int bcmgenet_poll(struct napi_struct *napi, int budget) ...@@ -1814,8 +1812,8 @@ static int bcmgenet_poll(struct napi_struct *napi, int budget)
priv->rx_c_index, RDMA_CONS_INDEX); priv->rx_c_index, RDMA_CONS_INDEX);
if (work_done < budget) { if (work_done < budget) {
napi_complete(napi); napi_complete(napi);
bcmgenet_intrl2_0_writel(priv, bcmgenet_intrl2_0_writel(priv, UMAC_IRQ_RXDMA_BDONE,
UMAC_IRQ_RXDMA_BDONE, INTRL2_CPU_MASK_CLEAR); INTRL2_CPU_MASK_CLEAR);
} }
return work_done; return work_done;
...@@ -1895,8 +1893,8 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id) ...@@ -1895,8 +1893,8 @@ static irqreturn_t bcmgenet_isr0(int irq, void *dev_id)
* Disable interrupt, will be enabled in the poll method. * Disable interrupt, will be enabled in the poll method.
*/ */
if (likely(napi_schedule_prep(&priv->napi))) { if (likely(napi_schedule_prep(&priv->napi))) {
bcmgenet_intrl2_0_writel(priv, bcmgenet_intrl2_0_writel(priv, UMAC_IRQ_RXDMA_BDONE,
UMAC_IRQ_RXDMA_BDONE, INTRL2_CPU_MASK_SET); INTRL2_CPU_MASK_SET);
__napi_schedule(&priv->napi); __napi_schedule(&priv->napi);
} }
} }
...@@ -2118,8 +2116,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) ...@@ -2118,8 +2116,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
} }
if (timeout == DMA_TIMEOUT_VAL) { if (timeout == DMA_TIMEOUT_VAL) {
netdev_warn(priv->dev, netdev_warn(priv->dev, "Timed out while disabling TX DMA\n");
"Timed out while disabling TX DMA\n");
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
} }
...@@ -2142,8 +2139,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv) ...@@ -2142,8 +2139,7 @@ static int bcmgenet_dma_teardown(struct bcmgenet_priv *priv)
} }
if (timeout == DMA_TIMEOUT_VAL) { if (timeout == DMA_TIMEOUT_VAL) {
netdev_warn(priv->dev, netdev_warn(priv->dev, "Timed out while disabling RX DMA\n");
"Timed out while disabling RX DMA\n");
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
} }
...@@ -2223,10 +2219,9 @@ static inline void bcmgenet_set_mdf_addr(struct bcmgenet_priv *priv, ...@@ -2223,10 +2219,9 @@ static inline void bcmgenet_set_mdf_addr(struct bcmgenet_priv *priv,
{ {
u32 reg; u32 reg;
bcmgenet_umac_writel(priv, bcmgenet_umac_writel(priv, addr[0] << 8 | addr[1],
addr[0] << 8 | addr[1], UMAC_MDF_ADDR + (*i * 4)); UMAC_MDF_ADDR + (*i * 4));
bcmgenet_umac_writel(priv, bcmgenet_umac_writel(priv, addr[2] << 24 | addr[3] << 16 |
addr[2] << 24 | addr[3] << 16 |
addr[4] << 8 | addr[5], addr[4] << 8 | addr[5],
UMAC_MDF_ADDR + ((*i + 1) * 4)); UMAC_MDF_ADDR + ((*i + 1) * 4));
reg = bcmgenet_umac_readl(priv, UMAC_MDF_CTRL); reg = bcmgenet_umac_readl(priv, UMAC_MDF_CTRL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment