bt_bmc 78 drivers/char/ipmi/bt-bmc.c static u8 bt_inb(struct bt_bmc *bt_bmc, int reg) bt_bmc 83 drivers/char/ipmi/bt-bmc.c rc = regmap_read(bt_bmc->map, bt_bmc->offset + reg, &val); bt_bmc 89 drivers/char/ipmi/bt-bmc.c static void bt_outb(struct bt_bmc *bt_bmc, u8 data, int reg) bt_bmc 93 drivers/char/ipmi/bt-bmc.c rc = regmap_write(bt_bmc->map, bt_bmc->offset + reg, data); bt_bmc 97 drivers/char/ipmi/bt-bmc.c static void clr_rd_ptr(struct bt_bmc *bt_bmc) bt_bmc 99 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_CLR_RD_PTR, BT_CTRL); bt_bmc 102 drivers/char/ipmi/bt-bmc.c static void clr_wr_ptr(struct bt_bmc *bt_bmc) bt_bmc 104 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_CLR_WR_PTR, BT_CTRL); bt_bmc 107 drivers/char/ipmi/bt-bmc.c static void clr_h2b_atn(struct bt_bmc *bt_bmc) bt_bmc 109 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_H2B_ATN, BT_CTRL); bt_bmc 112 drivers/char/ipmi/bt-bmc.c static void set_b_busy(struct bt_bmc *bt_bmc) bt_bmc 114 drivers/char/ipmi/bt-bmc.c if (!(bt_inb(bt_bmc, BT_CTRL) & BT_CTRL_B_BUSY)) bt_bmc 115 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_B_BUSY, BT_CTRL); bt_bmc 118 drivers/char/ipmi/bt-bmc.c static void clr_b_busy(struct bt_bmc *bt_bmc) bt_bmc 120 drivers/char/ipmi/bt-bmc.c if (bt_inb(bt_bmc, BT_CTRL) & BT_CTRL_B_BUSY) bt_bmc 121 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_B_BUSY, BT_CTRL); bt_bmc 124 drivers/char/ipmi/bt-bmc.c static void set_b2h_atn(struct bt_bmc *bt_bmc) bt_bmc 126 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_B2H_ATN, BT_CTRL); bt_bmc 129 drivers/char/ipmi/bt-bmc.c static u8 bt_read(struct bt_bmc *bt_bmc) bt_bmc 131 drivers/char/ipmi/bt-bmc.c return bt_inb(bt_bmc, BT_BMC2HOST); bt_bmc 134 drivers/char/ipmi/bt-bmc.c static ssize_t bt_readn(struct bt_bmc *bt_bmc, u8 *buf, size_t n) bt_bmc 139 drivers/char/ipmi/bt-bmc.c buf[i] = bt_read(bt_bmc); bt_bmc 143 drivers/char/ipmi/bt-bmc.c static void bt_write(struct bt_bmc *bt_bmc, u8 c) bt_bmc 145 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, c, BT_BMC2HOST); bt_bmc 148 drivers/char/ipmi/bt-bmc.c static ssize_t bt_writen(struct bt_bmc *bt_bmc, u8 *buf, size_t n) bt_bmc 153 drivers/char/ipmi/bt-bmc.c bt_write(bt_bmc, buf[i]); bt_bmc 157 drivers/char/ipmi/bt-bmc.c static void set_sms_atn(struct bt_bmc *bt_bmc) bt_bmc 159 drivers/char/ipmi/bt-bmc.c bt_outb(bt_bmc, BT_CTRL_SMS_ATN, BT_CTRL); bt_bmc 162 drivers/char/ipmi/bt-bmc.c static struct bt_bmc *file_bt_bmc(struct file *file) bt_bmc 164 drivers/char/ipmi/bt-bmc.c return container_of(file->private_data, struct bt_bmc, miscdev); bt_bmc 169 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 172 drivers/char/ipmi/bt-bmc.c clr_b_busy(bt_bmc); bt_bmc 196 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 205 drivers/char/ipmi/bt-bmc.c if (wait_event_interruptible(bt_bmc->queue, bt_bmc 206 drivers/char/ipmi/bt-bmc.c bt_inb(bt_bmc, BT_CTRL) & BT_CTRL_H2B_ATN)) bt_bmc 209 drivers/char/ipmi/bt-bmc.c mutex_lock(&bt_bmc->mutex); bt_bmc 211 drivers/char/ipmi/bt-bmc.c if (unlikely(!(bt_inb(bt_bmc, BT_CTRL) & BT_CTRL_H2B_ATN))) { bt_bmc 216 drivers/char/ipmi/bt-bmc.c set_b_busy(bt_bmc); bt_bmc 217 drivers/char/ipmi/bt-bmc.c clr_h2b_atn(bt_bmc); bt_bmc 218 drivers/char/ipmi/bt-bmc.c clr_rd_ptr(bt_bmc); bt_bmc 224 drivers/char/ipmi/bt-bmc.c kbuffer[0] = bt_read(bt_bmc); bt_bmc 234 drivers/char/ipmi/bt-bmc.c bt_readn(bt_bmc, kbuffer + len_byte, nread); bt_bmc 246 drivers/char/ipmi/bt-bmc.c clr_b_busy(bt_bmc); bt_bmc 249 drivers/char/ipmi/bt-bmc.c mutex_unlock(&bt_bmc->mutex); bt_bmc 262 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 279 drivers/char/ipmi/bt-bmc.c if (wait_event_interruptible(bt_bmc->queue, bt_bmc 280 drivers/char/ipmi/bt-bmc.c !(bt_inb(bt_bmc, BT_CTRL) & bt_bmc 284 drivers/char/ipmi/bt-bmc.c mutex_lock(&bt_bmc->mutex); bt_bmc 286 drivers/char/ipmi/bt-bmc.c if (unlikely(bt_inb(bt_bmc, BT_CTRL) & bt_bmc 292 drivers/char/ipmi/bt-bmc.c clr_wr_ptr(bt_bmc); bt_bmc 301 drivers/char/ipmi/bt-bmc.c bt_writen(bt_bmc, kbuffer, nwritten); bt_bmc 308 drivers/char/ipmi/bt-bmc.c set_b2h_atn(bt_bmc); bt_bmc 311 drivers/char/ipmi/bt-bmc.c mutex_unlock(&bt_bmc->mutex); bt_bmc 318 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 322 drivers/char/ipmi/bt-bmc.c set_sms_atn(bt_bmc); bt_bmc 330 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 333 drivers/char/ipmi/bt-bmc.c set_b_busy(bt_bmc); bt_bmc 339 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = file_bt_bmc(file); bt_bmc 343 drivers/char/ipmi/bt-bmc.c poll_wait(file, &bt_bmc->queue, wait); bt_bmc 345 drivers/char/ipmi/bt-bmc.c ctrl = bt_inb(bt_bmc, BT_CTRL); bt_bmc 368 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = from_timer(bt_bmc, t, poll_timer); bt_bmc 370 drivers/char/ipmi/bt-bmc.c bt_bmc->poll_timer.expires += msecs_to_jiffies(500); bt_bmc 371 drivers/char/ipmi/bt-bmc.c wake_up(&bt_bmc->queue); bt_bmc 372 drivers/char/ipmi/bt-bmc.c add_timer(&bt_bmc->poll_timer); bt_bmc 377 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = arg; bt_bmc 381 drivers/char/ipmi/bt-bmc.c rc = regmap_read(bt_bmc->map, bt_bmc->offset + BT_CR2, ®); bt_bmc 390 drivers/char/ipmi/bt-bmc.c regmap_write(bt_bmc->map, bt_bmc->offset + BT_CR2, reg); bt_bmc 392 drivers/char/ipmi/bt-bmc.c wake_up(&bt_bmc->queue); bt_bmc 396 drivers/char/ipmi/bt-bmc.c static int bt_bmc_config_irq(struct bt_bmc *bt_bmc, bt_bmc 402 drivers/char/ipmi/bt-bmc.c bt_bmc->irq = platform_get_irq(pdev, 0); bt_bmc 403 drivers/char/ipmi/bt-bmc.c if (!bt_bmc->irq) bt_bmc 406 drivers/char/ipmi/bt-bmc.c rc = devm_request_irq(dev, bt_bmc->irq, bt_bmc_irq, IRQF_SHARED, bt_bmc 407 drivers/char/ipmi/bt-bmc.c DEVICE_NAME, bt_bmc); bt_bmc 409 drivers/char/ipmi/bt-bmc.c dev_warn(dev, "Unable to request IRQ %d\n", bt_bmc->irq); bt_bmc 410 drivers/char/ipmi/bt-bmc.c bt_bmc->irq = 0; bt_bmc 420 drivers/char/ipmi/bt-bmc.c rc = regmap_update_bits(bt_bmc->map, bt_bmc->offset + BT_CR1, bt_bmc 429 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc; bt_bmc 439 drivers/char/ipmi/bt-bmc.c bt_bmc = devm_kzalloc(dev, sizeof(*bt_bmc), GFP_KERNEL); bt_bmc 440 drivers/char/ipmi/bt-bmc.c if (!bt_bmc) bt_bmc 443 drivers/char/ipmi/bt-bmc.c dev_set_drvdata(&pdev->dev, bt_bmc); bt_bmc 445 drivers/char/ipmi/bt-bmc.c bt_bmc->map = syscon_node_to_regmap(pdev->dev.parent->of_node); bt_bmc 446 drivers/char/ipmi/bt-bmc.c if (IS_ERR(bt_bmc->map)) { bt_bmc 459 drivers/char/ipmi/bt-bmc.c bt_bmc->map = devm_regmap_init_mmio(dev, base, &bt_regmap_cfg); bt_bmc 460 drivers/char/ipmi/bt-bmc.c bt_bmc->offset = 0; bt_bmc 462 drivers/char/ipmi/bt-bmc.c rc = of_property_read_u32(dev->of_node, "reg", &bt_bmc->offset); bt_bmc 467 drivers/char/ipmi/bt-bmc.c mutex_init(&bt_bmc->mutex); bt_bmc 468 drivers/char/ipmi/bt-bmc.c init_waitqueue_head(&bt_bmc->queue); bt_bmc 470 drivers/char/ipmi/bt-bmc.c bt_bmc->miscdev.minor = MISC_DYNAMIC_MINOR, bt_bmc 471 drivers/char/ipmi/bt-bmc.c bt_bmc->miscdev.name = DEVICE_NAME, bt_bmc 472 drivers/char/ipmi/bt-bmc.c bt_bmc->miscdev.fops = &bt_bmc_fops, bt_bmc 473 drivers/char/ipmi/bt-bmc.c bt_bmc->miscdev.parent = dev; bt_bmc 474 drivers/char/ipmi/bt-bmc.c rc = misc_register(&bt_bmc->miscdev); bt_bmc 480 drivers/char/ipmi/bt-bmc.c bt_bmc_config_irq(bt_bmc, pdev); bt_bmc 482 drivers/char/ipmi/bt-bmc.c if (bt_bmc->irq) { bt_bmc 483 drivers/char/ipmi/bt-bmc.c dev_info(dev, "Using IRQ %d\n", bt_bmc->irq); bt_bmc 486 drivers/char/ipmi/bt-bmc.c timer_setup(&bt_bmc->poll_timer, poll_timer, 0); bt_bmc 487 drivers/char/ipmi/bt-bmc.c bt_bmc->poll_timer.expires = jiffies + msecs_to_jiffies(10); bt_bmc 488 drivers/char/ipmi/bt-bmc.c add_timer(&bt_bmc->poll_timer); bt_bmc 491 drivers/char/ipmi/bt-bmc.c regmap_write(bt_bmc->map, bt_bmc->offset + BT_CR0, bt_bmc 498 drivers/char/ipmi/bt-bmc.c clr_b_busy(bt_bmc); bt_bmc 505 drivers/char/ipmi/bt-bmc.c struct bt_bmc *bt_bmc = dev_get_drvdata(&pdev->dev); bt_bmc 507 drivers/char/ipmi/bt-bmc.c misc_deregister(&bt_bmc->miscdev); bt_bmc 508 drivers/char/ipmi/bt-bmc.c if (!bt_bmc->irq) bt_bmc 509 drivers/char/ipmi/bt-bmc.c del_timer_sync(&bt_bmc->poll_timer);