/linux-4.1.27/sound/i2c/ |
H A D | i2c.c | 39 static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus, 48 static int snd_i2c_bus_free(struct snd_i2c_bus *bus) snd_i2c_bus_free() argument 53 if (snd_BUG_ON(!bus)) snd_i2c_bus_free() 55 while (!list_empty(&bus->devices)) { snd_i2c_bus_free() 56 device = snd_i2c_device(bus->devices.next); snd_i2c_bus_free() 59 if (bus->master) snd_i2c_bus_free() 60 list_del(&bus->buses); snd_i2c_bus_free() 62 while (!list_empty(&bus->buses)) { snd_i2c_bus_free() 63 slave = snd_i2c_slave_bus(bus->buses.next); snd_i2c_bus_free() 64 snd_device_free(bus->card, slave); snd_i2c_bus_free() 67 if (bus->private_free) snd_i2c_bus_free() 68 bus->private_free(bus); snd_i2c_bus_free() 69 kfree(bus); snd_i2c_bus_free() 75 struct snd_i2c_bus *bus = device->device_data; snd_i2c_bus_dev_free() local 76 return snd_i2c_bus_free(bus); snd_i2c_bus_dev_free() 82 struct snd_i2c_bus *bus; snd_i2c_bus_create() local 89 bus = kzalloc(sizeof(*bus), GFP_KERNEL); snd_i2c_bus_create() 90 if (bus == NULL) snd_i2c_bus_create() 92 mutex_init(&bus->lock_mutex); snd_i2c_bus_create() 93 INIT_LIST_HEAD(&bus->devices); snd_i2c_bus_create() 94 INIT_LIST_HEAD(&bus->buses); snd_i2c_bus_create() 95 bus->card = card; snd_i2c_bus_create() 96 bus->ops = &snd_i2c_bit_ops; snd_i2c_bus_create() 98 list_add_tail(&bus->buses, &master->buses); snd_i2c_bus_create() 99 bus->master = master; snd_i2c_bus_create() 101 strlcpy(bus->name, name, sizeof(bus->name)); snd_i2c_bus_create() 102 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &ops); snd_i2c_bus_create() 104 snd_i2c_bus_free(bus); snd_i2c_bus_create() 107 *ri2c = bus; snd_i2c_bus_create() 113 int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, snd_i2c_device_create() argument 119 if (snd_BUG_ON(!bus)) snd_i2c_device_create() 126 list_add_tail(&device->list, &bus->devices); snd_i2c_device_create() 127 device->bus = bus; snd_i2c_device_create() 136 if (device->bus) snd_i2c_device_free() 148 return device->bus->ops->sendbytes(device, bytes, count); snd_i2c_sendbytes() 155 return device->bus->ops->readbytes(device, bytes, count); snd_i2c_readbytes() 160 int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr) snd_i2c_probeaddr() argument 162 return bus->ops->probeaddr(bus, addr); snd_i2c_probeaddr() 171 static inline void snd_i2c_bit_hw_start(struct snd_i2c_bus *bus) snd_i2c_bit_hw_start() argument 173 if (bus->hw_ops.bit->start) snd_i2c_bit_hw_start() 174 bus->hw_ops.bit->start(bus); snd_i2c_bit_hw_start() 177 static inline void snd_i2c_bit_hw_stop(struct snd_i2c_bus *bus) snd_i2c_bit_hw_stop() argument 179 if (bus->hw_ops.bit->stop) snd_i2c_bit_hw_stop() 180 bus->hw_ops.bit->stop(bus); snd_i2c_bit_hw_stop() 183 static void snd_i2c_bit_direction(struct snd_i2c_bus *bus, int clock, int data) snd_i2c_bit_direction() argument 185 if (bus->hw_ops.bit->direction) snd_i2c_bit_direction() 186 bus->hw_ops.bit->direction(bus, clock, data); snd_i2c_bit_direction() 189 static void snd_i2c_bit_set(struct snd_i2c_bus *bus, int clock, int data) snd_i2c_bit_set() argument 191 bus->hw_ops.bit->setlines(bus, clock, data); snd_i2c_bit_set() 195 static int snd_i2c_bit_clock(struct snd_i2c_bus *bus) 197 if (bus->hw_ops.bit->getclock) 198 return bus->hw_ops.bit->getclock(bus); 203 static int snd_i2c_bit_data(struct snd_i2c_bus *bus, int ack) snd_i2c_bit_data() argument 205 return bus->hw_ops.bit->getdata(bus, ack); snd_i2c_bit_data() 208 static void snd_i2c_bit_start(struct snd_i2c_bus *bus) snd_i2c_bit_start() argument 210 snd_i2c_bit_hw_start(bus); snd_i2c_bit_start() 211 snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ snd_i2c_bit_start() 212 snd_i2c_bit_set(bus, 1, 1); snd_i2c_bit_start() 213 snd_i2c_bit_set(bus, 1, 0); snd_i2c_bit_start() 214 snd_i2c_bit_set(bus, 0, 0); snd_i2c_bit_start() 217 static void snd_i2c_bit_stop(struct snd_i2c_bus *bus) snd_i2c_bit_stop() argument 219 snd_i2c_bit_set(bus, 0, 0); snd_i2c_bit_stop() 220 snd_i2c_bit_set(bus, 1, 0); snd_i2c_bit_stop() 221 snd_i2c_bit_set(bus, 1, 1); snd_i2c_bit_stop() 222 snd_i2c_bit_hw_stop(bus); snd_i2c_bit_stop() 225 static void snd_i2c_bit_send(struct snd_i2c_bus *bus, int data) snd_i2c_bit_send() argument 227 snd_i2c_bit_set(bus, 0, data); snd_i2c_bit_send() 228 snd_i2c_bit_set(bus, 1, data); snd_i2c_bit_send() 229 snd_i2c_bit_set(bus, 0, data); snd_i2c_bit_send() 232 static int snd_i2c_bit_ack(struct snd_i2c_bus *bus) snd_i2c_bit_ack() argument 236 snd_i2c_bit_set(bus, 0, 1); snd_i2c_bit_ack() 237 snd_i2c_bit_set(bus, 1, 1); snd_i2c_bit_ack() 238 snd_i2c_bit_direction(bus, 1, 0); /* SCL - wr, SDA - rd */ snd_i2c_bit_ack() 239 ack = snd_i2c_bit_data(bus, 1); snd_i2c_bit_ack() 240 snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ snd_i2c_bit_ack() 241 snd_i2c_bit_set(bus, 0, 1); snd_i2c_bit_ack() 245 static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data) snd_i2c_bit_sendbyte() argument 250 snd_i2c_bit_send(bus, !!(data & (1 << i))); snd_i2c_bit_sendbyte() 251 err = snd_i2c_bit_ack(bus); snd_i2c_bit_sendbyte() 257 static int snd_i2c_bit_readbyte(struct snd_i2c_bus *bus, int last) snd_i2c_bit_readbyte() argument 262 snd_i2c_bit_set(bus, 0, 1); snd_i2c_bit_readbyte() 263 snd_i2c_bit_direction(bus, 1, 0); /* SCL - wr, SDA - rd */ snd_i2c_bit_readbyte() 265 snd_i2c_bit_set(bus, 1, 1); snd_i2c_bit_readbyte() 266 if (snd_i2c_bit_data(bus, 0)) snd_i2c_bit_readbyte() 268 snd_i2c_bit_set(bus, 0, 1); snd_i2c_bit_readbyte() 270 snd_i2c_bit_direction(bus, 1, 1); /* SCL - wr, SDA - wr */ snd_i2c_bit_readbyte() 271 snd_i2c_bit_send(bus, !!last); snd_i2c_bit_readbyte() 278 struct snd_i2c_bus *bus = device->bus; snd_i2c_bit_sendbytes() local 283 snd_i2c_bit_start(bus); snd_i2c_bit_sendbytes() 284 err = snd_i2c_bit_sendbyte(bus, device->addr << 1); snd_i2c_bit_sendbytes() 286 snd_i2c_bit_hw_stop(bus); snd_i2c_bit_sendbytes() 290 err = snd_i2c_bit_sendbyte(bus, *bytes++); snd_i2c_bit_sendbytes() 292 snd_i2c_bit_hw_stop(bus); snd_i2c_bit_sendbytes() 297 snd_i2c_bit_stop(bus); snd_i2c_bit_sendbytes() 304 struct snd_i2c_bus *bus = device->bus; snd_i2c_bit_readbytes() local 309 snd_i2c_bit_start(bus); snd_i2c_bit_readbytes() 310 err = snd_i2c_bit_sendbyte(bus, (device->addr << 1) | 1); snd_i2c_bit_readbytes() 312 snd_i2c_bit_hw_stop(bus); snd_i2c_bit_readbytes() 316 err = snd_i2c_bit_readbyte(bus, count == 0); snd_i2c_bit_readbytes() 318 snd_i2c_bit_hw_stop(bus); snd_i2c_bit_readbytes() 324 snd_i2c_bit_stop(bus); snd_i2c_bit_readbytes() 328 static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus, unsigned short addr) snd_i2c_bit_probeaddr() argument 336 snd_i2c_bit_start(bus); snd_i2c_bit_probeaddr() 337 err = snd_i2c_bit_sendbyte(bus, addr << 1); snd_i2c_bit_probeaddr() 338 snd_i2c_bit_stop(bus); snd_i2c_bit_probeaddr()
|
H A D | tea6330t.c | 2 * Routines for control of the TEA6330T circuit via i2c bus 31 MODULE_DESCRIPTION("Routines for control of the TEA6330T circuit via i2c bus"); 50 struct snd_i2c_bus *bus; member in struct:tea6330t 60 int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer) snd_tea6330t_detect() argument 64 snd_i2c_lock(bus); snd_tea6330t_detect() 65 res = snd_i2c_probeaddr(bus, TEA6330T_ADDR); snd_tea6330t_detect() 66 snd_i2c_unlock(bus); snd_tea6330t_detect() 77 snd_i2c_write(tea->bus, TEA6330T_ADDR, addr, value, 1); 101 snd_i2c_lock(tea->bus); snd_tea6330t_get_master_volume() 104 snd_i2c_unlock(tea->bus); snd_tea6330t_get_master_volume() 118 snd_i2c_lock(tea->bus); snd_tea6330t_put_master_volume() 136 snd_i2c_unlock(tea->bus); snd_tea6330t_put_master_volume() 152 snd_i2c_lock(tea->bus); snd_tea6330t_get_master_switch() 155 snd_i2c_unlock(tea->bus); snd_tea6330t_get_master_switch() 169 snd_i2c_lock(tea->bus); snd_tea6330t_put_master_switch() 180 snd_i2c_unlock(tea->bus); snd_tea6330t_put_master_switch() 219 snd_i2c_lock(tea->bus); snd_tea6330t_put_bass() 227 snd_i2c_unlock(tea->bus); snd_tea6330t_put_bass() 266 snd_i2c_lock(tea->bus); snd_tea6330t_put_treble() 274 snd_i2c_unlock(tea->bus); snd_tea6330t_put_treble() 291 struct snd_i2c_bus *bus, snd_tea6330t_update_mixer() 305 if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) { snd_tea6330t_update_mixer() 310 tea->bus = bus; snd_tea6330t_update_mixer() 316 snd_i2c_lock(bus); snd_tea6330t_update_mixer() 360 snd_i2c_unlock(bus); snd_tea6330t_update_mixer() 364 snd_i2c_unlock(bus); snd_tea6330t_update_mixer() 290 snd_tea6330t_update_mixer(struct snd_card *card, struct snd_i2c_bus *bus, int equalizer, int fader) snd_tea6330t_update_mixer() argument
|
/linux-4.1.27/sound/hda/ |
H A D | hdac_bus.c | 2 * HD-audio core bus driver 15 * snd_hdac_bus_init - initialize a HD-audio bas bus 16 * @bus: the pointer to bus object 20 int snd_hdac_bus_init(struct hdac_bus *bus, struct device *dev, snd_hdac_bus_init() argument 23 memset(bus, 0, sizeof(*bus)); snd_hdac_bus_init() 24 bus->dev = dev; snd_hdac_bus_init() 25 bus->ops = ops; snd_hdac_bus_init() 26 INIT_LIST_HEAD(&bus->codec_list); snd_hdac_bus_init() 27 INIT_WORK(&bus->unsol_work, process_unsol_events); snd_hdac_bus_init() 28 mutex_init(&bus->cmd_mutex); snd_hdac_bus_init() 34 * snd_hdac_bus_exit - clean up a HD-audio bas bus 35 * @bus: the pointer to bus object 37 void snd_hdac_bus_exit(struct hdac_bus *bus) snd_hdac_bus_exit() argument 39 WARN_ON(!list_empty(&bus->codec_list)); snd_hdac_bus_exit() 40 cancel_work_sync(&bus->unsol_work); snd_hdac_bus_exit() 45 * snd_hdac_bus_exec_verb - execute a HD-audio verb on the given bus 46 * @bus: bus object 52 int snd_hdac_bus_exec_verb(struct hdac_bus *bus, unsigned int addr, snd_hdac_bus_exec_verb() argument 57 mutex_lock(&bus->cmd_mutex); snd_hdac_bus_exec_verb() 58 err = snd_hdac_bus_exec_verb_unlocked(bus, addr, cmd, res); snd_hdac_bus_exec_verb() 59 mutex_unlock(&bus->cmd_mutex); snd_hdac_bus_exec_verb() 66 * @bus: bus object 72 int snd_hdac_bus_exec_verb_unlocked(struct hdac_bus *bus, unsigned int addr, snd_hdac_bus_exec_verb_unlocked() argument 83 else if (bus->sync_write) snd_hdac_bus_exec_verb_unlocked() 86 trace_hda_send_cmd(bus, cmd); snd_hdac_bus_exec_verb_unlocked() 87 err = bus->ops->command(bus, cmd); snd_hdac_bus_exec_verb_unlocked() 91 err = bus->ops->get_response(bus, addr, &tmp); snd_hdac_bus_exec_verb_unlocked() 96 err = bus->ops->get_response(bus, addr, res); snd_hdac_bus_exec_verb_unlocked() 97 trace_hda_get_response(bus, addr, *res); snd_hdac_bus_exec_verb_unlocked() 105 * @bus: the BUS 113 void snd_hdac_bus_queue_event(struct hdac_bus *bus, u32 res, u32 res_ex) snd_hdac_bus_queue_event() argument 117 if (!bus) snd_hdac_bus_queue_event() 120 trace_hda_unsol_event(bus, res, res_ex); snd_hdac_bus_queue_event() 121 wp = (bus->unsol_wp + 1) % HDA_UNSOL_QUEUE_SIZE; snd_hdac_bus_queue_event() 122 bus->unsol_wp = wp; snd_hdac_bus_queue_event() 125 bus->unsol_queue[wp] = res; snd_hdac_bus_queue_event() 126 bus->unsol_queue[wp + 1] = res_ex; snd_hdac_bus_queue_event() 128 schedule_work(&bus->unsol_work); snd_hdac_bus_queue_event() 137 struct hdac_bus *bus = container_of(work, struct hdac_bus, unsol_work); process_unsol_events() local 142 while (bus->unsol_rp != bus->unsol_wp) { process_unsol_events() 143 rp = (bus->unsol_rp + 1) % HDA_UNSOL_QUEUE_SIZE; process_unsol_events() 144 bus->unsol_rp = rp; process_unsol_events() 146 res = bus->unsol_queue[rp]; process_unsol_events() 147 caddr = bus->unsol_queue[rp + 1]; process_unsol_events() 150 codec = bus->caddr_tbl[caddr & 0x0f]; process_unsol_events() 159 int snd_hdac_bus_add_device(struct hdac_bus *bus, struct hdac_device *codec) snd_hdac_bus_add_device() argument 161 if (bus->caddr_tbl[codec->addr]) { snd_hdac_bus_add_device() 162 dev_err(bus->dev, "address 0x%x is already occupied\n", snd_hdac_bus_add_device() 167 list_add_tail(&codec->list, &bus->codec_list); snd_hdac_bus_add_device() 168 bus->caddr_tbl[codec->addr] = codec; snd_hdac_bus_add_device() 169 set_bit(codec->addr, &bus->codec_powered); snd_hdac_bus_add_device() 170 bus->num_codecs++; snd_hdac_bus_add_device() 175 void snd_hdac_bus_remove_device(struct hdac_bus *bus, snd_hdac_bus_remove_device() argument 178 WARN_ON(bus != codec->bus); snd_hdac_bus_remove_device() 182 bus->caddr_tbl[codec->addr] = NULL; snd_hdac_bus_remove_device() 183 clear_bit(codec->addr, &bus->codec_powered); snd_hdac_bus_remove_device() 184 bus->num_codecs--; snd_hdac_bus_remove_device()
|
H A D | trace.h | 19 TP_PROTO(struct hdac_bus *bus, unsigned int cmd), 20 TP_ARGS(bus, cmd), 25 dev_name((bus)->dev), (cmd) >> 28, cmd); 31 TP_PROTO(struct hdac_bus *bus, unsigned int addr, unsigned int res), 32 TP_ARGS(bus, addr, res), 37 dev_name((bus)->dev), addr, res); 43 TP_PROTO(struct hdac_bus *bus, u32 res, u32 res_ex), 44 TP_ARGS(bus, res, res_ex), 49 dev_name((bus)->dev), res_ex & 0x0f, res, res_ex);
|
/linux-4.1.27/drivers/staging/fsl-mc/bus/ |
H A D | Makefile | 2 # Freescale Management Complex (MC) bus drivers 8 obj-$(CONFIG_FSL_MC_BUS) += mc-bus-driver.o 10 mc-bus-driver-objs := mc-bus.o \
|
/linux-4.1.27/drivers/video/fbdev/via/ |
H A D | via_aux.c | 30 struct via_aux_bus *bus; via_aux_probe() local 35 bus = kmalloc(sizeof(*bus), GFP_KERNEL); via_aux_probe() 36 if (!bus) via_aux_probe() 39 bus->adap = adap; via_aux_probe() 40 INIT_LIST_HEAD(&bus->drivers); via_aux_probe() 42 via_aux_edid_probe(bus); via_aux_probe() 43 via_aux_vt1636_probe(bus); via_aux_probe() 44 via_aux_vt1632_probe(bus); via_aux_probe() 45 via_aux_vt1631_probe(bus); via_aux_probe() 46 via_aux_vt1625_probe(bus); via_aux_probe() 47 via_aux_vt1622_probe(bus); via_aux_probe() 48 via_aux_vt1621_probe(bus); via_aux_probe() 49 via_aux_sii164_probe(bus); via_aux_probe() 50 via_aux_ch7301_probe(bus); via_aux_probe() 52 return bus; via_aux_probe() 55 void via_aux_free(struct via_aux_bus *bus) via_aux_free() argument 59 if (!bus) via_aux_free() 62 list_for_each_entry_safe(pos, n, &bus->drivers, chain) { via_aux_free() 71 kfree(bus); via_aux_free() 74 const struct fb_videomode *via_aux_get_preferred_mode(struct via_aux_bus *bus) via_aux_get_preferred_mode() argument 79 if (!bus) via_aux_get_preferred_mode() 82 list_for_each_entry(pos, &bus->drivers, chain) { via_aux_get_preferred_mode()
|
H A D | via_aux.h | 34 struct i2c_adapter *adap; /* the I2C device to access the bus */ 35 struct list_head drivers; /* drivers for devices on this bus */ 41 struct via_aux_bus *bus; /* the I2C bus used */ member in struct:via_aux_drv 54 void via_aux_free(struct via_aux_bus *bus); 55 const struct fb_videomode *via_aux_get_preferred_mode(struct via_aux_bus *bus); 66 list_add_tail(&data->chain, &data->bus->drivers); via_aux_add() 77 return i2c_transfer(drv->bus->adap, msg, 2) == 2; via_aux_read() 82 void via_aux_ch7301_probe(struct via_aux_bus *bus); 83 void via_aux_edid_probe(struct via_aux_bus *bus); 84 void via_aux_sii164_probe(struct via_aux_bus *bus); 85 void via_aux_vt1636_probe(struct via_aux_bus *bus); 86 void via_aux_vt1632_probe(struct via_aux_bus *bus); 87 void via_aux_vt1631_probe(struct via_aux_bus *bus); 88 void via_aux_vt1625_probe(struct via_aux_bus *bus); 89 void via_aux_vt1622_probe(struct via_aux_bus *bus); 90 void via_aux_vt1621_probe(struct via_aux_bus *bus);
|
H A D | via_aux_ch7301.c | 31 static void probe(struct via_aux_bus *bus, u8 addr) probe() argument 34 .bus = bus, probe() 46 void via_aux_ch7301_probe(struct via_aux_bus *bus) via_aux_ch7301_probe() argument 48 probe(bus, 0x75); via_aux_ch7301_probe() 49 probe(bus, 0x76); via_aux_ch7301_probe()
|
H A D | via_aux_vt1622.c | 31 static void probe(struct via_aux_bus *bus, u8 addr) probe() argument 34 .bus = bus, probe() 46 void via_aux_vt1622_probe(struct via_aux_bus *bus) via_aux_vt1622_probe() argument 48 probe(bus, 0x20); via_aux_vt1622_probe() 49 probe(bus, 0x21); via_aux_vt1622_probe()
|
H A D | via_aux_vt1625.c | 31 static void probe(struct via_aux_bus *bus, u8 addr) probe() argument 34 .bus = bus, probe() 46 void via_aux_vt1625_probe(struct via_aux_bus *bus) via_aux_vt1625_probe() argument 48 probe(bus, 0x20); via_aux_vt1625_probe() 49 probe(bus, 0x21); via_aux_vt1625_probe()
|
H A D | via_aux_sii164.c | 31 static void probe(struct via_aux_bus *bus, u8 addr) probe() argument 34 .bus = bus, probe() 48 void via_aux_sii164_probe(struct via_aux_bus *bus) via_aux_sii164_probe() argument 53 probe(bus, i); via_aux_sii164_probe()
|
H A D | via_aux_vt1632.c | 31 static void probe(struct via_aux_bus *bus, u8 addr) probe() argument 34 .bus = bus, probe() 48 void via_aux_vt1632_probe(struct via_aux_bus *bus) via_aux_vt1632_probe() argument 53 probe(bus, i); via_aux_vt1632_probe()
|
H A D | via_aux_vt1621.c | 31 void via_aux_vt1621_probe(struct via_aux_bus *bus) via_aux_vt1621_probe() argument 34 .bus = bus, via_aux_vt1621_probe()
|
/linux-4.1.27/include/linux/ssb/ |
H A D | ssb_embedded.h | 8 extern int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks); 11 u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask); 12 u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value); 13 u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value); 14 u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value); 15 u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value); 16 u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value);
|
/linux-4.1.27/drivers/ssb/ |
H A D | driver_gpio.c | 33 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_to_irq() local 35 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_gpio_to_irq() 36 return irq_find_mapping(bus->irq_domain, gpio); ssb_gpio_to_irq() 48 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_get_value() local 50 return !!ssb_chipco_gpio_in(&bus->chipco, 1 << gpio); ssb_gpio_chipco_get_value() 56 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_set_value() local 58 ssb_chipco_gpio_out(&bus->chipco, 1 << gpio, value ? 1 << gpio : 0); ssb_gpio_chipco_set_value() 64 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_direction_input() local 66 ssb_chipco_gpio_outen(&bus->chipco, 1 << gpio, 0); ssb_gpio_chipco_direction_input() 73 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_direction_output() local 75 ssb_chipco_gpio_outen(&bus->chipco, 1 << gpio, 1 << gpio); ssb_gpio_chipco_direction_output() 76 ssb_chipco_gpio_out(&bus->chipco, 1 << gpio, value ? 1 << gpio : 0); ssb_gpio_chipco_direction_output() 82 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_request() local 84 ssb_chipco_gpio_control(&bus->chipco, 1 << gpio, 0); ssb_gpio_chipco_request() 86 ssb_chipco_gpio_pulldown(&bus->chipco, 1 << gpio, 0); ssb_gpio_chipco_request() 88 ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 1 << gpio); ssb_gpio_chipco_request() 95 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_chipco_free() local 98 ssb_chipco_gpio_pullup(&bus->chipco, 1 << gpio, 0); ssb_gpio_chipco_free() 104 struct ssb_bus *bus = irq_data_get_irq_chip_data(d); ssb_gpio_irq_chipco_mask() local 107 ssb_chipco_gpio_intmask(&bus->chipco, BIT(gpio), 0); ssb_gpio_irq_chipco_mask() 112 struct ssb_bus *bus = irq_data_get_irq_chip_data(d); ssb_gpio_irq_chipco_unmask() local 114 u32 val = ssb_chipco_gpio_in(&bus->chipco, BIT(gpio)); ssb_gpio_irq_chipco_unmask() 116 ssb_chipco_gpio_polarity(&bus->chipco, BIT(gpio), val); ssb_gpio_irq_chipco_unmask() 117 ssb_chipco_gpio_intmask(&bus->chipco, BIT(gpio), BIT(gpio)); ssb_gpio_irq_chipco_unmask() 128 struct ssb_bus *bus = dev_id; ssb_gpio_irq_chipco_handler() local 129 struct ssb_chipcommon *chipco = &bus->chipco; ssb_gpio_irq_chipco_handler() 139 for_each_set_bit(gpio, &irqs, bus->gpio.ngpio) ssb_gpio_irq_chipco_handler() 140 generic_handle_irq(ssb_gpio_to_irq(&bus->gpio, gpio)); ssb_gpio_irq_chipco_handler() 146 static int ssb_gpio_irq_chipco_domain_init(struct ssb_bus *bus) ssb_gpio_irq_chipco_domain_init() argument 148 struct ssb_chipcommon *chipco = &bus->chipco; ssb_gpio_irq_chipco_domain_init() 149 struct gpio_chip *chip = &bus->gpio; ssb_gpio_irq_chipco_domain_init() 152 if (bus->bustype != SSB_BUSTYPE_SSB) ssb_gpio_irq_chipco_domain_init() 155 bus->irq_domain = irq_domain_add_linear(NULL, chip->ngpio, ssb_gpio_irq_chipco_domain_init() 157 if (!bus->irq_domain) { ssb_gpio_irq_chipco_domain_init() 162 int irq = irq_create_mapping(bus->irq_domain, gpio); ssb_gpio_irq_chipco_domain_init() 164 irq_set_chip_data(irq, bus); ssb_gpio_irq_chipco_domain_init() 169 hwirq = ssb_mips_irq(bus->chipco.dev) + 2; ssb_gpio_irq_chipco_domain_init() 171 "gpio", bus); ssb_gpio_irq_chipco_domain_init() 175 ssb_chipco_gpio_intmask(&bus->chipco, ~0, 0); ssb_gpio_irq_chipco_domain_init() 182 int irq = irq_find_mapping(bus->irq_domain, gpio); ssb_gpio_irq_chipco_domain_init() 186 irq_domain_remove(bus->irq_domain); ssb_gpio_irq_chipco_domain_init() 191 static void ssb_gpio_irq_chipco_domain_exit(struct ssb_bus *bus) ssb_gpio_irq_chipco_domain_exit() argument 193 struct ssb_chipcommon *chipco = &bus->chipco; ssb_gpio_irq_chipco_domain_exit() 194 struct gpio_chip *chip = &bus->gpio; ssb_gpio_irq_chipco_domain_exit() 197 if (bus->bustype != SSB_BUSTYPE_SSB) ssb_gpio_irq_chipco_domain_exit() 201 free_irq(ssb_mips_irq(bus->chipco.dev) + 2, chipco); ssb_gpio_irq_chipco_domain_exit() 203 int irq = irq_find_mapping(bus->irq_domain, gpio); ssb_gpio_irq_chipco_domain_exit() 207 irq_domain_remove(bus->irq_domain); ssb_gpio_irq_chipco_domain_exit() 210 static int ssb_gpio_irq_chipco_domain_init(struct ssb_bus *bus) ssb_gpio_irq_chipco_domain_init() argument 215 static void ssb_gpio_irq_chipco_domain_exit(struct ssb_bus *bus) ssb_gpio_irq_chipco_domain_exit() argument 220 static int ssb_gpio_chipco_init(struct ssb_bus *bus) ssb_gpio_chipco_init() argument 222 struct gpio_chip *chip = &bus->gpio; ssb_gpio_chipco_init() 240 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_gpio_chipco_init() 245 err = ssb_gpio_irq_chipco_domain_init(bus); ssb_gpio_chipco_init() 251 ssb_gpio_irq_chipco_domain_exit(bus); ssb_gpio_chipco_init() 266 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_extif_get_value() local 268 return !!ssb_extif_gpio_in(&bus->extif, 1 << gpio); ssb_gpio_extif_get_value() 274 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_extif_set_value() local 276 ssb_extif_gpio_out(&bus->extif, 1 << gpio, value ? 1 << gpio : 0); ssb_gpio_extif_set_value() 282 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_extif_direction_input() local 284 ssb_extif_gpio_outen(&bus->extif, 1 << gpio, 0); ssb_gpio_extif_direction_input() 291 struct ssb_bus *bus = ssb_gpio_get_bus(chip); ssb_gpio_extif_direction_output() local 293 ssb_extif_gpio_outen(&bus->extif, 1 << gpio, 1 << gpio); ssb_gpio_extif_direction_output() 294 ssb_extif_gpio_out(&bus->extif, 1 << gpio, value ? 1 << gpio : 0); ssb_gpio_extif_direction_output() 301 struct ssb_bus *bus = irq_data_get_irq_chip_data(d); ssb_gpio_irq_extif_mask() local 304 ssb_extif_gpio_intmask(&bus->extif, BIT(gpio), 0); ssb_gpio_irq_extif_mask() 309 struct ssb_bus *bus = irq_data_get_irq_chip_data(d); ssb_gpio_irq_extif_unmask() local 311 u32 val = ssb_extif_gpio_in(&bus->extif, BIT(gpio)); ssb_gpio_irq_extif_unmask() 313 ssb_extif_gpio_polarity(&bus->extif, BIT(gpio), val); ssb_gpio_irq_extif_unmask() 314 ssb_extif_gpio_intmask(&bus->extif, BIT(gpio), BIT(gpio)); ssb_gpio_irq_extif_unmask() 325 struct ssb_bus *bus = dev_id; ssb_gpio_irq_extif_handler() local 326 struct ssb_extif *extif = &bus->extif; ssb_gpio_irq_extif_handler() 336 for_each_set_bit(gpio, &irqs, bus->gpio.ngpio) ssb_gpio_irq_extif_handler() 337 generic_handle_irq(ssb_gpio_to_irq(&bus->gpio, gpio)); ssb_gpio_irq_extif_handler() 343 static int ssb_gpio_irq_extif_domain_init(struct ssb_bus *bus) ssb_gpio_irq_extif_domain_init() argument 345 struct ssb_extif *extif = &bus->extif; ssb_gpio_irq_extif_domain_init() 346 struct gpio_chip *chip = &bus->gpio; ssb_gpio_irq_extif_domain_init() 349 if (bus->bustype != SSB_BUSTYPE_SSB) ssb_gpio_irq_extif_domain_init() 352 bus->irq_domain = irq_domain_add_linear(NULL, chip->ngpio, ssb_gpio_irq_extif_domain_init() 354 if (!bus->irq_domain) { ssb_gpio_irq_extif_domain_init() 359 int irq = irq_create_mapping(bus->irq_domain, gpio); ssb_gpio_irq_extif_domain_init() 361 irq_set_chip_data(irq, bus); ssb_gpio_irq_extif_domain_init() 366 hwirq = ssb_mips_irq(bus->extif.dev) + 2; ssb_gpio_irq_extif_domain_init() 368 "gpio", bus); ssb_gpio_irq_extif_domain_init() 372 ssb_extif_gpio_intmask(&bus->extif, ~0, 0); ssb_gpio_irq_extif_domain_init() 378 int irq = irq_find_mapping(bus->irq_domain, gpio); ssb_gpio_irq_extif_domain_init() 382 irq_domain_remove(bus->irq_domain); ssb_gpio_irq_extif_domain_init() 387 static void ssb_gpio_irq_extif_domain_exit(struct ssb_bus *bus) ssb_gpio_irq_extif_domain_exit() argument 389 struct ssb_extif *extif = &bus->extif; ssb_gpio_irq_extif_domain_exit() 390 struct gpio_chip *chip = &bus->gpio; ssb_gpio_irq_extif_domain_exit() 393 if (bus->bustype != SSB_BUSTYPE_SSB) ssb_gpio_irq_extif_domain_exit() 396 free_irq(ssb_mips_irq(bus->extif.dev) + 2, extif); ssb_gpio_irq_extif_domain_exit() 398 int irq = irq_find_mapping(bus->irq_domain, gpio); ssb_gpio_irq_extif_domain_exit() 402 irq_domain_remove(bus->irq_domain); ssb_gpio_irq_extif_domain_exit() 405 static int ssb_gpio_irq_extif_domain_init(struct ssb_bus *bus) ssb_gpio_irq_extif_domain_init() argument 410 static void ssb_gpio_irq_extif_domain_exit(struct ssb_bus *bus) ssb_gpio_irq_extif_domain_exit() argument 415 static int ssb_gpio_extif_init(struct ssb_bus *bus) ssb_gpio_extif_init() argument 417 struct gpio_chip *chip = &bus->gpio; ssb_gpio_extif_init() 433 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_gpio_extif_init() 438 err = ssb_gpio_irq_extif_domain_init(bus); ssb_gpio_extif_init() 444 ssb_gpio_irq_extif_domain_exit(bus); ssb_gpio_extif_init() 452 static int ssb_gpio_extif_init(struct ssb_bus *bus) ssb_gpio_extif_init() argument 462 int ssb_gpio_init(struct ssb_bus *bus) ssb_gpio_init() argument 464 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_init() 465 return ssb_gpio_chipco_init(bus); ssb_gpio_init() 466 else if (ssb_extif_available(&bus->extif)) ssb_gpio_init() 467 return ssb_gpio_extif_init(bus); ssb_gpio_init() 474 int ssb_gpio_unregister(struct ssb_bus *bus) ssb_gpio_unregister() argument 476 if (ssb_chipco_available(&bus->chipco) || ssb_gpio_unregister() 477 ssb_extif_available(&bus->extif)) { ssb_gpio_unregister() 478 gpiochip_remove(&bus->gpio); ssb_gpio_unregister()
|
H A D | scan.c | 160 static u32 scan_read32(struct ssb_bus *bus, u8 current_coreidx, scan_read32() argument 165 switch (bus->bustype) { scan_read32() 173 ssb_pcmcia_switch_segment(bus, 1); scan_read32() 176 ssb_pcmcia_switch_segment(bus, 0); scan_read32() 177 lo = readw(bus->mmio + offset); scan_read32() 178 hi = readw(bus->mmio + offset + 2); scan_read32() 182 return ssb_sdio_scan_read32(bus, offset); scan_read32() 184 return readl(bus->mmio + offset); scan_read32() 187 static int scan_switchcore(struct ssb_bus *bus, u8 coreidx) scan_switchcore() argument 189 switch (bus->bustype) { scan_switchcore() 193 return ssb_pci_switch_coreidx(bus, coreidx); scan_switchcore() 195 return ssb_pcmcia_switch_coreidx(bus, coreidx); scan_switchcore() 197 return ssb_sdio_scan_switch_coreidx(bus, coreidx); scan_switchcore() 202 void ssb_iounmap(struct ssb_bus *bus) ssb_iounmap() argument 204 switch (bus->bustype) { ssb_iounmap() 207 iounmap(bus->mmio); ssb_iounmap() 211 pci_iounmap(bus->host_pci, bus->mmio); ssb_iounmap() 219 bus->mmio = NULL; ssb_iounmap() 220 bus->mapped_device = NULL; ssb_iounmap() 223 static void __iomem *ssb_ioremap(struct ssb_bus *bus, ssb_ioremap() argument 228 switch (bus->bustype) { ssb_ioremap() 237 mmio = pci_iomap(bus->host_pci, 0, ~0UL); ssb_ioremap() 251 static int we_support_multiple_80211_cores(struct ssb_bus *bus) we_support_multiple_80211_cores() argument 259 if (bus->bustype == SSB_BUSTYPE_PCI) { we_support_multiple_80211_cores() 260 if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM && we_support_multiple_80211_cores() 261 ((bus->host_pci->device == 0x4313) || we_support_multiple_80211_cores() 262 (bus->host_pci->device == 0x431A) || we_support_multiple_80211_cores() 263 (bus->host_pci->device == 0x4321) || we_support_multiple_80211_cores() 264 (bus->host_pci->device == 0x4324))) we_support_multiple_80211_cores() 271 int ssb_bus_scan(struct ssb_bus *bus, ssb_bus_scan() argument 281 mmio = ssb_ioremap(bus, baseaddr); ssb_bus_scan() 284 bus->mmio = mmio; ssb_bus_scan() 286 err = scan_switchcore(bus, 0); /* Switch to first core */ ssb_bus_scan() 290 idhi = scan_read32(bus, 0, SSB_IDHIGH); ssb_bus_scan() 295 bus->nr_devices = 0; ssb_bus_scan() 297 tmp = scan_read32(bus, 0, SSB_CHIPCO_CHIPID); ssb_bus_scan() 299 bus->chip_id = (tmp & SSB_CHIPCO_IDMASK); ssb_bus_scan() 300 bus->chip_rev = (tmp & SSB_CHIPCO_REVMASK) >> ssb_bus_scan() 302 bus->chip_package = (tmp & SSB_CHIPCO_PACKMASK) >> ssb_bus_scan() 305 bus->nr_devices = (tmp & SSB_CHIPCO_NRCORESMASK) >> ssb_bus_scan() 308 tmp = scan_read32(bus, 0, SSB_CHIPCO_CAP); ssb_bus_scan() 309 bus->chipco.capabilities = tmp; ssb_bus_scan() 311 if (bus->bustype == SSB_BUSTYPE_PCI) { ssb_bus_scan() 312 bus->chip_id = pcidev_to_chipid(bus->host_pci); ssb_bus_scan() 313 bus->chip_rev = bus->host_pci->revision; ssb_bus_scan() 314 bus->chip_package = 0; ssb_bus_scan() 316 bus->chip_id = 0x4710; ssb_bus_scan() 317 bus->chip_rev = 0; ssb_bus_scan() 318 bus->chip_package = 0; ssb_bus_scan() 322 bus->chip_id, bus->chip_rev, bus->chip_package); ssb_bus_scan() 323 if (!bus->nr_devices) ssb_bus_scan() 324 bus->nr_devices = chipid_to_nrcores(bus->chip_id); ssb_bus_scan() 325 if (bus->nr_devices > ARRAY_SIZE(bus->devices)) { ssb_bus_scan() 327 SSB_MAX_NR_CORES, bus->nr_devices); ssb_bus_scan() 330 if (bus->bustype == SSB_BUSTYPE_SSB) { ssb_bus_scan() 336 mmio = ioremap(baseaddr, SSB_CORE_SIZE * bus->nr_devices); ssb_bus_scan() 339 bus->mmio = mmio; ssb_bus_scan() 343 for (i = 0, dev_i = 0; i < bus->nr_devices; i++) { ssb_bus_scan() 344 err = scan_switchcore(bus, i); ssb_bus_scan() 347 dev = &(bus->devices[dev_i]); ssb_bus_scan() 349 idhi = scan_read32(bus, i, SSB_IDHIGH); ssb_bus_scan() 355 dev->bus = bus; ssb_bus_scan() 356 dev->ops = bus->ops; ssb_bus_scan() 368 if (!we_support_multiple_80211_cores(bus)) { ssb_bus_scan() 376 if (bus->extif.dev) { ssb_bus_scan() 380 bus->extif.dev = dev; ssb_bus_scan() 384 if (bus->chipco.dev) { ssb_bus_scan() 388 bus->chipco.dev = dev; ssb_bus_scan() 393 if (bus->mipscore.dev) { ssb_bus_scan() 397 bus->mipscore.dev = dev; ssb_bus_scan() 403 if (bus->bustype == SSB_BUSTYPE_PCI) { ssb_bus_scan() 407 if (pci_is_pcie(bus->host_pci)) ssb_bus_scan() 410 if (!pci_is_pcie(bus->host_pci)) ssb_bus_scan() 414 if (bus->pcicore.dev) { ssb_bus_scan() 418 bus->pcicore.dev = dev; ssb_bus_scan() 422 if (bus->bustype == SSB_BUSTYPE_PCI) { ssb_bus_scan() 423 if (bus->host_pci->vendor == PCI_VENDOR_ID_BROADCOM && ssb_bus_scan() 424 (bus->host_pci->device & 0xFF00) == 0x4300) { ssb_bus_scan() 437 bus->nr_devices = dev_i; ssb_bus_scan() 443 ssb_iounmap(bus); ssb_bus_scan()
|
H A D | sdio.c | 104 static inline struct device *ssb_sdio_dev(struct ssb_bus *bus) ssb_sdio_dev() argument 106 return &bus->host_sdio->dev; ssb_sdio_dev() 110 static int ssb_sdio_writeb(struct ssb_bus *bus, unsigned int addr, u8 val) ssb_sdio_writeb() argument 114 sdio_writeb(bus->host_sdio, val, addr, &error); ssb_sdio_writeb() 116 dev_dbg(ssb_sdio_dev(bus), "%08X <- %02x, error %d\n", 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) ssb_sdio_set_sbaddr_window() argument 144 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRLOW, ssb_sdio_set_sbaddr_window() 148 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRMID, ssb_sdio_set_sbaddr_window() 152 error = ssb_sdio_writeb(bus, SBSDIO_FUNC1_SBADDRHIGH, ssb_sdio_set_sbaddr_window() 156 bus->sdio_sbaddr = address; ssb_sdio_set_sbaddr_window() 159 dev_dbg(ssb_sdio_dev(bus), "failed to set address window" ssb_sdio_set_sbaddr_window() 167 u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset) ssb_sdio_scan_read32() argument 172 sdio_claim_host(bus->host_sdio); ssb_sdio_scan_read32() 173 val = sdio_readl(bus->host_sdio, offset, &error); ssb_sdio_scan_read32() 174 sdio_release_host(bus->host_sdio); ssb_sdio_scan_read32() 176 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %08x, error %d\n", ssb_sdio_scan_read32() 177 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_scan_read32() 184 int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx) ssb_sdio_scan_switch_coreidx() argument 190 sdio_claim_host(bus->host_sdio); ssb_sdio_scan_switch_coreidx() 191 error = ssb_sdio_set_sbaddr_window(bus, sbaddr); ssb_sdio_scan_switch_coreidx() 192 sdio_release_host(bus->host_sdio); ssb_sdio_scan_switch_coreidx() 194 dev_err(ssb_sdio_dev(bus), "failed to switch to core %u," ssb_sdio_scan_switch_coreidx() 203 int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev) ssb_sdio_switch_core() argument 210 if (unlikely(bus->sdio_sbaddr != sbaddr)) { ssb_sdio_switch_core() 212 dev_info(ssb_sdio_dev(bus), ssb_sdio_switch_core() 216 error = ssb_sdio_set_sbaddr_window(bus, sbaddr); ssb_sdio_switch_core() 218 dev_dbg(ssb_sdio_dev(bus), "failed to switch to" ssb_sdio_switch_core() 222 bus->mapped_device = dev; ssb_sdio_switch_core() 231 struct ssb_bus *bus = dev->bus; ssb_sdio_read8() local 235 sdio_claim_host(bus->host_sdio); ssb_sdio_read8() 236 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_read8() 238 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_read8() 240 val = sdio_readb(bus->host_sdio, offset, &error); ssb_sdio_read8() 242 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %02x, error %d\n", ssb_sdio_read8() 243 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_read8() 246 sdio_release_host(bus->host_sdio); ssb_sdio_read8() 253 struct ssb_bus *bus = dev->bus; ssb_sdio_read16() local 257 sdio_claim_host(bus->host_sdio); ssb_sdio_read16() 258 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_read16() 260 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_read16() 262 val = sdio_readw(bus->host_sdio, offset, &error); ssb_sdio_read16() 264 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %04x, error %d\n", ssb_sdio_read16() 265 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_read16() 268 sdio_release_host(bus->host_sdio); ssb_sdio_read16() 275 struct ssb_bus *bus = dev->bus; ssb_sdio_read32() local 279 sdio_claim_host(bus->host_sdio); ssb_sdio_read32() 280 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_read32() 282 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_read32() 285 val = sdio_readl(bus->host_sdio, offset, &error); ssb_sdio_read32() 287 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X > %08x, error %d\n", ssb_sdio_read32() 288 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_read32() 291 sdio_release_host(bus->host_sdio); ssb_sdio_read32() 301 struct ssb_bus *bus = dev->bus; ssb_sdio_block_read() local 304 sdio_claim_host(bus->host_sdio); ssb_sdio_block_read() 305 if (unlikely(ssb_sdio_switch_core(bus, dev))) { ssb_sdio_block_read() 310 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_block_read() 315 error = sdio_readsb(bus->host_sdio, buffer, offset, count); sizeof() 320 error = sdio_readsb(bus->host_sdio, buffer, offset, count); sizeof() 326 error = sdio_readsb(bus->host_sdio, buffer, offset, count); sizeof() 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); 339 sdio_release_host(bus->host_sdio); 345 struct ssb_bus *bus = dev->bus; ssb_sdio_write8() local 348 sdio_claim_host(bus->host_sdio); ssb_sdio_write8() 349 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_write8() 351 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_write8() 353 sdio_writeb(bus->host_sdio, val, offset, &error); ssb_sdio_write8() 355 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %02x, error %d\n", ssb_sdio_write8() 356 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_write8() 359 sdio_release_host(bus->host_sdio); ssb_sdio_write8() 364 struct ssb_bus *bus = dev->bus; ssb_sdio_write16() local 367 sdio_claim_host(bus->host_sdio); ssb_sdio_write16() 368 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_write16() 370 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_write16() 372 sdio_writew(bus->host_sdio, val, offset, &error); ssb_sdio_write16() 374 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %04x, error %d\n", ssb_sdio_write16() 375 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_write16() 378 sdio_release_host(bus->host_sdio); ssb_sdio_write16() 383 struct ssb_bus *bus = dev->bus; ssb_sdio_write32() local 386 sdio_claim_host(bus->host_sdio); ssb_sdio_write32() 387 if (unlikely(ssb_sdio_switch_core(bus, dev))) ssb_sdio_write32() 389 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_write32() 392 sdio_writel(bus->host_sdio, val, offset, &error); ssb_sdio_write32() 394 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X < %08x, error %d\n", ssb_sdio_write32() 395 bus->sdio_sbaddr >> 16, offset, val, error); ssb_sdio_write32() 397 if (bus->quirks & SSB_QUIRK_SDIO_READ_AFTER_WRITE32) ssb_sdio_write32() 398 sdio_readl(bus->host_sdio, 0, &error); ssb_sdio_write32() 400 sdio_release_host(bus->host_sdio); ssb_sdio_write32() 408 struct ssb_bus *bus = dev->bus; ssb_sdio_block_write() local 411 sdio_claim_host(bus->host_sdio); ssb_sdio_block_write() 412 if (unlikely(ssb_sdio_switch_core(bus, dev))) { ssb_sdio_block_write() 417 offset |= bus->sdio_sbaddr & 0xffff; ssb_sdio_block_write() 422 error = sdio_writesb(bus->host_sdio, offset, ssb_sdio_block_write() 427 error = sdio_writesb(bus->host_sdio, offset, ssb_sdio_block_write() 433 error = sdio_writesb(bus->host_sdio, offset, ssb_sdio_block_write() 443 dev_dbg(ssb_sdio_dev(bus), "%04X:%04X (width=%u, len=%zu), error %d\n", ssb_sdio_block_write() 444 bus->sdio_sbaddr >> 16, offset, reg_width, saved_count, error); ssb_sdio_block_write() 446 sdio_release_host(bus->host_sdio); ssb_sdio_block_write() 472 int ssb_sdio_get_invariants(struct ssb_bus *bus, ssb_sdio_get_invariants() argument 485 tuple = bus->host_sdio->tuples; ssb_sdio_get_invariants() 586 dev_err(ssb_sdio_dev(bus), "failed to fetch device invariants: %s\n", ssb_sdio_get_invariants() 591 void ssb_sdio_exit(struct ssb_bus *bus) ssb_sdio_exit() argument 593 if (bus->bustype != SSB_BUSTYPE_SDIO) ssb_sdio_exit() 598 int ssb_sdio_init(struct ssb_bus *bus) ssb_sdio_init() argument 600 if (bus->bustype != SSB_BUSTYPE_SDIO) ssb_sdio_init() 603 bus->sdio_sbaddr = ~0; ssb_sdio_init()
|
H A D | embedded.c | 23 int ssb_watchdog_timer_set(struct ssb_bus *bus, u32 ticks) ssb_watchdog_timer_set() argument 25 if (ssb_chipco_available(&bus->chipco)) { ssb_watchdog_timer_set() 26 ssb_chipco_watchdog_timer_set(&bus->chipco, ticks); ssb_watchdog_timer_set() 29 if (ssb_extif_available(&bus->extif)) { ssb_watchdog_timer_set() 30 ssb_extif_watchdog_timer_set(&bus->extif, ticks); ssb_watchdog_timer_set() 37 int ssb_watchdog_register(struct ssb_bus *bus) ssb_watchdog_register() argument 42 if (ssb_chipco_available(&bus->chipco)) { ssb_watchdog_register() 43 wdt.driver_data = &bus->chipco; ssb_watchdog_register() 46 wdt.max_timer_ms = bus->chipco.max_timer_ms; ssb_watchdog_register() 47 } else if (ssb_extif_available(&bus->extif)) { ssb_watchdog_register() 48 wdt.driver_data = &bus->extif; ssb_watchdog_register() 57 bus->busnumber, &wdt, ssb_watchdog_register() 65 bus->watchdog = pdev; ssb_watchdog_register() 69 u32 ssb_gpio_in(struct ssb_bus *bus, u32 mask) ssb_gpio_in() argument 74 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_in() 75 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_in() 76 res = ssb_chipco_gpio_in(&bus->chipco, mask); ssb_gpio_in() 77 else if (ssb_extif_available(&bus->extif)) ssb_gpio_in() 78 res = ssb_extif_gpio_in(&bus->extif, mask); ssb_gpio_in() 81 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_in() 87 u32 ssb_gpio_out(struct ssb_bus *bus, u32 mask, u32 value) ssb_gpio_out() argument 92 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_out() 93 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_out() 94 res = ssb_chipco_gpio_out(&bus->chipco, mask, value); ssb_gpio_out() 95 else if (ssb_extif_available(&bus->extif)) ssb_gpio_out() 96 res = ssb_extif_gpio_out(&bus->extif, mask, value); ssb_gpio_out() 99 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_out() 105 u32 ssb_gpio_outen(struct ssb_bus *bus, u32 mask, u32 value) ssb_gpio_outen() argument 110 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_outen() 111 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_outen() 112 res = ssb_chipco_gpio_outen(&bus->chipco, mask, value); ssb_gpio_outen() 113 else if (ssb_extif_available(&bus->extif)) ssb_gpio_outen() 114 res = ssb_extif_gpio_outen(&bus->extif, mask, value); ssb_gpio_outen() 117 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_outen() 123 u32 ssb_gpio_control(struct ssb_bus *bus, u32 mask, u32 value) ssb_gpio_control() argument 128 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_control() 129 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_control() 130 res = ssb_chipco_gpio_control(&bus->chipco, mask, value); ssb_gpio_control() 131 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_control() 137 u32 ssb_gpio_intmask(struct ssb_bus *bus, u32 mask, u32 value) ssb_gpio_intmask() argument 142 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_intmask() 143 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_intmask() 144 res = ssb_chipco_gpio_intmask(&bus->chipco, mask, value); ssb_gpio_intmask() 145 else if (ssb_extif_available(&bus->extif)) ssb_gpio_intmask() 146 res = ssb_extif_gpio_intmask(&bus->extif, mask, value); ssb_gpio_intmask() 149 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_intmask() 155 u32 ssb_gpio_polarity(struct ssb_bus *bus, u32 mask, u32 value) ssb_gpio_polarity() argument 160 spin_lock_irqsave(&bus->gpio_lock, flags); ssb_gpio_polarity() 161 if (ssb_chipco_available(&bus->chipco)) ssb_gpio_polarity() 162 res = ssb_chipco_gpio_polarity(&bus->chipco, mask, value); ssb_gpio_polarity() 163 else if (ssb_extif_available(&bus->extif)) ssb_gpio_polarity() 164 res = ssb_extif_gpio_polarity(&bus->extif, mask, value); ssb_gpio_polarity() 167 spin_unlock_irqrestore(&bus->gpio_lock, flags); ssb_gpio_polarity() 174 static int gige_pci_init_callback(struct ssb_bus *bus, unsigned long data) gige_pci_init_callback() argument 181 for (i = 0; i < bus->nr_devices; i++) { gige_pci_init_callback() 182 dev = &(bus->devices[i]); gige_pci_init_callback() 216 static int gige_map_irq_callback(struct ssb_bus *bus, unsigned long data) gige_map_irq_callback() argument 223 for (i = 0; i < bus->nr_devices; i++) { gige_map_irq_callback() 224 dev = &(bus->devices[i]); gige_map_irq_callback() 244 /* Check if this PCI device is a device on a SSB bus or device ssb_pcibios_map_irq()
|
H A D | ssb_private.h | 47 extern int ssb_pci_switch_core(struct ssb_bus *bus, __ssb_do_nothing() 49 extern int ssb_pci_switch_coreidx(struct ssb_bus *bus, __ssb_do_nothing() 51 extern int ssb_pci_xtal(struct ssb_bus *bus, u32 what, __ssb_do_nothing() 53 extern int ssb_pci_get_invariants(struct ssb_bus *bus, __ssb_do_nothing() 55 extern void ssb_pci_exit(struct ssb_bus *bus); __ssb_do_nothing() 56 extern int ssb_pci_init(struct ssb_bus *bus); __ssb_do_nothing() 61 static inline int ssb_pci_switch_core(struct ssb_bus *bus, ssb_pci_switch_core() argument 66 static inline int ssb_pci_switch_coreidx(struct ssb_bus *bus, ssb_pci_switch_coreidx() argument 71 static inline int ssb_pci_xtal(struct ssb_bus *bus, u32 what, ssb_pci_xtal() argument 76 static inline void ssb_pci_exit(struct ssb_bus *bus) ssb_pci_exit() argument 79 static inline int ssb_pci_init(struct ssb_bus *bus) ssb_pci_init() argument 88 extern int ssb_pcmcia_switch_core(struct ssb_bus *bus, 90 extern int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, 92 extern int ssb_pcmcia_switch_segment(struct ssb_bus *bus, 94 extern int ssb_pcmcia_get_invariants(struct ssb_bus *bus, 96 extern int ssb_pcmcia_hardware_setup(struct ssb_bus *bus); 97 extern void ssb_pcmcia_exit(struct ssb_bus *bus); 98 extern int ssb_pcmcia_init(struct ssb_bus *bus); 101 static inline int ssb_pcmcia_switch_core(struct ssb_bus *bus, ssb_pcmcia_switch_core() argument 106 static inline int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, ssb_pcmcia_switch_coreidx() argument 111 static inline int ssb_pcmcia_switch_segment(struct ssb_bus *bus, ssb_pcmcia_switch_segment() argument 116 static inline int ssb_pcmcia_hardware_setup(struct ssb_bus *bus) ssb_pcmcia_hardware_setup() argument 120 static inline void ssb_pcmcia_exit(struct ssb_bus *bus) ssb_pcmcia_exit() argument 123 static inline int ssb_pcmcia_init(struct ssb_bus *bus) ssb_pcmcia_init() argument 131 extern int ssb_sdio_get_invariants(struct ssb_bus *bus, 134 extern u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset); 135 extern int ssb_sdio_switch_core(struct ssb_bus *bus, struct ssb_device *dev); 136 extern int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx); 137 extern int ssb_sdio_hardware_setup(struct ssb_bus *bus); 138 extern void ssb_sdio_exit(struct ssb_bus *bus); 139 extern int ssb_sdio_init(struct ssb_bus *bus); 143 static inline u32 ssb_sdio_scan_read32(struct ssb_bus *bus, u16 offset) ssb_sdio_scan_read32() argument 147 static inline int ssb_sdio_switch_core(struct ssb_bus *bus, ssb_sdio_switch_core() argument 152 static inline int ssb_sdio_scan_switch_coreidx(struct ssb_bus *bus, u8 coreidx) ssb_sdio_scan_switch_coreidx() argument 156 static inline int ssb_sdio_hardware_setup(struct ssb_bus *bus) ssb_sdio_hardware_setup() argument 160 static inline void ssb_sdio_exit(struct ssb_bus *bus) ssb_sdio_exit() argument 163 static inline int ssb_sdio_init(struct ssb_bus *bus) ssb_sdio_init() argument 172 extern int ssb_bus_scan(struct ssb_bus *bus, 179 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf, 180 int (*sprom_read)(struct ssb_bus *bus, u16 *sprom)); 182 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus, 185 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom)); 186 extern int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, 194 int (*func)(struct ssb_bus *bus, unsigned long data)); 198 /* Pointer to the bus */ 199 struct ssb_bus *bus; member in struct:ssb_freeze_context 200 /* Boolean list to indicate whether a device is frozen on this bus. */ 203 extern int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx); 267 extern int ssb_watchdog_register(struct ssb_bus *bus); 269 static inline int ssb_watchdog_register(struct ssb_bus *bus) ssb_watchdog_register() argument 284 extern int ssb_gpio_init(struct ssb_bus *bus); 285 extern int ssb_gpio_unregister(struct ssb_bus *bus); 287 static inline int ssb_gpio_init(struct ssb_bus *bus) ssb_gpio_init() argument 291 static inline int ssb_gpio_unregister(struct ssb_bus *bus) ssb_gpio_unregister() argument
|
H A D | driver_mipscore.c | 85 struct ssb_bus *bus = rdev->bus; find_device() local 87 for (i = 0; i < bus->nr_devices; i++) { find_device() 89 dev = &(bus->devices[i]); find_device() 103 struct ssb_bus *bus = dev->bus; ssb_mips_irq() local 104 struct ssb_device *mdev = bus->mipscore.dev; ssb_mips_irq() 113 ipsflag = ssb_read32(bus->mipscore.dev, SSB_IPSFLAG); ssb_mips_irq() 127 static void clear_irq(struct ssb_bus *bus, unsigned int irq) clear_irq() argument 129 struct ssb_device *dev = bus->mipscore.dev; clear_irq() 144 struct ssb_bus *bus = dev->bus; set_irq() local 145 struct ssb_device *mdev = bus->mipscore.dev; set_irq() 156 clear_irq(bus, oldirq); set_irq() 191 static void dump_irq(struct ssb_bus *bus) dump_irq() argument 194 for (i = 0; i < bus->nr_devices; i++) { dump_irq() 196 dev = &(bus->devices[i]); dump_irq() 203 struct ssb_bus *bus = mcore->dev->bus; ssb_mips_serial_init() local 205 if (ssb_extif_available(&bus->extif)) ssb_mips_serial_init() 206 mcore->nr_serial_ports = ssb_extif_serial_init(&bus->extif, mcore->serial_ports); ssb_mips_serial_init() 207 else if (ssb_chipco_available(&bus->chipco)) ssb_mips_serial_init() 208 mcore->nr_serial_ports = ssb_chipco_serial_init(&bus->chipco, mcore->serial_ports); ssb_mips_serial_init() 215 struct ssb_bus *bus = mcore->dev->bus; ssb_mips_flash_detect() local 219 /* When there is no chipcommon on the bus there is 4MB flash */ ssb_mips_flash_detect() 220 if (!ssb_chipco_available(&bus->chipco)) { ssb_mips_flash_detect() 229 switch (bus->chipco.capabilities & SSB_CHIPCO_CAP_FLASHT) { ssb_mips_flash_detect() 233 ssb_sflash_init(&bus->chipco); ssb_mips_flash_detect() 240 if ((ssb_read32(bus->chipco.dev, SSB_CHIPCO_FLASH_CFG) ssb_mips_flash_detect() 266 struct ssb_bus *bus = mcore->dev->bus; ssb_cpu_clock() local 269 if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) ssb_cpu_clock() 270 return ssb_pmu_get_cpu_clock(&bus->chipco); ssb_cpu_clock() 272 if (ssb_extif_available(&bus->extif)) { ssb_cpu_clock() 273 ssb_extif_get_clockcontrol(&bus->extif, &pll_type, &n, &m); ssb_cpu_clock() 274 } else if (ssb_chipco_available(&bus->chipco)) { ssb_cpu_clock() 275 ssb_chipco_get_clockcpu(&bus->chipco, &pll_type, &n, &m); ssb_cpu_clock() 279 if ((pll_type == SSB_PLLTYPE_5) || (bus->chip_id == 0x5365)) { ssb_cpu_clock() 294 struct ssb_bus *bus; ssb_mipscore_init() local 304 bus = mcore->dev->bus; ssb_mipscore_init() 305 hz = ssb_clockspeed(bus); ssb_mipscore_init() 310 if (ssb_extif_available(&bus->extif)) ssb_mipscore_init() 311 ssb_extif_timing_init(&bus->extif, ns); ssb_mipscore_init() 312 else if (ssb_chipco_available(&bus->chipco)) ssb_mipscore_init() 313 ssb_chipco_timing_init(&bus->chipco, ns); ssb_mipscore_init() 315 /* Assign IRQs to all cores on the bus, start with irq line 2, because serial usually takes 1 */ ssb_mipscore_init() 316 for (irq = 2, i = 0; i < bus->nr_devices; i++) { ssb_mipscore_init() 318 dev = &(bus->devices[i]); ssb_mipscore_init() 330 if ((bus->chip_id == 0x4710) && (irq <= 4)) { ssb_mipscore_init() 351 dump_irq(bus); ssb_mipscore_init()
|
H A D | main.c | 43 /* There are differences in the codeflow, if the bus is 58 struct ssb_bus *bus; ssb_pci_dev_to_bus() local 61 list_for_each_entry(bus, &buses, list) { ssb_pci_dev_to_bus() 62 if (bus->bustype == SSB_BUSTYPE_PCI && ssb_pci_dev_to_bus() 63 bus->host_pci == pdev) ssb_pci_dev_to_bus() 66 bus = NULL; ssb_pci_dev_to_bus() 70 return bus; ssb_pci_dev_to_bus() 77 struct ssb_bus *bus; ssb_pcmcia_dev_to_bus() local 80 list_for_each_entry(bus, &buses, list) { ssb_pcmcia_dev_to_bus() 81 if (bus->bustype == SSB_BUSTYPE_PCMCIA && ssb_pcmcia_dev_to_bus() 82 bus->host_pcmcia == pdev) ssb_pcmcia_dev_to_bus() 85 bus = NULL; ssb_pcmcia_dev_to_bus() 89 return bus; ssb_pcmcia_dev_to_bus() 94 int (*func)(struct ssb_bus *bus, unsigned long data)) ssb_for_each_bus_call() 96 struct ssb_bus *bus; ssb_for_each_bus_call() local 100 list_for_each_entry(bus, &buses, list) { ssb_for_each_bus_call() 101 res = func(bus, data); ssb_for_each_bus_call() 159 int ssb_bus_resume(struct ssb_bus *bus) ssb_bus_resume() argument 165 bus->mapped_device = NULL; ssb_bus_resume() 167 bus->pcicore.setup_done = 0; ssb_bus_resume() 170 err = ssb_bus_powerup(bus, 0); ssb_bus_resume() 173 err = ssb_pcmcia_hardware_setup(bus); ssb_bus_resume() 175 ssb_bus_may_powerdown(bus); ssb_bus_resume() 178 ssb_chipco_resume(&bus->chipco); ssb_bus_resume() 179 ssb_bus_may_powerdown(bus); ssb_bus_resume() 185 int ssb_bus_suspend(struct ssb_bus *bus) ssb_bus_suspend() argument 187 ssb_chipco_suspend(&bus->chipco); ssb_bus_suspend() 188 ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0); ssb_bus_suspend() 195 /** ssb_devices_freeze - Freeze all devices on the bus. 198 * on this bus anymore. ssb_devices_thaw() must be called after 201 * @bus: The bus. 204 int ssb_devices_freeze(struct ssb_bus *bus, struct ssb_freeze_context *ctx) ssb_devices_freeze() argument 211 ctx->bus = bus; ssb_devices_freeze() 212 SSB_WARN_ON(bus->nr_devices > ARRAY_SIZE(ctx->device_frozen)); ssb_devices_freeze() 214 for (i = 0; i < bus->nr_devices; i++) { ssb_devices_freeze() 215 sdev = ssb_device_get(&bus->devices[i]); ssb_devices_freeze() 232 /** ssb_devices_thaw - Unfreeze all devices on the bus. 240 struct ssb_bus *bus = ctx->bus; ssb_devices_thaw() local 246 for (i = 0; i < bus->nr_devices; i++) { ssb_devices_thaw() 249 sdev = &bus->devices[i]; ssb_devices_thaw() 411 static void ssb_devices_unregister(struct ssb_bus *bus) ssb_devices_unregister() argument 416 for (i = bus->nr_devices - 1; i >= 0; i--) { ssb_devices_unregister() 417 sdev = &(bus->devices[i]); ssb_devices_unregister() 423 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_devices_unregister() 424 platform_device_unregister(bus->watchdog); ssb_devices_unregister() 428 void ssb_bus_unregister(struct ssb_bus *bus) ssb_bus_unregister() argument 432 err = ssb_gpio_unregister(bus); ssb_bus_unregister() 439 ssb_devices_unregister(bus); ssb_bus_unregister() 440 list_del(&bus->list); ssb_bus_unregister() 443 ssb_pcmcia_exit(bus); ssb_bus_unregister() 444 ssb_pci_exit(bus); ssb_bus_unregister() 445 ssb_iounmap(bus); ssb_bus_unregister() 457 static int ssb_devices_register(struct ssb_bus *bus) ssb_devices_register() argument 465 for (i = 0; i < bus->nr_devices; i++) { ssb_devices_register() 466 sdev = &(bus->devices[i]); ssb_devices_register() 491 dev->bus = &ssb_bustype; ssb_devices_register() 492 dev_set_name(dev, "ssb%u:%d", bus->busnumber, dev_idx); ssb_devices_register() 494 switch (bus->bustype) { ssb_devices_register() 497 sdev->irq = bus->host_pci->irq; ssb_devices_register() 498 dev->parent = &bus->host_pci->dev; ssb_devices_register() 504 sdev->irq = bus->host_pcmcia->irq; ssb_devices_register() 505 dev->parent = &bus->host_pcmcia->dev; ssb_devices_register() 510 dev->parent = &bus->host_sdio->dev; ssb_devices_register() 533 if (bus->mipscore.pflash.present) { ssb_devices_register() 541 if (bus->mipscore.sflash.present) { ssb_devices_register() 551 ssb_devices_unregister(bus); ssb_devices_register() 558 struct ssb_bus *bus, *n; ssb_attach_queued_buses() local 562 list_for_each_entry_safe(bus, n, &attach_queue, list) { ssb_attach_queued_buses() 564 list_del(&bus->list); ssb_attach_queued_buses() 571 err = ssb_bus_powerup(bus, 0); ssb_attach_queued_buses() 574 ssb_pcicore_init(&bus->pcicore); ssb_attach_queued_buses() 575 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_attach_queued_buses() 576 ssb_watchdog_register(bus); ssb_attach_queued_buses() 578 err = ssb_gpio_init(bus); ssb_attach_queued_buses() 584 ssb_bus_may_powerdown(bus); ssb_attach_queued_buses() 586 err = ssb_devices_register(bus); ssb_attach_queued_buses() 590 list_del(&bus->list); ssb_attach_queued_buses() 593 list_move_tail(&bus->list, &buses); ssb_attach_queued_buses() 601 struct ssb_bus *bus = dev->bus; ssb_ssb_read8() local 604 return readb(bus->mmio + offset); ssb_ssb_read8() 609 struct ssb_bus *bus = dev->bus; ssb_ssb_read16() local 612 return readw(bus->mmio + offset); ssb_ssb_read16() 617 struct ssb_bus *bus = dev->bus; ssb_ssb_read32() local 620 return readl(bus->mmio + offset); ssb_ssb_read32() 627 struct ssb_bus *bus = dev->bus; ssb_ssb_block_read() local 631 addr = bus->mmio + offset; ssb_ssb_block_read() 674 struct ssb_bus *bus = dev->bus; ssb_ssb_write8() local 677 writeb(value, bus->mmio + offset); ssb_ssb_write8() 682 struct ssb_bus *bus = dev->bus; ssb_ssb_write16() local 685 writew(value, bus->mmio + offset); ssb_ssb_write16() 690 struct ssb_bus *bus = dev->bus; ssb_ssb_write32() local 693 writel(value, bus->mmio + offset); ssb_ssb_write32() 700 struct ssb_bus *bus = dev->bus; ssb_ssb_block_write() local 704 addr = bus->mmio + offset; ssb_ssb_block_write() 745 /* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */ 759 static int ssb_fetch_invariants(struct ssb_bus *bus, ssb_fetch_invariants() argument 766 err = get_invariants(bus, &iv); ssb_fetch_invariants() 769 memcpy(&bus->boardinfo, &iv.boardinfo, sizeof(iv.boardinfo)); ssb_fetch_invariants() 770 memcpy(&bus->sprom, &iv.sprom, sizeof(iv.sprom)); ssb_fetch_invariants() 771 bus->has_cardbus_slot = iv.has_cardbus_slot; ssb_fetch_invariants() 776 static int ssb_bus_register(struct ssb_bus *bus, ssb_bus_register() argument 782 spin_lock_init(&bus->bar_lock); ssb_bus_register() 783 INIT_LIST_HEAD(&bus->list); ssb_bus_register() 785 spin_lock_init(&bus->gpio_lock); ssb_bus_register() 788 /* Powerup the bus */ ssb_bus_register() 789 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1); ssb_bus_register() 794 err = ssb_sdio_init(bus); ssb_bus_register() 799 bus->busnumber = next_busnumber; ssb_bus_register() 801 err = ssb_bus_scan(bus, baseaddr); ssb_bus_register() 806 err = ssb_pci_init(bus); ssb_bus_register() 810 err = ssb_pcmcia_init(bus); ssb_bus_register() 815 err = ssb_bus_powerup(bus, 0); ssb_bus_register() 818 ssb_chipcommon_init(&bus->chipco); ssb_bus_register() 819 ssb_extif_init(&bus->extif); ssb_bus_register() 820 ssb_mipscore_init(&bus->mipscore); ssb_bus_register() 821 err = ssb_fetch_invariants(bus, get_invariants); ssb_bus_register() 823 ssb_bus_may_powerdown(bus); ssb_bus_register() 826 ssb_bus_may_powerdown(bus); ssb_bus_register() 830 list_add_tail(&bus->list, &attach_queue); ssb_bus_register() 832 /* This is not early boot, so we must attach the bus now */ ssb_bus_register() 844 list_del(&bus->list); ssb_bus_register() 846 ssb_pcmcia_exit(bus); ssb_bus_register() 848 ssb_pci_exit(bus); ssb_bus_register() 850 ssb_iounmap(bus); ssb_bus_register() 852 ssb_sdio_exit(bus); ssb_bus_register() 855 ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0); ssb_bus_register() 860 int ssb_bus_pcibus_register(struct ssb_bus *bus, struct pci_dev *host_pci) ssb_bus_pcibus_register() argument 864 bus->bustype = SSB_BUSTYPE_PCI; ssb_bus_pcibus_register() 865 bus->host_pci = host_pci; ssb_bus_pcibus_register() 866 bus->ops = &ssb_pci_ops; ssb_bus_pcibus_register() 868 err = ssb_bus_register(bus, ssb_pci_get_invariants, 0); ssb_bus_pcibus_register() 883 int ssb_bus_pcmciabus_register(struct ssb_bus *bus, ssb_bus_pcmciabus_register() argument 889 bus->bustype = SSB_BUSTYPE_PCMCIA; ssb_bus_pcmciabus_register() 890 bus->host_pcmcia = pcmcia_dev; ssb_bus_pcmciabus_register() 891 bus->ops = &ssb_pcmcia_ops; ssb_bus_pcmciabus_register() 893 err = ssb_bus_register(bus, ssb_pcmcia_get_invariants, baseaddr); ssb_bus_pcmciabus_register() 905 int ssb_bus_sdiobus_register(struct ssb_bus *bus, struct sdio_func *func, ssb_bus_sdiobus_register() argument 910 bus->bustype = SSB_BUSTYPE_SDIO; ssb_bus_sdiobus_register() 911 bus->host_sdio = func; ssb_bus_sdiobus_register() 912 bus->ops = &ssb_sdio_ops; ssb_bus_sdiobus_register() 913 bus->quirks = quirks; ssb_bus_sdiobus_register() 915 err = ssb_bus_register(bus, ssb_sdio_get_invariants, ~0); ssb_bus_sdiobus_register() 926 int ssb_bus_ssbbus_register(struct ssb_bus *bus, unsigned long baseaddr, ssb_bus_ssbbus_register() argument 931 bus->bustype = SSB_BUSTYPE_SSB; ssb_bus_ssbbus_register() 932 bus->ops = &ssb_ssb_ops; ssb_bus_ssbbus_register() 934 err = ssb_bus_register(bus, get_invariants, baseaddr); ssb_bus_ssbbus_register() 946 drv->drv.bus = &ssb_bustype; __ssb_driver_register() 961 struct ssb_bus *bus = dev->bus; ssb_set_devtypedata() local 965 for (i = 0; i < bus->nr_devices; i++) { ssb_set_devtypedata() 966 ent = &(bus->devices[i]); ssb_set_devtypedata() 1093 u32 ssb_clockspeed(struct ssb_bus *bus) ssb_clockspeed() argument 1099 if (bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU) ssb_clockspeed() 1100 return ssb_pmu_get_controlclock(&bus->chipco); ssb_clockspeed() 1102 if (ssb_extif_available(&bus->extif)) ssb_clockspeed() 1103 ssb_extif_get_clockcontrol(&bus->extif, &plltype, ssb_clockspeed() 1105 else if (bus->chipco.dev) ssb_clockspeed() 1106 ssb_chipco_get_clockcontrol(&bus->chipco, &plltype, ssb_clockspeed() 1111 if (bus->chip_id == 0x5365) { ssb_clockspeed() 1273 u16 chip_id = dev->bus->chip_id; ssb_dma_translation_special_bit() 1285 switch (dev->bus->bustype) { ssb_dma_translation() 1289 if (pci_is_pcie(dev->bus->host_pci) && ssb_dma_translation() 1305 int ssb_bus_may_powerdown(struct ssb_bus *bus) ssb_bus_may_powerdown() argument 1313 if (bus->bustype == SSB_BUSTYPE_SSB) ssb_bus_may_powerdown() 1316 cc = &bus->chipco; ssb_bus_may_powerdown() 1324 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 0); ssb_bus_may_powerdown() 1329 bus->powered_up = 0; ssb_bus_may_powerdown() 1338 int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl) ssb_bus_powerup() argument 1343 err = ssb_pci_xtal(bus, SSB_GPIO_XTAL | SSB_GPIO_PLL, 1); ssb_bus_powerup() 1348 bus->powered_up = 1; ssb_bus_powerup() 1352 ssb_chipco_set_clockmode(&bus->chipco, mode); ssb_bus_powerup() 1376 void ssb_commit_settings(struct ssb_bus *bus) ssb_commit_settings() argument 1381 dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev; ssb_commit_settings() 1383 dev = bus->chipco.dev; ssb_commit_settings() 93 ssb_for_each_bus_call(unsigned long data, int (*func)(struct ssb_bus *bus, unsigned long data)) ssb_for_each_bus_call() argument
|
H A D | pcmcia.c | 71 static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) ssb_pcmcia_cfg_write() argument 75 res = pcmcia_write_config_byte(bus->host_pcmcia, offset, value); ssb_pcmcia_cfg_write() 83 static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value) ssb_pcmcia_cfg_read() argument 87 res = pcmcia_read_config_byte(bus->host_pcmcia, offset, value); ssb_pcmcia_cfg_read() 94 int ssb_pcmcia_switch_coreidx(struct ssb_bus *bus, ssb_pcmcia_switch_coreidx() argument 106 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_ADDRESS0, ssb_pcmcia_switch_coreidx() 110 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_ADDRESS1, ssb_pcmcia_switch_coreidx() 114 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_ADDRESS2, ssb_pcmcia_switch_coreidx() 121 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_ADDRESS0, &val); ssb_pcmcia_switch_coreidx() 125 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_ADDRESS1, &val); ssb_pcmcia_switch_coreidx() 129 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_ADDRESS2, &val); ssb_pcmcia_switch_coreidx() 150 int ssb_pcmcia_switch_core(struct ssb_bus *bus, ssb_pcmcia_switch_core() argument 161 err = ssb_pcmcia_switch_coreidx(bus, dev->core_index); ssb_pcmcia_switch_core() 163 bus->mapped_device = dev; ssb_pcmcia_switch_core() 168 int ssb_pcmcia_switch_segment(struct ssb_bus *bus, u8 seg) ssb_pcmcia_switch_segment() argument 176 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_MEMSEG, seg); ssb_pcmcia_switch_segment() 179 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_MEMSEG, &val); ssb_pcmcia_switch_segment() 190 bus->mapped_pcmcia_seg = seg; ssb_pcmcia_switch_segment() 201 struct ssb_bus *bus = dev->bus; select_core_and_segment() local 211 if (unlikely(dev != bus->mapped_device)) { select_core_and_segment() 212 err = ssb_pcmcia_switch_core(bus, dev); select_core_and_segment() 216 if (unlikely(need_segment != bus->mapped_pcmcia_seg)) { select_core_and_segment() 217 err = ssb_pcmcia_switch_segment(bus, need_segment); select_core_and_segment() 227 struct ssb_bus *bus = dev->bus; ssb_pcmcia_read8() local 232 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_read8() 235 value = readb(bus->mmio + offset); ssb_pcmcia_read8() 236 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_read8() 243 struct ssb_bus *bus = dev->bus; ssb_pcmcia_read16() local 248 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_read16() 251 value = readw(bus->mmio + offset); ssb_pcmcia_read16() 252 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_read16() 259 struct ssb_bus *bus = dev->bus; ssb_pcmcia_read32() local 264 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_read32() 267 lo = readw(bus->mmio + offset); ssb_pcmcia_read32() 268 hi = readw(bus->mmio + offset + 2); ssb_pcmcia_read32() 270 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_read32() 279 struct ssb_bus *bus = dev->bus; ssb_pcmcia_block_read() local 281 void __iomem *addr = bus->mmio + offset; ssb_pcmcia_block_read() 284 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_block_read() 329 spin_unlock_irqrestore(&bus->bar_lock, flags); 335 struct ssb_bus *bus = dev->bus; ssb_pcmcia_write8() local 339 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_write8() 342 writeb(value, bus->mmio + offset); ssb_pcmcia_write8() 344 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_write8() 349 struct ssb_bus *bus = dev->bus; ssb_pcmcia_write16() local 353 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_write16() 356 writew(value, bus->mmio + offset); ssb_pcmcia_write16() 358 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_write16() 363 struct ssb_bus *bus = dev->bus; ssb_pcmcia_write32() local 367 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_write32() 370 writew((value & 0x0000FFFF), bus->mmio + offset); ssb_pcmcia_write32() 371 writew(((value & 0xFFFF0000) >> 16), bus->mmio + offset + 2); ssb_pcmcia_write32() 374 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pcmcia_write32() 381 struct ssb_bus *bus = dev->bus; ssb_pcmcia_block_write() local 383 void __iomem *addr = bus->mmio + offset; ssb_pcmcia_block_write() 386 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pcmcia_block_write() 430 spin_unlock_irqrestore(&bus->bar_lock, flags); 448 static int ssb_pcmcia_sprom_command(struct ssb_bus *bus, u8 command) ssb_pcmcia_sprom_command() argument 454 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROMCTL, command); ssb_pcmcia_sprom_command() 458 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_SPROMCTL, &value); ssb_pcmcia_sprom_command() 470 static int ssb_pcmcia_sprom_read(struct ssb_bus *bus, u16 offset, u16 *value) ssb_pcmcia_sprom_read() argument 477 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_ADDRLO, ssb_pcmcia_sprom_read() 481 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_ADDRHI, ssb_pcmcia_sprom_read() 485 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_READ); ssb_pcmcia_sprom_read() 488 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_SPROM_DATALO, &lo); ssb_pcmcia_sprom_read() 491 err = ssb_pcmcia_cfg_read(bus, SSB_PCMCIA_SPROM_DATAHI, &hi); ssb_pcmcia_sprom_read() 500 static int ssb_pcmcia_sprom_write(struct ssb_bus *bus, u16 offset, u16 value) ssb_pcmcia_sprom_write() argument 506 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_ADDRLO, ssb_pcmcia_sprom_write() 510 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_ADDRHI, ssb_pcmcia_sprom_write() 514 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_DATALO, ssb_pcmcia_sprom_write() 518 err = ssb_pcmcia_cfg_write(bus, SSB_PCMCIA_SPROM_DATAHI, ssb_pcmcia_sprom_write() 522 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITE); ssb_pcmcia_sprom_write() 531 static int ssb_pcmcia_sprom_read_all(struct ssb_bus *bus, u16 *sprom) ssb_pcmcia_sprom_read_all() argument 536 err = ssb_pcmcia_sprom_read(bus, i, &sprom[i]); ssb_pcmcia_sprom_read_all() 545 static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom) ssb_pcmcia_sprom_write_all() argument 552 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEEN); ssb_pcmcia_sprom_write_all() 568 err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); ssb_pcmcia_sprom_write_all() 575 err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); ssb_pcmcia_sprom_write_all() 704 int ssb_pcmcia_get_invariants(struct ssb_bus *bus, ssb_pcmcia_get_invariants() argument 716 res = pcmcia_loop_tuple(bus->host_pcmcia, CISTPL_FUNCE, ssb_pcmcia_get_invariants() 725 res = pcmcia_loop_tuple(bus->host_pcmcia, SSB_PCMCIA_CIS, ssb_pcmcia_get_invariants() 741 struct ssb_bus *bus; ssb_pcmcia_attr_sprom_show() local 743 bus = ssb_pcmcia_dev_to_bus(pdev); ssb_pcmcia_attr_sprom_show() 744 if (!bus) ssb_pcmcia_attr_sprom_show() 747 return ssb_attr_sprom_show(bus, buf, ssb_pcmcia_attr_sprom_show() 757 struct ssb_bus *bus; ssb_pcmcia_attr_sprom_store() local 759 bus = ssb_pcmcia_dev_to_bus(pdev); ssb_pcmcia_attr_sprom_store() 760 if (!bus) ssb_pcmcia_attr_sprom_store() 763 return ssb_attr_sprom_store(bus, buf, count, ssb_pcmcia_attr_sprom_store() 772 static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor) ssb_pcmcia_cor_setup() argument 777 err = ssb_pcmcia_cfg_read(bus, cor, &val); ssb_pcmcia_cor_setup() 782 err = ssb_pcmcia_cfg_write(bus, cor, val); ssb_pcmcia_cor_setup() 791 int ssb_pcmcia_hardware_setup(struct ssb_bus *bus) ssb_pcmcia_hardware_setup() argument 795 if (bus->bustype != SSB_BUSTYPE_PCMCIA) ssb_pcmcia_hardware_setup() 799 * bus->mapped_pcmcia_seg with hardware state. */ ssb_pcmcia_hardware_setup() 800 ssb_pcmcia_switch_segment(bus, 0); ssb_pcmcia_hardware_setup() 802 err = ssb_pcmcia_cor_setup(bus, CISREG_COR); ssb_pcmcia_hardware_setup() 806 err = ssb_pcmcia_cor_setup(bus, CISREG_COR + 0x80); ssb_pcmcia_hardware_setup() 813 void ssb_pcmcia_exit(struct ssb_bus *bus) ssb_pcmcia_exit() argument 815 if (bus->bustype != SSB_BUSTYPE_PCMCIA) ssb_pcmcia_exit() 818 device_remove_file(&bus->host_pcmcia->dev, &dev_attr_ssb_sprom); ssb_pcmcia_exit() 821 int ssb_pcmcia_init(struct ssb_bus *bus) ssb_pcmcia_init() argument 825 if (bus->bustype != SSB_BUSTYPE_PCMCIA) ssb_pcmcia_init() 828 err = ssb_pcmcia_hardware_setup(bus); ssb_pcmcia_init() 832 bus->sprom_size = SSB_PCMCIA_SPROM_SIZE; ssb_pcmcia_init() 833 mutex_init(&bus->sprom_mutex); ssb_pcmcia_init() 834 err = device_create_file(&bus->host_pcmcia->dev, &dev_attr_ssb_sprom); ssb_pcmcia_init()
|
H A D | sprom.c | 67 ssize_t ssb_attr_sprom_show(struct ssb_bus *bus, char *buf, ssb_attr_sprom_show() argument 68 int (*sprom_read)(struct ssb_bus *bus, u16 *sprom)) ssb_attr_sprom_show() 73 size_t sprom_size_words = bus->sprom_size; ssb_attr_sprom_show() 83 if (mutex_lock_interruptible(&bus->sprom_mutex)) ssb_attr_sprom_show() 85 err = sprom_read(bus, sprom); ssb_attr_sprom_show() 86 mutex_unlock(&bus->sprom_mutex); ssb_attr_sprom_show() 98 ssize_t ssb_attr_sprom_store(struct ssb_bus *bus, ssb_attr_sprom_store() argument 101 int (*sprom_write)(struct ssb_bus *bus, const u16 *sprom)) ssb_attr_sprom_store() 105 size_t sprom_size_words = bus->sprom_size; ssb_attr_sprom_store() 108 sprom = kcalloc(bus->sprom_size, sizeof(u16), GFP_KERNEL); ssb_attr_sprom_store() 126 if (mutex_lock_interruptible(&bus->sprom_mutex)) ssb_attr_sprom_store() 128 err = ssb_devices_freeze(bus, &freeze); ssb_attr_sprom_store() 133 res = sprom_write(bus, sprom); ssb_attr_sprom_store() 138 mutex_unlock(&bus->sprom_mutex); ssb_attr_sprom_store() 159 * SSB device hardwired to their PCI bus. 169 int ssb_arch_register_fallback_sprom(int (*sprom_callback)(struct ssb_bus *bus, ssb_arch_register_fallback_sprom() argument 179 int ssb_fill_sprom_with_fallback(struct ssb_bus *bus, struct ssb_sprom *out) ssb_fill_sprom_with_fallback() argument 184 return get_fallback_sprom(bus, out); ssb_fill_sprom_with_fallback() 188 bool ssb_is_sprom_available(struct ssb_bus *bus) ssb_is_sprom_available() argument 194 if (bus->bustype == SSB_BUSTYPE_PCI && ssb_is_sprom_available() 195 bus->chipco.dev && /* can be unavailable! */ ssb_is_sprom_available() 196 bus->chipco.dev->id.revision >= 31) ssb_is_sprom_available() 197 return bus->chipco.capabilities & SSB_CHIPCO_CAP_SPROM; ssb_is_sprom_available()
|
H A D | pci.c | 32 int ssb_pci_switch_coreidx(struct ssb_bus *bus, u8 coreidx) ssb_pci_switch_coreidx() argument 39 err = pci_write_config_dword(bus->host_pci, SSB_BAR0_WIN, ssb_pci_switch_coreidx() 44 err = pci_read_config_dword(bus->host_pci, SSB_BAR0_WIN, ssb_pci_switch_coreidx() 63 int ssb_pci_switch_core(struct ssb_bus *bus, ssb_pci_switch_core() argument 75 spin_lock_irqsave(&bus->bar_lock, flags); ssb_pci_switch_core() 76 err = ssb_pci_switch_coreidx(bus, dev->core_index); ssb_pci_switch_core() 78 bus->mapped_device = dev; ssb_pci_switch_core() 79 spin_unlock_irqrestore(&bus->bar_lock, flags); ssb_pci_switch_core() 85 int ssb_pci_xtal(struct ssb_bus *bus, u32 what, int turn_on) ssb_pci_xtal() argument 91 if (bus->bustype != SSB_BUSTYPE_PCI) ssb_pci_xtal() 94 err = pci_read_config_dword(bus->host_pci, SSB_GPIO_IN, &in); ssb_pci_xtal() 97 err = pci_read_config_dword(bus->host_pci, SSB_GPIO_OUT, &out); ssb_pci_xtal() 100 err = pci_read_config_dword(bus->host_pci, SSB_GPIO_OUT_ENABLE, &outenable); ssb_pci_xtal() 117 err = pci_write_config_dword(bus->host_pci, SSB_GPIO_OUT, out); ssb_pci_xtal() 120 err = pci_write_config_dword(bus->host_pci, SSB_GPIO_OUT_ENABLE, ssb_pci_xtal() 129 err = pci_write_config_dword(bus->host_pci, SSB_GPIO_OUT, out); ssb_pci_xtal() 136 err = pci_read_config_word(bus->host_pci, PCI_STATUS, &pci_status); ssb_pci_xtal() 140 err = pci_write_config_word(bus->host_pci, PCI_STATUS, pci_status); ssb_pci_xtal() 152 err = pci_write_config_dword(bus->host_pci, SSB_GPIO_OUT, out); ssb_pci_xtal() 155 err = pci_write_config_dword(bus->host_pci, SSB_GPIO_OUT_ENABLE, outenable); ssb_pci_xtal() 272 static int sprom_do_read(struct ssb_bus *bus, u16 *sprom) sprom_do_read() argument 276 for (i = 0; i < bus->sprom_size; i++) sprom_do_read() 277 sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2)); sprom_do_read() 282 static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom) sprom_do_write() argument 284 struct pci_dev *pdev = bus->host_pci; sprom_do_write() 287 u16 size = bus->sprom_size; sprom_do_write() 308 writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2)); sprom_do_write() 813 static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, sprom_extract() argument 823 if ((bus->chip_id & 0xFF00) == 0x4400) { sprom_extract() 859 static int ssb_pci_sprom_get(struct ssb_bus *bus, ssb_pci_sprom_get() argument 865 if (!ssb_is_sprom_available(bus)) { ssb_pci_sprom_get() 869 if (bus->chipco.dev) { /* can be unavailable! */ ssb_pci_sprom_get() 875 if (bus->chipco.dev->id.revision >= 31) ssb_pci_sprom_get() 876 bus->sprom_offset = SSB_SPROM_BASE31; ssb_pci_sprom_get() 877 else if (bus->chip_id == 0x4312 && ssb_pci_sprom_get() 878 (bus->chipco.status & 0x03) == 2) ssb_pci_sprom_get() 879 bus->sprom_offset = SSB_SPROM_BASE31; ssb_pci_sprom_get() 881 bus->sprom_offset = SSB_SPROM_BASE1; ssb_pci_sprom_get() 883 bus->sprom_offset = SSB_SPROM_BASE1; ssb_pci_sprom_get() 885 ssb_dbg("SPROM offset is 0x%x\n", bus->sprom_offset); ssb_pci_sprom_get() 890 bus->sprom_size = SSB_SPROMSIZE_WORDS_R123; ssb_pci_sprom_get() 891 sprom_do_read(bus, buf); ssb_pci_sprom_get() 892 err = sprom_check_crc(buf, bus->sprom_size); ssb_pci_sprom_get() 900 bus->sprom_size = SSB_SPROMSIZE_WORDS_R4; ssb_pci_sprom_get() 901 sprom_do_read(bus, buf); ssb_pci_sprom_get() 902 err = sprom_check_crc(buf, bus->sprom_size); ssb_pci_sprom_get() 908 err = ssb_fill_sprom_with_fallback(bus, sprom); ssb_pci_sprom_get() 921 err = sprom_extract(bus, sprom, buf, bus->sprom_size); ssb_pci_sprom_get() 928 static void ssb_pci_get_boardinfo(struct ssb_bus *bus, ssb_pci_get_boardinfo() argument 931 bi->vendor = bus->host_pci->subsystem_vendor; ssb_pci_get_boardinfo() 932 bi->type = bus->host_pci->subsystem_device; ssb_pci_get_boardinfo() 935 int ssb_pci_get_invariants(struct ssb_bus *bus, ssb_pci_get_invariants() argument 940 err = ssb_pci_sprom_get(bus, &iv->sprom); ssb_pci_get_invariants() 943 ssb_pci_get_boardinfo(bus, &iv->boardinfo); ssb_pci_get_invariants() 950 static int ssb_pci_assert_buspower(struct ssb_bus *bus) ssb_pci_assert_buspower() argument 952 if (likely(bus->powered_up)) ssb_pci_assert_buspower() 957 if (bus->power_warn_count <= 10) { ssb_pci_assert_buspower() 958 bus->power_warn_count++; ssb_pci_assert_buspower() 965 static inline int ssb_pci_assert_buspower(struct ssb_bus *bus) ssb_pci_assert_buspower() argument 973 struct ssb_bus *bus = dev->bus; ssb_pci_read8() local 975 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_read8() 977 if (unlikely(bus->mapped_device != dev)) { ssb_pci_read8() 978 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_read8() 981 return ioread8(bus->mmio + offset); ssb_pci_read8() 986 struct ssb_bus *bus = dev->bus; ssb_pci_read16() local 988 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_read16() 990 if (unlikely(bus->mapped_device != dev)) { ssb_pci_read16() 991 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_read16() 994 return ioread16(bus->mmio + offset); ssb_pci_read16() 999 struct ssb_bus *bus = dev->bus; ssb_pci_read32() local 1001 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_read32() 1003 if (unlikely(bus->mapped_device != dev)) { ssb_pci_read32() 1004 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_read32() 1007 return ioread32(bus->mmio + offset); ssb_pci_read32() 1014 struct ssb_bus *bus = dev->bus; ssb_pci_block_read() local 1015 void __iomem *addr = bus->mmio + offset; ssb_pci_block_read() 1017 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_block_read() 1019 if (unlikely(bus->mapped_device != dev)) { ssb_pci_block_read() 1020 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_block_read() 1047 struct ssb_bus *bus = dev->bus; ssb_pci_write8() local 1049 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_write8() 1051 if (unlikely(bus->mapped_device != dev)) { ssb_pci_write8() 1052 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_write8() 1055 iowrite8(value, bus->mmio + offset); ssb_pci_write8() 1060 struct ssb_bus *bus = dev->bus; ssb_pci_write16() local 1062 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_write16() 1064 if (unlikely(bus->mapped_device != dev)) { ssb_pci_write16() 1065 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_write16() 1068 iowrite16(value, bus->mmio + offset); ssb_pci_write16() 1073 struct ssb_bus *bus = dev->bus; ssb_pci_write32() local 1075 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_write32() 1077 if (unlikely(bus->mapped_device != dev)) { ssb_pci_write32() 1078 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_write32() 1081 iowrite32(value, bus->mmio + offset); ssb_pci_write32() 1088 struct ssb_bus *bus = dev->bus; ssb_pci_block_write() local 1089 void __iomem *addr = bus->mmio + offset; ssb_pci_block_write() 1091 if (unlikely(ssb_pci_assert_buspower(bus))) ssb_pci_block_write() 1093 if (unlikely(bus->mapped_device != dev)) { ssb_pci_block_write() 1094 if (unlikely(ssb_pci_switch_core(bus, dev))) ssb_pci_block_write() 1134 struct ssb_bus *bus; ssb_pci_attr_sprom_show() local 1136 bus = ssb_pci_dev_to_bus(pdev); ssb_pci_attr_sprom_show() 1137 if (!bus) ssb_pci_attr_sprom_show() 1140 return ssb_attr_sprom_show(bus, buf, sprom_do_read); ssb_pci_attr_sprom_show() 1148 struct ssb_bus *bus; ssb_pci_attr_sprom_store() local 1150 bus = ssb_pci_dev_to_bus(pdev); ssb_pci_attr_sprom_store() 1151 if (!bus) ssb_pci_attr_sprom_store() 1154 return ssb_attr_sprom_store(bus, buf, count, ssb_pci_attr_sprom_store() 1162 void ssb_pci_exit(struct ssb_bus *bus) ssb_pci_exit() argument 1166 if (bus->bustype != SSB_BUSTYPE_PCI) ssb_pci_exit() 1169 pdev = bus->host_pci; ssb_pci_exit() 1173 int ssb_pci_init(struct ssb_bus *bus) ssb_pci_init() argument 1178 if (bus->bustype != SSB_BUSTYPE_PCI) ssb_pci_init() 1181 pdev = bus->host_pci; ssb_pci_init() 1182 mutex_init(&bus->sprom_mutex); ssb_pci_init()
|
H A D | driver_chipcommon.c | 46 struct ssb_bus *bus; ssb_chipco_set_clockmode() local 51 bus = ccdev->bus; ssb_chipco_set_clockmode() 80 ssb_pci_xtal(bus, SSB_GPIO_XTAL, 1); /* Force crystal on */ ssb_chipco_set_clockmode() 106 ssb_pci_xtal(bus, SSB_GPIO_XTAL, 0); ssb_chipco_set_clockmode() 121 struct ssb_bus *bus = cc->dev->bus; chipco_pctl_get_slowclksrc() local 125 if (bus->bustype == SSB_BUSTYPE_SSB || chipco_pctl_get_slowclksrc() 126 bus->bustype == SSB_BUSTYPE_PCMCIA) chipco_pctl_get_slowclksrc() 128 if (bus->bustype == SSB_BUSTYPE_PCI) { chipco_pctl_get_slowclksrc() 129 pci_read_config_dword(bus->host_pci, SSB_GPIO_OUT, &tmp); chipco_pctl_get_slowclksrc() 213 struct ssb_bus *bus = cc->dev->bus; chipco_powercontrol_init() local 215 if (bus->chip_id == 0x4321) { chipco_powercontrol_init() 216 if (bus->chip_rev == 0) chipco_powercontrol_init() 218 else if (bus->chip_rev == 1) chipco_powercontrol_init() 244 struct ssb_bus *bus = cc->dev->bus; pmu_fast_powerup_delay() local 246 switch (bus->chip_id) { pmu_fast_powerup_delay() 261 struct ssb_bus *bus = cc->dev->bus; calc_fast_powerup_delay() local 266 if (bus->bustype != SSB_BUSTYPE_PCI) calc_fast_powerup_delay() 315 if (cc->dev->bus->bustype != SSB_BUSTYPE_SSB) ssb_chipco_watchdog_timer_set_wdt() 326 if (cc->dev->bus->bustype != SSB_BUSTYPE_SSB) ssb_chipco_watchdog_timer_set_ms() 335 struct ssb_bus *bus = cc->dev->bus; ssb_chipco_watchdog_ticks_per_ms() local 342 return ssb_clockspeed(bus) / 1000; ssb_chipco_watchdog_ticks_per_ms() 369 if (cc->dev->bus->bustype == SSB_BUSTYPE_SSB) { ssb_chipcommon_init() 413 /* Get the bus clock */ ssb_chipco_get_clockcontrol() 424 if (cc->dev->bus->chip_id != 0x5365) { ssb_chipco_get_clockcontrol() 438 struct ssb_bus *bus = dev->bus; ssb_chipco_timing_init() local 452 if ((bus->chip_id == 0x5365) || ssb_chipco_timing_init() 455 if ((bus->chip_id == 0x5365) || ssb_chipco_timing_init() 457 ((bus->chip_id == 0x5350) && (bus->chip_rev == 0))) ssb_chipco_timing_init() 460 if (bus->chip_id == 0x5350) { ssb_chipco_timing_init() 604 struct ssb_bus *bus = cc->dev->bus; ssb_chipco_serial_init() local 651 baud_base = ssb_clockspeed(bus); ssb_chipco_serial_init() 680 cc_mmio = cc->dev->bus->mmio + (cc->dev->core_index * SSB_CORE_SIZE); ssb_chipco_serial_init()
|
/linux-4.1.27/drivers/pci/ |
H A D | of.c | 20 if (!dev->bus->dev.of_node) pci_set_of_node() 22 dev->dev.of_node = of_pci_find_child_device(dev->bus->dev.of_node, pci_set_of_node() 32 void pci_set_bus_of_node(struct pci_bus *bus) pci_set_bus_of_node() argument 34 if (bus->self == NULL) pci_set_bus_of_node() 35 bus->dev.of_node = pcibios_get_phb_of_node(bus); pci_set_bus_of_node() 37 bus->dev.of_node = of_node_get(bus->self->dev.of_node); pci_set_bus_of_node() 40 void pci_release_bus_of_node(struct pci_bus *bus) pci_release_bus_of_node() argument 42 of_node_put(bus->dev.of_node); pci_release_bus_of_node() 43 bus->dev.of_node = NULL; pci_release_bus_of_node() 46 struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus) pcibios_get_phb_of_node() argument 49 if (WARN_ON(bus->self || bus->parent)) pcibios_get_phb_of_node() 53 * create above the root bus or it's own parent. Normally only pcibios_get_phb_of_node() 56 if (bus->bridge->of_node) pcibios_get_phb_of_node() 57 return of_node_get(bus->bridge->of_node); pcibios_get_phb_of_node() 58 if (bus->bridge->parent && bus->bridge->parent->of_node) pcibios_get_phb_of_node() 59 return of_node_get(bus->bridge->parent->of_node); pcibios_get_phb_of_node()
|
H A D | remove.c | 29 if (dev->bus->self) pci_stop_dev() 48 void pci_remove_bus(struct pci_bus *bus) pci_remove_bus() argument 50 pci_proc_detach_bus(bus); pci_remove_bus() 53 list_del(&bus->node); pci_remove_bus() 54 pci_bus_release_busn_res(bus); pci_remove_bus() 56 pci_remove_legacy_files(bus); pci_remove_bus() 57 pcibios_remove_bus(bus); pci_remove_bus() 58 device_unregister(&bus->dev); pci_remove_bus() 64 struct pci_bus *bus = dev->subordinate; pci_stop_bus_device() local 69 * which will update the bus->devices list and confuse the pci_stop_bus_device() 73 if (bus) { pci_stop_bus_device() 75 &bus->devices, bus_list) pci_stop_bus_device() 84 struct pci_bus *bus = dev->subordinate; pci_remove_bus_device() local 87 if (bus) { pci_remove_bus_device() 89 &bus->devices, bus_list) pci_remove_bus_device() 92 pci_remove_bus(bus); pci_remove_bus_device() 126 void pci_stop_root_bus(struct pci_bus *bus) pci_stop_root_bus() argument 131 if (!pci_is_root_bus(bus)) pci_stop_root_bus() 134 host_bridge = to_pci_host_bridge(bus->bridge); pci_stop_root_bus() 136 &bus->devices, bus_list) pci_stop_root_bus() 144 void pci_remove_root_bus(struct pci_bus *bus) pci_remove_root_bus() argument 149 if (!pci_is_root_bus(bus)) pci_remove_root_bus() 152 host_bridge = to_pci_host_bridge(bus->bridge); pci_remove_root_bus() 154 &bus->devices, bus_list) pci_remove_root_bus() 156 pci_remove_bus(bus); pci_remove_root_bus() 157 host_bridge->bus = NULL; pci_remove_root_bus()
|
H A D | host-bridge.c | 11 static struct pci_bus *find_pci_root_bus(struct pci_bus *bus) find_pci_root_bus() argument 13 while (bus->parent) find_pci_root_bus() 14 bus = bus->parent; find_pci_root_bus() 16 return bus; find_pci_root_bus() 19 struct pci_host_bridge *pci_find_host_bridge(struct pci_bus *bus) pci_find_host_bridge() argument 21 struct pci_bus *root_bus = find_pci_root_bus(bus); pci_find_host_bridge() 28 struct pci_bus *root_bus = find_pci_root_bus(dev->bus); pci_get_host_bridge_device() 48 void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, pcibios_resource_to_bus() argument 51 struct pci_host_bridge *bridge = pci_find_host_bridge(bus); pcibios_resource_to_bus() 73 void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, pcibios_bus_to_resource() argument 76 struct pci_host_bridge *bridge = pci_find_host_bridge(bus); pcibios_bus_to_resource()
|
H A D | bus.c | 2 * drivers/pci/bus.c 48 void pci_bus_add_resource(struct pci_bus *bus, struct resource *res, pci_bus_add_resource() argument 55 dev_err(&bus->dev, "can't add %pR resource\n", res); pci_bus_add_resource() 61 list_add_tail(&bus_res->list, &bus->resources); pci_bus_add_resource() 64 struct resource *pci_bus_resource_n(const struct pci_bus *bus, int n) pci_bus_resource_n() argument 69 return bus->resource[n]; pci_bus_resource_n() 72 list_for_each_entry(bus_res, &bus->resources, list) { pci_bus_resource_n() 80 void pci_bus_remove_resources(struct pci_bus *bus) pci_bus_remove_resources() argument 86 bus->resource[i] = NULL; pci_bus_remove_resources() 88 list_for_each_entry_safe(bus_res, tmp, &bus->resources, list) { pci_bus_remove_resources() 103 * @res contains CPU addresses. Clip it so the corresponding bus addresses 104 * on @bus are entirely within @region. This is used to control the bus 108 static void pci_clip_resource_to_region(struct pci_bus *bus, pci_clip_resource_to_region() argument 114 pcibios_resource_to_bus(bus, &r, res); pci_clip_resource_to_region() 123 pcibios_bus_to_resource(bus, res, &r); pci_clip_resource_to_region() 126 static int pci_bus_alloc_from_region(struct pci_bus *bus, struct resource *res, pci_bus_alloc_from_region() argument 142 pci_bus_for_each_resource(bus, r, i) { pci_bus_for_each_resource() 159 pci_clip_resource_to_region(bus, &avail, region); pci_bus_for_each_resource() 182 * pci_bus_alloc_resource - allocate a resource from a parent bus 183 * @bus: PCI bus 192 * Given the PCI bus a device resides on, the size, minimum address, 196 int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, pci_bus_alloc_resource() argument 209 rc = pci_bus_alloc_from_region(bus, res, size, align, min, pci_bus_alloc_resource() 215 return pci_bus_alloc_from_region(bus, res, size, align, min, pci_bus_alloc_resource() 221 return pci_bus_alloc_from_region(bus, res, size, align, min, pci_bus_alloc_resource() 235 struct pci_bus *bus = dev->bus; pci_bus_clip_resource() local 241 pci_bus_for_each_resource(bus, r, i) { pci_bus_for_each_resource() 272 void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { } pcibios_resource_survey_bus() argument 302 * @bus: bus to check for new devices 306 void pci_bus_add_devices(const struct pci_bus *bus) pci_bus_add_devices() argument 311 list_for_each_entry(dev, &bus->devices, bus_list) { pci_bus_add_devices() 318 list_for_each_entry(dev, &bus->devices, bus_list) { pci_bus_add_devices() 327 /** pci_walk_bus - walk devices on/under bus, calling callback. 328 * @top bus whose devices should be walked 332 * Walk the given bus, including any bridged devices 333 * on buses under this bus. Call the provided callback 344 struct pci_bus *bus; pci_walk_bus() local 348 bus = top; pci_walk_bus() 352 if (next == &bus->devices) { pci_walk_bus() 353 /* end of this bus, go up or finish */ pci_walk_bus() 354 if (bus == top) pci_walk_bus() 356 next = bus->self->bus_list.next; pci_walk_bus() 357 bus = bus->self->bus; pci_walk_bus() 364 bus = dev->subordinate; pci_walk_bus() 376 struct pci_bus *pci_bus_get(struct pci_bus *bus) pci_bus_get() argument 378 if (bus) pci_bus_get() 379 get_device(&bus->dev); pci_bus_get() 380 return bus; pci_bus_get() 384 void pci_bus_put(struct pci_bus *bus) pci_bus_put() argument 386 if (bus) pci_bus_put() 387 put_device(&bus->dev); pci_bus_put()
|
H A D | probe.c | 272 dev_info(&dev->dev, "reg 0x%x: can't handle BAR above 4GB (bus address %#010llx)\n", __pci_read_base() 281 pcibios_bus_to_resource(dev->bus, res, ®ion); __pci_read_base() 282 pcibios_resource_to_bus(dev->bus, &inverted_region, res); __pci_read_base() 285 * If "A" is a BAR value (a bus address), "bus_to_resource(A)" is __pci_read_base() 287 * the CPU. Converting that resource address back to a bus address __pci_read_base() 373 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_read_bridge_io() 395 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_read_bridge_mmio() 436 dev_err(&dev->dev, "can't handle bridge window above 4GB (bus address %#010llx)\n", pci_read_bridge_mmio_pref() 448 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_read_bridge_mmio_pref() 459 if (pci_is_root_bus(child)) /* It's a host bus, nothing to read */ pci_read_bridge_bases() 530 bridge->bus = b; pci_alloc_host_bridge() 572 void pcie_update_link_speed(struct pci_bus *bus, u16 linksta) pcie_update_link_speed() argument 574 bus->cur_bus_speed = pcie_link_speed[linksta & PCI_EXP_LNKSTA_CLS]; pcie_update_link_speed() 609 static void pci_set_bus_speed(struct pci_bus *bus) pci_set_bus_speed() argument 611 struct pci_dev *bridge = bus->self; pci_set_bus_speed() 621 bus->max_bus_speed = agp_speed(agpstat & 8, agpstat & 7); pci_set_bus_speed() 624 bus->cur_bus_speed = agp_speed(agpstat & 8, agpcmd & 7); pci_set_bus_speed() 648 bus->max_bus_speed = max; pci_set_bus_speed() 649 bus->cur_bus_speed = pcix_bus_speed[ pci_set_bus_speed() 660 bus->max_bus_speed = pcie_link_speed[linkcap & PCI_EXP_LNKCAP_SLS]; pci_set_bus_speed() 663 pcie_update_link_speed(bus, linksta); pci_set_bus_speed() 675 * Allocate a new bus, and inherit stuff from the parent.. pci_alloc_child_bus() 687 /* initialize some portions of the bus device, but don't register it pci_alloc_child_bus() 695 * bus numbers. pci_alloc_child_bus() 725 /* Create legacy_io and legacy_mem files for this bus */ pci_alloc_child_bus() 758 * If it's a bridge, configure it and scan the bus behind it. 765 * order to avoid overlaps between old and new bus numbers. 767 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max, int pass) pci_scan_bridge() argument 781 dev_dbg(&dev->dev, "scanning [bus %02x-%02x] behind bridge, pass %d\n", pci_scan_bridge() 784 if (!primary && (primary != bus->number) && secondary && subordinate) { pci_scan_bridge() 785 dev_warn(&dev->dev, "Primary bus is hard wired to 0\n"); pci_scan_bridge() 786 primary = bus->number; pci_scan_bridge() 791 (primary != bus->number || secondary <= bus->number || pci_scan_bridge() 793 dev_info(&dev->dev, "bridge configuration invalid ([bus %02x-%02x]), reconfiguring\n", pci_scan_bridge() 799 of bus errors (in some architectures) */ pci_scan_bridge() 817 * The bus might already exist for two reasons: Either we are pci_scan_bridge() 818 * rescanning the bus or the bus is reachable through more than pci_scan_bridge() 822 child = pci_find_bus(pci_domain_nr(bus), secondary); pci_scan_bridge() 824 child = pci_add_new_bus(bus, dev, secondary); pci_scan_bridge() 841 * We need to assign a number to this bus which we always pci_scan_bridge() 848 this bus segment to avoid possible pci_scan_bridge() 851 bus ranges. */ pci_scan_bridge() 860 /* Prevent assigning a bus number that already exists. pci_scan_bridge() 862 * this case we only re-scan this bus. */ pci_scan_bridge() 863 child = pci_find_bus(pci_domain_nr(bus), max+1); pci_scan_bridge() 865 child = pci_add_new_bus(bus, dev, max+1); pci_scan_bridge() 895 * For CardBus bridges, we leave 4 bus numbers pci_scan_bridge() 900 struct pci_bus *parent = bus; pci_scan_bridge() 901 if (pci_find_bus(pci_domain_nr(bus), pci_scan_bridge() 915 * -- try to leave one valid bus number pci_scan_bridge() 925 * Set the subordinate bus number to its real value. pci_scan_bridge() 933 pci_domain_nr(bus), child->number); pci_scan_bridge() 936 while (bus->parent) { pci_scan_bridge() 937 if ((child->busn_res.end > bus->busn_res.end) || pci_scan_bridge() 938 (child->number > bus->busn_res.end) || pci_scan_bridge() 939 (child->number < bus->number) || pci_scan_bridge() 940 (child->busn_res.end < bus->number)) { pci_scan_bridge() 943 (bus->number > child->busn_res.end && pci_scan_bridge() 944 bus->busn_res.end < child->number) ? pci_scan_bridge() 946 bus->self->transparent ? " transparent" : "", pci_scan_bridge() 947 dev_name(&bus->dev), pci_scan_bridge() 948 &bus->busn_res); pci_scan_bridge() 950 bus = bus->parent; pci_scan_bridge() 1132 dev->sysdata = dev->bus->sysdata; pci_setup_device() 1133 dev->dev.parent = dev->bus->bridge; pci_setup_device() 1134 dev->dev.bus = &pci_bus_type; pci_setup_device() 1140 list_for_each_entry(slot, &dev->bus->slots, list) pci_setup_device() 1148 dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(dev->bus), pci_setup_device() 1149 dev->bus->number, PCI_SLOT(dev->devfn), pci_setup_device() 1203 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_setup_device() 1210 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_setup_device() 1219 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_setup_device() 1226 pcibios_bus_to_resource(dev->bus, res, ®ion); pci_setup_device() 1427 pci_bus_put(pci_dev->bus); pci_release_dev() 1432 struct pci_dev *pci_alloc_dev(struct pci_bus *bus) pci_alloc_dev() argument 1442 dev->bus = pci_bus_get(bus); pci_alloc_dev() 1448 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, pci_bus_read_dev_vendor_id() argument 1453 if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l)) pci_bus_read_dev_vendor_id() 1473 if (pci_bus_read_config_dword(bus, devfn, PCI_VENDOR_ID, l)) pci_bus_read_dev_vendor_id() 1478 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), pci_bus_read_dev_vendor_id() 1492 static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) pci_scan_device() argument 1497 if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) pci_scan_device() 1500 dev = pci_alloc_dev(bus); pci_scan_device() 1511 pci_bus_put(dev->bus); pci_scan_device() 1543 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) pci_device_add() argument 1552 set_dev_node(&dev->dev, pcibus_to_node(bus)); pci_device_add() 1575 * and the bus list for fixup functions, etc. pci_device_add() 1578 list_add_tail(&dev->bus_list, &bus->devices); pci_device_add() 1590 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn) pci_scan_single_device() argument 1594 dev = pci_get_slot(bus, devfn); pci_scan_single_device() 1600 dev = pci_scan_device(bus, devfn); pci_scan_single_device() 1604 pci_device_add(dev, bus); pci_scan_single_device() 1610 static unsigned next_fn(struct pci_bus *bus, struct pci_dev *dev, unsigned fn) next_fn() argument 1616 if (pci_ari_enabled(bus)) { next_fn() 1638 static int only_one_child(struct pci_bus *bus) only_one_child() argument 1640 struct pci_dev *parent = bus->self; only_one_child() 1653 * pci_scan_slot - scan a PCI slot on a bus for devices. 1654 * @bus: PCI bus to scan 1657 * Scan a PCI slot on the specified PCI bus for devices, adding 1658 * discovered devices to the @bus->devices list. New devices 1663 int pci_scan_slot(struct pci_bus *bus, int devfn) pci_scan_slot() argument 1668 if (only_one_child(bus) && (devfn > 0)) pci_scan_slot() 1671 dev = pci_scan_single_device(bus, devfn); pci_scan_slot() 1677 for (fn = next_fn(bus, dev, 0); fn > 0; fn = next_fn(bus, dev, fn)) { pci_scan_slot() 1678 dev = pci_scan_single_device(bus, devfn + fn); pci_scan_slot() 1687 if (bus->self && nr) pci_scan_slot() 1688 pcie_aspm_init_link_state(bus->self); pci_scan_slot() 1734 dev->bus->self) pcie_write_mps() 1740 * to that of the parent bus. pcie_write_mps() 1745 * allowable MPS based on its parent bus). pcie_write_mps() 1747 mps = min(mps, pcie_get_mps(dev->bus->self)); pcie_write_mps() 1767 * device or the bus can support. This should already be properly pcie_write_mrrs() 1792 struct pci_dev *bridge = dev->bus->self; pcie_bus_detect_mps() 1835 void pcie_bus_configure_settings(struct pci_bus *bus) pcie_bus_configure_settings() argument 1839 if (!bus->self) pcie_bus_configure_settings() 1842 if (!pci_is_pcie(bus->self)) pcie_bus_configure_settings() 1853 smpss = bus->self->pcie_mpss; pcie_bus_configure_settings() 1855 pcie_find_smpss(bus->self, &smpss); pcie_bus_configure_settings() 1856 pci_walk_bus(bus, pcie_find_smpss, &smpss); pcie_bus_configure_settings() 1859 pcie_bus_configure_set(bus->self, &smpss); pcie_bus_configure_settings() 1860 pci_walk_bus(bus, pcie_bus_configure_set, &smpss); pcie_bus_configure_settings() 1864 unsigned int pci_scan_child_bus(struct pci_bus *bus) pci_scan_child_bus() argument 1866 unsigned int devfn, pass, max = bus->busn_res.start; pci_scan_child_bus() 1869 dev_dbg(&bus->dev, "scanning bus\n"); pci_scan_child_bus() 1873 pci_scan_slot(bus, devfn); pci_scan_child_bus() 1876 max += pci_iov_bus_range(bus); pci_scan_child_bus() 1879 * After performing arch-dependent fixup of the bus, look behind pci_scan_child_bus() 1880 * all PCI-to-PCI bridges on this bus. pci_scan_child_bus() 1882 if (!bus->is_added) { pci_scan_child_bus() 1883 dev_dbg(&bus->dev, "fixups for bus\n"); pci_scan_child_bus() 1884 pcibios_fixup_bus(bus); pci_scan_child_bus() 1885 bus->is_added = 1; pci_scan_child_bus() 1889 list_for_each_entry(dev, &bus->devices, bus_list) { pci_scan_child_bus() 1891 max = pci_scan_bridge(bus, dev, max, pass); pci_scan_child_bus() 1895 * We've scanned the bus and so we know all about what's on pci_scan_child_bus() 1896 * the other side of any bridges that may be on this bus plus pci_scan_child_bus() 1901 dev_dbg(&bus->dev, "bus scan returning with max=%02x\n", max); pci_scan_child_bus() 1918 void __weak pcibios_add_bus(struct pci_bus *bus) pcibios_add_bus() argument 1922 void __weak pcibios_remove_bus(struct pci_bus *bus) pcibios_remove_bus() argument 1926 struct pci_bus *pci_create_root_bus(struct device *parent, int bus, pci_create_root_bus() argument 1944 b->number = b->busn_res.start = bus; pci_create_root_bus() 1946 b2 = pci_find_bus(pci_domain_nr(b), bus); pci_create_root_bus() 1948 /* If we already got to this bus through a different bridge, ignore it */ pci_create_root_bus() 1949 dev_dbg(&b2->dev, "bus already known\n"); pci_create_root_bus() 1959 dev_set_name(&bridge->dev, "pci%04x:%02x", pci_domain_nr(b), bus); pci_create_root_bus() 1980 dev_set_name(&b->dev, "%04x:%02x", pci_domain_nr(b), bus); pci_create_root_bus() 1987 /* Create legacy_io and legacy_mem files for this bus */ pci_create_root_bus() 1991 dev_info(parent, "PCI host bridge to bus %s\n", dev_name(&b->dev)); pci_create_root_bus() 1993 printk(KERN_INFO "PCI host bridge to bus %s\n", dev_name(&b->dev)); pci_create_root_bus() 1995 /* Add initial resources to the bus */ resource_list_for_each_entry_safe() 2001 pci_bus_insert_busn_res(b, bus, res->end); resource_list_for_each_entry_safe() 2006 fmt = " (bus address [%#06llx-%#06llx])"; resource_list_for_each_entry_safe() 2008 fmt = " (bus address [%#010llx-%#010llx])"; resource_list_for_each_entry_safe() 2014 dev_info(&b->dev, "root bus resource %pR%s\n", res, bus_addr); resource_list_for_each_entry_safe() 2032 int pci_bus_insert_busn_res(struct pci_bus *b, int bus, int bus_max) pci_bus_insert_busn_res() argument 2037 res->start = bus; pci_bus_insert_busn_res() 2095 struct pci_bus *pci_scan_root_bus(struct device *parent, int bus, pci_scan_root_bus() argument 2109 b = pci_create_root_bus(parent, bus, ops, sysdata, resources); 2115 "No busn resource found for root bus, will use [bus %02x-ff]\n", 2116 bus); 2117 pci_bus_insert_busn_res(b, bus, 255); 2131 int bus, struct pci_ops *ops, void *sysdata) pci_scan_bus_parented() 2139 b = pci_create_root_bus(parent, bus, ops, sysdata, &resources); pci_scan_bus_parented() 2148 struct pci_bus *pci_scan_bus(int bus, struct pci_ops *ops, pci_scan_bus() argument 2157 b = pci_create_root_bus(NULL, bus, ops, sysdata, &resources); pci_scan_bus() 2168 * pci_rescan_bus_bridge_resize - scan a PCI bus for devices. 2169 * @bridge: PCI bridge for the bus to scan 2171 * Scan a PCI bus and child buses for new devices, add them, 2176 * Returns the max number of subordinate bus discovered. 2181 struct pci_bus *bus = bridge->subordinate; pci_rescan_bus_bridge_resize() local 2183 max = pci_scan_child_bus(bus); pci_rescan_bus_bridge_resize() 2187 pci_bus_add_devices(bus); pci_rescan_bus_bridge_resize() 2193 * pci_rescan_bus - scan a PCI bus for devices. 2194 * @bus: PCI bus to scan 2196 * Scan a PCI bus and child buses for new devices, adds them, 2199 * Returns the max number of subordinate bus discovered. 2201 unsigned int pci_rescan_bus(struct pci_bus *bus) pci_rescan_bus() argument 2205 max = pci_scan_child_bus(bus); pci_rescan_bus() 2206 pci_assign_unassigned_bus_resources(bus); pci_rescan_bus() 2207 pci_bus_add_devices(bus); pci_rescan_bus() 2237 if (pci_domain_nr(a->bus) < pci_domain_nr(b->bus)) return -1; pci_sort_bf_cmp() 2238 else if (pci_domain_nr(a->bus) > pci_domain_nr(b->bus)) return 1; pci_sort_bf_cmp() 2240 if (a->bus->number < b->bus->number) return -1; pci_sort_bf_cmp() 2241 else if (a->bus->number > b->bus->number) return 1; pci_sort_bf_cmp() 2130 pci_scan_bus_parented(struct device *parent, int bus, struct pci_ops *ops, void *sysdata) pci_scan_bus_parented() argument
|
H A D | search.c | 25 * Starting @pdev, walk up the bus calling @fn for each possible alias 26 * of @pdev at the root bus. 32 struct pci_bus *bus; pci_for_each_dma_alias() local 35 ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data); pci_for_each_dma_alias() 44 ret = fn(pdev, PCI_DEVID(pdev->bus->number, pci_for_each_dma_alias() 50 for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) { pci_for_each_dma_alias() 54 if (!bus->self) pci_for_each_dma_alias() 57 tmp = bus->self; pci_for_each_dma_alias() 61 * devices using the subordinate bus number (PCI Express to pci_for_each_dma_alias() 63 * where the upstream bus is PCI/X we alias to the bridge pci_for_each_dma_alias() 83 PCI_DEVID(tmp->bus->number, pci_for_each_dma_alias() 96 PCI_DEVID(tmp->bus->number, pci_for_each_dma_alias() 106 static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr) pci_do_find_bus() argument 111 if (bus->number == busnr) pci_do_find_bus() 112 return bus; pci_do_find_bus() 114 list_for_each_entry(tmp, &bus->children, node) { pci_do_find_bus() 123 * pci_find_bus - locate PCI bus from a given domain and bus number 125 * @busnr: number of desired PCI bus 127 * Given a PCI bus number and domain number, the desired PCI bus is located 128 * in the global list of PCI buses. If the bus is found, a pointer to its 129 * data structure is returned. If no bus is found, %NULL is returned. 133 struct pci_bus *bus = NULL; pci_find_bus() local 136 while ((bus = pci_find_next_bus(bus)) != NULL) { pci_find_bus() 137 if (pci_domain_nr(bus) != domain) pci_find_bus() 139 tmp_bus = pci_do_find_bus(bus, busnr); pci_find_bus() 148 * pci_find_next_bus - begin or continue searching for a PCI bus 149 * @from: Previous PCI bus found, or %NULL for new search. 173 * @bus: PCI bus on which desired PCI device resides 178 * Given a PCI bus and slot/function number, the desired PCI device 185 struct pci_dev *pci_get_slot(struct pci_bus *bus, unsigned int devfn) pci_get_slot() argument 192 list_for_each_entry(dev, &bus->devices, bus_list) { pci_get_slot() 206 * pci_get_domain_bus_and_slot - locate PCI device for a given PCI domain (segment), bus, and slot 208 * @bus: PCI bus on which desired PCI device resides 213 * Given a PCI domain, bus, and slot/function number, the desired PCI 220 struct pci_dev *pci_get_domain_bus_and_slot(int domain, unsigned int bus, pci_get_domain_bus_and_slot() argument 226 if (pci_domain_nr(dev->bus) == domain && for_each_pci_dev() 227 (dev->bus->number == bus && dev->devfn == devfn)) for_each_pci_dev()
|
H A D | hotplug-pci.c | 9 struct pci_bus *parent = dev->bus; pci_hp_add_bridge() 18 printk(KERN_ERR "No bus number available for hot-added bridge %s\n", pci_hp_add_bridge()
|
H A D | setup-bus.c | 2 * drivers/pci/setup-bus.c 512 static void pbus_assign_resources_sorted(const struct pci_bus *bus, pbus_assign_resources_sorted() argument 519 list_for_each_entry(dev, &bus->devices, bus_list) pbus_assign_resources_sorted() 525 void pci_setup_cardbus(struct pci_bus *bus) pci_setup_cardbus() argument 527 struct pci_dev *bridge = bus->self; pci_setup_cardbus() 532 &bus->busn_res); pci_setup_cardbus() 534 res = bus->resource[0]; pci_setup_cardbus() 535 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_cardbus() 548 res = bus->resource[1]; pci_setup_cardbus() 549 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_cardbus() 558 res = bus->resource[2]; pci_setup_cardbus() 559 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_cardbus() 568 res = bus->resource[3]; pci_setup_cardbus() 569 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_cardbus() 604 /* Set up the top and bottom of the PCI I/O segment for this bus. */ pci_setup_bridge_io() 606 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_bridge_io() 634 /* Set up the top and bottom of the PCI Memory segment for this bus. */ pci_setup_bridge_mmio() 636 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_bridge_mmio() 661 pcibios_resource_to_bus(bridge->bus, ®ion, res); pci_setup_bridge_mmio_pref() 680 static void __pci_setup_bridge(struct pci_bus *bus, unsigned long type) __pci_setup_bridge() argument 682 struct pci_dev *bridge = bus->self; __pci_setup_bridge() 685 &bus->busn_res); __pci_setup_bridge() 696 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl); __pci_setup_bridge() 699 void pci_setup_bridge(struct pci_bus *bus) pci_setup_bridge() argument 704 __pci_setup_bridge(bus, type); pci_setup_bridge() 745 static void pci_bridge_check_ranges(struct pci_bus *bus) pci_bridge_check_ranges() argument 749 struct pci_dev *bridge = bus->self; pci_bridge_check_ranges() 802 bus resource of a given type. Note: we intentionally skip 803 the bus resources which have already been assigned (that is, 805 static struct resource *find_free_bus_resource(struct pci_bus *bus, find_free_bus_resource() argument 811 pci_bus_for_each_resource(bus, r, i) { pci_bus_for_each_resource() 857 resource_size_t __weak pcibios_window_alignment(struct pci_bus *bus, pcibios_window_alignment() argument 867 static resource_size_t window_alignment(struct pci_bus *bus, window_alignment() argument 879 if (bus->self->io_window_1k) window_alignment() 885 arch_align = pcibios_window_alignment(bus, type); window_alignment() 890 * pbus_size_io() - size the io window of a given bus 892 * @bus : the bus 902 static void pbus_size_io(struct pci_bus *bus, resource_size_t min_size, pbus_size_io() argument 906 struct resource *b_res = find_free_bus_resource(bus, IORESOURCE_IO, pbus_size_io() 915 min_align = window_alignment(bus, IORESOURCE_IO); pbus_size_io() 916 list_for_each_entry(dev, &bus->devices, bus_list) { pbus_size_io() 951 dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", pbus_size_io() 952 b_res, &bus->busn_res); pbus_size_io() 961 add_to_list(realloc_head, bus->self, b_res, size1-size0, pbus_size_io() 963 dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx\n", pbus_size_io() 964 b_res, &bus->busn_res, pbus_size_io() 992 * pbus_size_mem() - size the memory window of a given bus 994 * @bus : the bus 1003 * Calculate the size of the bus and minimal alignment which 1006 * Returns -ENOSPC if there's no available bus resource of the desired type. 1007 * Otherwise, sets the bus resource start/end to indicate the required 1010 static int pbus_size_mem(struct pci_bus *bus, unsigned long mask, pbus_size_mem() argument 1020 struct resource *b_res = find_free_bus_resource(bus, pbus_size_mem() 1033 list_for_each_entry(dev, &bus->devices, bus_list) { pbus_size_mem() 1089 min_align = max(min_align, window_alignment(bus, b_res->flags)); pbus_size_mem() 1099 dev_info(&bus->self->dev, "disabling bridge window %pR to %pR (unused)\n", pbus_size_mem() 1100 b_res, &bus->busn_res); pbus_size_mem() 1108 add_to_list(realloc_head, bus->self, b_res, size1-size0, add_align); pbus_size_mem() 1109 dev_printk(KERN_DEBUG, &bus->self->dev, "bridge window %pR to %pR add_size %llx add_align %llx\n", pbus_size_mem() 1110 b_res, &bus->busn_res, pbus_size_mem() 1126 static void pci_bus_size_cardbus(struct pci_bus *bus, pci_bus_size_cardbus() argument 1129 struct pci_dev *bridge = bus->self; pci_bus_size_cardbus() 1138 * a fixed amount of bus space for CardBus bridges. pci_bus_size_cardbus() 1219 void __pci_bus_size_bridges(struct pci_bus *bus, struct list_head *realloc_head) __pci_bus_size_bridges() argument 1227 list_for_each_entry(dev, &bus->devices, bus_list) { __pci_bus_size_bridges() 1244 /* The root bus? */ __pci_bus_size_bridges() 1245 if (pci_is_root_bus(bus)) __pci_bus_size_bridges() 1248 switch (bus->self->class >> 8) { __pci_bus_size_bridges() 1254 pci_bridge_check_ranges(bus); __pci_bus_size_bridges() 1255 if (bus->self->is_hotplug_bridge) { __pci_bus_size_bridges() 1261 pbus_size_io(bus, realloc_head ? 0 : additional_io_size, __pci_bus_size_bridges() 1269 b_res = &bus->self->resource[PCI_BRIDGE_RESOURCES]; __pci_bus_size_bridges() 1274 ret = pbus_size_mem(bus, prefmask, prefmask, __pci_bus_size_bridges() 1298 ret = pbus_size_mem(bus, prefmask, prefmask, __pci_bus_size_bridges() 1330 pbus_size_mem(bus, mask, IORESOURCE_MEM, type2, type3, __pci_bus_size_bridges() 1337 void pci_bus_size_bridges(struct pci_bus *bus) pci_bus_size_bridges() argument 1339 __pci_bus_size_bridges(bus, NULL); pci_bus_size_bridges() 1343 void __pci_bus_assign_resources(const struct pci_bus *bus, __pci_bus_assign_resources() argument 1350 pbus_assign_resources_sorted(bus, realloc_head, fail_head); __pci_bus_assign_resources() 1352 list_for_each_entry(dev, &bus->devices, bus_list) { __pci_bus_assign_resources() 1370 dev_info(&dev->dev, "not setting up bridge for bus %04x:%02x\n", __pci_bus_assign_resources() 1377 void pci_bus_assign_resources(const struct pci_bus *bus) pci_bus_assign_resources() argument 1379 __pci_bus_assign_resources(bus, NULL, NULL); pci_bus_assign_resources() 1408 dev_info(&bridge->dev, "not setting up bridge for bus %04x:%02x\n", __pci_bridge_assign_resources() 1413 static void pci_bridge_release_resources(struct pci_bus *bus, pci_bridge_release_resources() argument 1416 struct pci_dev *dev = bus->self; pci_bridge_release_resources() 1473 __pci_setup_bridge(bus, type); pci_bridge_release_resources() 1487 static void pci_bus_release_bridge_resources(struct pci_bus *bus, pci_bus_release_bridge_resources() argument 1494 list_for_each_entry(dev, &bus->devices, bus_list) { pci_bus_release_bridge_resources() 1509 if (pci_is_root_bus(bus)) pci_bus_release_bridge_resources() 1512 if ((bus->self->class >> 8) != PCI_CLASS_BRIDGE_PCI) pci_bus_release_bridge_resources() 1516 pci_bridge_release_resources(bus, type); pci_bus_release_bridge_resources() 1519 static void pci_bus_dump_res(struct pci_bus *bus) pci_bus_dump_res() argument 1524 pci_bus_for_each_resource(bus, res, i) { pci_bus_for_each_resource() 1528 dev_printk(KERN_DEBUG, &bus->dev, "resource %d %pR\n", i, res); pci_bus_for_each_resource() 1532 static void pci_bus_dump_resources(struct pci_bus *bus) pci_bus_dump_resources() argument 1538 pci_bus_dump_res(bus); pci_bus_dump_resources() 1540 list_for_each_entry(dev, &bus->devices, bus_list) { pci_bus_dump_resources() 1549 static int pci_bus_get_depth(struct pci_bus *bus) pci_bus_get_depth() argument 1554 list_for_each_entry(child_bus, &bus->children, node) { pci_bus_get_depth() 1607 pcibios_resource_to_bus(dev->bus, ®ion, r); iov_resources_unassigned() 1617 static enum enable_type pci_realloc_detect(struct pci_bus *bus, pci_realloc_detect() argument 1625 pci_walk_bus(bus, iov_resources_unassigned, &unassigned); pci_realloc_detect() 1632 static enum enable_type pci_realloc_detect(struct pci_bus *bus, pci_realloc_detect() argument 1644 void pci_assign_unassigned_root_bus_resources(struct pci_bus *bus) pci_assign_unassigned_root_bus_resources() argument 1659 enable_local = pci_realloc_detect(bus, pci_realloc_enable); pci_assign_unassigned_root_bus_resources() 1661 int max_depth = pci_bus_get_depth(bus); pci_assign_unassigned_root_bus_resources() 1664 dev_printk(KERN_DEBUG, &bus->dev, pci_assign_unassigned_root_bus_resources() 1665 "max bus depth: %d pci_try_num: %d\n", pci_assign_unassigned_root_bus_resources() 1678 __pci_bus_size_bridges(bus, add_list); pci_assign_unassigned_root_bus_resources() 1681 __pci_bus_assign_resources(bus, add_list, &fail_head); pci_assign_unassigned_root_bus_resources() 1692 dev_info(&bus->dev, "Some PCI device resources are unassigned, try booting with pci=realloc\n"); pci_assign_unassigned_root_bus_resources() 1694 dev_info(&bus->dev, "Automatically enabled pci realloc, if you have problem, try booting with pci=realloc=off\n"); pci_assign_unassigned_root_bus_resources() 1700 dev_printk(KERN_DEBUG, &bus->dev, pci_assign_unassigned_root_bus_resources() 1712 pci_bus_release_bridge_resources(fail_res->dev->bus, pci_assign_unassigned_root_bus_resources() 1732 pci_bus_dump_resources(bus); pci_assign_unassigned_root_bus_resources() 1778 pci_bus_release_bridge_resources(fail_res->dev->bus, pci_assign_unassigned_bridge_resources() 1804 void pci_assign_unassigned_bus_resources(struct pci_bus *bus) pci_assign_unassigned_bus_resources() argument 1811 list_for_each_entry(dev, &bus->devices, bus_list) pci_assign_unassigned_bus_resources() 1816 __pci_bus_assign_resources(bus, &add_list, NULL); pci_assign_unassigned_bus_resources()
|
H A D | xen-pcifront.c | 31 struct pci_bus *bus; member in struct:pci_bus_entry 66 unsigned int domain, unsigned int bus, pcifront_init_sd() 179 static int pcifront_bus_read(struct pci_bus *bus, unsigned int devfn, pcifront_bus_read() argument 185 .domain = pci_domain_nr(bus), pcifront_bus_read() 186 .bus = bus->number, pcifront_bus_read() 191 struct pcifront_sd *sd = bus->sysdata; pcifront_bus_read() 197 pci_domain_nr(bus), bus->number, PCI_SLOT(devfn), pcifront_bus_read() 218 static int pcifront_bus_write(struct pci_bus *bus, unsigned int devfn, pcifront_bus_write() argument 223 .domain = pci_domain_nr(bus), pcifront_bus_write() 224 .bus = bus->number, pcifront_bus_write() 230 struct pcifront_sd *sd = bus->sysdata; pcifront_bus_write() 237 pci_domain_nr(bus), bus->number, pcifront_bus_write() 256 .domain = pci_domain_nr(dev->bus), pci_frontend_enable_msix() 257 .bus = dev->bus->number, pci_frontend_enable_msix() 261 struct pcifront_sd *sd = dev->bus->sysdata; pci_frontend_enable_msix() 310 .domain = pci_domain_nr(dev->bus), pci_frontend_disable_msix() 311 .bus = dev->bus->number, pci_frontend_disable_msix() 314 struct pcifront_sd *sd = dev->bus->sysdata; pci_frontend_disable_msix() 329 .domain = pci_domain_nr(dev->bus), pci_frontend_enable_msi() 330 .bus = dev->bus->number, pci_frontend_enable_msi() 333 struct pcifront_sd *sd = dev->bus->sysdata; pci_frontend_enable_msi() 347 "%x:%x\n", op.bus, op.devfn); pci_frontend_enable_msi() 358 .domain = pci_domain_nr(dev->bus), pci_frontend_disable_msi() 359 .bus = dev->bus->number, pci_frontend_disable_msi() 362 struct pcifront_sd *sd = dev->bus->sysdata; pci_frontend_disable_msi() 419 unsigned int domain, unsigned int bus, pcifront_scan_bus() 425 /* Scan the bus for functions and add. pcifront_scan_bus() 440 "%04x:%02x:%02x.%d found.\n", domain, bus, pcifront_scan_bus() 448 unsigned int domain, unsigned int bus) pcifront_scan_root() 467 domain, bus); pcifront_scan_root() 475 pcifront_init_sd(sd, domain, bus, pdev); pcifront_scan_root() 479 b = pci_scan_bus_parented(&pdev->xdev->dev, bus, pcifront_scan_root() 489 bus_entry->bus = b; pcifront_scan_root() 495 err = pcifront_scan_bus(pdev, domain, bus, b); pcifront_scan_root() 514 unsigned int domain, unsigned int bus) pcifront_rescan_root() 530 domain, bus); pcifront_rescan_root() 532 b = pci_find_bus(domain, bus); pcifront_rescan_root() 534 /* If the bus is unknown, create it. */ pcifront_rescan_root() 535 return pcifront_scan_root(pdev, domain, bus); pcifront_rescan_root() 537 err = pcifront_scan_bus(pdev, domain, bus, b); pcifront_rescan_root() 548 static void free_root_bus_devs(struct pci_bus *bus) free_root_bus_devs() argument 552 while (!list_empty(&bus->devices)) { free_root_bus_devs() 553 dev = container_of(bus->devices.next, struct pci_dev, free_root_bus_devs() 570 free_root_bus_devs(bus_entry->bus); pcifront_free_roots() 572 kfree(bus_entry->bus->sysdata); pcifront_free_roots() 574 device_unregister(bus_entry->bus->bridge); pcifront_free_roots() 575 pci_remove_bus(bus_entry->bus); pcifront_free_roots() 588 int bus = pdev->sh_info->aer_op.bus; pcifront_common_process() local 594 "pcifront AER process: cmd %x (bus:%x, devfn%x)", pcifront_common_process() 595 cmd, bus, devfn); pcifront_common_process() 598 pcidev = pci_get_bus_and_slot(bus, devfn); pcifront_common_process() 655 "pcifront service aer bus %x devfn %x\n", pcifront_do_aer() 656 pdev->sh_info->aer_op.bus, pdev->sh_info->aer_op.devfn); pcifront_do_aer() 850 unsigned int domain, bus; pcifront_try_connect() local 893 "%x:%x", &domain, &bus); pcifront_try_connect() 902 err = pcifront_scan_root(pdev, domain, bus); pcifront_try_connect() 906 domain, bus); pcifront_try_connect() 944 unsigned int domain, bus; pcifront_attach_devices() local 979 "%x:%x", &domain, &bus); pcifront_attach_devices() 988 err = pcifront_rescan_root(pdev, domain, bus); pcifront_attach_devices() 992 domain, bus); pcifront_attach_devices() 1007 unsigned int domain, bus, slot, func; pcifront_detach_devices() local 1048 "%x:%x:%x.%x", &domain, &bus, &slot, &func); pcifront_detach_devices() 1057 pci_dev = pci_get_domain_bus_and_slot(domain, bus, pcifront_detach_devices() 1062 domain, bus, slot, func); pcifront_detach_devices() 1072 domain, bus, slot, func); pcifront_detach_devices() 65 pcifront_init_sd(struct pcifront_sd *sd, unsigned int domain, unsigned int bus, struct pcifront_device *pdev) pcifront_init_sd() argument 418 pcifront_scan_bus(struct pcifront_device *pdev, unsigned int domain, unsigned int bus, struct pci_bus *b) pcifront_scan_bus() argument 447 pcifront_scan_root(struct pcifront_device *pdev, unsigned int domain, unsigned int bus) pcifront_scan_root() argument 513 pcifront_rescan_root(struct pcifront_device *pdev, unsigned int domain, unsigned int bus) pcifront_rescan_root() argument
|
/linux-4.1.27/arch/metag/include/asm/ |
H A D | topology.h | 11 #define pcibus_to_node(bus) ((void)(bus), -1) 12 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 14 cpumask_of_node(pcibus_to_node(bus)))
|
/linux-4.1.27/arch/sh/include/asm/ |
H A D | topology.h | 11 #define pcibus_to_node(bus) ((void)(bus), -1) 12 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 14 cpumask_of_node(pcibus_to_node(bus)))
|
H A D | pci.h | 7 already-configured bus numbers - to be used for buggy BIOSes 18 struct pci_bus *bus; member in struct:pci_channel 47 int bus, int devfn, int offset, u8 *value); 49 int bus, int devfn, int offset, u16 *value); 51 int bus, int devfn, int offset, u32 *value); 53 int bus, int devfn, int offset, u8 value); 55 int bus, int devfn, int offset, u16 value); 57 int bus, int devfn, int offset, u32 value); 112 #define pci_domain_nr(bus) ((struct pci_channel *)(bus)->sysdata)->index 114 static inline int pci_proc_domain(struct pci_bus *bus) pci_proc_domain() argument 116 struct pci_channel *hose = bus->sysdata; pci_proc_domain()
|
/linux-4.1.27/drivers/net/ethernet/hisilicon/ |
H A D | hip04_mdio.c | 32 static int hip04_mdio_wait_ready(struct mii_bus *bus) hip04_mdio_wait_ready() argument 34 struct hip04_mdio_priv *priv = bus->priv; hip04_mdio_wait_ready() 46 static int hip04_mdio_read(struct mii_bus *bus, int mii_id, int regnum) hip04_mdio_read() argument 48 struct hip04_mdio_priv *priv = bus->priv; hip04_mdio_read() 52 ret = hip04_mdio_wait_ready(bus); hip04_mdio_read() 59 ret = hip04_mdio_wait_ready(bus); hip04_mdio_read() 65 dev_err(bus->parent, "SMI bus read not valid\n"); hip04_mdio_read() 76 static int hip04_mdio_write(struct mii_bus *bus, int mii_id, hip04_mdio_write() argument 79 struct hip04_mdio_priv *priv = bus->priv; hip04_mdio_write() 83 ret = hip04_mdio_wait_ready(bus); hip04_mdio_write() 94 static int hip04_mdio_reset(struct mii_bus *bus) hip04_mdio_reset() argument 99 hip04_mdio_write(bus, i, 22, 0); hip04_mdio_reset() 100 temp = hip04_mdio_read(bus, i, MII_BMCR); hip04_mdio_reset() 105 if (hip04_mdio_write(bus, i, MII_BMCR, temp) < 0) hip04_mdio_reset() 116 struct mii_bus *bus; hip04_mdio_probe() local 120 bus = mdiobus_alloc_size(sizeof(struct hip04_mdio_priv)); hip04_mdio_probe() 121 if (!bus) { hip04_mdio_probe() 122 dev_err(&pdev->dev, "Cannot allocate MDIO bus\n"); hip04_mdio_probe() 126 bus->name = "hip04_mdio_bus"; hip04_mdio_probe() 127 bus->read = hip04_mdio_read; hip04_mdio_probe() 128 bus->write = hip04_mdio_write; hip04_mdio_probe() 129 bus->reset = hip04_mdio_reset; hip04_mdio_probe() 130 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev)); hip04_mdio_probe() 131 bus->parent = &pdev->dev; hip04_mdio_probe() 132 priv = bus->priv; hip04_mdio_probe() 141 ret = of_mdiobus_register(bus, pdev->dev.of_node); hip04_mdio_probe() 143 dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); hip04_mdio_probe() 147 platform_set_drvdata(pdev, bus); hip04_mdio_probe() 152 mdiobus_free(bus); hip04_mdio_probe() 158 struct mii_bus *bus = platform_get_drvdata(pdev); hip04_mdio_remove() local 160 mdiobus_unregister(bus); hip04_mdio_remove() 161 mdiobus_free(bus); hip04_mdio_remove()
|
/linux-4.1.27/arch/x86/include/asm/ |
H A D | pci_64.h | 7 static inline void *pci_iommu(struct pci_bus *bus) pci_iommu() argument 9 struct pci_sysdata *sd = bus->sysdata; pci_iommu() 13 static inline void set_pci_iommu(struct pci_bus *bus, void *val) set_pci_iommu() argument 15 struct pci_sysdata *sd = bus->sysdata; set_pci_iommu() 20 extern int (*pci_config_read)(int seg, int bus, int dev, int fn, 22 extern int (*pci_config_write)(int seg, int bus, int dev, int fn,
|
H A D | pci-direct.h | 9 extern u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset); 10 extern u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset); 11 extern u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset); 12 extern void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, u32 val); 13 extern void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val); 14 extern void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val); 19 extern void early_dump_pci_device(u8 bus, u8 slot, u8 func);
|
H A D | pci.h | 32 static inline int pci_domain_nr(struct pci_bus *bus) pci_domain_nr() argument 34 struct pci_sysdata *sd = bus->sysdata; pci_domain_nr() 38 static inline int pci_proc_domain(struct pci_bus *bus) pci_proc_domain() argument 40 return pci_domain_nr(bus); pci_proc_domain() 45 already-configured bus numbers - to be used for buggy BIOSes 68 void pcibios_scan_root(int bus); 127 /* Returns the node based on pci bus */ __pcibus_to_node() 128 static inline int __pcibus_to_node(const struct pci_bus *bus) __pcibus_to_node() argument 130 const struct pci_sysdata *sd = bus->sysdata; __pcibus_to_node() 136 cpumask_of_pcibus(const struct pci_bus *bus) cpumask_of_pcibus() argument 140 node = __pcibus_to_node(bus); cpumask_of_pcibus() 152 unsigned long bus; member in struct:pci_setup_rom
|
/linux-4.1.27/drivers/bcma/ |
H A D | main.c | 19 /* contains the number the next bus should get. */ 76 static u16 bcma_cc_core_id(struct bcma_bus *bus) bcma_cc_core_id() argument 78 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) bcma_cc_core_id() 83 struct bcma_device *bcma_find_core_unit(struct bcma_bus *bus, u16 coreid, bcma_find_core_unit() argument 88 list_for_each_entry(core, &bus->cores, list) { bcma_find_core_unit() 110 bcma_warn(core->bus, "Timeout waiting for register 0x%04X!\n", reg); bcma_wait_value() 189 bcma_debug(core->bus, "bcma_of_get_irq() failed with rc=%d\n", bcma_of_get_irq() 222 struct bcma_bus *bus = core->bus; bcma_core_irq() local 225 switch (bus->hosttype) { bcma_core_irq() 227 return bus->host_pci->irq; bcma_core_irq() 229 if (bus->drv_mips.core && num == 0) { bcma_core_irq() 233 if (bus->host_pdev) bcma_core_irq() 234 return bcma_of_get_irq(bus->host_pdev, core, num); bcma_core_irq() 244 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) bcma_prepare_core() argument 247 core->dev.bus = &bcma_bus_type; bcma_prepare_core() 248 dev_set_name(&core->dev, "bcma%d:%d", bus->num, core->core_index); bcma_prepare_core() 250 switch (bus->hosttype) { bcma_prepare_core() 252 core->dev.parent = &bus->host_pci->dev; bcma_prepare_core() 253 core->dma_dev = &bus->host_pci->dev; bcma_prepare_core() 254 core->irq = bus->host_pci->irq; bcma_prepare_core() 258 if (bus->host_pdev) { bcma_prepare_core() 259 core->dma_dev = &bus->host_pdev->dev; bcma_prepare_core() 260 core->dev.parent = &bus->host_pdev->dev; bcma_prepare_core() 261 bcma_of_fill_device(bus->host_pdev, core); bcma_prepare_core() 271 void bcma_init_bus(struct bcma_bus *bus) bcma_init_bus() argument 274 bus->num = bcma_bus_next_num++; bcma_init_bus() 277 INIT_LIST_HEAD(&bus->cores); bcma_init_bus() 278 bus->nr_cores = 0; bcma_init_bus() 280 bcma_detect_chip(bus); bcma_init_bus() 283 static void bcma_register_core(struct bcma_bus *bus, struct bcma_device *core) bcma_register_core() argument 289 bcma_err(bus, "Could not register dev for core 0x%03X\n", bcma_register_core() 297 static int bcma_register_devices(struct bcma_bus *bus) bcma_register_devices() argument 302 list_for_each_entry(core, &bus->cores, list) { bcma_register_devices() 325 bcma_register_core(bus, core); bcma_register_devices() 329 if (bus->drv_cc.pflash.present) { bcma_register_devices() 332 bcma_err(bus, "Error registering parallel flash\n"); bcma_register_devices() 337 if (bus->drv_cc.sflash.present) { bcma_register_devices() 340 bcma_err(bus, "Error registering serial flash\n"); bcma_register_devices() 345 if (bus->drv_cc.nflash.present) { bcma_register_devices() 348 bcma_err(bus, "Error registering NAND flash\n"); bcma_register_devices() 351 err = bcma_gpio_init(&bus->drv_cc); bcma_register_devices() 353 bcma_debug(bus, "GPIO driver not activated\n"); bcma_register_devices() 355 bcma_err(bus, "Error registering GPIO driver: %i\n", err); bcma_register_devices() 357 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { bcma_register_devices() 358 err = bcma_chipco_watchdog_register(&bus->drv_cc); bcma_register_devices() 360 bcma_err(bus, "Error registering watchdog driver\n"); bcma_register_devices() 366 void bcma_unregister_cores(struct bcma_bus *bus) bcma_unregister_cores() argument 370 list_for_each_entry_safe(core, tmp, &bus->cores, list) { bcma_unregister_cores() 376 if (bus->hosttype == BCMA_HOSTTYPE_SOC) bcma_unregister_cores() 377 platform_device_unregister(bus->drv_cc.watchdog); bcma_unregister_cores() 380 list_for_each_entry_safe(core, tmp, &bus->cores, list) { bcma_unregister_cores() 386 int bcma_bus_register(struct bcma_bus *bus) bcma_bus_register() argument 392 err = bcma_bus_scan(bus); bcma_bus_register() 394 bcma_err(bus, "Failed to scan: %d\n", err); bcma_bus_register() 399 core = bcma_find_core(bus, bcma_cc_core_id(bus)); bcma_bus_register() 401 bus->drv_cc.core = core; bcma_bus_register() 402 bcma_core_chipcommon_early_init(&bus->drv_cc); bcma_bus_register() 406 core = bcma_find_core(bus, BCMA_CORE_PCIE); bcma_bus_register() 408 bus->drv_pci[0].core = core; bcma_bus_register() 409 bcma_core_pci_early_init(&bus->drv_pci[0]); bcma_bus_register() 413 list_for_each_entry(core, &bus->cores, list) { bcma_bus_register() 415 bcma_register_core(bus, core); bcma_bus_register() 419 err = bcma_sprom_get(bus); bcma_bus_register() 421 bcma_err(bus, "No SPROM available\n"); bcma_bus_register() 423 bcma_err(bus, "Failed to get SPROM: %d\n", err); bcma_bus_register() 426 core = bcma_find_core(bus, bcma_cc_core_id(bus)); bcma_bus_register() 428 bus->drv_cc.core = core; bcma_bus_register() 429 bcma_core_chipcommon_init(&bus->drv_cc); bcma_bus_register() 433 core = bcma_find_core(bus, BCMA_CORE_NS_CHIPCOMMON_B); bcma_bus_register() 435 bus->drv_cc_b.core = core; bcma_bus_register() 436 bcma_core_chipcommon_b_init(&bus->drv_cc_b); bcma_bus_register() 440 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); bcma_bus_register() 442 bus->drv_mips.core = core; bcma_bus_register() 443 bcma_core_mips_init(&bus->drv_mips); bcma_bus_register() 447 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 0); bcma_bus_register() 449 bus->drv_pci[0].core = core; bcma_bus_register() 450 bcma_core_pci_init(&bus->drv_pci[0]); bcma_bus_register() 454 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE, 1); bcma_bus_register() 456 bus->drv_pci[1].core = core; bcma_bus_register() 457 bcma_core_pci_init(&bus->drv_pci[1]); bcma_bus_register() 461 core = bcma_find_core_unit(bus, BCMA_CORE_PCIE2, 0); bcma_bus_register() 463 bus->drv_pcie2.core = core; bcma_bus_register() 464 bcma_core_pcie2_init(&bus->drv_pcie2); bcma_bus_register() 468 core = bcma_find_core(bus, BCMA_CORE_4706_MAC_GBIT_COMMON); bcma_bus_register() 470 bus->drv_gmac_cmn.core = core; bcma_bus_register() 471 bcma_core_gmac_cmn_init(&bus->drv_gmac_cmn); bcma_bus_register() 475 bcma_register_devices(bus); bcma_bus_register() 477 bcma_info(bus, "Bus registered\n"); bcma_bus_register() 482 void bcma_bus_unregister(struct bcma_bus *bus) bcma_bus_unregister() argument 486 err = bcma_gpio_unregister(&bus->drv_cc); bcma_bus_unregister() 488 bcma_err(bus, "Some GPIOs are still in use.\n"); bcma_bus_unregister() 490 bcma_err(bus, "Can not unregister GPIO driver: %i\n", err); bcma_bus_unregister() 492 bcma_core_chipcommon_b_free(&bus->drv_cc_b); bcma_bus_unregister() 494 bcma_unregister_cores(bus); bcma_bus_unregister() 498 * This is a special version of bus registration function designed for SoCs. 499 * It scans bus and performs basic initialization of main cores only. 502 int __init bcma_bus_early_register(struct bcma_bus *bus) bcma_bus_early_register() argument 508 err = bcma_bus_scan(bus); bcma_bus_early_register() 510 bcma_err(bus, "Failed to scan bus: %d\n", err); bcma_bus_early_register() 515 core = bcma_find_core(bus, bcma_cc_core_id(bus)); bcma_bus_early_register() 517 bus->drv_cc.core = core; bcma_bus_early_register() 518 bcma_core_chipcommon_early_init(&bus->drv_cc); bcma_bus_early_register() 522 core = bcma_find_core(bus, BCMA_CORE_MIPS_74K); bcma_bus_early_register() 524 bus->drv_mips.core = core; bcma_bus_early_register() 525 bcma_core_mips_early_init(&bus->drv_mips); bcma_bus_early_register() 528 bcma_info(bus, "Early bus registered\n"); bcma_bus_early_register() 534 int bcma_bus_suspend(struct bcma_bus *bus) bcma_bus_suspend() argument 538 list_for_each_entry(core, &bus->cores, list) { bcma_bus_suspend() 549 int bcma_bus_resume(struct bcma_bus *bus) bcma_bus_resume() argument 554 if (bus->drv_cc.core) { bcma_bus_resume() 555 bus->drv_cc.setup_done = false; bcma_bus_resume() 556 bcma_core_chipcommon_init(&bus->drv_cc); bcma_bus_resume() 559 list_for_each_entry(core, &bus->cores, list) { bcma_bus_resume() 575 drv->drv.bus = &bcma_bus_type; __bcma_driver_register()
|
H A D | host_pci.c | 16 int win2 = core->bus->host_is_pcie2 ? bcma_host_pci_switch_core() 19 pci_write_config_dword(core->bus->host_pci, BCMA_PCI_BAR0_WIN, bcma_host_pci_switch_core() 21 pci_write_config_dword(core->bus->host_pci, win2, core->wrap); bcma_host_pci_switch_core() 22 core->bus->mapped_core = core; bcma_host_pci_switch_core() 23 bcma_debug(core->bus, "Switched to core: 0x%X\n", core->id.id); bcma_host_pci_switch_core() 37 if (core->bus->mapped_core != core) bcma_host_pci_provide_access_to_core() 45 return ioread8(core->bus->mmio + offset); bcma_host_pci_read8() 51 return ioread16(core->bus->mmio + offset); bcma_host_pci_read16() 57 return ioread32(core->bus->mmio + offset); bcma_host_pci_read32() 64 iowrite8(value, core->bus->mmio + offset); bcma_host_pci_write8() 71 iowrite16(value, core->bus->mmio + offset); bcma_host_pci_write16() 78 iowrite32(value, core->bus->mmio + offset); bcma_host_pci_write32() 85 void __iomem *addr = core->bus->mmio + offset; bcma_host_pci_block_read() 86 if (core->bus->mapped_core != core) bcma_host_pci_block_read() 109 void __iomem *addr = core->bus->mmio + offset; bcma_host_pci_block_write() 110 if (core->bus->mapped_core != core) bcma_host_pci_block_write() 132 if (core->bus->mapped_core != core) bcma_host_pci_aread32() 134 return ioread32(core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset); bcma_host_pci_aread32() 140 if (core->bus->mapped_core != core) bcma_host_pci_awrite32() 142 iowrite32(value, core->bus->mmio + (1 * BCMA_CORE_SIZE) + offset); bcma_host_pci_awrite32() 163 struct bcma_bus *bus; bcma_host_pci_probe() local 169 bus = kzalloc(sizeof(*bus), GFP_KERNEL); bcma_host_pci_probe() 170 if (!bus) bcma_host_pci_probe() 194 bcma_err(bus, "PCI card detected, they are not supported.\n"); bcma_host_pci_probe() 201 bus->mmio = pci_iomap(dev, 0, ~0UL); bcma_host_pci_probe() 202 if (!bus->mmio) bcma_host_pci_probe() 206 bus->host_pci = dev; bcma_host_pci_probe() 207 bus->hosttype = BCMA_HOSTTYPE_PCI; bcma_host_pci_probe() 208 bus->ops = &bcma_host_pci_ops; bcma_host_pci_probe() 210 bus->boardinfo.vendor = bus->host_pci->subsystem_vendor; bcma_host_pci_probe() 211 bus->boardinfo.type = bus->host_pci->subsystem_device; bcma_host_pci_probe() 214 bcma_init_bus(bus); bcma_host_pci_probe() 216 /* Scan bus to find out generation of PCIe core */ bcma_host_pci_probe() 217 err = bcma_bus_scan(bus); bcma_host_pci_probe() 221 if (bcma_find_core(bus, BCMA_CORE_PCIE2)) bcma_host_pci_probe() 222 bus->host_is_pcie2 = true; bcma_host_pci_probe() 225 err = bcma_bus_register(bus); bcma_host_pci_probe() 229 pci_set_drvdata(dev, bus); bcma_host_pci_probe() 235 bcma_unregister_cores(bus); bcma_host_pci_probe() 237 pci_iounmap(dev, bus->mmio); bcma_host_pci_probe() 243 kfree(bus); bcma_host_pci_probe() 249 struct bcma_bus *bus = pci_get_drvdata(dev); bcma_host_pci_remove() local 251 bcma_bus_unregister(bus); bcma_host_pci_remove() 252 pci_iounmap(dev, bus->mmio); bcma_host_pci_remove() 255 kfree(bus); bcma_host_pci_remove() 262 struct bcma_bus *bus = pci_get_drvdata(pdev); bcma_host_pci_suspend() local 264 bus->mapped_core = NULL; bcma_host_pci_suspend() 266 return bcma_bus_suspend(bus); bcma_host_pci_suspend() 272 struct bcma_bus *bus = pci_get_drvdata(pdev); bcma_host_pci_resume() local 274 return bcma_bus_resume(bus); bcma_host_pci_resume() 332 void bcma_host_pci_up(struct bcma_bus *bus) bcma_host_pci_up() argument 334 if (bus->hosttype != BCMA_HOSTTYPE_PCI) bcma_host_pci_up() 337 if (bus->host_is_pcie2) bcma_host_pci_up() 338 bcma_core_pcie2_up(&bus->drv_pcie2); bcma_host_pci_up() 340 bcma_core_pci_up(&bus->drv_pci[0]); bcma_host_pci_up() 345 void bcma_host_pci_down(struct bcma_bus *bus) bcma_host_pci_down() argument 347 if (bus->hosttype != BCMA_HOSTTYPE_PCI) bcma_host_pci_down() 350 if (!bus->host_is_pcie2) bcma_host_pci_down() 351 bcma_core_pci_down(&bus->drv_pci[0]); bcma_host_pci_down() 356 int bcma_host_pci_irq_ctl(struct bcma_bus *bus, struct bcma_device *core, bcma_host_pci_irq_ctl() argument 363 if (bus->hosttype != BCMA_HOSTTYPE_PCI) { bcma_host_pci_irq_ctl() 364 /* This bcma device is not on a PCI host-bus. So the IRQs are bcma_host_pci_irq_ctl() 370 pdev = bus->host_pci; bcma_host_pci_irq_ctl()
|
H A D | driver_mips.c | 58 return dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM47162 && bcma_core_mips_bcm47162a0_quirk() 59 dev->bus->chipinfo.rev == 0 && dev->id.id == BCMA_CORE_MIPS_74K; bcma_core_mips_bcm47162a0_quirk() 65 return (dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 || bcma_core_mips_bcm5357b0_quirk() 66 dev->bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) && bcma_core_mips_bcm5357b0_quirk() 67 dev->bus->chipinfo.pkg == 11 && bcma_core_mips_bcm5357b0_quirk() 123 struct bcma_device *mdev = dev->bus->drv_mips.core; bcma_core_mips_irq() 142 struct bcma_bus *bus = dev->bus; bcma_core_mips_set_irq() local 143 struct bcma_device *mdev = bus->drv_mips.core; bcma_core_mips_set_irq() 173 list_for_each_entry(core, &bus->cores, list) { bcma_core_mips_set_irq() 185 bcma_debug(bus, "set_irq: core 0x%04x, irq %d => %d\n", bcma_core_mips_set_irq() 189 static void bcma_core_mips_set_irq_name(struct bcma_bus *bus, unsigned int irq, bcma_core_mips_set_irq_name() argument 194 core = bcma_find_core_unit(bus, coreid, unit); bcma_core_mips_set_irq_name() 196 bcma_warn(bus, bcma_core_mips_set_irq_name() 215 static void bcma_core_mips_dump_irq(struct bcma_bus *bus) bcma_core_mips_dump_irq() argument 219 list_for_each_entry(core, &bus->cores, list) { bcma_core_mips_dump_irq() 226 struct bcma_bus *bus = mcore->core->bus; bcma_cpu_clock() local 228 if (bus->drv_cc.capabilities & BCMA_CC_CAP_PMU) bcma_cpu_clock() 229 return bcma_pmu_get_cpu_clock(&bus->drv_cc); bcma_cpu_clock() 231 bcma_err(bus, "No PMU available, need this to get the cpu clock\n"); bcma_cpu_clock() 236 static enum bcma_boot_dev bcma_boot_dev(struct bcma_bus *bus) bcma_boot_dev() argument 238 struct bcma_drv_cc *cc = &bus->drv_cc; bcma_boot_dev() 244 core = bcma_find_core(bus, BCMA_CORE_NS_ROM); bcma_boot_dev() 277 struct bcma_bus *bus = mcore->core->bus; bcma_core_mips_flash_detect() local 278 struct bcma_drv_cc *cc = &bus->drv_cc; bcma_core_mips_flash_detect() 285 bcma_debug(bus, "Found serial flash\n"); bcma_core_mips_flash_detect() 289 bcma_debug(bus, "Found parallel flash\n"); bcma_core_mips_flash_detect() 306 bcma_err(bus, "Flash type not supported\n"); bcma_core_mips_flash_detect() 310 bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) { bcma_core_mips_flash_detect() 312 bcma_debug(bus, "Found NAND flash\n"); bcma_core_mips_flash_detect() 318 boot_dev = bcma_boot_dev(bus); bcma_core_mips_flash_detect() 340 struct bcma_bus *bus = mcore->core->bus; bcma_core_mips_early_init() local 345 bcma_chipco_serial_init(&bus->drv_cc); bcma_core_mips_early_init() 351 static void bcma_fix_i2s_irqflag(struct bcma_bus *bus) bcma_fix_i2s_irqflag() argument 358 if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4716 && bcma_fix_i2s_irqflag() 359 bus->chipinfo.id != BCMA_CHIP_ID_BCM4748) bcma_fix_i2s_irqflag() 362 cpu = bcma_find_core(bus, BCMA_CORE_MIPS_74K); bcma_fix_i2s_irqflag() 363 pcie = bcma_find_core(bus, BCMA_CORE_PCIE); bcma_fix_i2s_irqflag() 364 i2s = bcma_find_core(bus, BCMA_CORE_I2S); bcma_fix_i2s_irqflag() 372 bcma_debug(bus, bcma_fix_i2s_irqflag() 379 struct bcma_bus *bus; bcma_core_mips_init() local 381 bus = mcore->core->bus; bcma_core_mips_init() 386 bcma_debug(bus, "Initializing MIPS core...\n"); bcma_core_mips_init() 390 bcma_fix_i2s_irqflag(bus); bcma_core_mips_init() 392 switch (bus->chipinfo.id) { bcma_core_mips_init() 395 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0); bcma_core_mips_init() 396 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0); bcma_core_mips_init() 397 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0); bcma_core_mips_init() 398 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_PCIE, 0); bcma_core_mips_init() 399 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0); bcma_core_mips_init() 400 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0); bcma_core_mips_init() 405 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0); bcma_core_mips_init() 406 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0); bcma_core_mips_init() 407 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0); bcma_core_mips_init() 411 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_80211, 0); bcma_core_mips_init() 412 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_MAC_GBIT, 0); bcma_core_mips_init() 413 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_USB20_HOST, 0); bcma_core_mips_init() 414 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_CHIPCOMMON, 0); bcma_core_mips_init() 415 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_I2S, 0); bcma_core_mips_init() 418 bcma_core_mips_set_irq_name(bus, 1, BCMA_CORE_PCIE, 0); bcma_core_mips_init() 419 bcma_core_mips_set_irq_name(bus, 2, BCMA_CORE_4706_MAC_GBIT, bcma_core_mips_init() 421 bcma_core_mips_set_irq_name(bus, 3, BCMA_CORE_PCIE, 1); bcma_core_mips_init() 422 bcma_core_mips_set_irq_name(bus, 4, BCMA_CORE_USB20_HOST, 0); bcma_core_mips_init() 423 bcma_core_mips_set_irq_name(bus, 0, BCMA_CORE_4706_CHIPCOMMON, bcma_core_mips_init() 427 list_for_each_entry(core, &bus->cores, list) { bcma_core_mips_init() 430 bcma_err(bus, bcma_core_mips_init() 432 bus->chipinfo.id); bcma_core_mips_init() 434 bcma_debug(bus, "IRQ reconfiguration done\n"); bcma_core_mips_init() 435 bcma_core_mips_dump_irq(bus); bcma_core_mips_init()
|
H A D | scan.c | 141 static u32 bcma_scan_read32(struct bcma_bus *bus, u8 current_coreidx, bcma_scan_read32() argument 144 return readl(bus->mmio + offset); bcma_scan_read32() 147 static void bcma_scan_switch_core(struct bcma_bus *bus, u32 addr) bcma_scan_switch_core() argument 149 if (bus->hosttype == BCMA_HOSTTYPE_PCI) bcma_scan_switch_core() 150 pci_write_config_dword(bus->host_pci, BCMA_PCI_BAR0_WIN, bcma_scan_switch_core() 154 static u32 bcma_erom_get_ent(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_get_ent() argument 166 static s32 bcma_erom_get_ci(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_get_ci() argument 168 u32 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_ci() 176 static bool bcma_erom_is_end(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_is_end() argument 178 u32 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_is_end() 183 static bool bcma_erom_is_bridge(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_is_bridge() argument 185 u32 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_is_bridge() 192 static void bcma_erom_skip_component(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_skip_component() argument 196 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_skip_component() 206 static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 __iomem **eromptr) bcma_erom_get_mst_port() argument 208 u32 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_mst_port() 216 static u32 bcma_erom_get_addr_desc(struct bcma_bus *bus, u32 __iomem **eromptr, bcma_erom_get_addr_desc() argument 222 u32 ent = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_addr_desc() 233 addrh = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_addr_desc() 238 size = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_addr_desc() 241 sizeh = bcma_erom_get_ent(bus, eromptr); bcma_erom_get_addr_desc() 249 static struct bcma_device *bcma_find_core_by_index(struct bcma_bus *bus, bcma_find_core_by_index() argument 254 list_for_each_entry(core, &bus->cores, list) { bcma_find_core_by_index() 261 static struct bcma_device *bcma_find_core_reverse(struct bcma_bus *bus, u16 coreid) bcma_find_core_reverse() argument 265 list_for_each_entry_reverse(core, &bus->cores, list) { bcma_find_core_reverse() 274 static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr, bcma_get_next_core() argument 284 cia = bcma_erom_get_ci(bus, eromptr); bcma_get_next_core() 287 if (bcma_erom_is_end(bus, eromptr)) bcma_get_next_core() 291 cib = bcma_erom_get_ci(bus, eromptr); bcma_get_next_core() 308 bcma_erom_skip_component(bus, eromptr); bcma_get_next_core() 321 bcma_erom_skip_component(bus, eromptr); bcma_get_next_core() 326 if (bcma_erom_is_bridge(bus, eromptr)) { bcma_get_next_core() 327 bcma_erom_skip_component(bus, eromptr); bcma_get_next_core() 331 if (bcma_find_core_by_index(bus, core_num)) { bcma_get_next_core() 332 bcma_erom_skip_component(bus, eromptr); bcma_get_next_core() 342 bcma_erom_skip_component(bus, eromptr); bcma_get_next_core() 348 s32 mst_port_d = bcma_erom_get_mst_port(bus, eromptr); bcma_get_next_core() 356 tmp = bcma_erom_get_addr_desc(bus, eromptr, SCAN_ADDR_TYPE_SLAVE, 0); bcma_get_next_core() 359 tmp = bcma_erom_get_addr_desc(bus, eromptr, bcma_get_next_core() 364 bcma_info(bus, "Bridge found\n"); bcma_get_next_core() 374 tmp = bcma_erom_get_addr_desc(bus, eromptr, bcma_get_next_core() 391 tmp = bcma_erom_get_addr_desc(bus, eromptr, bcma_get_next_core() 409 tmp = bcma_erom_get_addr_desc(bus, eromptr, bcma_get_next_core() 422 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { bcma_get_next_core() 438 void bcma_detect_chip(struct bcma_bus *bus) bcma_detect_chip() argument 441 struct bcma_chipinfo *chipinfo = &(bus->chipinfo); bcma_detect_chip() 444 bcma_scan_switch_core(bus, BCMA_ADDR_BASE); bcma_detect_chip() 446 tmp = bcma_scan_read32(bus, 0, BCMA_CC_ID); bcma_detect_chip() 453 bcma_info(bus, "Found chip with id %s, rev 0x%02X and package 0x%02X\n", bcma_detect_chip() 457 int bcma_bus_scan(struct bcma_bus *bus) bcma_bus_scan() argument 464 /* Skip if bus was already scanned (e.g. during early register) */ bcma_bus_scan() 465 if (bus->nr_cores) bcma_bus_scan() 468 erombase = bcma_scan_read32(bus, 0, BCMA_CC_EROM); bcma_bus_scan() 469 if (bus->hosttype == BCMA_HOSTTYPE_SOC) { bcma_bus_scan() 474 eromptr = bus->mmio; bcma_bus_scan() 479 bcma_scan_switch_core(bus, erombase); bcma_bus_scan() 489 core->bus = bus; bcma_bus_scan() 491 err = bcma_get_next_core(bus, &eromptr, NULL, core_num, core); bcma_bus_scan() 506 bus->nr_cores++; bcma_bus_scan() 507 other_core = bcma_find_core_reverse(bus, core->id.id); bcma_bus_scan() 509 bcma_prepare_core(bus, core); bcma_bus_scan() 511 bcma_info(bus, "Core %d found: %s (manuf 0x%03X, id 0x%03X, rev 0x%02X, class 0x%X)\n", bcma_bus_scan() 516 list_add_tail(&core->list, &bus->cores); bcma_bus_scan() 521 if (bus->hosttype == BCMA_HOSTTYPE_SOC) bcma_bus_scan()
|
H A D | host_soc.c | 170 struct bcma_bus *bus = &soc->bus; bcma_host_soc_register() local 173 * to scan the bus. bcma_host_soc_register() 175 bus->mmio = ioremap_nocache(BCMA_ADDR_BASE, BCMA_CORE_SIZE * 1); bcma_host_soc_register() 176 if (!bus->mmio) bcma_host_soc_register() 180 bus->hosttype = BCMA_HOSTTYPE_SOC; bcma_host_soc_register() 181 bus->ops = &bcma_host_soc_ops; bcma_host_soc_register() 182 bus->host_pdev = NULL; bcma_host_soc_register() 185 bcma_init_bus(bus); bcma_host_soc_register() 192 struct bcma_bus *bus = &soc->bus; bcma_host_soc_init() local 195 /* Scan bus and initialize it */ bcma_host_soc_init() 196 err = bcma_bus_early_register(bus); bcma_host_soc_init() 198 iounmap(bus->mmio); bcma_host_soc_init() 208 struct bcma_bus *bus; bcma_host_soc_probe() local 212 bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); bcma_host_soc_probe() 213 if (!bus) bcma_host_soc_probe() 217 bus->mmio = of_iomap(np, 0); bcma_host_soc_probe() 218 if (!bus->mmio) bcma_host_soc_probe() 222 bus->hosttype = BCMA_HOSTTYPE_SOC; bcma_host_soc_probe() 223 bus->ops = &bcma_host_soc_ops; bcma_host_soc_probe() 224 bus->host_pdev = pdev; bcma_host_soc_probe() 227 bcma_init_bus(bus); bcma_host_soc_probe() 230 err = bcma_bus_register(bus); bcma_host_soc_probe() 234 platform_set_drvdata(pdev, bus); bcma_host_soc_probe() 239 iounmap(bus->mmio); bcma_host_soc_probe() 245 struct bcma_bus *bus = platform_get_drvdata(pdev); bcma_host_soc_remove() local 247 bcma_bus_unregister(bus); bcma_host_soc_remove() 248 iounmap(bus->mmio); bcma_host_soc_remove() 255 { .compatible = "brcm,bus-axi", },
|
H A D | bcma_private.h | 13 #define bcma_err(bus, fmt, ...) \ 14 pr_err("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) 15 #define bcma_warn(bus, fmt, ...) \ 16 pr_warn("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) 17 #define bcma_info(bus, fmt, ...) \ 18 pr_info("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) 19 #define bcma_debug(bus, fmt, ...) \ 20 pr_debug("bus%d: " fmt, (bus)->num, ##__VA_ARGS__) 27 void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core); 28 void bcma_init_bus(struct bcma_bus *bus); 29 void bcma_unregister_cores(struct bcma_bus *bus); 30 int bcma_bus_register(struct bcma_bus *bus); 31 void bcma_bus_unregister(struct bcma_bus *bus); 32 int __init bcma_bus_early_register(struct bcma_bus *bus); 34 int bcma_bus_suspend(struct bcma_bus *bus); 35 int bcma_bus_resume(struct bcma_bus *bus); 39 void bcma_detect_chip(struct bcma_bus *bus); 40 int bcma_bus_scan(struct bcma_bus *bus); 43 int bcma_sprom_get(struct bcma_bus *bus); 71 bcma_err(cc->core->bus, "Serial flash not supported\n"); bcma_sflash_init() 83 bcma_err(cc->core->bus, "NAND flash not supported\n"); bcma_nflash_init() 118 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); bcma_core_pci_early_init() 122 /* Initialization is required for PCI hosted bus */ bcma_core_pci_init() 123 WARN_ON(pc->core->bus->hosttype == BCMA_HOSTTYPE_PCI); bcma_core_pci_init() 134 /* Initialization is required for PCI hosted bus */ bcma_core_pcie2_init() 135 WARN_ON(pcie2->core->bus->hosttype == BCMA_HOSTTYPE_PCI); bcma_core_pcie2_init()
|
H A D | driver_chipcommon_b.c | 14 static bool bcma_wait_reg(struct bcma_bus *bus, void __iomem *addr, u32 mask, bcma_wait_reg() argument 28 bcma_err(bus, "Timeout waiting for register %p\n", addr); bcma_wait_reg() 35 struct bcma_bus *bus = ccb->core->bus; bcma_chipco_b_mii_write() local 38 bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); bcma_chipco_b_mii_write() 40 bcma_wait_reg(bus, ccb->mii + 0x00, 0x0100, 0x0000, 100); bcma_chipco_b_mii_write()
|
H A D | driver_chipcommon_pmu.c | 82 struct bcma_bus *bus = cc->core->bus; bcma_pmu2_pll_init0() local 86 switch (bus->chipinfo.id) { bcma_pmu2_pll_init0() 110 bcma_err(bus, "Unknown TGT frequency for xtalfreq %d\n", bcma_pmu2_pll_init0() 120 bcma_debug(bus, "Target TGT frequency already set\n"); bcma_pmu2_pll_init0() 125 switch (bus->chipinfo.id) { bcma_pmu2_pll_init0() 150 struct bcma_bus *bus = cc->core->bus; bcma_pmu_pll_init() local 153 switch (bus->chipinfo.id) { bcma_pmu_pll_init() 164 struct bcma_bus *bus = cc->core->bus; bcma_pmu_resources_init() local 167 switch (bus->chipinfo.id) { bcma_pmu_resources_init() 192 bcma_debug(bus, "PMU resource config unknown or not needed for device 0x%04X\n", bcma_pmu_resources_init() 193 bus->chipinfo.id); bcma_pmu_resources_init() 212 struct bcma_bus *bus = cc->core->bus; bcma_chipco_bcm4331_ext_pa_lines_ctl() local 218 if (bus->chipinfo.pkg == 9 || bus->chipinfo.pkg == 11) bcma_chipco_bcm4331_ext_pa_lines_ctl() 220 else if (bus->chipinfo.rev > 0) bcma_chipco_bcm4331_ext_pa_lines_ctl() 232 struct bcma_bus *bus = cc->core->bus; bcma_pmu_workarounds() local 234 switch (bus->chipinfo.id) { bcma_pmu_workarounds() 251 if (bus->chipinfo.rev == 0) { bcma_pmu_workarounds() 265 bcma_debug(bus, "Workarounds unknown or not needed for device 0x%04X\n", bcma_pmu_workarounds() 266 bus->chipinfo.id); bcma_pmu_workarounds() 277 bcma_debug(cc->core->bus, "Found rev %u PMU (capabilities 0x%08X)\n", bcma_pmu_early_init() 297 struct bcma_bus *bus = cc->core->bus; bcma_pmu_get_alp_clock() local 299 switch (bus->chipinfo.id) { bcma_pmu_get_alp_clock() 330 bcma_warn(bus, "No ALP clock specified for %04X device, pmu rev. %d, using default %d Hz\n", bcma_pmu_get_alp_clock() 331 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_ALP_CLOCK); bcma_pmu_get_alp_clock() 342 struct bcma_bus *bus = cc->core->bus; bcma_pmu_pll_clock() local 348 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 || bcma_pmu_pll_clock() 349 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749) { bcma_pmu_pll_clock() 405 /* query bus clock frequency for PMU-enabled chipcommon */ bcma_pmu_get_bus_clock() 408 struct bcma_bus *bus = cc->core->bus; bcma_pmu_get_bus_clock() local 410 switch (bus->chipinfo.id) { bcma_pmu_get_bus_clock() 430 bcma_warn(bus, "No bus clock specified for %04X device, pmu rev. %d, using default %d Hz\n", bcma_pmu_get_bus_clock() 431 bus->chipinfo.id, cc->pmu.rev, BCMA_CC_PMU_HT_CLOCK); bcma_pmu_get_bus_clock() 440 struct bcma_bus *bus = cc->core->bus; bcma_pmu_get_cpu_clock() local 442 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) bcma_pmu_get_cpu_clock() 445 /* New PMUs can have different clock for bus and CPU */ bcma_pmu_get_cpu_clock() 448 switch (bus->chipinfo.id) { bcma_pmu_get_cpu_clock() 468 /* On old PMUs CPU has the same clock as the bus */ bcma_pmu_get_cpu_clock() 485 struct bcma_bus *bus = cc->core->bus; bcma_pmu_spuravoid_pllupdate() local 487 switch (bus->chipinfo.id) { bcma_pmu_spuravoid_pllupdate() 495 phypll_offset = (bus->chipinfo.id == BCMA_CHIP_ID_BCM5357 || bcma_pmu_spuravoid_pllupdate() 496 bus->chipinfo.id == BCMA_CHIP_ID_BCM4749 || bcma_pmu_spuravoid_pllupdate() 497 bus->chipinfo.id == BCMA_CHIP_ID_BCM53572) ? 6 : 0; bcma_pmu_spuravoid_pllupdate() 644 bcma_err(bus, "Unknown spuravoidance settings for chip 0x%04X, not changing PLL\n", bcma_pmu_spuravoid_pllupdate() 645 bus->chipinfo.id); bcma_pmu_spuravoid_pllupdate()
|
H A D | driver_chipcommon_nflash.c | 21 struct bcma_bus *bus = cc->core->bus; bcma_nflash_init() local 23 if (bus->chipinfo.id != BCMA_CHIP_ID_BCM4706 && bcma_nflash_init() 25 bcma_err(bus, "NAND flash on unsupported board!\n"); bcma_nflash_init() 30 bcma_err(bus, "NAND flash not present according to ChipCommon\n"); bcma_nflash_init()
|
H A D | sprom.c | 31 * to controll the system bus. 34 * BCMA device hardwired to their PCI bus. 39 int bcma_arch_register_fallback_sprom(int (*sprom_callback)(struct bcma_bus *bus, bcma_arch_register_fallback_sprom() argument 49 static int bcma_fill_sprom_with_fallback(struct bcma_bus *bus, bcma_fill_sprom_with_fallback() argument 59 err = get_fallback_sprom(bus, out); bcma_fill_sprom_with_fallback() 63 bcma_debug(bus, "Using SPROM revision %d provided by platform.\n", bcma_fill_sprom_with_fallback() 64 bus->sprom.revision); bcma_fill_sprom_with_fallback() 67 bcma_warn(bus, "Using fallback SPROM failed (err %d)\n", err); bcma_fill_sprom_with_fallback() 75 static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom, bcma_sprom_read() argument 80 sprom[i] = bcma_read16(bus->drv_cc.core, offset + (i * 2)); bcma_sprom_read() 157 static int bcma_sprom_valid(struct bcma_bus *bus, const u16 *sprom, bcma_sprom_valid() argument 173 bus->sprom.revision = revision; bcma_sprom_valid() 174 bcma_debug(bus, "Found SPROM revision %d\n", revision); bcma_sprom_valid() 186 bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift)) 189 bus->sprom._field = ((((u32)sprom[SPOFF((_offset)+2)] << 16 | \ 221 static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) bcma_sprom_extract_r8() argument 230 ARRAY_SIZE(bus->sprom.core_pwr_info)); bcma_sprom_extract_r8() 234 *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v); bcma_sprom_extract_r8() 401 bus->sprom.antenna_gain.a0 = sprom_extract_antgain(sprom, bcma_sprom_extract_r8() 405 bus->sprom.antenna_gain.a1 = sprom_extract_antgain(sprom, bcma_sprom_extract_r8() 409 bus->sprom.antenna_gain.a2 = sprom_extract_antgain(sprom, bcma_sprom_extract_r8() 413 bus->sprom.antenna_gain.a3 = sprom_extract_antgain(sprom, bcma_sprom_extract_r8() 480 static bool bcma_sprom_ext_available(struct bcma_bus *bus) bcma_sprom_ext_available() argument 486 if (bus->drv_cc.core->id.rev >= 31) { bcma_sprom_ext_available() 487 if (!(bus->drv_cc.capabilities & BCMA_CC_CAP_SPROM)) bcma_sprom_ext_available() 490 srom_control = bcma_read32(bus->drv_cc.core, bcma_sprom_ext_available() 496 chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT); bcma_sprom_ext_available() 497 switch (bus->chipinfo.id) { bcma_sprom_ext_available() 516 static bool bcma_sprom_onchip_available(struct bcma_bus *bus) bcma_sprom_onchip_available() argument 522 chip_status = bcma_read32(bus->drv_cc.core, BCMA_CC_CHIPSTAT); bcma_sprom_onchip_available() 523 switch (bus->chipinfo.id) { bcma_sprom_onchip_available() 550 otpsize = bus->drv_cc.capabilities & BCMA_CC_CAP_OTPS; bcma_sprom_onchip_available() 563 static int bcma_sprom_onchip_offset(struct bcma_bus *bus) bcma_sprom_onchip_offset() argument 565 struct bcma_device *cc = bus->drv_cc.core; bcma_sprom_onchip_offset() 577 int bcma_sprom_get(struct bcma_bus *bus) bcma_sprom_get() argument 586 if (!bus->drv_cc.core) bcma_sprom_get() 589 if (!bcma_sprom_ext_available(bus)) { bcma_sprom_get() 597 sprom_onchip = bcma_sprom_onchip_available(bus); bcma_sprom_get() 600 offset = bcma_sprom_onchip_offset(bus); bcma_sprom_get() 608 err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); bcma_sprom_get() 613 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 || bcma_sprom_get() 614 bus->chipinfo.id == BCMA_CHIP_ID_BCM43431) bcma_sprom_get() 615 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); bcma_sprom_get() 617 bcma_debug(bus, "SPROM offset 0x%x\n", offset); bcma_sprom_get() 625 bcma_sprom_read(bus, offset, sprom, words); bcma_sprom_get() 626 err = bcma_sprom_valid(bus, sprom, words); bcma_sprom_get() 633 if (bus->chipinfo.id == BCMA_CHIP_ID_BCM4331 || bcma_sprom_get() 634 bus->chipinfo.id == BCMA_CHIP_ID_BCM43431) bcma_sprom_get() 635 bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); bcma_sprom_get() 638 bcma_warn(bus, "Invalid SPROM read from the PCIe card, trying to use fallback SPROM\n"); bcma_sprom_get() 639 err = bcma_fill_sprom_with_fallback(bus, &bus->sprom); bcma_sprom_get() 641 bcma_sprom_extract_r8(bus, sprom); bcma_sprom_get()
|
H A D | driver_pcie2.c | 145 struct bcma_drv_cc *drv_cc = &pcie2->core->bus->drv_cc; pciedev_reg_pm_clk_period() 160 struct bcma_bus *bus = pcie2->core->bus; bcma_core_pcie2_init() local 161 struct bcma_chipinfo *ci = &bus->chipinfo; bcma_core_pcie2_init() 168 switch (bus->chipinfo.id) { bcma_core_pcie2_init() 193 struct bcma_bus *bus = pcie2->core->bus; bcma_core_pcie2_up() local 194 struct pci_dev *dev = bus->host_pci; bcma_core_pcie2_up() 199 bcma_err(bus, "Error setting PCI_EXP_DEVCTL_READRQ: %d\n", err); bcma_core_pcie2_up()
|
/linux-4.1.27/arch/x86/pci/ |
H A D | early.c | 10 u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset) read_pci_config() argument 13 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); read_pci_config() 18 u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset) read_pci_config_byte() argument 21 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); read_pci_config_byte() 26 u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset) read_pci_config_16() argument 29 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); read_pci_config_16() 34 void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, write_pci_config() argument 37 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); write_pci_config() 41 void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val) write_pci_config_byte() argument 43 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); write_pci_config_byte() 47 void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val) write_pci_config_16() argument 49 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); write_pci_config_16() 59 void early_dump_pci_device(u8 bus, u8 slot, u8 func) early_dump_pci_device() argument 66 bus, slot, func); early_dump_pci_device() 72 val = read_pci_config(bus, slot, func, i); early_dump_pci_device() 83 unsigned bus, slot, func; early_dump_pci_devices() local 88 for (bus = 0; bus < 256; bus++) { early_dump_pci_devices() 94 class = read_pci_config(bus, slot, func, early_dump_pci_devices() 99 early_dump_pci_device(bus, slot, func); early_dump_pci_devices() 102 type = read_pci_config_byte(bus, slot, early_dump_pci_devices()
|
H A D | broadcom_bus.c | 22 static void __init cnb20le_res(u8 bus, u8 slot, u8 func) cnb20le_res() argument 30 /* read the PCI bus numbers */ cnb20le_res() 31 fbus = read_pci_config_byte(bus, slot, func, 0x44); cnb20le_res() 32 lbus = read_pci_config_byte(bus, slot, func, 0x45); cnb20le_res() 36 * Add the legacy IDE ports on bus 0 cnb20le_res() 50 word1 = read_pci_config_16(bus, slot, func, 0xc0); cnb20le_res() 51 word2 = read_pci_config_16(bus, slot, func, 0xc2); cnb20le_res() 60 word1 = read_pci_config_16(bus, slot, func, 0xc4); cnb20le_res() 61 word2 = read_pci_config_16(bus, slot, func, 0xc6); cnb20le_res() 70 word1 = read_pci_config_16(bus, slot, func, 0xd0); cnb20le_res() 71 word2 = read_pci_config_16(bus, slot, func, 0xd2); cnb20le_res() 91 u8 bus = 0, slot = 0; broadcom_postcore_init() local 104 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID); broadcom_postcore_init() 110 cnb20le_res(bus, slot, 0); broadcom_postcore_init() 111 cnb20le_res(bus, slot, 1); broadcom_postcore_init()
|
H A D | mmconfig_32.c | 28 static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) get_base_addr() argument 30 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus); get_base_addr() 40 static void pci_exp_set_dev_base(unsigned int base, int bus, int devfn) pci_exp_set_dev_base() argument 42 u32 dev_base = base | PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12); pci_exp_set_dev_base() 52 static int pci_mmcfg_read(unsigned int seg, unsigned int bus, pci_mmcfg_read() argument 58 if ((bus > 255) || (devfn > 255) || (reg > 4095)) { pci_mmcfg_read() 64 base = get_base_addr(seg, bus, devfn); pci_mmcfg_read() 72 pci_exp_set_dev_base(base, bus, devfn); pci_mmcfg_read() 91 static int pci_mmcfg_write(unsigned int seg, unsigned int bus, pci_mmcfg_write() argument 97 if ((bus > 255) || (devfn > 255) || (reg > 4095)) pci_mmcfg_write() 101 base = get_base_addr(seg, bus, devfn); pci_mmcfg_write() 109 pci_exp_set_dev_base(base, bus, devfn); pci_mmcfg_write()
|
H A D | numachip.c | 21 static inline char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) pci_dev_base() argument 23 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus); pci_dev_base() 26 return cfg->virt + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12)); pci_dev_base() 30 static int pci_mmcfg_read_numachip(unsigned int seg, unsigned int bus, pci_mmcfg_read_numachip() argument 36 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { pci_mmcfg_read_numachip() 42 if (unlikely(bus == 0 && devfn >= limit)) { pci_mmcfg_read_numachip() 48 addr = pci_dev_base(seg, bus, devfn); pci_mmcfg_read_numachip() 70 static int pci_mmcfg_write_numachip(unsigned int seg, unsigned int bus, pci_mmcfg_write_numachip() argument 76 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) pci_mmcfg_write_numachip() 80 if (unlikely(bus == 0 && devfn >= limit)) pci_mmcfg_write_numachip() 84 addr = pci_dev_base(seg, bus, devfn); pci_mmcfg_write_numachip() 116 /* For remote I/O, restrict bus 0 access to the actual number of AMD pci_numachip_init()
|
H A D | intel_mid_pci.c | 51 * @bus: PCI bus 54 * Look for the fixed BAR cap on @bus and @devfn, returning its offset 57 static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn) fixed_bar_cap() argument 68 if (raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number, fixed_bar_cap() 77 raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number, fixed_bar_cap() 89 static int pci_device_update_fixed(struct pci_bus *bus, unsigned int devfn, pci_device_update_fixed() argument 96 domain = pci_domain_nr(bus); pci_device_update_fixed() 97 busnum = bus->number; pci_device_update_fixed() 135 * @bus: bus number 138 * If the bus is on a Lincroft chip and it exists, or is not on a Lincroft at 143 static bool type1_access_ok(unsigned int bus, unsigned int devfn, int reg) type1_access_ok() argument 155 if (bus == 0 && (devfn == PCI_DEVFN(2, 0) type1_access_ok() 162 static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, pci_read() argument 165 if (type1_access_ok(bus->number, devfn, where)) pci_read() 166 return pci_direct_conf1.read(pci_domain_nr(bus), bus->number, pci_read() 168 return raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number, pci_read() 172 static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, pci_write() argument 190 offset = fixed_bar_cap(bus, devfn); pci_write() 193 return pci_device_update_fixed(bus, devfn, where, size, value, pci_write() 202 if (type1_access_ok(bus->number, devfn, where)) pci_write() 203 return pci_direct_conf1.write(pci_domain_nr(bus), bus->number, pci_write() 205 return raw_pci_ext_ops->write(pci_domain_nr(bus), bus->number, devfn, pci_write() 283 if (type1_access_ok(dev->bus->number, dev->devfn, PCI_DEVICE_ID)) pci_d3delay_fixup() 315 offset = fixed_bar_cap(dev->bus, dev->devfn); pci_fixed_bar_fixup()
|
H A D | bus_numa.c | 9 static struct pci_root_info *x86_find_pci_root_info(int bus) x86_find_pci_root_info() argument 14 if (info->busn.start == bus) x86_find_pci_root_info() 20 int x86_pci_root_bus_node(int bus) x86_pci_root_bus_node() argument 22 struct pci_root_info *info = x86_find_pci_root_info(bus); x86_pci_root_bus_node() 30 void x86_pci_root_bus_resources(int bus, struct list_head *resources) x86_pci_root_bus_resources() argument 32 struct pci_root_info *info = x86_find_pci_root_info(bus); x86_pci_root_bus_resources() 40 printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n", x86_pci_root_bus_resources() 41 bus); x86_pci_root_bus_resources() 73 printk(KERN_DEBUG "PCI: root bus %02x: using default resources\n", bus);
|
H A D | mmconfig_64.c | 18 static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) pci_dev_base() argument 20 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus); pci_dev_base() 23 return cfg->virt + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12)); pci_dev_base() 27 static int pci_mmcfg_read(unsigned int seg, unsigned int bus, pci_mmcfg_read() argument 33 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) { pci_mmcfg_read() 39 addr = pci_dev_base(seg, bus, devfn); pci_mmcfg_read() 61 static int pci_mmcfg_write(unsigned int seg, unsigned int bus, pci_mmcfg_write() argument 67 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) pci_mmcfg_write() 71 addr = pci_dev_base(seg, bus, devfn); pci_mmcfg_write()
|
H A D | amd_bus.c | 22 u32 bus; member in struct:amd_hostbridge 62 unsigned bus; early_root_info_init() local 89 bus = hb_probes[i].bus; early_root_info_init() 91 id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID); early_root_info_init() 115 reg = read_pci_config(bus, slot, 1, early_root_info_init() 118 /* Check if that register is enabled for bus range */ early_root_info_init() 142 reg = read_pci_config(bus, slot, 0, AMD_NB_F0_NODE_ID); early_root_info_init() 144 reg = read_pci_config(bus, slot, 0, AMD_NB_F0_UNIT_ID); early_root_info_init() 151 reg = read_pci_config(bus, slot, 1, 0xc0 + (i << 3)); early_root_info_init() 156 reg = read_pci_config(bus, slot, 1, 0xc4 + (i << 3)); early_root_info_init() 217 reg = read_pci_config(bus, slot, 1, 0x80 + (i << 3)); early_root_info_init() 223 reg = read_pci_config(bus, slot, 1, 0x84 + (i << 3)); early_root_info_init() 318 printk(KERN_DEBUG "bus: %pR on node %x link %x\n", early_root_info_init() 321 printk(KERN_DEBUG "bus: %02x %pR\n", early_root_info_init() 365 u8 bus = amd_nb_bus_dev_ranges[i].bus; pci_enable_pci_io_ecs() local 370 u32 val = read_pci_config(bus, slot, 3, 0); pci_enable_pci_io_ecs() 375 val = read_pci_config(bus, slot, 3, 0x8c); pci_enable_pci_io_ecs() 378 write_pci_config(bus, slot, 3, 0x8c, val); pci_enable_pci_io_ecs()
|
H A D | i386.c | 135 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) skip_isa_ioresource_align() 232 static void pcibios_allocate_bus_resources(struct pci_bus *bus) pcibios_allocate_bus_resources() argument 236 /* Depth-First Search on bus tree */ pcibios_allocate_bus_resources() 237 if (bus->self) pcibios_allocate_bus_resources() 238 pcibios_allocate_bridge_resources(bus->self); pcibios_allocate_bus_resources() 239 list_for_each_entry(child, &bus->children, node) pcibios_allocate_bus_resources() 306 static void pcibios_allocate_resources(struct pci_bus *bus, int pass) pcibios_allocate_resources() argument 311 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_allocate_resources() 340 static void pcibios_allocate_rom_resources(struct pci_bus *bus) pcibios_allocate_rom_resources() argument 345 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_allocate_rom_resources() 356 struct pci_bus *bus; pcibios_assign_resources() local 359 list_for_each_entry(bus, &pci_root_buses, node) pcibios_assign_resources() 360 pcibios_allocate_rom_resources(bus); pcibios_assign_resources() 374 void pcibios_resource_survey_bus(struct pci_bus *bus) pcibios_resource_survey_bus() argument 376 dev_printk(KERN_DEBUG, &bus->dev, "Allocating resources\n"); pcibios_resource_survey_bus() 378 pcibios_allocate_bus_resources(bus); pcibios_resource_survey_bus() 380 pcibios_allocate_resources(bus, 0); pcibios_resource_survey_bus() 381 pcibios_allocate_resources(bus, 1); pcibios_resource_survey_bus() 384 pcibios_allocate_rom_resources(bus); pcibios_resource_survey_bus() 389 struct pci_bus *bus; pcibios_resource_survey() local 393 list_for_each_entry(bus, &pci_root_buses, node) pcibios_resource_survey() 394 pcibios_allocate_bus_resources(bus); pcibios_resource_survey() 396 list_for_each_entry(bus, &pci_root_buses, node) pcibios_resource_survey() 397 pcibios_allocate_resources(bus, 0); pcibios_resource_survey() 398 list_for_each_entry(bus, &pci_root_buses, node) pcibios_resource_survey() 399 pcibios_allocate_resources(bus, 1); pcibios_resource_survey()
|
H A D | legacy.c | 2 * legacy.c - traditional, old school PCI bus probing 11 * We use the number of last PCI bus provided by the PCI BIOS. 49 printk(KERN_INFO "PCI: Discovered peer bus %02x\n", busn); pcibios_scan_specific_bus()
|
/linux-4.1.27/arch/powerpc/platforms/pasemi/ |
H A D | gpio_mdio.c | 47 #define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin) 48 #define MDIO_PIN(bus) (((struct gpio_priv *)bus->priv)->mdio_pin) 50 static inline void mdio_lo(struct mii_bus *bus) mdio_lo() argument 52 out_le32(gpio_regs+0x10, 1 << MDIO_PIN(bus)); mdio_lo() 55 static inline void mdio_hi(struct mii_bus *bus) mdio_hi() argument 57 out_le32(gpio_regs, 1 << MDIO_PIN(bus)); mdio_hi() 60 static inline void mdc_lo(struct mii_bus *bus) mdc_lo() argument 62 out_le32(gpio_regs+0x10, 1 << MDC_PIN(bus)); mdc_lo() 65 static inline void mdc_hi(struct mii_bus *bus) mdc_hi() argument 67 out_le32(gpio_regs, 1 << MDC_PIN(bus)); mdc_hi() 70 static inline void mdio_active(struct mii_bus *bus) mdio_active() argument 72 out_le32(gpio_regs+0x20, (1 << MDC_PIN(bus)) | (1 << MDIO_PIN(bus))); mdio_active() 75 static inline void mdio_tristate(struct mii_bus *bus) mdio_tristate() argument 77 out_le32(gpio_regs+0x30, (1 << MDIO_PIN(bus))); mdio_tristate() 80 static inline int mdio_read(struct mii_bus *bus) mdio_read() argument 82 return !!(in_le32(gpio_regs+0x40) & (1 << MDIO_PIN(bus))); mdio_read() 85 static void clock_out(struct mii_bus *bus, int bit) clock_out() argument 88 mdio_hi(bus); clock_out() 90 mdio_lo(bus); clock_out() 92 mdc_hi(bus); clock_out() 94 mdc_lo(bus); clock_out() 98 static void bitbang_pre(struct mii_bus *bus, int read, u8 addr, u8 reg) bitbang_pre() argument 103 mdio_active(bus); bitbang_pre() 105 clock_out(bus, 1); bitbang_pre() 109 clock_out(bus, 0); bitbang_pre() 110 clock_out(bus, 1); bitbang_pre() 112 clock_out(bus, read); bitbang_pre() 113 clock_out(bus, !read); bitbang_pre() 117 clock_out(bus, (addr & 0x10) != 0); bitbang_pre() 123 clock_out(bus, (reg & 0x10) != 0); bitbang_pre() 128 static int gpio_mdio_read(struct mii_bus *bus, int phy_id, int location) gpio_mdio_read() argument 135 bitbang_pre(bus, 1, addr, reg); gpio_mdio_read() 138 mdio_tristate(bus); gpio_mdio_read() 140 mdc_hi(bus); gpio_mdio_read() 142 mdc_lo(bus); gpio_mdio_read() 147 mdc_lo(bus); gpio_mdio_read() 149 mdc_hi(bus); gpio_mdio_read() 151 mdc_lo(bus); gpio_mdio_read() 154 rdreg |= mdio_read(bus); gpio_mdio_read() 157 mdc_hi(bus); gpio_mdio_read() 159 mdc_lo(bus); gpio_mdio_read() 167 static int gpio_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val) gpio_mdio_write() argument 175 bitbang_pre(bus, 0, addr, reg); gpio_mdio_write() 178 mdc_lo(bus); gpio_mdio_write() 179 mdio_hi(bus); gpio_mdio_write() 181 mdc_hi(bus); gpio_mdio_write() 183 mdc_lo(bus); gpio_mdio_write() 184 mdio_lo(bus); gpio_mdio_write() 186 mdc_hi(bus); gpio_mdio_write() 191 mdc_lo(bus); gpio_mdio_write() 193 mdio_hi(bus); gpio_mdio_write() 195 mdio_lo(bus); gpio_mdio_write() 197 mdc_hi(bus); gpio_mdio_write() 205 mdio_tristate(bus); gpio_mdio_write() 206 mdc_lo(bus); gpio_mdio_write() 208 mdc_hi(bus); gpio_mdio_write() 213 static int gpio_mdio_reset(struct mii_bus *bus) gpio_mdio_reset() argument 239 new_bus->name = "pasemi gpio mdio bus"; gpio_mdio_probe() 262 printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n", gpio_mdio_probe() 280 struct mii_bus *bus = dev_get_drvdata(&dev->dev); gpio_mdio_remove() local 282 mdiobus_unregister(bus); gpio_mdio_remove() 286 kfree(bus->priv); gpio_mdio_remove() 287 bus->priv = NULL; gpio_mdio_remove() 288 mdiobus_free(bus); gpio_mdio_remove()
|
H A D | pci.c | 36 #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) 38 static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) pa_pxp_offset_valid() argument 44 if (bus == 0 && devfn == 0) pa_pxp_offset_valid() 51 u8 bus, u8 devfn, int offset) pa_pxp_cfg_addr() 53 return hose->cfg_data + PA_PXP_CFA(bus, devfn, offset); pa_pxp_cfg_addr() 68 static int workaround_5945(struct pci_bus *bus, unsigned int devfn, workaround_5945() argument 76 if (!is_root_port(bus->number, devfn) || !is_5945_reg(offset)) workaround_5945() 79 hose = pci_bus_to_host(bus); workaround_5945() 81 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset & ~0x3); workaround_5945() 88 dummy = pa_pxp_cfg_addr(hose, bus->number, devfn, 0x10); workaround_5945() 111 static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, pa_pxp_read_config() argument 117 hose = pci_bus_to_host(bus); pa_pxp_read_config() 121 if (!pa_pxp_offset_valid(bus->number, devfn, offset)) pa_pxp_read_config() 124 if (workaround_5945(bus, devfn, offset, len, val)) pa_pxp_read_config() 127 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); pa_pxp_read_config() 148 static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn, pa_pxp_write_config() argument 154 hose = pci_bus_to_host(bus); pa_pxp_write_config() 158 if (!pa_pxp_offset_valid(bus->number, devfn, offset)) pa_pxp_write_config() 161 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); pa_pxp_write_config() 241 hose = pci_bus_to_host(dev->bus); pasemi_pci_getcfgaddr() 243 return (void __iomem *)pa_pxp_cfg_addr(hose, dev->bus->number, dev->devfn, offset); pasemi_pci_getcfgaddr() 50 pa_pxp_cfg_addr(struct pci_controller *hose, u8 bus, u8 devfn, int offset) pa_pxp_cfg_addr() argument
|
/linux-4.1.27/drivers/net/ethernet/arc/ |
H A D | emac_mdio.c | 45 * @bus: Pointer to MII bus structure. 54 static int arc_mdio_read(struct mii_bus *bus, int phy_addr, int reg_num) arc_mdio_read() argument 56 struct arc_emac_priv *priv = bus->priv; arc_mdio_read() 77 * @bus: Pointer to MII bus structure. 86 static int arc_mdio_write(struct mii_bus *bus, int phy_addr, arc_mdio_write() argument 89 struct arc_emac_priv *priv = bus->priv; arc_mdio_write() 106 * (to allocate memory for MII bus structure) fails. 112 struct mii_bus *bus; arc_mdio_probe() local 115 bus = mdiobus_alloc(); arc_mdio_probe() 116 if (!bus) arc_mdio_probe() 119 priv->bus = bus; arc_mdio_probe() 120 bus->priv = priv; arc_mdio_probe() 121 bus->parent = priv->dev; arc_mdio_probe() 122 bus->name = "Synopsys MII Bus", arc_mdio_probe() 123 bus->read = &arc_mdio_read; arc_mdio_probe() 124 bus->write = &arc_mdio_write; arc_mdio_probe() 126 snprintf(bus->id, MII_BUS_ID_SIZE, "%s", bus->name); arc_mdio_probe() 128 error = of_mdiobus_register(bus, priv->dev->of_node); arc_mdio_probe() 130 dev_err(priv->dev, "cannot register MDIO bus %s\n", bus->name); arc_mdio_probe() 131 mdiobus_free(bus); arc_mdio_probe() 142 * Unregisters the MDIO and frees any associate memory for MII bus. 146 mdiobus_unregister(priv->bus); arc_mdio_remove() 147 mdiobus_free(priv->bus); arc_mdio_remove() 148 priv->bus = NULL; arc_mdio_remove()
|
/linux-4.1.27/arch/ia64/pci/ |
H A D | Makefile | 2 # Makefile for the ia64-specific parts of the pci bus
|
H A D | fixup.c | 33 struct pci_bus *bus; pci_fixup_video() local 42 bus = pdev->bus; pci_fixup_video() 43 while (bus) { pci_fixup_video() 44 bridge = bus->self; pci_fixup_video() 59 bus = bus->parent; pci_fixup_video()
|
/linux-4.1.27/drivers/net/phy/ |
H A D | mdio-octeon.c | 81 /* Wait 1000 clocks so we don't saturate the RSL bus octeon_mdiobus_c45_addr() 93 static int octeon_mdiobus_read(struct mii_bus *bus, int phy_id, int regnum) octeon_mdiobus_read() argument 95 struct octeon_mdiobus *p = bus->priv; octeon_mdiobus_read() 120 /* Wait 1000 clocks so we don't saturate the RSL bus octeon_mdiobus_read() 133 static int octeon_mdiobus_write(struct mii_bus *bus, int phy_id, octeon_mdiobus_write() argument 136 struct octeon_mdiobus *p = bus->priv; octeon_mdiobus_write() 165 /* Wait 1000 clocks so we don't saturate the RSL bus octeon_mdiobus_write() 180 struct octeon_mdiobus *bus; octeon_mdiobus_probe() local 185 bus = devm_kzalloc(&pdev->dev, sizeof(*bus), GFP_KERNEL); octeon_mdiobus_probe() 186 if (!bus) octeon_mdiobus_probe() 196 bus->mdio_phys = res_mem->start; octeon_mdiobus_probe() 197 bus->regsize = resource_size(res_mem); octeon_mdiobus_probe() 198 if (!devm_request_mem_region(&pdev->dev, bus->mdio_phys, bus->regsize, octeon_mdiobus_probe() 203 bus->register_base = octeon_mdiobus_probe() 204 (u64)devm_ioremap(&pdev->dev, bus->mdio_phys, bus->regsize); octeon_mdiobus_probe() 206 bus->mii_bus = mdiobus_alloc(); octeon_mdiobus_probe() 208 if (!bus->mii_bus) octeon_mdiobus_probe() 213 cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); octeon_mdiobus_probe() 215 bus->mii_bus->priv = bus; octeon_mdiobus_probe() 216 bus->mii_bus->irq = bus->phy_irq; octeon_mdiobus_probe() 217 bus->mii_bus->name = "mdio-octeon"; octeon_mdiobus_probe() 218 snprintf(bus->mii_bus->id, MII_BUS_ID_SIZE, "%llx", bus->register_base); octeon_mdiobus_probe() 219 bus->mii_bus->parent = &pdev->dev; octeon_mdiobus_probe() 221 bus->mii_bus->read = octeon_mdiobus_read; octeon_mdiobus_probe() 222 bus->mii_bus->write = octeon_mdiobus_write; octeon_mdiobus_probe() 224 platform_set_drvdata(pdev, bus); octeon_mdiobus_probe() 226 err = of_mdiobus_register(bus->mii_bus, pdev->dev.of_node); octeon_mdiobus_probe() 234 mdiobus_free(bus->mii_bus); octeon_mdiobus_probe() 237 cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); octeon_mdiobus_probe() 243 struct octeon_mdiobus *bus; octeon_mdiobus_remove() local 246 bus = platform_get_drvdata(pdev); octeon_mdiobus_remove() 248 mdiobus_unregister(bus->mii_bus); octeon_mdiobus_remove() 249 mdiobus_free(bus->mii_bus); octeon_mdiobus_remove() 251 cvmx_write_csr(bus->register_base + SMI_EN, smi_en.u64); octeon_mdiobus_remove()
|
H A D | mdio_bus.c | 44 * If non-zero, then bus->priv is points to that memory. 46 * Description: called by a bus driver to allocate an mii_bus 51 struct mii_bus *bus; mdiobus_alloc_size() local 52 size_t aligned_size = ALIGN(sizeof(*bus), NETDEV_ALIGN); mdiobus_alloc_size() 59 alloc_size = sizeof(*bus); mdiobus_alloc_size() 61 bus = kzalloc(alloc_size, GFP_KERNEL); mdiobus_alloc_size() 62 if (bus) { mdiobus_alloc_size() 63 bus->state = MDIOBUS_ALLOCATED; mdiobus_alloc_size() 65 bus->priv = (void *)bus + aligned_size; mdiobus_alloc_size() 68 return bus; mdiobus_alloc_size() 103 struct mii_bus **ptr, *bus; devm_mdiobus_alloc_size() local 110 bus = mdiobus_alloc_size(sizeof_priv); devm_mdiobus_alloc_size() 111 if (bus) { devm_mdiobus_alloc_size() 112 *ptr = bus; devm_mdiobus_alloc_size() 118 return bus; devm_mdiobus_alloc_size() 125 * @bus: the mii_bus associated with the device 129 void devm_mdiobus_free(struct device *dev, struct mii_bus *bus) devm_mdiobus_free() argument 134 devm_mdiobus_match, bus); devm_mdiobus_free() 148 struct mii_bus *bus = to_mii_bus(d); mdiobus_release() local 149 BUG_ON(bus->state != MDIOBUS_RELEASED && mdiobus_release() 151 bus->state != MDIOBUS_ALLOCATED); mdiobus_release() 152 kfree(bus); mdiobus_release() 191 /* Walk the list of subnodes of a mdio bus and look for a node that matches the 237 * mdiobus_register - bring up all the PHYs on a given bus and attach them to bus 238 * @bus: target mii_bus 240 * Description: Called by a bus driver to bring up all the PHYs 241 * on a given bus, and attach them to the bus. 245 int mdiobus_register(struct mii_bus *bus) mdiobus_register() argument 249 if (NULL == bus || NULL == bus->name || mdiobus_register() 250 NULL == bus->read || NULL == bus->write) mdiobus_register() 253 BUG_ON(bus->state != MDIOBUS_ALLOCATED && mdiobus_register() 254 bus->state != MDIOBUS_UNREGISTERED); mdiobus_register() 256 bus->dev.parent = bus->parent; mdiobus_register() 257 bus->dev.class = &mdio_bus_class; mdiobus_register() 258 bus->dev.groups = NULL; mdiobus_register() 259 dev_set_name(&bus->dev, "%s", bus->id); mdiobus_register() 261 err = device_register(&bus->dev); mdiobus_register() 263 pr_err("mii_bus %s failed to register\n", bus->id); mdiobus_register() 264 put_device(&bus->dev); mdiobus_register() 268 mutex_init(&bus->mdio_lock); mdiobus_register() 270 if (bus->reset) mdiobus_register() 271 bus->reset(bus); mdiobus_register() 274 if ((bus->phy_mask & (1 << i)) == 0) { mdiobus_register() 277 phydev = mdiobus_scan(bus, i); mdiobus_register() 285 bus->state = MDIOBUS_REGISTERED; mdiobus_register() 286 pr_info("%s: probed\n", bus->name); mdiobus_register() 291 if (bus->phy_map[i]) mdiobus_register() 292 device_unregister(&bus->phy_map[i]->dev); mdiobus_register() 294 device_del(&bus->dev); mdiobus_register() 299 void mdiobus_unregister(struct mii_bus *bus) mdiobus_unregister() argument 303 BUG_ON(bus->state != MDIOBUS_REGISTERED); mdiobus_unregister() 304 bus->state = MDIOBUS_UNREGISTERED; mdiobus_unregister() 306 device_del(&bus->dev); mdiobus_unregister() 308 if (bus->phy_map[i]) mdiobus_unregister() 309 device_unregister(&bus->phy_map[i]->dev); mdiobus_unregister() 310 bus->phy_map[i] = NULL; mdiobus_unregister() 317 * @bus: mii_bus to free 323 void mdiobus_free(struct mii_bus *bus) mdiobus_free() argument 326 if (bus->state == MDIOBUS_ALLOCATED) { mdiobus_free() 327 kfree(bus); mdiobus_free() 331 BUG_ON(bus->state != MDIOBUS_UNREGISTERED); mdiobus_free() 332 bus->state = MDIOBUS_RELEASED; mdiobus_free() 334 put_device(&bus->dev); mdiobus_free() 338 struct phy_device *mdiobus_scan(struct mii_bus *bus, int addr) mdiobus_scan() argument 343 phydev = get_phy_device(bus, addr, false); mdiobus_scan() 349 * in the bus node, and set the of_node pointer in this case. mdiobus_scan() 351 of_mdiobus_link_phydev(bus, phydev); mdiobus_scan() 365 * @bus: the mii_bus struct 370 * because the bus read/write functions may wait for an interrupt 373 int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum) mdiobus_read() argument 379 mutex_lock(&bus->mdio_lock); mdiobus_read() 380 retval = bus->read(bus, addr, regnum); mdiobus_read() 381 mutex_unlock(&bus->mdio_lock); mdiobus_read() 389 * @bus: the mii_bus struct 395 * because the bus read/write functions may wait for an interrupt 398 int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val) mdiobus_write() argument 404 mutex_lock(&bus->mdio_lock); mdiobus_write() 405 err = bus->write(bus, addr, regnum, val); mdiobus_write() 406 mutex_unlock(&bus->mdio_lock); mdiobus_write() 449 * MDIO bus driver and clock gated at this point. mdio_bus_phy_may_suspend() 461 * is the case for devices w/o underlaying pwr. mgmt. aware bus, mdio_bus_phy_may_suspend()
|
H A D | mdio-moxart.c | 37 static int moxart_mdio_read(struct mii_bus *bus, int mii_id, int regnum) moxart_mdio_read() argument 39 struct moxart_mdio_data *data = bus->priv; moxart_mdio_read() 43 dev_dbg(&bus->dev, "%s\n", __func__); moxart_mdio_read() 60 dev_dbg(&bus->dev, "%s timed out\n", __func__); moxart_mdio_read() 65 static int moxart_mdio_write(struct mii_bus *bus, int mii_id, moxart_mdio_write() argument 68 struct moxart_mdio_data *data = bus->priv; moxart_mdio_write() 72 dev_dbg(&bus->dev, "%s\n", __func__); moxart_mdio_write() 92 dev_dbg(&bus->dev, "%s timed out\n", __func__); moxart_mdio_write() 97 static int moxart_mdio_reset(struct mii_bus *bus) moxart_mdio_reset() argument 102 data = moxart_mdio_read(bus, i, MII_BMCR); moxart_mdio_reset() 107 if (moxart_mdio_write(bus, i, MII_BMCR, data) < 0) moxart_mdio_reset() 117 struct mii_bus *bus; moxart_mdio_probe() local 122 bus = mdiobus_alloc_size(sizeof(*data)); moxart_mdio_probe() 123 if (!bus) moxart_mdio_probe() 126 bus->name = "MOXA ART Ethernet MII"; moxart_mdio_probe() 127 bus->read = &moxart_mdio_read; moxart_mdio_probe() 128 bus->write = &moxart_mdio_write; moxart_mdio_probe() 129 bus->reset = &moxart_mdio_reset; moxart_mdio_probe() 130 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-%d-mii", pdev->name, pdev->id); moxart_mdio_probe() 131 bus->parent = &pdev->dev; moxart_mdio_probe() 133 bus->irq = devm_kzalloc(&pdev->dev, sizeof(int) * PHY_MAX_ADDR, moxart_mdio_probe() 135 if (!bus->irq) { moxart_mdio_probe() 148 bus->irq[i] = PHY_IGNORE_INTERRUPT; moxart_mdio_probe() 150 data = bus->priv; moxart_mdio_probe() 158 ret = of_mdiobus_register(bus, np); moxart_mdio_probe() 162 platform_set_drvdata(pdev, bus); moxart_mdio_probe() 167 mdiobus_free(bus); moxart_mdio_probe() 173 struct mii_bus *bus = platform_get_drvdata(pdev); moxart_mdio_remove() local 175 mdiobus_unregister(bus); moxart_mdio_remove() 176 mdiobus_free(bus); moxart_mdio_remove()
|
H A D | mdio-bcm-unimac.c | 2 * Broadcom UniMAC MDIO bus controller driver 60 static int unimac_mdio_read(struct mii_bus *bus, int phy_id, int reg) unimac_mdio_read() argument 62 struct unimac_mdio_priv *priv = bus->priv; unimac_mdio_read() 90 static int unimac_mdio_write(struct mii_bus *bus, int phy_id, unimac_mdio_write() argument 93 struct unimac_mdio_priv *priv = bus->priv; unimac_mdio_write() 121 struct mii_bus *bus; unimac_mdio_probe() local 146 bus = priv->mii_bus; unimac_mdio_probe() 147 bus->priv = priv; unimac_mdio_probe() 148 bus->name = "unimac MII bus"; unimac_mdio_probe() 149 bus->parent = &pdev->dev; unimac_mdio_probe() 150 bus->read = unimac_mdio_read; unimac_mdio_probe() 151 bus->write = unimac_mdio_write; unimac_mdio_probe() 152 snprintf(bus->id, MII_BUS_ID_SIZE, "%s", pdev->name); unimac_mdio_probe() 154 bus->irq = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL); unimac_mdio_probe() 155 if (!bus->irq) { unimac_mdio_probe() 160 ret = of_mdiobus_register(bus, np); unimac_mdio_probe() 162 dev_err(&pdev->dev, "MDIO bus registration failed\n"); unimac_mdio_probe() 168 dev_info(&pdev->dev, "Broadcom UniMAC MDIO bus at 0x%p\n", priv->base); unimac_mdio_probe() 173 kfree(bus->irq); unimac_mdio_probe() 175 mdiobus_free(bus); unimac_mdio_probe() 210 MODULE_DESCRIPTION("Broadcom UniMAC MDIO bus controller");
|
H A D | mdio-sun4i.c | 39 static int sun4i_mdio_read(struct mii_bus *bus, int mii_id, int regnum) sun4i_mdio_read() argument 41 struct sun4i_mdio_data *data = bus->priv; sun4i_mdio_read() 66 static int sun4i_mdio_write(struct mii_bus *bus, int mii_id, int regnum, sun4i_mdio_write() argument 69 struct sun4i_mdio_data *data = bus->priv; sun4i_mdio_write() 96 struct mii_bus *bus; sun4i_mdio_probe() local 101 bus = mdiobus_alloc_size(sizeof(*data)); sun4i_mdio_probe() 102 if (!bus) sun4i_mdio_probe() 105 bus->name = "sun4i_mii_bus"; sun4i_mdio_probe() 106 bus->read = &sun4i_mdio_read; sun4i_mdio_probe() 107 bus->write = &sun4i_mdio_write; sun4i_mdio_probe() 108 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", dev_name(&pdev->dev)); sun4i_mdio_probe() 109 bus->parent = &pdev->dev; sun4i_mdio_probe() 111 bus->irq = devm_kzalloc(&pdev->dev, sizeof(int) * PHY_MAX_ADDR, sun4i_mdio_probe() 113 if (!bus->irq) { sun4i_mdio_probe() 119 bus->irq[i] = PHY_POLL; sun4i_mdio_probe() 121 data = bus->priv; sun4i_mdio_probe() 141 ret = of_mdiobus_register(bus, np); sun4i_mdio_probe() 145 platform_set_drvdata(pdev, bus); sun4i_mdio_probe() 152 mdiobus_free(bus); sun4i_mdio_probe() 158 struct mii_bus *bus = platform_get_drvdata(pdev); sun4i_mdio_remove() local 160 mdiobus_unregister(bus); sun4i_mdio_remove() 161 mdiobus_free(bus); sun4i_mdio_remove()
|
H A D | mdio-bitbang.c | 135 can exist on the same bus. Normal devices should ignore the MDIO_ADDR 155 static int mdiobb_read(struct mii_bus *bus, int phy, int reg) mdiobb_read() argument 157 struct mdiobb_ctrl *ctrl = bus->priv; mdiobb_read() 184 static int mdiobb_write(struct mii_bus *bus, int phy, int reg, u16 val) mdiobb_write() argument 186 struct mdiobb_ctrl *ctrl = bus->priv; mdiobb_write() 205 static int mdiobb_reset(struct mii_bus *bus) mdiobb_reset() argument 207 struct mdiobb_ctrl *ctrl = bus->priv; mdiobb_reset() 209 ctrl->reset(bus); mdiobb_reset() 215 struct mii_bus *bus; alloc_mdio_bitbang() local 217 bus = mdiobus_alloc(); alloc_mdio_bitbang() 218 if (!bus) alloc_mdio_bitbang() 223 bus->read = mdiobb_read; alloc_mdio_bitbang() 224 bus->write = mdiobb_write; alloc_mdio_bitbang() 225 bus->reset = mdiobb_reset; alloc_mdio_bitbang() 226 bus->priv = ctrl; alloc_mdio_bitbang() 228 return bus; alloc_mdio_bitbang() 232 void free_mdio_bitbang(struct mii_bus *bus) free_mdio_bitbang() argument 234 struct mdiobb_ctrl *ctrl = bus->priv; free_mdio_bitbang() 237 mdiobus_free(bus); free_mdio_bitbang()
|
/linux-4.1.27/drivers/media/pci/cx23885/ |
H A D | cx23885-i2c.c | 34 MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); 49 struct cx23885_i2c *bus = i2c_adap->algo_data; i2c_slave_did_ack() local 50 struct cx23885_dev *dev = bus->dev; i2c_slave_did_ack() 51 return cx_read(bus->reg_stat) & 0x01; i2c_slave_did_ack() 56 struct cx23885_i2c *bus = i2c_adap->algo_data; i2c_is_busy() local 57 struct cx23885_dev *dev = bus->dev; i2c_is_busy() 58 return cx_read(bus->reg_stat) & 0x02 ? 1 : 0; i2c_is_busy() 80 struct cx23885_i2c *bus = i2c_adap->algo_data; i2c_sendbytes() local 81 struct cx23885_dev *dev = bus->dev; i2c_sendbytes() 93 cx_write(bus->reg_addr, msg->addr << 25); i2c_sendbytes() 94 cx_write(bus->reg_ctrl, bus->i2c_period | (1 << 2)); i2c_sendbytes() 108 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); i2c_sendbytes() 115 cx_write(bus->reg_addr, addr); i2c_sendbytes() 116 cx_write(bus->reg_wdata, wdata); i2c_sendbytes() 117 cx_write(bus->reg_ctrl, ctrl); i2c_sendbytes() 130 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); i2c_sendbytes() 137 cx_write(bus->reg_addr, addr); i2c_sendbytes() 138 cx_write(bus->reg_wdata, wdata); i2c_sendbytes() 139 cx_write(bus->reg_ctrl, ctrl); i2c_sendbytes() 161 struct cx23885_i2c *bus = i2c_adap->algo_data; i2c_readbytes() local 162 struct cx23885_dev *dev = bus->dev; i2c_readbytes() 172 cx_write(bus->reg_addr, msg->addr << 25); i2c_readbytes() 173 cx_write(bus->reg_ctrl, bus->i2c_period | (1 << 2) | 1); i2c_readbytes() 193 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; i2c_readbytes() 198 cx_write(bus->reg_addr, msg->addr << 25); i2c_readbytes() 199 cx_write(bus->reg_ctrl, ctrl); i2c_readbytes() 203 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; i2c_readbytes() 222 struct cx23885_i2c *bus = i2c_adap->algo_data; i2c_xfer() local 223 struct cx23885_dev *dev = bus->dev; i2c_xfer() 309 int cx23885_i2c_register(struct cx23885_i2c *bus) cx23885_i2c_register() argument 311 struct cx23885_dev *dev = bus->dev; cx23885_i2c_register() 313 dprintk(1, "%s(bus = %d)\n", __func__, bus->nr); cx23885_i2c_register() 315 bus->i2c_adap = cx23885_i2c_adap_template; cx23885_i2c_register() 316 bus->i2c_client = cx23885_i2c_client_template; cx23885_i2c_register() 317 bus->i2c_adap.dev.parent = &dev->pci->dev; cx23885_i2c_register() 319 strlcpy(bus->i2c_adap.name, bus->dev->name, cx23885_i2c_register() 320 sizeof(bus->i2c_adap.name)); cx23885_i2c_register() 322 bus->i2c_adap.algo_data = bus; cx23885_i2c_register() 323 i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev); cx23885_i2c_register() 324 i2c_add_adapter(&bus->i2c_adap); cx23885_i2c_register() 326 bus->i2c_client.adapter = &bus->i2c_adap; cx23885_i2c_register() 328 if (0 == bus->i2c_rc) { cx23885_i2c_register() 329 dprintk(1, "%s: i2c bus %d registered\n", dev->name, bus->nr); cx23885_i2c_register() 331 printk(KERN_INFO "%s: scan bus %d:\n", cx23885_i2c_register() 332 dev->name, bus->nr); cx23885_i2c_register() 333 do_i2c_scan(dev->name, &bus->i2c_client); cx23885_i2c_register() 336 printk(KERN_WARNING "%s: i2c bus %d register FAILED\n", cx23885_i2c_register() 337 dev->name, bus->nr); cx23885_i2c_register() 340 if (0 == bus->i2c_rc) { cx23885_i2c_register() 350 i2c_new_probed_device(&bus->i2c_adap, &info, addr_list, cx23885_i2c_register() 354 return bus->i2c_rc; cx23885_i2c_register() 357 int cx23885_i2c_unregister(struct cx23885_i2c *bus) cx23885_i2c_unregister() argument 359 i2c_del_adapter(&bus->i2c_adap); cx23885_i2c_unregister() 365 /* write 0 to bus 2 addr 0x144 via i2x_xfer() */ cx23885_av_clk()
|
/linux-4.1.27/drivers/media/pci/saa7164/ |
H A D | saa7164-i2c.c | 32 struct saa7164_i2c *bus = i2c_adap->algo_data; i2c_xfer() local 33 struct saa7164_dev *dev = bus->dev; i2c_xfer() 49 retval = saa7164_api_i2c_read(bus, msgs[i].addr, i2c_xfer() 60 retval = saa7164_api_i2c_write(bus, msgs[i].addr, i2c_xfer() 94 int saa7164_i2c_register(struct saa7164_i2c *bus) saa7164_i2c_register() argument 96 struct saa7164_dev *dev = bus->dev; saa7164_i2c_register() 98 dprintk(DBGLVL_I2C, "%s(bus = %d)\n", __func__, bus->nr); saa7164_i2c_register() 100 bus->i2c_adap = saa7164_i2c_adap_template; saa7164_i2c_register() 101 bus->i2c_client = saa7164_i2c_client_template; saa7164_i2c_register() 103 bus->i2c_adap.dev.parent = &dev->pci->dev; saa7164_i2c_register() 105 strlcpy(bus->i2c_adap.name, bus->dev->name, saa7164_i2c_register() 106 sizeof(bus->i2c_adap.name)); saa7164_i2c_register() 108 bus->i2c_adap.algo_data = bus; saa7164_i2c_register() 109 i2c_set_adapdata(&bus->i2c_adap, bus); saa7164_i2c_register() 110 i2c_add_adapter(&bus->i2c_adap); saa7164_i2c_register() 112 bus->i2c_client.adapter = &bus->i2c_adap; saa7164_i2c_register() 114 if (0 != bus->i2c_rc) saa7164_i2c_register() 115 printk(KERN_ERR "%s: i2c bus %d register FAILED\n", saa7164_i2c_register() 116 dev->name, bus->nr); saa7164_i2c_register() 118 return bus->i2c_rc; saa7164_i2c_register() 121 int saa7164_i2c_unregister(struct saa7164_i2c *bus) saa7164_i2c_unregister() argument 123 i2c_del_adapter(&bus->i2c_adap); saa7164_i2c_unregister()
|
H A D | saa7164-bus.c | 24 /* The message bus to/from the firmware is a ring buffer in PCI address 29 struct tmComResBusInfo *b = &dev->bus; saa7164_bus_setup() 58 struct tmComResBusInfo *b = &dev->bus; saa7164_bus_dump() 60 dprintk(DBGLVL_BUS, "Dumping the bus structure:\n"); saa7164_bus_dump() 83 /* Intensionally throw a BUG() if the state of the message bus looks corrupt */ saa7164_bus_verify() 86 struct tmComResBusInfo *b = &dev->bus; saa7164_bus_verify() 102 saa_debug = 0xffff; /* Ensure we get the bus dump */ saa7164_bus_verify() 104 saa_debug = 1024; /* Ensure we get the bus dump */ saa7164_bus_verify() 124 * Places a command or a response on the bus. The implementation does not 126 * bus depending on the bus information given in the struct tmComResBusInfo 127 * structure. If the command or response does not fit into the bus ring 137 struct tmComResBusInfo *bus = &dev->bus; saa7164_bus_set() local 152 if (msg->size > dev->bus.m_wMaxReqSize) { saa7164_bus_set() 153 printk(KERN_ERR "%s() Exceeded dev->bus.m_wMaxReqSize\n", saa7164_bus_set() 163 /* Lock the bus from any other access */ saa7164_bus_set() 164 mutex_lock(&bus->lock); saa7164_bus_set() 169 curr_srp = saa7164_readl(bus->m_dwSetReadPos); saa7164_bus_set() 170 curr_swp = saa7164_readl(bus->m_dwSetWritePos); saa7164_bus_set() 178 free_write_space = (curr_srp + bus->m_dwSizeSetRing) - curr_swp; saa7164_bus_set() 189 /* Process the msg and write the content onto the bus */ saa7164_bus_set() 193 printk(KERN_ERR "%s() bus timeout\n", __func__); saa7164_bus_set() 203 curr_srp = saa7164_readl(bus->m_dwSetReadPos); saa7164_bus_set() 211 free_write_space = (curr_srp + bus->m_dwSizeSetRing) - saa7164_bus_set() 220 dprintk(DBGLVL_BUS, "%s() bus->m_dwSizeSetRing = %x\n", __func__, saa7164_bus_set() 221 bus->m_dwSizeSetRing); saa7164_bus_set() 236 if (new_swp > bus->m_dwSizeSetRing) { saa7164_bus_set() 239 new_swp -= bus->m_dwSizeSetRing; saa7164_bus_set() 241 space_rem = bus->m_dwSizeSetRing - curr_swp; saa7164_bus_set() 253 memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, space_rem); saa7164_bus_set() 254 memcpy_toio(bus->m_pdwSetRing, (u8 *)msg + space_rem, saa7164_bus_set() 257 memcpy_toio(bus->m_pdwSetRing + sizeof(*msg) - space_rem, saa7164_bus_set() 264 memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg)); saa7164_bus_set() 265 memcpy_toio(bus->m_pdwSetRing, buf, size); saa7164_bus_set() 269 memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg)); saa7164_bus_set() 271 memcpy_toio(bus->m_pdwSetRing + curr_swp + saa7164_bus_set() 274 memcpy_toio(bus->m_pdwSetRing, (u8 *)buf + saa7164_bus_set() 281 } /* (new_swp > bus->m_dwSizeSetRing) */ saa7164_bus_set() 286 memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg)); saa7164_bus_set() 287 memcpy_toio(bus->m_pdwSetRing + curr_swp + sizeof(*msg), buf, saa7164_bus_set() 293 /* Update the bus write position */ saa7164_bus_set() 294 saa7164_writel(bus->m_dwSetWritePos, new_swp); saa7164_bus_set() 304 mutex_unlock(&bus->lock); saa7164_bus_set() 310 * Receive a command or a response from the bus. The implementation does not 312 * depending on the bus information given in the struct tmComResBusInfo 322 struct tmComResBusInfo *bus = &dev->bus; saa7164_bus_get() local 333 if (msg->size > dev->bus.m_wMaxReqSize) { saa7164_bus_get() 334 printk(KERN_ERR "%s() Exceeded dev->bus.m_wMaxReqSize\n", saa7164_bus_get() 346 mutex_lock(&bus->lock); saa7164_bus_get() 348 /* Peek the bus to see if a msg exists, if it's not what we're expecting saa7164_bus_get() 349 * then return cleanly else read the message from the bus. saa7164_bus_get() 351 curr_gwp = saa7164_readl(bus->m_dwGetWritePos); saa7164_bus_get() 352 curr_grp = saa7164_readl(bus->m_dwGetReadPos); saa7164_bus_get() 368 write_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp; saa7164_bus_get() 378 if (new_grp > bus->m_dwSizeGetRing) { saa7164_bus_get() 381 new_grp -= bus->m_dwSizeGetRing; saa7164_bus_get() 382 space_rem = bus->m_dwSizeGetRing - curr_grp; saa7164_bus_get() 384 memcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem); saa7164_bus_get() 385 memcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing, saa7164_bus_get() 390 memcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read); saa7164_bus_get() 416 /* Get the actual command and response from the bus */ saa7164_bus_get() 427 write_distance = curr_gwp + bus->m_dwSizeGetRing - curr_grp; saa7164_bus_get() 430 printk(KERN_ERR "%s() Invalid bus state, missing msg " saa7164_bus_get() 438 if (new_grp > bus->m_dwSizeGetRing) { saa7164_bus_get() 441 new_grp -= bus->m_dwSizeGetRing; saa7164_bus_get() 442 space_rem = bus->m_dwSizeGetRing - curr_grp; saa7164_bus_get() 446 memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, space_rem); saa7164_bus_get() 447 memcpy_fromio((u8 *)msg + space_rem, bus->m_pdwGetRing, saa7164_bus_get() 450 memcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) - saa7164_bus_get() 454 memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg)); saa7164_bus_get() 456 memcpy_fromio(buf, bus->m_pdwGetRing, buf_size); saa7164_bus_get() 459 memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg)); saa7164_bus_get() 461 memcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + saa7164_bus_get() 464 bus->m_pdwGetRing, bytes_to_read - saa7164_bus_get() 472 memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg)); saa7164_bus_get() 474 memcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg), saa7164_bus_get() 483 saa7164_writel(bus->m_dwGetReadPos, new_grp); saa7164_bus_get() 488 mutex_unlock(&bus->lock); saa7164_bus_get()
|
/linux-4.1.27/drivers/net/wireless/brcm80211/brcmfmac/ |
H A D | sdio.c | 100 #include "bus.h" 136 * sdio bus power cycle to clear (rev 9) */ 383 /* dongle SDIO bus specific header info */ 430 /* Private data for SDIO bus interaction */ 488 s32 idleclock; /* How to set bus driver when idle */ 498 spinlock_t txq_lock; /* protect bus->txq */ 518 u8 tx_hdrlen; /* sdio bus header length for tx packet */ 734 static bool data_ok(struct brcmf_sdio *bus) data_ok() argument 736 return (u8)(bus->tx_max - bus->tx_seq) != 0 && data_ok() 737 ((u8)(bus->tx_max - bus->tx_seq) & 0x80) == 0; data_ok() 742 * adresses on the 32 bit backplane bus. 744 static int r_sdreg32(struct brcmf_sdio *bus, u32 *regvar, u32 offset) r_sdreg32() argument 749 core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); r_sdreg32() 750 *regvar = brcmf_sdiod_regrl(bus->sdiodev, core->base + offset, &ret); r_sdreg32() 755 static int w_sdreg32(struct brcmf_sdio *bus, u32 regval, u32 reg_offset) w_sdreg32() argument 760 core = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); w_sdreg32() 761 brcmf_sdiod_regwl(bus->sdiodev, core->base + reg_offset, regval, &ret); w_sdreg32() 767 brcmf_sdio_kso_control(struct brcmf_sdio *bus, bool on) brcmf_sdio_kso_control() argument 777 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, brcmf_sdio_kso_control() 804 rd_val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, brcmf_sdio_kso_control() 810 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, brcmf_sdio_kso_control() 827 static int brcmf_sdio_htclk(struct brcmf_sdio *bus, bool on, bool pendok) brcmf_sdio_htclk() argument 837 if (bus->sr_enabled) { brcmf_sdio_htclk() 838 bus->clkstate = (on ? CLK_AVAIL : CLK_SDONLY); brcmf_sdio_htclk() 845 bus->alp_only ? SBSDIO_ALP_AVAIL_REQ : SBSDIO_HT_AVAIL_REQ; brcmf_sdio_htclk() 847 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdio_htclk() 855 clkctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_htclk() 863 if (!SBSDIO_CLKAV(clkctl, bus->alp_only) && pendok) { brcmf_sdio_htclk() 865 devctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_htclk() 874 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, brcmf_sdio_htclk() 877 bus->clkstate = CLK_PENDING; brcmf_sdio_htclk() 880 } else if (bus->clkstate == CLK_PENDING) { brcmf_sdio_htclk() 882 devctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_htclk() 885 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, brcmf_sdio_htclk() 892 while (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { brcmf_sdio_htclk() 893 clkctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_htclk() 905 if (!SBSDIO_CLKAV(clkctl, bus->alp_only)) { brcmf_sdio_htclk() 912 bus->clkstate = CLK_AVAIL; brcmf_sdio_htclk() 916 if (!bus->alp_only) { brcmf_sdio_htclk() 925 if (bus->clkstate == CLK_PENDING) { brcmf_sdio_htclk() 927 devctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_htclk() 930 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, brcmf_sdio_htclk() 934 bus->clkstate = CLK_SDONLY; brcmf_sdio_htclk() 935 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdio_htclk() 948 static int brcmf_sdio_sdclk(struct brcmf_sdio *bus, bool on) brcmf_sdio_sdclk() argument 953 bus->clkstate = CLK_SDONLY; brcmf_sdio_sdclk() 955 bus->clkstate = CLK_NONE; brcmf_sdio_sdclk() 961 static int brcmf_sdio_clkctl(struct brcmf_sdio *bus, uint target, bool pendok) brcmf_sdio_clkctl() argument 964 uint oldstate = bus->clkstate; brcmf_sdio_clkctl() 970 if (bus->clkstate == target) brcmf_sdio_clkctl() 976 if (bus->clkstate == CLK_NONE) brcmf_sdio_clkctl() 977 brcmf_sdio_sdclk(bus, true); brcmf_sdio_clkctl() 979 brcmf_sdio_htclk(bus, true, pendok); brcmf_sdio_clkctl() 984 if (bus->clkstate == CLK_NONE) brcmf_sdio_clkctl() 985 brcmf_sdio_sdclk(bus, true); brcmf_sdio_clkctl() 986 else if (bus->clkstate == CLK_AVAIL) brcmf_sdio_clkctl() 987 brcmf_sdio_htclk(bus, false, false); brcmf_sdio_clkctl() 990 bus->clkstate, target); brcmf_sdio_clkctl() 995 if (bus->clkstate == CLK_AVAIL) brcmf_sdio_clkctl() 996 brcmf_sdio_htclk(bus, false, false); brcmf_sdio_clkctl() 998 brcmf_sdio_sdclk(bus, false); brcmf_sdio_clkctl() 1002 brcmf_dbg(SDIO, "%d -> %d\n", oldstate, bus->clkstate); brcmf_sdio_clkctl() 1009 brcmf_sdio_bus_sleep(struct brcmf_sdio *bus, bool sleep, bool pendok) brcmf_sdio_bus_sleep() argument 1016 (bus->sleeping ? "SLEEP" : "WAKE")); brcmf_sdio_bus_sleep() 1018 /* If SR is enabled control bus state with KSO */ brcmf_sdio_bus_sleep() 1019 if (bus->sr_enabled) { brcmf_sdio_bus_sleep() 1021 if (sleep == bus->sleeping) brcmf_sdio_bus_sleep() 1026 clkcsr = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_bus_sleep() 1031 brcmf_sdiod_regwb(bus->sdiodev, brcmf_sdio_bus_sleep() 1035 err = brcmf_sdio_kso_control(bus, false); brcmf_sdio_bus_sleep() 1037 err = brcmf_sdio_kso_control(bus, true); brcmf_sdio_bus_sleep() 1040 brcmf_err("error while changing bus sleep state %d\n", brcmf_sdio_bus_sleep() 1049 if (!bus->sr_enabled) brcmf_sdio_bus_sleep() 1050 brcmf_sdio_clkctl(bus, CLK_NONE, pendok); brcmf_sdio_bus_sleep() 1052 brcmf_sdio_clkctl(bus, CLK_AVAIL, pendok); brcmf_sdio_bus_sleep() 1053 brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_bus_sleep() 1055 bus->sleeping = sleep; brcmf_sdio_bus_sleep() 1070 static int brcmf_sdio_readshared(struct brcmf_sdio *bus, brcmf_sdio_readshared() argument 1079 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readshared() 1080 brcmf_sdio_bus_sleep(bus, false, false); brcmf_sdio_readshared() 1086 shaddr = bus->ci->rambase + bus->ci->ramsize - 4; brcmf_sdio_readshared() 1087 if (!bus->ci->rambase && brcmf_chip_sr_capable(bus->ci)) brcmf_sdio_readshared() 1088 shaddr -= bus->ci->srsize; brcmf_sdio_readshared() 1089 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, shaddr, brcmf_sdio_readshared() 1108 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&sh_le, brcmf_sdio_readshared() 1113 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readshared() 1135 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readshared() 1139 static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus) brcmf_sdio_get_console_addr() argument 1143 if (brcmf_sdio_readshared(bus, &sh) == 0) brcmf_sdio_get_console_addr() 1144 bus->console_addr = sh.console_addr; brcmf_sdio_get_console_addr() 1147 static void brcmf_sdio_get_console_addr(struct brcmf_sdio *bus) brcmf_sdio_get_console_addr() argument 1152 static u32 brcmf_sdio_hostmail(struct brcmf_sdio *bus) brcmf_sdio_hostmail() argument 1162 ret = r_sdreg32(bus, &hmb_data, brcmf_sdio_hostmail() 1166 w_sdreg32(bus, SMB_INT_ACK, brcmf_sdio_hostmail() 1168 bus->sdcnt.f1regdata += 2; brcmf_sdio_hostmail() 1173 bus->rx_seq); brcmf_sdio_hostmail() 1174 if (!bus->rxskip) brcmf_sdio_hostmail() 1177 bus->rxskip = false; brcmf_sdio_hostmail() 1185 bus->sdpcm_ver = brcmf_sdio_hostmail() 1188 if (bus->sdpcm_ver != SDPCM_PROT_VERSION) brcmf_sdio_hostmail() 1191 bus->sdpcm_ver, SDPCM_PROT_VERSION); brcmf_sdio_hostmail() 1194 bus->sdpcm_ver); brcmf_sdio_hostmail() 1200 brcmf_sdio_get_console_addr(bus); brcmf_sdio_hostmail() 1212 if (fcbits & ~bus->flowcontrol) brcmf_sdio_hostmail() 1213 bus->sdcnt.fc_xoff++; brcmf_sdio_hostmail() 1215 if (bus->flowcontrol & ~fcbits) brcmf_sdio_hostmail() 1216 bus->sdcnt.fc_xon++; brcmf_sdio_hostmail() 1218 bus->sdcnt.fc_rcvd++; brcmf_sdio_hostmail() 1219 bus->flowcontrol = fcbits; brcmf_sdio_hostmail() 1234 static void brcmf_sdio_rxfail(struct brcmf_sdio *bus, bool abort, bool rtx) brcmf_sdio_rxfail() argument 1246 brcmf_sdiod_abort(bus->sdiodev, SDIO_FUNC_2); brcmf_sdio_rxfail() 1248 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_FRAMECTRL, brcmf_sdio_rxfail() 1250 bus->sdcnt.f1regdata++; brcmf_sdio_rxfail() 1254 hi = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_rxfail() 1256 lo = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_rxfail() 1258 bus->sdcnt.f1regdata += 2; brcmf_sdio_rxfail() 1276 bus->sdcnt.rxrtx++; brcmf_sdio_rxfail() 1277 err = w_sdreg32(bus, SMB_NAK, brcmf_sdio_rxfail() 1280 bus->sdcnt.f1regdata++; brcmf_sdio_rxfail() 1282 bus->rxskip = true; brcmf_sdio_rxfail() 1286 bus->cur_read.len = 0; brcmf_sdio_rxfail() 1289 static void brcmf_sdio_txfail(struct brcmf_sdio *bus) brcmf_sdio_txfail() argument 1291 struct brcmf_sdio_dev *sdiodev = bus->sdiodev; brcmf_sdio_txfail() 1296 bus->sdcnt.tx_sderrs++; brcmf_sdio_txfail() 1300 bus->sdcnt.f1regdata++; brcmf_sdio_txfail() 1305 bus->sdcnt.f1regdata += 2; brcmf_sdio_txfail() 1312 static uint brcmf_sdio_glom_len(struct brcmf_sdio *bus) brcmf_sdio_glom_len() argument 1318 skb_queue_walk(&bus->glom, p) brcmf_sdio_glom_len() 1323 static void brcmf_sdio_free_glom(struct brcmf_sdio *bus) brcmf_sdio_free_glom() argument 1327 skb_queue_walk_safe(&bus->glom, cur, next) { brcmf_sdio_free_glom() 1328 skb_unlink(cur, &bus->glom); brcmf_sdio_free_glom() 1334 * brcmfmac sdio bus specific header 1390 static int brcmf_sdio_hdparse(struct brcmf_sdio *bus, u8 *header, brcmf_sdio_hdparse() argument 1405 bus->rxpending = false; brcmf_sdio_hdparse() 1410 bus->sdcnt.rx_badhdr++; brcmf_sdio_hdparse() 1411 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_hdparse() 1419 (roundup(len, bus->blocksize) != rd->len)) { brcmf_sdio_hdparse() 1442 bus->sdcnt.rx_toolong++; brcmf_sdio_hdparse() 1443 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_hdparse() 1461 bus->sdcnt.rx_badhdr++; brcmf_sdio_hdparse() 1462 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_hdparse() 1469 bus->sdcnt.rx_badseq++; brcmf_sdio_hdparse() 1484 if (bus->flowcontrol != fc) { brcmf_sdio_hdparse() 1485 if (~bus->flowcontrol & fc) brcmf_sdio_hdparse() 1486 bus->sdcnt.fc_xoff++; brcmf_sdio_hdparse() 1487 if (bus->flowcontrol & ~fc) brcmf_sdio_hdparse() 1488 bus->sdcnt.fc_xon++; brcmf_sdio_hdparse() 1489 bus->sdcnt.fc_rcvd++; brcmf_sdio_hdparse() 1490 bus->flowcontrol = fc; brcmf_sdio_hdparse() 1493 if ((u8)(tx_seq_max - bus->tx_seq) > 0x40) { brcmf_sdio_hdparse() 1495 tx_seq_max = bus->tx_seq + 2; brcmf_sdio_hdparse() 1497 bus->tx_max = tx_seq_max; brcmf_sdio_hdparse() 1508 static void brcmf_sdio_hdpack(struct brcmf_sdio *bus, u8 *header, brcmf_sdio_hdpack() argument 1517 if (bus->txglom) { brcmf_sdio_hdpack() 1532 trace_brcmf_sdpcm_hdr(SDPCM_TX + !!(bus->txglom), header); brcmf_sdio_hdpack() 1535 static u8 brcmf_sdio_rxglom(struct brcmf_sdio *bus, u8 rxseq) brcmf_sdio_rxglom() argument 1551 bus->glomd, skb_peek(&bus->glom)); brcmf_sdio_rxglom() 1554 if (bus->glomd) { brcmf_sdio_rxglom() 1556 dlen = (u16) (bus->glomd->len); brcmf_sdio_rxglom() 1557 dptr = bus->glomd->data; brcmf_sdio_rxglom() 1576 if (sublen % bus->sgentry_align) { brcmf_sdio_rxglom() 1578 sublen, bus->sgentry_align); brcmf_sdio_rxglom() 1586 (roundup(totlen, bus->blocksize) - totlen); brcmf_sdio_rxglom() 1587 totlen = roundup(totlen, bus->blocksize); brcmf_sdio_rxglom() 1591 pnext = brcmu_pkt_buf_get_skb(sublen + bus->sgentry_align); brcmf_sdio_rxglom() 1597 skb_queue_tail(&bus->glom, pnext); brcmf_sdio_rxglom() 1600 pkt_align(pnext, sublen, bus->sgentry_align); brcmf_sdio_rxglom() 1604 in bus structure */ brcmf_sdio_rxglom() 1608 if (BRCMF_GLOM_ON() && bus->cur_read.len && brcmf_sdio_rxglom() 1609 totlen != bus->cur_read.len) { brcmf_sdio_rxglom() 1611 bus->cur_read.len, totlen, rxseq); brcmf_sdio_rxglom() 1615 brcmf_sdio_free_glom(bus); brcmf_sdio_rxglom() 1620 brcmu_pkt_buf_free_skb(bus->glomd); brcmf_sdio_rxglom() 1621 bus->glomd = NULL; brcmf_sdio_rxglom() 1622 bus->cur_read.len = 0; brcmf_sdio_rxglom() 1627 if (!skb_queue_empty(&bus->glom)) { brcmf_sdio_rxglom() 1630 skb_queue_walk(&bus->glom, pnext) { brcmf_sdio_rxglom() 1637 pfirst = skb_peek(&bus->glom); brcmf_sdio_rxglom() 1638 dlen = (u16) brcmf_sdio_glom_len(bus); brcmf_sdio_rxglom() 1644 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1645 errcode = brcmf_sdiod_recv_chain(bus->sdiodev, brcmf_sdio_rxglom() 1646 &bus->glom, dlen); brcmf_sdio_rxglom() 1647 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1648 bus->sdcnt.f2rxdata++; brcmf_sdio_rxglom() 1655 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1656 if (bus->glomerr++ < 3) { brcmf_sdio_rxglom() 1657 brcmf_sdio_rxfail(bus, true, true); brcmf_sdio_rxglom() 1659 bus->glomerr = 0; brcmf_sdio_rxglom() 1660 brcmf_sdio_rxfail(bus, true, false); brcmf_sdio_rxglom() 1661 bus->sdcnt.rxglomfail++; brcmf_sdio_rxglom() 1662 brcmf_sdio_free_glom(bus); brcmf_sdio_rxglom() 1664 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1674 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1675 errcode = brcmf_sdio_hdparse(bus, pfirst->data, &rd_new, brcmf_sdio_rxglom() 1677 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1678 bus->cur_read.len = rd_new.len_nxtfrm << 4; brcmf_sdio_rxglom() 1686 skb_queue_walk(&bus->glom, pnext) { brcmf_sdio_rxglom() 1693 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1694 errcode = brcmf_sdio_hdparse(bus, pnext->data, &rd_new, brcmf_sdio_rxglom() 1696 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1706 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1707 if (bus->glomerr++ < 3) { brcmf_sdio_rxglom() 1710 brcmf_sdio_rxfail(bus, true, true); brcmf_sdio_rxglom() 1712 bus->glomerr = 0; brcmf_sdio_rxglom() 1713 brcmf_sdio_rxfail(bus, true, false); brcmf_sdio_rxglom() 1714 bus->sdcnt.rxglomfail++; brcmf_sdio_rxglom() 1715 brcmf_sdio_free_glom(bus); brcmf_sdio_rxglom() 1717 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_rxglom() 1718 bus->cur_read.len = 0; brcmf_sdio_rxglom() 1724 skb_queue_walk_safe(&bus->glom, pfirst, pnext) { brcmf_sdio_rxglom() 1737 skb_unlink(pfirst, &bus->glom); brcmf_sdio_rxglom() 1746 bus->glom.qlen, pfirst, pfirst->data, brcmf_sdio_rxglom() 1749 skb_unlink(pfirst, &bus->glom); brcmf_sdio_rxglom() 1750 brcmf_rx_frame(bus->sdiodev->dev, pfirst); brcmf_sdio_rxglom() 1751 bus->sdcnt.rxglompkts++; brcmf_sdio_rxglom() 1754 bus->sdcnt.rxglomframes++; brcmf_sdio_rxglom() 1759 static int brcmf_sdio_dcmd_resp_wait(struct brcmf_sdio *bus, uint *condition, brcmf_sdio_dcmd_resp_wait() argument 1766 add_wait_queue(&bus->dcmd_resp_wait, &wait); brcmf_sdio_dcmd_resp_wait() 1776 remove_wait_queue(&bus->dcmd_resp_wait, &wait); brcmf_sdio_dcmd_resp_wait() 1781 static int brcmf_sdio_dcmd_resp_wake(struct brcmf_sdio *bus) brcmf_sdio_dcmd_resp_wake() argument 1783 if (waitqueue_active(&bus->dcmd_resp_wait)) brcmf_sdio_dcmd_resp_wake() 1784 wake_up_interruptible(&bus->dcmd_resp_wait); brcmf_sdio_dcmd_resp_wake() 1789 brcmf_sdio_read_control(struct brcmf_sdio *bus, u8 *hdr, uint len, uint doff) brcmf_sdio_read_control() argument 1797 if (bus->rxblen) brcmf_sdio_read_control() 1798 buf = vzalloc(bus->rxblen); brcmf_sdio_read_control() 1802 rbuf = bus->rxbuf; brcmf_sdio_read_control() 1803 pad = ((unsigned long)rbuf % bus->head_align); brcmf_sdio_read_control() 1805 rbuf += (bus->head_align - pad); brcmf_sdio_read_control() 1814 if (bus->roundup && bus->blocksize && (rdlen > bus->blocksize)) { brcmf_sdio_read_control() 1815 pad = bus->blocksize - (rdlen % bus->blocksize); brcmf_sdio_read_control() 1816 if ((pad <= bus->roundup) && (pad < bus->blocksize) && brcmf_sdio_read_control() 1817 ((len + pad) < bus->sdiodev->bus_if->maxctl)) brcmf_sdio_read_control() 1819 } else if (rdlen % bus->head_align) { brcmf_sdio_read_control() 1820 rdlen += bus->head_align - (rdlen % bus->head_align); brcmf_sdio_read_control() 1824 if ((rdlen + BRCMF_FIRSTREAD) > bus->sdiodev->bus_if->maxctl) { brcmf_sdio_read_control() 1826 rdlen, bus->sdiodev->bus_if->maxctl); brcmf_sdio_read_control() 1827 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_read_control() 1831 if ((len - doff) > bus->sdiodev->bus_if->maxctl) { brcmf_sdio_read_control() 1833 len, len - doff, bus->sdiodev->bus_if->maxctl); brcmf_sdio_read_control() 1834 bus->sdcnt.rx_toolong++; brcmf_sdio_read_control() 1835 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_read_control() 1840 sdret = brcmf_sdiod_recv_buf(bus->sdiodev, rbuf, rdlen); brcmf_sdio_read_control() 1841 bus->sdcnt.f2rxdata++; brcmf_sdio_read_control() 1847 bus->sdcnt.rxc_errors++; brcmf_sdio_read_control() 1848 brcmf_sdio_rxfail(bus, true, true); brcmf_sdio_read_control() 1859 spin_lock_bh(&bus->rxctl_lock); brcmf_sdio_read_control() 1860 if (bus->rxctl) { brcmf_sdio_read_control() 1862 spin_unlock_bh(&bus->rxctl_lock); brcmf_sdio_read_control() 1866 bus->rxctl = buf + doff; brcmf_sdio_read_control() 1867 bus->rxctl_orig = buf; brcmf_sdio_read_control() 1868 bus->rxlen = len - doff; brcmf_sdio_read_control() 1869 spin_unlock_bh(&bus->rxctl_lock); brcmf_sdio_read_control() 1873 brcmf_sdio_dcmd_resp_wake(bus); brcmf_sdio_read_control() 1877 static void brcmf_sdio_pad(struct brcmf_sdio *bus, u16 *pad, u16 *rdlen) brcmf_sdio_pad() argument 1879 if (bus->roundup && bus->blocksize && *rdlen > bus->blocksize) { brcmf_sdio_pad() 1880 *pad = bus->blocksize - (*rdlen % bus->blocksize); brcmf_sdio_pad() 1881 if (*pad <= bus->roundup && *pad < bus->blocksize && brcmf_sdio_pad() 1884 } else if (*rdlen % bus->head_align) { brcmf_sdio_pad() 1885 *rdlen += bus->head_align - (*rdlen % bus->head_align); brcmf_sdio_pad() 1889 static uint brcmf_sdio_readframes(struct brcmf_sdio *bus, uint maxframes) brcmf_sdio_readframes() argument 1896 struct brcmf_sdio_hdrinfo *rd = &bus->cur_read, rd_new; brcmf_sdio_readframes() 1902 bus->rxpending = true; brcmf_sdio_readframes() 1904 for (rd->seq_num = bus->rx_seq, rxleft = maxframes; brcmf_sdio_readframes() 1905 !bus->rxskip && rxleft && bus->sdiodev->state == BRCMF_SDIOD_DATA; brcmf_sdio_readframes() 1909 if (bus->glomd || !skb_queue_empty(&bus->glom)) { brcmf_sdio_readframes() 1912 bus->glomd, skb_peek(&bus->glom)); brcmf_sdio_readframes() 1913 cnt = brcmf_sdio_rxglom(bus, rd->seq_num); brcmf_sdio_readframes() 1922 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1924 ret = brcmf_sdiod_recv_buf(bus->sdiodev, brcmf_sdio_readframes() 1925 bus->rxhdr, BRCMF_FIRSTREAD); brcmf_sdio_readframes() 1926 bus->sdcnt.f2rxhdrs++; brcmf_sdio_readframes() 1930 bus->sdcnt.rx_hdrfail++; brcmf_sdio_readframes() 1931 brcmf_sdio_rxfail(bus, true, true); brcmf_sdio_readframes() 1932 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1937 bus->rxhdr, SDPCM_HDRLEN, brcmf_sdio_readframes() 1940 if (brcmf_sdio_hdparse(bus, bus->rxhdr, rd, brcmf_sdio_readframes() 1942 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1943 if (!bus->rxpending) brcmf_sdio_readframes() 1950 brcmf_sdio_read_control(bus, bus->rxhdr, brcmf_sdio_readframes() 1958 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1966 brcmf_sdio_pad(bus, &pad, &rd->len_left); brcmf_sdio_readframes() 1969 bus->head_align); brcmf_sdio_readframes() 1973 brcmf_sdio_rxfail(bus, false, brcmf_sdio_readframes() 1975 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1979 pkt_align(pkt, rd->len_left, bus->head_align); brcmf_sdio_readframes() 1981 ret = brcmf_sdiod_recv_pkt(bus->sdiodev, pkt); brcmf_sdio_readframes() 1982 bus->sdcnt.f2rxdata++; brcmf_sdio_readframes() 1983 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1989 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1990 brcmf_sdio_rxfail(bus, true, brcmf_sdio_readframes() 1992 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 1998 memcpy(pkt->data, bus->rxhdr, head_read); brcmf_sdio_readframes() 2001 memcpy(bus->rxhdr, pkt->data, SDPCM_HDRLEN); brcmf_sdio_readframes() 2003 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2004 if (brcmf_sdio_hdparse(bus, bus->rxhdr, &rd_new, brcmf_sdio_readframes() 2009 bus->sdcnt.rx_readahead_cnt++; brcmf_sdio_readframes() 2015 brcmf_sdio_rxfail(bus, true, true); brcmf_sdio_readframes() 2016 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2020 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2028 bus->rxhdr, SDPCM_HDRLEN, brcmf_sdio_readframes() 2036 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2037 brcmf_sdio_rxfail(bus, false, true); brcmf_sdio_readframes() 2038 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2049 if (SDPCM_GLOMDESC(&bus->rxhdr[SDPCM_HWHDR_LEN])) { brcmf_sdio_readframes() 2057 bus->glomd = pkt; brcmf_sdio_readframes() 2061 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2062 brcmf_sdio_rxfail(bus, false, false); brcmf_sdio_readframes() 2063 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_readframes() 2088 brcmf_rx_frame(bus->sdiodev->dev, pkt); brcmf_sdio_readframes() 2098 if (bus->rxskip) brcmf_sdio_readframes() 2100 bus->rx_seq = rd->seq_num; brcmf_sdio_readframes() 2106 brcmf_sdio_wait_event_wakeup(struct brcmf_sdio *bus) brcmf_sdio_wait_event_wakeup() argument 2108 if (waitqueue_active(&bus->ctrl_wait)) brcmf_sdio_wait_event_wakeup() 2109 wake_up_interruptible(&bus->ctrl_wait); brcmf_sdio_wait_event_wakeup() 2113 static int brcmf_sdio_txpkt_hdalign(struct brcmf_sdio *bus, struct sk_buff *pkt) brcmf_sdio_txpkt_hdalign() argument 2121 head_pad = ((unsigned long)dat_buf % bus->head_align); brcmf_sdio_txpkt_hdalign() 2124 bus->sdiodev->bus_if->tx_realloc++; brcmf_sdio_txpkt_hdalign() 2131 memset(dat_buf, 0, head_pad + bus->tx_hdrlen); brcmf_sdio_txpkt_hdalign() 2138 * bus layer usage. 2145 static int brcmf_sdio_txpkt_prep_sg(struct brcmf_sdio *bus, brcmf_sdio_txpkt_prep_sg() argument 2156 sdiodev = bus->sdiodev; brcmf_sdio_txpkt_prep_sg() 2159 WARN_ON(blksize % bus->sgentry_align); brcmf_sdio_txpkt_prep_sg() 2164 tail_chop = pkt->len % bus->sgentry_align; brcmf_sdio_txpkt_prep_sg() 2166 tail_pad = bus->sgentry_align - tail_chop; brcmf_sdio_txpkt_prep_sg() 2172 bus->head_align); brcmf_sdio_txpkt_prep_sg() 2175 ret = brcmf_sdio_txpkt_hdalign(bus, pkt_pad); brcmf_sdio_txpkt_prep_sg() 2203 * @bus: brcmf_sdio structure pointer 2214 brcmf_sdio_txpkt_prep(struct brcmf_sdio *bus, struct sk_buff_head *pktq, brcmf_sdio_txpkt_prep() argument 2223 txseq = bus->tx_seq; brcmf_sdio_txpkt_prep() 2235 ret = brcmf_sdio_txpkt_hdalign(bus, pkt_next); skb_queue_walk() 2240 memset(pkt_next->data + bus->tx_hdrlen, 0, head_pad); skb_queue_walk() 2246 if (bus->txglom && pktq->qlen > 1) { skb_queue_walk() 2247 ret = brcmf_sdio_txpkt_prep_sg(bus, pktq, skb_queue_walk() 2256 hd_info.dat_offset = head_pad + bus->tx_hdrlen; skb_queue_walk() 2260 brcmf_sdio_hdpack(bus, pkt_next->data, &hd_info); skb_queue_walk() 2269 head_pad + bus->tx_hdrlen, skb_queue_walk() 2275 if (bus->txglom) 2282 * @bus: brcmf_sdio structure pointer 2290 brcmf_sdio_txpkt_postp(struct brcmf_sdio *bus, struct sk_buff_head *pktq) brcmf_sdio_txpkt_postp() argument 2309 hdr = pkt_next->data + bus->tx_hdrlen - SDPCM_SWHDR_LEN; skb_queue_walk_safe() 2314 if (bus->txglom) { skb_queue_walk_safe() 2324 static int brcmf_sdio_txpkt(struct brcmf_sdio *bus, struct sk_buff_head *pktq, brcmf_sdio_txpkt() argument 2332 ret = brcmf_sdio_txpkt_prep(bus, pktq, chan); brcmf_sdio_txpkt() 2336 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_txpkt() 2337 ret = brcmf_sdiod_send_pkt(bus->sdiodev, pktq); brcmf_sdio_txpkt() 2338 bus->sdcnt.f2txdata++; brcmf_sdio_txpkt() 2341 brcmf_sdio_txfail(bus); brcmf_sdio_txpkt() 2343 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_txpkt() 2346 brcmf_sdio_txpkt_postp(bus, pktq); brcmf_sdio_txpkt() 2348 bus->tx_seq = (bus->tx_seq + pktq->qlen) % SDPCM_SEQ_WRAP; skb_queue_walk_safe() 2351 brcmf_txcomplete(bus->sdiodev->dev, pkt_next, ret == 0); skb_queue_walk_safe() 2356 static uint brcmf_sdio_sendfromq(struct brcmf_sdio *bus, uint maxframes) brcmf_sdio_sendfromq() argument 2367 tx_prec_map = ~bus->flowcontrol; brcmf_sdio_sendfromq() 2370 for (cnt = 0; (cnt < maxframes) && data_ok(bus);) { brcmf_sdio_sendfromq() 2372 if (bus->txglom) brcmf_sdio_sendfromq() 2373 pkt_num = min_t(u8, bus->tx_max - bus->tx_seq, brcmf_sdio_sendfromq() 2374 bus->sdiodev->txglomsz); brcmf_sdio_sendfromq() 2376 brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol)); brcmf_sdio_sendfromq() 2378 spin_lock_bh(&bus->txq_lock); brcmf_sdio_sendfromq() 2380 pkt = brcmu_pktq_mdeq(&bus->txq, tx_prec_map, brcmf_sdio_sendfromq() 2386 spin_unlock_bh(&bus->txq_lock); brcmf_sdio_sendfromq() 2390 ret = brcmf_sdio_txpkt(bus, &pktq, SDPCM_DATA_CHANNEL); brcmf_sdio_sendfromq() 2395 if (!bus->intr) { brcmf_sdio_sendfromq() 2397 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_sendfromq() 2398 ret = r_sdreg32(bus, &intstatus, brcmf_sdio_sendfromq() 2401 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_sendfromq() 2402 bus->sdcnt.f2txdata++; brcmf_sdio_sendfromq() 2405 if (intstatus & bus->hostintmask) brcmf_sdio_sendfromq() 2406 atomic_set(&bus->ipend, 1); brcmf_sdio_sendfromq() 2411 if ((bus->sdiodev->state == BRCMF_SDIOD_DATA) && brcmf_sdio_sendfromq() 2412 bus->txoff && (pktq_len(&bus->txq) < TXLOW)) { brcmf_sdio_sendfromq() 2413 bus->txoff = false; brcmf_sdio_sendfromq() 2414 brcmf_txflowblock(bus->sdiodev->dev, false); brcmf_sdio_sendfromq() 2420 static int brcmf_sdio_tx_ctrlframe(struct brcmf_sdio *bus, u8 *frame, u16 len) brcmf_sdio_tx_ctrlframe() argument 2430 /* Back the pointer to make room for bus header */ brcmf_sdio_tx_ctrlframe() 2431 frame -= bus->tx_hdrlen; brcmf_sdio_tx_ctrlframe() 2432 len += bus->tx_hdrlen; brcmf_sdio_tx_ctrlframe() 2435 doff = ((unsigned long)frame % bus->head_align); brcmf_sdio_tx_ctrlframe() 2439 memset(frame + bus->tx_hdrlen, 0, doff); brcmf_sdio_tx_ctrlframe() 2444 if (bus->roundup && bus->blocksize && (len > bus->blocksize)) { brcmf_sdio_tx_ctrlframe() 2445 pad = bus->blocksize - (len % bus->blocksize); brcmf_sdio_tx_ctrlframe() 2446 if ((pad > bus->roundup) || (pad >= bus->blocksize)) brcmf_sdio_tx_ctrlframe() 2448 } else if (len % bus->head_align) { brcmf_sdio_tx_ctrlframe() 2449 pad = bus->head_align - (len % bus->head_align); brcmf_sdio_tx_ctrlframe() 2455 hd_info.dat_offset = doff + bus->tx_hdrlen; brcmf_sdio_tx_ctrlframe() 2456 hd_info.seq_num = bus->tx_seq; brcmf_sdio_tx_ctrlframe() 2459 brcmf_sdio_hdpack(bus, frame, &hd_info); brcmf_sdio_tx_ctrlframe() 2461 if (bus->txglom) brcmf_sdio_tx_ctrlframe() 2471 ret = brcmf_sdiod_send_buf(bus->sdiodev, frame, len); brcmf_sdio_tx_ctrlframe() 2474 brcmf_sdio_txfail(bus); brcmf_sdio_tx_ctrlframe() 2476 bus->tx_seq = (bus->tx_seq + 1) % SDPCM_SEQ_WRAP; brcmf_sdio_tx_ctrlframe() 2489 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_stop() local 2493 if (bus->watchdog_tsk) { brcmf_sdio_bus_stop() 2494 send_sig(SIGTERM, bus->watchdog_tsk, 1); brcmf_sdio_bus_stop() 2495 kthread_stop(bus->watchdog_tsk); brcmf_sdio_bus_stop() 2496 bus->watchdog_tsk = NULL; brcmf_sdio_bus_stop() 2503 brcmf_sdio_bus_sleep(bus, false, false); brcmf_sdio_bus_stop() 2506 w_sdreg32(bus, 0, offsetof(struct sdpcmd_regs, hostintmask)); brcmf_sdio_bus_stop() 2507 local_hostintmask = bus->hostintmask; brcmf_sdio_bus_stop() 2508 bus->hostintmask = 0; brcmf_sdio_bus_stop() 2520 /* Turn off the bus (F2), free any pending packets */ brcmf_sdio_bus_stop() 2525 w_sdreg32(bus, local_hostintmask, brcmf_sdio_bus_stop() 2531 brcmu_pktq_flush(&bus->txq, true, NULL, NULL); brcmf_sdio_bus_stop() 2534 brcmu_pkt_buf_free_skb(bus->glomd); brcmf_sdio_bus_stop() 2535 brcmf_sdio_free_glom(bus); brcmf_sdio_bus_stop() 2538 spin_lock_bh(&bus->rxctl_lock); brcmf_sdio_bus_stop() 2539 bus->rxlen = 0; brcmf_sdio_bus_stop() 2540 spin_unlock_bh(&bus->rxctl_lock); brcmf_sdio_bus_stop() 2541 brcmf_sdio_dcmd_resp_wake(bus); brcmf_sdio_bus_stop() 2544 bus->rxskip = false; brcmf_sdio_bus_stop() 2545 bus->tx_seq = bus->rx_seq = 0; brcmf_sdio_bus_stop() 2548 static inline void brcmf_sdio_clrintr(struct brcmf_sdio *bus) brcmf_sdio_clrintr() argument 2552 if (bus->sdiodev->oob_irq_requested) { brcmf_sdio_clrintr() 2553 spin_lock_irqsave(&bus->sdiodev->irq_en_lock, flags); brcmf_sdio_clrintr() 2554 if (!bus->sdiodev->irq_en && !atomic_read(&bus->ipend)) { brcmf_sdio_clrintr() 2555 enable_irq(bus->sdiodev->pdata->oob_irq_nr); brcmf_sdio_clrintr() 2556 bus->sdiodev->irq_en = true; brcmf_sdio_clrintr() 2558 spin_unlock_irqrestore(&bus->sdiodev->irq_en_lock, flags); brcmf_sdio_clrintr() 2571 static int brcmf_sdio_intr_rstatus(struct brcmf_sdio *bus) brcmf_sdio_intr_rstatus() argument 2578 buscore = brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV); brcmf_sdio_intr_rstatus() 2581 val = brcmf_sdiod_regrl(bus->sdiodev, addr, &ret); brcmf_sdio_intr_rstatus() 2582 bus->sdcnt.f1regdata++; brcmf_sdio_intr_rstatus() 2586 val &= bus->hostintmask; brcmf_sdio_intr_rstatus() 2587 atomic_set(&bus->fcstate, !!(val & I_HMB_FC_STATE)); brcmf_sdio_intr_rstatus() 2591 brcmf_sdiod_regwl(bus->sdiodev, addr, val, &ret); brcmf_sdio_intr_rstatus() 2592 bus->sdcnt.f1regdata++; brcmf_sdio_intr_rstatus() 2593 atomic_orr(val, &bus->intstatus); brcmf_sdio_intr_rstatus() 2599 static void brcmf_sdio_dpc(struct brcmf_sdio *bus) brcmf_sdio_dpc() argument 2603 uint txlimit = bus->txbound; /* Tx frames to send before resched */ brcmf_sdio_dpc() 2609 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2612 if (!bus->sr_enabled && bus->clkstate == CLK_PENDING) { brcmf_sdio_dpc() 2617 devctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_dpc() 2622 clkctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_dpc() 2629 devctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_dpc() 2632 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_DEVICE_CTL, brcmf_sdio_dpc() 2634 bus->clkstate = CLK_AVAIL; brcmf_sdio_dpc() 2639 brcmf_sdio_bus_sleep(bus, false, true); brcmf_sdio_dpc() 2642 if (atomic_read(&bus->ipend) > 0) { brcmf_sdio_dpc() 2643 atomic_set(&bus->ipend, 0); brcmf_sdio_dpc() 2644 err = brcmf_sdio_intr_rstatus(bus); brcmf_sdio_dpc() 2648 intstatus = atomic_xchg(&bus->intstatus, 0); brcmf_sdio_dpc() 2656 err = w_sdreg32(bus, I_HMB_FC_CHANGE, brcmf_sdio_dpc() 2659 err = r_sdreg32(bus, &newstatus, brcmf_sdio_dpc() 2661 bus->sdcnt.f1regdata += 2; brcmf_sdio_dpc() 2662 atomic_set(&bus->fcstate, brcmf_sdio_dpc() 2664 intstatus |= (newstatus & bus->hostintmask); brcmf_sdio_dpc() 2670 intstatus |= brcmf_sdio_hostmail(bus); brcmf_sdio_dpc() 2673 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2698 if (bus->rxskip) brcmf_sdio_dpc() 2702 if ((intstatus & I_HMB_FRAME_IND) && (bus->clkstate == CLK_AVAIL)) { brcmf_sdio_dpc() 2703 brcmf_sdio_readframes(bus, bus->rxbound); brcmf_sdio_dpc() 2704 if (!bus->rxpending) brcmf_sdio_dpc() 2710 atomic_orr(intstatus, &bus->intstatus); brcmf_sdio_dpc() 2712 brcmf_sdio_clrintr(bus); brcmf_sdio_dpc() 2714 if (bus->ctrl_frame_stat && (bus->clkstate == CLK_AVAIL) && brcmf_sdio_dpc() 2715 data_ok(bus)) { brcmf_sdio_dpc() 2716 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2717 if (bus->ctrl_frame_stat) { brcmf_sdio_dpc() 2718 err = brcmf_sdio_tx_ctrlframe(bus, bus->ctrl_frame_buf, brcmf_sdio_dpc() 2719 bus->ctrl_frame_len); brcmf_sdio_dpc() 2720 bus->ctrl_frame_err = err; brcmf_sdio_dpc() 2722 bus->ctrl_frame_stat = false; brcmf_sdio_dpc() 2724 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2725 brcmf_sdio_wait_event_wakeup(bus); brcmf_sdio_dpc() 2728 if ((bus->clkstate == CLK_AVAIL) && !atomic_read(&bus->fcstate) && brcmf_sdio_dpc() 2729 brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && txlimit && brcmf_sdio_dpc() 2730 data_ok(bus)) { brcmf_sdio_dpc() 2731 framecnt = bus->rxpending ? min(txlimit, bus->txminmax) : brcmf_sdio_dpc() 2733 brcmf_sdio_sendfromq(bus, framecnt); brcmf_sdio_dpc() 2736 if ((bus->sdiodev->state != BRCMF_SDIOD_DATA) || (err != 0)) { brcmf_sdio_dpc() 2738 atomic_set(&bus->intstatus, 0); brcmf_sdio_dpc() 2739 if (bus->ctrl_frame_stat) { brcmf_sdio_dpc() 2740 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2741 if (bus->ctrl_frame_stat) { brcmf_sdio_dpc() 2742 bus->ctrl_frame_err = -ENODEV; brcmf_sdio_dpc() 2744 bus->ctrl_frame_stat = false; brcmf_sdio_dpc() 2745 brcmf_sdio_wait_event_wakeup(bus); brcmf_sdio_dpc() 2747 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_dpc() 2749 } else if (atomic_read(&bus->intstatus) || brcmf_sdio_dpc() 2750 atomic_read(&bus->ipend) > 0 || brcmf_sdio_dpc() 2751 (!atomic_read(&bus->fcstate) && brcmf_sdio_dpc() 2752 brcmu_pktq_mlen(&bus->txq, ~bus->flowcontrol) && brcmf_sdio_dpc() 2753 data_ok(bus))) { brcmf_sdio_dpc() 2754 bus->dpc_triggered = true; brcmf_sdio_dpc() 2762 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_gettxq() local 2764 return &bus->txq; brcmf_sdio_bus_gettxq() 2815 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_txdata() local 2820 skb_push(pkt, bus->tx_hdrlen); brcmf_sdio_bus_txdata() 2827 brcmf_dbg(TRACE, "deferring pktq len %d\n", pktq_len(&bus->txq)); brcmf_sdio_bus_txdata() 2828 bus->sdcnt.fcqueued++; brcmf_sdio_bus_txdata() 2831 spin_lock_bh(&bus->txq_lock); brcmf_sdio_bus_txdata() 2834 if (!brcmf_sdio_prec_enq(&bus->txq, pkt, prec)) { brcmf_sdio_bus_txdata() 2835 skb_pull(pkt, bus->tx_hdrlen); brcmf_sdio_bus_txdata() 2836 brcmf_err("out of bus->txq !!!\n"); brcmf_sdio_bus_txdata() 2842 if (pktq_len(&bus->txq) >= TXHI) { brcmf_sdio_bus_txdata() 2843 bus->txoff = true; brcmf_sdio_bus_txdata() 2846 spin_unlock_bh(&bus->txq_lock); brcmf_sdio_bus_txdata() 2849 if (pktq_plen(&bus->txq, prec) > qcount[prec]) brcmf_sdio_bus_txdata() 2850 qcount[prec] = pktq_plen(&bus->txq, prec); brcmf_sdio_bus_txdata() 2853 brcmf_sdio_trigger_dpc(bus); brcmf_sdio_bus_txdata() 2860 static int brcmf_sdio_readconsole(struct brcmf_sdio *bus) brcmf_sdio_readconsole() argument 2862 struct brcmf_console *c = &bus->console; brcmf_sdio_readconsole() 2868 if (bus->console_addr == 0) brcmf_sdio_readconsole() 2872 addr = bus->console_addr + offsetof(struct rte_console, log_le); brcmf_sdio_readconsole() 2873 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, (u8 *)&c->log_le, brcmf_sdio_readconsole() 2899 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, c->buf, c->bufsize); brcmf_sdio_readconsole() 2942 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_txctl() local 2948 bus->ctrl_frame_buf = msg; brcmf_sdio_bus_txctl() 2949 bus->ctrl_frame_len = msglen; brcmf_sdio_bus_txctl() 2951 bus->ctrl_frame_stat = true; brcmf_sdio_bus_txctl() 2953 brcmf_sdio_trigger_dpc(bus); brcmf_sdio_bus_txctl() 2954 wait_event_interruptible_timeout(bus->ctrl_wait, !bus->ctrl_frame_stat, brcmf_sdio_bus_txctl() 2957 if (bus->ctrl_frame_stat) { brcmf_sdio_bus_txctl() 2958 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_bus_txctl() 2959 if (bus->ctrl_frame_stat) { brcmf_sdio_bus_txctl() 2961 bus->ctrl_frame_stat = false; brcmf_sdio_bus_txctl() 2964 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_bus_txctl() 2968 bus->ctrl_frame_err); brcmf_sdio_bus_txctl() 2970 ret = bus->ctrl_frame_err; brcmf_sdio_bus_txctl() 2974 bus->sdcnt.tx_ctlerrs++; brcmf_sdio_bus_txctl() 2976 bus->sdcnt.tx_ctlpkts++; brcmf_sdio_bus_txctl() 2982 static int brcmf_sdio_dump_console(struct seq_file *seq, struct brcmf_sdio *bus, brcmf_sdio_dump_console() argument 2992 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, brcmf_sdio_dump_console() 2999 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, brcmf_sdio_dump_console() 3006 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, addr, brcmf_sdio_dump_console() 3021 rv = brcmf_sdiod_ramrw(bus->sdiodev, false, console_ptr, (u8 *)conbuf, brcmf_sdio_dump_console() 3039 static int brcmf_sdio_trap_info(struct seq_file *seq, struct brcmf_sdio *bus, brcmf_sdio_trap_info() argument 3050 error = brcmf_sdiod_ramrw(bus->sdiodev, false, sh->trap_addr, (u8 *)&tr, brcmf_sdio_trap_info() 3073 static int brcmf_sdio_assert_info(struct seq_file *seq, struct brcmf_sdio *bus, brcmf_sdio_assert_info() argument 3088 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_assert_info() 3090 error = brcmf_sdiod_ramrw(bus->sdiodev, false, brcmf_sdio_assert_info() 3096 error = brcmf_sdiod_ramrw(bus->sdiodev, false, brcmf_sdio_assert_info() 3101 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_assert_info() 3108 static int brcmf_sdio_checkdied(struct brcmf_sdio *bus) brcmf_sdio_checkdied() argument 3113 error = brcmf_sdio_readshared(bus, &sh); brcmf_sdio_checkdied() 3129 static int brcmf_sdio_died_dump(struct seq_file *seq, struct brcmf_sdio *bus) brcmf_sdio_died_dump() argument 3134 error = brcmf_sdio_readshared(bus, &sh); brcmf_sdio_died_dump() 3138 error = brcmf_sdio_assert_info(seq, bus, &sh); brcmf_sdio_died_dump() 3142 error = brcmf_sdio_trap_info(seq, bus, &sh); brcmf_sdio_died_dump() 3146 error = brcmf_sdio_dump_console(seq, bus, &sh); brcmf_sdio_died_dump() 3155 struct brcmf_sdio *bus = bus_if->bus_priv.sdio->bus; brcmf_sdio_forensic_read() local 3157 return brcmf_sdio_died_dump(seq, bus); brcmf_sdio_forensic_read() 3164 struct brcmf_sdio_count *sdcnt = &sdiodev->bus->sdcnt; brcmf_debugfs_sdio_count_read() 3199 static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) brcmf_sdio_debugfs_create() argument 3201 struct brcmf_pub *drvr = bus->sdiodev->bus_if->drvr; brcmf_sdio_debugfs_create() 3211 &bus->console_interval); brcmf_sdio_debugfs_create() 3214 static int brcmf_sdio_checkdied(struct brcmf_sdio *bus) brcmf_sdio_checkdied() argument 3219 static void brcmf_sdio_debugfs_create(struct brcmf_sdio *bus) brcmf_sdio_debugfs_create() argument 3233 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_rxctl() local 3238 timeleft = brcmf_sdio_dcmd_resp_wait(bus, &bus->rxlen, &pending); brcmf_sdio_bus_rxctl() 3240 spin_lock_bh(&bus->rxctl_lock); brcmf_sdio_bus_rxctl() 3241 rxlen = bus->rxlen; brcmf_sdio_bus_rxctl() 3242 memcpy(msg, bus->rxctl, min(msglen, rxlen)); brcmf_sdio_bus_rxctl() 3243 bus->rxctl = NULL; brcmf_sdio_bus_rxctl() 3244 buf = bus->rxctl_orig; brcmf_sdio_bus_rxctl() 3245 bus->rxctl_orig = NULL; brcmf_sdio_bus_rxctl() 3246 bus->rxlen = 0; brcmf_sdio_bus_rxctl() 3247 spin_unlock_bh(&bus->rxctl_lock); brcmf_sdio_bus_rxctl() 3255 brcmf_sdio_checkdied(bus); brcmf_sdio_bus_rxctl() 3261 brcmf_sdio_checkdied(bus); brcmf_sdio_bus_rxctl() 3265 bus->sdcnt.rx_ctlpkts++; brcmf_sdio_bus_rxctl() 3267 bus->sdcnt.rx_ctlerrs++; brcmf_sdio_bus_rxctl() 3326 static int brcmf_sdio_download_code_file(struct brcmf_sdio *bus, brcmf_sdio_download_code_file() argument 3333 err = brcmf_sdiod_ramrw(bus->sdiodev, true, bus->ci->rambase, brcmf_sdio_download_code_file() 3337 err, (int)fw->size, bus->ci->rambase); brcmf_sdio_download_code_file() 3338 else if (!brcmf_sdio_verifymemory(bus->sdiodev, bus->ci->rambase, brcmf_sdio_download_code_file() 3345 static int brcmf_sdio_download_nvram(struct brcmf_sdio *bus, brcmf_sdio_download_nvram() argument 3353 address = bus->ci->ramsize - varsz + bus->ci->rambase; brcmf_sdio_download_nvram() 3354 err = brcmf_sdiod_ramrw(bus->sdiodev, true, address, vars, varsz); brcmf_sdio_download_nvram() 3358 else if (!brcmf_sdio_verifymemory(bus->sdiodev, address, vars, varsz)) brcmf_sdio_download_nvram() 3364 static int brcmf_sdio_download_firmware(struct brcmf_sdio *bus, brcmf_sdio_download_firmware() argument 3371 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_download_firmware() 3372 brcmf_sdio_clkctl(bus, CLK_AVAIL, false); brcmf_sdio_download_firmware() 3377 bcmerror = brcmf_sdio_download_code_file(bus, fw); brcmf_sdio_download_firmware() 3385 bcmerror = brcmf_sdio_download_nvram(bus, nvram, nvlen); brcmf_sdio_download_firmware() 3393 if (!brcmf_chip_set_active(bus->ci, rstvec)) { brcmf_sdio_download_firmware() 3399 brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); brcmf_sdio_download_firmware() 3403 brcmf_sdio_clkctl(bus, CLK_SDONLY, false); brcmf_sdio_download_firmware() 3404 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_download_firmware() 3408 static void brcmf_sdio_sr_init(struct brcmf_sdio *bus) brcmf_sdio_sr_init() argument 3415 val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, &err); brcmf_sdio_sr_init() 3422 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_WAKEUPCTRL, val, &err); brcmf_sdio_sr_init() 3429 brcmf_sdiod_regwb(bus->sdiodev, SDIO_CCCR_BRCM_CARDCAP, brcmf_sdio_sr_init() 3438 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdio_sr_init() 3446 bus->sr_enabled = true; brcmf_sdio_sr_init() 3451 static int brcmf_sdio_kso_init(struct brcmf_sdio *bus) brcmf_sdio_kso_init() argument 3459 if (brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV)->rev < 12) brcmf_sdio_kso_init() 3462 val = brcmf_sdiod_regrb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, &err); brcmf_sdio_kso_init() 3471 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_SLEEPCSR, brcmf_sdio_kso_init() 3487 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_bus_preinit() local 3493 * a device perspective, ie. bus:txglom affects the brcmf_sdio_bus_preinit() 3494 * bus transfers from device to host. brcmf_sdio_bus_preinit() 3496 if (brcmf_chip_get_core(bus->ci, BCMA_CORE_SDIO_DEV)->rev < 12) { brcmf_sdio_bus_preinit() 3499 err = brcmf_iovar_data_set(dev, "bus:txglom", &value, brcmf_sdio_bus_preinit() 3508 err = brcmf_iovar_data_set(dev, "bus:txglomalign", &value, brcmf_sdio_bus_preinit() 3515 bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; brcmf_sdio_bus_preinit() 3517 bus->txglom = false; brcmf_sdio_bus_preinit() 3519 pad_size = bus->sdiodev->func[2]->cur_blksize << 1; brcmf_sdio_bus_preinit() 3520 err = brcmf_iovar_data_set(bus->sdiodev->dev, "bus:rxglom", brcmf_sdio_bus_preinit() 3523 /* bus:rxglom is allowed to fail */ brcmf_sdio_bus_preinit() 3526 bus->txglom = true; brcmf_sdio_bus_preinit() 3527 bus->tx_hdrlen += SDPCM_HWEXT_LEN; brcmf_sdio_bus_preinit() 3530 brcmf_bus_add_txhdrlen(bus->sdiodev->dev, bus->tx_hdrlen); brcmf_sdio_bus_preinit() 3536 void brcmf_sdio_trigger_dpc(struct brcmf_sdio *bus) brcmf_sdio_trigger_dpc() argument 3538 if (!bus->dpc_triggered) { brcmf_sdio_trigger_dpc() 3539 bus->dpc_triggered = true; brcmf_sdio_trigger_dpc() 3540 queue_work(bus->brcmf_wq, &bus->datawork); brcmf_sdio_trigger_dpc() 3544 void brcmf_sdio_isr(struct brcmf_sdio *bus) brcmf_sdio_isr() argument 3548 if (!bus) { brcmf_sdio_isr() 3549 brcmf_err("bus is null pointer, exiting\n"); brcmf_sdio_isr() 3553 if (bus->sdiodev->state != BRCMF_SDIOD_DATA) { brcmf_sdio_isr() 3554 brcmf_err("bus is down. we have nothing to do\n"); brcmf_sdio_isr() 3558 bus->sdcnt.intrcount++; brcmf_sdio_isr() 3560 atomic_set(&bus->ipend, 1); brcmf_sdio_isr() 3562 if (brcmf_sdio_intr_rstatus(bus)) { brcmf_sdio_isr() 3567 if (!bus->intr) brcmf_sdio_isr() 3570 bus->dpc_triggered = true; brcmf_sdio_isr() 3571 queue_work(bus->brcmf_wq, &bus->datawork); brcmf_sdio_isr() 3574 static void brcmf_sdio_bus_watchdog(struct brcmf_sdio *bus) brcmf_sdio_bus_watchdog() argument 3579 if (!bus->sr_enabled && brcmf_sdio_bus_watchdog() 3580 bus->poll && (++bus->polltick >= bus->pollrate)) { brcmf_sdio_bus_watchdog() 3584 bus->polltick = 0; brcmf_sdio_bus_watchdog() 3587 if (!bus->intr || brcmf_sdio_bus_watchdog() 3588 (bus->sdcnt.intrcount == bus->sdcnt.lastintrs)) { brcmf_sdio_bus_watchdog() 3590 if (!bus->dpc_triggered) { brcmf_sdio_bus_watchdog() 3593 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3594 devpend = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_bus_watchdog() 3597 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3605 bus->sdcnt.pollcnt++; brcmf_sdio_bus_watchdog() 3606 atomic_set(&bus->ipend, 1); brcmf_sdio_bus_watchdog() 3608 bus->dpc_triggered = true; brcmf_sdio_bus_watchdog() 3609 queue_work(bus->brcmf_wq, &bus->datawork); brcmf_sdio_bus_watchdog() 3614 bus->sdcnt.lastintrs = bus->sdcnt.intrcount; brcmf_sdio_bus_watchdog() 3618 if (bus->sdiodev->state == BRCMF_SDIOD_DATA && brcmf_sdio_bus_watchdog() 3619 bus->console_interval != 0) { brcmf_sdio_bus_watchdog() 3620 bus->console.count += BRCMF_WD_POLL_MS; brcmf_sdio_bus_watchdog() 3621 if (bus->console.count >= bus->console_interval) { brcmf_sdio_bus_watchdog() 3622 bus->console.count -= bus->console_interval; brcmf_sdio_bus_watchdog() 3623 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3625 brcmf_sdio_bus_sleep(bus, false, false); brcmf_sdio_bus_watchdog() 3626 if (brcmf_sdio_readconsole(bus) < 0) brcmf_sdio_bus_watchdog() 3628 bus->console_interval = 0; brcmf_sdio_bus_watchdog() 3629 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3635 if (!bus->dpc_triggered) { brcmf_sdio_bus_watchdog() 3637 if ((!bus->dpc_running) && (bus->idletime > 0) && brcmf_sdio_bus_watchdog() 3638 (bus->clkstate == CLK_AVAIL)) { brcmf_sdio_bus_watchdog() 3639 bus->idlecount++; brcmf_sdio_bus_watchdog() 3640 if (bus->idlecount > bus->idletime) { brcmf_sdio_bus_watchdog() 3642 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3643 brcmf_sdio_wd_timer(bus, 0); brcmf_sdio_bus_watchdog() 3644 bus->idlecount = 0; brcmf_sdio_bus_watchdog() 3645 brcmf_sdio_bus_sleep(bus, true, false); brcmf_sdio_bus_watchdog() 3646 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_bus_watchdog() 3649 bus->idlecount = 0; brcmf_sdio_bus_watchdog() 3652 bus->idlecount = 0; brcmf_sdio_bus_watchdog() 3658 struct brcmf_sdio *bus = container_of(work, struct brcmf_sdio, brcmf_sdio_dataworker() local 3661 bus->dpc_running = true; brcmf_sdio_dataworker() 3663 while (ACCESS_ONCE(bus->dpc_triggered)) { brcmf_sdio_dataworker() 3664 bus->dpc_triggered = false; brcmf_sdio_dataworker() 3665 brcmf_sdio_dpc(bus); brcmf_sdio_dataworker() 3666 bus->idlecount = 0; brcmf_sdio_dataworker() 3668 bus->dpc_running = false; brcmf_sdio_dataworker() 3669 if (brcmf_sdiod_freezing(bus->sdiodev)) { brcmf_sdio_dataworker() 3670 brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DOWN); brcmf_sdio_dataworker() 3671 brcmf_sdiod_try_freeze(bus->sdiodev); brcmf_sdio_dataworker() 3672 brcmf_sdiod_change_state(bus->sdiodev, BRCMF_SDIOD_DATA); brcmf_sdio_dataworker() 3841 brcmf_sdio_probe_attach(struct brcmf_sdio *bus) brcmf_sdio_probe_attach() argument 3849 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_probe_attach() 3852 brcmf_sdiod_regrl(bus->sdiodev, SI_ENUM_BASE, NULL)); brcmf_sdio_probe_attach() 3859 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, brcmf_sdio_probe_attach() 3862 clkctl = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_probe_attach() 3871 bus->ci = brcmf_chip_attach(bus->sdiodev, &brcmf_sdio_buscore_ops); brcmf_sdio_probe_attach() 3872 if (IS_ERR(bus->ci)) { brcmf_sdio_probe_attach() 3874 bus->ci = NULL; brcmf_sdio_probe_attach() 3878 if (brcmf_sdio_kso_init(bus)) { brcmf_sdio_probe_attach() 3883 if ((bus->sdiodev->pdata) && (bus->sdiodev->pdata->drive_strength)) brcmf_sdio_probe_attach() 3884 drivestrength = bus->sdiodev->pdata->drive_strength; brcmf_sdio_probe_attach() 3887 brcmf_sdio_drivestrengthinit(bus->sdiodev, bus->ci, drivestrength); brcmf_sdio_probe_attach() 3890 reg_val = brcmf_sdiod_regrb(bus->sdiodev, brcmf_sdio_probe_attach() 3897 brcmf_sdiod_regwb(bus->sdiodev, brcmf_sdio_probe_attach() 3903 reg_addr = CORE_CC_REG(brcmf_chip_get_chipcommon(bus->ci)->base, brcmf_sdio_probe_attach() 3905 reg_val = brcmf_sdiod_regrl(bus->sdiodev, reg_addr, &err); brcmf_sdio_probe_attach() 3911 brcmf_sdiod_regwl(bus->sdiodev, reg_addr, reg_val, &err); brcmf_sdio_probe_attach() 3915 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_probe_attach() 3917 brcmu_pktq_init(&bus->txq, (PRIOMASK + 1), TXQLEN); brcmf_sdio_probe_attach() 3920 bus->hdrbuf = kzalloc(MAX_HDR_READ + bus->head_align, GFP_KERNEL); brcmf_sdio_probe_attach() 3921 if (!bus->hdrbuf) brcmf_sdio_probe_attach() 3924 bus->rxhdr = (u8 *) roundup((unsigned long)&bus->hdrbuf[0], brcmf_sdio_probe_attach() 3925 bus->head_align); brcmf_sdio_probe_attach() 3928 bus->intr = true; brcmf_sdio_probe_attach() 3929 bus->poll = false; brcmf_sdio_probe_attach() 3930 if (bus->poll) brcmf_sdio_probe_attach() 3931 bus->pollrate = 1; brcmf_sdio_probe_attach() 3936 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_probe_attach() 3943 struct brcmf_sdio *bus = (struct brcmf_sdio *)data; brcmf_sdio_watchdog_thread() local 3948 brcmf_sdiod_freezer_count(bus->sdiodev); brcmf_sdio_watchdog_thread() 3952 brcmf_sdiod_freezer_uncount(bus->sdiodev); brcmf_sdio_watchdog_thread() 3953 wait = wait_for_completion_interruptible(&bus->watchdog_wait); brcmf_sdio_watchdog_thread() 3954 brcmf_sdiod_freezer_count(bus->sdiodev); brcmf_sdio_watchdog_thread() 3955 brcmf_sdiod_try_freeze(bus->sdiodev); brcmf_sdio_watchdog_thread() 3957 brcmf_sdio_bus_watchdog(bus); brcmf_sdio_watchdog_thread() 3959 bus->sdcnt.tickcnt++; brcmf_sdio_watchdog_thread() 3960 reinit_completion(&bus->watchdog_wait); brcmf_sdio_watchdog_thread() 3970 struct brcmf_sdio *bus = (struct brcmf_sdio *)data; brcmf_sdio_watchdog() local 3972 if (bus->watchdog_tsk) { brcmf_sdio_watchdog() 3973 complete(&bus->watchdog_wait); brcmf_sdio_watchdog() 3975 if (bus->wd_timer_valid) brcmf_sdio_watchdog() 3976 mod_timer(&bus->timer, brcmf_sdio_watchdog() 3997 struct brcmf_sdio *bus = sdiodev->bus; brcmf_sdio_firmware_callback() local 4007 bus->alp_only = true; brcmf_sdio_firmware_callback() 4008 err = brcmf_sdio_download_firmware(bus, code, nvram, nvram_len); brcmf_sdio_firmware_callback() 4011 bus->alp_only = false; brcmf_sdio_firmware_callback() 4014 bus->sdcnt.tickcnt = 0; brcmf_sdio_firmware_callback() 4015 brcmf_sdio_wd_timer(bus, BRCMF_WD_POLL_MS); brcmf_sdio_firmware_callback() 4020 brcmf_sdio_clkctl(bus, CLK_AVAIL, false); brcmf_sdio_firmware_callback() 4021 if (bus->clkstate != CLK_AVAIL) brcmf_sdio_firmware_callback() 4036 w_sdreg32(bus, SDPCM_PROT_VERSION << SMB_DATA_VERSION_SHIFT, brcmf_sdio_firmware_callback() 4046 bus->hostintmask = HOSTINTMASK; brcmf_sdio_firmware_callback() 4047 w_sdreg32(bus, bus->hostintmask, brcmf_sdio_firmware_callback() 4057 if (brcmf_chip_sr_capable(bus->ci)) { brcmf_sdio_firmware_callback() 4058 brcmf_sdio_sr_init(bus); brcmf_sdio_firmware_callback() 4073 brcmf_sdio_clkctl(bus, CLK_NONE, false); brcmf_sdio_firmware_callback() 4094 struct brcmf_sdio *bus; brcmf_sdio_probe() local 4099 /* Allocate private bus interface state */ brcmf_sdio_probe() 4100 bus = kzalloc(sizeof(struct brcmf_sdio), GFP_ATOMIC); brcmf_sdio_probe() 4101 if (!bus) brcmf_sdio_probe() 4104 bus->sdiodev = sdiodev; brcmf_sdio_probe() 4105 sdiodev->bus = bus; brcmf_sdio_probe() 4106 skb_queue_head_init(&bus->glom); brcmf_sdio_probe() 4107 bus->txbound = BRCMF_TXBOUND; brcmf_sdio_probe() 4108 bus->rxbound = BRCMF_RXBOUND; brcmf_sdio_probe() 4109 bus->txminmax = BRCMF_TXMINMAX; brcmf_sdio_probe() 4110 bus->tx_seq = SDPCM_SEQ_WRAP - 1; brcmf_sdio_probe() 4115 bus->head_align = ALIGNMENT; brcmf_sdio_probe() 4116 bus->sgentry_align = ALIGNMENT; brcmf_sdio_probe() 4119 bus->head_align = sdiodev->pdata->sd_head_align; brcmf_sdio_probe() 4121 bus->sgentry_align = sdiodev->pdata->sd_sgentry_align; brcmf_sdio_probe() 4132 INIT_WORK(&bus->datawork, brcmf_sdio_dataworker); brcmf_sdio_probe() 4133 bus->brcmf_wq = wq; brcmf_sdio_probe() 4136 if (!(brcmf_sdio_probe_attach(bus))) { brcmf_sdio_probe() 4141 spin_lock_init(&bus->rxctl_lock); brcmf_sdio_probe() 4142 spin_lock_init(&bus->txq_lock); brcmf_sdio_probe() 4143 init_waitqueue_head(&bus->ctrl_wait); brcmf_sdio_probe() 4144 init_waitqueue_head(&bus->dcmd_resp_wait); brcmf_sdio_probe() 4147 init_timer(&bus->timer); brcmf_sdio_probe() 4148 bus->timer.data = (unsigned long)bus; brcmf_sdio_probe() 4149 bus->timer.function = brcmf_sdio_watchdog; brcmf_sdio_probe() 4152 init_completion(&bus->watchdog_wait); brcmf_sdio_probe() 4153 bus->watchdog_tsk = kthread_run(brcmf_sdio_watchdog_thread, brcmf_sdio_probe() 4154 bus, "brcmf_wdog/%s", brcmf_sdio_probe() 4156 if (IS_ERR(bus->watchdog_tsk)) { brcmf_sdio_probe() 4158 bus->watchdog_tsk = NULL; brcmf_sdio_probe() 4161 bus->dpc_triggered = false; brcmf_sdio_probe() 4162 bus->dpc_running = false; brcmf_sdio_probe() 4164 /* Assign bus interface call back */ brcmf_sdio_probe() 4165 bus->sdiodev->bus_if->dev = bus->sdiodev->dev; brcmf_sdio_probe() 4166 bus->sdiodev->bus_if->ops = &brcmf_sdio_bus_ops; brcmf_sdio_probe() 4167 bus->sdiodev->bus_if->chip = bus->ci->chip; brcmf_sdio_probe() 4168 bus->sdiodev->bus_if->chiprev = bus->ci->chiprev; brcmf_sdio_probe() 4170 /* default sdio bus header length for tx packet */ brcmf_sdio_probe() 4171 bus->tx_hdrlen = SDPCM_HWHDR_LEN + SDPCM_SWHDR_LEN; brcmf_sdio_probe() 4174 ret = brcmf_attach(bus->sdiodev->dev); brcmf_sdio_probe() 4181 bus->blocksize = bus->sdiodev->func[2]->cur_blksize; brcmf_sdio_probe() 4182 bus->roundup = min(max_roundup, bus->blocksize); brcmf_sdio_probe() 4185 if (bus->sdiodev->bus_if->maxctl) { brcmf_sdio_probe() 4186 bus->sdiodev->bus_if->maxctl += bus->roundup; brcmf_sdio_probe() 4187 bus->rxblen = brcmf_sdio_probe() 4188 roundup((bus->sdiodev->bus_if->maxctl + SDPCM_HDRLEN), brcmf_sdio_probe() 4189 ALIGNMENT) + bus->head_align; brcmf_sdio_probe() 4190 bus->rxbuf = kmalloc(bus->rxblen, GFP_ATOMIC); brcmf_sdio_probe() 4191 if (!(bus->rxbuf)) { brcmf_sdio_probe() 4197 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_probe() 4200 sdio_disable_func(bus->sdiodev->func[SDIO_FUNC_2]); brcmf_sdio_probe() 4202 bus->rxflow = false; brcmf_sdio_probe() 4205 brcmf_sdiod_regwb(bus->sdiodev, SBSDIO_FUNC1_CHIPCLKCSR, 0, NULL); brcmf_sdio_probe() 4207 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_probe() 4210 bus->clkstate = CLK_SDONLY; brcmf_sdio_probe() 4211 bus->idletime = BRCMF_IDLE_INTERVAL; brcmf_sdio_probe() 4212 bus->idleclock = BRCMF_IDLE_ACTIVE; brcmf_sdio_probe() 4215 bus->sr_enabled = false; brcmf_sdio_probe() 4217 brcmf_sdio_debugfs_create(bus); brcmf_sdio_probe() 4220 ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev); brcmf_sdio_probe() 4232 return bus; brcmf_sdio_probe() 4235 brcmf_sdio_remove(bus); brcmf_sdio_probe() 4240 void brcmf_sdio_remove(struct brcmf_sdio *bus) brcmf_sdio_remove() argument 4244 if (bus) { brcmf_sdio_remove() 4246 brcmf_sdiod_intr_unregister(bus->sdiodev); brcmf_sdio_remove() 4248 brcmf_detach(bus->sdiodev->dev); brcmf_sdio_remove() 4250 cancel_work_sync(&bus->datawork); brcmf_sdio_remove() 4251 if (bus->brcmf_wq) brcmf_sdio_remove() 4252 destroy_workqueue(bus->brcmf_wq); brcmf_sdio_remove() 4254 if (bus->ci) { brcmf_sdio_remove() 4255 if (bus->sdiodev->state != BRCMF_SDIOD_NOMEDIUM) { brcmf_sdio_remove() 4256 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_remove() 4257 brcmf_sdio_wd_timer(bus, 0); brcmf_sdio_remove() 4258 brcmf_sdio_clkctl(bus, CLK_AVAIL, false); brcmf_sdio_remove() 4264 brcmf_chip_set_passive(bus->ci); brcmf_sdio_remove() 4265 brcmf_sdio_clkctl(bus, CLK_NONE, false); brcmf_sdio_remove() 4266 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_remove() 4268 brcmf_chip_detach(bus->ci); brcmf_sdio_remove() 4271 kfree(bus->rxbuf); brcmf_sdio_remove() 4272 kfree(bus->hdrbuf); brcmf_sdio_remove() 4273 kfree(bus); brcmf_sdio_remove() 4279 void brcmf_sdio_wd_timer(struct brcmf_sdio *bus, uint wdtick) brcmf_sdio_wd_timer() argument 4282 if (!wdtick && bus->wd_timer_valid) { brcmf_sdio_wd_timer() 4283 del_timer_sync(&bus->timer); brcmf_sdio_wd_timer() 4284 bus->wd_timer_valid = false; brcmf_sdio_wd_timer() 4285 bus->save_ms = wdtick; brcmf_sdio_wd_timer() 4290 if (bus->sdiodev->state != BRCMF_SDIOD_DATA) brcmf_sdio_wd_timer() 4294 if (bus->save_ms != BRCMF_WD_POLL_MS) { brcmf_sdio_wd_timer() 4295 if (bus->wd_timer_valid) brcmf_sdio_wd_timer() 4297 del_timer_sync(&bus->timer); brcmf_sdio_wd_timer() 4302 bus->timer.expires = brcmf_sdio_wd_timer() 4304 add_timer(&bus->timer); brcmf_sdio_wd_timer() 4308 mod_timer(&bus->timer, brcmf_sdio_wd_timer() 4312 bus->wd_timer_valid = true; brcmf_sdio_wd_timer() 4313 bus->save_ms = wdtick; brcmf_sdio_wd_timer() 4317 int brcmf_sdio_sleep(struct brcmf_sdio *bus, bool sleep) brcmf_sdio_sleep() argument 4321 sdio_claim_host(bus->sdiodev->func[1]); brcmf_sdio_sleep() 4322 ret = brcmf_sdio_bus_sleep(bus, sleep, false); brcmf_sdio_sleep() 4323 sdio_release_host(bus->sdiodev->func[1]); brcmf_sdio_sleep()
|
H A D | bus.h | 34 /* The level of bus communication with the dongle */ 40 /* The level of bus communication with the dongle */ 54 * struct brcmf_bus_ops - bus callback operations. 56 * @preinit: execute bus/device specific dongle init commands (optional). 66 * @gettxq: obtain a reference of bus transmit queue (optional). 70 * bus specific driver. For control messages to common driver 86 * struct brcmf_bus_msgbuf - bus ringbuf if in case of msgbuf. 104 * struct brcmf_bus - interface structure between common and bus layer 106 * @bus_priv: pointer to private bus device. 108 * @dev: device pointer of bus device. 110 * @state: operational state of the bus interface. 114 * @dcmd_list: bus/device specific dongle initialization commands. 116 * @wowl_supported: is wowl supported by bus driver. 143 static inline int brcmf_bus_preinit(struct brcmf_bus *bus) brcmf_bus_preinit() argument 145 if (!bus->ops->preinit) brcmf_bus_preinit() 147 return bus->ops->preinit(bus->dev); brcmf_bus_preinit() 150 static inline void brcmf_bus_stop(struct brcmf_bus *bus) brcmf_bus_stop() argument 152 bus->ops->stop(bus->dev); brcmf_bus_stop() 155 static inline int brcmf_bus_txdata(struct brcmf_bus *bus, struct sk_buff *skb) brcmf_bus_txdata() argument 157 return bus->ops->txdata(bus->dev, skb); brcmf_bus_txdata() 161 int brcmf_bus_txctl(struct brcmf_bus *bus, unsigned char *msg, uint len) brcmf_bus_txctl() argument 163 return bus->ops->txctl(bus->dev, msg, len); brcmf_bus_txctl() 167 int brcmf_bus_rxctl(struct brcmf_bus *bus, unsigned char *msg, uint len) brcmf_bus_rxctl() argument 169 return bus->ops->rxctl(bus->dev, msg, len); brcmf_bus_rxctl() 173 struct pktq *brcmf_bus_gettxq(struct brcmf_bus *bus) brcmf_bus_gettxq() argument 175 if (!bus->ops->gettxq) brcmf_bus_gettxq() 178 return bus->ops->gettxq(bus->dev); brcmf_bus_gettxq() 182 void brcmf_bus_wowl_config(struct brcmf_bus *bus, bool enabled) brcmf_bus_wowl_config() argument 184 if (bus->ops->wowl_config) brcmf_bus_wowl_config() 185 bus->ops->wowl_config(bus->dev, enabled); brcmf_bus_wowl_config() 198 /* Indication from bus module regarding presence/insertion of dongle. */ 200 /* Indication from bus module regarding removal/absence of dongle */ 202 /* Indication from bus module that dongle should be reset */ 204 /* Indication from bus module to change flow-control state */ 207 /* Notify the bus has transferred the tx packet to firmware */ 210 /* Configure the "global" bus state used by upper layers */ 211 void brcmf_bus_change_state(struct brcmf_bus *bus, enum brcmf_bus_state state);
|
/linux-4.1.27/arch/mips/lib/ |
H A D | iomap-pci.c | 16 struct pci_controller *ctrl = dev->bus->sysdata; __pci_ioport_map() 21 struct pci_bus *bus = dev->bus; __pci_ioport_map() local 24 while (bus->parent) __pci_ioport_map() 25 bus = bus->parent; __pci_ioport_map() 29 sprintf(name, "%04x:%02x", pci_domain_nr(bus), bus->number); __pci_ioport_map() 30 printk(KERN_WARNING "io_map_base of root PCI bus %s unset. " __pci_ioport_map()
|
/linux-4.1.27/drivers/net/ethernet/freescale/ |
H A D | fec_mpc52xx_phy.c | 2 * Driver for the MPC5200 Fast Ethernet Controller - MDIO bus driver 28 static int mpc52xx_fec_mdio_transfer(struct mii_bus *bus, int phy_id, mpc52xx_fec_mdio_transfer() argument 31 struct mpc52xx_fec_mdio_priv *priv = bus->priv; mpc52xx_fec_mdio_transfer() 52 static int mpc52xx_fec_mdio_read(struct mii_bus *bus, int phy_id, int reg) mpc52xx_fec_mdio_read() argument 54 return mpc52xx_fec_mdio_transfer(bus, phy_id, reg, FEC_MII_READ_FRAME); mpc52xx_fec_mdio_read() 57 static int mpc52xx_fec_mdio_write(struct mii_bus *bus, int phy_id, int reg, mpc52xx_fec_mdio_write() argument 60 return mpc52xx_fec_mdio_transfer(bus, phy_id, reg, mpc52xx_fec_mdio_write() 68 struct mii_bus *bus; mpc52xx_fec_mdio_probe() local 73 bus = mdiobus_alloc(); mpc52xx_fec_mdio_probe() 74 if (bus == NULL) mpc52xx_fec_mdio_probe() 82 bus->name = "mpc52xx MII bus"; mpc52xx_fec_mdio_probe() 83 bus->read = mpc52xx_fec_mdio_read; mpc52xx_fec_mdio_probe() 84 bus->write = mpc52xx_fec_mdio_write; mpc52xx_fec_mdio_probe() 87 bus->irq = priv->mdio_irqs; mpc52xx_fec_mdio_probe() 99 snprintf(bus->id, MII_BUS_ID_SIZE, "%x", res.start); mpc52xx_fec_mdio_probe() 100 bus->priv = priv; mpc52xx_fec_mdio_probe() 102 bus->parent = dev; mpc52xx_fec_mdio_probe() 103 dev_set_drvdata(dev, bus); mpc52xx_fec_mdio_probe() 109 err = of_mdiobus_register(bus, np); mpc52xx_fec_mdio_probe() 119 mdiobus_free(bus); mpc52xx_fec_mdio_probe() 126 struct mii_bus *bus = platform_get_drvdata(of); mpc52xx_fec_mdio_remove() local 127 struct mpc52xx_fec_mdio_priv *priv = bus->priv; mpc52xx_fec_mdio_remove() 129 mdiobus_unregister(bus); mpc52xx_fec_mdio_remove() 132 mdiobus_free(bus); mpc52xx_fec_mdio_remove()
|
H A D | xgmac_mdio.c | 74 * Wait until the MDIO bus is free 82 /* Wait till the bus is free */ xgmac_wait_until_free() 91 dev_err(dev, "timeout waiting for bus to be free\n"); xgmac_wait_until_free() 128 static int xgmac_mdio_write(struct mii_bus *bus, int phy_id, int regnum, u16 value) xgmac_mdio_write() argument 130 struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; xgmac_mdio_write() 150 ret = xgmac_wait_until_free(&bus->dev, regs, endian); xgmac_mdio_write() 162 ret = xgmac_wait_until_free(&bus->dev, regs, endian); xgmac_mdio_write() 170 ret = xgmac_wait_until_done(&bus->dev, regs, endian); xgmac_mdio_write() 182 static int xgmac_mdio_read(struct mii_bus *bus, int phy_id, int regnum) xgmac_mdio_read() argument 184 struct mdio_fsl_priv *priv = (struct mdio_fsl_priv *)bus->priv; xgmac_mdio_read() 204 ret = xgmac_wait_until_free(&bus->dev, regs, endian); xgmac_mdio_read() 216 ret = xgmac_wait_until_free(&bus->dev, regs, endian); xgmac_mdio_read() 224 ret = xgmac_wait_until_done(&bus->dev, regs, endian); xgmac_mdio_read() 230 dev_err(&bus->dev, xgmac_mdio_read() 237 dev_dbg(&bus->dev, "read %04x\n", value); xgmac_mdio_read() 245 struct mii_bus *bus; xgmac_mdio_probe() local 256 bus = mdiobus_alloc_size(sizeof(struct mdio_fsl_priv)); xgmac_mdio_probe() 257 if (!bus) xgmac_mdio_probe() 260 bus->name = "Freescale XGMAC MDIO Bus"; xgmac_mdio_probe() 261 bus->read = xgmac_mdio_read; xgmac_mdio_probe() 262 bus->write = xgmac_mdio_write; xgmac_mdio_probe() 263 bus->parent = &pdev->dev; xgmac_mdio_probe() 264 snprintf(bus->id, MII_BUS_ID_SIZE, "%llx", (unsigned long long)res.start); xgmac_mdio_probe() 267 priv = bus->priv; xgmac_mdio_probe() 280 ret = of_mdiobus_register(bus, np); xgmac_mdio_probe() 282 dev_err(&pdev->dev, "cannot register MDIO bus\n"); xgmac_mdio_probe() 286 platform_set_drvdata(pdev, bus); xgmac_mdio_probe() 294 mdiobus_free(bus); xgmac_mdio_probe() 301 struct mii_bus *bus = platform_get_drvdata(pdev); xgmac_mdio_remove() local 303 mdiobus_unregister(bus); xgmac_mdio_remove() 304 iounmap(bus->priv); xgmac_mdio_remove() 305 mdiobus_free(bus); xgmac_mdio_remove()
|
/linux-4.1.27/arch/powerpc/kernel/ |
H A D | pci-hotplug.c | 36 * pcibios_remove_pci_devices - remove all devices under this bus 37 * @bus: the indicated PCI bus 39 * Remove all of the PCI devices under this bus both from the 42 void pcibios_remove_pci_devices(struct pci_bus *bus) pcibios_remove_pci_devices() argument 48 list_for_each_entry(child_bus, &bus->children, node) pcibios_remove_pci_devices() 51 pr_debug("PCI: Removing devices on bus %04x:%02x\n", pcibios_remove_pci_devices() 52 pci_domain_nr(bus), bus->number); pcibios_remove_pci_devices() 53 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) { pcibios_remove_pci_devices() 62 * pcibios_add_pci_devices - adds new pci devices to bus 63 * @bus: the indicated PCI bus 66 * the indicated bus. This routine presumes that there 72 void pcibios_add_pci_devices(struct pci_bus * bus) pcibios_add_pci_devices() argument 77 struct device_node *dn = pci_bus_to_OF_node(bus); pcibios_add_pci_devices() 81 phb = pci_bus_to_host(bus); pcibios_add_pci_devices() 85 mode = phb->controller_ops.probe_mode(bus); pcibios_add_pci_devices() 89 of_rescan_bus(dn, bus); pcibios_add_pci_devices() 99 pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); pcibios_add_pci_devices() 100 pcibios_setup_bus_devices(bus); pcibios_add_pci_devices() 101 max = bus->busn_res.start; pcibios_add_pci_devices() 103 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_add_pci_devices() 105 max = pci_scan_bridge(bus, dev, pcibios_add_pci_devices() 110 pcibios_finish_adding_to_bus(bus); pcibios_add_pci_devices()
|
H A D | pci_of_scan.c | 114 pcibios_bus_to_resource(dev->bus, res, ®ion); of_pci_parse_addrs() 119 * of_create_pci_dev - Given a device tree node on a pci bus, create a pci_dev 121 * @bus: bus the device is sitting on 125 struct pci_bus *bus, int devfn) of_create_pci_dev() 131 dev = pci_alloc_dev(bus); of_create_pci_dev() 141 dev->dev.parent = bus->bridge; of_create_pci_dev() 142 dev->dev.bus = &pci_bus_type; of_create_pci_dev() 148 list_for_each_entry(slot, &dev->bus->slots, list) of_create_pci_dev() 159 dev_set_name(&dev->dev, "%04x:%02x:%02x.%d", pci_domain_nr(bus), of_create_pci_dev() 160 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); of_create_pci_dev() 192 pci_device_add(dev, bus); of_create_pci_dev() 209 struct pci_bus *bus; of_scan_pci_bridge() local 220 /* parse bus-range property */ of_scan_pci_bridge() 221 busrange = of_get_property(node, "bus-range", &len); of_scan_pci_bridge() 223 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", of_scan_pci_bridge() 234 bus = pci_find_bus(pci_domain_nr(dev->bus), of_scan_pci_bridge() 236 if (!bus) { of_scan_pci_bridge() 237 bus = pci_add_new_bus(dev->bus, dev, of_scan_pci_bridge() 239 if (!bus) { of_scan_pci_bridge() 240 printk(KERN_ERR "Failed to create pci bus for %s\n", of_scan_pci_bridge() 246 bus->primary = dev->bus->number; of_scan_pci_bridge() 247 pci_bus_insert_busn_res(bus, of_read_number(busrange, 1), of_scan_pci_bridge() 249 bus->bridge_ctl = 0; of_scan_pci_bridge() 256 bus->resource[i] = res; of_scan_pci_bridge() 266 res = bus->resource[0]; of_scan_pci_bridge() 278 res = bus->resource[i]; of_scan_pci_bridge() 284 pcibios_bus_to_resource(dev->bus, res, ®ion); of_scan_pci_bridge() 286 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), of_scan_pci_bridge() 287 bus->number); of_scan_pci_bridge() 288 pr_debug(" bus name: %s\n", bus->name); of_scan_pci_bridge() 290 phb = pci_bus_to_host(bus); of_scan_pci_bridge() 294 mode = phb->controller_ops.probe_mode(bus); of_scan_pci_bridge() 298 of_scan_bus(node, bus); of_scan_pci_bridge() 300 pci_scan_child_bus(bus); of_scan_pci_bridge() 304 static struct pci_dev *of_scan_pci_dev(struct pci_bus *bus, of_scan_pci_dev() argument 324 dev = pci_get_slot(bus, devfn); of_scan_pci_dev() 337 dev = of_create_pci_dev(dn, bus, devfn); of_scan_pci_dev() 346 * __of_scan_bus - given a PCI bus node, setup bus and scan for child devices 347 * @node: device tree node for the PCI bus 348 * @bus: pci_bus structure for the PCI bus 349 * @rescan_existing: Flag indicating bus has already been set up 351 static void __of_scan_bus(struct device_node *node, struct pci_bus *bus, __of_scan_bus() argument 357 pr_debug("of_scan_bus(%s) bus no %d...\n", __of_scan_bus() 358 node->full_name, bus->number); __of_scan_bus() 362 dev = of_scan_pci_dev(bus, child); for_each_child_of_node() 368 /* Apply all fixups necessary. We don't fixup the bus "self" 372 pcibios_setup_bus_self(bus); 373 pcibios_setup_bus_devices(bus); 376 list_for_each_entry(dev, &bus->devices, bus_list) { 384 * of_scan_bus - given a PCI bus node, setup bus and scan for child devices 385 * @node: device tree node for the PCI bus 386 * @bus: pci_bus structure for the PCI bus 388 void of_scan_bus(struct device_node *node, struct pci_bus *bus) of_scan_bus() argument 390 __of_scan_bus(node, bus, 0); of_scan_bus() 395 * of_rescan_bus - given a PCI bus node, scan for child devices 396 * @node: device tree node for the PCI bus 397 * @bus: pci_bus structure for the PCI bus 402 void of_rescan_bus(struct device_node *node, struct pci_bus *bus) of_rescan_bus() argument 404 __of_scan_bus(node, bus, 1); of_rescan_bus() 124 of_create_pci_dev(struct device_node *node, struct pci_bus *bus, int devfn) of_create_pci_dev() argument
|
H A D | io-workarounds.c | 35 struct iowa_bus *bus = &iowa_busses[i]; iowa_pci_find() local 36 struct pci_controller *phb = bus->phb; iowa_pci_find() 42 return bus; iowa_pci_find() 49 return bus; iowa_pci_find() 60 struct iowa_bus *bus; iowa_mem_find_bus() local 66 bus = &iowa_busses[token - 1]; iowa_mem_find_bus() 86 bus = iowa_pci_find(vaddr, paddr); iowa_mem_find_bus() 88 if (bus == NULL) iowa_mem_find_bus() 92 return bus; iowa_mem_find_bus() 117 struct iowa_bus *bus; \ 118 bus = iowa_##space##_find_bus(aa); \ 119 if (bus && bus->ops && bus->ops->name) \ 120 return bus->ops->name al; \ 127 struct iowa_bus *bus; \ 128 bus = iowa_##space##_find_bus(aa); \ 129 if (bus && bus->ops && bus->ops->name) { \ 130 bus->ops->name al; \ 157 struct iowa_bus *bus; iowa_ioremap() local 161 bus = iowa_pci_find(0, (unsigned long)addr); iowa_ioremap() 162 if (bus != NULL) { iowa_ioremap() 163 busno = bus - iowa_busses; iowa_ioremap() 184 /* Register new bus to support workaround */ iowa_register_bus() 188 struct iowa_bus *bus; iowa_register_bus() local 199 bus = &iowa_busses[iowa_bus_count]; iowa_register_bus() 200 bus->phb = phb; iowa_register_bus() 201 bus->ops = ops; iowa_register_bus() 202 bus->private = data; iowa_register_bus() 205 if ((*initfunc)(bus, data)) iowa_register_bus() 210 pr_debug("IOWA:[%d]Add bus, %s.\n", iowa_bus_count-1, np->full_name); iowa_register_bus()
|
H A D | pci_64.c | 37 * and it *must* be the start of ISA space if an ISA bus exists because 38 * ISA drivers use hard coded offsets. If no ISA bus exists nothing 63 pci_bus_add_devices(hose->bus); pcibios_init() 76 int pcibios_unmap_io_space(struct pci_bus *bus) pcibios_unmap_io_space() argument 80 WARN_ON(bus == NULL); pcibios_unmap_io_space() 92 if (bus->self) { pcibios_unmap_io_space() 94 struct resource *res = bus->resource[0]; pcibios_unmap_io_space() 98 pci_name(bus->self)); pcibios_unmap_io_space() 108 hose = pci_bus_to_host(bus); pcibios_unmap_io_space() 137 /* If there's no IO to map on that bus, get away too */ pcibios_map_phb_io_space() 175 int pcibios_map_io_space(struct pci_bus *bus) pcibios_map_io_space() argument 177 WARN_ON(bus == NULL); pcibios_map_io_space() 182 if (bus->self) { pcibios_map_io_space() 184 pci_name(bus->self)); pcibios_map_io_space() 186 bus->resource[0]->start + _IO_BASE, pcibios_map_io_space() 187 bus->resource[0]->end + _IO_BASE); pcibios_map_io_space() 191 return pcibios_map_phb_io_space(pci_bus_to_host(bus)); pcibios_map_io_space() 210 struct pci_bus *tmp_bus, *bus = NULL; sys_pciconfig_iobase() local 215 * G5 machines... So when something asks for bus 0 io base sys_pciconfig_iobase() 216 * (bus 0 is HT root), we return the AGP one instead. sys_pciconfig_iobase() 234 bus = tmp_bus; sys_pciconfig_iobase() 238 if (bus == NULL || bus->dev.of_node == NULL) sys_pciconfig_iobase() 241 hose_node = bus->dev.of_node; sys_pciconfig_iobase() 261 int pcibus_to_node(struct pci_bus *bus) pcibus_to_node() argument 263 struct pci_controller *phb = pci_bus_to_host(bus); pcibus_to_node()
|
H A D | pci_32.c | 41 /* By default, we don't re-assign bus numbers. We do this only on 78 bus_range = of_get_property(node, "bus-range", &len); make_one_node_map() 80 printk(KERN_WARNING "Can't get bus-range for %s, " make_one_node_map() 117 printk(KERN_ERR "Can't allocate OF bus map !\n"); pcibios_make_OF_bus_map() 121 /* We fill the bus map with invalid values, that helps pcibios_make_OF_bus_map() 136 map_prop = of_find_property(dn, "pci-OF-bus-map", NULL); pcibios_make_OF_bus_map() 143 printk("PCI->OF bus map:\n"); pcibios_make_OF_bus_map() 156 int pci_device_from_OF_node(struct device_node *node, u8 *bus, u8 *devfn) pci_device_from_OF_node() argument 170 *bus = (be32_to_cpup(®[0]) >> 16) & 0xff; pci_device_from_OF_node() 174 * all busses, we can't rely on the OF bus number any more. pci_device_from_OF_node() 176 * may match the same OF bus number. pci_device_from_OF_node() 182 if (pci_to_OF_bus_map[dev->bus->number] == *bus && for_each_pci_dev() 184 *bus = dev->bus->number; for_each_pci_dev() 193 /* We create the "pci-OF-bus-map" property now so it appears in the 206 of_prop->name = "pci-OF-bus-map"; pci_create_OF_bus_map() 241 pci_bus_add_devices(hose->bus); pcibios_init() 247 /* OpenFirmware based machines need a map of OF bus pcibios_init() 248 * numbers vs. kernel bus numbers since we may have to pcibios_init() 267 pci_bus_to_hose(int bus) pci_bus_to_hose() argument 272 if (bus >= hose->first_busno && bus <= hose->last_busno) pci_bus_to_hose() 283 long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) sys_pciconfig_iobase() argument 288 hose = pci_bus_to_hose(bus); sys_pciconfig_iobase()
|
H A D | pci-common.c | 109 resource_size_t pcibios_window_alignment(struct pci_bus *bus, pcibios_window_alignment() argument 112 struct pci_controller *phb = pci_bus_to_host(bus); pcibios_window_alignment() 115 return phb->controller_ops.window_alignment(bus, type); pcibios_window_alignment() 127 struct pci_controller *phb = pci_bus_to_host(dev->bus); pcibios_reset_secondary_bus() 199 * Return the domain number for this bus. 201 int pci_domain_nr(struct pci_bus *bus) pci_domain_nr() argument 203 struct pci_controller *hose = pci_bus_to_host(bus); pci_domain_nr() 210 * PCI bus numbers have not yet been assigned, and you need to 288 * Platform support for /proc/bus/pci/X/Y mmap()s, 295 * corresponding to the 32-bit pci bus offset for DEV requested by the user. 300 * offset parameter of mmap on /proc/bus/pci/XXX for that device. 308 struct pci_controller *hose = pci_bus_to_host(dev->bus); __pci_mmap_make_offset() 442 * decisions on a per-device or per-bus basis. 469 /* This provides legacy IO read access on a bus */ pci_legacy_read() 470 int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size) pci_legacy_read() argument 473 struct pci_controller *hose = pci_bus_to_host(bus); pci_legacy_read() 477 /* Check if port can be supported by that bus. We only check pci_legacy_read() 478 * the ranges of the PHB though, not the bus itself as the rules pci_legacy_read() 509 /* This provides legacy IO write access on a bus */ pci_legacy_write() 510 int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, size_t size) pci_legacy_write() argument 513 struct pci_controller *hose = pci_bus_to_host(bus); pci_legacy_write() 517 /* Check if port can be supported by that bus. We only check pci_legacy_write() 518 * the ranges of the PHB though, not the bus itself as the rules pci_legacy_write() 554 /* This provides legacy IO or memory mmap access on a bus */ pci_mmap_legacy_page_range() 555 int pci_mmap_legacy_page_range(struct pci_bus *bus, pci_mmap_legacy_page_range() argument 559 struct pci_controller *hose = pci_bus_to_host(bus); pci_mmap_legacy_page_range() 566 pci_domain_nr(bus), bus->number, pci_mmap_legacy_page_range() 582 current->comm, current->pid, pci_domain_nr(bus), bus->number); pci_mmap_legacy_page_range() 611 struct pci_controller *hose = pci_bus_to_host(dev->bus); pci_resource_to_user() 650 * @primary: set if primary bus (32 bits only, soon to be deprecated) 773 int pci_proc_domain(struct pci_bus *bus) pci_proc_domain() argument 775 struct pci_controller *hose = pci_bus_to_host(bus); pci_proc_domain() 797 struct pci_controller *hose = pci_bus_to_host(dev->bus); pcibios_fixup_resources() 820 pcibios_resource_to_bus(dev->bus, ®, res); pcibios_fixup_resources() 855 static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus, pcibios_uninitialized_bridge_resource() argument 858 struct pci_controller *hose = pci_bus_to_host(bus); pcibios_uninitialized_bridge_resource() 859 struct pci_dev *dev = bus->self; pcibios_uninitialized_bridge_resource() 871 pcibios_resource_to_bus(dev->bus, ®ion, res); pcibios_uninitialized_bridge_resource() 921 static void pcibios_fixup_bridge(struct pci_bus *bus) pcibios_fixup_bridge() argument 926 struct pci_dev *dev = bus->self; pcibios_fixup_bridge() 928 pci_bus_for_each_resource(bus, res, i) { pci_bus_for_each_resource() 931 if (i >= 3 && bus->self->transparent) pci_bus_for_each_resource() 954 if (pcibios_uninitialized_bridge_resource(bus, res)) { pci_bus_for_each_resource() 961 void pcibios_setup_bus_self(struct pci_bus *bus) pcibios_setup_bus_self() argument 965 /* Fix up the bus resources for P2P bridges */ pcibios_setup_bus_self() 966 if (bus->self != NULL) pcibios_setup_bus_self() 967 pcibios_fixup_bridge(bus); pcibios_setup_bus_self() 969 /* Platform specific bus fixups. This is currently only used pcibios_setup_bus_self() 973 ppc_md.pcibios_fixup_bus(bus); pcibios_setup_bus_self() 975 /* Setup bus DMA mappings */ pcibios_setup_bus_self() 976 phb = pci_bus_to_host(bus); pcibios_setup_bus_self() 978 phb->controller_ops.dma_bus_setup(bus); pcibios_setup_bus_self() 987 set_dev_node(&dev->dev, pcibus_to_node(dev->bus)); pcibios_setup_device() 994 phb = pci_bus_to_host(dev->bus); pcibios_setup_device() 1007 * We can only call pcibios_setup_device() after bus setup is complete, pcibios_add_device() 1010 if (dev->bus->is_added) pcibios_add_device() 1021 void pcibios_setup_bus_devices(struct pci_bus *bus) pcibios_setup_bus_devices() argument 1025 pr_debug("PCI: Fixup bus devices %d (%s)\n", pcibios_setup_bus_devices() 1026 bus->number, bus->self ? pci_name(bus->self) : "PHB"); pcibios_setup_bus_devices() 1028 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_setup_bus_devices() 1029 /* Cardbus can call us to add new devices to a bus, so ignore pcibios_setup_bus_devices() 1041 /* No special bus mastering setup handling */ pcibios_set_master() 1044 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 1050 pci_read_bridge_bases(bus); pcibios_fixup_bus() 1052 /* Now fixup the bus bus */ pcibios_fixup_bus() 1053 pcibios_setup_bus_self(bus); pcibios_fixup_bus() 1055 /* Now fixup devices on that bus */ pcibios_fixup_bus() 1056 pcibios_setup_bus_devices(bus); pcibios_fixup_bus() 1060 void pci_fixup_cardbus(struct pci_bus *bus) pci_fixup_cardbus() argument 1062 /* Now fixup devices on that bus */ pci_fixup_cardbus() 1063 pcibios_setup_bus_devices(bus); pci_fixup_cardbus() 1070 !(dev->bus->bridge_ctl & PCI_BRIDGE_CTL_ISA)) skip_isa_ioresource_align() 1175 static void pcibios_allocate_bus_resources(struct pci_bus *bus) pcibios_allocate_bus_resources() argument 1181 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", pcibios_allocate_bus_resources() 1182 pci_domain_nr(bus), bus->number); pcibios_allocate_bus_resources() 1184 pci_bus_for_each_resource(bus, res, i) { pci_bus_for_each_resource() 1192 if (bus->parent == NULL) pci_bus_for_each_resource() 1196 pr = pci_find_parent_resource(bus->self, res); pci_bus_for_each_resource() 1206 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx " pci_bus_for_each_resource() 1208 bus->self ? pci_name(bus->self) : "PHB", pci_bus_for_each_resource() 1209 bus->number, i, pci_bus_for_each_resource() 1216 struct pci_dev *dev = bus->self; pci_bus_for_each_resource() 1234 "%d of PCI bridge %d, will remap\n", i, bus->number); pci_bus_for_each_resource() 1247 list_for_each_entry(b, &bus->children, node) 1326 static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus) pcibios_reserve_legacy_regions() argument 1328 struct pci_controller *hose = pci_bus_to_host(bus); pcibios_reserve_legacy_regions() 1333 pr_debug("Reserving legacy ranges for domain %04x\n", pci_domain_nr(bus)); pcibios_reserve_legacy_regions() 1349 pci_domain_nr(bus), bus->number, res); pcibios_reserve_legacy_regions() 1377 pci_domain_nr(bus), bus->number, res); pcibios_reserve_legacy_regions() 1394 * bus available resources to avoid allocating things on top of them pcibios_resource_survey() 1419 void pcibios_claim_one_bus(struct pci_bus *bus) pcibios_claim_one_bus() argument 1424 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_claim_one_bus() 1447 list_for_each_entry(child_bus, &bus->children, node) pcibios_claim_one_bus() 1455 * added to a bus, this include calling it for a PHB that is just 1458 void pcibios_finish_adding_to_bus(struct pci_bus *bus) pcibios_finish_adding_to_bus() argument 1460 pr_debug("PCI: Finishing adding to hotplug bus %04x:%02x\n", pcibios_finish_adding_to_bus() 1461 pci_domain_nr(bus), bus->number); pcibios_finish_adding_to_bus() 1463 /* Allocate bus and devices resources */ pcibios_finish_adding_to_bus() 1464 pcibios_allocate_bus_resources(bus); pcibios_finish_adding_to_bus() 1465 pcibios_claim_one_bus(bus); pcibios_finish_adding_to_bus() 1467 pci_assign_unassigned_bus_resources(bus); pcibios_finish_adding_to_bus() 1470 eeh_add_device_tree_late(bus); pcibios_finish_adding_to_bus() 1473 pci_bus_add_devices(bus); pcibios_finish_adding_to_bus() 1476 eeh_add_sysfs_files(bus); pcibios_finish_adding_to_bus() 1482 struct pci_controller *phb = pci_bus_to_host(dev->bus); pcibios_enable_device() 1556 null_read_config(struct pci_bus *bus, unsigned int devfn, int offset, null_read_config() argument 1563 null_write_config(struct pci_bus *bus, unsigned int devfn, int offset, null_write_config() argument 1582 static struct pci_bus bus; fake_pci_bus() local 1585 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr); fake_pci_bus() 1587 bus.number = busnr; fake_pci_bus() 1588 bus.sysdata = hose; fake_pci_bus() 1589 bus.ops = hose? hose->ops: &null_pci_ops; fake_pci_bus() 1590 return &bus; fake_pci_bus() 1594 int early_##rw##_config_##size(struct pci_controller *hose, int bus, \ 1597 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \ 1608 int early_find_capability(struct pci_controller *hose, int bus, int devfn, EARLY_PCI_OP() 1611 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); EARLY_PCI_OP() 1614 struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) pcibios_get_phb_of_node() argument 1616 struct pci_controller *hose = bus->sysdata; pcibios_get_phb_of_node() 1622 * pci_scan_phb - Given a pci_controller, setup and scan the PCI bus 1628 struct pci_bus *bus; pcibios_scan_phb() local 1637 /* Wire up PHB bus resources */ pcibios_scan_phb() 1645 /* Create an empty bus for the toplevel */ pcibios_scan_phb() 1646 bus = pci_create_root_bus(hose->parent, hose->first_busno, pcibios_scan_phb() 1648 if (bus == NULL) { pcibios_scan_phb() 1649 pr_err("Failed to create bus for PCI domain %04x\n", pcibios_scan_phb() 1654 hose->bus = bus; pcibios_scan_phb() 1659 mode = hose->controller_ops.probe_mode(bus); pcibios_scan_phb() 1662 of_scan_bus(node, bus); pcibios_scan_phb() 1665 pci_bus_update_busn_res_end(bus, 255); pcibios_scan_phb() 1666 hose->last_busno = pci_scan_child_bus(bus); pcibios_scan_phb() 1667 pci_bus_update_busn_res_end(bus, hose->last_busno); pcibios_scan_phb() 1677 if (bus && !pci_has_flag(PCI_PROBE_ONLY)) { pcibios_scan_phb() 1679 list_for_each_entry(child, &bus->children, node) pcibios_scan_phb() 1694 (dev->bus->parent == NULL)) { fixup_hide_host_resource_fsl()
|
/linux-4.1.27/drivers/media/pci/cx25821/ |
H A D | cx25821-i2c.c | 36 MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); 52 struct cx25821_i2c *bus = i2c_adap->algo_data; i2c_slave_did_ack() local 53 struct cx25821_dev *dev = bus->dev; i2c_slave_did_ack() 54 return cx_read(bus->reg_stat) & 0x01; i2c_slave_did_ack() 59 struct cx25821_i2c *bus = i2c_adap->algo_data; i2c_is_busy() local 60 struct cx25821_dev *dev = bus->dev; i2c_is_busy() 61 return cx_read(bus->reg_stat) & 0x02 ? 1 : 0; i2c_is_busy() 83 struct cx25821_i2c *bus = i2c_adap->algo_data; i2c_sendbytes() local 84 struct cx25821_dev *dev = bus->dev; i2c_sendbytes() 96 cx_write(bus->reg_addr, msg->addr << 25); i2c_sendbytes() 97 cx_write(bus->reg_ctrl, bus->i2c_period | (1 << 2)); i2c_sendbytes() 113 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); i2c_sendbytes() 120 cx_write(bus->reg_addr, addr); i2c_sendbytes() 121 cx_write(bus->reg_wdata, wdata); i2c_sendbytes() 122 cx_write(bus->reg_ctrl, ctrl); i2c_sendbytes() 139 ctrl = bus->i2c_period | (1 << 12) | (1 << 2); i2c_sendbytes() 146 cx_write(bus->reg_addr, addr); i2c_sendbytes() 147 cx_write(bus->reg_wdata, wdata); i2c_sendbytes() 148 cx_write(bus->reg_ctrl, ctrl); i2c_sendbytes() 177 struct cx25821_i2c *bus = i2c_adap->algo_data; i2c_readbytes() local 178 struct cx25821_dev *dev = bus->dev; i2c_readbytes() 187 cx_write(bus->reg_addr, msg->addr << 25); i2c_readbytes() 188 cx_write(bus->reg_ctrl, bus->i2c_period | (1 << 2) | 1); i2c_readbytes() 207 ctrl = bus->i2c_period | (1 << 12) | (1 << 2) | 1; i2c_readbytes() 212 cx_write(bus->reg_addr, msg->addr << 25); i2c_readbytes() 213 cx_write(bus->reg_ctrl, ctrl); i2c_readbytes() 220 msg->buf[cnt] = cx_read(bus->reg_rdata) & 0xff; i2c_readbytes() 240 struct cx25821_i2c *bus = i2c_adap->algo_data; i2c_xfer() local 241 struct cx25821_dev *dev = bus->dev; i2c_xfer() 303 int cx25821_i2c_register(struct cx25821_i2c *bus) cx25821_i2c_register() argument 305 struct cx25821_dev *dev = bus->dev; cx25821_i2c_register() 307 dprintk(1, "%s(bus = %d)\n", __func__, bus->nr); cx25821_i2c_register() 309 bus->i2c_adap = cx25821_i2c_adap_template; cx25821_i2c_register() 310 bus->i2c_client = cx25821_i2c_client_template; cx25821_i2c_register() 311 bus->i2c_adap.dev.parent = &dev->pci->dev; cx25821_i2c_register() 313 strlcpy(bus->i2c_adap.name, bus->dev->name, sizeof(bus->i2c_adap.name)); cx25821_i2c_register() 315 bus->i2c_adap.algo_data = bus; cx25821_i2c_register() 316 i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev); cx25821_i2c_register() 317 i2c_add_adapter(&bus->i2c_adap); cx25821_i2c_register() 319 bus->i2c_client.adapter = &bus->i2c_adap; cx25821_i2c_register() 322 bus->i2c_client.addr = (0x88 >> 1); cx25821_i2c_register() 324 return bus->i2c_rc; cx25821_i2c_register() 327 int cx25821_i2c_unregister(struct cx25821_i2c *bus) cx25821_i2c_unregister() argument 329 i2c_del_adapter(&bus->i2c_adap); cx25821_i2c_unregister() 336 /* write 0 to bus 2 addr 0x144 via i2x_xfer() */ 358 int cx25821_i2c_read(struct cx25821_i2c *bus, u16 reg_addr, int *value) cx25821_i2c_read() argument 360 struct i2c_client *client = &bus->i2c_client; cx25821_i2c_read() 392 int cx25821_i2c_write(struct cx25821_i2c *bus, u16 reg_addr, int value) cx25821_i2c_write() argument 394 struct i2c_client *client = &bus->i2c_client; cx25821_i2c_write()
|
/linux-4.1.27/arch/mn10300/unit-asb2305/ |
H A D | pci.c | 32 * insert specific PCI bus resources instead of using the platform-level bus 33 * resources directly for the PCI root bus. 55 #define CONFIG_CMD(bus, devfn, where) \ 56 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 68 static inline int __query(const struct pci_bus *bus, unsigned int devfn) __query() argument 71 return bus->number == 0 && (devfn == PCI_DEVFN(0, 0)); __query() 72 return bus->number == 1; __query() 73 return bus->number == 0 && __query() 82 static int pci_ampci_read_config_byte(struct pci_bus *bus, unsigned int devfn, pci_ampci_read_config_byte() argument 87 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_read_config_byte() 91 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_read_config_byte() 94 if (__query(bus, devfn)) pci_ampci_read_config_byte() 95 __pcidebug("=> %02hx", bus, devfn, where, value); pci_ampci_read_config_byte() 102 static int pci_ampci_read_config_word(struct pci_bus *bus, unsigned int devfn, pci_ampci_read_config_word() argument 107 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_read_config_word() 111 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_read_config_word() 114 if (__query(bus, devfn)) pci_ampci_read_config_word() 115 __pcidebug("=> %04hx", bus, devfn, where, value); pci_ampci_read_config_word() 122 static int pci_ampci_read_config_dword(struct pci_bus *bus, unsigned int devfn, pci_ampci_read_config_dword() argument 127 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_read_config_dword() 131 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_read_config_dword() 134 if (__query(bus, devfn)) pci_ampci_read_config_dword() 135 __pcidebug("=> %08x", bus, devfn, where, value); pci_ampci_read_config_dword() 142 static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn, pci_ampci_write_config_byte() argument 147 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_write_config_byte() 151 if (bus->number == 0 && pci_ampci_write_config_byte() 154 __pcidebug("<= %02x", bus, devfn, where, value); pci_ampci_write_config_byte() 155 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_write_config_byte() 162 static int pci_ampci_write_config_word(struct pci_bus *bus, unsigned int devfn, pci_ampci_write_config_word() argument 167 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_write_config_word() 171 if (__query(bus, devfn)) pci_ampci_write_config_word() 172 __pcidebug("<= %04hx", bus, devfn, where, value); pci_ampci_write_config_word() 173 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_write_config_word() 180 static int pci_ampci_write_config_dword(struct pci_bus *bus, unsigned int devfn, pci_ampci_write_config_dword() argument 185 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_ampci_write_config_dword() 189 if (__query(bus, devfn)) pci_ampci_write_config_dword() 190 __pcidebug("<= %08x", bus, devfn, where, value); pci_ampci_write_config_dword() 191 CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where); pci_ampci_write_config_dword() 198 static int pci_ampci_read_config(struct pci_bus *bus, unsigned int devfn, pci_ampci_read_config() argument 203 return pci_ampci_read_config_byte(bus, devfn, where, val); pci_ampci_read_config() 205 return pci_ampci_read_config_word(bus, devfn, where, val); pci_ampci_read_config() 207 return pci_ampci_read_config_dword(bus, devfn, where, val); pci_ampci_read_config() 214 static int pci_ampci_write_config(struct pci_bus *bus, unsigned int devfn, pci_ampci_write_config() argument 219 return pci_ampci_write_config_byte(bus, devfn, where, val); pci_ampci_write_config() 221 return pci_ampci_write_config_word(bus, devfn, where, val); pci_ampci_write_config() 223 return pci_ampci_write_config_dword(bus, devfn, where, val); pci_ampci_write_config() 238 * whether bus 00 contains a host bridge (this is similar to checking 247 struct pci_bus bus; /* Fake bus and device */ pci_sanity_check() local 250 bus.number = 0; pci_sanity_check() 252 if ((!o->read(&bus, 0, PCI_CLASS_DEVICE, 2, &x) && pci_sanity_check() 254 (!o->read(&bus, 0, PCI_VENDOR_ID, 2, &x) && pci_sanity_check() 288 if (!dev->bus) pcibios_fixup_device_resources() 305 if (!dev->bus) pcibios_fixup_bridge_resources() 319 * Called after each bus is probed, but before its children 322 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 326 if (bus->self) { pcibios_fixup_bus() 327 pci_read_bridge_bases(bus); pcibios_fixup_bus() 328 pcibios_fixup_bridge_resources(bus->self); pcibios_fixup_bus() 331 list_for_each_entry(dev, &bus->devices, bus_list) pcibios_fixup_bus() 345 struct pci_bus *bus; pcibios_init() local 361 printk(KERN_WARNING "PCI: No PCI bus detected\n"); pcibios_init() 375 bus = pci_scan_root_bus(NULL, 0, &pci_direct_ampci, NULL, &resources); pcibios_init() 376 if (!bus) pcibios_init() 382 pci_bus_add_devices(bus); pcibios_init() 411 static void __init unit_disable_pcnet(struct pci_bus *bus, struct pci_ops *o) unit_disable_pcnet() argument 415 bus->number = 0; unit_disable_pcnet() 417 o->read (bus, PCI_DEVFN(2, 0), PCI_VENDOR_ID, 4, &x); unit_disable_pcnet() 418 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); unit_disable_pcnet() 422 o->write(bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, x); unit_disable_pcnet() 423 o->read (bus, PCI_DEVFN(2, 0), PCI_COMMAND, 2, &x); unit_disable_pcnet() 424 o->write(bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, 0x00030001); unit_disable_pcnet() 425 o->read (bus, PCI_DEVFN(2, 0), PCI_BASE_ADDRESS_0, 4, &x); unit_disable_pcnet() 450 struct pci_bus bus; /* Fake bus and device */ unit_pci_init() local 456 memset(&bus, 0, sizeof(bus)); unit_pci_init() 471 BRIDGEREGB(0x41) = 0x00; /* secondary bus unit_pci_init() 473 BRIDGEREGB(0x42) = 0x01; /* subordinate bus unit_pci_init() 481 bus.number = 0; unit_pci_init() 484 o->read (&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, &x); unit_pci_init() 488 o->write(&bus, PCI_DEVFN(3, 0), PCI_COMMAND, 2, x); unit_pci_init() 490 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); unit_pci_init() 491 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); unit_pci_init() 492 o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); unit_pci_init() 493 o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); unit_pci_init() 495 o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, 0x01); unit_pci_init() 496 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE, 1, &x); unit_pci_init() 497 o->write(&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, 0x00020000); unit_pci_init() 498 o->read (&bus, PCI_DEVFN(3, 0), PCI_IO_BASE_UPPER16, 4, &x); unit_pci_init() 499 o->write(&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, 0xEBB0EA00); unit_pci_init() 500 o->read (&bus, PCI_DEVFN(3, 0), PCI_MEMORY_BASE, 4, &x); unit_pci_init() 501 o->write(&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, 0xE9F0E800); unit_pci_init() 502 o->read (&bus, PCI_DEVFN(3, 0), PCI_PREF_MEMORY_BASE, 4, &x); unit_pci_init() 504 unit_disable_pcnet(&bus, o); unit_pci_init()
|
/linux-4.1.27/drivers/base/ |
H A D | bus.c | 2 * bus.c - bus driver management 39 static struct bus_type *bus_get(struct bus_type *bus) bus_get() argument 41 if (bus) { bus_get() 42 kset_get(&bus->p->subsys); bus_get() 43 return bus; bus_get() 48 static void bus_put(struct bus_type *bus) bus_put() argument 50 if (bus) bus_put() 51 kset_put(&bus->p->subsys); bus_put() 107 ret = bus_attr->show(subsys_priv->bus, buf); bus_attr_show() 119 ret = bus_attr->store(subsys_priv->bus, buf, count); bus_attr_store() 128 int bus_create_file(struct bus_type *bus, struct bus_attribute *attr) bus_create_file() argument 131 if (bus_get(bus)) { bus_create_file() 132 error = sysfs_create_file(&bus->p->subsys.kobj, &attr->attr); bus_create_file() 133 bus_put(bus); bus_create_file() 140 void bus_remove_file(struct bus_type *bus, struct bus_attribute *attr) bus_remove_file() argument 142 if (bus_get(bus)) { bus_remove_file() 143 sysfs_remove_file(&bus->p->subsys.kobj, &attr->attr); bus_remove_file() 144 bus_put(bus); bus_remove_file() 153 struct bus_type *bus = priv->bus; bus_release() local 156 bus->p = NULL; bus_release() 183 struct bus_type *bus = bus_get(drv->bus); unbind_store() local 187 dev = bus_find_device_by_name(bus, NULL, buf); unbind_store() 197 bus_put(bus); unbind_store() 210 struct bus_type *bus = bus_get(drv->bus); bind_store() local 214 dev = bus_find_device_by_name(bus, NULL, buf); bind_store() 233 bus_put(bus); bind_store() 238 static ssize_t show_drivers_autoprobe(struct bus_type *bus, char *buf) show_drivers_autoprobe() argument 240 return sprintf(buf, "%d\n", bus->p->drivers_autoprobe); show_drivers_autoprobe() 243 static ssize_t store_drivers_autoprobe(struct bus_type *bus, store_drivers_autoprobe() argument 247 bus->p->drivers_autoprobe = 0; store_drivers_autoprobe() 249 bus->p->drivers_autoprobe = 1; store_drivers_autoprobe() 253 static ssize_t store_drivers_probe(struct bus_type *bus, store_drivers_probe() argument 259 dev = bus_find_device_by_name(bus, NULL, buf); store_drivers_probe() 283 * @bus: bus type. 288 * Iterate over @bus's list of devices, and call @fn for each, 300 int bus_for_each_dev(struct bus_type *bus, struct device *start, bus_for_each_dev() argument 307 if (!bus || !bus->p) bus_for_each_dev() 310 klist_iter_init_node(&bus->p->klist_devices, &i, bus_for_each_dev() 321 * @bus: bus type 334 struct device *bus_find_device(struct bus_type *bus, bus_find_device() argument 341 if (!bus || !bus->p) bus_find_device() 344 klist_iter_init_node(&bus->p->klist_devices, &i, bus_find_device() 363 * @bus: bus type 371 struct device *bus_find_device_by_name(struct bus_type *bus, bus_find_device_by_name() argument 374 return bus_find_device(bus, start, (void *)name, match_name); bus_find_device_by_name() 433 * @bus: bus we're dealing with. 439 * We iterate over each driver that belongs to @bus, and call 450 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, bus_for_each_drv() argument 457 if (!bus) bus_for_each_drv() 460 klist_iter_init_node(&bus->p->klist_drivers, &i, bus_for_each_drv() 469 static int device_add_attrs(struct bus_type *bus, struct device *dev) device_add_attrs() argument 474 if (!bus->dev_attrs) device_add_attrs() 477 for (i = 0; bus->dev_attrs[i].attr.name; i++) { device_add_attrs() 478 error = device_create_file(dev, &bus->dev_attrs[i]); device_add_attrs() 481 device_remove_file(dev, &bus->dev_attrs[i]); device_add_attrs() 488 static void device_remove_attrs(struct bus_type *bus, struct device *dev) device_remove_attrs() argument 492 if (bus->dev_attrs) { device_remove_attrs() 493 for (i = 0; bus->dev_attrs[i].attr.name; i++) device_remove_attrs() 494 device_remove_file(dev, &bus->dev_attrs[i]); device_remove_attrs() 499 * bus_add_device - add device to bus 502 * - Add device's bus attributes. 503 * - Create links to device's bus. 504 * - Add the device to its bus's list of devices. 508 struct bus_type *bus = bus_get(dev->bus); bus_add_device() local 511 if (bus) { bus_add_device() 512 pr_debug("bus: '%s': add device %s\n", bus->name, dev_name(dev)); bus_add_device() 513 error = device_add_attrs(bus, dev); bus_add_device() 516 error = device_add_groups(dev, bus->dev_groups); bus_add_device() 519 error = sysfs_create_link(&bus->p->devices_kset->kobj, bus_add_device() 524 &dev->bus->p->subsys.kobj, "subsystem"); bus_add_device() 527 klist_add_tail(&dev->p->knode_bus, &bus->p->klist_devices); bus_add_device() 532 sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev)); bus_add_device() 534 device_remove_groups(dev, bus->dev_groups); bus_add_device() 536 device_remove_attrs(bus, dev); bus_add_device() 538 bus_put(dev->bus); bus_add_device() 546 * - Automatically probe for a driver if the bus allows it. 550 struct bus_type *bus = dev->bus; bus_probe_device() local 554 if (!bus) bus_probe_device() 557 if (bus->p->drivers_autoprobe) { bus_probe_device() 562 mutex_lock(&bus->p->mutex); bus_probe_device() 563 list_for_each_entry(sif, &bus->p->interfaces, node) bus_probe_device() 566 mutex_unlock(&bus->p->mutex); bus_probe_device() 570 * bus_remove_device - remove device from bus 574 * - Remove symlink from bus' directory. 575 * - Delete device from bus's list. 581 struct bus_type *bus = dev->bus; bus_remove_device() local 584 if (!bus) bus_remove_device() 587 mutex_lock(&bus->p->mutex); bus_remove_device() 588 list_for_each_entry(sif, &bus->p->interfaces, node) bus_remove_device() 591 mutex_unlock(&bus->p->mutex); bus_remove_device() 594 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, bus_remove_device() 596 device_remove_attrs(dev->bus, dev); bus_remove_device() 597 device_remove_groups(dev, dev->bus->dev_groups); bus_remove_device() 601 pr_debug("bus: '%s': remove device %s\n", bus_remove_device() 602 dev->bus->name, dev_name(dev)); bus_remove_device() 604 bus_put(dev->bus); bus_remove_device() 630 static int add_probe_files(struct bus_type *bus) add_probe_files() argument 634 retval = bus_create_file(bus, &bus_attr_drivers_probe); add_probe_files() 638 retval = bus_create_file(bus, &bus_attr_drivers_autoprobe); add_probe_files() 640 bus_remove_file(bus, &bus_attr_drivers_probe); add_probe_files() 645 static void remove_probe_files(struct bus_type *bus) remove_probe_files() argument 647 bus_remove_file(bus, &bus_attr_drivers_autoprobe); remove_probe_files() 648 bus_remove_file(bus, &bus_attr_drivers_probe); remove_probe_files() 663 * bus_add_driver - Add a driver to the bus. 668 struct bus_type *bus; bus_add_driver() local 672 bus = bus_get(drv->bus); bus_add_driver() 673 if (!bus) bus_add_driver() 676 pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name); bus_add_driver() 686 priv->kobj.kset = bus->p->drivers_kset; bus_add_driver() 692 klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers); bus_add_driver() 693 if (drv->bus->p->drivers_autoprobe) { bus_add_driver() 705 error = driver_add_groups(drv, bus->drv_groups); bus_add_driver() 728 bus_put(bus); bus_add_driver() 733 * bus_remove_driver - delete driver from bus's knowledge. 737 * it from its bus's list of drivers. Finally, we drop the reference 738 * to the bus we took in bus_add_driver(). 742 if (!drv->bus) bus_remove_driver() 747 driver_remove_groups(drv, drv->bus->drv_groups); bus_remove_driver() 750 pr_debug("bus: '%s': remove driver %s\n", drv->bus->name, drv->name); bus_remove_driver() 754 bus_put(drv->bus); bus_remove_driver() 774 * bus_rescan_devices - rescan devices on the bus for possible drivers 775 * @bus: the bus to scan. 777 * This function will look for devices on the bus with no driver 781 int bus_rescan_devices(struct bus_type *bus) bus_rescan_devices() argument 783 return bus_for_each_dev(bus, NULL, NULL, bus_rescan_devices_helper); bus_rescan_devices() 810 * find_bus - locate bus by name. 811 * @name: name of bus. 814 * find a bus by name. Return bus if found. 816 * Note that kset_find_obj increments bus' reference count. 826 static int bus_add_groups(struct bus_type *bus, bus_add_groups() argument 829 return sysfs_create_groups(&bus->p->subsys.kobj, groups); bus_add_groups() 832 static void bus_remove_groups(struct bus_type *bus, bus_remove_groups() argument 835 sysfs_remove_groups(&bus->p->subsys.kobj, groups); bus_remove_groups() 854 static ssize_t bus_uevent_store(struct bus_type *bus, bus_uevent_store() argument 860 kobject_uevent(&bus->p->subsys.kobj, action); bus_uevent_store() 867 * @bus: bus to register 869 * Once we have that, we register the bus with the kobject 873 int bus_register(struct bus_type *bus) bus_register() argument 877 struct lock_class_key *key = &bus->lock_key; bus_register() 883 priv->bus = bus; bus_register() 884 bus->p = priv; bus_register() 888 retval = kobject_set_name(&priv->subsys.kobj, "%s", bus->name); bus_register() 900 retval = bus_create_file(bus, &bus_attr_uevent); bus_register() 923 retval = add_probe_files(bus); bus_register() 927 retval = bus_add_groups(bus, bus->bus_groups); bus_register() 931 pr_debug("bus: '%s': registered\n", bus->name); bus_register() 935 remove_probe_files(bus); bus_register() 937 kset_unregister(bus->p->drivers_kset); bus_register() 939 kset_unregister(bus->p->devices_kset); bus_register() 941 bus_remove_file(bus, &bus_attr_uevent); bus_register() 943 kset_unregister(&bus->p->subsys); bus_register() 945 kfree(bus->p); bus_register() 946 bus->p = NULL; bus_register() 952 * bus_unregister - remove a bus from the system 953 * @bus: bus. 955 * Unregister the child subsystems and the bus itself. 958 void bus_unregister(struct bus_type *bus) bus_unregister() argument 960 pr_debug("bus: '%s': unregistering\n", bus->name); bus_unregister() 961 if (bus->dev_root) bus_unregister() 962 device_unregister(bus->dev_root); bus_unregister() 963 bus_remove_groups(bus, bus->bus_groups); bus_unregister() 964 remove_probe_files(bus); bus_unregister() 965 kset_unregister(bus->p->drivers_kset); bus_unregister() 966 kset_unregister(bus->p->devices_kset); bus_unregister() 967 bus_remove_file(bus, &bus_attr_uevent); bus_unregister() 968 kset_unregister(&bus->p->subsys); bus_unregister() 972 int bus_register_notifier(struct bus_type *bus, struct notifier_block *nb) bus_register_notifier() argument 974 return blocking_notifier_chain_register(&bus->p->bus_notifier, nb); bus_register_notifier() 978 int bus_unregister_notifier(struct bus_type *bus, struct notifier_block *nb) bus_unregister_notifier() argument 980 return blocking_notifier_chain_unregister(&bus->p->bus_notifier, nb); bus_unregister_notifier() 984 struct kset *bus_get_kset(struct bus_type *bus) bus_get_kset() argument 986 return &bus->p->subsys; bus_get_kset() 990 struct klist *bus_get_device_klist(struct bus_type *bus) bus_get_device_klist() argument 992 return &bus->p->klist_devices; bus_get_device_klist() 1025 void bus_sort_breadthfirst(struct bus_type *bus, bus_sort_breadthfirst() argument 1036 device_klist = bus_get_device_klist(bus); bus_sort_breadthfirst() 1265 bus_kset = kset_create_and_add("bus", &bus_uevent_ops, NULL); buses_init()
|
/linux-4.1.27/include/linux/bcma/ |
H A D | bcma_soc.h | 7 struct bcma_bus bus; member in struct:bcma_soc 13 int bcma_bus_register(struct bcma_bus *bus);
|
/linux-4.1.27/include/sound/ |
H A D | i2c.h | 28 struct snd_i2c_bus *bus; /* I2C bus */ member in struct:snd_i2c_device 40 void (*start)(struct snd_i2c_bus *bus); /* transfer start */ 41 void (*stop)(struct snd_i2c_bus *bus); /* transfer stop */ 42 void (*direction)(struct snd_i2c_bus *bus, int clock, int data); /* set line direction (0 = write, 1 = read) */ 43 void (*setlines)(struct snd_i2c_bus *bus, int clock, int data); 44 int (*getclock)(struct snd_i2c_bus *bus); 45 int (*getdata)(struct snd_i2c_bus *bus, int ack); 51 int (*probeaddr)(struct snd_i2c_bus *bus, unsigned short addr); 60 struct snd_i2c_bus *master; /* master bus when SCK/SCL is shared */ 63 struct list_head devices; /* attached devices to this bus */ 73 void (*private_free)(struct snd_i2c_bus *bus); 80 int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name, 84 static inline void snd_i2c_lock(struct snd_i2c_bus *bus) snd_i2c_lock() argument 86 if (bus->master) snd_i2c_lock() 87 mutex_lock(&bus->master->lock_mutex); snd_i2c_lock() 89 mutex_lock(&bus->lock_mutex); snd_i2c_lock() 92 static inline void snd_i2c_unlock(struct snd_i2c_bus *bus) snd_i2c_unlock() argument 94 if (bus->master) snd_i2c_unlock() 95 mutex_unlock(&bus->master->lock_mutex); snd_i2c_unlock() 97 mutex_unlock(&bus->lock_mutex); snd_i2c_unlock() 102 int snd_i2c_probeaddr(struct snd_i2c_bus *bus, unsigned short addr);
|
/linux-4.1.27/drivers/gpu/host1x/ |
H A D | Makefile | 2 bus.o \
|
/linux-4.1.27/drivers/w1/ |
H A D | Makefile | 2 # Makefile for the Dallas's 1-wire bus.
|
/linux-4.1.27/arch/powerpc/sysdev/ |
H A D | mpc5xxx_clocks.c | 2 * mpc5xxx_get_bus_frequency - Find the bus frequency for a device 5 * Returns bus frequency (IPS on MPC512x, IPB on MPC52xx), 6 * or 0 if the bus frequency cannot be found. 21 p_bus_freq = of_get_property(node, "bus-frequency", NULL); mpc5xxx_get_bus_frequency()
|
H A D | xilinx_pci.c | 43 if (dev->devfn || dev->bus->self) xilinx_pci_fixup_bridge() 46 hose = pci_bus_to_host(dev->bus); xilinx_pci_fixup_bridge() 68 * xilinx_pci_exclude_device - Don't do config access for non-root bus 70 * This is a hack. Config access to any bus other than bus 0 does not 74 xilinx_pci_exclude_device(struct pci_controller *hose, u_char bus, u8 devfn) xilinx_pci_exclude_device() argument 76 return (bus != 0); xilinx_pci_exclude_device() 110 * a self-init when the bus master enable bit is set. Without this bit xilinx_pci_init() 111 * set the pci bus can't be scanned. xilinx_pci_init() 118 /* Set the max bus number to 255 */ xilinx_pci_init() 124 * exclude config access to anything except bus 0 */ xilinx_pci_init()
|
/linux-4.1.27/arch/powerpc/platforms/powermac/ |
H A D | low_i2c.c | 76 * A bus structure. Each bus in the system has such a structure associated. 95 int (*open)(struct pmac_i2c_bus *bus); 96 void (*close)(struct pmac_i2c_bus *bus); 97 int (*xfer)(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, 386 static int kw_i2c_open(struct pmac_i2c_bus *bus) kw_i2c_open() argument 388 struct pmac_i2c_host_kw *host = bus->hostdata; kw_i2c_open() 393 static void kw_i2c_close(struct pmac_i2c_bus *bus) kw_i2c_close() argument 395 struct pmac_i2c_host_kw *host = bus->hostdata; kw_i2c_close() 399 static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, kw_i2c_xfer() argument 402 struct pmac_i2c_host_kw *host = bus->hostdata; kw_i2c_xfer() 404 int use_irq = host->irq != NO_IRQ && !bus->polled; kw_i2c_xfer() 407 switch(bus->mode) { kw_i2c_xfer() 429 kw_write_reg(reg_mode, mode_reg | (bus->channel << 4)); kw_i2c_xfer() 432 /* Set up address and r/w bit, strip possible stale bus number from kw_i2c_xfer() 448 host->polled = bus->polled; kw_i2c_xfer() 574 struct pmac_i2c_bus *bus; kw_i2c_add() local 576 bus = kzalloc(sizeof(struct pmac_i2c_bus), GFP_KERNEL); kw_i2c_add() 577 if (bus == NULL) kw_i2c_add() 580 bus->controller = of_node_get(controller); kw_i2c_add() 581 bus->busnode = of_node_get(busnode); kw_i2c_add() 582 bus->type = pmac_i2c_bus_keywest; kw_i2c_add() 583 bus->hostdata = host; kw_i2c_add() 584 bus->channel = channel; kw_i2c_add() 585 bus->mode = pmac_i2c_mode_std; kw_i2c_add() 586 bus->open = kw_i2c_open; kw_i2c_add() 587 bus->close = kw_i2c_close; kw_i2c_add() 588 bus->xfer = kw_i2c_xfer; kw_i2c_add() 589 mutex_init(&bus->mutex); kw_i2c_add() 591 bus->flags = pmac_i2c_multibus; kw_i2c_add() 592 list_add(&bus->link, &pmac_i2c_busses); kw_i2c_add() 594 printk(KERN_INFO " channel %d bus %s\n", channel, kw_i2c_add() 613 * have proper bus nodes. Note that the "new" way (proper bus kw_i2c_probe() 620 multibus = !child || strcmp(child->name, "i2c-bus"); kw_i2c_probe() 623 /* For a multibus setup, we get the bus count based on the kw_i2c_probe() 661 u8 bus; member in struct:pmu_i2c_hdr 676 static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, pmu_i2c_xfer() argument 679 struct adb_request *req = bus->hostdata; pmu_i2c_xfer() 694 hdr->bus = bus->channel; pmu_i2c_xfer() 697 switch(bus->mode) { pmu_i2c_xfer() 711 if (bus->mode == pmac_i2c_mode_stdsub) pmu_i2c_xfer() 749 hdr->bus = PMU_I2C_BUS_STATUS; pmu_i2c_xfer() 782 struct pmac_i2c_bus *bus; pmu_i2c_probe() local 791 * with separate bus nodes, so we assume a multibus setup pmu_i2c_probe() 802 * We add bus 1 and 2 only for now, bus 0 is "special" pmu_i2c_probe() 806 bus = kzalloc(sz, GFP_KERNEL); pmu_i2c_probe() 807 if (bus == NULL) pmu_i2c_probe() 810 bus->controller = busnode; pmu_i2c_probe() 811 bus->busnode = busnode; pmu_i2c_probe() 812 bus->type = pmac_i2c_bus_pmu; pmu_i2c_probe() 813 bus->channel = channel; pmu_i2c_probe() 814 bus->mode = pmac_i2c_mode_std; pmu_i2c_probe() 815 bus->hostdata = bus + 1; pmu_i2c_probe() 816 bus->xfer = pmu_i2c_xfer; pmu_i2c_probe() 817 mutex_init(&bus->mutex); pmu_i2c_probe() 818 bus->flags = pmac_i2c_multibus; pmu_i2c_probe() 819 list_add(&bus->link, &pmac_i2c_busses); pmu_i2c_probe() 821 printk(KERN_INFO " channel %d bus <multibus>\n", channel); pmu_i2c_probe() 841 static int smu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, smu_i2c_xfer() argument 844 struct smu_i2c_cmd *cmd = bus->hostdata; smu_i2c_xfer() 854 cmd->info.bus = bus->channel; smu_i2c_xfer() 858 switch(bus->mode) { smu_i2c_xfer() 872 if (bus->mode == pmac_i2c_mode_stdsub) smu_i2c_xfer() 900 struct pmac_i2c_bus *bus; smu_i2c_probe() local 922 strcmp(busnode->type, "i2c-bus")) smu_i2c_probe() 929 bus = kzalloc(sz, GFP_KERNEL); smu_i2c_probe() 930 if (bus == NULL) smu_i2c_probe() 933 bus->controller = controller; smu_i2c_probe() 934 bus->busnode = of_node_get(busnode); smu_i2c_probe() 935 bus->type = pmac_i2c_bus_smu; smu_i2c_probe() 936 bus->channel = *reg; smu_i2c_probe() 937 bus->mode = pmac_i2c_mode_std; smu_i2c_probe() 938 bus->hostdata = bus + 1; smu_i2c_probe() 939 bus->xfer = smu_i2c_xfer; smu_i2c_probe() 940 mutex_init(&bus->mutex); smu_i2c_probe() 941 bus->flags = 0; smu_i2c_probe() 942 list_add(&bus->link, &pmac_i2c_busses); smu_i2c_probe() 944 printk(KERN_INFO " channel %x bus %s\n", smu_i2c_probe() 945 bus->channel, busnode->full_name); smu_i2c_probe() 962 struct pmac_i2c_bus *bus; pmac_i2c_find_bus() local 965 list_for_each_entry(bus, &pmac_i2c_busses, link) { pmac_i2c_find_bus() 966 if (p == bus->busnode) { pmac_i2c_find_bus() 967 if (prev && bus->flags & pmac_i2c_multibus) { pmac_i2c_find_bus() 973 if (((*reg) >> 8) != bus->channel) pmac_i2c_find_bus() 978 return bus; pmac_i2c_find_bus() 1000 struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus) pmac_i2c_get_controller() argument 1002 return bus->controller; pmac_i2c_get_controller() 1006 struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus) pmac_i2c_get_bus_node() argument 1008 return bus->busnode; pmac_i2c_get_bus_node() 1012 int pmac_i2c_get_type(struct pmac_i2c_bus *bus) pmac_i2c_get_type() argument 1014 return bus->type; pmac_i2c_get_type() 1018 int pmac_i2c_get_flags(struct pmac_i2c_bus *bus) pmac_i2c_get_flags() argument 1020 return bus->flags; pmac_i2c_get_flags() 1024 int pmac_i2c_get_channel(struct pmac_i2c_bus *bus) pmac_i2c_get_channel() argument 1026 return bus->channel; pmac_i2c_get_channel() 1031 struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus) pmac_i2c_get_adapter() argument 1033 return &bus->adapter; pmac_i2c_get_adapter() 1039 struct pmac_i2c_bus *bus; pmac_i2c_adapter_to_bus() local 1041 list_for_each_entry(bus, &pmac_i2c_busses, link) pmac_i2c_adapter_to_bus() 1042 if (&bus->adapter == adapter) pmac_i2c_adapter_to_bus() 1043 return bus; pmac_i2c_adapter_to_bus() 1050 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev); pmac_i2c_match_adapter() local 1052 if (bus == NULL) pmac_i2c_match_adapter() 1054 return (&bus->adapter == adapter); pmac_i2c_match_adapter() 1060 struct pmac_i2c_bus *bus, *found = NULL; pmac_low_i2c_lock() local 1062 list_for_each_entry(bus, &pmac_i2c_busses, link) { pmac_low_i2c_lock() 1063 if (np == bus->controller) { pmac_low_i2c_lock() 1064 found = bus; pmac_low_i2c_lock() 1070 return pmac_i2c_open(bus, 0); pmac_low_i2c_lock() 1076 struct pmac_i2c_bus *bus, *found = NULL; pmac_low_i2c_unlock() local 1078 list_for_each_entry(bus, &pmac_i2c_busses, link) { pmac_low_i2c_unlock() 1079 if (np == bus->controller) { pmac_low_i2c_unlock() 1080 found = bus; pmac_low_i2c_unlock() 1086 pmac_i2c_close(bus); pmac_low_i2c_unlock() 1092 int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled) pmac_i2c_open() argument 1096 mutex_lock(&bus->mutex); pmac_i2c_open() 1097 bus->polled = polled || pmac_i2c_force_poll; pmac_i2c_open() 1098 bus->opened = 1; pmac_i2c_open() 1099 bus->mode = pmac_i2c_mode_std; pmac_i2c_open() 1100 if (bus->open && (rc = bus->open(bus)) != 0) { pmac_i2c_open() 1101 bus->opened = 0; pmac_i2c_open() 1102 mutex_unlock(&bus->mutex); pmac_i2c_open() 1109 void pmac_i2c_close(struct pmac_i2c_bus *bus) pmac_i2c_close() argument 1111 WARN_ON(!bus->opened); pmac_i2c_close() 1112 if (bus->close) pmac_i2c_close() 1113 bus->close(bus); pmac_i2c_close() 1114 bus->opened = 0; pmac_i2c_close() 1115 mutex_unlock(&bus->mutex); pmac_i2c_close() 1119 int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode) pmac_i2c_setmode() argument 1121 WARN_ON(!bus->opened); pmac_i2c_setmode() 1124 * "combined4" mode that I need to implement for the SMU bus pmac_i2c_setmode() 1128 " bus %s !\n", mode, bus->busnode->full_name); pmac_i2c_setmode() 1131 bus->mode = mode; pmac_i2c_setmode() 1137 int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize, pmac_i2c_xfer() argument 1142 WARN_ON(!bus->opened); pmac_i2c_xfer() 1145 " %d bytes, bus %s\n", bus->channel, addrdir, bus->mode, subsize, pmac_i2c_xfer() 1146 subaddr, len, bus->busnode->full_name); pmac_i2c_xfer() 1148 rc = bus->xfer(bus, addrdir, subsize, subaddr, data, len); pmac_i2c_xfer() 1167 struct pmac_i2c_bus *bus; pmac_i2c_devscan() local 1198 list_for_each_entry(bus, &pmac_i2c_busses, link) { pmac_i2c_devscan() 1200 (np = of_get_next_child(bus->busnode, np)) != NULL;) { pmac_i2c_devscan() 1202 /* If multibus, check if device is on that bus */ pmac_i2c_devscan() 1203 if (bus->flags & pmac_i2c_multibus) pmac_i2c_devscan() 1204 if (bus != pmac_i2c_find_bus(np)) pmac_i2c_devscan() 1225 struct pmac_i2c_bus *bus; member in struct:pmac_i2c_pf_inst 1236 struct pmac_i2c_bus *bus; pmac_i2c_do_begin() local 1238 bus = pmac_i2c_find_bus(func->node); pmac_i2c_do_begin() 1239 if (bus == NULL) { pmac_i2c_do_begin() 1240 printk(KERN_ERR "low_i2c: Can't find bus for %s (pfunc)\n", pmac_i2c_do_begin() 1244 if (pmac_i2c_open(bus, 0)) { pmac_i2c_do_begin() 1245 printk(KERN_ERR "low_i2c: Can't open i2c bus for %s (pfunc)\n", pmac_i2c_do_begin() 1257 pmac_i2c_close(bus); pmac_i2c_do_begin() 1260 inst->bus = bus; pmac_i2c_do_begin() 1272 pmac_i2c_close(inst->bus); pmac_i2c_do_end() 1281 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 0, 0, pmac_i2c_do_read() 1289 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0, pmac_i2c_do_write() 1326 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0, pmac_i2c_do_rmw() 1335 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 1, subaddr, pmac_i2c_do_read_sub() 1344 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1, pmac_i2c_do_write_sub() 1352 return pmac_i2c_setmode(inst->bus, mode); pmac_i2c_do_set_mode() 1367 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1, pmac_i2c_do_rmw_sub() 1490 struct pmac_i2c_bus *bus; pmac_i2c_create_platform_devices() local 1500 list_for_each_entry(bus, &pmac_i2c_busses, link) { pmac_i2c_create_platform_devices() 1501 bus->platform_dev = pmac_i2c_create_platform_devices() 1503 if (bus->platform_dev == NULL) pmac_i2c_create_platform_devices() 1505 bus->platform_dev->dev.platform_data = bus; pmac_i2c_create_platform_devices() 1506 bus->platform_dev->dev.of_node = bus->busnode; pmac_i2c_create_platform_devices() 1507 platform_device_add(bus->platform_dev); pmac_i2c_create_platform_devices()
|
/linux-4.1.27/include/linux/ |
H A D | pci-acpi.h | 29 struct pci_bus *pbus = pdev->bus; acpi_find_root_bridge_handle() 31 /* Find a PCI root bus */ acpi_find_root_bridge_handle() 45 /* If pbus is a virtual bus, there is no bridge to it */ acpi_pci_get_bridge_handle() 55 void acpi_pci_add_bus(struct pci_bus *bus); 56 void acpi_pci_remove_bus(struct pci_bus *bus); 60 void acpi_pci_slot_enumerate(struct pci_bus *bus); 61 void acpi_pci_slot_remove(struct pci_bus *bus); 64 static inline void acpi_pci_slot_enumerate(struct pci_bus *bus) { } acpi_pci_slot_remove() argument 65 static inline void acpi_pci_slot_remove(struct pci_bus *bus) { } acpi_pci_slot_remove() argument 70 void acpiphp_enumerate_slots(struct pci_bus *bus); acpi_pci_slot_remove() 71 void acpiphp_remove_slots(struct pci_bus *bus); acpi_pci_slot_remove() 75 static inline void acpiphp_enumerate_slots(struct pci_bus *bus) { } acpiphp_remove_slots() argument 76 static inline void acpiphp_remove_slots(struct pci_bus *bus) { } acpiphp_check_host_bridge() argument 86 static inline void acpi_pci_add_bus(struct pci_bus *bus) { } acpi_pci_remove_bus() argument 87 static inline void acpi_pci_remove_bus(struct pci_bus *bus) { } acpi_pci_remove_bus() argument
|
H A D | mcb.h | 26 * @bus_nr: mcb bus number 41 * @bus_list: internal list handling for bus code 43 * @bus: mcb bus the device is plugged to 45 * @is_added: flag to check if device is added to bus 59 struct mcb_bus *bus; member in struct:mcb_device 110 extern void mcb_bus_add_devices(const struct mcb_bus *bus); 111 extern int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev); 113 extern struct mcb_bus *mcb_bus_get(struct mcb_bus *bus); 114 extern void mcb_bus_put(struct mcb_bus *bus); 115 extern struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus); 117 extern void mcb_release_bus(struct mcb_bus *bus);
|
H A D | mdio-gpio.h | 2 * MDIO-GPIO bus platform data structures 17 /* GPIO numbers for bus pins */ 29 int (*reset)(struct mii_bus *bus);
|
H A D | mdio-bitbang.h | 36 int (*reset)(struct mii_bus *bus); 39 /* The returned bus is not yet registered with the phy layer. */ 42 /* The bus must already have been unregistered. */ 43 void free_mdio_bitbang(struct mii_bus *bus);
|
H A D | davinci_emac.h | 31 * - NULL : use the first phy on the bus, 33 * - "<bus>:<addr>" : use the specified bus and phy
|
H A D | mISDNdsp.h | 31 int pcm_id; /* unique id to identify the pcm bus (or -1) */ 32 int pcm_slots; /* number of slots on the pcm bus */ 33 int pcm_banks; /* number of IO banks of pcm bus */
|
/linux-4.1.27/drivers/net/ethernet/xilinx/ |
H A D | ll_temac_mdio.c | 2 * MDIO bus driver for the Xilinx TEMAC device 22 static int temac_mdio_read(struct mii_bus *bus, int phy_id, int reg) temac_mdio_read() argument 24 struct temac_local *lp = bus->priv; temac_mdio_read() 41 static int temac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val) temac_mdio_write() argument 43 struct temac_local *lp = bus->priv; temac_mdio_write() 61 struct mii_bus *bus; temac_mdio_setup() local 78 /* Enable the MDIO bus by asserting the enable bit and writing temac_mdio_setup() 84 bus = mdiobus_alloc(); temac_mdio_setup() 85 if (!bus) temac_mdio_setup() 89 snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx", temac_mdio_setup() 91 bus->priv = lp; temac_mdio_setup() 92 bus->name = "Xilinx TEMAC MDIO"; temac_mdio_setup() 93 bus->read = temac_mdio_read; temac_mdio_setup() 94 bus->write = temac_mdio_write; temac_mdio_setup() 95 bus->parent = lp->dev; temac_mdio_setup() 96 bus->irq = lp->mdio_irqs; /* preallocated IRQ table */ temac_mdio_setup() 98 lp->mii_bus = bus; temac_mdio_setup() 100 rc = of_mdiobus_register(bus, np); temac_mdio_setup() 105 dev_dbg(lp->dev, "MDIO bus registered; MC:%x\n", temac_mdio_setup() 111 mdiobus_free(bus); temac_mdio_setup()
|
H A D | xilinx_axienet_mdio.c | 2 * MDIO bus driver for the Xilinx Axi Ethernet device 36 * @bus: Pointer to mii bus structure 46 static int axienet_mdio_read(struct mii_bus *bus, int phy_id, int reg) axienet_mdio_read() argument 50 struct axienet_local *lp = bus->priv; axienet_mdio_read() 78 * @bus: Pointer to mii bus structure 89 static int axienet_mdio_write(struct mii_bus *bus, int phy_id, int reg, axienet_mdio_write() argument 93 struct axienet_local *lp = bus->priv; axienet_mdio_write() 123 * mdiobus_alloc (to allocate memory for mii bus structure) fails. 133 struct mii_bus *bus; axienet_mdio_setup() local 202 bus = mdiobus_alloc(); axienet_mdio_setup() 203 if (!bus) axienet_mdio_setup() 208 snprintf(bus->id, MII_BUS_ID_SIZE, "%.8llx", axienet_mdio_setup() 211 bus->priv = lp; axienet_mdio_setup() 212 bus->name = "Xilinx Axi Ethernet MDIO"; axienet_mdio_setup() 213 bus->read = axienet_mdio_read; axienet_mdio_setup() 214 bus->write = axienet_mdio_write; axienet_mdio_setup() 215 bus->parent = lp->dev; axienet_mdio_setup() 216 bus->irq = lp->mdio_irqs; /* preallocated IRQ table */ axienet_mdio_setup() 217 lp->mii_bus = bus; axienet_mdio_setup() 219 ret = of_mdiobus_register(bus, np1); axienet_mdio_setup() 221 mdiobus_free(bus); axienet_mdio_setup() 231 * Unregisters the MDIO and frees any associate memory for mii bus.
|
/linux-4.1.27/drivers/mcb/ |
H A D | mcb-core.c | 118 drv->driver.bus = &mcb_bus_type; __mcb_register_driver() 141 mcb_bus_put(mdev->bus); mcb_release_dev() 147 * @bus: The @mcb_bus of the device 152 int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev) mcb_device_register() argument 158 dev->dev.bus = &mcb_bus_type; mcb_device_register() 159 dev->dev.parent = bus->dev.parent; mcb_device_register() 164 bus->bus_nr, device_id, dev->inst, dev->group, dev->var); mcb_device_register() 168 pr_err("Failed registering device 16z%03d on bus mcb%d (%d)\n", mcb_device_register() 169 device_id, bus->bus_nr, ret); mcb_device_register() 188 struct mcb_bus *bus; mcb_alloc_bus() local 191 bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL); mcb_alloc_bus() 192 if (!bus) mcb_alloc_bus() 197 kfree(bus); mcb_alloc_bus() 201 INIT_LIST_HEAD(&bus->children); mcb_alloc_bus() 202 bus->bus_nr = bus_nr; mcb_alloc_bus() 203 bus->carrier = carrier; mcb_alloc_bus() 204 return bus; mcb_alloc_bus() 214 static void mcb_devices_unregister(struct mcb_bus *bus) mcb_devices_unregister() argument 220 * @bus: The @mcb_bus to release 224 void mcb_release_bus(struct mcb_bus *bus) mcb_release_bus() argument 226 mcb_devices_unregister(bus); mcb_release_bus() 228 ida_simple_remove(&mcb_ida, bus->bus_nr); mcb_release_bus() 230 kfree(bus); mcb_release_bus() 236 * @bus: The @mcb_bus 240 struct mcb_bus *mcb_bus_get(struct mcb_bus *bus) mcb_bus_get() argument 242 if (bus) mcb_bus_get() 243 get_device(&bus->dev); mcb_bus_get() 245 return bus; mcb_bus_get() 251 * @bus: The @mcb_bus 255 void mcb_bus_put(struct mcb_bus *bus) mcb_bus_put() argument 257 if (bus) mcb_bus_put() 258 put_device(&bus->dev); mcb_bus_put() 264 * @bus: The @mcb_bus the device is part of 266 * Allocate a @mcb_device and add bus. 268 struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus) mcb_alloc_dev() argument 277 dev->bus = bus; mcb_alloc_dev() 327 * mcb_bus_add_devices() - Add devices in the bus' internal device list 328 * @bus: The @mcb_bus we add the devices 330 * Add devices in the bus' internal device list to the system. 332 void mcb_bus_add_devices(const struct mcb_bus *bus) mcb_bus_add_devices() argument 396 struct mcb_bus *bus = dev->bus; mcb_get_irq() local 398 if (bus->get_irq) mcb_get_irq() 399 return bus->get_irq(dev); mcb_get_irq()
|
H A D | mcb-pci.c | 19 struct mcb_bus *bus; member in struct:priv 26 struct mcb_bus *mbus = mdev->bus; mcb_pci_get_irq() 82 priv->bus = mcb_alloc_bus(&pdev->dev); mcb_pci_probe() 83 if (IS_ERR(priv->bus)) { mcb_pci_probe() 84 ret = PTR_ERR(priv->bus); mcb_pci_probe() 88 priv->bus->get_irq = mcb_pci_get_irq; mcb_pci_probe() 90 ret = chameleon_parse_cells(priv->bus, priv->mapbase, priv->base); mcb_pci_probe() 97 mcb_bus_add_devices(priv->bus); mcb_pci_probe() 114 mcb_release_bus(priv->bus); mcb_pci_remove()
|
/linux-4.1.27/arch/powerpc/include/asm/ |
H A D | pmac_low_i2c.h | 30 /* i2c bus type */ 37 /* i2c bus features */ 42 /* multibus : device node holds multiple busses, bus number is 55 /* Lookup an i2c bus for a device-node. The node can be either the bus 56 * node itself or a device below it. In the case of a multibus, the bus 62 /* Get the address for an i2c device. This strips the bus number if 68 /* Get infos about a bus */ 69 extern struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus); 70 extern struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus); 71 extern int pmac_i2c_get_type(struct pmac_i2c_bus *bus); 72 extern int pmac_i2c_get_flags(struct pmac_i2c_bus *bus); 73 extern int pmac_i2c_get_channel(struct pmac_i2c_bus *bus); 76 extern struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus); 79 /* March a device or bus with an i2c adapter structure, to be used by drivers 92 extern int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled); 93 extern void pmac_i2c_close(struct pmac_i2c_bus *bus); 94 extern int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode); 95 extern int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
|
H A D | pci.h | 26 #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ 44 * bus numbers (don't do that on ppc64 yet !) 106 extern int pci_domain_nr(struct pci_bus *bus); 109 extern int pci_proc_domain(struct pci_bus *bus); 119 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, 121 extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, 123 extern int pci_mmap_legacy_page_range(struct pci_bus *bus, 149 extern void pcibios_finish_adding_to_bus(struct pci_bus *bus); 157 struct pci_bus *bus, int devfn); 161 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 162 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); 176 extern void pcibios_setup_bus_devices(struct pci_bus *bus); 177 extern void pcibios_setup_bus_self(struct pci_bus *bus);
|
H A D | topology.h | 27 extern int pcibus_to_node(struct pci_bus *bus); 29 static inline int pcibus_to_node(struct pci_bus *bus) pcibus_to_node() argument 35 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 37 cpumask_of_node(pcibus_to_node(bus)))
|
H A D | pci-bridge.h | 22 void (*dma_bus_setup)(struct pci_bus *bus); 39 struct pci_bus *bus; member in struct:pci_controller 78 * to determine which bus number to match on when generating type0 119 extern int early_read_config_byte(struct pci_controller *hose, int bus, 121 extern int early_read_config_word(struct pci_controller *hose, int bus, 123 extern int early_read_config_dword(struct pci_controller *hose, int bus, 125 extern int early_write_config_byte(struct pci_controller *hose, int bus, 127 extern int early_write_config_word(struct pci_controller *hose, int bus, 129 extern int early_write_config_dword(struct pci_controller *hose, int bus, 132 extern int early_find_capability(struct pci_controller *hose, int bus, 139 extern int indirect_read_config(struct pci_bus *bus, unsigned int devfn, 146 extern int indirect_write_config(struct pci_bus *bus, unsigned int devfn, 149 static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) pci_bus_to_host() argument 151 return bus->sysdata; pci_bus_to_host() 157 u8 *bus, u8 *devfn); 180 int busno; /* pci bus number */ 216 extern struct pci_dn *pci_get_pdn_by_devfn(struct pci_bus *bus, 224 u8 *bus, u8 *devfn) pci_device_from_OF_node() 228 *bus = PCI_DN(np)->busno; pci_device_from_OF_node() 242 /** Find the bus corresponding to the indicated device node */ 245 /** Remove all of the PCI devices under this bus */ 246 extern void pcibios_remove_pci_devices(struct pci_bus *bus); 248 /** Discover new pci devices under this bus, and add them */ 249 extern void pcibios_add_pci_devices(struct pci_bus *bus); 261 extern int pcibios_unmap_io_space(struct pci_bus *bus); 262 extern int pcibios_map_io_space(struct pci_bus *bus); 223 pci_device_from_OF_node(struct device_node *np, u8 *bus, u8 *devfn) pci_device_from_OF_node() argument
|
/linux-4.1.27/arch/mips/pci/ |
H A D | ops-rc32434.c | 41 #define PCI_CFG_SET(bus, slot, func, off) \ 43 ((bus) << 16) | ((slot)<<11) | \ 47 struct pci_bus *bus, unsigned int devfn, config_access() 54 PCI_CFG_SET(bus->number, slot, func, where); config_access() 72 static int read_config_byte(struct pci_bus *bus, unsigned int devfn, read_config_byte() argument 78 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data); read_config_byte() 83 static int read_config_word(struct pci_bus *bus, unsigned int devfn, read_config_word() argument 89 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, &data); read_config_word() 94 static int read_config_dword(struct pci_bus *bus, unsigned int devfn, read_config_dword() argument 104 if (bus->number == 0 && PCI_SLOT(devfn) > 21) read_config_dword() 108 ret = config_access(PCI_ACCESS_READ, bus, devfn, where, val); read_config_dword() 129 write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, write_config_byte() argument 134 if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) write_config_byte() 140 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) write_config_byte() 148 write_config_word(struct pci_bus *bus, unsigned int devfn, int where, write_config_word() argument 153 if (config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) write_config_word() 159 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) write_config_word() 168 write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, write_config_dword() argument 171 if (config_access(PCI_ACCESS_WRITE, bus, devfn, where, &val)) write_config_dword() 177 static int pci_config_read(struct pci_bus *bus, unsigned int devfn, pci_config_read() argument 182 return read_config_byte(bus, devfn, where, (u8 *) val); pci_config_read() 184 return read_config_word(bus, devfn, where, (u16 *) val); pci_config_read() 186 return read_config_dword(bus, devfn, where, val); pci_config_read() 190 static int pci_config_write(struct pci_bus *bus, unsigned int devfn, pci_config_write() argument 195 return write_config_byte(bus, devfn, where, (u8) val); pci_config_write() 197 return write_config_word(bus, devfn, where, (u16) val); pci_config_write() 199 return write_config_dword(bus, devfn, where, val); pci_config_write() 46 config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, unsigned char where, u32 *data) config_access() argument
|
H A D | ops-loongson3.c | 16 struct pci_bus *bus, unsigned int devfn, loongson3_pci_config_access() 19 unsigned char busnum = bus->number; loongson3_pci_config_access() 50 static int loongson3_pci_pcibios_read(struct pci_bus *bus, unsigned int devfn, loongson3_pci_pcibios_read() argument 55 bus, devfn, where, &data); loongson3_pci_pcibios_read() 70 static int loongson3_pci_pcibios_write(struct pci_bus *bus, unsigned int devfn, loongson3_pci_pcibios_write() argument 80 bus, devfn, where, &data); loongson3_pci_pcibios_write() 93 bus, devfn, where, &data); loongson3_pci_pcibios_write() 15 loongson3_pci_config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 *data) loongson3_pci_config_access() argument
|
H A D | ops-sni.c | 19 * test for bus 0 and hope forwarding and decoding work properly for any 40 static int pcimt_read(struct pci_bus *bus, unsigned int devfn, int reg, pcimt_read() argument 45 if ((res = set_config_address(bus->number, devfn, reg))) pcimt_read() 63 static int pcimt_write(struct pci_bus *bus, unsigned int devfn, int reg, pcimt_write() argument 68 if ((res = set_config_address(bus->number, devfn, reg))) pcimt_write() 100 static int pcit_read(struct pci_bus *bus, unsigned int devfn, int reg, pcit_read() argument 106 * on bus 0 we need to check, whether there is a device answering pcit_read() 108 * we don't do it, we will get a data bus error pcit_read() 110 if (bus->number == 0) { pcit_read() 120 if ((res = pcit_set_config_address(bus->number, devfn, reg))) pcit_read() 137 static int pcit_write(struct pci_bus *bus, unsigned int devfn, int reg, pcit_write() argument 142 if ((res = pcit_set_config_address(bus->number, devfn, reg))) pcit_write()
|
H A D | pci-xlp.c | 60 #define pci_cfg_addr(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) 63 static inline u32 pci_cfg_read_32bit(struct pci_bus *bus, unsigned int devfn, pci_cfg_read_32bit() argument 72 if (bus->number == 0) { pci_cfg_read_32bit() 77 } else if (bus->parent->number == 0) { /* SoC bus */ pci_cfg_read_32bit() 83 } else if (bus->number == 0 && PCI_SLOT(devfn) == 1 && where == 0x954) { pci_cfg_read_32bit() 87 pci_cfg_addr(bus->number, devfn, where)); pci_cfg_read_32bit() 92 static inline void pci_cfg_write_32bit(struct pci_bus *bus, unsigned int devfn, pci_cfg_write_32bit() argument 98 pci_cfg_addr(bus->number, devfn, where & ~3)); pci_cfg_write_32bit() 102 static int nlm_pcibios_read(struct pci_bus *bus, unsigned int devfn, nlm_pcibios_read() argument 112 data = pci_cfg_read_32bit(bus, devfn, where); nlm_pcibios_read() 125 static int nlm_pcibios_write(struct pci_bus *bus, unsigned int devfn, nlm_pcibios_write() argument 135 data = pci_cfg_read_32bit(bus, devfn, where); nlm_pcibios_write() 146 pci_cfg_write_32bit(bus, devfn, where, data); nlm_pcibios_write() 181 struct pci_bus *bus, *p; xlp_get_pcie_link() local 183 bus = dev->bus; xlp_get_pcie_link() 186 /* find bus with grand parent number == 0 */ xlp_get_pcie_link() 187 for (p = bus->parent; p && p->parent && p->parent->number != 0; xlp_get_pcie_link() 189 bus = p; xlp_get_pcie_link() 190 return (p && p->parent) ? bus->self : NULL; xlp_get_pcie_link() 192 /* Find the bridge on bus 0 */ xlp_get_pcie_link() 193 for (p = bus->parent; p && p->number != 0; p = p->parent) xlp_get_pcie_link() 194 bus = p; xlp_get_pcie_link() 196 return p ? bus->self : NULL; xlp_get_pcie_link() 203 return PCI_FUNC(lnkdev->bus->self->devfn); xlp_socdev_to_node()
|
H A D | ops-loongson2.c | 36 struct pci_bus *bus, loongson_pcibios_config_access() 40 u32 busnum = bus->number; loongson_pcibios_config_access() 72 /* Type 0 configuration for onboard PCI bus */ loongson_pcibios_config_access() 79 /* Type 1 configuration for offboard PCI bus */ loongson_pcibios_config_access() 121 static int loongson_pcibios_read(struct pci_bus *bus, unsigned int devfn, loongson_pcibios_read() argument 131 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, loongson_pcibios_read() 145 static int loongson_pcibios_write(struct pci_bus *bus, unsigned int devfn, loongson_pcibios_write() argument 158 if (loongson_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, loongson_pcibios_write() 170 if (loongson_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where, loongson_pcibios_write() 187 struct pci_bus bus = { _rdmsr() local 194 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr); _rdmsr() 195 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_LO, 4, lo); _rdmsr() 196 loongson_pcibios_read(&bus, devfn, PCI_MSR_DATA_HI, 4, hi); _rdmsr() 203 struct pci_bus bus = { _wrmsr() local 210 loongson_pcibios_write(&bus, devfn, PCI_MSR_ADDR, 4, msr); _wrmsr() 211 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_LO, 4, lo); _wrmsr() 212 loongson_pcibios_write(&bus, devfn, PCI_MSR_DATA_HI, 4, hi); _wrmsr() 35 loongson_pcibios_config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 *data) loongson_pcibios_config_access() argument
|
H A D | ops-lantiq.c | 28 static int ltq_pci_config_access(unsigned char access_type, struct pci_bus *bus, ltq_pci_config_access() argument 37 if ((bus->number != 0) || ((devfn & 0xf8) > 0x78) ltq_pci_config_access() 44 cfg_base |= (bus->number << LTQ_PCI_CFG_BUSNUM_SHF) | (devfn << ltq_pci_config_access() 73 int ltq_pci_read_config_dword(struct pci_bus *bus, unsigned int devfn, ltq_pci_read_config_dword() argument 78 if (ltq_pci_config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) ltq_pci_read_config_dword() 91 int ltq_pci_write_config_dword(struct pci_bus *bus, unsigned int devfn, ltq_pci_write_config_dword() argument 99 if (ltq_pci_config_access(PCI_ACCESS_READ, bus, ltq_pci_write_config_dword() 111 if (ltq_pci_config_access(PCI_ACCESS_WRITE, bus, devfn, where, &data)) ltq_pci_write_config_dword()
|
H A D | pci-lantiq.h | 13 extern int ltq_pci_read_config_dword(struct pci_bus *bus, 15 extern int ltq_pci_write_config_dword(struct pci_bus *bus,
|
H A D | fixup-tb0287.c | 27 unsigned char bus; pcibios_map_irq() local 30 bus = dev->bus->number; pcibios_map_irq() 31 if (bus == 0) { pcibios_map_irq() 42 } else if (bus == 1) { pcibios_map_irq() 54 } else if (bus > 1) { pcibios_map_irq()
|
H A D | ops-bcm63xx.c | 90 /* type 0 cycle for local bus, type 1 cycle for anything else */ bcm63xx_setup_cfg_access() 92 /* FIXME: how to specify bus ??? */ bcm63xx_setup_cfg_access() 147 static int bcm63xx_pci_read(struct pci_bus *bus, unsigned int devfn, bcm63xx_pci_read() argument 152 type = bus->parent ? 1 : 0; bcm63xx_pci_read() 157 return bcm63xx_do_cfg_read(type, bus->number, devfn, bcm63xx_pci_read() 161 static int bcm63xx_pci_write(struct pci_bus *bus, unsigned int devfn, bcm63xx_pci_write() argument 166 type = bus->parent ? 1 : 0; bcm63xx_pci_write() 171 return bcm63xx_do_cfg_write(type, bus->number, devfn, bcm63xx_pci_write() 362 static int bcm63xx_cb_read(struct pci_bus *bus, unsigned int devfn, bcm63xx_cb_read() argument 365 /* snoop access to slot 0x1e on root bus, we fake a cardbus bcm63xx_cb_read() 367 if (!bus->parent && PCI_SLOT(devfn) == FAKE_CB_BRIDGE_SLOT) { bcm63xx_cb_read() 368 fake_cb_bridge_bus_number = bus->number; bcm63xx_cb_read() 374 * bus. This means that only one device can be on the cardbus bcm63xx_cb_read() 375 * bus */ bcm63xx_cb_read() 377 bus->number == fake_cb_bridge_regs.cardbus_busn && bcm63xx_cb_read() 386 static int bcm63xx_cb_write(struct pci_bus *bus, unsigned int devfn, bcm63xx_cb_write() argument 389 if (!bus->parent && PCI_SLOT(devfn) == FAKE_CB_BRIDGE_SLOT) { bcm63xx_cb_write() 390 fake_cb_bridge_bus_number = bus->number; bcm63xx_cb_write() 395 bus->number == fake_cb_bridge_regs.cardbus_busn && bcm63xx_cb_write() 431 /* skip our fake bus with only cardbus bridge on it */ bcm63xx_fixup() 432 if (dev->bus->number == fake_cb_bridge_bus_number) bcm63xx_fixup() 435 /* find on which bus the device is */ bcm63xx_fixup() 437 dev->bus->number == fake_cb_bridge_regs.cardbus_busn && bcm63xx_fixup() 468 static int bcm63xx_pcie_can_access(struct pci_bus *bus, int devfn) bcm63xx_pcie_can_access() argument 470 switch (bus->number) { bcm63xx_pcie_can_access() 482 static int bcm63xx_pcie_read(struct pci_bus *bus, unsigned int devfn, bcm63xx_pcie_read() argument 488 if (!bcm63xx_pcie_can_access(bus, devfn)) bcm63xx_pcie_read() 491 if (bus->number == PCIE_BUS_DEVICE) bcm63xx_pcie_read() 502 static int bcm63xx_pcie_write(struct pci_bus *bus, unsigned int devfn, bcm63xx_pcie_write() argument 508 if (!bcm63xx_pcie_can_access(bus, devfn)) bcm63xx_pcie_write() 511 if (bus->number == PCIE_BUS_DEVICE) bcm63xx_pcie_write()
|
H A D | ops-mace.c | 31 static inline int mkaddr(struct pci_bus *bus, unsigned int devfn, mkaddr() argument 34 return ((bus->number & 0xff) << 16) | mkaddr() 41 mace_pci_read_config(struct pci_bus *bus, unsigned int devfn, mace_pci_read_config() argument 48 mace->pci.config_addr = mkaddr(bus, devfn, reg); mace_pci_read_config() 67 if (bus->number == 0 && reg == 0x40 && size == 4 && mace_pci_read_config() 77 mace_pci_write_config(struct pci_bus *bus, unsigned int devfn, mace_pci_write_config() argument 80 mace->pci.config_addr = mkaddr(bus, devfn, reg); mace_pci_write_config()
|
H A D | ops-nile4.c | 17 struct pci_bus *bus, unsigned int devfn, int where, u32 *val) nile4_pcibios_config_access() 19 unsigned char busnum = bus->number; nile4_pcibios_config_access() 74 static int nile4_pcibios_read(struct pci_bus *bus, unsigned int devfn, nile4_pcibios_read() argument 85 err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, nile4_pcibios_read() 100 static int nile4_pcibios_write(struct pci_bus *bus, unsigned int devfn, nile4_pcibios_write() argument 111 err = nile4_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, nile4_pcibios_write() 126 (PCI_ACCESS_WRITE, bus, devfn, where, &data)) nile4_pcibios_write() 16 nile4_pcibios_config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 *val) nile4_pcibios_config_access() argument
|
H A D | pci-bcm1480ht.c | 51 #define CFGOFFSET(bus, devfn, where) (((bus)<<16)+((devfn)<<8)+(where)) 52 #define CFGADDR(bus, devfn, where) CFGOFFSET((bus)->number, (devfn), where) 85 * In PCI Device Mode, hide everything on bus 0 except the LDT host 88 static int bcm1480ht_can_access(struct pci_bus *bus, int devfn) bcm1480ht_can_access() argument 95 if (bus->number == 0) { bcm1480ht_can_access() 109 static int bcm1480ht_pcibios_read(struct pci_bus *bus, unsigned int devfn, bcm1480ht_pcibios_read() argument 119 if (bcm1480ht_can_access(bus, devfn)) bcm1480ht_pcibios_read() 120 data = READCFG32(CFGADDR(bus, devfn, where)); bcm1480ht_pcibios_read() 134 static int bcm1480ht_pcibios_write(struct pci_bus *bus, unsigned int devfn, bcm1480ht_pcibios_write() argument 137 u32 cfgaddr = CFGADDR(bus, devfn, where); bcm1480ht_pcibios_write() 145 if (!bcm1480ht_can_access(bus, devfn)) bcm1480ht_pcibios_write()
|
H A D | ops-bonito64.c | 37 struct pci_bus *bus, bonito64_pcibios_config_access() 41 u32 busnum = bus->number; bonito64_pcibios_config_access() 50 /* Type 0 configuration for onboard PCI bus */ bonito64_pcibios_config_access() 57 /* Type 1 configuration for offboard PCI bus */ bonito64_pcibios_config_access() 101 static int bonito64_pcibios_read(struct pci_bus *bus, unsigned int devfn, bonito64_pcibios_read() argument 111 if (bonito64_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, bonito64_pcibios_read() 125 static int bonito64_pcibios_write(struct pci_bus *bus, unsigned int devfn, bonito64_pcibios_write() argument 138 if (bonito64_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, bonito64_pcibios_write() 150 if (bonito64_pcibios_config_access(PCI_ACCESS_WRITE, bus, devfn, where, bonito64_pcibios_write() 36 bonito64_pcibios_config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 * data) bonito64_pcibios_config_access() argument
|
/linux-4.1.27/drivers/staging/iio/frequency/ |
H A D | dds.h | 12 * /sys/bus/iio/devices/.../out_altvoltageX_frequencyY 20 * /sys/bus/iio/devices/.../out_altvoltageX_frequencyY_scale 27 * /sys/bus/iio/devices/.../out_altvoltageX_frequencysymbol 35 * /sys/bus/iio/devices/.../out_altvoltageX_phaseY 43 * /sys/bus/iio/devices/.../out_altvoltageX_phaseY_scale 50 * /sys/bus/iio/devices/.../out_altvoltageX_phasesymbol 58 * /sys/bus/iio/devices/.../out_altvoltageX_pincontrol_en 66 * /sys/bus/iio/devices/.../out_altvoltageX_pincontrol_frequency_en 74 * /sys/bus/iio/devices/.../out_altvoltageX_pincontrol_phase_en 82 * /sys/bus/iio/devices/.../out_altvoltageX_out_enable 90 * /sys/bus/iio/devices/.../out_altvoltageX_outY_enable 99 * /sys/bus/iio/devices/.../out_altvoltageX_outY_wavetype 107 * /sys/bus/iio/devices/.../out_altvoltageX_outY_wavetype_available
|
/linux-4.1.27/drivers/xen/ |
H A D | pci.c | 49 .add.seg = pci_domain_nr(pci_dev->bus), xen_add_device() 50 .add.bus = pci_dev->bus->number, xen_add_device() 62 add->physfn.bus = physfn->bus->number; xen_add_device() 66 if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) xen_add_device() 73 handle = ACPI_HANDLE(physfn->bus->bridge); xen_add_device() 78 * all. Try to get acpi handle of parent pci bus. xen_add_device() 81 for (pbus = pci_dev->bus; pbus; pbus = pbus->parent) { xen_add_device() 111 if (pci_domain_nr(pci_dev->bus)) xen_add_device() 116 .bus = pci_dev->bus->number, xen_add_device() 119 .physfn.bus = physfn->bus->number, xen_add_device() 127 else if (pci_ari_enabled(pci_dev->bus) && PCI_SLOT(pci_dev->devfn)) { xen_add_device() 129 .bus = pci_dev->bus->number, xen_add_device() 138 .bus = pci_dev->bus->number, xen_add_device() 156 .seg = pci_domain_nr(pci_dev->bus), xen_remove_device() 157 .bus = pci_dev->bus->number, xen_remove_device() 163 } else if (pci_domain_nr(pci_dev->bus)) xen_remove_device() 167 .bus = pci_dev->bus->number, xen_remove_device()
|
H A D | dbgp.c | 25 dbgp.u.pci.seg = pci_domain_nr(pdev->bus); xen_dbgp_op() 26 dbgp.u.pci.bus = pdev->bus->number; xen_dbgp_op() 28 dbgp.bus = PHYSDEVOP_DBGP_BUS_PCI; xen_dbgp_op() 31 dbgp.bus = PHYSDEVOP_DBGP_BUS_UNKNOWN; xen_dbgp_op()
|
/linux-4.1.27/drivers/pcmcia/ |
H A D | cardbus.c | 30 static void cardbus_config_irq_and_cls(struct pci_bus *bus, int irq) cardbus_config_irq_and_cls() argument 34 list_for_each_entry(dev, &bus->devices, bus_list) { cardbus_config_irq_and_cls() 69 struct pci_bus *bus = s->cb_dev->subordinate; cb_alloc() local 75 s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0)); cb_alloc() 76 pci_fixup_cardbus(bus); cb_alloc() 78 max = bus->busn_res.start; cb_alloc() 80 list_for_each_entry(dev, &bus->devices, bus_list) cb_alloc() 82 max = pci_scan_bridge(bus, dev, max, pass); cb_alloc() 87 pci_bus_size_bridges(bus); cb_alloc() 88 pci_bus_assign_resources(bus); cb_alloc() 89 cardbus_config_irq_and_cls(bus, s->pci_irq); cb_alloc() 93 s->tune_bridge(s, bus); cb_alloc() 95 pci_bus_add_devices(bus); cb_alloc() 110 struct pci_bus *bus; cb_free() local 116 bus = bridge->subordinate; cb_free() 117 if (!bus) cb_free() 122 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) cb_free()
|
/linux-4.1.27/arch/sh/include/mach-se/mach/ |
H A D | mrshpc.h | 24 /* common mode & bus width 16bit SWAP = 1*/ mrshpc_setup_windows() 27 /* common mode & bus width 16bit SWAP = 0*/ mrshpc_setup_windows() 33 /* attribute mode & bus width 16bit SWAP = 1*/ mrshpc_setup_windows() 36 /* attribute mode & bus width 16bit SWAP = 0*/ mrshpc_setup_windows() 43 __raw_writew(0x0a00, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 1*/ mrshpc_setup_windows() 45 __raw_writew(0x0200, MRSHPC_IOWCR2); /* bus width 16bit SWAP = 0*/ mrshpc_setup_windows()
|
/linux-4.1.27/arch/sh/drivers/pci/ |
H A D | fixups-cayman.c | 19 always bus 2, because a card containing a PCI-PCI bridge may be pcibios_map_platform_irq() 20 plugged into a 3.3V slot, and this changes the bus numbering. pcibios_map_platform_irq() 22 Also, the Cayman has an intermediate PCI bus that goes a custom pcibios_map_platform_irq() 23 expansion board header (and to the secondary bridge). This bus has pcibios_map_platform_irq() 26 The 1ary onboard PCI-PCI bridge is device 3 on bus 0 pcibios_map_platform_irq() 27 The 2ary onboard PCI-PCI bridge is device 0 on the 2ary bus of pcibios_map_platform_irq() 37 while (dev->bus->number > 0) { pcibios_map_platform_irq() 41 dev = dev->bus->self; pcibios_map_platform_irq() 43 if (i > 3) panic("PCI path to root bus too long!\n"); pcibios_map_platform_irq() 47 /* This is the slot on bus 0 through which the device is eventually pcibios_map_platform_irq() 60 panic("PCI expansion bus device found - not handled!\n"); pcibios_map_platform_irq()
|
H A D | common.c | 14 static struct pci_bus bus; fake_pci_dev() local 16 dev.bus = &bus; fake_pci_dev() 19 bus.number = busnr; fake_pci_dev() 20 bus.sysdata = hose; fake_pci_dev() 21 bus.ops = hose->pci_ops; fake_pci_dev() 24 /* Fake a parent bus structure. */ fake_pci_dev() 25 bus.parent = &bus; fake_pci_dev() 27 bus.parent = NULL; fake_pci_dev() 34 int top_bus, int bus, int devfn, int offset, type value) \ 37 fake_pci_dev(hose, top_bus, bus, devfn), \
|
H A D | ops-sh7786.c | 23 struct pci_bus *bus, unsigned int devfn, int where, u32 *data) sh7786_pcie_config_access() 25 struct pci_channel *chan = bus->sysdata; sh7786_pcie_config_access() 30 type = !!bus->parent; sh7786_pcie_config_access() 33 if (bus->number > 255 || dev > 31 || func > 7) sh7786_pcie_config_access() 51 if (pci_is_root_bus(bus)) { sh7786_pcie_config_access() 67 pci_write_reg(chan, (bus->number << 24) | (dev << 19) | sh7786_pcie_config_access() 92 static int sh7786_pcie_read(struct pci_bus *bus, unsigned int devfn, sh7786_pcie_read() argument 105 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, sh7786_pcie_read() 119 dev_dbg(&bus->dev, "pcie-config-read: bus=%3d devfn=0x%04x " sh7786_pcie_read() 120 "where=0x%04x size=%d val=0x%08lx\n", bus->number, sh7786_pcie_read() 128 static int sh7786_pcie_write(struct pci_bus *bus, unsigned int devfn, sh7786_pcie_write() argument 141 ret = sh7786_pcie_config_access(PCI_ACCESS_READ, bus, sh7786_pcie_write() 146 dev_dbg(&bus->dev, "pcie-config-write: bus=%3d devfn=0x%04x " sh7786_pcie_write() 147 "where=0x%04x size=%d val=%08lx\n", bus->number, sh7786_pcie_write() 161 ret = sh7786_pcie_config_access(PCI_ACCESS_WRITE, bus, sh7786_pcie_write() 22 sh7786_pcie_config_access(unsigned char access_type, struct pci_bus *bus, unsigned int devfn, int where, u32 *data) sh7786_pcie_config_access() argument
|
H A D | ops-sh4.c | 19 #define CONFIG_CMD(bus, devfn, where) \ 20 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 25 static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn, sh4_pci_read() argument 28 struct pci_channel *chan = bus->sysdata; sh4_pci_read() 37 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); sh4_pci_read() 63 static int sh4_pci_write(struct pci_bus *bus, unsigned int devfn, sh4_pci_write() argument 66 struct pci_channel *chan = bus->sysdata; sh4_pci_write() 72 pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR); sh4_pci_write()
|
H A D | pci.c | 43 struct pci_bus *bus; pcibios_scanbus() local 55 bus = pci_scan_root_bus(NULL, next_busno, hose->pci_ops, hose, pcibios_scanbus() 57 hose->bus = bus; pcibios_scanbus() 62 if (!bus) { pcibios_scanbus() 67 next_busno = bus->busn_res.end + 1; pcibios_scanbus() 68 /* Don't allow 8-bit bus number overflow inside the hose - pcibios_scanbus() 75 pci_bus_size_bridges(bus); pcibios_scanbus() 76 pci_bus_assign_resources(bus); pcibios_scanbus() 77 pci_bus_add_devices(bus); pcibios_scanbus() 120 * Scan the bus if it is register after the PCI subsystem register_pci_controller() 135 printk(KERN_WARNING "Skipping PCI bus scan due to resource conflict\n"); register_pci_controller() 158 * Called after each bus is probed, but before its children 161 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 225 pcibios_bus_report_status(struct pci_bus *bus, unsigned int status_mask, pcibios_bus_report_status() argument 230 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_bus_report_status() 237 if (dev->bus->number == 0 && dev->devfn == 0) pcibios_bus_report_status() 254 list_for_each_entry(dev, &bus->devices, bus_list) pcibios_bus_report_status() 264 if (unlikely(!hose->bus)) pcibios_report_status() 268 pcibios_bus_report_status(hose->bus, status_mask, warn); pcibios_report_status()
|
/linux-4.1.27/drivers/bus/ |
H A D | mips_cdmm.c | 223 drv->drv.bus = &mips_cdmm_bustype; mips_cdmm_driver_register() 249 /* CDMM initialisation and bus discovery */ 252 * struct mips_cdmm_bus - Info about CDMM bus. 257 * @discovered: Whether the devices on the bus have been discovered yet. 258 * @offline: Whether the CDMM bus is going offline (or very early 276 * mips_cdmm_get_bus() - Get the per-CPU CDMM bus information. 278 * Get information about the per-CPU CDMM bus, if the bus is present. 283 * Returns: Pointer to CDMM bus information for the current CPU. 289 struct mips_cdmm_bus *bus, **bus_p; mips_cdmm_get_bus() local 301 /* Get bus pointer */ mips_cdmm_get_bus() 304 bus = *bus_p; mips_cdmm_get_bus() 306 if (unlikely(!bus)) { mips_cdmm_get_bus() 307 bus = kzalloc(sizeof(*bus), GFP_ATOMIC); mips_cdmm_get_bus() 308 if (unlikely(!bus)) mips_cdmm_get_bus() 309 bus = ERR_PTR(-ENOMEM); mips_cdmm_get_bus() 311 *bus_p = bus; mips_cdmm_get_bus() 314 return bus; mips_cdmm_get_bus() 335 * mips_cdmm_setup() - Ensure the CDMM bus is initialised and usable. 336 * @bus: Pointer to bus information for current CPU. 337 * IS_ERR(bus) is checked, so no need for caller to check. 344 static int mips_cdmm_setup(struct mips_cdmm_bus *bus) mips_cdmm_setup() argument 349 if (IS_ERR(bus)) mips_cdmm_setup() 350 return PTR_ERR(bus); mips_cdmm_setup() 353 /* Don't set up bus a second time unless marked offline */ mips_cdmm_setup() 354 if (bus->offline) { mips_cdmm_setup() 356 if (bus->phys == mips_cdmm_cur_base()) mips_cdmm_setup() 362 bus->offline = false; mips_cdmm_setup() 363 } else if (bus->phys > 1) { mips_cdmm_setup() 368 if (!bus->phys) mips_cdmm_setup() 369 bus->phys = mips_cdmm_cur_base(); mips_cdmm_setup() 371 if (!bus->phys && mips_cdmm_phys_base) mips_cdmm_setup() 372 bus->phys = mips_cdmm_phys_base(); mips_cdmm_setup() 374 if (!bus->phys) mips_cdmm_setup() 375 bus->phys = mips_cdmm_default_base; mips_cdmm_setup() 377 if (!bus->phys) { mips_cdmm_setup() 378 bus->phys = 1; mips_cdmm_setup() 388 if (bus->phys == 1) { mips_cdmm_setup() 393 mips_cdmm_default_base = bus->phys; mips_cdmm_setup() 396 smp_processor_id(), &bus->phys); mips_cdmm_setup() 401 cdmmbase |= (bus->phys >> MIPS_CDMMBASE_ADDR_START) mips_cdmm_setup() 407 bus->regs = (void __iomem *)CKSEG1ADDR(bus->phys); mips_cdmm_setup() 408 bus->drbs = 1 + ((cdmmbase & MIPS_CDMMBASE_SIZE) >> mips_cdmm_setup() 410 bus->drbs_reserved = !!(cdmmbase & MIPS_CDMMBASE_CI); mips_cdmm_setup() 436 struct mips_cdmm_bus *bus; mips_cdmm_early_probe() local 445 bus = mips_cdmm_get_bus(); mips_cdmm_early_probe() 446 err = mips_cdmm_setup(bus); mips_cdmm_early_probe() 451 drb = bus->drbs_reserved; mips_cdmm_early_probe() 452 cdmm = bus->regs; mips_cdmm_early_probe() 455 for (; drb < bus->drbs; drb += size + 1) { mips_cdmm_early_probe() 482 * mips_cdmm_bus_discover() - Discover the devices on the CDMM bus. 483 * @bus: CDMM bus information, must already be set up. 485 static void mips_cdmm_bus_discover(struct mips_cdmm_bus *bus) mips_cdmm_bus_discover() argument 496 drb = bus->drbs_reserved; mips_cdmm_bus_discover() 497 cdmm = bus->regs; mips_cdmm_bus_discover() 500 bus->discovered = true; mips_cdmm_bus_discover() 501 pr_info("cdmm%u discovery (%u blocks)\n", cpu, bus->drbs); mips_cdmm_bus_discover() 502 for (; drb < bus->drbs; drb += size + 1) { mips_cdmm_bus_discover() 521 dev->res.start = bus->phys + drb * CDMM_DRB_SIZE; mips_cdmm_bus_discover() 522 dev->res.end = bus->phys + mips_cdmm_bus_discover() 528 dev->dev.bus = &mips_cdmm_bustype; mips_cdmm_bus_discover() 587 * mips_cdmm_bus_down() - Tear down the CDMM bus. 595 struct mips_cdmm_bus *bus; mips_cdmm_bus_down() local 598 /* Inform all the devices on the bus */ mips_cdmm_bus_down() 603 * While bus is offline, each use of it should reconfigure it just in mips_cdmm_bus_down() 606 bus = mips_cdmm_get_bus(); mips_cdmm_bus_down() 607 if (!IS_ERR(bus)) mips_cdmm_bus_down() 608 bus->offline = true; mips_cdmm_bus_down() 614 * mips_cdmm_bus_up() - Bring up the CDMM bus. 625 struct mips_cdmm_bus *bus; mips_cdmm_bus_up() local 628 bus = mips_cdmm_get_bus(); mips_cdmm_bus_up() 629 ret = mips_cdmm_setup(bus); mips_cdmm_bus_up() 634 bus->offline = false; mips_cdmm_bus_up() 636 if (!bus->discovered) mips_cdmm_bus_up() 637 mips_cdmm_bus_discover(bus); mips_cdmm_bus_up() 639 /* Inform all the devices on the bus */ mips_cdmm_bus_up() 653 * onlined. When CPUs go offline or come back online, so does their CDMM bus, so 655 * devices on the CDMM bus need discovering. 685 * mips_cdmm_init() - Initialise CDMM bus. 687 * Initialise CDMM bus, discover CDMM devices for online CPUs, and arrange for 695 /* Register the bus */ mips_cdmm_init()
|
/linux-4.1.27/drivers/gpu/drm/gma500/ |
H A D | intel_gmbus.c | 249 struct intel_gmbus *bus = container_of(adapter, gmbus_xfer() local 255 if (bus->force_bit) gmbus_xfer() 257 bus->force_bit, msgs, num); gmbus_xfer() 261 GMBUS_REG_WRITE(GMBUS0 + reg_offset, bus->reg0); gmbus_xfer() 349 bus->reg0 & 0xff, bus->adapter.name); gmbus_xfer() 353 bus->force_bit = intel_gpio_create(dev_priv, bus->reg0 & 0xff); gmbus_xfer() 354 if (!bus->force_bit) gmbus_xfer() 357 return intel_i2c_quirk_xfer(dev_priv, bus->force_bit, msgs, num); gmbus_xfer() 362 struct intel_gmbus *bus = container_of(adapter, gmbus_func() local 366 if (bus->force_bit) gmbus_func() 367 bus->force_bit->algo->functionality(bus->force_bit); gmbus_func() 410 struct intel_gmbus *bus = &dev_priv->gmbus[i]; gma_intel_setup_gmbus() local 412 bus->adapter.owner = THIS_MODULE; gma_intel_setup_gmbus() 413 bus->adapter.class = I2C_CLASS_DDC; gma_intel_setup_gmbus() 414 snprintf(bus->adapter.name, gma_intel_setup_gmbus() 415 sizeof(bus->adapter.name), gma_intel_setup_gmbus() 419 bus->adapter.dev.parent = &dev->pdev->dev; gma_intel_setup_gmbus() 420 bus->adapter.algo_data = dev_priv; gma_intel_setup_gmbus() 422 bus->adapter.algo = &gmbus_algorithm; gma_intel_setup_gmbus() 423 ret = i2c_add_adapter(&bus->adapter); gma_intel_setup_gmbus() 428 bus->reg0 = i | GMBUS_RATE_100KHZ; gma_intel_setup_gmbus() 431 bus->force_bit = intel_gpio_create(dev_priv, i); gma_intel_setup_gmbus() 440 struct intel_gmbus *bus = &dev_priv->gmbus[i]; gma_intel_setup_gmbus() local 441 i2c_del_adapter(&bus->adapter); gma_intel_setup_gmbus() 450 struct intel_gmbus *bus = to_intel_gmbus(adapter); gma_intel_gmbus_set_speed() local 458 bus->reg0 = (bus->reg0 & ~(0x3 << 8)) | (speed << 8); gma_intel_gmbus_set_speed() 463 struct intel_gmbus *bus = to_intel_gmbus(adapter); gma_intel_gmbus_force_bit() local 466 if (bus->force_bit == NULL) { gma_intel_gmbus_force_bit() 468 bus->force_bit = intel_gpio_create(dev_priv, gma_intel_gmbus_force_bit() 469 bus->reg0 & 0xff); gma_intel_gmbus_force_bit() 472 if (bus->force_bit) { gma_intel_gmbus_force_bit() 473 i2c_del_adapter(bus->force_bit); gma_intel_gmbus_force_bit() 474 kfree(bus->force_bit); gma_intel_gmbus_force_bit() 475 bus->force_bit = NULL; gma_intel_gmbus_force_bit() 489 struct intel_gmbus *bus = &dev_priv->gmbus[i]; gma_intel_teardown_gmbus() local 490 if (bus->force_bit) { gma_intel_teardown_gmbus() 491 i2c_del_adapter(bus->force_bit); gma_intel_teardown_gmbus() 492 kfree(bus->force_bit); gma_intel_teardown_gmbus() 494 i2c_del_adapter(&bus->adapter); gma_intel_teardown_gmbus()
|
/linux-4.1.27/drivers/xen/xen-pciback/ |
H A D | passthrough.c | 2 * PCI Backend - Provides restricted access to the real PCI bus topology 21 unsigned int bus, __xen_pcibk_get_pci_dev() 31 if (domain == (unsigned int)pci_domain_nr(dev_entry->dev->bus) __xen_pcibk_get_pci_dev() 32 && bus == (unsigned int)dev_entry->dev->bus->number __xen_pcibk_get_pci_dev() 50 unsigned int domain, bus, devfn; __xen_pcibk_add_pci_dev() local 63 domain = (unsigned int)pci_domain_nr(dev->bus); __xen_pcibk_add_pci_dev() 64 bus = (unsigned int)dev->bus->number; __xen_pcibk_add_pci_dev() 66 err = publish_cb(pdev, domain, bus, devfn, devid); __xen_pcibk_add_pci_dev() 124 unsigned int domain, bus; __xen_pcibk_publish_pci_roots() local 133 dev = dev_entry->dev->bus->self; __xen_pcibk_publish_pci_roots() 134 for (; !found && dev != NULL; dev = dev->bus->self) { __xen_pcibk_publish_pci_roots() 143 domain = (unsigned int)pci_domain_nr(dev_entry->dev->bus); __xen_pcibk_publish_pci_roots() 144 bus = (unsigned int)dev_entry->dev->bus->number; __xen_pcibk_publish_pci_roots() 147 err = publish_root_cb(pdev, domain, bus); __xen_pcibk_publish_pci_roots() 178 unsigned int *domain, unsigned int *bus, __xen_pcibk_get_pcifront_dev() 181 *domain = pci_domain_nr(pcidev->bus); __xen_pcibk_get_pcifront_dev() 182 *bus = pcidev->bus->number; __xen_pcibk_get_pcifront_dev() 19 __xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, unsigned int domain, unsigned int bus, unsigned int devfn) __xen_pcibk_get_pci_dev() argument 176 __xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev, struct xen_pcibk_device *pdev, unsigned int *domain, unsigned int *bus, unsigned int *devfn) __xen_pcibk_get_pcifront_dev() argument
|
H A D | vpci.c | 2 * PCI Backend - Provides a Virtual PCI bus (with real devices) 31 unsigned int bus, __xen_pcibk_get_pci_dev() 38 if (domain != 0 || bus != 0) __xen_pcibk_get_pci_dev() 60 if (pci_domain_nr(l->bus) == pci_domain_nr(r->bus) match_slot() 61 && l->bus == r->bus && PCI_SLOT(l->devfn) == PCI_SLOT(r->devfn)) match_slot() 78 "Can't export bridges on the virtual PCI bus"); __xen_pcibk_add_pci_dev() 86 "Error adding entry to virtual PCI bus"); __xen_pcibk_add_pci_dev() 95 * Keep multi-function devices together on the virtual PCI bus, except __xen_pcibk_add_pci_dev() 118 /* Assign to a new slot on the virtual PCI bus */ __xen_pcibk_add_pci_dev() 132 "No more space on root virtual PCI bus"); __xen_pcibk_add_pci_dev() 203 /* The Virtual PCI bus has only one root */ __xen_pcibk_publish_pci_roots() 231 unsigned int *domain, unsigned int *bus, __xen_pcibk_get_pcifront_dev() 245 if (dev && dev->bus->number == pcidev->bus->number __xen_pcibk_get_pcifront_dev() 246 && pci_domain_nr(dev->bus) == __xen_pcibk_get_pcifront_dev() 247 pci_domain_nr(pcidev->bus) __xen_pcibk_get_pcifront_dev() 251 *bus = 0; __xen_pcibk_get_pcifront_dev() 29 __xen_pcibk_get_pci_dev(struct xen_pcibk_device *pdev, unsigned int domain, unsigned int bus, unsigned int devfn) __xen_pcibk_get_pci_dev() argument 229 __xen_pcibk_get_pcifront_dev(struct pci_dev *pcidev, struct xen_pcibk_device *pdev, unsigned int *domain, unsigned int *bus, unsigned int *devfn) __xen_pcibk_get_pcifront_dev() argument
|
/linux-4.1.27/drivers/pci/pcie/aer/ |
H A D | aer_inject.c | 35 u8 bus; member in struct:aer_error_inj 50 unsigned int bus; member in struct:aer_error 66 struct pci_bus *bus; member in struct:pci_bus_ops 78 unsigned int bus, unsigned int devfn, aer_error_init() 83 err->bus = bus; aer_error_init() 89 static struct aer_error *__find_aer_error(u16 domain, unsigned int bus, __find_aer_error() argument 96 bus == err->bus && __find_aer_error() 106 int domain = pci_domain_nr(dev->bus); __find_aer_error_by_dev() 109 return __find_aer_error((u16)domain, dev->bus->number, dev->devfn); __find_aer_error_by_dev() 113 static struct pci_ops *__find_pci_bus_ops(struct pci_bus *bus) __find_pci_bus_ops() argument 118 if (bus_ops->bus == bus) __find_pci_bus_ops() 184 static int pci_read_aer(struct pci_bus *bus, unsigned int devfn, int where, pci_read_aer() argument 196 domain = pci_domain_nr(bus); pci_read_aer() 199 err = __find_aer_error((u16)domain, bus->number, devfn); pci_read_aer() 210 ops = __find_pci_bus_ops(bus); pci_read_aer() 212 return ops->read(bus, devfn, where, size, val); pci_read_aer() 215 static int pci_write_aer(struct pci_bus *bus, unsigned int devfn, int where, pci_write_aer() argument 228 domain = pci_domain_nr(bus); pci_write_aer() 231 err = __find_aer_error((u16)domain, bus->number, devfn); pci_write_aer() 245 ops = __find_pci_bus_ops(bus); pci_write_aer() 247 return ops->write(bus, devfn, where, size, val); pci_write_aer() 256 struct pci_bus *bus, pci_bus_ops_init() 260 bus_ops->bus = bus; pci_bus_ops_init() 264 static int pci_bus_set_aer_ops(struct pci_bus *bus) pci_bus_set_aer_ops() argument 273 ops = pci_bus_set_ops(bus, &pci_ops_aer); pci_bus_set_aer_ops() 277 pci_bus_ops_init(bus_ops, bus, ops); pci_bus_set_aer_ops() 293 if (!dev->bus->self) pcie_find_root_port() 295 dev = dev->bus->self; pcie_find_root_port() 305 if (device->bus == &pcie_port_bus_type) { find_aer_device_iter() 332 dev = pci_get_domain_bus_and_slot((int)einj->domain, einj->bus, devfn); aer_inject() 386 aer_error_init(err, einj->domain, einj->bus, devfn, aer_inject() 416 aer_error_init(rperr, pci_domain_nr(rpdev->bus), aer_inject() 417 rpdev->bus->number, rpdev->devfn, aer_inject() 427 rperr->source_id |= (einj->bus << 8) | devfn; aer_inject() 440 rperr->source_id |= ((einj->bus << 8) | devfn) << 16; aer_inject() 451 ret = pci_bus_set_aer_ops(dev->bus); aer_inject() 454 ret = pci_bus_set_aer_ops(rpdev->bus); aer_inject() 520 pci_bus_set_ops(bus_ops->bus, bus_ops->ops); aer_inject_exit() 77 aer_error_init(struct aer_error *err, u16 domain, unsigned int bus, unsigned int devfn, int pos_cap_err) aer_error_init() argument 255 pci_bus_ops_init(struct pci_bus_ops *bus_ops, struct pci_bus *bus, struct pci_ops *ops) pci_bus_ops_init() argument
|
/linux-4.1.27/drivers/isdn/hardware/eicon/ |
H A D | diva_pci.h | 11 unsigned long divasa_get_pci_irq(unsigned char bus, 13 unsigned long divasa_get_pci_bar(unsigned char bus,
|
/linux-4.1.27/drivers/net/ethernet/marvell/ |
H A D | mvmdio.c | 8 * the MDIO bus). This driver is currently used by the mvneta and 74 static int orion_mdio_wait_ready(struct mii_bus *bus) orion_mdio_wait_ready() argument 76 struct orion_mdio_dev *dev = bus->priv; orion_mdio_wait_ready() 108 dev_err(bus->parent, "Timeout: SMI busy for too long\n"); orion_mdio_wait_ready() 112 static int orion_mdio_read(struct mii_bus *bus, int mii_id, orion_mdio_read() argument 115 struct orion_mdio_dev *dev = bus->priv; orion_mdio_read() 121 ret = orion_mdio_wait_ready(bus); orion_mdio_read() 130 ret = orion_mdio_wait_ready(bus); orion_mdio_read() 136 dev_err(bus->parent, "SMI bus read not valid\n"); orion_mdio_read() 147 static int orion_mdio_write(struct mii_bus *bus, int mii_id, orion_mdio_write() argument 150 struct orion_mdio_dev *dev = bus->priv; orion_mdio_write() 155 ret = orion_mdio_wait_ready(bus); orion_mdio_write() 188 struct mii_bus *bus; orion_mdio_probe() local 198 bus = devm_mdiobus_alloc_size(&pdev->dev, orion_mdio_probe() 200 if (!bus) orion_mdio_probe() 203 bus->name = "orion_mdio_bus"; orion_mdio_probe() 204 bus->read = orion_mdio_read; orion_mdio_probe() 205 bus->write = orion_mdio_write; orion_mdio_probe() 206 snprintf(bus->id, MII_BUS_ID_SIZE, "%s-mii", orion_mdio_probe() 208 bus->parent = &pdev->dev; orion_mdio_probe() 210 bus->irq = devm_kmalloc_array(&pdev->dev, PHY_MAX_ADDR, sizeof(int), orion_mdio_probe() 212 if (!bus->irq) orion_mdio_probe() 216 bus->irq[i] = PHY_POLL; orion_mdio_probe() 218 dev = bus->priv; orion_mdio_probe() 250 ret = of_mdiobus_register(bus, pdev->dev.of_node); orion_mdio_probe() 252 ret = mdiobus_register(bus); orion_mdio_probe() 254 dev_err(&pdev->dev, "Cannot register MDIO bus (%d)\n", ret); orion_mdio_probe() 258 platform_set_drvdata(pdev, bus); orion_mdio_probe() 270 struct mii_bus *bus = platform_get_drvdata(pdev); orion_mdio_remove() local 271 struct orion_mdio_dev *dev = bus->priv; orion_mdio_remove() 274 mdiobus_unregister(bus); orion_mdio_remove()
|
/linux-4.1.27/drivers/staging/unisys/uislib/ |
H A D | uislib.c | 148 struct bus_info *tmp, *bus; create_bus() local 166 bus = kzalloc(size, GFP_ATOMIC); create_bus() 167 if (!bus) { create_bus() 173 /* Currently by default, the bus Number is the GuestHandle. create_bus() 178 bus->guest_handle = 0; create_bus() 179 bus->bus_no = bus_no; create_bus() 180 bus->local_vnic = 1; create_bus() 182 bus->bus_no = bus_no; create_bus() 183 bus->guest_handle = bus_no; create_bus() 185 sprintf(bus->name, "%d", (int)bus->bus_no); create_bus() 186 bus->device_count = dev_count; create_bus() 187 bus->device = create_bus() 188 (struct device_info **)((char *)bus + sizeof(struct bus_info)); create_bus() 189 bus->bus_inst_uuid = msg->cmd.create_bus.bus_inst_uuid; create_bus() 190 bus->bus_channel_bytes = 0; create_bus() 191 bus->bus_channel = NULL; create_bus() 193 /* add bus to our bus list - but check for duplicates first */ create_bus() 196 if (tmp->bus_no == bus->bus_no) create_bus() 201 /* found a bus already in the list with same bus_no - create_bus() 204 POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, create_bus() 206 kfree(bus); create_bus() 211 bus->bus_channel_bytes = msg->cmd.create_bus.channel_bytes; create_bus() 212 bus->bus_channel = create_bus() 222 cmd.add_vbus.chanptr = bus->bus_channel; create_bus() 227 POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, create_bus() 229 kfree(bus); create_bus() 233 POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus->bus_no, create_bus() 235 kfree(bus); create_bus() 241 /* add bus at the head of our list */ create_bus() 244 bus_list = bus; create_bus() 246 bus->next = bus_list; create_bus() 247 bus_list = bus; create_bus() 252 POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus->bus_no, create_bus() 261 struct bus_info *bus, *prev = NULL; destroy_bus() local 269 bus = bus_list; destroy_bus() 270 while (bus) { destroy_bus() 271 if (bus->bus_no == bus_no) destroy_bus() 273 prev = bus; destroy_bus() 274 bus = bus->next; destroy_bus() 277 if (!bus) { destroy_bus() 282 /* verify that this bus has no devices. */ destroy_bus() 283 for (i = 0; i < bus->device_count; i++) { destroy_bus() 284 if (bus->device[i]) { destroy_bus() 295 with this bus. */ destroy_bus() 304 /* finally, remove the bus from the list */ destroy_bus() 308 prev->next = bus->next; destroy_bus() 310 bus_list = bus->next; destroy_bus() 314 if (bus->bus_channel) { destroy_bus() 315 uislib_iounmap(bus->bus_channel); destroy_bus() 316 bus->bus_channel = NULL; destroy_bus() 319 kfree(bus); destroy_bus() 326 struct bus_info *bus; create_device() local 383 for (bus = bus_list; bus; bus = bus->next) { create_device() 384 if (bus->bus_no != bus_no) create_device() 387 if (dev_no >= bus->device_count) { create_device() 395 if (bus->device[dev_no]) { create_device() 408 bus->device[dev_no] = dev; create_device() 469 bus->device[dev_no] = dev; create_device() 493 struct bus_info *bus; pause_device() local 502 for (bus = bus_list; bus; bus = bus->next) { pause_device() 503 if (bus->bus_no == bus_no) { pause_device() 505 if (dev_no >= bus->device_count) { pause_device() 509 dev = bus->device[dev_no]; pause_device() 518 if (!bus) pause_device() 550 struct bus_info *bus; resume_device() local 559 for (bus = bus_list; bus; bus = bus->next) { resume_device() 560 if (bus->bus_no == bus_no) { resume_device() 562 if (dev_no >= bus->device_count) { resume_device() 566 dev = bus->device[dev_no]; resume_device() 576 if (!bus) resume_device() 608 struct bus_info *bus; destroy_device() local 617 for (bus = bus_list; bus; bus = bus->next) { destroy_device() 618 if (bus->bus_no == bus_no) { destroy_device() 620 if (dev_no >= bus->device_count) { destroy_device() 624 dev = bus->device[dev_no]; destroy_device() 634 if (!bus) destroy_device() 672 bus->device[dev_no] = NULL; destroy_device() 738 * OK even when the bus 0 create comes in late. If the uislib_client_inject_add_bus() 739 * bus 0 create is the first create, then the add_vnic uislib_client_inject_add_bus() 740 * will work fine, but if the bus 0 create arrives uislib_client_inject_add_bus() 752 /* step 1: create a bus */ uislib_client_inject_add_bus() 820 /* chipset init'ed with bus bus has been previously created - uislib_client_inject_add_vhba() 822 * bus uislib_client_inject_add_vhba() 875 /* chipset init'ed with bus bus has been previously created - uislib_client_inject_add_vnic() 877 * bus uislib_client_inject_add_vnic() 993 struct bus_info *bus; info_debugfs_read_helper() local 999 for (bus = bus_list; bus; bus = bus->next) { info_debugfs_read_helper() 1000 if (PLINE(" bus=0x%p, busNo=%d, deviceCount=%d\n", info_debugfs_read_helper() 1001 bus, bus->bus_no, bus->device_count) < 0) info_debugfs_read_helper() 1007 for (i = 0; i < bus->device_count; i++) { info_debugfs_read_helper() 1008 if (bus->device[i]) { info_debugfs_read_helper() 1010 bus->bus_no, i, bus->device[i], info_debugfs_read_helper() 1011 bus->device[i]->chanptr, info_debugfs_read_helper() 1012 bus->device[i]->swtch) < 0) info_debugfs_read_helper() 1016 bus->device[i]->first_busy_cnt, info_debugfs_read_helper() 1017 bus->device[i]->moved_to_tail_cnt, info_debugfs_read_helper() 1018 bus->device[i]->last_on_list_cnt) < 0) info_debugfs_read_helper() 1078 struct bus_info *bus; find_dev() local 1082 for (bus = bus_list; bus; bus = bus->next) { find_dev() 1083 if (bus->bus_no == bus_no) { find_dev() 1085 if (dev_no >= bus->device_count) find_dev() 1087 dev = bus->device[dev_no]; find_dev()
|
/linux-4.1.27/arch/mn10300/include/asm/ |
H A D | busctl-regs.h | 1 /* AM33v2 on-board bus controller registers 19 /* bus controller registers */ 20 #define BCCR __SYSREG(0xc0002000, u32) /* bus controller control reg */ 21 #define BCCR_B0AD 0x00000003 /* block 0 (80000000-83ffffff) bus allocation */ 22 #define BCCR_B1AD 0x0000000c /* block 1 (84000000-87ffffff) bus allocation */ 23 #define BCCR_B2AD 0x00000030 /* block 2 (88000000-8bffffff) bus allocation */ 24 #define BCCR_B3AD 0x000000c0 /* block 3 (8c000000-8fffffff) bus allocation */ 25 #define BCCR_B4AD 0x00000300 /* block 4 (90000000-93ffffff) bus allocation */ 26 #define BCCR_B5AD 0x00000c00 /* block 5 (94000000-97ffffff) bus allocation */ 27 #define BCCR_B6AD 0x00003000 /* block 6 (98000000-9bffffff) bus allocation */ 28 #define BCCR_B7AD 0x0000c000 /* block 7 (9c000000-9fffffff) bus allocation */ 29 #define BCCR_BxAD_EXBUS 0x0 /* - direct to system bus controller */ 30 #define BCCR_BxAD_OPEXBUS 0x1 /* - direct to memory bus controller */ 32 #define BCCR_API 0x00070000 /* bus arbitration priority */ 38 #define BCCR_BEPRI_DMACICD 0x00c00000 /* bus error address priority */ 50 #define BCBERR __SYSREG(0xc0002010, u32) /* bus error source reg */ 53 #define BCBERR_BESB_IO 0x00000002 /* - IO bus */ 54 #define BCBERR_BESB_EX 0x00000004 /* - EX bus */ 55 #define BCBERR_BESB_OPEX 0x00000008 /* - OpEX bus */ 62 #define BCBERR_BESD_SLAVE_BUS 0x00000200 /* - slave bus detected error */ 66 #define BCBERR_BEME 0x00000800 /* multiple bus error flag */ 67 #define BCBERR_BEMR 0x00007000 /* master bus that caused the error */ 69 #define BCBERR_BEMR_CI 0x00001000 /* - CPU instruction fetch bus caused error */ 70 #define BCBERR_BEMR_CD 0x00002000 /* - CPU data bus caused error */ 71 #define BCBERR_BEMR_DMA 0x00004000 /* - DMA bus caused error */ 73 #define BCBEAR __SYSREGC(0xc0002020, u32) /* bus error address reg */ 75 /* system bus controller registers */ 103 #define SBCNTRL2_BM 0x02000000 /* bus synchronisation mode */ 106 #define SBCNTRL2_BW 0x04000000 /* bus width */ 112 #define SBCNTRL2_BT 0x70000000 /* bus type setting */ 118 /* memory bus controller */ 125 #define SDRAMBUS __SYSREG(0xda000000, u32) /* bus mode control reg */
|
/linux-4.1.27/include/asm-generic/ |
H A D | parport.h | 5 * An ISA bus may have i8255 parallel ports at well-known 10 * to devices on the PCI bus.
|
H A D | topology.h | 54 #define pcibus_to_node(bus) ((void)(bus), -1) 58 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 60 cpumask_of_node(pcibus_to_node(bus)))
|
/linux-4.1.27/arch/arm/mach-cns3xxx/ |
H A D | pcie.c | 49 static struct cns3xxx_pcie *pbus_to_cnspci(struct pci_bus *bus) pbus_to_cnspci() argument 51 return sysdata_to_cnspci(bus->sysdata); pbus_to_cnspci() 54 static void __iomem *cns3xxx_pci_map_bus(struct pci_bus *bus, cns3xxx_pci_map_bus() argument 57 struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus); cns3xxx_pci_map_bus() 58 int busno = bus->number; cns3xxx_pci_map_bus() 69 * the first device on the same bus as the CNS PCI bridge. cns3xxx_pci_map_bus() 71 if (busno == 0) { /* internal PCIe bus, host bridge device */ cns3xxx_pci_map_bus() 82 } else /* remote PCI bus */ cns3xxx_pci_map_bus() 88 static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn, cns3xxx_pci_read_config() argument 95 ret = pci_generic_config_read32(bus, devfn, where, size, val); cns3xxx_pci_read_config() 97 if (ret == PCIBIOS_SUCCESSFUL && !bus->number && !devfn && cns3xxx_pci_read_config() 133 int irq = cnspci->irqs[!!dev->bus->number]; cns3xxx_pcie_map_irq() 136 pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn), cns3xxx_pcie_map_irq() 220 struct pci_bus bus = { cns3xxx_pcie_hw_init() local 234 pci_bus_write_config_byte(&bus, devfn, PCI_PRIMARY_BUS, 0); cns3xxx_pcie_hw_init() 235 pci_bus_write_config_byte(&bus, devfn, PCI_SECONDARY_BUS, 1); cns3xxx_pcie_hw_init() 236 pci_bus_write_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, 1); cns3xxx_pcie_hw_init() 238 pci_bus_read_config_byte(&bus, devfn, PCI_PRIMARY_BUS, &tmp8); cns3xxx_pcie_hw_init() 239 pci_bus_read_config_byte(&bus, devfn, PCI_SECONDARY_BUS, &tmp8); cns3xxx_pcie_hw_init() 240 pci_bus_read_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, &tmp8); cns3xxx_pcie_hw_init() 242 pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_BASE, mem_base); cns3xxx_pcie_hw_init() 243 pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_LIMIT, mem_limit); cns3xxx_pcie_hw_init() 244 pci_bus_write_config_word(&bus, devfn, PCI_IO_BASE_UPPER16, io_base); cns3xxx_pcie_hw_init() 245 pci_bus_write_config_word(&bus, devfn, PCI_IO_LIMIT_UPPER16, io_limit); cns3xxx_pcie_hw_init() 251 bus.number = 1; /* directly connected PCIe device */ cns3xxx_pcie_hw_init() 253 pos = pci_bus_find_capability(&bus, devfn, PCI_CAP_ID_EXP); cns3xxx_pcie_hw_init() 254 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); cns3xxx_pcie_hw_init() 257 pci_bus_write_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, dc); cns3xxx_pcie_hw_init() 258 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc); cns3xxx_pcie_hw_init()
|
/linux-4.1.27/arch/alpha/kernel/ |
H A D | sys_nautilus.c | 76 dev->bus->self && dev->bus->self->device == 0x700f) nautilus_map_irq() 85 struct pci_bus *bus = pci_isa_hose->bus; nautilus_kill_arch() local 93 pci_bus_read_config_byte(bus, 0x38, 0x43, &t8); nautilus_kill_arch() 94 pci_bus_write_config_byte(bus, 0x38, 0x43, t8 | 0x80); nautilus_kill_arch() 104 pci_bus_read_config_dword(bus, 0x88, 0x10, &pmuport); nautilus_kill_arch() 108 pci_bus_read_config_dword(bus, 0x88, 0xe0, &pmuport); nautilus_kill_arch() 203 struct pci_bus *bus; nautilus_init_pci() local 209 bus = pci_scan_bus(0, alpha_mv.pci_ops, hose); nautilus_init_pci() 210 if (!bus) nautilus_init_pci() 213 hose->bus = bus; nautilus_init_pci() 214 pcibios_claim_one_bus(bus); nautilus_init_pci() 217 bus->self = irongate; nautilus_init_pci() 218 bus->resource[0] = &irongate_io; nautilus_init_pci() 219 bus->resource[1] = &irongate_mem; nautilus_init_pci() 221 pci_bus_size_bridges(bus); nautilus_init_pci() 224 bus->resource[0]->start = 0; nautilus_init_pci() 225 bus->resource[0]->end = 0xffff; nautilus_init_pci() 229 bus_align = bus->resource[1]->start; nautilus_init_pci() 230 bus_size = bus->resource[1]->end + 1 - bus_align; nautilus_init_pci() 236 bus->resource[1]->start = pci_mem; nautilus_init_pci() 237 bus->resource[1]->end = 0xffffffffUL; nautilus_init_pci() 238 if (request_resource(&iomem_resource, bus->resource[1]) < 0) nautilus_init_pci() 253 pci_bus_assign_resources(bus); nautilus_init_pci() 255 /* pci_common_swizzle() relies on bus->self being NULL nautilus_init_pci() 256 for the root bus, so just clear it. */ nautilus_init_pci() 257 bus->self = NULL; nautilus_init_pci() 259 pci_bus_add_devices(bus); nautilus_init_pci()
|
H A D | pci.c | 35 "PCI IO bus 0", "PCI IO bus 1", "PCI IO bus 2", "PCI IO bus 3", 36 "PCI IO bus 4", "PCI IO bus 5", "PCI IO bus 6", "PCI IO bus 7" 40 "PCI mem bus 0", "PCI mem bus 1", "PCI mem bus 2", "PCI mem bus 3", 41 "PCI mem bus 4", "PCI mem bus 5", "PCI mem bus 6", "PCI mem bus 7" 87 /* The Cypress bridge responds on the PCI bus in the address range quirk_cypress() 243 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 245 struct pci_dev *dev = bus->self; pcibios_fixup_bus() 249 pci_read_bridge_bases(bus); pcibios_fixup_bus() 252 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_fixup_bus() 258 * If we set up a device for bus mastering, we need to check the latency 315 struct pci_bus *bus; common_init_pci() local 339 bus = pci_scan_root_bus(NULL, next_busno, alpha_mv.pci_ops, common_init_pci() 341 if (!bus) common_init_pci() 343 hose->bus = bus; common_init_pci() 345 next_busno = bus->busn_res.end + 1; common_init_pci() 346 /* Don't allow 8-bit bus number overflow inside the hose - common_init_pci() 359 bus = hose->bus; common_init_pci() 360 if (bus) common_init_pci() 361 pci_bus_add_devices(bus); common_init_pci() 394 sys_pciconfig_iobase(long which, unsigned long bus, unsigned long dfn) sys_pciconfig_iobase() argument 399 /* from hose or from bus.devfn */ sys_pciconfig_iobase() 402 if (hose->index == bus) break; sys_pciconfig_iobase() 406 if (bus == 0 && dfn == 0) { sys_pciconfig_iobase() 409 dev = pci_get_bus_and_slot(bus, dfn); sys_pciconfig_iobase() 429 return hose->bus->number; sys_pciconfig_iobase()
|
H A D | core_polaris.c | 36 * Given a bus, device, and function number, compute resulting 39 * cycles automatically depending on the bus number (Bus 0 is 51 * 23:16 bus number (8 bits = 128 possible buses) 69 u8 bus = pbus->number; mk_conf_addr() local 71 *type1 = (bus == 0) ? 0 : 1; mk_conf_addr() 72 *pci_addr = (bus << 16) | (device_fn << 8) | (where) | mk_conf_addr() 75 DBG_CFG(("mk_conf_addr(bus=%d ,device_fn=0x%x, where=0x%x," mk_conf_addr() 77 bus, device_fn, where, *pci_addr)); mk_conf_addr() 83 polaris_read_config(struct pci_bus *bus, unsigned int devfn, int where, polaris_read_config() argument 89 if (mk_conf_addr(bus, devfn, where, &addr, &type1)) polaris_read_config() 109 polaris_write_config(struct pci_bus *bus, unsigned int devfn, int where, polaris_write_config() argument 115 if (mk_conf_addr(bus, devfn, where, &addr, &type1)) polaris_write_config()
|
H A D | pci-sysfs.c | 61 * Use the bus mapping routines to map a PCI resource into userspace. 86 pcibios_resource_to_bus(pdev->bus, &bar, res); pci_mmap_resource() 142 pcibios_resource_to_bus(pdev->bus, &bar, &pdev->resource[num]); sparse_mem_mmap_fits() 147 to 128M or 512M of the bus space. */ sparse_mem_mmap_fits() 250 /* Legacy I/O bus mapping stuff. */ 282 int pci_mmap_legacy_page_range(struct pci_bus *bus, struct vm_area_struct *vma, pci_mmap_legacy_page_range() argument 285 struct pci_controller *hose = bus->sysdata; pci_mmap_legacy_page_range() 289 res_size = (mmap_type == pci_mmap_mem) ? bus->legacy_mem->size : pci_mmap_legacy_page_range() 290 bus->legacy_io->size; pci_mmap_legacy_page_range() 299 * @b: bus to create files under 304 void pci_adjust_legacy_attr(struct pci_bus *bus, enum pci_mmap_state mmap_type) pci_adjust_legacy_attr() argument 306 struct pci_controller *hose = bus->sysdata; pci_adjust_legacy_attr() 312 bus->legacy_mem->attr.name = "legacy_mem_sparse"; pci_adjust_legacy_attr() 313 bus->legacy_mem->size <<= 5; pci_adjust_legacy_attr() 315 bus->legacy_io->attr.name = "legacy_io_sparse"; pci_adjust_legacy_attr() 316 bus->legacy_io->size <<= 5; pci_adjust_legacy_attr() 321 /* Legacy I/O bus read/write functions */ pci_legacy_read() 322 int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size) pci_legacy_read() argument 324 struct pci_controller *hose = bus->sysdata; pci_legacy_read() 346 int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, size_t size) pci_legacy_write() argument 348 struct pci_controller *hose = bus->sysdata; pci_legacy_write()
|
H A D | sys_sable.c | 257 *32 PCI 0 slot 4 A primary bus 32 258 *33 PCI 0 slot 4 B primary bus 33 259 *34 PCI 0 slot 4 C primary bus 34 260 *35 PCI 0 slot 4 D primary bus 261 *36 PCI 0 slot 5 A primary bus 262 *37 PCI 0 slot 5 B primary bus 263 *38 PCI 0 slot 5 C primary bus 264 *39 PCI 0 slot 5 D primary bus 265 *40 PCI 0 slot 6 A primary bus 266 *41 PCI 0 slot 6 B primary bus 267 *42 PCI 0 slot 6 C primary bus 268 *43 PCI 0 slot 6 D primary bus 269 *44 PCI 0 slot 7 A primary bus 270 *45 PCI 0 slot 7 B primary bus 271 *46 PCI 0 slot 7 C primary bus 272 *47 PCI 0 slot 7 D primary bus 273 *48 PCI 0 slot 0 A secondary bus 274 *49 PCI 0 slot 0 B secondary bus 275 *50 PCI 0 slot 0 C secondary bus 276 *51 PCI 0 slot 0 D secondary bus 277 *52 PCI 0 slot 1 A secondary bus 278 *53 PCI 0 slot 1 B secondary bus 279 *54 PCI 0 slot 1 C secondary bus 280 *55 PCI 0 slot 1 D secondary bus 281 *56 PCI 0 slot 2 A secondary bus 282 *57 PCI 0 slot 2 B secondary bus 283 *58 PCI 0 slot 2 C secondary bus 284 *59 PCI 0 slot 2 D secondary bus 285 *60 PCI 0 slot 3 A secondary bus 286 *61 PCI 0 slot 3 B secondary bus 287 *62 PCI 0 slot 3 C secondary bus 288 *63 PCI 0 slot 3 D secondary bus 412 if (dev->bus->number == 0) { lynx_swizzle() 416 else if (PCI_SLOT(dev->bus->self->devfn) == 3) { lynx_swizzle() 423 if (PCI_SLOT(dev->bus->self->devfn) == 3) { lynx_swizzle() 430 dev = dev->bus->self; lynx_swizzle() 433 } while (dev->bus->self); lynx_swizzle()
|
/linux-4.1.27/arch/x86/kernel/ |
H A D | aperture_64.c | 95 static u32 __init find_cap(int bus, int slot, int func, int cap) find_cap() argument 100 if (!(read_pci_config_16(bus, slot, func, PCI_STATUS) & find_cap() 104 pos = read_pci_config_byte(bus, slot, func, PCI_CAPABILITY_LIST); find_cap() 109 id = read_pci_config_byte(bus, slot, func, pos+PCI_CAP_LIST_ID); find_cap() 114 pos = read_pci_config_byte(bus, slot, func, find_cap() 121 static u32 __init read_agp(int bus, int slot, int func, int cap, u32 *order) read_agp() argument 130 pr_info("pci 0000:%02x:%02x:%02x: AGP bridge\n", bus, slot, func); read_agp() 131 apsizereg = read_pci_config_16(bus, slot, func, cap + 0x14); read_agp() 134 bus, slot, func); read_agp() 150 aper_low = read_pci_config(bus, slot, func, 0x10); read_agp() 151 aper_hi = read_pci_config(bus, slot, func, 0x14); read_agp() 158 pr_info("pci 0000:%02x:%02x.%d: AGP aperture [bus addr %#010Lx-%#010Lx] (old size %uMB)\n", read_agp() 159 bus, slot, func, aper, aper + (32ULL << (old_order + 20)) - 1, read_agp() 163 bus, slot, func, 32 << *order, apsizereg); read_agp() 167 pr_info("pci 0000:%02x:%02x.%d: AGP aperture [bus addr %#010Lx-%#010Lx] (%uMB, APSIZE %#x)\n", read_agp() 168 bus, slot, func, aper, aper + (32ULL << (*order + 20)) - 1, read_agp() 181 * Do an PCI bus scan by hand because we're running before the PCI 186 * the AGP bridges should be always an own bus on the HT hierarchy, 191 int bus, slot, func; search_agp_bridge() local 194 for (bus = 0; bus < 256; bus++) { search_agp_bridge() 199 class = read_pci_config(bus, slot, func, search_agp_bridge() 208 cap = find_cap(bus, slot, func, search_agp_bridge() 213 return read_agp(bus, slot, func, cap, search_agp_bridge() 218 type = read_pci_config_byte(bus, slot, func, search_agp_bridge() 273 int bus; early_gart_iommu_check() local 276 bus = amd_nb_bus_dev_ranges[i].bus; early_gart_iommu_check() 281 if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) early_gart_iommu_check() 284 ctl = read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL); early_gart_iommu_check() 288 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff; early_gart_iommu_check() 329 int bus; early_gart_iommu_check() local 332 bus = amd_nb_bus_dev_ranges[i].bus; early_gart_iommu_check() 337 if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) early_gart_iommu_check() 340 ctl = read_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL); early_gart_iommu_check() 342 write_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL, ctl); early_gart_iommu_check() 370 int bus; gart_iommu_hole_init() local 374 bus = amd_nb_bus_dev_ranges[i].bus; gart_iommu_hole_init() 379 if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) gart_iommu_hole_init() 386 ctl = read_pci_config(bus, slot, 3, gart_iommu_hole_init() 396 write_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL, ctl); gart_iommu_hole_init() 400 aper_base = read_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE) & 0x7fff; gart_iommu_hole_init() 403 pr_info("Node %d: aperture [bus addr %#010Lx-%#010Lx] (%uMB)\n", gart_iommu_hole_init() 479 int bus, dev_base, dev_limit; gart_iommu_hole_init() local 487 bus = amd_nb_bus_dev_ranges[i].bus; gart_iommu_hole_init() 491 if (!early_is_amd_nb(read_pci_config(bus, slot, 3, 0x00))) gart_iommu_hole_init() 494 write_pci_config(bus, slot, 3, AMD64_GARTAPERTURECTL, ctl); gart_iommu_hole_init() 495 write_pci_config(bus, slot, 3, AMD64_GARTAPERTUREBASE, aper_alloc >> 25); gart_iommu_hole_init()
|
/linux-4.1.27/arch/microblaze/pci/ |
H A D | indirect_pci.c | 23 indirect_read_config(struct pci_bus *bus, unsigned int devfn, int offset, indirect_read_config() argument 26 struct pci_controller *hose = pci_bus_to_host(bus); indirect_read_config() 32 if (bus->number != hose->first_busno) indirect_read_config() 39 if (bus->number != hose->first_busno) indirect_read_config() 42 bus_no = (bus->number == hose->first_busno) ? indirect_read_config() 43 hose->self_busno : bus->number; indirect_read_config() 77 indirect_write_config(struct pci_bus *bus, unsigned int devfn, int offset, indirect_write_config() argument 80 struct pci_controller *hose = pci_bus_to_host(bus); indirect_write_config() 86 if (bus->number != hose->first_busno) indirect_write_config() 93 if (bus->number != hose->first_busno) indirect_write_config() 96 bus_no = (bus->number == hose->first_busno) ? indirect_write_config() 97 hose->self_busno : bus->number; indirect_write_config() 114 (bus->number == hose->first_busno)) indirect_write_config()
|
H A D | pci-common.c | 127 * Return the domain number for this bus. 129 int pci_domain_nr(struct pci_bus *bus) pci_domain_nr() argument 131 struct pci_controller *hose = pci_bus_to_host(bus); pci_domain_nr() 138 * PCI bus numbers have not yet been assigned, and you need to 158 /* No special bus mastering setup handling */ pcibios_set_master() 162 * Platform support for /proc/bus/pci/X/Y mmap()s, 169 * corresponding to the 32-bit pci bus offset for DEV requested by the user. 174 * offset parameter of mmap on /proc/bus/pci/XXX for that device. 182 struct pci_controller *hose = pci_bus_to_host(dev->bus); __pci_mmap_make_offset() 312 * decisions on a per-device or per-bus basis. 339 /* This provides legacy IO read access on a bus */ pci_legacy_read() 340 int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, size_t size) pci_legacy_read() argument 343 struct pci_controller *hose = pci_bus_to_host(bus); pci_legacy_read() 347 /* Check if port can be supported by that bus. We only check pci_legacy_read() 348 * the ranges of the PHB though, not the bus itself as the rules pci_legacy_read() 379 /* This provides legacy IO write access on a bus */ pci_legacy_write() 380 int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, size_t size) pci_legacy_write() argument 383 struct pci_controller *hose = pci_bus_to_host(bus); pci_legacy_write() 387 /* Check if port can be supported by that bus. We only check pci_legacy_write() 388 * the ranges of the PHB though, not the bus itself as the rules pci_legacy_write() 424 /* This provides legacy IO or memory mmap access on a bus */ pci_mmap_legacy_page_range() 425 int pci_mmap_legacy_page_range(struct pci_bus *bus, pci_mmap_legacy_page_range() argument 429 struct pci_controller *hose = pci_bus_to_host(bus); pci_mmap_legacy_page_range() 436 pci_domain_nr(bus), bus->number, pci_mmap_legacy_page_range() 454 pci_domain_nr(bus), bus->number); pci_mmap_legacy_page_range() 485 struct pci_controller *hose = pci_bus_to_host(dev->bus); pci_resource_to_user() 524 * @primary: set if primary bus (32 bits only, soon to be deprecated) 688 int pci_proc_domain(struct pci_bus *bus) pci_proc_domain() argument 698 struct pci_controller *hose = pci_bus_to_host(dev->bus); pcibios_fixup_resources() 737 static int pcibios_uninitialized_bridge_resource(struct pci_bus *bus, pcibios_uninitialized_bridge_resource() argument 740 struct pci_controller *hose = pci_bus_to_host(bus); pcibios_uninitialized_bridge_resource() 741 struct pci_dev *dev = bus->self; pcibios_uninitialized_bridge_resource() 799 static void pcibios_fixup_bridge(struct pci_bus *bus) pcibios_fixup_bridge() argument 804 struct pci_dev *dev = bus->self; pcibios_fixup_bridge() 806 pci_bus_for_each_resource(bus, res, i) { pci_bus_for_each_resource() 811 if (i >= 3 && bus->self->transparent) pci_bus_for_each_resource() 823 if (pcibios_uninitialized_bridge_resource(bus, res)) { pci_bus_for_each_resource() 836 void pcibios_setup_bus_self(struct pci_bus *bus) pcibios_setup_bus_self() argument 838 /* Fix up the bus resources for P2P bridges */ pcibios_setup_bus_self() 839 if (bus->self != NULL) pcibios_setup_bus_self() 840 pcibios_fixup_bridge(bus); pcibios_setup_bus_self() 843 void pcibios_setup_bus_devices(struct pci_bus *bus) pcibios_setup_bus_devices() argument 847 pr_debug("PCI: Fixup bus devices %d (%s)\n", pcibios_setup_bus_devices() 848 bus->number, bus->self ? pci_name(bus->self) : "PHB"); pcibios_setup_bus_devices() 850 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_setup_bus_devices() 857 set_dev_node(&dev->dev, pcibus_to_node(dev->bus)); pcibios_setup_bus_devices() 864 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 870 if (bus->self != NULL) pcibios_fixup_bus() 871 pci_read_bridge_bases(bus); pcibios_fixup_bus() 873 /* Now fixup the bus bus */ pcibios_fixup_bus() 874 pcibios_setup_bus_self(bus); pcibios_fixup_bus() 876 /* Now fixup devices on that bus */ pcibios_fixup_bus() 877 pcibios_setup_bus_devices(bus); pcibios_fixup_bus() 986 static void pcibios_allocate_bus_resources(struct pci_bus *bus) pcibios_allocate_bus_resources() argument 992 pr_debug("PCI: Allocating bus resources for %04x:%02x...\n", pcibios_allocate_bus_resources() 993 pci_domain_nr(bus), bus->number); pcibios_allocate_bus_resources() 995 pci_bus_for_each_resource(bus, res, i) { pci_bus_for_each_resource() 999 if (bus->parent == NULL) pci_bus_for_each_resource() 1009 pr = pci_find_parent_resource(bus->self, res); pci_bus_for_each_resource() 1019 pr_debug("PCI: %s (bus %d) bridge rsrc %d: %016llx-%016llx ", pci_bus_for_each_resource() 1020 bus->self ? pci_name(bus->self) : "PHB", pci_bus_for_each_resource() 1021 bus->number, i, pci_bus_for_each_resource() 1029 struct pci_dev *dev = bus->self; pci_bus_for_each_resource() 1048 pr_cont("%d of PCI bridge %d, will remap\n", i, bus->number); pci_bus_for_each_resource() 1053 list_for_each_entry(b, &bus->children, node) 1132 static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus) pcibios_reserve_legacy_regions() argument 1134 struct pci_controller *hose = pci_bus_to_host(bus); pcibios_reserve_legacy_regions() 1140 pci_domain_nr(bus)); pcibios_reserve_legacy_regions() 1155 pci_domain_nr(bus), bus->number, res); pcibios_reserve_legacy_regions() 1183 pci_domain_nr(bus), bus->number, res); pcibios_reserve_legacy_regions() 1203 * bus available resources to avoid allocating things on top of them pcibios_resource_survey() 1218 void pcibios_claim_one_bus(struct pci_bus *bus) pcibios_claim_one_bus() argument 1223 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_claim_one_bus() 1245 list_for_each_entry(child_bus, &bus->children, node) pcibios_claim_one_bus() 1254 * added to a bus, this include calling it for a PHB that is just 1257 void pcibios_finish_adding_to_bus(struct pci_bus *bus) pcibios_finish_adding_to_bus() argument 1259 pr_debug("PCI: Finishing adding to hotplug bus %04x:%02x\n", pcibios_finish_adding_to_bus() 1260 pci_domain_nr(bus), bus->number); pcibios_finish_adding_to_bus() 1262 /* Allocate bus and devices resources */ pcibios_finish_adding_to_bus() 1263 pcibios_allocate_bus_resources(bus); pcibios_finish_adding_to_bus() 1264 pcibios_claim_one_bus(bus); pcibios_finish_adding_to_bus() 1267 pci_bus_add_devices(bus); pcibios_finish_adding_to_bus() 1270 /* eeh_add_device_tree_late(bus); */ pcibios_finish_adding_to_bus() 1336 struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus) pcibios_get_phb_of_node() argument 1338 struct pci_controller *hose = bus->sysdata; pcibios_get_phb_of_node() 1346 struct pci_bus *bus; pcibios_scan_phb() local 1353 bus = pci_scan_root_bus(hose->parent, hose->first_busno, pcibios_scan_phb() 1355 if (bus == NULL) { pcibios_scan_phb() 1356 pr_err("Failed to create bus for PCI domain %04x\n", pcibios_scan_phb() 1361 bus->busn_res.start = hose->first_busno; pcibios_scan_phb() 1362 hose->bus = bus; pcibios_scan_phb() 1364 hose->last_busno = bus->busn_res.end; pcibios_scan_phb() 1386 if (hose->bus) pcibios_init() 1387 pci_bus_add_devices(hose->bus); pcibios_init() 1395 static struct pci_controller *pci_bus_to_hose(int bus) pci_bus_to_hose() argument 1400 if (bus >= hose->first_busno && bus <= hose->last_busno) pci_bus_to_hose() 1411 long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) sys_pciconfig_iobase() argument 1416 hose = pci_bus_to_hose(bus); sys_pciconfig_iobase() 1448 null_read_config(struct pci_bus *bus, unsigned int devfn, int offset, null_read_config() argument 1455 null_write_config(struct pci_bus *bus, unsigned int devfn, int offset, null_write_config() argument 1473 static struct pci_bus bus; fake_pci_bus() local 1476 pr_err("Can't find hose for PCI bus %d!\n", busnr); fake_pci_bus() 1478 bus.number = busnr; fake_pci_bus() 1479 bus.sysdata = hose; fake_pci_bus() 1480 bus.ops = hose ? hose->ops : &null_pci_ops; fake_pci_bus() 1481 return &bus; fake_pci_bus() 1485 int early_##rw##_config_##size(struct pci_controller *hose, int bus, \ 1488 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \ 1499 int early_find_capability(struct pci_controller *hose, int bus, int devfn, EARLY_PCI_OP() 1502 return pci_bus_find_capability(fake_pci_bus(hose, bus), devfn, cap); EARLY_PCI_OP()
|
H A D | xilinx_pci.c | 43 if (dev->devfn || dev->bus->self) xilinx_pci_fixup_bridge() 46 hose = pci_bus_to_host(dev->bus); xilinx_pci_fixup_bridge() 69 * xilinx_pci_exclude_device - Don't do config access for non-root bus 71 * This is a hack. Config access to any bus other than bus 0 does not 75 xilinx_pci_exclude_device(struct pci_controller *hose, u_char bus, u8 devfn) xilinx_pci_exclude_device() argument 77 return (bus != 0); xilinx_pci_exclude_device() 87 u32 bus = 0; xilinx_early_pci_scan() local 94 pr_info("%02x:%02x:%02x", bus, dev, func); xilinx_early_pci_scan() 98 early_read_config_dword(hose, bus, xilinx_early_pci_scan() 150 * a self-init when the bus master enable bit is set. Without this bit xilinx_pci_init() 151 * set the pci bus can't be scanned. xilinx_pci_init() 158 /* Set the max bus number to 255, and bus/subbus no's to 0 */ xilinx_pci_init()
|
/linux-4.1.27/arch/sparc/kernel/ |
H A D | pci_common.c | 19 unsigned long bus, config_out_of_range() 23 if (bus < pbm->pci_first_busno || config_out_of_range() 24 bus > pbm->pci_last_busno) config_out_of_range() 30 unsigned long bus, sun4u_config_mkaddr() 36 if (config_out_of_range(pbm, bus, devfn, reg)) sun4u_config_mkaddr() 41 bus <<= rbits + 8; sun4u_config_mkaddr() 43 return (void *) (pbm->config_space | bus | devfn | reg); sun4u_config_mkaddr() 52 unsigned char bus, unsigned int devfn, sun4u_read_pci_cfg_host() 59 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); sun4u_read_pci_cfg_host() 94 sun4u_read_pci_cfg_host(pbm, bus, devfn, sun4u_read_pci_cfg_host() 99 sun4u_read_pci_cfg_host(pbm, bus, devfn, sun4u_read_pci_cfg_host() 111 unsigned char bus = bus_dev->number; sun4u_read_pci_cfg() local 129 return sun4u_read_pci_cfg_host(pbm, bus, devfn, where, sun4u_read_pci_cfg() 132 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); sun4u_read_pci_cfg() 165 unsigned char bus, unsigned int devfn, sun4u_write_pci_cfg_host() 170 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); sun4u_write_pci_cfg_host() 202 sun4u_write_pci_cfg_host(pbm, bus, devfn, sun4u_write_pci_cfg_host() 204 sun4u_write_pci_cfg_host(pbm, bus, devfn, sun4u_write_pci_cfg_host() 215 unsigned char bus = bus_dev->number; sun4u_write_pci_cfg() local 219 return sun4u_write_pci_cfg_host(pbm, bus, devfn, where, sun4u_write_pci_cfg() 222 addr = sun4u_config_mkaddr(pbm, bus, devfn, where); sun4u_write_pci_cfg() 261 unsigned int bus = bus_dev->number; sun4v_read_pci_cfg() local 266 if (config_out_of_range(pbm, bus, devfn, where)) { sun4v_read_pci_cfg() 270 HV_PCI_DEVICE_BUILD(bus, device, func), sun4v_read_pci_cfg() 294 unsigned int bus = bus_dev->number; sun4v_write_pci_cfg() local 298 if (config_out_of_range(pbm, bus, devfn, where)) { sun4v_write_pci_cfg() 306 HV_PCI_DEVICE_BUILD(bus, device, func), sun4v_write_pci_cfg() 319 const u32 *val = of_get_property(pbm->op->dev.of_node, "bus-range", NULL); pci_get_pbm_props() 488 struct pci_bus *bus; pci_scan_for_target_abort() local 504 list_for_each_entry(bus, &pbus->children, node) pci_scan_for_target_abort() 505 pci_scan_for_target_abort(pbm, bus); pci_scan_for_target_abort() 512 struct pci_bus *bus; pci_scan_for_master_abort() local 527 list_for_each_entry(bus, &pbus->children, node) pci_scan_for_master_abort() 528 pci_scan_for_master_abort(pbm, bus); pci_scan_for_master_abort() 535 struct pci_bus *bus; pci_scan_for_parity_error() local 551 list_for_each_entry(bus, &pbus->children, node) pci_scan_for_parity_error() 552 pci_scan_for_parity_error(pbm, bus); pci_scan_for_parity_error() 18 config_out_of_range(struct pci_pbm_info *pbm, unsigned long bus, unsigned long devfn, unsigned long reg) config_out_of_range() argument 29 sun4u_config_mkaddr(struct pci_pbm_info *pbm, unsigned long bus, unsigned long devfn, unsigned long reg) sun4u_config_mkaddr() argument 51 sun4u_read_pci_cfg_host(struct pci_pbm_info *pbm, unsigned char bus, unsigned int devfn, int where, int size, u32 *value) sun4u_read_pci_cfg_host() argument 164 sun4u_write_pci_cfg_host(struct pci_pbm_info *pbm, unsigned char bus, unsigned int devfn, int where, int size, u32 value) sun4u_write_pci_cfg_host() argument
|
H A D | psycho_common.h | 9 * |0 0 0 0 0 0 0 0 1| bus | device | function | reg | 0 0 | 20 unsigned char bus, psycho_pci_config_mkaddr() 26 PSYCHO_CONFIG_ENCODE(bus, devfn, where)); psycho_pci_config_mkaddr() 19 psycho_pci_config_mkaddr(struct pci_pbm_info *pbm, unsigned char bus, unsigned int devfn, int where) psycho_pci_config_mkaddr() argument
|
/linux-4.1.27/drivers/zorro/ |
H A D | zorro.c | 38 * Zorro bus 130 struct zorro_bus *bus; amiga_zorro_probe() local 137 /* Initialize the Zorro bus */ amiga_zorro_probe() 138 bus = kzalloc(sizeof(*bus) + amiga_zorro_probe() 139 zorro_num_autocon * sizeof(bus->devices[0]), amiga_zorro_probe() 141 if (!bus) amiga_zorro_probe() 144 zorro_autocon = bus->devices; amiga_zorro_probe() 145 bus->dev.parent = &pdev->dev; amiga_zorro_probe() 146 dev_set_name(&bus->dev, zorro_bus_type.name); amiga_zorro_probe() 147 error = device_register(&bus->dev); amiga_zorro_probe() 150 put_device(&bus->dev); amiga_zorro_probe() 151 kfree(bus); amiga_zorro_probe() 154 platform_set_drvdata(pdev, bus); amiga_zorro_probe() 182 dev_err(&bus->dev, amiga_zorro_probe() 185 z->dev.parent = &bus->dev; amiga_zorro_probe() 186 z->dev.bus = &zorro_bus_type; amiga_zorro_probe() 195 dev_err(&bus->dev, "Error registering device %s\n", amiga_zorro_probe()
|
/linux-4.1.27/drivers/i2c/busses/ |
H A D | i2c-cros-ec-tunnel.c | 27 * @remote_bus: The EC bus number we tunnel to on the other side. 74 * @bus_num: The remote bus number we want to talk to. 180 struct ec_i2c_device *bus = adap->algo_data; ec_i2c_xfer() local 181 struct device *dev = bus->dev; ec_i2c_xfer() 182 const u16 bus_num = bus->remote_bus; ec_i2c_xfer() 210 result = cros_ec_cmd_xfer(bus->ec, &msg); ec_i2c_xfer() 237 struct ec_i2c_device *bus = NULL; ec_i2c_probe() local 246 bus = devm_kzalloc(dev, sizeof(*bus), GFP_KERNEL); ec_i2c_probe() 247 if (bus == NULL) ec_i2c_probe() 250 err = of_property_read_u32(np, "google,remote-bus", &remote_bus); ec_i2c_probe() 252 dev_err(dev, "Couldn't read remote-bus property\n"); ec_i2c_probe() 255 bus->remote_bus = remote_bus; ec_i2c_probe() 257 bus->ec = ec; ec_i2c_probe() 258 bus->dev = dev; ec_i2c_probe() 260 bus->adap.owner = THIS_MODULE; ec_i2c_probe() 261 strlcpy(bus->adap.name, "cros-ec-i2c-tunnel", sizeof(bus->adap.name)); ec_i2c_probe() 262 bus->adap.algo = &ec_i2c_algorithm; ec_i2c_probe() 263 bus->adap.algo_data = bus; ec_i2c_probe() 264 bus->adap.dev.parent = &pdev->dev; ec_i2c_probe() 265 bus->adap.dev.of_node = np; ec_i2c_probe() 266 bus->adap.retries = I2C_MAX_RETRIES; ec_i2c_probe() 268 err = i2c_add_adapter(&bus->adap); ec_i2c_probe() 273 platform_set_drvdata(pdev, bus); ec_i2c_probe() 280 struct ec_i2c_device *bus = platform_get_drvdata(dev); ec_i2c_remove() local 282 i2c_del_adapter(&bus->adap); ec_i2c_remove()
|
/linux-4.1.27/drivers/gpu/drm/i915/ |
H A D | intel_i2c.c | 86 static u32 get_reserved(struct intel_gmbus *bus) get_reserved() argument 88 struct drm_i915_private *dev_priv = bus->dev_priv; get_reserved() 94 reserved = I915_READ_NOTRACE(bus->gpio_reg) & get_reserved() 103 struct intel_gmbus *bus = data; get_clock() local 104 struct drm_i915_private *dev_priv = bus->dev_priv; get_clock() 105 u32 reserved = get_reserved(bus); get_clock() 106 I915_WRITE_NOTRACE(bus->gpio_reg, reserved | GPIO_CLOCK_DIR_MASK); get_clock() 107 I915_WRITE_NOTRACE(bus->gpio_reg, reserved); get_clock() 108 return (I915_READ_NOTRACE(bus->gpio_reg) & GPIO_CLOCK_VAL_IN) != 0; get_clock() 113 struct intel_gmbus *bus = data; get_data() local 114 struct drm_i915_private *dev_priv = bus->dev_priv; get_data() 115 u32 reserved = get_reserved(bus); get_data() 116 I915_WRITE_NOTRACE(bus->gpio_reg, reserved | GPIO_DATA_DIR_MASK); get_data() 117 I915_WRITE_NOTRACE(bus->gpio_reg, reserved); get_data() 118 return (I915_READ_NOTRACE(bus->gpio_reg) & GPIO_DATA_VAL_IN) != 0; get_data() 123 struct intel_gmbus *bus = data; set_clock() local 124 struct drm_i915_private *dev_priv = bus->dev_priv; set_clock() 125 u32 reserved = get_reserved(bus); set_clock() 134 I915_WRITE_NOTRACE(bus->gpio_reg, reserved | clock_bits); set_clock() 135 POSTING_READ(bus->gpio_reg); set_clock() 140 struct intel_gmbus *bus = data; set_data() local 141 struct drm_i915_private *dev_priv = bus->dev_priv; set_data() 142 u32 reserved = get_reserved(bus); set_data() 151 I915_WRITE_NOTRACE(bus->gpio_reg, reserved | data_bits); set_data() 152 POSTING_READ(bus->gpio_reg); set_data() 158 struct intel_gmbus *bus = container_of(adapter, intel_gpio_pre_xfer() local 161 struct drm_i915_private *dev_priv = bus->dev_priv; intel_gpio_pre_xfer() 165 set_data(bus, 1); intel_gpio_pre_xfer() 166 set_clock(bus, 1); intel_gpio_pre_xfer() 174 struct intel_gmbus *bus = container_of(adapter, intel_gpio_post_xfer() local 177 struct drm_i915_private *dev_priv = bus->dev_priv; intel_gpio_post_xfer() 179 set_data(bus, 1); intel_gpio_post_xfer() 180 set_clock(bus, 1); intel_gpio_post_xfer() 185 intel_gpio_setup(struct intel_gmbus *bus, u32 pin) intel_gpio_setup() argument 187 struct drm_i915_private *dev_priv = bus->dev_priv; intel_gpio_setup() 190 algo = &bus->bit_algo; intel_gpio_setup() 193 bus->gpio_reg = dev_priv->gpio_mmio_base + gmbus_ports[pin - 1].reg; intel_gpio_setup() 195 bus->adapter.algo_data = algo; intel_gpio_setup() 204 algo->data = bus; intel_gpio_setup() 434 struct intel_gmbus *bus = container_of(adapter, gmbus_xfer() local 437 struct drm_i915_private *dev_priv = bus->dev_priv; gmbus_xfer() 444 if (bus->force_bit) { gmbus_xfer() 452 I915_WRITE(GMBUS0 + reg_offset, bus->reg0); gmbus_xfer() 478 /* Generate a STOP condition on the bus. Note that gmbus can't generata gmbus_xfer() 499 * Wait for bus to IDLE before clearing NAK. gmbus_xfer() 500 * If we clear the NAK while bus is still active, then it will stay gmbus_xfer() 546 bus->adapter.name, bus->reg0 & 0xff); gmbus_xfer() 550 bus->force_bit = 1; gmbus_xfer() 595 struct intel_gmbus *bus = &dev_priv->gmbus[i]; intel_setup_gmbus() local 598 bus->adapter.owner = THIS_MODULE; intel_setup_gmbus() 599 bus->adapter.class = I2C_CLASS_DDC; intel_setup_gmbus() 600 snprintf(bus->adapter.name, intel_setup_gmbus() 601 sizeof(bus->adapter.name), intel_setup_gmbus() 605 bus->adapter.dev.parent = &dev->pdev->dev; intel_setup_gmbus() 606 bus->dev_priv = dev_priv; intel_setup_gmbus() 608 bus->adapter.algo = &gmbus_algorithm; intel_setup_gmbus() 611 bus->reg0 = port | GMBUS_RATE_100KHZ; intel_setup_gmbus() 615 bus->force_bit = 1; intel_setup_gmbus() 617 intel_gpio_setup(bus, port); intel_setup_gmbus() 619 ret = i2c_add_adapter(&bus->adapter); intel_setup_gmbus() 630 struct intel_gmbus *bus = &dev_priv->gmbus[i]; intel_setup_gmbus() local 631 i2c_del_adapter(&bus->adapter); intel_setup_gmbus() 647 struct intel_gmbus *bus = to_intel_gmbus(adapter); intel_gmbus_set_speed() local 649 bus->reg0 = (bus->reg0 & ~(0x3 << 8)) | speed; intel_gmbus_set_speed() 654 struct intel_gmbus *bus = to_intel_gmbus(adapter); intel_gmbus_force_bit() local 656 bus->force_bit += force_bit ? 1 : -1; intel_gmbus_force_bit() 659 bus->force_bit); intel_gmbus_force_bit() 668 struct intel_gmbus *bus = &dev_priv->gmbus[i]; intel_teardown_gmbus() local 669 i2c_del_adapter(&bus->adapter); intel_teardown_gmbus()
|
/linux-4.1.27/drivers/pci/hotplug/ |
H A D | cpci_hotplug_pci.c | 54 hs_cap = pci_bus_find_capability(slot->bus, cpci_get_attention_status() 60 if (pci_bus_read_config_word(slot->bus, cpci_get_attention_status() 74 hs_cap = pci_bus_find_capability(slot->bus, cpci_set_attention_status() 79 if (pci_bus_read_config_word(slot->bus, cpci_set_attention_status() 88 if (pci_bus_write_config_word(slot->bus, cpci_set_attention_status() 101 hs_cap = pci_bus_find_capability(slot->bus, cpci_get_hs_csr() 106 if (pci_bus_read_config_word(slot->bus, cpci_get_hs_csr() 120 hs_cap = pci_bus_find_capability(slot->bus, cpci_check_and_clear_ins() 125 if (pci_bus_read_config_word(slot->bus, cpci_check_and_clear_ins() 132 if (pci_bus_write_config_word(slot->bus, cpci_check_and_clear_ins() 149 hs_cap = pci_bus_find_capability(slot->bus, cpci_check_ext() 154 if (pci_bus_read_config_word(slot->bus, cpci_check_ext() 169 hs_cap = pci_bus_find_capability(slot->bus, cpci_clear_ext() 174 if (pci_bus_read_config_word(slot->bus, cpci_clear_ext() 181 if (pci_bus_write_config_word(slot->bus, cpci_clear_ext() 195 hs_cap = pci_bus_find_capability(slot->bus, cpci_led_on() 200 if (pci_bus_read_config_word(slot->bus, cpci_led_on() 207 if (pci_bus_write_config_word(slot->bus, cpci_led_on() 224 hs_cap = pci_bus_find_capability(slot->bus, cpci_led_off() 229 if (pci_bus_read_config_word(slot->bus, cpci_led_off() 236 if (pci_bus_write_config_word(slot->bus, cpci_led_off() 265 slot->bus->number, PCI_SLOT(slot->devfn), PCI_FUNC(slot->devfn)); cpci_configure_slot() 266 slot->dev = pci_get_slot(slot->bus, slot->devfn); cpci_configure_slot() 278 n = pci_scan_slot(slot->bus, slot->devfn); cpci_configure_slot() 280 slot->dev = pci_get_slot(slot->bus, slot->devfn); cpci_configure_slot() 287 parent = slot->dev->bus; cpci_configure_slot() 319 list_for_each_entry_safe(dev, temp, &slot->bus->devices, bus_list) { cpci_unconfigure_slot()
|
H A D | shpchp_sysfs.c | 44 struct pci_bus *bus; show_ctrl() local 47 bus = pdev->subordinate; show_ctrl() 50 pci_bus_for_each_resource(bus, res, index) { pci_bus_for_each_resource() 59 pci_bus_for_each_resource(bus, res, index) { pci_bus_for_each_resource() 68 pci_bus_for_each_resource(bus, res, index) { pci_bus_for_each_resource() 75 out += sprintf(out, "Free resources: bus numbers\n"); 76 for (busnr = bus->busn_res.start; busnr <= bus->busn_res.end; busnr++) { 77 if (!pci_find_bus(pci_domain_nr(bus), busnr)) 80 if (busnr < bus->busn_res.end) 82 busnr, (int)(bus->busn_res.end - busnr));
|
/linux-4.1.27/arch/sparc/include/asm/ |
H A D | topology_64.h | 29 #define cpumask_of_pcibus(bus) \ 30 (pcibus_to_node(bus) == -1 ? \ 32 cpumask_of_node(pcibus_to_node(bus)))
|
H A D | pbm.h | 3 * pbm.h: PCI bus module pseudo driver software state 7 * pbm.h: U2P PCI bus module pseudo driver software state. 15 * pci_bus - Linux PCI subsystem view of a PCI bus (including bridged buses) 16 * pbm - Arch-specific view of a PCI bus (sparc or sparc64) 33 /* Now things for the actual PCI bus probes. */
|
/linux-4.1.27/arch/powerpc/platforms/pseries/ |
H A D | pci_dlpar.c | 38 find_bus_among_children(struct pci_bus *bus, find_bus_among_children() argument 45 busdn = pci_bus_to_OF_node(bus); find_bus_among_children() 47 return bus; find_bus_among_children() 49 list_for_each_entry(tmp, &bus->children, node) { find_bus_among_children() 62 if (!pdn || !pdn->phb || !pdn->phb->bus) pcibios_find_pci_bus() 65 return find_bus_among_children(pdn->phb->bus, dn); pcibios_find_pci_bus() 91 pcibios_finish_adding_to_bus(phb->bus); init_phb_dynamic() 100 struct pci_bus *b = phb->bus; remove_phb_dynamic() 107 /* We cannot to remove a root bus that has children */ remove_phb_dynamic() 118 printk(KERN_ERR "%s: failed to unmap IO on bus %s\n", remove_phb_dynamic() 124 /* Remove the PCI bus and unregister the bridge device from sysfs */ remove_phb_dynamic() 125 phb->bus = NULL; remove_phb_dynamic()
|
H A D | pci.c | 102 && dev->bus->number == 0 && dev->devfn == 0x81) fixup_winbond_82c105() 116 struct pci_bus *bus; pseries_root_bridge_prepare() local 120 bus = bridge->bus; pseries_root_bridge_prepare() 122 dn = pcibios_get_phb_of_node(bus); pseries_root_bridge_prepare() 143 bus->max_bus_speed = PCIE_SPEED_2_5GT; pseries_root_bridge_prepare() 146 bus->max_bus_speed = PCIE_SPEED_5_0GT; pseries_root_bridge_prepare() 149 bus->max_bus_speed = PCIE_SPEED_8_0GT; pseries_root_bridge_prepare() 152 bus->max_bus_speed = PCI_SPEED_UNKNOWN; pseries_root_bridge_prepare() 158 bus->cur_bus_speed = PCIE_SPEED_2_5GT; pseries_root_bridge_prepare() 161 bus->cur_bus_speed = PCIE_SPEED_5_0GT; pseries_root_bridge_prepare() 164 bus->cur_bus_speed = PCIE_SPEED_8_0GT; pseries_root_bridge_prepare() 167 bus->cur_bus_speed = PCI_SPEED_UNKNOWN; pseries_root_bridge_prepare()
|
/linux-4.1.27/arch/frv/mb93090-mb00/ |
H A D | pci-vdk.c | 33 * insert specific PCI bus resources instead of using the platform-level bus 34 * resources directly for the PCI root bus. 37 * root bus by pcibios_fixup_bus(). 57 #define CONFIG_CMD(bus, dev, where) \ 58 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 85 // return dev->bus->number==0 && (dev->devfn==PCI_DEVFN(0,0)); __query() 86 // return dev->bus->number==1; __query() 87 // return dev->bus->number==0 && __query() 96 static int pci_frv_read_config(struct pci_bus *bus, unsigned int devfn, int where, int size, pci_frv_read_config() argument 101 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_frv_read_config() 105 __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); pci_frv_read_config() 129 static int pci_frv_write_config(struct pci_bus *bus, unsigned int devfn, int where, int size, pci_frv_write_config() argument 134 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_frv_write_config() 138 __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); pci_frv_write_config() 144 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_frv_write_config() 148 __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); pci_frv_write_config() 154 if (bus->number == 0 && devfn == PCI_DEVFN(0, 0)) { pci_frv_write_config() 158 __set_PciCfgAddr(CONFIG_CMD(bus, devfn, where)); pci_frv_write_config() 178 * whether bus 00 contains a host bridge (this is similar to checking 187 struct pci_bus bus; /* Fake bus and device */ pci_sanity_check() local 190 bus.number = 0; pci_sanity_check() 192 if (o->read(&bus, 0, PCI_VENDOR_ID, 4, &id) == PCIBIOS_SUCCESSFUL) { pci_sanity_check() 287 * Called after each bus is probed, but before its children 291 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 294 printk("### PCIBIOS_FIXUP_BUS(%d)\n",bus->number); pcibios_fixup_bus() 297 pci_read_bridge_bases(bus); pcibios_fixup_bus() 299 if (bus->number == 0) { pcibios_fixup_bus() 301 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_fixup_bus() 319 struct pci_bus *bus; pcibios_init() local 380 printk("PCI: No PCI bus detected\n"); pcibios_init() 387 bus = pci_scan_root_bus(NULL, 0, pci_root_ops, NULL, &resources); pcibios_init() 392 if (!bus) pcibios_init() 395 pci_bus_add_devices(bus); pcibios_init()
|
/linux-4.1.27/drivers/media/usb/cx231xx/ |
H A D | cx231xx-i2c.c | 36 MODULE_PARM_DESC(i2c_scan, "scan i2c bus at insmod time"); 64 static inline bool is_tuner(struct cx231xx *dev, struct cx231xx_i2c *bus, is_tuner() argument 67 int i2c_port = get_real_i2c_port(dev, bus->nr); is_tuner() 87 struct cx231xx_i2c *bus = i2c_adap->algo_data; cx231xx_i2c_send_bytes() local 88 struct cx231xx *dev = bus->dev; cx231xx_i2c_send_bytes() 98 if (is_tuner(dev, bus, msg, TUNER_XC5000)) { cx231xx_i2c_send_bytes() 157 bus->i2c_nostop = (size > 16) ? 1 : 0; cx231xx_i2c_send_bytes() 158 bus->i2c_reserve = (loop == 0) ? 0 : 1; cx231xx_i2c_send_bytes() 161 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_send_bytes() 171 bus->i2c_nostop = 0; cx231xx_i2c_send_bytes() 172 bus->i2c_reserve = 0; cx231xx_i2c_send_bytes() 185 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_send_bytes() 198 struct cx231xx_i2c *bus = i2c_adap->algo_data; cx231xx_i2c_recv_bytes() local 199 struct cx231xx *dev = bus->dev; cx231xx_i2c_recv_bytes() 205 if (is_tuner(dev, bus, msg, TUNER_XC5000)) { cx231xx_i2c_recv_bytes() 258 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_recv_bytes() 271 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_recv_bytes() 285 struct cx231xx_i2c *bus = i2c_adap->algo_data; cx231xx_i2c_recv_bytes_with_saddr() local 286 struct cx231xx *dev = bus->dev; cx231xx_i2c_recv_bytes_with_saddr() 297 if (is_tuner(dev, bus, msg2, TUNER_XC5000)) { cx231xx_i2c_recv_bytes_with_saddr() 336 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_recv_bytes_with_saddr() 348 struct cx231xx_i2c *bus = i2c_adap->algo_data; cx231xx_i2c_check_for_device() local 349 struct cx231xx *dev = bus->dev; cx231xx_i2c_check_for_device() 363 status = dev->cx231xx_send_usb_command(bus, &req_data); cx231xx_i2c_check_for_device() 375 struct cx231xx_i2c *bus = i2c_adap->algo_data; cx231xx_i2c_xfer() local 376 struct cx231xx *dev = bus->dev; cx231xx_i2c_xfer() 407 && (msgs[i].len <= 2) && (bus->nr < 3)) { cx231xx_i2c_xfer() 522 * register i2c bus 524 int cx231xx_i2c_register(struct cx231xx_i2c *bus) cx231xx_i2c_register() argument 526 struct cx231xx *dev = bus->dev; cx231xx_i2c_register() 530 bus->i2c_adap = cx231xx_adap_template; cx231xx_i2c_register() 531 bus->i2c_adap.dev.parent = dev->dev; cx231xx_i2c_register() 533 snprintf(bus->i2c_adap.name, sizeof(bus->i2c_adap.name), "%s-%d", bus->dev->name, bus->nr); cx231xx_i2c_register() 535 bus->i2c_adap.algo_data = bus; cx231xx_i2c_register() 536 i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev); cx231xx_i2c_register() 537 i2c_add_adapter(&bus->i2c_adap); cx231xx_i2c_register() 539 if (0 != bus->i2c_rc) cx231xx_i2c_register() 541 "i2c bus %d register FAILED\n", bus->nr); cx231xx_i2c_register() 543 return bus->i2c_rc; cx231xx_i2c_register() 550 int cx231xx_i2c_unregister(struct cx231xx_i2c *bus) cx231xx_i2c_unregister() argument 552 i2c_del_adapter(&bus->i2c_adap); cx231xx_i2c_unregister()
|
/linux-4.1.27/drivers/mmc/core/ |
H A D | Makefile | 6 mmc_core-y := core.o bus.o host.o \
|
/linux-4.1.27/include/media/ |
H A D | s3c_camif.h | 21 * @mbus_type: media bus type 22 * @i2c_bus_num: i2c control bus id the sensor is attached to 23 * @flags: the parallel bus flags defining signals polarity (V4L2_MBUS_*) 24 * @use_field: 1 if parallel bus FIELD signal is used (only s3c64xx)
|
H A D | sh_mobile_ceu.h | 4 #define SH_CEU_FLAG_USE_8BIT_BUS (1 << 0) /* use 8bit bus width */ 5 #define SH_CEU_FLAG_USE_16BIT_BUS (1 << 1) /* use 16bit bus width */
|
H A D | v4l2-of.h | 27 * struct v4l2_of_bus_mipi_csi2 - MIPI CSI-2 bus data structure 28 * @flags: media bus (V4L2_MBUS_*) flags 44 * struct v4l2_of_bus_parallel - parallel data bus data structure 45 * @flags: media bus (V4L2_MBUS_*) flags 46 * @bus_width: bus width in bits 58 * @bus_type: bus type 59 * @bus: bus configuration data structure 68 } bus; member in struct:v4l2_of_endpoint
|
/linux-4.1.27/arch/arm/plat-orion/include/plat/ |
H A D | pcie.h | 24 int orion_pcie_rd_conf(void __iomem *base, struct pci_bus *bus, 26 int orion_pcie_rd_conf_tlp(void __iomem *base, struct pci_bus *bus, 28 int orion_pcie_rd_conf_wa(void __iomem *wa_base, struct pci_bus *bus, 30 int orion_pcie_wr_conf(void __iomem *base, struct pci_bus *bus,
|
/linux-4.1.27/include/linux/can/platform/ |
H A D | mcp251x.h | 6 * CAN bus driver for Microchip 251x CAN Controller with SPI Interface
|
/linux-4.1.27/drivers/eisa/ |
H A D | Makefile | 3 obj-$(CONFIG_EISA) += eisa-bus.o 14 $(obj)/eisa-bus.o: $(obj)/devlist.h
|
/linux-4.1.27/arch/arm/mach-orion5x/ |
H A D | pci.c | 28 * Note1: The local PCIe bus number is '0'. The local PCI bus number 33 * device bus, Orion registers, etc. However this code only enable the 49 static int pcie_valid_config(int bus, int dev) pcie_valid_config() argument 53 * 1. nonexisting device on local bus pcie_valid_config() 56 if (bus == 0 && dev == 0) pcie_valid_config() 62 if (bus == 0 && dev != 1) pcie_valid_config() 76 static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, pcie_rd_conf() argument 82 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) { pcie_rd_conf() 88 ret = orion_pcie_rd_conf(PCIE_BASE, bus, devfn, where, size, val); pcie_rd_conf() 94 static int pcie_rd_conf_wa(struct pci_bus *bus, u32 devfn, pcie_rd_conf_wa() argument 99 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) { pcie_rd_conf_wa() 115 bus, devfn, where, size, val); pcie_rd_conf_wa() 120 static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, pcie_wr_conf() argument 126 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) pcie_wr_conf() 130 ret = orion_pcie_wr_conf(PCIE_BASE, bus, devfn, where, size, val); pcie_wr_conf() 225 #define PCI_CONF_BUS(bus) (((bus) & 0xff) << 16) 273 static int orion5x_pci_hw_rd_conf(int bus, int dev, u32 func, orion5x_pci_hw_rd_conf() argument 279 writel(PCI_CONF_BUS(bus) | orion5x_pci_hw_rd_conf() 295 static int orion5x_pci_hw_wr_conf(int bus, int dev, u32 func, orion5x_pci_hw_wr_conf() argument 303 writel(PCI_CONF_BUS(bus) | orion5x_pci_hw_wr_conf() 322 static int orion5x_pci_valid_config(int bus, u32 devfn) orion5x_pci_valid_config() argument 324 if (bus == orion5x_pci_local_bus_nr()) { orion5x_pci_valid_config() 342 static int orion5x_pci_rd_conf(struct pci_bus *bus, u32 devfn, orion5x_pci_rd_conf() argument 345 if (!orion5x_pci_valid_config(bus->number, devfn)) { orion5x_pci_rd_conf() 350 return orion5x_pci_hw_rd_conf(bus->number, PCI_SLOT(devfn), orion5x_pci_rd_conf() 354 static int orion5x_pci_wr_conf(struct pci_bus *bus, u32 devfn, orion5x_pci_wr_conf() argument 357 if (!orion5x_pci_valid_config(bus->number, devfn)) orion5x_pci_wr_conf() 360 return orion5x_pci_hw_wr_conf(bus->number, PCI_SLOT(devfn), orion5x_pci_wr_conf() 377 u32 pcix_status, bus, dev; orion5x_pci_set_bus_nr() local 378 bus = (p2p & PCI_P2P_BUS_MASK) >> PCI_P2P_BUS_OFFS; orion5x_pci_set_bus_nr() 380 orion5x_pci_hw_rd_conf(bus, dev, 0, PCIX_STAT, 4, &pcix_status); orion5x_pci_set_bus_nr() 383 orion5x_pci_hw_wr_conf(bus, dev, 0, PCIX_STAT, 4, pcix_status); orion5x_pci_set_bus_nr() 411 int bus; orion5x_setup_pci_wins() local 423 bus = orion5x_pci_local_bus_nr(); orion5x_setup_pci_wins() 435 orion5x_pci_hw_rd_conf(bus, 0, func, reg, 4, &val); orion5x_setup_pci_wins() 437 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, val); orion5x_setup_pci_wins() 443 orion5x_pci_hw_wr_conf(bus, 0, func, reg, 4, 0); orion5x_setup_pci_wins() 517 if (dev->bus->parent == NULL && dev->devfn == 0) { rc_pci_fixup() 574 int bus = dev->bus->number; orion5x_pci_map_irq() local 579 if (orion5x_pci_disabled || bus < orion5x_pci_local_bus_nr()) orion5x_pci_map_irq()
|
/linux-4.1.27/drivers/media/v4l2-core/ |
H A D | v4l2-of.c | 25 struct v4l2_of_bus_mipi_csi2 *bus = &endpoint->bus.mipi_csi2; v4l2_of_parse_csi_bus() local 36 for (i = 0; i < ARRAY_SIZE(bus->data_lanes); i++) { v4l2_of_parse_csi_bus() 40 bus->data_lanes[i] = v; v4l2_of_parse_csi_bus() 42 bus->num_data_lanes = i; v4l2_of_parse_csi_bus() 50 for (i = 0; i < ARRAY_SIZE(bus->lane_polarities); i++) { v4l2_of_parse_csi_bus() 54 bus->lane_polarities[i] = v; v4l2_of_parse_csi_bus() 57 if (i < 1 + bus->num_data_lanes /* clock + data */) { v4l2_of_parse_csi_bus() 59 node->full_name, 1 + bus->num_data_lanes, i); v4l2_of_parse_csi_bus() 65 bus->clock_lane = v; v4l2_of_parse_csi_bus() 71 else if (have_clk_lane || bus->num_data_lanes > 0) v4l2_of_parse_csi_bus() 74 bus->flags = flags; v4l2_of_parse_csi_bus() 83 struct v4l2_of_bus_parallel *bus = &endpoint->bus.parallel; v4l2_of_parse_parallel_bus() local 116 if (!of_property_read_u32(node, "bus-width", &v)) v4l2_of_parse_parallel_bus() 117 bus->bus_width = v; v4l2_of_parse_parallel_bus() 120 bus->data_shift = v; v4l2_of_parse_parallel_bus() 126 bus->flags = flags; v4l2_of_parse_parallel_bus() 138 * If any properties that identify the bus as parallel are found and 140 * the bus as serial CSI-2 and clock-noncontinuous isn't set, we set the 153 memset(&endpoint->bus, 0, sizeof(endpoint->bus)); v4l2_of_parse_endpoint() 159 * Parse the parallel video bus properties only if none v4l2_of_parse_endpoint() 162 if (endpoint->bus.mipi_csi2.flags == 0) v4l2_of_parse_endpoint()
|
/linux-4.1.27/arch/ia64/include/asm/ |
H A D | topology.h | 44 * Determines the node for a given pci bus 46 #define pcibus_to_node(bus) PCI_CONTROLLER(bus)->node 61 #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \ 63 cpumask_of_node(pcibus_to_node(bus)))
|
/linux-4.1.27/tools/power/cpupower/utils/helpers/ |
H A D | pci.c | 14 * bus: bus 25 struct pci_dev *pci_acc_init(struct pci_access **pacc, int domain, int bus, pci_acc_init() argument 37 filter_nb_link.bus = bus; pci_acc_init() 55 and bus */ pci_slot_func_init()
|
/linux-4.1.27/drivers/net/ethernet/ti/ |
H A D | davinci_mdio.c | 96 struct mii_bus *bus; member in struct:davinci_mdio_data 100 * if MDIO bus is registered from DT. 121 * 24 bits of bus yield (not needed unless shared?) __davinci_mdio_reset() 128 * after the mdio bus scan state-machine triggered its own read. If __davinci_mdio_reset() 137 static int davinci_mdio_reset(struct mii_bus *bus) davinci_mdio_reset() argument 139 struct davinci_mdio_data *data = bus->priv; davinci_mdio_reset() 158 /* restrict mdio bus to live phys only */ davinci_mdio_reset() 166 data->bus->phy_mask = phy_mask; davinci_mdio_reset() 219 static int davinci_mdio_read(struct mii_bus *bus, int phy_id, int phy_reg) davinci_mdio_read() argument 221 struct davinci_mdio_data *data = bus->priv; davinci_mdio_read() 263 static int davinci_mdio_write(struct mii_bus *bus, int phy_id, davinci_mdio_write() argument 266 struct davinci_mdio_data *data = bus->priv; davinci_mdio_write() 336 data->bus = devm_mdiobus_alloc(dev); davinci_mdio_probe() 337 if (!data->bus) { davinci_mdio_probe() 338 dev_err(dev, "failed to alloc mii bus\n"); davinci_mdio_probe() 345 snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s", pdev->name); davinci_mdio_probe() 348 snprintf(data->bus->id, MII_BUS_ID_SIZE, "%s-%x", davinci_mdio_probe() 352 data->bus->name = dev_name(dev); davinci_mdio_probe() 353 data->bus->read = davinci_mdio_read, davinci_mdio_probe() 354 data->bus->write = davinci_mdio_write, davinci_mdio_probe() 355 data->bus->reset = davinci_mdio_reset, davinci_mdio_probe() 356 data->bus->parent = dev; davinci_mdio_probe() 357 data->bus->priv = data; davinci_mdio_probe() 380 /* register the mii bus davinci_mdio_probe() 383 * Davinci MDIO will always scan the bus for PHYs detection. davinci_mdio_probe() 387 ret = of_mdiobus_register(data->bus, dev->of_node); davinci_mdio_probe() 389 ret = mdiobus_register(data->bus); davinci_mdio_probe() 394 /* scan and dump the bus */ davinci_mdio_probe() 396 phy = data->bus->phy_map[addr]; davinci_mdio_probe() 417 if (data->bus) davinci_mdio_remove() 418 mdiobus_unregister(data->bus); davinci_mdio_remove()
|
/linux-4.1.27/drivers/pci/host/ |
H A D | pcie-iproc.c | 70 static void __iomem *iproc_pcie_map_cfg_bus(struct pci_bus *bus, iproc_pcie_map_cfg_bus() argument 74 struct pci_sys_data *sys = bus->sysdata; iproc_pcie_map_cfg_bus() 78 unsigned busno = bus->number; iproc_pcie_map_cfg_bus() 126 static int iproc_pcie_check_link(struct iproc_pcie *pcie, struct pci_bus *bus) iproc_pcie_check_link() argument 134 pci_bus_read_config_byte(bus, 0, PCI_HEADER_TYPE, &hdr_type); iproc_pcie_check_link() 141 pci_bus_write_config_word(bus, 0, PCI_CLASS_DEVICE, iproc_pcie_check_link() 145 pos = pci_bus_find_capability(bus, 0, PCI_CAP_ID_EXP); iproc_pcie_check_link() 146 pci_bus_read_config_word(bus, 0, pos + PCI_EXP_LNKSTA, &link_status); iproc_pcie_check_link() 156 pci_bus_read_config_dword(bus, 0, iproc_pcie_check_link() 163 pci_bus_write_config_dword(bus, 0, iproc_pcie_check_link() 168 pos = pci_bus_find_capability(bus, 0, PCI_CAP_ID_EXP); iproc_pcie_check_link() 169 pci_bus_read_config_word(bus, 0, pos + PCI_EXP_LNKSTA, iproc_pcie_check_link() 189 struct pci_bus *bus; iproc_pcie_setup() local 213 bus = pci_create_root_bus(pcie->dev, 0, &iproc_pcie_ops, iproc_pcie_setup() 215 if (!bus) { iproc_pcie_setup() 216 dev_err(pcie->dev, "unable to create PCI root bus\n"); iproc_pcie_setup() 220 pcie->root_bus = bus; iproc_pcie_setup() 222 ret = iproc_pcie_check_link(pcie, bus); iproc_pcie_setup() 230 pci_scan_child_bus(bus); iproc_pcie_setup() 231 pci_assign_unassigned_bus_resources(bus); iproc_pcie_setup() 233 pci_bus_add_devices(bus); iproc_pcie_setup() 238 pci_stop_root_bus(bus); iproc_pcie_setup() 239 pci_remove_root_bus(bus); iproc_pcie_setup()
|
/linux-4.1.27/arch/powerpc/boot/ |
H A D | cuboot-c2k.c | 37 int bus; c2k_bridge_setup() local 64 for (bus = 0; ; bus++) { c2k_bridge_setup() 67 name[strlen(name)-1] = bus+'0'; c2k_bridge_setup() 73 if (bus >= 2) c2k_bridge_setup() 77 mv64x60_config_pci_windows(bridge_base, bridge_pbase, bus, 0, c2k_bridge_setup() 111 mv64x60_config_cpu2pci_window(bridge_base, bus, c2k_bridge_setup() 115 enables &= ~(3<<(9+bus*5)); /* Enable cpu->pci<bus> i/o, c2k_bridge_setup() 116 cpu->pci<bus> mem0 */ c2k_bridge_setup()
|
/linux-4.1.27/arch/alpha/include/asm/ |
H A D | pci.h | 26 struct pci_bus *bus; member in struct:pci_controller 53 bus numbers. */ 98 #define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 100 static inline int pci_proc_domain(struct pci_bus *bus) pci_proc_domain() argument 102 struct pci_controller *hose = bus->sysdata; pci_proc_domain() 119 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, 121 extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, 123 extern int pci_mmap_legacy_page_range(struct pci_bus *bus, 126 extern void pci_adjust_legacy_attr(struct pci_bus *bus,
|
/linux-4.1.27/arch/m68k/coldfire/ |
H A D | pci.c | 2 * pci.c -- PCI bus support for ColdFire processors 26 * PCI bus memory (no reason not to really). IO space doesn't matter, we 44 * We need to be carefull probing on bus 0 (directly connected to host 62 /* The ColdFire "nop" instruction waits for all bus IO to complete */ syncio() 70 static unsigned long mcf_mk_pcicar(int bus, unsigned int devfn, int where) mcf_mk_pcicar() argument 72 return (bus << PCICAR_BUSN) | (devfn << PCICAR_DEVFNN) | (where & 0xfc); mcf_mk_pcicar() 75 static int mcf_pci_readconfig(struct pci_bus *bus, unsigned int devfn, mcf_pci_readconfig() argument 82 if (bus->number == 0) { mcf_pci_readconfig() 88 addr = mcf_mk_pcicar(bus->number, devfn, where); mcf_pci_readconfig() 109 static int mcf_pci_writeconfig(struct pci_bus *bus, unsigned int devfn, mcf_pci_writeconfig() argument 114 if (bus->number == 0) { mcf_pci_writeconfig() 120 addr = mcf_mk_pcicar(bus->number, devfn, where); mcf_pci_writeconfig() 230 * Initialize the PCI bus registers, and scan the bus. 261 pr_info("ColdFire: PCI bus initialization...\n"); mcf_pci_init() 263 /* Reset the external PCI bus */ mcf_pci_init() 274 /* Set required multi-function pins for PCI bus use */ mcf_pci_init() 278 /* Set up config space for local host bus controller */ mcf_pci_init() 286 * These give the CPU bus access onto the PCI bus. One for each of mcf_pci_init() 297 * Set up the target windows for access from the PCI bus back to the mcf_pci_init() 298 * CPU bus. All we need is access to system RAM (for mastering). mcf_pci_init()
|
/linux-4.1.27/arch/powerpc/platforms/maple/ |
H A D | pci.c | 50 bus_range = of_get_property(node, "bus-range", &len); fixup_one_level_bus_range() 60 /* This routine fixes the "bus-range" property of all bridges in the 63 * Note that the bus numbers manipulated here are OF bus numbers, they 64 * are not Linux bus numbers. 72 /* Lookup the "bus-range" property for the hose */ fixup_bus_range() 73 prop = of_find_property(bridge, "bus-range", &len); fixup_bus_range() 75 printk(KERN_WARNING "Can't get bus-range for %s\n", fixup_bus_range() 91 static unsigned long u3_agp_cfa1(u8 bus, u8 devfn, u8 off) u3_agp_cfa1() argument 93 return ((unsigned long)bus << 16) | u3_agp_cfa1() 100 u8 bus, u8 dev_fn, u8 offset) u3_agp_cfg_access() 104 if (bus == hose->first_busno) { u3_agp_cfg_access() 109 caddr = u3_agp_cfa1(bus, dev_fn, offset); u3_agp_cfg_access() 120 static int u3_agp_read_config(struct pci_bus *bus, unsigned int devfn, u3_agp_read_config() argument 126 hose = pci_bus_to_host(bus); u3_agp_read_config() 130 addr = u3_agp_cfg_access(hose, bus->number, devfn, offset); u3_agp_read_config() 151 static int u3_agp_write_config(struct pci_bus *bus, unsigned int devfn, u3_agp_write_config() argument 157 hose = pci_bus_to_host(bus); u3_agp_write_config() 161 addr = u3_agp_cfg_access(hose, bus->number, devfn, offset); u3_agp_write_config() 193 static unsigned long u3_ht_cfa1(u8 bus, u8 devfn, u8 off) u3_ht_cfa1() argument 195 return u3_ht_cfa0(devfn, off) + (bus << 16) + 0x01000000UL; u3_ht_cfa1() 199 u8 bus, u8 devfn, u8 offset) u3_ht_cfg_access() 201 if (bus == hose->first_busno) { u3_ht_cfg_access() 206 return hose->cfg_data + u3_ht_cfa1(bus, devfn, offset); u3_ht_cfg_access() 257 static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, u3_ht_read_config() argument 263 hose = pci_bus_to_host(bus); u3_ht_read_config() 267 if (bus->number == hose->first_busno && devfn == PCI_DEVFN(0, 0)) u3_ht_read_config() 273 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); u3_ht_read_config() 295 static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, u3_ht_write_config() argument 301 hose = pci_bus_to_host(bus); u3_ht_write_config() 305 if (bus->number == hose->first_busno && devfn == PCI_DEVFN(0, 0)) u3_ht_write_config() 311 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); u3_ht_write_config() 346 static unsigned int u4_pcie_cfa1(unsigned int bus, unsigned int devfn, u4_pcie_cfa1() argument 349 return (bus << 16) | u4_pcie_cfa1() 356 u8 bus, u8 dev_fn, int offset) u4_pcie_cfg_access() 360 if (bus == hose->first_busno) u4_pcie_cfg_access() 363 caddr = u4_pcie_cfa1(bus, dev_fn, offset); u4_pcie_cfg_access() 374 static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn, u4_pcie_read_config() argument 380 hose = pci_bus_to_host(bus); u4_pcie_read_config() 385 addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset); u4_pcie_read_config() 405 static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn, u4_pcie_write_config() argument 411 hose = pci_bus_to_host(bus); u4_pcie_write_config() 416 addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset); u4_pcie_write_config() 445 /* On G5, we move AGP up to high bus number so we don't need setup_u3_agp() 446 * to reassign bus numbers for HT. If we ever have P2P bridges setup_u3_agp() 502 bus_range = of_get_property(dev, "bus-range", &len); maple_add_bridge() 504 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", maple_add_bridge() 529 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", maple_add_bridge() 536 /* Fixup "bus-range" OF property */ maple_add_bridge() 551 if (u4_pcie != NULL && dev->bus->number == 0 && maple_pci_irq_fixup() 552 pci_bus_to_host(dev->bus) == u4_pcie) { maple_pci_irq_fixup() 611 /* Fixup the PCI<->OF mapping for U3 AGP due to bus renumbering. We maple_pci_init() 612 * assume there is no P2P bridge on the AGP bus, which should be a maple_pci_init() 99 u3_agp_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, u8 offset) u3_agp_cfg_access() argument 198 u3_ht_cfg_access(struct pci_controller* hose, u8 bus, u8 devfn, u8 offset) u3_ht_cfg_access() argument 355 u4_pcie_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, int offset) u4_pcie_cfg_access() argument
|
/linux-4.1.27/arch/ia64/sn/kernel/ |
H A D | io_init.c | 28 static int max_pcibus_number = 255; /* Default highest pci bus number */ 47 * Retrieve the pci bus information given the bus number. 62 * Retrieve the pci device information given the bus and device|function number. 97 * Inform Prom that this kernel can support domain bus numbering. sn_fixup_ionodes() 168 (u64) dev->bus->number, sn_io_slot_fixup() 230 * sn_pci_controller_fixup() - This routine sets up a bus's resources 234 sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus) sn_pci_controller_fixup() argument 245 return; /*bus # does not exist */ sn_pci_controller_fixup() 269 bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, controller, sn_pci_controller_fixup() 271 if (bus == NULL) { sn_pci_controller_fixup() 276 pci_bus_add_devices(bus); sn_pci_controller_fixup() 283 sn_bus_fixup(struct pci_bus *bus) sn_bus_fixup() argument 288 if (!bus->parent) { /* If root bus */ sn_bus_fixup() 289 prom_bussoft_ptr = PCI_CONTROLLER(bus)->platform_data; sn_bus_fixup() 294 pci_domain_nr(bus), bus->number); sn_bus_fixup() 297 sn_common_bus_fixup(bus, prom_bussoft_ptr); sn_bus_fixup() 299 list_for_each_entry(pci_dev, &bus->devices, bus_list) { sn_bus_fixup() 308 * bus scanning ourselves.
|
/linux-4.1.27/drivers/i2c/muxes/ |
H A D | i2c-mux-pca9541.c | 2 * I2C multiplexer driver for PCA9541 bus master selector 30 * The PCA9541 is a bus master selector. It supports two I2C masters connected 31 * to a single slave bus. 33 * Before each bus transaction, a master has to acquire bus ownership. After the 34 * transaction is complete, bus ownership has to be released. This fits well 37 * single-channel I2C bus multiplexer. 39 * This driver assumes that the two bus masters are controlled by two different 68 #define ARB_TIMEOUT (HZ / 8) /* 125 ms until forcing bus ownership */ 170 /* Release bus. Also reset NTESTON and BUSINIT if it was set. */ pca9541_release_bus() 182 * Arbitration is defined as a two-step process. A bus master can only activate 183 * the slave bus if it owns it; otherwise it has to request ownership first. 193 * off yes no turn on bus 196 * for other master to release bus 198 * The main contention point occurs if the slave bus is off and both masters 200 * the slave bus, believing that it owns it. The other master will request 201 * bus ownership. Result is that the bus is turned on, and master which did 202 * _not_ own the slave bus before ends up owning it. 215 * 0 : bus not acquired 216 * 1 : bus acquired 238 * or arbitration timeout expired. Take the bus. pca9541_arbitrate() 265 * Other master owns the bus. pca9541_arbitrate() 271 /* Time is up, take the bus and reset it. */ pca9541_arbitrate() 278 /* Request bus ownership if needed */ pca9541_arbitrate() 296 /* force bus ownership after this time */ pca9541_select_chan() 344 * We have to lock the adapter before releasing the bus. pca9541_probe()
|
/linux-4.1.27/drivers/sh/superhyway/ |
H A D | superhyway.c | 40 * @bus: Bus where SuperHyway module resides. 54 struct superhyway_bus *bus) superhyway_add_device() 65 dev->bus = bus; superhyway_add_device() 81 dev->dev.bus = &superhyway_bus_type; superhyway_add_device() 93 int superhyway_add_devices(struct superhyway_bus *bus, superhyway_add_devices() argument 101 ret |= superhyway_add_device(dev->resource[0].start, dev, bus); superhyway_add_devices() 109 struct superhyway_bus *bus; superhyway_init() local 116 for (bus = superhyway_channels; bus->ops; bus++) superhyway_init() 117 ret |= superhyway_scan_bus(bus); superhyway_init() 177 drv->drv.bus = &superhyway_bus_type; superhyway_register_driver() 53 superhyway_add_device(unsigned long base, struct superhyway_device *sdev, struct superhyway_bus *bus) superhyway_add_device() argument
|
/linux-4.1.27/arch/microblaze/include/asm/ |
H A D | pci.h | 43 * bus numbers (don't do that on ppc64 yet !) 57 extern int pci_domain_nr(struct pci_bus *bus); 60 extern int pci_proc_domain(struct pci_bus *bus); 70 extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, 72 extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, 74 extern int pci_mmap_legacy_page_range(struct pci_bus *bus, 101 extern void pcibios_finish_adding_to_bus(struct pci_bus *bus); 109 struct pci_bus *bus, int devfn); 114 extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); 115 extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); 117 extern int pci_bus_find_capability(struct pci_bus *bus, 131 extern void pcibios_setup_bus_devices(struct pci_bus *bus); 132 extern void pcibios_setup_bus_self(struct pci_bus *bus);
|
H A D | pci-bridge.h | 30 struct pci_bus *bus; member in struct:pci_controller 47 * the PCI memory space in the CPU bus space 68 * to determine which bus number to match on when generating type0 95 static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus) pci_bus_to_host() argument 97 return bus->sysdata; pci_bus_to_host() 111 extern int early_read_config_byte(struct pci_controller *hose, int bus, 113 extern int early_read_config_word(struct pci_controller *hose, int bus, 115 extern int early_read_config_dword(struct pci_controller *hose, int bus, 117 extern int early_write_config_byte(struct pci_controller *hose, int bus, 119 extern int early_write_config_word(struct pci_controller *hose, int bus, 121 extern int early_write_config_dword(struct pci_controller *hose, int bus, 124 extern int early_find_capability(struct pci_controller *hose, int bus,
|
/linux-4.1.27/drivers/staging/fsl-mc/include/ |
H A D | mc-private.h | 2 * Freescale Management Complex (MC) bus private declarations 32 * @addr_translation_ranges: array of bus to system address translation ranges 41 * struct fsl_mc_addr_translation_range - bus to system address translation 62 * @mc_bus: pointer to the MC bus that owns this resource pool 74 * struct fsl_mc_bus - logical bus that corresponds to a physical DPRC 75 * @mc_dev: fsl-mc device for the bus device itself. 77 * for this MC bus. These resources represent allocatable entities 79 * @scan_mutex: Serializes bus scanning 84 struct mutex scan_mutex; /* serializes bus scanning */
|
/linux-4.1.27/drivers/usb/core/ |
H A D | buffer.c | 5 * and should work with all USB controllers, regardless of bus type. 49 * @hcd: the bus whose buffer pools are to be initialized 87 * @hcd: the bus whose buffer pools are to be destroyed 111 struct usb_bus *bus, hcd_buffer_alloc() 117 struct usb_hcd *hcd = bus_to_hcd(bus); hcd_buffer_alloc() 121 if (!bus->controller->dma_mask && hcd_buffer_alloc() 135 struct usb_bus *bus, hcd_buffer_free() 141 struct usb_hcd *hcd = bus_to_hcd(bus); hcd_buffer_free() 147 if (!bus->controller->dma_mask && hcd_buffer_free() 110 hcd_buffer_alloc( struct usb_bus *bus, size_t size, gfp_t mem_flags, dma_addr_t *dma ) hcd_buffer_alloc() argument 134 hcd_buffer_free( struct usb_bus *bus, size_t size, void *addr, dma_addr_t dma ) hcd_buffer_free() argument
|
/linux-4.1.27/drivers/net/wireless/b43/ |
H A D | bus.c | 30 #include "bus.h" 36 return 0; /* bcma_bus_may_powerdown(dev->bdev->bus); */ b43_bus_bcma_bus_may_powerdown() 41 return 0; /* bcma_bus_powerup(dev->sdev->bus, dynamic_pctl); */ b43_bus_bcma_bus_powerup() 112 bcm47xx_bus.bcma.bus.chipinfo.id == BCMA_CHIP_ID_BCM4716) b43_bus_dev_bcma_init() 120 dev->board_vendor = core->bus->boardinfo.vendor; b43_bus_dev_bcma_init() 121 dev->board_type = core->bus->boardinfo.type; b43_bus_dev_bcma_init() 122 dev->board_rev = core->bus->sprom.board_rev; b43_bus_dev_bcma_init() 124 dev->chip_id = core->bus->chipinfo.id; b43_bus_dev_bcma_init() 125 dev->chip_rev = core->bus->chipinfo.rev; b43_bus_dev_bcma_init() 126 dev->chip_pkg = core->bus->chipinfo.pkg; b43_bus_dev_bcma_init() 128 dev->bus_sprom = &core->bus->sprom; b43_bus_dev_bcma_init() 141 return ssb_bus_may_powerdown(dev->sdev->bus); b43_bus_ssb_bus_may_powerdown() 146 return ssb_bus_powerup(dev->sdev->bus, dynamic_pctl); b43_bus_ssb_bus_powerup() 219 dev->board_vendor = sdev->bus->boardinfo.vendor; b43_bus_dev_ssb_init() 220 dev->board_type = sdev->bus->boardinfo.type; b43_bus_dev_ssb_init() 221 dev->board_rev = sdev->bus->sprom.board_rev; b43_bus_dev_ssb_init() 223 dev->chip_id = sdev->bus->chip_id; b43_bus_dev_ssb_init() 224 dev->chip_rev = sdev->bus->chip_rev; b43_bus_dev_ssb_init() 225 dev->chip_pkg = sdev->bus->chip_package; b43_bus_dev_ssb_init() 227 dev->bus_sprom = &sdev->bus->sprom; b43_bus_dev_ssb_init()
|
/linux-4.1.27/arch/mips/jz4740/ |
H A D | setup.c | 34 u32 ctrl, bus, bank, rows, cols; jz4740_detect_mem() local 39 bus = 2 - ((ctrl >> 31) & 1); jz4740_detect_mem() 44 "SDRAM preconfigured: bus:%u bank:%u rows:%u cols:%u\n", jz4740_detect_mem() 45 bus, bank, rows, cols); jz4740_detect_mem() 48 size = 1 << (bus + bank + cols + rows); jz4740_detect_mem()
|
/linux-4.1.27/arch/parisc/include/asm/ |
H A D | pci.h | 9 ** HP PCI platforms generally support multiple bus adapters. 12 ** Newer platforms number the busses across PCI bus adapters *sparsely*. 15 ** Under a PCI bus, most HP platforms support PPBs up to two or three 24 * accessing the PCI bus once #RESET is de-asserted. 25 * PCI spec somewhere says 1 second but with multi-PCI bus systems, 43 const struct parisc_device *dev; /* device from PA bus walk */ 44 struct pci_bus *hba_bus; /* primary PCI bus below HBA */ 46 struct resource bus_num; /* PCI bus numbers */ 48 struct resource lmmio_space; /* bus addresses < 4Gb */ 49 struct resource elmmio_space; /* additional bus addresses < 4Gb */ 50 struct resource gmmio_space; /* bus addresses > 4Gb */ 72 ** 0xbbxxxx, where bb is the bus number and xxxx is the I/O port 122 ** access under HP PCI bus adapters, strongly recommend the use of MMIO 129 ** to the same device (or typically the bus adapter above it) will 153 void (*fixup_bus)(struct pci_bus *bus); 181 * bus of a C200 resulted in the secondary bus being numbered as 1. 182 * The second PCI host bus controller's root bus had already been 183 * assigned bus number 1 by firmware and sysfs complained.
|
/linux-4.1.27/drivers/ipack/ |
H A D | ipack.c | 2 * Industry-pack bus support functions. 213 struct ipack_bus_device *bus; ipack_bus_register() local 215 bus = kzalloc(sizeof(struct ipack_bus_device), GFP_KERNEL); ipack_bus_register() 216 if (!bus) ipack_bus_register() 221 kfree(bus); ipack_bus_register() 225 bus->bus_nr = bus_nr; ipack_bus_register() 226 bus->parent = parent; ipack_bus_register() 227 bus->slots = slots; ipack_bus_register() 228 bus->ops = ops; ipack_bus_register() 229 bus->owner = owner; ipack_bus_register() 230 return bus; ipack_bus_register() 237 struct ipack_bus_device *bus = data; ipack_unregister_bus_member() local 239 if (idev->bus == bus) ipack_unregister_bus_member() 245 int ipack_bus_unregister(struct ipack_bus_device *bus) ipack_bus_unregister() argument 247 bus_for_each_dev(&ipack_bus_type, NULL, bus, ipack_bus_unregister() 249 ida_simple_remove(&ipack_ida, bus->bus_nr); ipack_bus_unregister() 250 kfree(bus); ipack_bus_unregister() 260 edrv->driver.bus = &ipack_bus_type; ipack_driver_register() 436 dev->dev.bus = &ipack_bus_type; ipack_device_init() 438 dev->dev.parent = dev->bus->parent; ipack_device_init() 440 "ipack-dev.%u.%u", dev->bus->bus_nr, dev->slot); ipack_device_init() 443 if (dev->bus->ops->set_clockrate(dev, 8)) ipack_device_init() 445 if (dev->bus->ops->reset_timeout(dev)) ipack_device_init() 456 ret = dev->bus->ops->set_clockrate(dev, 32); ipack_device_init() 507 MODULE_DESCRIPTION("Industry-pack bus core");
|
/linux-4.1.27/arch/unicore32/kernel/ |
H A D | pci.c | 25 #define CONFIG_CMD(bus, devfn, where) \ 26 (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) 29 puv3_read_config(struct pci_bus *bus, unsigned int devfn, int where, puv3_read_config() argument 32 writel(CONFIG_CMD(bus, devfn, where), PCICFG_ADDR); puv3_read_config() 48 puv3_write_config(struct pci_bus *bus, unsigned int devfn, int where, puv3_write_config() argument 51 writel(CONFIG_CMD(bus, devfn, where), PCICFG_ADDR); puv3_write_config() 106 if (dev->bus->number == 0) { pci_puv3_map_irq() 158 * If the bus contains any of these devices, then we must not turn on 167 * pcibios_fixup_bus - Called after each bus is probed, 170 void pcibios_fixup_bus(struct pci_bus *bus) pcibios_fixup_bus() argument 177 bus->resource[0] = &ioport_resource; pcibios_fixup_bus() 178 bus->resource[1] = &iomem_resource; pcibios_fixup_bus() 181 * Walk the devices on this bus, working out what we can pcibios_fixup_bus() 184 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_fixup_bus() 190 * If any device on this bus does not support fast back pcibios_fixup_bus() 191 * to back transfers, then the bus as a whole is not able pcibios_fixup_bus() 226 list_for_each_entry(dev, &bus->devices, bus_list) { pcibios_fixup_bus() 240 if (bus->self && bus->self->hdr_type == PCI_HEADER_TYPE_BRIDGE) { pcibios_fixup_bus() 242 bus->bridge_ctl |= PCI_BRIDGE_CTL_FAST_BACK; pcibios_fixup_bus() 244 bus->bridge_ctl |= PCI_BRIDGE_CTL_PARITY; pcibios_fixup_bus() 248 * Report what we did for this bus pcibios_fixup_bus() 250 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n", pcibios_fixup_bus() 251 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); pcibios_fixup_bus() 264 panic("PCI: unable to scan bus!"); pci_common_init() 291 /* No special bus mastering setup handling */ pcibios_set_master()
|
/linux-4.1.27/include/linux/platform_data/ |
H A D | dma-s3c24xx.h | 21 * @bus: on which bus does the peripheral reside - AHB or APB. 28 enum s3c24xx_dma_bus bus; member in struct:s3c24xx_dma_channel
|
/linux-4.1.27/arch/arm/mach-dove/ |
H A D | pcie.c | 83 static int pcie_valid_config(struct pcie_port *pp, int bus, int dev) pcie_valid_config() argument 87 * on the local bus. pcie_valid_config() 89 if (bus == pp->root_bus_nr && dev > 1) pcie_valid_config() 95 static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, pcie_rd_conf() argument 98 struct pci_sys_data *sys = bus->sysdata; pcie_rd_conf() 103 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) { pcie_rd_conf() 109 ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val); pcie_rd_conf() 115 static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, pcie_wr_conf() argument 118 struct pci_sys_data *sys = bus->sysdata; pcie_wr_conf() 123 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) pcie_wr_conf() 127 ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val); pcie_wr_conf() 143 if (dev->bus->parent == NULL && dev->devfn == 0) { rc_pci_fixup()
|
/linux-4.1.27/drivers/scsi/ |
H A D | qla1280.c | 95 - Eliminate duplicate marker commands on bus resets 96 - Handle outstanding commands appropriately on bus/device resets 676 nv->bus[i].selection_timeout = cpu_to_le16(nv->bus[i].selection_timeout); qla1280_read_nvram() 677 nv->bus[i].max_queue_depth = cpu_to_le16(nv->bus[i].max_queue_depth); qla1280_read_nvram() 802 qla1280_wait_for_pending_commands(struct scsi_qla_host *ha, int bus, int target) qla1280_wait_for_pending_commands() argument 812 * Wait for all commands with the designated bus/target qla1280_wait_for_pending_commands() 820 if (bus >= 0 && SCSI_BUS_32(cmd) != bus) qla1280_wait_for_pending_commands() 840 * bus reset. 851 int bus, target, lun; qla1280_error_action() local 863 bus = SCSI_BUS_32(cmd); qla1280_error_action() 899 "already completed.\n", ha->host_no, bus, qla1280_error_action() 921 "command.\n", ha->host_no, bus, target, lun); qla1280_error_action() 922 if (qla1280_device_reset(ha, bus, target) == 0) { qla1280_error_action() 924 wait_for_bus = bus; qla1280_error_action() 931 printk(KERN_INFO "qla1280(%ld:%d): Issued bus " qla1280_error_action() 932 "reset.\n", ha->host_no, bus); qla1280_error_action() 933 if (qla1280_bus_reset(ha, bus) == 0) { qla1280_error_action() 934 /* issued bus reset, set wait conditions */ qla1280_error_action() 935 wait_for_bus = bus; qla1280_error_action() 973 ha->host_no, bus, target, lun); qla1280_error_action() 1031 * Reset the specified bus. 1143 qla1280_set_target_parameters(struct scsi_qla_host *ha, int bus, int target) qla1280_set_target_parameters() argument 1156 mb[1] = (uint16_t)((bus ? target | BIT_7 : target) << 8); qla1280_set_target_parameters() 1157 mb[2] = nv->bus[bus].target[target].parameter.renegotiate_on_error << 8; qla1280_set_target_parameters() 1158 mb[2] |= nv->bus[bus].target[target].parameter.stop_queue_on_check << 9; qla1280_set_target_parameters() 1159 mb[2] |= nv->bus[bus].target[target].parameter.auto_request_sense << 10; qla1280_set_target_parameters() 1160 mb[2] |= nv->bus[bus].target[target].parameter.tag_queuing << 11; qla1280_set_target_parameters() 1161 mb[2] |= nv->bus[bus].target[target].parameter.enable_sync << 12; qla1280_set_target_parameters() 1162 mb[2] |= nv->bus[bus].target[target].parameter.enable_wide << 13; qla1280_set_target_parameters() 1163 mb[2] |= nv->bus[bus].target[target].parameter.parity_checking << 14; qla1280_set_target_parameters() 1164 mb[2] |= nv->bus[bus].target[target].parameter.disconnect_allowed << 15; qla1280_set_target_parameters() 1167 mb[2] |= nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr << 5; qla1280_set_target_parameters() 1168 mb[3] = (nv->bus[bus].target[target].flags.flags1x160.sync_offset << 8); qla1280_set_target_parameters() 1169 mb[6] = (nv->bus[bus].target[target].ppr_1x160.flags.ppr_options << 8) | qla1280_set_target_parameters() 1170 nv->bus[bus].target[target].ppr_1x160.flags.ppr_bus_width; qla1280_set_target_parameters() 1173 mb[3] = (nv->bus[bus].target[target].flags.flags1x80.sync_offset << 8); qla1280_set_target_parameters() 1175 mb[3] |= nv->bus[bus].target[target].sync_period; qla1280_set_target_parameters() 1182 mb[1] = (uint16_t)((bus ? target | BIT_7 : target) << 8); qla1280_set_target_parameters() 1184 mb[2] = nv->bus[bus].max_queue_depth; qla1280_set_target_parameters() 1185 mb[3] = nv->bus[bus].target[target].execution_throttle; qla1280_set_target_parameters() 1192 ha->host_no, bus, target); qla1280_set_target_parameters() 1213 int bus = device->channel; qla1280_slave_configure() local 1222 if (qla1280_check_for_dead_scsi_bus(ha, bus)) qla1280_slave_configure() 1226 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) { qla1280_slave_configure() 1227 scsi_change_queue_depth(device, ha->bus_settings[bus].hiwat); qla1280_slave_configure() 1232 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; qla1280_slave_configure() 1233 nv->bus[bus].target[target].parameter.enable_wide = device->wdtr; qla1280_slave_configure() 1234 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr; qla1280_slave_configure() 1239 nv->bus[bus].target[target].parameter.enable_sync = 0; qla1280_slave_configure() 1243 nv->bus[bus].target[target].parameter.enable_wide = 0; qla1280_slave_configure() 1248 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; qla1280_slave_configure() 1252 if (nv->bus[bus].target[target].parameter.enable_sync) qla1280_slave_configure() 1253 status = qla1280_set_target_parameters(ha, bus, target); qla1280_slave_configure() 1272 int bus, target, lun; qla1280_done() local 1285 bus = SCSI_BUS_32(cmd); qla1280_done() 1293 qla1280_marker(ha, bus, target, 0, MK_SYNC_ID); qla1280_done() 1438 int bus; qla1280_initialize_adapter() local 1504 /* Issue SCSI reset, if we can't reset twice then bus is dead */ qla1280_initialize_adapter() 1505 for (bus = 0; bus < ha->ports; bus++) { qla1280_initialize_adapter() 1506 if (!ha->bus_settings[bus].disable_scsi_reset && qla1280_initialize_adapter() 1507 qla1280_bus_reset(ha, bus) && qla1280_initialize_adapter() 1508 qla1280_bus_reset(ha, bus)) qla1280_initialize_adapter() 1509 ha->bus_settings[bus].scsi_bus_dead = 1; qla1280_initialize_adapter() 1967 dprintk(1, "qla1280 : initiator scsi id bus[0]=%d\n", qla1280_print_settings() 1968 nv->bus[0].config_1.initiator_id); qla1280_print_settings() 1969 dprintk(1, "qla1280 : initiator scsi id bus[1]=%d\n", qla1280_print_settings() 1970 nv->bus[1].config_1.initiator_id); qla1280_print_settings() 1972 dprintk(1, "qla1280 : bus reset delay[0]=%d\n", qla1280_print_settings() 1973 nv->bus[0].bus_reset_delay); qla1280_print_settings() 1974 dprintk(1, "qla1280 : bus reset delay[1]=%d\n", qla1280_print_settings() 1975 nv->bus[1].bus_reset_delay); qla1280_print_settings() 1977 dprintk(1, "qla1280 : retry count[0]=%d\n", nv->bus[0].retry_count); qla1280_print_settings() 1978 dprintk(1, "qla1280 : retry delay[0]=%d\n", nv->bus[0].retry_delay); qla1280_print_settings() 1979 dprintk(1, "qla1280 : retry count[1]=%d\n", nv->bus[1].retry_count); qla1280_print_settings() 1980 dprintk(1, "qla1280 : retry delay[1]=%d\n", nv->bus[1].retry_delay); qla1280_print_settings() 1983 nv->bus[0].config_2.async_data_setup_time); qla1280_print_settings() 1985 nv->bus[1].config_2.async_data_setup_time); qla1280_print_settings() 1988 nv->bus[0].config_2.req_ack_active_negation); qla1280_print_settings() 1990 nv->bus[1].config_2.req_ack_active_negation); qla1280_print_settings() 1993 nv->bus[0].config_2.data_line_active_negation); qla1280_print_settings() 1995 nv->bus[1].config_2.data_line_active_negation); qla1280_print_settings() 2004 nv->bus[0].selection_timeout); qla1280_print_settings() 2006 nv->bus[1].selection_timeout); qla1280_print_settings() 2009 nv->bus[0].max_queue_depth); qla1280_print_settings() 2011 nv->bus[1].max_queue_depth); qla1280_print_settings() 2015 qla1280_set_target_defaults(struct scsi_qla_host *ha, int bus, int target) qla1280_set_target_defaults() argument 2019 nv->bus[bus].target[target].parameter.renegotiate_on_error = 1; qla1280_set_target_defaults() 2020 nv->bus[bus].target[target].parameter.auto_request_sense = 1; qla1280_set_target_defaults() 2021 nv->bus[bus].target[target].parameter.tag_queuing = 1; qla1280_set_target_defaults() 2022 nv->bus[bus].target[target].parameter.enable_sync = 1; qla1280_set_target_defaults() 2024 nv->bus[bus].target[target].parameter.enable_wide = 1; qla1280_set_target_defaults() 2026 nv->bus[bus].target[target].execution_throttle = qla1280_set_target_defaults() 2027 nv->bus[bus].max_queue_depth - 1; qla1280_set_target_defaults() 2028 nv->bus[bus].target[target].parameter.parity_checking = 1; qla1280_set_target_defaults() 2029 nv->bus[bus].target[target].parameter.disconnect_allowed = 1; qla1280_set_target_defaults() 2032 nv->bus[bus].target[target].flags.flags1x160.device_enable = 1; qla1280_set_target_defaults() 2033 nv->bus[bus].target[target].flags.flags1x160.sync_offset = 0x0e; qla1280_set_target_defaults() 2034 nv->bus[bus].target[target].sync_period = 9; qla1280_set_target_defaults() 2035 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 1; qla1280_set_target_defaults() 2036 nv->bus[bus].target[target].ppr_1x160.flags.ppr_options = 2; qla1280_set_target_defaults() 2037 nv->bus[bus].target[target].ppr_1x160.flags.ppr_bus_width = 1; qla1280_set_target_defaults() 2039 nv->bus[bus].target[target].flags.flags1x80.device_enable = 1; qla1280_set_target_defaults() 2040 nv->bus[bus].target[target].flags.flags1x80.sync_offset = 12; qla1280_set_target_defaults() 2041 nv->bus[bus].target[target].sync_period = 10; qla1280_set_target_defaults() 2049 int bus, target; qla1280_set_defaults() local 2078 for (bus = 0; bus < MAX_BUSES; bus++) { qla1280_set_defaults() 2079 nv->bus[bus].config_1.initiator_id = 7; qla1280_set_defaults() 2080 nv->bus[bus].config_2.req_ack_active_negation = 1; qla1280_set_defaults() 2081 nv->bus[bus].config_2.data_line_active_negation = 1; qla1280_set_defaults() 2082 nv->bus[bus].selection_timeout = 250; qla1280_set_defaults() 2083 nv->bus[bus].max_queue_depth = 32; qla1280_set_defaults() 2086 nv->bus[bus].bus_reset_delay = 3; qla1280_set_defaults() 2087 nv->bus[bus].config_2.async_data_setup_time = 6; qla1280_set_defaults() 2088 nv->bus[bus].retry_delay = 1; qla1280_set_defaults() 2090 nv->bus[bus].bus_reset_delay = 5; qla1280_set_defaults() 2091 nv->bus[bus].config_2.async_data_setup_time = 8; qla1280_set_defaults() 2095 qla1280_set_target_defaults(ha, bus, target); qla1280_set_defaults() 2100 qla1280_config_target(struct scsi_qla_host *ha, int bus, int target) qla1280_config_target() argument 2109 mb[1] = (uint16_t)((bus ? target | BIT_7 : target) << 8); qla1280_config_target() 2120 mb[3] = nv->bus[bus].target[target].flags.flags1x160.sync_offset << 8; qla1280_config_target() 2122 mb[3] = nv->bus[bus].target[target].flags.flags1x80.sync_offset << 8; qla1280_config_target() 2123 mb[3] |= nv->bus[bus].target[target].sync_period; qla1280_config_target() 2128 if (nv->bus[bus].target[target].parameter.tag_queuing) qla1280_config_target() 2129 ha->bus_settings[bus].qtag_enables |= flag; qla1280_config_target() 2133 if (nv->bus[bus].target[target].flags.flags1x160.device_enable) qla1280_config_target() 2134 ha->bus_settings[bus].device_enables |= flag; qla1280_config_target() 2135 ha->bus_settings[bus].lun_disables |= 0; qla1280_config_target() 2137 if (nv->bus[bus].target[target].flags.flags1x80.device_enable) qla1280_config_target() 2138 ha->bus_settings[bus].device_enables |= flag; qla1280_config_target() 2140 if (nv->bus[bus].target[target].flags.flags1x80.lun_disable) qla1280_config_target() 2141 ha->bus_settings[bus].lun_disables |= flag; qla1280_config_target() 2147 mb[1] = (uint16_t)((bus ? target | BIT_7 : target) << 8); qla1280_config_target() 2149 mb[2] = nv->bus[bus].max_queue_depth; qla1280_config_target() 2150 mb[3] = nv->bus[bus].target[target].execution_throttle; qla1280_config_target() 2158 qla1280_config_bus(struct scsi_qla_host *ha, int bus) qla1280_config_bus() argument 2165 ha->bus_settings[bus].disable_scsi_reset = qla1280_config_bus() 2166 nv->bus[bus].config_1.scsi_reset_disable; qla1280_config_bus() 2169 ha->bus_settings[bus].id = nv->bus[bus].config_1.initiator_id; qla1280_config_bus() 2171 mb[1] = bus ? ha->bus_settings[bus].id | BIT_7 : qla1280_config_bus() 2172 ha->bus_settings[bus].id; qla1280_config_bus() 2176 ha->bus_settings[bus].bus_reset_delay = qla1280_config_bus() 2177 nv->bus[bus].bus_reset_delay; qla1280_config_bus() 2180 ha->bus_settings[bus].hiwat = nv->bus[bus].max_queue_depth - 1; qla1280_config_bus() 2184 status |= qla1280_config_target(ha, bus, target); qla1280_config_bus() 2194 int bus, target, status = 0; qla1280_nvram_config() local 2201 for (bus = 0; bus < MAX_BUSES; bus++) qla1280_nvram_config() 2203 nv->bus[bus].target[target].parameter. qla1280_nvram_config() 2284 mb[1] = nv->bus[0].retry_count; qla1280_nvram_config() 2285 mb[2] = nv->bus[0].retry_delay; qla1280_nvram_config() 2286 mb[6] = nv->bus[1].retry_count; qla1280_nvram_config() 2287 mb[7] = nv->bus[1].retry_delay; qla1280_nvram_config() 2293 mb[1] = nv->bus[0].config_2.async_data_setup_time; qla1280_nvram_config() 2294 mb[2] = nv->bus[1].config_2.async_data_setup_time; qla1280_nvram_config() 2300 if (nv->bus[0].config_2.req_ack_active_negation) qla1280_nvram_config() 2302 if (nv->bus[0].config_2.data_line_active_negation) qla1280_nvram_config() 2305 if (nv->bus[1].config_2.req_ack_active_negation) qla1280_nvram_config() 2307 if (nv->bus[1].config_2.data_line_active_negation) qla1280_nvram_config() 2312 mb[1] = 2; /* Reset SCSI bus and return all outstanding IO */ qla1280_nvram_config() 2327 mb[1] = nv->bus[0].selection_timeout; qla1280_nvram_config() 2328 mb[2] = nv->bus[1].selection_timeout; qla1280_nvram_config() 2331 for (bus = 0; bus < ha->ports; bus++) qla1280_nvram_config() 2332 status |= qla1280_config_bus(ha, bus); qla1280_nvram_config() 2580 * Issue SCSI bus reset. 2584 * bus = SCSI bus number. 2590 qla1280_bus_reset(struct scsi_qla_host *ha, int bus) qla1280_bus_reset() argument 2600 ha->host_no, bus); qla1280_bus_reset() 2602 reset_delay = ha->bus_settings[bus].bus_reset_delay; qla1280_bus_reset() 2605 mb[2] = (uint16_t) bus; qla1280_bus_reset() 2609 if (ha->bus_settings[bus].failed_reset_count > 2) qla1280_bus_reset() 2610 ha->bus_settings[bus].scsi_bus_dead = 1; qla1280_bus_reset() 2611 ha->bus_settings[bus].failed_reset_count++; qla1280_bus_reset() 2617 ha->bus_settings[bus].scsi_bus_dead = 0; qla1280_bus_reset() 2618 ha->bus_settings[bus].failed_reset_count = 0; qla1280_bus_reset() 2619 ha->bus_settings[bus].reset_marker = 0; qla1280_bus_reset() 2621 qla1280_marker(ha, bus, 0, 0, MK_SYNC_ALL); qla1280_bus_reset() 2626 * here as well for all devices on the bus. qla1280_bus_reset() 2639 * Issue bus device reset message to the target. 2643 * bus = SCSI BUS number. 2650 qla1280_device_reset(struct scsi_qla_host *ha, int bus, int target) qla1280_device_reset() argument 2658 mb[1] = (bus ? (target | BIT_7) : target) << 8; qla1280_device_reset() 2663 qla1280_marker(ha, bus, target, 0, MK_SYNC_ID); qla1280_device_reset() 2687 unsigned int bus, target, lun; qla1280_abort_command() local 2692 bus = SCSI_BUS_32(sp->cmd); qla1280_abort_command() 2699 mb[1] = (bus ? target | BIT_7 : target) << 8 | lun; qla1280_abort_command() 2744 * bus = SCSI BUS number 2750 qla1280_marker(struct scsi_qla_host *ha, int bus, int id, int lun, u8 type) qla1280_marker() argument 2760 pkt->target = (uint8_t) (bus ? (id | BIT_7) : id); qla1280_marker() 2854 dprintk(2, " bus %i, target %i, lun %i\n", qla1280_64bit_start_scsi() 3390 * On PCI bus, order reverses and write of 6 posts, then index 5, qla1280_isp_cmd() 3636 uint8_t bus; qla1280_rst_aen() local 3646 for (bus = 0; bus < ha->ports && qla1280_rst_aen() 3647 !ha->flags.reset_marker; bus++) { qla1280_rst_aen() 3648 if (ha->bus_settings[bus].reset_marker) { qla1280_rst_aen() 3649 ha->bus_settings[bus].reset_marker = 0; qla1280_rst_aen() 3650 qla1280_marker(ha, bus, 0, 0, qla1280_rst_aen() 3674 unsigned int bus, target, lun; qla1280_status_entry() local 3701 bus = SCSI_BUS_32(cmd); qla1280_status_entry() 3743 "l %i\n", bus, target, lun); qla1280_status_entry() 3839 int bus; qla1280_abort_isp() local 3882 for (bus = 0; bus < ha->ports; bus++) qla1280_abort_isp() 3883 qla1280_bus_reset(ha, bus); qla1280_abort_isp() 3934 * This routine checks for a dead SCSI bus * 3939 qla1280_check_for_dead_scsi_bus(struct scsi_qla_host *ha, unsigned int bus) qla1280_check_for_dead_scsi_bus() argument 3944 if (ha->bus_settings[bus].scsi_bus_dead) { qla1280_check_for_dead_scsi_bus() 3953 ha->bus_settings[bus].scsi_bus_dead = 1; qla1280_check_for_dead_scsi_bus() 3954 return 1; /* bus is dead */ qla1280_check_for_dead_scsi_bus() 3956 ha->bus_settings[bus].scsi_bus_dead = 0; qla1280_check_for_dead_scsi_bus() 3957 ha->bus_settings[bus].failed_reset_count = 0; qla1280_check_for_dead_scsi_bus() 3960 return 0; /* bus is not dead */ qla1280_check_for_dead_scsi_bus() 3968 int bus, target, lun; qla1280_get_target_parameters() local 3970 bus = device->channel; qla1280_get_target_parameters() 3976 mb[1] = (uint16_t) (bus ? target | BIT_7 : target); qla1280_get_target_parameters() 3981 printk(KERN_INFO "scsi(%li:%d:%d:%d):", ha->host_no, bus, target, lun); qla1280_get_target_parameters() 4241 printk(KERN_INFO "qla1280: %s found on PCI bus %i, dev %i\n", qla1280_probe_one() 4242 bdp->name, pdev->bus->number, PCI_SLOT(pdev->devfn)); qla1280_probe_one()
|