aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/ssb
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/ssb')
-rw-r--r--include/linux/ssb/ssb.h97
-rw-r--r--include/linux/ssb/ssb_regs.h83
2 files changed, 108 insertions, 72 deletions
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index 2b5c312c4960..e18f5c23b930 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -15,22 +15,19 @@ struct pcmcia_device;
15struct ssb_bus; 15struct ssb_bus;
16struct ssb_driver; 16struct ssb_driver;
17 17
18 18struct ssb_sprom {
19struct ssb_sprom_r1 { 19 u8 revision;
20 u16 pci_spid; /* Subsystem Product ID for PCI */
21 u16 pci_svid; /* Subsystem Vendor ID for PCI */
22 u16 pci_pid; /* Product ID for PCI */
23 u8 il0mac[6]; /* MAC address for 802.11b/g */ 20 u8 il0mac[6]; /* MAC address for 802.11b/g */
24 u8 et0mac[6]; /* MAC address for Ethernet */ 21 u8 et0mac[6]; /* MAC address for Ethernet */
25 u8 et1mac[6]; /* MAC address for 802.11a */ 22 u8 et1mac[6]; /* MAC address for 802.11a */
26 u8 et0phyaddr:5; /* MII address for enet0 */ 23 u8 et0phyaddr; /* MII address for enet0 */
27 u8 et1phyaddr:5; /* MII address for enet1 */ 24 u8 et1phyaddr; /* MII address for enet1 */
28 u8 et0mdcport:1; /* MDIO for enet0 */ 25 u8 et0mdcport; /* MDIO for enet0 */
29 u8 et1mdcport:1; /* MDIO for enet1 */ 26 u8 et1mdcport; /* MDIO for enet1 */
30 u8 board_rev; /* Board revision */ 27 u8 board_rev; /* Board revision number from SPROM. */
31 u8 country_code:4; /* Country Code */ 28 u8 country_code; /* Country Code */
32 u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */ 29 u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */
33 u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */ 30 u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */
34 u16 pa0b0; 31 u16 pa0b0;
35 u16 pa0b1; 32 u16 pa0b1;
36 u16 pa0b2; 33 u16 pa0b2;
@@ -41,61 +38,26 @@ struct ssb_sprom_r1 {
41 u8 gpio1; /* GPIO pin 1 */ 38 u8 gpio1; /* GPIO pin 1 */
42 u8 gpio2; /* GPIO pin 2 */ 39 u8 gpio2; /* GPIO pin 2 */
43 u8 gpio3; /* GPIO pin 3 */ 40 u8 gpio3; /* GPIO pin 3 */
44 u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */ 41 u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */
45 u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */ 42 u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */
46 u8 itssi_a; /* Idle TSSI Target for A-PHY */ 43 u8 itssi_a; /* Idle TSSI Target for A-PHY */
47 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ 44 u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */
48 u16 boardflags_lo; /* Boardflags (low 16 bits) */ 45 u16 boardflags_lo; /* Boardflags (low 16 bits) */
49 u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */
50 u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */
51 u8 oem[8]; /* OEM string (rev 1 only) */
52};
53
54struct ssb_sprom_r2 {
55 u16 boardflags_hi; /* Boardflags (high 16 bits) */ 46 u16 boardflags_hi; /* Boardflags (high 16 bits) */
56 u8 maxpwr_a_lo; /* A-PHY Max Power Low */
57 u8 maxpwr_a_hi; /* A-PHY Max Power High */
58 u16 pa1lob0; /* A-PHY PA Low Settings */
59 u16 pa1lob1; /* A-PHY PA Low Settings */
60 u16 pa1lob2; /* A-PHY PA Low Settings */
61 u16 pa1hib0; /* A-PHY PA High Settings */
62 u16 pa1hib1; /* A-PHY PA High Settings */
63 u16 pa1hib2; /* A-PHY PA High Settings */
64 u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */
65 u8 country_str[2]; /* Two char Country Code */
66};
67
68struct ssb_sprom_r3 {
69 u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */
70 u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */
71 u32 ofdmahpo; /* A-PHY OFDM High Power Offset */
72 u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */
73 u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */
74 u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */
75 u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */
76 u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */
77 u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */
78 u32 ofdmgpo; /* G-PHY OFDM Power Offset */
79};
80
81struct ssb_sprom_r4 {
82 /* TODO */
83};
84 47
85struct ssb_sprom { 48 /* Antenna gain values for up to 4 antennas
86 u8 revision; 49 * on each band. Values in dBm/4 (Q5.2). Negative gain means the
87 u8 crc; 50 * loss in the connectors is bigger than the gain. */
88 /* The valid r# fields are selected by the "revision". 51 struct {
89 * Revision 3 and lower inherit from lower revisions.
90 */
91 union {
92 struct { 52 struct {
93 struct ssb_sprom_r1 r1; 53 s8 a0, a1, a2, a3;
94 struct ssb_sprom_r2 r2; 54 } ghz24; /* 2.4GHz band */
95 struct ssb_sprom_r3 r3; 55 struct {
96 }; 56 s8 a0, a1, a2, a3;
97 struct ssb_sprom_r4 r4; 57 } ghz5; /* 5GHz band */
98 }; 58 } antenna_gain;
59
60 /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */
99}; 61};
100 62
101/* Information about the PCB the circuitry is soldered on. */ 63/* Information about the PCB the circuitry is soldered on. */
@@ -270,7 +232,8 @@ struct ssb_bus {
270 struct ssb_device *mapped_device; 232 struct ssb_device *mapped_device;
271 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ 233 /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */
272 u8 mapped_pcmcia_seg; 234 u8 mapped_pcmcia_seg;
273 /* Lock for core and segment switching. */ 235 /* Lock for core and segment switching.
236 * On PCMCIA-host busses this is used to protect the whole MMIO access. */
274 spinlock_t bar_lock; 237 spinlock_t bar_lock;
275 238
276 /* The bus this backplane is running on. */ 239 /* The bus this backplane is running on. */
@@ -288,6 +251,7 @@ struct ssb_bus {
288 /* ID information about the Chip. */ 251 /* ID information about the Chip. */
289 u16 chip_id; 252 u16 chip_id;
290 u16 chip_rev; 253 u16 chip_rev;
254 u16 sprom_size; /* number of words in sprom */
291 u8 chip_package; 255 u8 chip_package;
292 256
293 /* List of devices (cores) on the backplane. */ 257 /* List of devices (cores) on the backplane. */
@@ -402,6 +366,13 @@ static inline void ssb_pcihost_unregister(struct pci_driver *driver)
402{ 366{
403 pci_unregister_driver(driver); 367 pci_unregister_driver(driver);
404} 368}
369
370static inline
371void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state)
372{
373 if (sdev->bus->bustype == SSB_BUSTYPE_PCI)
374 pci_set_power_state(sdev->bus->host_pci, state);
375}
405#endif /* CONFIG_SSB_PCIHOST */ 376#endif /* CONFIG_SSB_PCIHOST */
406 377
407 378
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h
index 47c7c71a5acf..ebad0bac9801 100644
--- a/include/linux/ssb/ssb_regs.h
+++ b/include/linux/ssb/ssb_regs.h
@@ -147,6 +147,10 @@
147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ 147#define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */
148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ 148#define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */
149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ 149#define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */
150#define SSB_IDLOW_SSBREV_24 0x40000000 /* ?? Found in BCM4328 */
151#define SSB_IDLOW_SSBREV_25 0x50000000 /* ?? Not Found yet */
152#define SSB_IDLOW_SSBREV_26 0x60000000 /* ?? Found in some BCM4311/2 */
153#define SSB_IDLOW_SSBREV_27 0x70000000 /* ?? Found in some BCM4311/2 */
150#define SSB_IDHIGH 0x0FFC /* SB Identification High */ 154#define SSB_IDHIGH 0x0FFC /* SB Identification High */
151#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ 155#define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */
152#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ 156#define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */
@@ -162,11 +166,16 @@
162 */ 166 */
163#define SSB_SPROMSIZE_WORDS 64 167#define SSB_SPROMSIZE_WORDS 64
164#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) 168#define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16))
169#define SSB_SPROMSIZE_WORDS_R123 64
170#define SSB_SPROMSIZE_WORDS_R4 220
171#define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16))
172#define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16))
165#define SSB_SPROM_BASE 0x1000 173#define SSB_SPROM_BASE 0x1000
166#define SSB_SPROM_REVISION 0x107E 174#define SSB_SPROM_REVISION 0x107E
167#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ 175#define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */
168#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ 176#define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */
169#define SSB_SPROM_REVISION_CRC_SHIFT 8 177#define SSB_SPROM_REVISION_CRC_SHIFT 8
178
170/* SPROM Revision 1 */ 179/* SPROM Revision 1 */
171#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ 180#define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */
172#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ 181#define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */
@@ -184,10 +193,10 @@
184#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ 193#define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */
185#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ 194#define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */
186#define SSB_SPROM1_BINF_CCODE_SHIFT 8 195#define SSB_SPROM1_BINF_CCODE_SHIFT 8
187#define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */ 196#define SSB_SPROM1_BINF_ANTBG 0x3000 /* Available B-PHY and G-PHY antennas */
188#define SSB_SPROM1_BINF_ANTA_SHIFT 12 197#define SSB_SPROM1_BINF_ANTBG_SHIFT 12
189#define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */ 198#define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */
190#define SSB_SPROM1_BINF_ANTBG_SHIFT 14 199#define SSB_SPROM1_BINF_ANTA_SHIFT 14
191#define SSB_SPROM1_PA0B0 0x105E 200#define SSB_SPROM1_PA0B0 0x105E
192#define SSB_SPROM1_PA0B1 0x1060 201#define SSB_SPROM1_PA0B1 0x1060
193#define SSB_SPROM1_PA0B2 0x1062 202#define SSB_SPROM1_PA0B2 0x1062
@@ -212,10 +221,11 @@
212#define SSB_SPROM1_ITSSI_A_SHIFT 8 221#define SSB_SPROM1_ITSSI_A_SHIFT 8
213#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ 222#define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */
214#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ 223#define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */
215#define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */ 224#define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */
216#define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */ 225#define SSB_SPROM1_AGAIN_BG_SHIFT 0
217#define SSB_SPROM1_AGAIN_BG_SHIFT 8 226#define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */
218#define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */ 227#define SSB_SPROM1_AGAIN_A_SHIFT 8
228
219/* SPROM Revision 2 (inherits from rev 1) */ 229/* SPROM Revision 2 (inherits from rev 1) */
220#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ 230#define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */
221#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ 231#define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */
@@ -232,7 +242,11 @@
232#define SSB_SPROM2_OPO_VALUE 0x00FF 242#define SSB_SPROM2_OPO_VALUE 0x00FF
233#define SSB_SPROM2_OPO_UNUSED 0xFF00 243#define SSB_SPROM2_OPO_UNUSED 0xFF00
234#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ 244#define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */
235/* SPROM Revision 3 (inherits from rev 2) */ 245
246/* SPROM Revision 3 (inherits most data from rev 2) */
247#define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */
248#define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */
249#define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */
236#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ 250#define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */
237#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ 251#define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */
238#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ 252#define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */
@@ -251,6 +265,57 @@
251#define SSB_SPROM3_CCKPO_11M_SHIFT 12 265#define SSB_SPROM3_CCKPO_11M_SHIFT 12
252#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ 266#define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */
253 267
268/* SPROM Revision 4 */
269#define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */
270#define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */
271#define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */
272#define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */
273#define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */
274#define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */
275#define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5
276#define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */
277#define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */
278#define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */
279#define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */
280#define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */
281#define SSB_SPROM4_ANTAVAIL_A_SHIFT 0
282#define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */
283#define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8
284#define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */
285#define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */
286#define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */
287#define SSB_SPROM4_AGAIN0_SHIFT 0
288#define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */
289#define SSB_SPROM4_AGAIN1_SHIFT 8
290#define SSB_SPROM4_AGAIN23 0x1060
291#define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */
292#define SSB_SPROM4_AGAIN2_SHIFT 0
293#define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */
294#define SSB_SPROM4_AGAIN3_SHIFT 8
295#define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */
296#define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */
297#define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */
298#define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */
299#define SSB_SPROM4_ITSSI_BG_SHIFT 8
300#define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */
301#define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */
302#define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */
303#define SSB_SPROM4_ITSSI_A_SHIFT 8
304#define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */
305#define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */
306#define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */
307#define SSB_SPROM4_GPIOA_P1_SHIFT 8
308#define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */
309#define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */
310#define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */
311#define SSB_SPROM4_GPIOB_P3_SHIFT 8
312#define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */
313#define SSB_SPROM4_PA0B1 0x1084 /* only guesses */
314#define SSB_SPROM4_PA0B2 0x1086
315#define SSB_SPROM4_PA1B0 0x108E
316#define SSB_SPROM4_PA1B1 0x1090
317#define SSB_SPROM4_PA1B2 0x1092
318
254/* Values for SSB_SPROM1_BINF_CCODE */ 319/* Values for SSB_SPROM1_BINF_CCODE */
255enum { 320enum {
256 SSB_SPROM1CCODE_WORLD = 0, 321 SSB_SPROM1CCODE_WORLD = 0,