Skip to contentSkip to conversation

ks8842: Support DMA when accessed via timberdale

PATCH Superseded Richard Röjfors 2 participants 2 messages Jul 27, 2010

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ks8842: Support DMA when accessed via timberdale

This patch adds support for RX and TX DMA via the DMA API, this is only supported when the KS8842 is accessed via timberdale.

There is no support for DMA on the generic bus interface it self, a state machine inside the FPGA is handling RX and TX transfers to/from buffers in the FPGA. The host CPU can do DMA to and from these buffers.

The FPGA has to handle the RX interrupts, so these must be enabled in the ks8842 but not in the FPGA. The driver must not disable the RX interrupt that would mean that the data transfers into the FPGA buffers would stop.

The host shall not enable TX interrupts since TX is handled by the FPGA, the host is notified by DMA callbacks when transfers are finished.

Which DMA channels to use are added as parameters in the platform data struct.

---

drivers/net/Kconfig +10 -0
index 70b98e7..386e283 100644
@@ -1757,6 +1757,16 @@ config KS8842
 	 ethernet switch chip (managed, VLAN, QoS) from Micrel or
 	 Timberdale(FPGA).
 
+config KS8842_TIMB_DMA
+	bool "Use Timberdale specific DMA engine"
+	depends on KS8842 && MFD_TIMBERDALE
+	select CONFIG_TIMB_DMA
+	help
+	  This option enables usage of the timberdale specific DMA engine
+	  for the KS8842 driver. Rather than using PIO which results in
+	  single accesses over PCIe, the DMA block of the timberdale FPGA
+	  will burst data to and from the KS8842.
+
 config KS8851
        tristate "Micrel KS8851 SPI"
        depends on SPI
drivers/net/ks8842.c +483 -22

635 lines not on this page · raw message

include/linux/ks8842.h +4 -0
index da0341b..953b3fb 100644
@@ -25,10 +25,14 @@
  * struct ks8842_platform_data - Platform data of the KS8842 network driver
  * @macaddr:	The MAC address of the device, set to all 0:s to use the on in
  *		the chip.
+ * @rx_dma_channel:	The DMA channel to use for RX, -1 for none.
+ * @tx_dma_channel:	The DMA channel to use for RX, -1 for none.
  *
  */
 struct ks8842_platform_data {
 	u8 macaddr[ETH_ALEN];
+	int rx_dma_channel;
+	int tx_dma_channel;
 };
 
 #endif
maintainer
#1 lore raw

From: Richard Röjfors <[email protected]>
Date: Tue, 27 Jul 2010 11:18:17 +0200

Quoted 11 lines

This patch adds support for RX and TX DMA via the DMA API, this is only supported when the KS8842 is accessed via timberdale.

There is no support for DMA on the generic bus interface it self, a state machine inside the FPGA is handling RX and TX transfers to/from buffers in the FPGA. The host CPU can do DMA to and from these buffers.

The FPGA has to handle the RX interrupts, so these must be enabled in the ks8842 but not in the FPGA. The driver must not disable the RX interrupt that would mean that the data transfers into the FPGA buffers would stop.

Quoted 6 lines

The host shall not enable TX interrupts since TX is handled by the FPGA, the host is notified by DMA callbacks when transfers are finished.

Which DMA channels to use are added as parameters in the platform data struct.

Please, no more crazy config options, make the code dynamically use DMA or not based upon information passed in via the platform_device object at probe time.