From: George Kashperko <george@xxxxxxxxxxx> Introduce helpers for SB core control and state flags' management. SB-style buses provide access to these flags at two high octets of TMSLOW and TMSHIGH registers whereas AI-ones implement these flags in two low octets of IOCTRL and IOSTAT registers. Signed-off-by: George Kashperko <george@xxxxxxxxxxx> --- drivers/ssb/main.c | 17 +++++++++++++++++ include/linux/ssb/ssb.h | 10 ++++++++++ 2 files changed, 27 insertions(+) --- linux-wireless-testing.orig/drivers/ssb/main.c 2011-02-17 14:05:12.000000000 +0200 +++ linux-wireless-testing/drivers/ssb/main.c 2011-02-17 14:15:25.000000000 +0200 @@ -1360,12 +1360,29 @@ static u32 ssb_admatch_size_sb(struct ss return size; } +static u32 ssb_core_ctl_flags_sb(struct ssb_device *dev, u32 mask, u32 val) +{ + if (~mask || val) { + u32 tmp = (ssb_read32(dev, SSB_TMSLOW) & mask) | val; + ssb_write32(dev, SSB_TMSLOW, tmp); + } + + return ssb_read32(dev, SSB_TMSLOW); +} + +static u32 ssb_core_state_flags_sb(struct ssb_device *dev) +{ + return ssb_read32(dev, SSB_TMSHIGH); +} + const struct ssb_bus_helpers ssb_helpers_sb = { .device_is_enabled = ssb_device_is_enabled_sb, .device_enable = ssb_device_enable_sb, .device_disable = ssb_device_disable_sb, .admatch_base = ssb_admatch_base_sb, .admatch_size = ssb_admatch_size_sb, + .core_ctl_flags = ssb_core_ctl_flags_sb, + .core_state_flags = ssb_core_state_flags_sb, }; static int __init ssb_modinit(void) --- linux-wireless-testing.orig/include/linux/ssb/ssb.h 2011-02-17 14:05:12.000000000 +0200 +++ linux-wireless-testing/include/linux/ssb/ssb.h 2011-02-17 14:15:25.000000000 +0200 @@ -128,6 +128,8 @@ struct ssb_bus_helpers { void (*device_disable)(struct ssb_device *dev, u32 core_specific_flags); u32 (*admatch_base)(struct ssb_device *dev, u32 adm); u32 (*admatch_size)(struct ssb_device *dev, u32 adm); + u32 (*core_ctl_flags)(struct ssb_device *dev, u32 mask, u32 val); + u32 (*core_state_flags)(struct ssb_device *dev); }; @@ -451,6 +453,14 @@ static inline u32 ssb_admatch_size(struc { return dev->helpers->admatch_size(dev, adm); } +static inline u32 ssb_core_ctl_flags(struct ssb_device *dev, u32 mask, u32 val) +{ + return dev->helpers->core_ctl_flags(dev, mask, val); +} +static inline u32 ssb_core_state_flags(struct ssb_device *dev) +{ + return dev->helpers->core_state_flags(dev); +} /* Device MMIO register read/write functions. */ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html