diff options
author | Felix Fietkau <nbd@openwrt.org> | 2007-10-14 02:47:36 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2007-10-14 02:47:36 +0000 |
commit | fd811bf54ced0e0ff4c1c02720a0f116fff21b4d (patch) | |
tree | 4041f1a7dfc40620ac439b37c4e65abb7dad3b1a /target/linux/generic-2.6/files/drivers/ssb/pcmcia.c | |
parent | af03fdb6c5d9f94ec372cc9764a17b7d43a8edb0 (diff) | |
download | mtk-20170518-fd811bf54ced0e0ff4c1c02720a0f116fff21b4d.zip mtk-20170518-fd811bf54ced0e0ff4c1c02720a0f116fff21b4d.tar.gz mtk-20170518-fd811bf54ced0e0ff4c1c02720a0f116fff21b4d.tar.bz2 |
sync ssb with upstream
SVN-Revision: 9302
Diffstat (limited to 'target/linux/generic-2.6/files/drivers/ssb/pcmcia.c')
-rw-r--r-- | target/linux/generic-2.6/files/drivers/ssb/pcmcia.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/target/linux/generic-2.6/files/drivers/ssb/pcmcia.c b/target/linux/generic-2.6/files/drivers/ssb/pcmcia.c index b908563..7c77360 100644 --- a/target/linux/generic-2.6/files/drivers/ssb/pcmcia.c +++ b/target/linux/generic-2.6/files/drivers/ssb/pcmcia.c @@ -21,6 +21,10 @@ #include "ssb_private.h" +/* Define the following to 1 to enable a printk on each coreswitch. */ +#define SSB_VERBOSE_PCMCIACORESWITCH_DEBUG 0 + + int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, u8 coreidx) { @@ -91,10 +95,12 @@ int ssb_pcmcia_switch_core(struct ssb_bus *bus, int err; unsigned long flags; - ssb_dprintk(KERN_INFO PFX - "Switching to %s core, index %d\n", - ssb_core_name(dev->id.coreid), - dev->core_index); +#if SSB_VERBOSE_PCMCIACORESWITCH_DEBUG + ssb_printk(KERN_INFO PFX + "Switching to %s core, index %d\n", + ssb_core_name(dev->id.coreid), + dev->core_index); +#endif spin_lock_irqsave(&bus->bar_lock, flags); err = ssb_pcmcia_switch_coreidx(bus, dev->core_index); @@ -112,7 +118,7 @@ int ssb_pcmcia_switch_segment(struct ssb_bus *bus, u8 seg) conf_reg_t reg; int res, err = 0; - assert(seg == 0 || seg == 1); + SSB_WARN_ON((seg != 0) && (seg != 1)); reg.Offset = 0x34; reg.Function = 0; spin_lock_irqsave(&bus->bar_lock, flags); @@ -145,6 +151,9 @@ error: goto out_unlock; } +/* These are the main device register access functions. + * do_select_core is inline to have the likely hotpath inline. + * All unlikely codepaths are out-of-line. */ static inline int do_select_core(struct ssb_bus *bus, struct ssb_device *dev, u16 *offset) @@ -176,7 +185,7 @@ static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset) if (unlikely(do_select_core(bus, dev, &offset))) return 0xFFFF; x = readw(bus->mmio + offset); -//printk("R16 0x%04X, 0x%04X\n", offset, x); + return x; } @@ -188,7 +197,7 @@ static u32 ssb_pcmcia_read32(struct ssb_device *dev, u16 offset) if (unlikely(do_select_core(bus, dev, &offset))) return 0xFFFFFFFF; x = readl(bus->mmio + offset); -//printk("R32 0x%04X, 0x%08X\n", offset, x); + return x; } @@ -198,7 +207,6 @@ static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value) if (unlikely(do_select_core(bus, dev, &offset))) return; -//printk("W16 0x%04X, 0x%04X\n", offset, value); writew(value, bus->mmio + offset); } @@ -208,13 +216,13 @@ static void ssb_pcmcia_write32(struct ssb_device *dev, u16 offset, u32 value) if (unlikely(do_select_core(bus, dev, &offset))) return; -//printk("W32 0x%04X, 0x%08X\n", offset, value); readw(bus->mmio + offset); writew(value >> 16, bus->mmio + offset + 2); readw(bus->mmio + offset); writew(value, bus->mmio + offset); } +/* Not "static", as it's used in main.c */ const struct ssb_bus_ops ssb_pcmcia_ops = { .read16 = ssb_pcmcia_read16, .read32 = ssb_pcmcia_read32, |