Skip to contentSkip to conversation

Making use of VNICs in the sfc driver

RFC PATCH New Robert Stonehouse 1 participant 1 message Jun 13, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/2 Making use of VNICs in the sfc driver

---
 drivers/net/sfc/Kconfig         |    8 +
 drivers/net/sfc/Makefile        |    3 +
 drivers/net/sfc/driverlink.c    |    4 +-
 drivers/net/sfc/efx.c           |    1 +
 drivers/net/sfc/falcon.c        |  181 ++++++++++--
 drivers/net/sfc/falcon_hwdefs.h |   21 ++
 drivers/net/sfc/mtd.c           |  592 +++++++++++++++++++++++++++++++++++++++
 drivers/net/sfc/net_driver.h    |    9 +
 drivers/net/sfc/spi.h           |   98 +++++++
 9 files changed, 887 insertions(+), 30 deletions(-)
 create mode 100644 drivers/net/sfc/mtd.c
drivers/net/sfc/Kconfig +8 -0
index 3be13b5..0603ead 100644
@@ -12,3 +12,11 @@ config SFC
 
 	  To compile this driver as a module, choose M here.  The module
 	  will be called sfc.
+
+config SFC_MTD
+	depends on SFC && MTD && MTD_PARTITIONS
+	tristate "Solarflare Solarstorm SFC4000 flash/EEPROM support"
+	help
+	  This module exposes the on-board flash and/or EEPROM memory as
+	  MTD devices (e.g. /dev/mtd1).  This makes it possible to upload a
+	  new boot ROM to the NIC.
drivers/net/sfc/Makefile +3 -0
index aa3bff7..738649a 100644
@@ -3,3 +3,6 @@ sfc-y			+= efx.o falcon.o tx.o rx.o falcon_xmac.o \
 			   mdio_10g.o tenxpress.o boards.o sfe4001.o \
 			   driverlink.o
 obj-$(CONFIG_SFC)	+= sfc.o
+
+sfc_mtd-y		+= mtd.o
+obj-$(CONFIG_SFC_MTD)	+= sfc_mtd.o
drivers/net/sfc/driverlink.c +2 -2
index 93f29d5..6c33aeb 100644
@@ -80,7 +80,7 @@ static void efx_dl_try_add_device(struct efx_nic *efx,
 {
 	struct efx_dl_handle *efx_handle;
 	struct efx_dl_device *efx_dev;
-	int rc;
+	int rc = -ENODEV;
 
 	/* Allocate and initialise new efx_dl_device structure */
 	efx_handle = kzalloc(sizeof(*efx_handle), GFP_KERNEL);
@@ -107,7 +107,7 @@ static void efx_dl_try_add_device(struct efx_nic *efx,
 	return;
 
  fail:
-	EFX_INFO(efx, "%s driverlink client skipped\n", driver->name);
+	EFX_INFO(efx, "%s driverlink client skipped rc=%d\n", driver->name, rc);
 
 	kfree(efx_handle);
 }
drivers/net/sfc/efx.c +0 -0
index 0e153cb..f3f62ea 100644
@@ -1871,6 +1871,7 @@ static int efx_init_struct(struct efx_nic *efx, struct

efx_nic_type *type,
memset(efx, 0, sizeof(*efx)); spin_lock_init(&efx->biu_lock); spin_lock_init(&efx->phy_lock);
+ mutex_init(&efx->spi_lock);
INIT_WORK(&efx->reset_work, efx_reset_work); INIT_DELAYED_WORK(&efx->monitor_work, efx_monitor); efx->pci_dev = pci_dev;

drivers/net/sfc/falcon.c +153 -28

256 lines not on this page · raw message

drivers/net/sfc/falcon_hwdefs.h +21 -0
index 6d00311..d20bc65 100644
@@ -1127,6 +1127,25 @@ struct falcon_nvconfig_board_v2 {
 	__le16 board_revision;
 } __packed;
 
+/* Board configuration v3 extra information */
+struct falcon_nvconfig_board_v3 {
+	__le32 spi_device_type[2];
+} __packed;
+
+/* Bit numbers for spi_device_type */
+#define SPI_DEV_TYPE_SIZE_LBN 0
+#define SPI_DEV_TYPE_SIZE_WIDTH 5
+#define SPI_DEV_TYPE_ADDR_LEN_LBN 6
+#define SPI_DEV_TYPE_ADDR_LEN_WIDTH 2
+#define SPI_DEV_TYPE_ERASE_CMD_LBN 8
+#define SPI_DEV_TYPE_ERASE_CMD_WIDTH 8
+#define SPI_DEV_TYPE_ERASE_SIZE_LBN 16
+#define SPI_DEV_TYPE_ERASE_SIZE_WIDTH 5
+#define SPI_DEV_TYPE_BLOCK_SIZE_LBN 24
+#define SPI_DEV_TYPE_BLOCK_SIZE_WIDTH 5
+#define SPI_DEV_TYPE_FIELD(type, field) \
+	(((type) >> EFX_LOW_BIT(field)) & EFX_MASK32(field))
+
 #define NVCONFIG_BASE 0x300
 #define NVCONFIG_BOARD_MAGIC_NUM 0xFA1C
 struct falcon_nvconfig {
@@ -1144,6 +1163,8 @@ struct falcon_nvconfig {
 	__le16 board_struct_ver;
 	__le16 board_checksum;
 	struct falcon_nvconfig_board_v2 board_v2;
+	efx_oword_t ee_base_page_reg;			/* 0x3B0 */
+	struct falcon_nvconfig_board_v3 board_v3;	/* 0x3C0 */
 } __packed;
 
 #endif /* EFX_FALCON_HWDEFS_H */
drivers/net/sfc/mtd.c new file +592 -0

592 lines not on this page · raw message

drivers/net/sfc/net_driver.h +9 -0
index 2a84468..9a32fea 100644
@@ -640,6 +640,11 @@ union efx_multicast_hash {
  *	This register is written with the SMP processor ID whenever an
  *	interrupt is handled.  It is used by falcon_test_interrupt()
  *	to verify that an interrupt has occurred.
+ * @spi_flash: SPI flash device
+ *	This field will be %NULL if no flash device is present.
+ * @spi_eeprom: SPI EEPROM device
+ *	This field will be %NULL if no EEPROM device is present.
+ * @spi_lock: SPI bus lock
  * @n_rx_nodesc_drop_cnt: RX no descriptor drop count
  * @nic_data: Hardware dependant state
  * @mac_lock: MAC access lock. Protects @port_enabled, efx_monitor() and
@@ -716,6 +721,10 @@ struct efx_nic {
 	struct efx_buffer irq_status;
 	volatile signed int last_irq_cpu;
 
+	struct efx_spi_device *spi_flash;
+	struct efx_spi_device *spi_eeprom;
+	struct mutex spi_lock;
+
 	unsigned n_rx_nodesc_drop_cnt;
 
 	struct falcon_nic_data *nic_data;
drivers/net/sfc/spi.h +98 -0

102 lines not on this page · raw message

Signature · 1 line
1.5.3.7