24 #define SSB_VERBOSE_SDIOCORESWITCH_DEBUG 0
28 #define SSB_SDIO_CIS 0x80
29 #define SSB_SDIO_CIS_SROMREV 0x00
30 #define SSB_SDIO_CIS_ID 0x01
31 #define SSB_SDIO_CIS_BOARDREV 0x02
32 #define SSB_SDIO_CIS_PA 0x03
33 #define SSB_SDIO_CIS_PA_PA0B0_LO 0
34 #define SSB_SDIO_CIS_PA_PA0B0_HI 1
35 #define SSB_SDIO_CIS_PA_PA0B1_LO 2
36 #define SSB_SDIO_CIS_PA_PA0B1_HI 3
37 #define SSB_SDIO_CIS_PA_PA0B2_LO 4
38 #define SSB_SDIO_CIS_PA_PA0B2_HI 5
39 #define SSB_SDIO_CIS_PA_ITSSI 6
40 #define SSB_SDIO_CIS_PA_MAXPOW 7
41 #define SSB_SDIO_CIS_OEMNAME 0x04
42 #define SSB_SDIO_CIS_CCODE 0x05
43 #define SSB_SDIO_CIS_ANTENNA 0x06
44 #define SSB_SDIO_CIS_ANTGAIN 0x07
45 #define SSB_SDIO_CIS_BFLAGS 0x08
46 #define SSB_SDIO_CIS_LEDS 0x09
48 #define CISTPL_FUNCE_LAN_NODE_ID 0x04
59 #define SBSDIO_FUNC1_SBADDRLOW 0x1000a
60 #define SBSDIO_FUNC1_SBADDRMID 0x1000b
61 #define SBSDIO_FUNC1_SBADDRHIGH 0x1000c
64 #define SBSDIO_SBADDRLOW_MASK 0x80
65 #define SBSDIO_SBADDRMID_MASK 0xff
66 #define SBSDIO_SBADDRHIGH_MASK 0xff
68 #define SBSDIO_SB_OFT_ADDR_MASK 0x7FFF
71 #define SBSDIO_SB_ACCESS_2_4B_FLAG 0x8000
116 dev_dbg(ssb_sdio_dev(bus),
"%08X <- %02x, error %d\n",
124 static u8 ssb_sdio_readb(
struct ssb_bus *bus,
unsigned int addr)
131 dev_dbg(ssb_sdio_dev(bus),
"%08X -> %02x, error %d\n",
159 dev_dbg(ssb_sdio_dev(bus),
"failed to set address window"
160 " to 0x%08x, error %d\n", address, error);
176 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X > %08x, error %d\n",
191 error = ssb_sdio_set_sbaddr_window(bus, sbaddr);
194 dev_err(ssb_sdio_dev(bus),
"failed to switch to core %u,"
195 " error %d\n", coreidx, error);
211 #if SSB_VERBOSE_SDIOCORESWITCH_DEBUG
213 "switching to %s core, index %d\n",
216 error = ssb_sdio_set_sbaddr_window(bus, sbaddr);
218 dev_dbg(ssb_sdio_dev(bus),
"failed to switch to"
219 " core %u, error %d\n", coreidx, error);
242 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X > %02x, error %d\n",
264 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X > %04x, error %d\n",
276 u32 val = 0xffffffff;
287 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X > %08x, error %d\n",
296 #ifdef CONFIG_SSB_BLOCKIO
300 size_t saved_count =
count;
307 memset(buffer, 0xff, count);
336 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X (width=%u, len=%zu), error %d\n",
337 bus->
sdio_sbaddr >> 16, offset, reg_width, saved_count, error);
343 static void ssb_sdio_write8(
struct ssb_device *dev,
u16 offset,
u8 val)
355 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X < %02x, error %d\n",
374 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X < %04x, error %d\n",
394 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X < %08x, error %d\n",
403 #ifdef CONFIG_SSB_BLOCKIO
404 static void ssb_sdio_block_write(
struct ssb_device *dev,
const void *buffer,
405 size_t count,
u16 offset,
u8 reg_width)
407 size_t saved_count =
count;
414 memset((
void *)buffer, 0xff, count);
428 (
void *)buffer, count);
434 (
void *)buffer, count);
443 dev_dbg(ssb_sdio_dev(bus),
"%04X:%04X (width=%u, len=%zu), error %d\n",
444 bus->
sdio_sbaddr >> 16, offset, reg_width, saved_count, error);
453 .read8 = ssb_sdio_read8,
454 .read16 = ssb_sdio_read16,
455 .read32 = ssb_sdio_read32,
456 .write8 = ssb_sdio_write8,
457 .write16 = ssb_sdio_write16,
458 .write32 = ssb_sdio_write32,
459 #ifdef CONFIG_SSB_BLOCKIO
460 .block_read = ssb_sdio_block_read,
461 .block_write = ssb_sdio_block_write,
465 #define GOTO_ERROR_ON(condition, description) do { \
466 if (unlikely(condition)) { \
467 error_description = description; \
477 const char *error_description =
"none";
481 memset(sprom, 0xFF,
sizeof(*sprom));
487 switch (tuple->
code) {
489 switch (tuple->
data[0]) {
492 (tuple->
data[1] != 6),
495 mac = tuple->
data + 2;
504 switch (tuple->
data[0]) {
519 "boardrev tpl size");
586 dev_err(ssb_sdio_dev(bus),
"failed to fetch device invariants: %s\n",