• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/sbus/char/

Lines Matching refs:bp

78 	struct bbc_i2c_bus	*bp;
84 static int find_device(struct bbc_i2c_bus *bp, struct linux_ebus_child *echild)
89 if (bp->devs[i].device == echild) {
90 if (bp->devs[i].client_claimed)
98 static void set_device_claimage(struct bbc_i2c_bus *bp, struct linux_ebus_child *echild, int val)
103 if (bp->devs[i].device == echild) {
104 bp->devs[i].client_claimed = val;
115 struct bbc_i2c_bus *bp = all_bbc_i2c;
117 while (bp != NULL) {
118 if (find_device(bp, echild) != 0)
120 bp = bp->next;
123 return bp;
128 struct bbc_i2c_bus *bp = all_bbc_i2c;
132 while (bp != NULL) {
133 struct bbc_i2c_bus *next = bp->next;
137 if (!(echild = bp->devs[i].device))
144 bp = next;
154 struct bbc_i2c_bus *bp = find_bus_for_device(echild);
157 if (!bp)
163 client->bp = bp;
168 claim_device(bp, echild);
175 struct bbc_i2c_bus *bp = client->bp;
178 release_device(bp, echild);
182 static int wait_for_pin(struct bbc_i2c_bus *bp, u8 *status)
188 bp->waiting = 1;
189 add_wait_queue(&bp->wq, &wait);
194 bp->wq,
195 (((*status = readb(bp->i2c_control_regs + 0))
203 remove_wait_queue(&bp->wq, &wait);
204 bp->waiting = 0;
211 struct bbc_i2c_bus *bp = client->bp;
216 if (bp->i2c_bussel_reg != NULL)
217 writeb(client->bus, bp->i2c_bussel_reg);
219 writeb(address, bp->i2c_control_regs + 0x1);
220 writeb(I2C_PCF_START, bp->i2c_control_regs + 0x0);
221 if (wait_for_pin(bp, &status))
224 writeb(off, bp->i2c_control_regs + 0x1);
225 if (wait_for_pin(bp, &status) ||
229 writeb(val, bp->i2c_control_regs + 0x1);
230 if (wait_for_pin(bp, &status))
236 writeb(I2C_PCF_STOP, bp->i2c_control_regs + 0x0);
242 struct bbc_i2c_bus *bp = client->bp;
246 if (bp->i2c_bussel_reg != NULL)
247 writeb(client->bus, bp->i2c_bussel_reg);
249 writeb(address, bp->i2c_control_regs + 0x1);
250 writeb(I2C_PCF_START, bp->i2c_control_regs + 0x0);
251 if (wait_for_pin(bp, &status))
254 writeb(off, bp->i2c_control_regs + 0x1);
255 if (wait_for_pin(bp, &status) ||
259 writeb(I2C_PCF_STOP, bp->i2c_control_regs + 0x0);
263 writeb(address, bp->i2c_control_regs + 0x1);
264 writeb(I2C_PCF_START, bp->i2c_control_regs + 0x0);
265 if (wait_for_pin(bp, &status))
271 (void) readb(bp->i2c_control_regs + 0x1);
272 if (wait_for_pin(bp, &status))
275 writeb(I2C_PCF_ESO | I2C_PCF_ENI, bp->i2c_control_regs + 0x0);
276 *byte = readb(bp->i2c_control_regs + 0x1);
277 if (wait_for_pin(bp, &status))
283 writeb(I2C_PCF_STOP, bp->i2c_control_regs + 0x0);
284 (void) readb(bp->i2c_control_regs + 0x1);
338 struct bbc_i2c_bus *bp = dev_id;
343 if (bp->waiting &&
344 !(readb(bp->i2c_control_regs + 0x0) & I2C_PCF_PIN))
345 wake_up_interruptible(&bp->wq);
350 static void __init reset_one_i2c(struct bbc_i2c_bus *bp)
352 writeb(I2C_PCF_PIN, bp->i2c_control_regs + 0x0);
353 writeb(bp->own, bp->i2c_control_regs + 0x1);
354 writeb(I2C_PCF_PIN | I2C_PCF_ES1, bp->i2c_control_regs + 0x0);
355 writeb(bp->clock, bp->i2c_control_regs + 0x1);
356 writeb(I2C_PCF_IDLE, bp->i2c_control_regs + 0x0);
361 struct bbc_i2c_bus *bp = kmalloc(sizeof(*bp), GFP_KERNEL);
365 if (!bp)
367 memset(bp, 0, sizeof(*bp));
369 bp->i2c_control_regs = ioremap(edev->resource[0].start, 0x2);
370 if (!bp->i2c_control_regs)
374 bp->i2c_bussel_reg = ioremap(edev->resource[1].start, 0x1);
375 if (!bp->i2c_bussel_reg)
379 bp->waiting = 0;
380 init_waitqueue_head(&bp->wq);
382 IRQF_SHARED, "bbc_i2c", bp))
385 bp->index = index;
386 bp->bus_edev = edev;
388 spin_lock_init(&bp->lock);
389 bp->next = all_bbc_i2c;
390 all_bbc_i2c = bp;
396 bp->devs[entry].device = echild;
397 bp->devs[entry].client_claimed = 0;
400 writeb(I2C_PCF_PIN, bp->i2c_control_regs + 0x0);
401 bp->own = readb(bp->i2c_control_regs + 0x01);
402 writeb(I2C_PCF_PIN | I2C_PCF_ES1, bp->i2c_control_regs + 0x0);
403 bp->clock = readb(bp->i2c_control_regs + 0x01);
406 bp->index, bp->i2c_control_regs, entry, bp->own, bp->clock);
408 reset_one_i2c(bp);
413 if (bp->i2c_bussel_reg)
414 iounmap(bp->i2c_bussel_reg);
415 if (bp->i2c_control_regs)
416 iounmap(bp->i2c_control_regs);
417 kfree(bp);
469 struct bbc_i2c_bus *bp = all_bbc_i2c;
473 while (bp != NULL) {
474 struct bbc_i2c_bus *next = bp->next;
476 free_irq(bp->bus_edev->irqs[0], bp);
478 if (bp->i2c_bussel_reg)
479 iounmap(bp->i2c_bussel_reg);
480 if (bp->i2c_control_regs)
481 iounmap(bp->i2c_control_regs);
483 kfree(bp);
485 bp = next;