From: George Kashperko <george@znau.edu.ua>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: linux-wireless@vger.kernel.org,
"John W. Linville" <linville@tuxdriver.com>,
"Michael Büsch" <mb@bu3sch.de>,
b43-dev@lists.infradead.org,
"Larry Finger" <Larry.Finger@lwfinger.net>
Subject: Re: [RFC][PATCH] ssb: separate common scanning functions
Date: Sat, 19 Mar 2011 00:40:10 +0200 [thread overview]
Message-ID: <1300488010.16395.37.camel@dev.znau.edu.ua> (raw)
In-Reply-To: <AANLkTi=1XOxwS4tMc6eMcNGeHf_ZGaAH5MC97JsP7oWP@mail.gmail.com>
> 2011/3/18 George Kashperko <george@znau.edu.ua>:
> > - read pci revision id/vendor id (pci_read_config_word), if required
> > to decide if second window is sliding or sprom (actually rev_id should
> > be sufficient for that) read offset 0x0000 from bar0 offset to get
> > chipid register value
>
> Could you say something about WIN1 and WIN2? What are they for, can we
> use them somehow separately? What do you mean by second window being
> SPROM? We read sprom without any special window magic:
> sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2));
>
> My understanding is limited to that:
> If we want to use device with CORE_ADDR and WRAP_ADDR we have to write
> CORE_ADDR to BAR0_WIN and WRAP_ADDR to BAR0_WIN2. Then we can use
> readl/writel.
>
Historically layout of BAR0 for Broadcom pci(e) hosts differs depending
on pci(e) and chipcommon cores revisions. Unfortunately there are no
info from Broadcom on the host dev id, pci/chipco core revisions
correspondance but unlikely that we could have different hosts with same
PCI_REVISION but different sets of pci/chipco cores. Here I with my poor
english mean that pci host identification obtainable with
pci_read_config_dword PCI_REVISION should be sufficient to distinguish
between these BAR0 layouts.
Well, here you are:
1. PCI hosts with PCI buscores prior rev. 13 (8Kb window)
offset size type description
0x0000 0x1000 sliding controlled with BAR0_WIN1 register
0x1000 0x0800 fixed SPROM
0x1800 0x0400 fixed PCI core (core registers 0x0000 to 0x03FF range)
0x1C00 0x0400 fixed PCI core (agent registers, 0x0C00 to 0x0FFF range)
2. PCI hosts with PCI buscores rev. 13 and above and PCIE with
Chipcommon rev. up to 31 (16Kb window)
offset size type description
0x0000 0x1000 sliding controlled with BAR0_WIN1 register
0x1000 0x1000 fixed SPROM
0x2000 0x1000 fixed PCI core
0x3000 0x1000 fixed Chipcommon core
3. PCIE hosts with Chipcommon rev. 32 and above
offset size type description
0x0000 0x1000 sliding controlled with BAR0_WIN1 register
0x1000 0x1000 sliding controlled with BAR0_WIN2 register
0x2000 0x1000 fixed PCI core
0x3000 0x1000 fixed Chipcommon core
As you can see even if PCI_REVISION can't feed us with guaranteed choice
of either of these 3 layouts we can distingiush between them easily like
following:
if (pci_is_pcie(dev)) {
u32 chipid = ioread32(bar0_base + 0x3000);
if (chipid & 0x10000000)
/* AXI, Chipcommon rev. is 32+ */
goto win_3_setup;
else
/* SB, Chipcommon rev. is <= 31 */
goto win_2_setup;
} else {
u32 idhi = ioread32(bar0_base + 0x1C00 + 0x03FC);
if (((idhi & 0x00008FF0) >> 4) == 0x804)
/* PCI core id */
goto win_1_setup;
else
/* Some crap from SPROM area */
goto win_2_setup;
}
Therefore we can setup PCI(e) host windows for backplane access prior to
scanning.
As for BAR0_WIN[12] registers, they point to physical base address on
backplane that will be mapped into corresponding 0x1000-size window. And
here again registers don't care what exactly you want to see there. Both
the windows can be controlled independently.
Finally, you might noticed we don't have SPROM in last 3rd layout. Thats
because it is in Chipcommon registers' space. For layouts #1 & #2 BAR0
range 0x1000 to 0x2000 is either mapped to actual SPROM or to SPROM
shadow in PCI core.
Have nice day,
George
next prev parent reply other threads:[~2011-03-18 22:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-18 12:02 [RFC][PATCH] ssb: separate common scanning functions Rafał Miłecki
2011-03-18 13:03 ` George Kashperko
2011-03-18 14:10 ` Rafał Miłecki
2011-03-18 14:50 ` Rafał Miłecki
2011-03-18 15:49 ` George Kashperko
2011-03-18 16:25 ` Rafał Miłecki
2011-03-18 17:13 ` Larry Finger
2011-03-18 18:11 ` George Kashperko
2011-03-18 19:04 ` Rafał Miłecki
2011-03-18 20:01 ` George Kashperko
2011-03-18 21:52 ` Rafał Miłecki
2011-03-18 22:40 ` George Kashperko [this message]
2011-03-18 23:06 ` Rafał Miłecki
2011-03-18 23:22 ` George Kashperko
2011-03-18 23:32 ` Rafał Miłecki
2011-03-18 14:59 ` George Kashperko
2011-03-18 15:17 ` Rafał Miłecki
2011-03-18 15:58 ` George Kashperko
2011-03-18 16:04 ` Rafał Miłecki
2011-03-18 20:26 ` Rafał Miłecki
2011-03-18 21:18 ` George Kashperko
2011-03-18 22:42 ` Rafał Miłecki
2011-03-18 22:50 ` George Kashperko
2011-03-18 13:06 ` Arend van Spriel
2011-03-18 19:49 ` Rafał Miłecki
2011-03-19 8:59 ` Arend van Spriel
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=1300488010.16395.37.camel@dev.znau.edu.ua \
--to=george@znau.edu.ua \
--cc=Larry.Finger@lwfinger.net \
--cc=b43-dev@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=mb@bu3sch.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox