From: Michael Buesch <mb@bu3sch.de>
To: b43-dev@lists.infradead.org
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>
Subject: [RFT][PATCH] ssb: Look for SPROM at different offset on higher rev CC
Date: Thu, 1 Apr 2010 16:36:50 +0100 [thread overview]
Message-ID: <201004011736.50440.mb@bu3sch.de> (raw)
In-Reply-To: <1270065561-4333-1-git-send-email-zajec5@gmail.com>
On Wednesday 31 March 2010 21:59:21 Rafa? Mi?ecki wrote:
> Our offset handling becomes even a little more hackish now. For some reason I
> do not understand all offsets as inrelative. It assumes base offset is 0x1000
> but it will work for now as we make offsets relative anyway by removing base
> 0x1000. Should be cleaner however.
>
What about fixing it correctly instead adding a hack?
> Signed-off-by: Rafa? Mi?ecki <zajec5@gmail.com>
> ---
> drivers/ssb/pci.c | 9 ++++++---
> include/linux/ssb/ssb.h | 1 +
> include/linux/ssb/ssb_regs.h | 3 ++-
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
> index a4b2b99..5bb1278 100644
> --- a/drivers/ssb/pci.c
> +++ b/drivers/ssb/pci.c
> @@ -167,7 +167,7 @@ err_pci:
> }
>
> /* Get the word-offset for a SSB_SPROM_XXX define. */
> -#define SPOFF(offset) (((offset) - SSB_SPROM_BASE) / sizeof(u16))
> +#define SPOFF(offset) (((offset) - SSB_SPROM_BASE1) / 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,7 +253,7 @@ static int sprom_do_read(struct ssb_bus *bus, u16 *sprom)
> int i;
>
> for (i = 0; i < bus->sprom_size; i++)
> - sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
> + sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2));
>
> return 0;
> }
> @@ -284,7 +284,7 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
> ssb_printk("75%%");
> else if (i % 2)
> ssb_printk(".");
> - writew(sprom[i], bus->mmio + SSB_SPROM_BASE + (i * 2));
> + writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
> mmiowb();
> msleep(20);
> }
> @@ -625,6 +625,9 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
> return -ENODEV;
> }
>
> + bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
> + SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
> +
> buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
> if (!buf)
> goto out;
> diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
> index 3b4da23..a2608bf 100644
> --- a/include/linux/ssb/ssb.h
> +++ b/include/linux/ssb/ssb.h
> @@ -305,6 +305,7 @@ struct ssb_bus {
> /* ID information about the Chip. */
> u16 chip_id;
> u16 chip_rev;
> + u16 sprom_offset;
> u16 sprom_size; /* number of words in sprom */
> u8 chip_package;
>
> diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
> index 9ae9082..b8be23c 100644
> --- a/include/linux/ssb/ssb_regs.h
> +++ b/include/linux/ssb/ssb_regs.h
> @@ -170,7 +170,8 @@
> #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_BASE 0x1000
> +#define SSB_SPROM_BASE1 0x1000
> +#define SSB_SPROM_BASE31 0x0800
> #define SSB_SPROM_REVISION 0x107E
> #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
> #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
>
--
Greetings, Michael.
WARNING: multiple messages have this Message-ID (diff)
From: Michael Buesch <mb@bu3sch.de>
To: b43-dev@lists.infradead.org
Cc: "Rafał Miłecki" <zajec5@gmail.com>,
linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>
Subject: Re: [RFT][PATCH] ssb: Look for SPROM at different offset on higher rev CC
Date: Thu, 1 Apr 2010 16:36:50 +0100 [thread overview]
Message-ID: <201004011736.50440.mb@bu3sch.de> (raw)
In-Reply-To: <1270065561-4333-1-git-send-email-zajec5@gmail.com>
On Wednesday 31 March 2010 21:59:21 Rafał Miłecki wrote:
> Our offset handling becomes even a little more hackish now. For some reason I
> do not understand all offsets as inrelative. It assumes base offset is 0x1000
> but it will work for now as we make offsets relative anyway by removing base
> 0x1000. Should be cleaner however.
>
What about fixing it correctly instead adding a hack?
> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
> ---
> drivers/ssb/pci.c | 9 ++++++---
> include/linux/ssb/ssb.h | 1 +
> include/linux/ssb/ssb_regs.h | 3 ++-
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
> index a4b2b99..5bb1278 100644
> --- a/drivers/ssb/pci.c
> +++ b/drivers/ssb/pci.c
> @@ -167,7 +167,7 @@ err_pci:
> }
>
> /* Get the word-offset for a SSB_SPROM_XXX define. */
> -#define SPOFF(offset) (((offset) - SSB_SPROM_BASE) / sizeof(u16))
> +#define SPOFF(offset) (((offset) - SSB_SPROM_BASE1) / 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,7 +253,7 @@ static int sprom_do_read(struct ssb_bus *bus, u16 *sprom)
> int i;
>
> for (i = 0; i < bus->sprom_size; i++)
> - sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2));
> + sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2));
>
> return 0;
> }
> @@ -284,7 +284,7 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
> ssb_printk("75%%");
> else if (i % 2)
> ssb_printk(".");
> - writew(sprom[i], bus->mmio + SSB_SPROM_BASE + (i * 2));
> + writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
> mmiowb();
> msleep(20);
> }
> @@ -625,6 +625,9 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
> return -ENODEV;
> }
>
> + bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
> + SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
> +
> buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
> if (!buf)
> goto out;
> diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
> index 3b4da23..a2608bf 100644
> --- a/include/linux/ssb/ssb.h
> +++ b/include/linux/ssb/ssb.h
> @@ -305,6 +305,7 @@ struct ssb_bus {
> /* ID information about the Chip. */
> u16 chip_id;
> u16 chip_rev;
> + u16 sprom_offset;
> u16 sprom_size; /* number of words in sprom */
> u8 chip_package;
>
> diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
> index 9ae9082..b8be23c 100644
> --- a/include/linux/ssb/ssb_regs.h
> +++ b/include/linux/ssb/ssb_regs.h
> @@ -170,7 +170,8 @@
> #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_BASE 0x1000
> +#define SSB_SPROM_BASE1 0x1000
> +#define SSB_SPROM_BASE31 0x0800
> #define SSB_SPROM_REVISION 0x107E
> #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
> #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
>
--
Greetings, Michael.
next prev parent reply other threads:[~2010-04-01 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-31 19:59 [RFT][PATCH] ssb: Look for SPROM at different offset on higher rev CC Rafał Miłecki
2010-03-31 19:59 ` Rafał Miłecki
2010-04-01 15:36 ` Michael Buesch [this message]
2010-04-01 15:36 ` Michael Buesch
2010-04-01 17:11 ` Rafał Miłecki
2010-04-01 17:11 ` Rafał Miłecki
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=201004011736.50440.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=b43-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=zajec5@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.