61
61
#define MACB_WOL_HAS_MAGIC_PACKET (0x1 << 0)
62
62
#define MACB_WOL_ENABLED (0x1 << 1)
63
63
64
- /*
65
- * Graceful stop timeouts in us. We should allow up to
64
+ /* Graceful stop timeouts in us. We should allow up to
66
65
* 1 frame time (10 Mbits/s, full-duplex, ignoring collisions)
67
66
*/
68
67
#define MACB_HALT_TIMEOUT 1230
@@ -130,8 +129,7 @@ static void hw_writel(struct macb *bp, int offset, u32 value)
130
129
writel_relaxed (value , bp -> regs + offset );
131
130
}
132
131
133
- /*
134
- * Find the CPU endianness by using the loopback bit of NCR register. When the
132
+ /* Find the CPU endianness by using the loopback bit of NCR register. When the
135
133
* CPU is in big endian we need to program swaped mode for management
136
134
* descriptor access.
137
135
*/
@@ -386,7 +384,8 @@ static int macb_mii_probe(struct net_device *dev)
386
384
387
385
pdata = dev_get_platdata (& bp -> pdev -> dev );
388
386
if (pdata && gpio_is_valid (pdata -> phy_irq_pin )) {
389
- ret = devm_gpio_request (& bp -> pdev -> dev , pdata -> phy_irq_pin , "phy int" );
387
+ ret = devm_gpio_request (& bp -> pdev -> dev , pdata -> phy_irq_pin ,
388
+ "phy int" );
390
389
if (!ret ) {
391
390
phy_irq = gpio_to_irq (pdata -> phy_irq_pin );
392
391
phydev -> irq = (phy_irq < 0 ) ? PHY_POLL : phy_irq ;
@@ -452,7 +451,8 @@ static int macb_mii_init(struct macb *bp)
452
451
err = of_mdiobus_register (bp -> mii_bus , np );
453
452
454
453
/* fallback to standard phy registration if no phy were
455
- found during dt phy registration */
454
+ * found during dt phy registration
455
+ */
456
456
if (!err && !phy_find_first (bp -> mii_bus )) {
457
457
for (i = 0 ; i < PHY_MAX_ADDR ; i ++ ) {
458
458
struct phy_device * phydev ;
@@ -567,17 +567,15 @@ static void macb_tx_error_task(struct work_struct *work)
567
567
/* Make sure nobody is trying to queue up new packets */
568
568
netif_tx_stop_all_queues (bp -> dev );
569
569
570
- /*
571
- * Stop transmission now
570
+ /* Stop transmission now
572
571
* (in case we have just queued new packets)
573
572
* macb/gem must be halted to write TBQP register
574
573
*/
575
574
if (macb_halt_tx (bp ))
576
575
/* Just complain for now, reinitializing TX path can be good */
577
576
netdev_err (bp -> dev , "BUG: halt tx timed out\n" );
578
577
579
- /*
580
- * Treat frames in TX queue including the ones that caused the error.
578
+ /* Treat frames in TX queue including the ones that caused the error.
581
579
* Free transmit buffers in upper layer.
582
580
*/
583
581
for (tail = queue -> tx_tail ; tail != queue -> tx_head ; tail ++ ) {
@@ -607,10 +605,9 @@ static void macb_tx_error_task(struct work_struct *work)
607
605
bp -> stats .tx_bytes += skb -> len ;
608
606
}
609
607
} else {
610
- /*
611
- * "Buffers exhausted mid-frame" errors may only happen
612
- * if the driver is buggy, so complain loudly about those.
613
- * Statistics are updated by hardware.
608
+ /* "Buffers exhausted mid-frame" errors may only happen
609
+ * if the driver is buggy, so complain loudly about
610
+ * those. Statistics are updated by hardware.
614
611
*/
615
612
if (ctrl & MACB_BIT (TX_BUF_EXHAUSTED ))
616
613
netdev_err (bp -> dev ,
@@ -722,7 +719,8 @@ static void gem_rx_refill(struct macb *bp)
722
719
struct sk_buff * skb ;
723
720
dma_addr_t paddr ;
724
721
725
- while (CIRC_SPACE (bp -> rx_prepared_head , bp -> rx_tail , RX_RING_SIZE ) > 0 ) {
722
+ while (CIRC_SPACE (bp -> rx_prepared_head , bp -> rx_tail ,
723
+ RX_RING_SIZE ) > 0 ) {
726
724
entry = macb_rx_ring_wrap (bp -> rx_prepared_head );
727
725
728
726
/* Make hw descriptor updates visible to CPU */
@@ -741,7 +739,8 @@ static void gem_rx_refill(struct macb *bp)
741
739
742
740
/* now fill corresponding descriptor entry */
743
741
paddr = dma_map_single (& bp -> pdev -> dev , skb -> data ,
744
- bp -> rx_buffer_size , DMA_FROM_DEVICE );
742
+ bp -> rx_buffer_size ,
743
+ DMA_FROM_DEVICE );
745
744
if (dma_mapping_error (& bp -> pdev -> dev , paddr )) {
746
745
dev_kfree_skb (skb );
747
746
break ;
@@ -777,14 +776,14 @@ static void discard_partial_frame(struct macb *bp, unsigned int begin,
777
776
778
777
for (frag = begin ; frag != end ; frag ++ ) {
779
778
struct macb_dma_desc * desc = macb_rx_desc (bp , frag );
779
+
780
780
desc -> addr &= ~MACB_BIT (RX_USED );
781
781
}
782
782
783
783
/* Make descriptor updates visible to hardware */
784
784
wmb ();
785
785
786
- /*
787
- * When this happens, the hardware stats registers for
786
+ /* When this happens, the hardware stats registers for
788
787
* whatever caused this is updated, so we don't have to record
789
788
* anything.
790
789
*/
@@ -883,8 +882,7 @@ static int macb_rx_frame(struct macb *bp, unsigned int first_frag,
883
882
macb_rx_ring_wrap (first_frag ),
884
883
macb_rx_ring_wrap (last_frag ), len );
885
884
886
- /*
887
- * The ethernet header starts NET_IP_ALIGN bytes into the
885
+ /* The ethernet header starts NET_IP_ALIGN bytes into the
888
886
* first buffer. Since the header is 14 bytes, this makes the
889
887
* payload word-aligned.
890
888
*
@@ -1099,8 +1097,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
1099
1097
(unsigned long )status );
1100
1098
1101
1099
if (status & MACB_RX_INT_FLAGS ) {
1102
- /*
1103
- * There's no point taking any more interrupts
1100
+ /* There's no point taking any more interrupts
1104
1101
* until we have processed the buffers. The
1105
1102
* scheduling call may fail if the poll routine
1106
1103
* is already scheduled, so disable interrupts
@@ -1129,8 +1126,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
1129
1126
if (status & MACB_BIT (TCOMP ))
1130
1127
macb_tx_interrupt (queue );
1131
1128
1132
- /*
1133
- * Link change detection isn't possible with RMII, so we'll
1129
+ /* Link change detection isn't possible with RMII, so we'll
1134
1130
* add that if/when we get our hands on a full-blown MII PHY.
1135
1131
*/
1136
1132
@@ -1161,8 +1157,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
1161
1157
}
1162
1158
1163
1159
if (status & MACB_BIT (HRESP )) {
1164
- /*
1165
- * TODO: Reset the hardware, and maybe move the
1160
+ /* TODO: Reset the hardware, and maybe move the
1166
1161
* netdev_err to a lower-priority context as well
1167
1162
* (work queue?)
1168
1163
*/
@@ -1181,8 +1176,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
1181
1176
}
1182
1177
1183
1178
#ifdef CONFIG_NET_POLL_CONTROLLER
1184
- /*
1185
- * Polling receive - used by netconsole and other diagnostic tools
1179
+ /* Polling receive - used by netconsole and other diagnostic tools
1186
1180
* to allow network i/o with interrupts disabled.
1187
1181
*/
1188
1182
static void macb_poll_controller (struct net_device * dev )
@@ -1478,10 +1472,10 @@ static int gem_alloc_rx_buffers(struct macb *bp)
1478
1472
bp -> rx_skbuff = kzalloc (size , GFP_KERNEL );
1479
1473
if (!bp -> rx_skbuff )
1480
1474
return - ENOMEM ;
1481
- else
1482
- netdev_dbg (bp -> dev ,
1483
- "Allocated %d RX struct sk_buff entries at %p\n" ,
1484
- RX_RING_SIZE , bp -> rx_skbuff );
1475
+
1476
+ netdev_dbg (bp -> dev ,
1477
+ "Allocated %d RX struct sk_buff entries at %p\n" ,
1478
+ RX_RING_SIZE , bp -> rx_skbuff );
1485
1479
return 0 ;
1486
1480
}
1487
1481
@@ -1494,10 +1488,10 @@ static int macb_alloc_rx_buffers(struct macb *bp)
1494
1488
& bp -> rx_buffers_dma , GFP_KERNEL );
1495
1489
if (!bp -> rx_buffers )
1496
1490
return - ENOMEM ;
1497
- else
1498
- netdev_dbg (bp -> dev ,
1499
- "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n" ,
1500
- size , (unsigned long )bp -> rx_buffers_dma , bp -> rx_buffers );
1491
+
1492
+ netdev_dbg (bp -> dev ,
1493
+ "Allocated RX buffers of %d bytes at %08lx (mapped %p)\n" ,
1494
+ size , (unsigned long )bp -> rx_buffers_dma , bp -> rx_buffers );
1501
1495
return 0 ;
1502
1496
}
1503
1497
@@ -1588,8 +1582,7 @@ static void macb_reset_hw(struct macb *bp)
1588
1582
struct macb_queue * queue ;
1589
1583
unsigned int q ;
1590
1584
1591
- /*
1592
- * Disable RX and TX (XXX: Should we halt the transmission
1585
+ /* Disable RX and TX (XXX: Should we halt the transmission
1593
1586
* more gracefully?)
1594
1587
*/
1595
1588
macb_writel (bp , NCR , 0 );
@@ -1652,8 +1645,7 @@ static u32 macb_mdc_clk_div(struct macb *bp)
1652
1645
return config ;
1653
1646
}
1654
1647
1655
- /*
1656
- * Get the DMA bus width field of the network configuration register that we
1648
+ /* Get the DMA bus width field of the network configuration register that we
1657
1649
* should program. We find the width from decoding the design configuration
1658
1650
* register to find the maximum supported data bus width.
1659
1651
*/
@@ -1673,8 +1665,7 @@ static u32 macb_dbw(struct macb *bp)
1673
1665
}
1674
1666
}
1675
1667
1676
- /*
1677
- * Configure the receive DMA engine
1668
+ /* Configure the receive DMA engine
1678
1669
* - use the correct receive buffer size
1679
1670
* - set best burst length for DMA operations
1680
1671
* (if not supported by FIFO, it will fallback to default)
@@ -1762,8 +1753,7 @@ static void macb_init_hw(struct macb *bp)
1762
1753
macb_writel (bp , NCR , MACB_BIT (RE ) | MACB_BIT (TE ) | MACB_BIT (MPE ));
1763
1754
}
1764
1755
1765
- /*
1766
- * The hash address register is 64 bits long and takes up two
1756
+ /* The hash address register is 64 bits long and takes up two
1767
1757
* locations in the memory map. The least significant bits are stored
1768
1758
* in EMAC_HSL and the most significant bits in EMAC_HSH.
1769
1759
*
@@ -1803,9 +1793,7 @@ static inline int hash_bit_value(int bitnr, __u8 *addr)
1803
1793
return 0 ;
1804
1794
}
1805
1795
1806
- /*
1807
- * Return the hash index value for the specified address.
1808
- */
1796
+ /* Return the hash index value for the specified address. */
1809
1797
static int hash_get_index (__u8 * addr )
1810
1798
{
1811
1799
int i , j , bitval ;
@@ -1821,9 +1809,7 @@ static int hash_get_index(__u8 *addr)
1821
1809
return hash_index ;
1822
1810
}
1823
1811
1824
- /*
1825
- * Add multicast addresses to the internal multicast-hash table.
1826
- */
1812
+ /* Add multicast addresses to the internal multicast-hash table. */
1827
1813
static void macb_sethashtable (struct net_device * dev )
1828
1814
{
1829
1815
struct netdev_hw_addr * ha ;
@@ -1842,9 +1828,7 @@ static void macb_sethashtable(struct net_device *dev)
1842
1828
macb_or_gem_writel (bp , HRT , mc_filter [1 ]);
1843
1829
}
1844
1830
1845
- /*
1846
- * Enable/Disable promiscuous and multicast modes.
1847
- */
1831
+ /* Enable/Disable promiscuous and multicast modes. */
1848
1832
static void macb_set_rx_mode (struct net_device * dev )
1849
1833
{
1850
1834
unsigned long cfg ;
@@ -2161,9 +2145,8 @@ static void macb_get_regs(struct net_device *dev, struct ethtool_regs *regs,
2161
2145
2162
2146
if (!(bp -> caps & MACB_CAPS_USRIO_DISABLED ))
2163
2147
regs_buff [12 ] = macb_or_gem_readl (bp , USRIO );
2164
- if (macb_is_gem (bp )) {
2148
+ if (macb_is_gem (bp ))
2165
2149
regs_buff [13 ] = gem_readl (bp , DMACFG );
2166
- }
2167
2150
}
2168
2151
2169
2152
static void macb_get_wol (struct net_device * netdev , struct ethtool_wolinfo * wol )
@@ -2286,11 +2269,11 @@ static const struct net_device_ops macb_netdev_ops = {
2286
2269
.ndo_set_features = macb_set_features ,
2287
2270
};
2288
2271
2289
- /*
2290
- * Configure peripheral capabilities according to device tree
2272
+ /* Configure peripheral capabilities according to device tree
2291
2273
* and integration options used
2292
2274
*/
2293
- static void macb_configure_caps (struct macb * bp , const struct macb_config * dt_conf )
2275
+ static void macb_configure_caps (struct macb * bp ,
2276
+ const struct macb_config * dt_conf )
2294
2277
{
2295
2278
u32 dcfg ;
2296
2279
@@ -2996,6 +2979,7 @@ static int macb_probe(struct platform_device *pdev)
2996
2979
phy_node = of_get_next_available_child (np , NULL );
2997
2980
if (phy_node ) {
2998
2981
int gpio = of_get_named_gpio (phy_node , "reset-gpios" , 0 );
2982
+
2999
2983
if (gpio_is_valid (gpio )) {
3000
2984
bp -> reset_gpio = gpio_to_desc (gpio );
3001
2985
gpiod_direction_output (bp -> reset_gpio , 1 );
0 commit comments