Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1864cfb authored by David S. Miller's avatar David S. Miller
Browse files
parents 9b97b84e da2e8526
Loading
Loading
Loading
Loading
+25 −19
Original line number Diff line number Diff line
@@ -10,8 +10,8 @@ Currently this network device driver is for all STM embedded MAC/GMAC
(i.e. 7xxx/5xxx SoCs), SPEAr (arm), Loongson1B (mips) and XLINX XC2V3000
FF1152AMT0221 D1215994A VIRTEX FPGA board.

DWC Ether MAC 10/100/1000 Universal version 3.60a (and older) and DWC Ether MAC 10/100
Universal version 4.0 have been used for developing this driver.
DWC Ether MAC 10/100/1000 Universal version 3.60a (and older) and DWC Ether
MAC 10/100 Universal version 4.0 have been used for developing this driver.

This driver supports both the platform bus and PCI.

@@ -54,27 +54,27 @@ net_device structure enabling the scatter/gather feature.
When one or more packets are received, an interrupt happens. The interrupts
are not queued so the driver has to scan all the descriptors in the ring during
the receive process.
This is based on NAPI so the interrupt handler signals only if there is work to be
done, and it exits.
This is based on NAPI so the interrupt handler signals only if there is work
to be done, and it exits.
Then the poll method will be scheduled at some future point.
The incoming packets are stored, by the DMA, in a list of pre-allocated socket
buffers in order to avoid the memcpy (Zero-copy).

4.3) Timer-Driver Interrupt
Instead of having the device that asynchronously notifies the frame receptions, the
driver configures a timer to generate an interrupt at regular intervals.
Based on the granularity of the timer, the frames that are received by the device
will experience different levels of latency. Some NICs have dedicated timer
device to perform this task. STMMAC can use either the RTC device or the TMU
channel 2  on STLinux platforms.
Instead of having the device that asynchronously notifies the frame receptions,
the driver configures a timer to generate an interrupt at regular intervals.
Based on the granularity of the timer, the frames that are received by the
device will experience different levels of latency. Some NICs have dedicated
timer device to perform this task. STMMAC can use either the RTC device or the
TMU channel 2  on STLinux platforms.
The timers frequency can be passed to the driver as parameter; when change it,
take care of both hardware capability and network stability/performance impact.
Several performance tests on STM platforms showed this optimisation allows to spare
the CPU while having the maximum throughput.
Several performance tests on STM platforms showed this optimisation allows to
spare the CPU while having the maximum throughput.

4.4) WOL
Wake up on Lan feature through Magic and Unicast frames are supported for the GMAC
core.
Wake up on Lan feature through Magic and Unicast frames are supported for the
GMAC core.

4.5) DMA descriptors
Driver handles both normal and enhanced descriptors. The latter has been only
@@ -107,6 +107,7 @@ These are included in the include/linux/stmmac.h header file
and detailed below as well:

struct plat_stmmacenet_data {
	char *phy_bus_name;
	int bus_id;
	int phy_addr;
	int interface;
@@ -124,19 +125,24 @@ and detailed below as well:
	void (*bus_setup)(void __iomem *ioaddr);
	int (*init)(struct platform_device *pdev);
	void (*exit)(struct platform_device *pdev);
	void *custom_cfg;
	void *custom_data;
	void *bsp_priv;
 };

Where:
 o phy_bus_name: phy bus name to attach to the stmmac.
 o bus_id: bus identifier.
 o phy_addr: the physical address can be passed from the platform.
	    If it is set to -1 the driver will automatically
	    detect it at run-time by probing all the 32 addresses.
 o interface: PHY device's interface.
 o mdio_bus_data: specific platform fields for the MDIO bus.
 o dma_cfg: internal DMA parameters
   o pbl: the Programmable Burst Length is maximum number of beats to
       be transferred in one DMA transaction.
       GMAC also enables the 4xPBL by default.
   o fixed_burst/mixed_burst/burst_len
 o clk_csr: fixed CSR Clock range selection.
 o has_gmac: uses the GMAC core.
 o enh_desc: if sets the MAC will use the enhanced descriptor structure.
@@ -160,8 +166,9 @@ Where:
	     this is sometime necessary on some platforms (e.g. ST boxes)
	     where the HW needs to have set some PIO lines or system cfg
	     registers.
 o custom_cfg: this is a custom configuration that can be passed while
	      initialising the resources.
 o custom_cfg/custom_data: this is a custom configuration that can be passed
			   while initialising the resources.
 o bsp_priv: another private poiter.

For MDIO bus The we have:

@@ -180,7 +187,6 @@ Where:
 o irqs: list of IRQs, one per PHY.
 o probed_phy_irq: if irqs is NULL, use this for probed PHY.


For DMA engine we have the following internal fields that should be
tuned according to the HW capabilities.

+3 −1
Original line number Diff line number Diff line
@@ -139,7 +139,9 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc)
		bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7);
		break;
	case 0x4331:
		/* BCM4331 workaround is SPROM-related, we put it in sprom.c */
	case 43431:
		/* Ext PA lines must be enabled for tx on BCM4331 */
		bcma_chipco_bcm4331_ext_pa_lines_ctl(cc, true);
		break;
	case 43224:
		if (bus->chipinfo.rev == 0) {
+2 −2
Original line number Diff line number Diff line
@@ -579,13 +579,13 @@ int bcma_sprom_get(struct bcma_bus *bus)
	if (!sprom)
		return -ENOMEM;

	if (bus->chipinfo.id == 0x4331)
	if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
		bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false);

	pr_debug("SPROM offset 0x%x\n", offset);
	bcma_sprom_read(bus, offset, sprom);

	if (bus->chipinfo.id == 0x4331)
	if (bus->chipinfo.id == 0x4331 || bus->chipinfo.id == 43431)
		bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true);

	err = bcma_sprom_valid(sprom);
+9 −7
Original line number Diff line number Diff line
@@ -686,7 +686,7 @@ static int c_can_get_berr_counter(const struct net_device *dev,
 *
 * We iterate from priv->tx_echo to priv->tx_next and check if the
 * packet has been transmitted, echo it back to the CAN framework.
 * If we discover a not yet transmitted package, stop looking for more.
 * If we discover a not yet transmitted packet, stop looking for more.
 */
static void c_can_do_tx(struct net_device *dev)
{
@@ -698,7 +698,7 @@ static void c_can_do_tx(struct net_device *dev)
	for (/* nix */; (priv->tx_next - priv->tx_echo) > 0; priv->tx_echo++) {
		msg_obj_no = get_tx_echo_msg_obj(priv);
		val = c_can_read_reg32(priv, &priv->regs->txrqst1);
		if (!(val & (1 << msg_obj_no))) {
		if (!(val & (1 << (msg_obj_no - 1)))) {
			can_get_echo_skb(dev,
					msg_obj_no - C_CAN_MSG_OBJ_TX_FIRST);
			stats->tx_bytes += priv->read_reg(priv,
@@ -706,6 +706,8 @@ static void c_can_do_tx(struct net_device *dev)
					& IF_MCONT_DLC_MASK;
			stats->tx_packets++;
			c_can_inval_msg_object(dev, 0, msg_obj_no);
		} else {
			break;
		}
	}

@@ -950,7 +952,7 @@ static int c_can_poll(struct napi_struct *napi, int quota)
	struct net_device *dev = napi->dev;
	struct c_can_priv *priv = netdev_priv(dev);

	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
	irqstatus = priv->irqstatus;
	if (!irqstatus)
		goto end;

@@ -1028,12 +1030,11 @@ static int c_can_poll(struct napi_struct *napi, int quota)

static irqreturn_t c_can_isr(int irq, void *dev_id)
{
	u16 irqstatus;
	struct net_device *dev = (struct net_device *)dev_id;
	struct c_can_priv *priv = netdev_priv(dev);

	irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
	if (!irqstatus)
	priv->irqstatus = priv->read_reg(priv, &priv->regs->interrupt);
	if (!priv->irqstatus)
		return IRQ_NONE;

	/* disable all interrupts and schedule the NAPI */
@@ -1063,10 +1064,11 @@ static int c_can_open(struct net_device *dev)
		goto exit_irq_fail;
	}

	napi_enable(&priv->napi);

	/* start the c_can controller */
	c_can_start(dev);

	napi_enable(&priv->napi);
	netif_start_queue(dev);

	return 0;
+1 −0
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ struct c_can_priv {
	unsigned int tx_next;
	unsigned int tx_echo;
	void *priv;		/* for board-specific data */
	u16 irqstatus;
};

struct net_device *alloc_c_can_dev(void);
Loading