netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Jeff Garzik <jgarzik@pobox.com>, Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: netdev@vger.kernel.org, linux-pci@vger.kernel.org,
	Ben Hutchings <bhutchings@solarflare.com>,
	Ivan Vecera <ivecera@redhat.com>
Subject: [PATCH 9/9] skge: remove VPD eeprom
Date: Thu, 25 Sep 2008 09:49:00 -0700	[thread overview]
Message-ID: <20080925165223.930366451@vyatta.com> (raw)
In-Reply-To: 20080925164851.694359776@vyatta.com

[-- Attachment #1: skge-no-eeprom.patch --]
[-- Type: text/plain, Size: 3510 bytes --]

The VPD is not really the firmware EEPROM.
Programming the VPD through the ethtool interface doesn't work
(doesn't really change firmware). Now that the interesting bits are
available through the debug interface and raw data is available through sysfs,
the old interface can go.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/skge.c	2008-09-09 11:19:33.000000000 -0700
+++ b/drivers/net/skge.c	2008-09-09 11:19:34.000000000 -0700
@@ -61,9 +61,6 @@
 #define BLINK_MS		250
 #define LINK_HZ			HZ
 
-#define SKGE_EEPROM_MAGIC	0x9933aabb
-
-
 MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver");
 MODULE_AUTHOR("Stephen Hemminger <shemminger@linux-foundation.org>");
 MODULE_LICENSE("GPL");
@@ -803,98 +800,6 @@ static int skge_phys_id(struct net_devic
 	return 0;
 }
 
-static int skge_get_eeprom_len(struct net_device *dev)
-{
-	struct skge_port *skge = netdev_priv(dev);
-	u32 reg2;
-
-	pci_read_config_dword(skge->hw->pdev, PCI_DEV_REG2, &reg2);
-	return 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
-}
-
-static u32 skge_vpd_read(struct pci_dev *pdev, int cap, u16 offset)
-{
-	u32 val;
-
-	pci_write_config_word(pdev, cap + PCI_VPD_ADDR, offset);
-
-	do {
-		pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
-	} while (!(offset & PCI_VPD_ADDR_F));
-
-	pci_read_config_dword(pdev, cap + PCI_VPD_DATA, &val);
-	return val;
-}
-
-static void skge_vpd_write(struct pci_dev *pdev, int cap, u16 offset, u32 val)
-{
-	pci_write_config_dword(pdev, cap + PCI_VPD_DATA, val);
-	pci_write_config_word(pdev, cap + PCI_VPD_ADDR,
-			      offset | PCI_VPD_ADDR_F);
-
-	do {
-		pci_read_config_word(pdev, cap + PCI_VPD_ADDR, &offset);
-	} while (offset & PCI_VPD_ADDR_F);
-}
-
-static int skge_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
-			   u8 *data)
-{
-	struct skge_port *skge = netdev_priv(dev);
-	struct pci_dev *pdev = skge->hw->pdev;
-	int cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);
-	int length = eeprom->len;
-	u16 offset = eeprom->offset;
-
-	if (!cap)
-		return -EINVAL;
-
-	eeprom->magic = SKGE_EEPROM_MAGIC;
-
-	while (length > 0) {
-		u32 val = skge_vpd_read(pdev, cap, offset);
-		int n = min_t(int, length, sizeof(val));
-
-		memcpy(data, &val, n);
-		length -= n;
-		data += n;
-		offset += n;
-	}
-	return 0;
-}
-
-static int skge_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
-			   u8 *data)
-{
-	struct skge_port *skge = netdev_priv(dev);
-	struct pci_dev *pdev = skge->hw->pdev;
-	int cap = pci_find_capability(pdev, PCI_CAP_ID_VPD);
-	int length = eeprom->len;
-	u16 offset = eeprom->offset;
-
-	if (!cap)
-		return -EINVAL;
-
-	if (eeprom->magic != SKGE_EEPROM_MAGIC)
-		return -EINVAL;
-
-	while (length > 0) {
-		u32 val;
-		int n = min_t(int, length, sizeof(val));
-
-		if (n < sizeof(val))
-			val = skge_vpd_read(pdev, cap, offset);
-		memcpy(&val, data, n);
-
-		skge_vpd_write(pdev, cap, offset, val);
-
-		length -= n;
-		data += n;
-		offset += n;
-	}
-	return 0;
-}
-
 static const struct ethtool_ops skge_ethtool_ops = {
 	.get_settings	= skge_get_settings,
 	.set_settings	= skge_set_settings,
@@ -907,9 +812,6 @@ static const struct ethtool_ops skge_eth
 	.set_msglevel	= skge_set_msglevel,
 	.nway_reset	= skge_nway_reset,
 	.get_link	= ethtool_op_get_link,
-	.get_eeprom_len	= skge_get_eeprom_len,
-	.get_eeprom	= skge_get_eeprom,
-	.set_eeprom	= skge_set_eeprom,
 	.get_ringparam	= skge_get_ring_param,
 	.set_ringparam	= skge_set_ring_param,
 	.get_pauseparam = skge_get_pauseparam,

-- 

  parent reply	other threads:[~2008-09-25 16:49 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 16:48 [PATCH 0/9] PCI vpd patches (rev4) Stephen Hemminger
2008-09-25 16:48 ` [PATCH 1/9] PCI: vpd handle longer delays in access (rev3) Stephen Hemminger
2008-09-25 18:54   ` Matthew Wilcox
2008-09-25 16:48 ` [PATCH 2/9] PCI: revise VPD access interface (rev3) Stephen Hemminger
2008-09-25 17:58   ` Ben Hutchings
2008-09-25 16:48 ` [PATCH 3/9] PCI: add interface to set visible size of VPD (rev3) Stephen Hemminger
2008-09-25 17:22   ` Jeff Garzik
2008-09-25 17:49     ` Ben Hutchings
2008-09-25 16:48 ` [PATCH 4/9] sky2: set VPD size Stephen Hemminger
2008-09-25 16:48 ` [PATCH 5/9] sky2: move VPD display into debug interface Stephen Hemminger
2008-09-25 16:48 ` [PATCH 6/9] sky2: remove VPD eeprom Stephen Hemminger
2008-09-25 16:48 ` [PATCH 7/9] skge: set VPD size Stephen Hemminger
2008-09-25 16:48 ` [PATCH 8/9] skge: add VPD display into debug interface Stephen Hemminger
2008-09-25 17:23   ` Jeff Garzik
2008-09-25 16:49 ` Stephen Hemminger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2008-09-09 18:20 [PATCH 0/9] PCI VPD related patches Stephen Hemminger
2008-09-09 18:20 ` [PATCH 9/9] skge: remove VPD eeprom Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080925165223.930366451@vyatta.com \
    --to=shemminger@vyatta.com \
    --cc=bhutchings@solarflare.com \
    --cc=ivecera@redhat.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).