mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Larry Finger <Larry.Finger@lwfinger.net>,
	Ben Hutchings <ben@decadent.org.uk>
Subject: [30/34] Revert "ssb: Handle Netbook devices where the SPROM address is changed"
Date: Fri, 06 Aug 2010 11:57:25 -0700	[thread overview]
Message-ID: <20100806185836.523782243@clark.site> (raw)
In-Reply-To: <20100806185853.GA28270@kroah.com>

2.6.32-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Greg Kroah-Hartman <gregkh@suse.de>

Turns out this isn't the best way to resolve this issue.  The
individual patches will be applied instead.

Cc: Larry Finger <Larry.Finger@lwfinger.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/ssb/driver_chipcommon.c           |    3 -
 drivers/ssb/driver_chipcommon_pmu.c       |   17 ++++++-----
 drivers/ssb/pci.c                         |   46 +++---------------------------
 drivers/ssb/sprom.c                       |   15 ---------
 include/linux/ssb/ssb.h                   |    1 
 include/linux/ssb/ssb_driver_chipcommon.h |    2 -
 include/linux/ssb/ssb_regs.h              |    3 -
 7 files changed, 17 insertions(+), 70 deletions(-)

--- a/drivers/ssb/driver_chipcommon.c
+++ b/drivers/ssb/driver_chipcommon.c
@@ -233,9 +233,6 @@ void ssb_chipcommon_init(struct ssb_chip
 {
 	if (!cc->dev)
 		return; /* We don't have a ChipCommon */
-	if (cc->dev->id.revision >= 11)
-		cc->status = chipco_read32(cc, SSB_CHIPCO_CHIPSTAT);
-	ssb_dprintk(KERN_INFO PFX "chipcommon status is 0x%x\n", cc->status);
 	ssb_pmu_init(cc);
 	chipco_powercontrol_init(cc);
 	ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
--- a/drivers/ssb/driver_chipcommon_pmu.c
+++ b/drivers/ssb/driver_chipcommon_pmu.c
@@ -495,9 +495,9 @@ static void ssb_pmu_resources_init(struc
 		chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk);
 }
 
-/* http://bcm-v4.sipsolutions.net/802.11/SSB/PmuInit */
 void ssb_pmu_init(struct ssb_chipcommon *cc)
 {
+	struct ssb_bus *bus = cc->dev->bus;
 	u32 pmucap;
 
 	if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU))
@@ -509,12 +509,15 @@ void ssb_pmu_init(struct ssb_chipcommon
 	ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n",
 		    cc->pmu.rev, pmucap);
 
-	if (cc->pmu.rev == 1)
-		chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
-			      ~SSB_CHIPCO_PMU_CTL_NOILPONW);
-	else
-		chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
-			     SSB_CHIPCO_PMU_CTL_NOILPONW);
+	if (cc->pmu.rev >= 1) {
+		if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) {
+			chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
+				      ~SSB_CHIPCO_PMU_CTL_NOILPONW);
+		} else {
+			chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
+				     SSB_CHIPCO_PMU_CTL_NOILPONW);
+		}
+	}
 	ssb_pmu_pll_init(cc);
 	ssb_pmu_resources_init(cc);
 }
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -22,7 +22,6 @@
 
 #include "ssb_private.h"
 
-bool ssb_is_sprom_available(struct ssb_bus *bus);
 
 /* Define the following to 1 to enable a printk on each coreswitch. */
 #define SSB_VERBOSE_PCICORESWITCH_DEBUG		0
@@ -168,7 +167,7 @@ err_pci:
 }
 
 /* Get the word-offset for a SSB_SPROM_XXX define. */
-#define SPOFF(offset)	((offset) / sizeof(u16))
+#define SPOFF(offset)	(((offset) - SSB_SPROM_BASE) / sizeof(u16))
 /* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */
 #define SPEX16(_outvar, _offset, _mask, _shift)	\
 	out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift))
@@ -253,13 +252,8 @@ static int sprom_do_read(struct ssb_bus
 {
 	int i;
 
-	/* Check if SPROM can be read */
-	if (ioread16(bus->mmio + bus->sprom_offset) == 0xFFFF) {
-		ssb_printk(KERN_ERR PFX "Unable to read SPROM\n");
-		return -ENODEV;
-	}
 	for (i = 0; i < bus->sprom_size; i++)
-		sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2));
+		sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
 
 	return 0;
 }
@@ -290,7 +284,7 @@ static int sprom_do_write(struct ssb_bus
 			ssb_printk("75%%");
 		else if (i % 2)
 			ssb_printk(".");
-		writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
+		writew(sprom[i], bus->mmio + SSB_SPROM_BASE + (i * 2));
 		mmiowb();
 		msleep(20);
 	}
@@ -626,49 +620,21 @@ static int ssb_pci_sprom_get(struct ssb_
 	int err = -ENOMEM;
 	u16 *buf;
 
-	if (!ssb_is_sprom_available(bus)) {
-		ssb_printk(KERN_ERR PFX "No SPROM available!\n");
-		return -ENODEV;
-	}
-	if (bus->chipco.dev) {	/* can be unavailible! */
-		/*
-		 * get SPROM offset: SSB_SPROM_BASE1 except for
-		 * chipcommon rev >= 31 or chip ID is 0x4312 and
-		 * chipcommon status & 3 == 2
-		 */
-		if (bus->chipco.dev->id.revision >= 31)
-			bus->sprom_offset = SSB_SPROM_BASE31;
-		else if (bus->chip_id == 0x4312 &&
-			 (bus->chipco.status & 0x03) == 2)
-			bus->sprom_offset = SSB_SPROM_BASE31;
-		else
-			bus->sprom_offset = SSB_SPROM_BASE1;
-	} else {
-		bus->sprom_offset = SSB_SPROM_BASE1;
-	}
-	ssb_dprintk(KERN_INFO PFX "SPROM offset is 0x%x\n", bus->sprom_offset);
-
 	buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
 	if (!buf)
 		goto out;
 	bus->sprom_size = SSB_SPROMSIZE_WORDS_R123;
-	err = sprom_do_read(bus, buf);
-	if (err)
-		goto out_free;
+	sprom_do_read(bus, buf);
 	err = sprom_check_crc(buf, bus->sprom_size);
 	if (err) {
 		/* try for a 440 byte SPROM - revision 4 and higher */
 		kfree(buf);
 		buf = kcalloc(SSB_SPROMSIZE_WORDS_R4, sizeof(u16),
 			      GFP_KERNEL);
-		if (!buf) {
-			err = -ENOMEM;
+		if (!buf)
 			goto out;
-		}
 		bus->sprom_size = SSB_SPROMSIZE_WORDS_R4;
-		err = sprom_do_read(bus, buf);
-		if (err)
-			goto out_free;
+		sprom_do_read(bus, buf);
 		err = sprom_check_crc(buf, bus->sprom_size);
 		if (err) {
 			/* All CRC attempts failed.
--- a/drivers/ssb/sprom.c
+++ b/drivers/ssb/sprom.c
@@ -179,18 +179,3 @@ const struct ssb_sprom *ssb_get_fallback
 {
 	return fallback_sprom;
 }
-
-/* http://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
-bool ssb_is_sprom_available(struct ssb_bus *bus)
-{
-	/* status register only exists on chipcomon rev >= 11 and we need check
-	   for >= 31 only */
-	/* this routine differs from specs as we do not access SPROM directly
-	   on PCMCIA */
-	if (bus->bustype == SSB_BUSTYPE_PCI &&
-	    bus->chipco.dev &&	/* can be unavailible! */
-	    bus->chipco.dev->id.revision >= 31)
-		return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM;
-
-	return true;
-}
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -302,7 +302,6 @@ struct ssb_bus {
 	u16 chip_id;
 	u16 chip_rev;
 	u16 sprom_size;		/* number of words in sprom */
-	u16 sprom_offset;
 	u8 chip_package;
 
 	/* List of devices (cores) on the backplane. */
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -46,7 +46,6 @@
 #define   SSB_PLLTYPE_7			0x00038000	/* 25Mhz, 4 dividers */
 #define  SSB_CHIPCO_CAP_PCTL		0x00040000	/* Power Control */
 #define  SSB_CHIPCO_CAP_OTPS		0x00380000	/* OTP size */
-#define  SSB_CHIPCO_CAP_SPROM		0x40000000	/* SPROM present */
 #define  SSB_CHIPCO_CAP_OTPS_SHIFT	19
 #define  SSB_CHIPCO_CAP_OTPS_BASE	5
 #define  SSB_CHIPCO_CAP_JTAGM		0x00400000	/* JTAG master present */
@@ -565,7 +564,6 @@ struct ssb_chipcommon_pmu {
 struct ssb_chipcommon {
 	struct ssb_device *dev;
 	u32 capabilities;
-	u32 status;
 	/* Fast Powerup Delay constant */
 	u16 fast_pwrup_delay;
 	struct ssb_chipcommon_pmu pmu;
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -170,8 +170,7 @@
 #define SSB_SPROMSIZE_WORDS_R4		220
 #define SSB_SPROMSIZE_BYTES_R123	(SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
 #define SSB_SPROMSIZE_BYTES_R4		(SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
-#define SSB_SPROM_BASE1			0x1000
-#define SSB_SPROM_BASE31		0x0800
+#define SSB_SPROM_BASE			0x1000
 #define SSB_SPROM_REVISION		0x107E
 #define  SSB_SPROM_REVISION_REV		0x00FF	/* SPROM Revision number */
 #define  SSB_SPROM_REVISION_CRC		0xFF00	/* SPROM CRC8 value */



  parent reply	other threads:[~2010-08-06 19:08 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 18:58 [00/34] 2.6.32.18-stable review Greg KH
2010-08-06 18:56 ` [01/34] sched: cgroup: Implement different treatment for idle shares Greg KH
2010-08-06 18:56 ` [02/34] mm: fix ia64 crash when gcore reads gate area Greg KH
2010-08-06 18:56 ` [03/34] Re: acl trouble after upgrading ubuntu Greg KH
2010-08-06 18:56 ` [04/34] comedi: Uncripple 8255-based DIO subdevices Greg KH
2010-08-06 18:57 ` [05/34] NFS: kswapd must not block in nfs_release_page Greg KH
2010-08-06 18:57 ` [06/34] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
2010-08-06 18:57 ` [07/34] arm/imx/gpio: add spinlock protection Greg KH
2010-08-06 18:57 ` [08/34] parisc: pass through \t to early (iodc) console Greg KH
2010-08-06 18:57 ` [09/34] amd64_edac: Fix DCT base address selector Greg KH
2010-08-06 18:57 ` [10/34] amd64_edac: Correct scrub rate setting Greg KH
2010-08-06 18:57 ` [11/34] e1000e: dont inadvertently re-set INTX_DISABLE Greg KH
2010-08-06 18:57 ` [12/34] e1000e: 82577/82578 PHY register access issues Greg KH
2010-08-06 18:57 ` [13/34] 9p: strlen() doesnt count the terminator Greg KH
2010-08-06 18:57 ` [14/34] ath9k: enable serialize_regmode for non-PCIE AR9160 Greg KH
2010-08-06 18:57 ` [15/34] ath9k_hw: fix an off-by-one error in the PDADC boundaries calculation Greg KH
2010-08-06 18:57 ` [16/34] ath9k: fix TSF after reset on AR913x Greg KH
2010-08-06 18:57 ` [17/34] ath9k: fix yet another buffer leak in the tx aggregation code Greg KH
2010-08-06 18:57 ` [18/34] iwlwifi: fix scan abort Greg KH
2010-08-06 18:57 ` [19/34] cfg80211: ignore spurious deauth Greg KH
2010-08-06 18:57 ` [20/34] cfg80211: dont get expired BSSes Greg KH
2010-08-06 18:57 ` [21/34] xfs: prevent swapext from operating on write-only files Greg KH
2010-08-06 18:57 ` [22/34] SCSI: enclosure: fix error path - actually return ERR_PTR() on error Greg KH
2010-08-06 18:57 ` [23/34] GFS2: rename causes kernel Oops Greg KH
2010-08-06 18:57 ` [24/34] slow-work: use get_ref wrapper instead of directly calling get_ref Greg KH
2010-08-06 18:57 ` [25/34] CIFS: Remove __exit mark from cifs_exit_dns_resolver() Greg KH
2010-08-06 18:57 ` [26/34] CIFS: Fix compile error with __init in cifs_init_dns_resolver() definition Greg KH
2010-08-06 20:53   ` [Stable-review] " Ben Hutchings
2010-08-06 21:06     ` Greg KH
2010-08-07  3:38       ` Michael Neuling
2010-08-06 18:57 ` [27/34] xen: drop xen_sched_clock in favour of using plain wallclock time Greg KH
2010-08-06 18:57 ` [28/34] drm/i915: Fix LVDS presence check Greg KH
2010-08-06 18:57 ` [29/34] drm/i915: parse child device from VBT Greg KH
2010-08-06 18:57 ` Greg KH [this message]
2010-08-06 18:57 ` [31/34] ssb: do not read SPROM if it does not exist Greg KH
2010-08-06 18:57 ` [32/34] ssb: Look for SPROM at different offset on higher rev CC Greg KH
2010-08-06 18:57 ` [33/34] ssb: fix NULL ptr deref when pcihost_wrapper is used Greg KH
2010-08-06 18:57 ` [34/34] ssb: Handle alternate SSPROM location Greg KH

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=20100806185836.523782243@clark.site \
    --to=gregkh@suse.de \
    --cc=Larry.Finger@lwfinger.net \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=ben@decadent.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®