ax88796: add 93cx6 eeprom support

Previous thread: Re: Linux networking implementation and packet capture by Alan Menegotto on Thursday, September 27, 2007 - 3:48 am. (1 message)

Next thread: Re: 2.6.23-rc8-mm2 - drivers/net/ibm_newemac/mal - broken by Kamalesh Babulal on Thursday, September 27, 2007 - 3:52 am. (1 message)
From: Magnus Damm
Date: Thursday, September 27, 2007 - 3:51 am

ax88796: add 93cx6 eeprom support

This patch hooks up the 93cx6 eeprom code to the ax88796 driver and modifies
the ax88796 driver to read out the mac address from the eeprom. We need
this for the ax88796 on certain SuperH boards. The pin configuration used
to connect the eeprom to the ax88796 on these boards is the same as pointed
out by the ax88796 datasheet, so we can probably reuse this code for multiple
platforms in the future.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
---

 This is a broken out version of the larger patch recently posted to netdev:
 http://www.mail-archive.com/netdev@vger.kernel.org/msg47278.html

 drivers/net/Kconfig          |    7 ++++++
 drivers/net/ax88796.c        |   49 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/eeprom_93cx6.h |    3 +-
 include/net/ax88796.h        |    1 
 4 files changed, 59 insertions(+), 1 deletion(-)

--- 0001/drivers/net/Kconfig
+++ work/drivers/net/Kconfig	2007-09-27 19:32:10.000000000 +0900
@@ -225,6 +225,13 @@ config AX88796
 	  AX88796 driver, using platform bus to provide
 	  chip detection and resources
 
+config AX88796_93CX6
+	bool "ASIX AX88796 external 93CX6 eeprom support"
+	depends on AX88796
+	select EEPROM_93CX6
+	help
+	  Select this if your platform comes with an external 93CX6 eeprom.
+
 config MACE
 	tristate "MACE (Power Mac ethernet) support"
 	depends on PPC_PMAC && PPC32
--- 0001/drivers/net/ax88796.c
+++ work/drivers/net/ax88796.c	2007-09-27 19:17:44.000000000 +0900
@@ -24,6 +24,7 @@
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
+#include <linux/eeprom_93cx6.h>
 
 #include <net/ax88796.h>
 
@@ -582,6 +583,37 @@ static const struct ethtool_ops ax_ethto
 	.get_link		= ax_get_link,
 };
 
+#ifdef CONFIG_AX88796_93CX6
+static void ax_eeprom_register_read(struct eeprom_93cx6 *eeprom)
+{
+	struct ei_device *ei_local = eeprom->data;
+	u8 reg = ei_inb(ei_local->mem + AX_MEMR);
+
+	eeprom->reg_data_in = reg & ...
From: Andrew Morton
Date: Thursday, September 27, 2007 - 3:04 pm

On Thu, 27 Sep 2007 19:51:19 +0900

I'm showing a minor reject between this and Francois's git-r8169.patch.

***************
*** 21,33 ****
  /*
  	Module: eeprom_93cx6
  	Abstract: EEPROM reader datastructures for 93cx6 chipsets.
- 	Supported chipsets: 93c46 & 93c66.
   */
  
  /*
   * EEPROM operation defines.
   */
  #define PCI_EEPROM_WIDTH_93C46	6
  #define PCI_EEPROM_WIDTH_93C66	8
  #define PCI_EEPROM_WIDTH_OPCODE	3
  #define PCI_EEPROM_WRITE_OPCODE	0x05
--- 21,34 ----
  /*
  	Module: eeprom_93cx6
  	Abstract: EEPROM reader datastructures for 93cx6 chipsets.
+ 	Supported chipsets: 93c46/93c56/93c66.
   */
  
  /*
   * EEPROM operation defines.
   */
  #define PCI_EEPROM_WIDTH_93C46	6
+ #define PCI_EEPROM_WIDTH_93C56	8
  #define PCI_EEPROM_WIDTH_93C66	8
  #define PCI_EEPROM_WIDTH_OPCODE	3
  #define PCI_EEPROM_WRITE_OPCODE	0x05


You both made the same change to eeprom_93cx6.h.  That all sounds good but
it would be comforting if you could review each other's work, please...

-

From: Magnus Damm
Date: Friday, September 28, 2007 - 1:29 am

Hi Andrew,

Thanks for picking up the patch.


[snip]

I thought I was more or less the only user, but thanks for pointing that out.

The eeprom code in the r8169 driver from
2.6.23-rc8-mm2/git-r8169.patch looks fine, but I don't understand the
point of adding the size member to the eeprom struct in
eeprom_93cx6.h. Especially since no code change is made in
eeprom_93cx6.c.

Thanks,

/ magnus
-

Previous thread: Re: Linux networking implementation and packet capture by Alan Menegotto on Thursday, September 27, 2007 - 3:48 am. (1 message)

Next thread: Re: 2.6.23-rc8-mm2 - drivers/net/ibm_newemac/mal - broken by Kamalesh Babulal on Thursday, September 27, 2007 - 3:52 am. (1 message)