Lines Matching full:bus

104 static inline struct device *ssb_sdio_dev(struct ssb_bus *bus)  in ssb_sdio_dev()  argument
106 return &bus->host_sdio->dev; in ssb_sdio_dev()
110 static int ssb_sdio_writeb(struct ssb_bus *bus, unsigned int addr, u8 val) in ssb_sdio_writeb() argument
114 sdio_writeb(bus->host_sdio, val, addr, &error); in ssb_sdio_writeb()
116 dev_dbg(ssb_sdio_dev(bus), "%08X <- %02x, error %d\n", in ssb_sdio_writeb()
124 static u8 ssb_sdio_readb(struct ssb_bus *bus, unsigned int addr)
129 val = sdio_readb(bus->host_sdio, addr, &error);
131 dev_dbg(ssb_sdio_dev(bus), "%08X -> %02x, error %d\n",
140 static int ssb_sdio_set_sbaddr_window(struct ssb_bus *bus, u32 address) in ssb_sdio_set_sbaddr_window() argument
144 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRLOW, in ssb_sdio_set_sbaddr_window()
148 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRMID, in ssb_sdio_set_sbaddr_window()
152 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRHIGH, in ssb_sdio_set_sbaddr_window()
156 bus->sdio_sbaddr = address; in ssb_sdio_set_sbaddr_window()
159 dev_dbg(ssb_sdio_dev(bus), "failed to set address window" in ssb_sdio_set_sbaddr_window()
167 u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset) in ssb_sdio_scan_read32() argument
172 sdio_claim_host(bus->host_sdio); in ssb_sdio_scan_read32()
173 val = sdio_readl(bus->host_sdio, offset, &error); in ssb_sdio_scan_read32()
174 sdio_release_host(bus->host_sdio); in ssb_sdio_scan_read32()
176 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %08x, error %d\n", in ssb_sdio_scan_read32()
177 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_scan_read32()
184 int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx) in ssb_sdio_scan_switch_coreidx() argument
190 sdio_claim_host(bus->host_sdio); in ssb_sdio_scan_switch_coreidx()
191 error = ssb_sdio_set_sbaddr_window(bus, sbaddr); in ssb_sdio_scan_switch_coreidx()
192 sdio_release_host(bus->host_sdio); in ssb_sdio_scan_switch_coreidx()
194 dev_err(ssb_sdio_dev(bus), "failed to switch to core %u," in ssb_sdio_scan_switch_coreidx()
203 static int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev) in ssb_sdio_switch_core() argument
210 if (unlikely(bus->sdio_sbaddr != sbaddr)) { in ssb_sdio_switch_core()
212 dev_info(ssb_sdio_dev(bus), in ssb_sdio_switch_core()
216 error = ssb_sdio_set_sbaddr_window(bus, sbaddr); in ssb_sdio_switch_core()
218 dev_dbg(ssb_sdio_dev(bus), "failed to switch to" in ssb_sdio_switch_core()
222 bus->mapped_device = dev; in ssb_sdio_switch_core()
231 struct ssb_bus *bus = dev->bus; in ssb_sdio_read8() local
235 sdio_claim_host(bus->host_sdio); in ssb_sdio_read8()
236 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_read8()
238 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_read8()
240 val = sdio_readb(bus->host_sdio, offset, &error); in ssb_sdio_read8()
242 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %02x, error %d\n", in ssb_sdio_read8()
243 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_read8()
246 sdio_release_host(bus->host_sdio); in ssb_sdio_read8()
253 struct ssb_bus *bus = dev->bus; in ssb_sdio_read16() local
257 sdio_claim_host(bus->host_sdio); in ssb_sdio_read16()
258 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_read16()
260 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_read16()
262 val = sdio_readw(bus->host_sdio, offset, &error); in ssb_sdio_read16()
264 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %04x, error %d\n", in ssb_sdio_read16()
265 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_read16()
268 sdio_release_host(bus->host_sdio); in ssb_sdio_read16()
275 struct ssb_bus *bus = dev->bus; in ssb_sdio_read32() local
279 sdio_claim_host(bus->host_sdio); in ssb_sdio_read32()
280 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_read32()
282 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_read32()
285 val = sdio_readl(bus->host_sdio, offset, &error); in ssb_sdio_read32()
287 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %08x, error %d\n", in ssb_sdio_read32()
288 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_read32()
291 sdio_release_host(bus->host_sdio); in ssb_sdio_read32()
301 struct ssb_bus *bus = dev->bus; in ssb_sdio_block_read() local
304 sdio_claim_host(bus->host_sdio); in ssb_sdio_block_read()
305 if (unlikely(ssb_sdio_switch_core(bus, dev))) { in ssb_sdio_block_read()
310 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_block_read()
315 error = sdio_readsb(bus->host_sdio, buffer, offset, count); in ssb_sdio_block_read()
320 error = sdio_readsb(bus->host_sdio, buffer, offset, count); in ssb_sdio_block_read()
326 error = sdio_readsb(bus->host_sdio, buffer, offset, count); in ssb_sdio_block_read()
336 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X (width=%u, len=%zu), error %d\n", in ssb_sdio_block_read()
337 bus->sdio_sbaddr >> 16, offset, reg_width, saved_count, error); in ssb_sdio_block_read()
339 sdio_release_host(bus->host_sdio); in ssb_sdio_block_read()
345 struct ssb_bus *bus = dev->bus; in ssb_sdio_write8() local
348 sdio_claim_host(bus->host_sdio); in ssb_sdio_write8()
349 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_write8()
351 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_write8()
353 sdio_writeb(bus->host_sdio, val, offset, &error); in ssb_sdio_write8()
355 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %02x, error %d\n", in ssb_sdio_write8()
356 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_write8()
359 sdio_release_host(bus->host_sdio); in ssb_sdio_write8()
364 struct ssb_bus *bus = dev->bus; in ssb_sdio_write16() local
367 sdio_claim_host(bus->host_sdio); in ssb_sdio_write16()
368 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_write16()
370 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_write16()
372 sdio_writew(bus->host_sdio, val, offset, &error); in ssb_sdio_write16()
374 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %04x, error %d\n", in ssb_sdio_write16()
375 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_write16()
378 sdio_release_host(bus->host_sdio); in ssb_sdio_write16()
383 struct ssb_bus *bus = dev->bus; in ssb_sdio_write32() local
386 sdio_claim_host(bus->host_sdio); in ssb_sdio_write32()
387 if (unlikely(ssb_sdio_switch_core(bus, dev))) in ssb_sdio_write32()
389 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_write32()
392 sdio_writel(bus->host_sdio, val, offset, &error); in ssb_sdio_write32()
394 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %08x, error %d\n", in ssb_sdio_write32()
395 bus->sdio_sbaddr >> 16, offset, val, error); in ssb_sdio_write32()
397 if (bus->quirks & SSB_QUIRK_SDIO_READ_AFTER_WRITE32) in ssb_sdio_write32()
398 sdio_readl(bus->host_sdio, 0, &error); in ssb_sdio_write32()
400 sdio_release_host(bus->host_sdio); in ssb_sdio_write32()
408 struct ssb_bus *bus = dev->bus; in ssb_sdio_block_write() local
411 sdio_claim_host(bus->host_sdio); in ssb_sdio_block_write()
412 if (unlikely(ssb_sdio_switch_core(bus, dev))) { in ssb_sdio_block_write()
416 offset |= bus->sdio_sbaddr & 0xffff; in ssb_sdio_block_write()
421 error = sdio_writesb(bus->host_sdio, offset, in ssb_sdio_block_write()
426 error = sdio_writesb(bus->host_sdio, offset, in ssb_sdio_block_write()
432 error = sdio_writesb(bus->host_sdio, offset, in ssb_sdio_block_write()
442 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X (width=%u, len=%zu), error %d\n", in ssb_sdio_block_write()
443 bus->sdio_sbaddr >> 16, offset, reg_width, saved_count, error); in ssb_sdio_block_write()
445 sdio_release_host(bus->host_sdio); in ssb_sdio_block_write()
471 int ssb_sdio_get_invariants(struct ssb_bus *bus, in ssb_sdio_get_invariants() argument
484 tuple = bus->host_sdio->tuples; in ssb_sdio_get_invariants()
585 dev_err(ssb_sdio_dev(bus), "failed to fetch device invariants: %s\n", in ssb_sdio_get_invariants()
590 void ssb_sdio_exit(struct ssb_bus *bus) in ssb_sdio_exit() argument
592 if (bus->bustype != SSB_BUSTYPE_SDIO) in ssb_sdio_exit()
597 int ssb_sdio_init(struct ssb_bus *bus) in ssb_sdio_init() argument
599 if (bus->bustype != SSB_BUSTYPE_SDIO) in ssb_sdio_init()
602 bus->sdio_sbaddr = ~0; in ssb_sdio_init()