Lines Matching +full:half +full:- +full:bus

5  * Copyright (C) 2005-2008 Michael Buesch <m@bues.ch>
6 * Copyright (C) 2005 Martin Langer <martin-langer@gmx.de>
29 pos += scnprintf(buf + pos, buf_len - pos - 1, in sprom2hex()
31 pos += scnprintf(buf + pos, buf_len - pos - 1, "\n"); in sprom2hex()
45 c = dump[len - 1]; in hex2sprom()
48 len--; in hex2sprom()
52 return -EINVAL; in hex2sprom()
66 /* Common sprom device-attribute show-handler */
67 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf, in ssb_attr_sprom_show() argument
68 int (*sprom_read)(struct ssb_bus *bus, u16 *sprom)) in ssb_attr_sprom_show() argument
71 int err = -ENOMEM; in ssb_attr_sprom_show()
73 size_t sprom_size_words = bus->sprom_size; in ssb_attr_sprom_show()
83 err = -ERESTARTSYS; in ssb_attr_sprom_show()
84 if (mutex_lock_interruptible(&bus->sprom_mutex)) in ssb_attr_sprom_show()
86 err = sprom_read(bus, sprom); in ssb_attr_sprom_show()
87 mutex_unlock(&bus->sprom_mutex); in ssb_attr_sprom_show()
98 /* Common sprom device-attribute store-handler */
99 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus, in ssb_attr_sprom_store() argument
102 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom)) in ssb_attr_sprom_store() argument
105 int res = 0, err = -ENOMEM; in ssb_attr_sprom_store()
106 size_t sprom_size_words = bus->sprom_size; in ssb_attr_sprom_store()
109 sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL); in ssb_attr_sprom_store()
114 err = -EINVAL; in ssb_attr_sprom_store()
119 err = -EINVAL; in ssb_attr_sprom_store()
127 err = -ERESTARTSYS; in ssb_attr_sprom_store()
128 if (mutex_lock_interruptible(&bus->sprom_mutex)) in ssb_attr_sprom_store()
130 err = ssb_devices_freeze(bus, &freeze); in ssb_attr_sprom_store()
135 res = sprom_write(bus, sprom); in ssb_attr_sprom_store()
140 mutex_unlock(&bus->sprom_mutex); in ssb_attr_sprom_store()
150 * ssb_arch_register_fallback_sprom - Registers a method providing a
160 * This function is useful for weird architectures that have a half-assed
161 * SSB device hardwired to their PCI bus.
171 int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, in ssb_arch_register_fallback_sprom() argument
175 return -EEXIST; in ssb_arch_register_fallback_sprom()
181 int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) in ssb_fill_sprom_with_fallback() argument
184 return -ENOENT; in ssb_fill_sprom_with_fallback()
186 return get_fallback_sprom(bus, out); in ssb_fill_sprom_with_fallback()
189 /* https://bcm-v4.sipsolutions.net/802.11/IsSpromAvailable */
190 bool ssb_is_sprom_available(struct ssb_bus *bus) in ssb_is_sprom_available() argument
198 if (bus->bustype == SSB_BUSTYPE_PCI && in ssb_is_sprom_available()
199 bus->chipco.dev && /* can be unavailable! */ in ssb_is_sprom_available()
200 bus->chipco.dev->id.revision >= 31) in ssb_is_sprom_available()
201 return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM; in ssb_is_sprom_available()