Lines Matching +full:ipmi +full:- +full:bt
1 // SPDX-License-Identifier: GPL-2.0+
22 #define DRV_NAME "hisi-lpc"
27 * such as BT.
84 return (status & LPC_REG_OP_STATUS_FINISHED) ? 0 : -EIO;
86 } while (--waitcnt);
88 return -ETIMEDOUT;
92 * hisi_lpc_target_in - trigger a series of LPC cycles for read operation
99 * Returns 0 on success, non-zero on fail.
110 if (!buf || !opcnt || !para || !para->csize || !lpcdev)
111 return -EINVAL;
115 if (!(para->opflags & FG_INCRADDR_LPC)) {
121 spin_lock_irqsave(&lpcdev->cycle_lock, flags);
123 writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN);
124 writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD);
125 writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR);
128 lpcdev->membase + LPC_REG_STARTUP_SIGNAL);
131 ret = wait_lpc_idle(lpcdev->membase, waitcnt);
133 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
137 readsb(lpcdev->membase + LPC_REG_RDATA, buf, opcnt);
139 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
145 * hisi_lpc_target_out - trigger a series of LPC cycles for write operation
152 * Returns 0 on success, non-zero on fail.
164 return -EINVAL;
169 if (!(para->opflags & FG_INCRADDR_LPC)) {
174 spin_lock_irqsave(&lpcdev->cycle_lock, flags);
176 writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN);
177 writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD);
178 writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR);
180 writesb(lpcdev->membase + LPC_REG_WDATA, buf, opcnt);
183 lpcdev->membase + LPC_REG_STARTUP_SIGNAL);
186 ret = wait_lpc_idle(lpcdev->membase, waitcnt);
188 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags);
196 return pio - lpcdev->io_host->io_start + lpcdev->io_host->hw_start;
200 * hisi_lpc_comm_in - input the data in a single operation
232 * hisi_lpc_comm_out - output the data in a single operation
262 * hisi_lpc_comm_ins - input the data in the buffer in multiple operations
270 * Returns 0 on success, -errno otherwise.
281 return -EINVAL;
297 } while (--count);
303 * hisi_lpc_comm_outs - output the data in the buffer in multiple operations
332 } while (--count);
350 sys_port = logic_pio_trans_hwaddr(acpi_fwnode_handle(host), res->start, len);
352 return -EFAULT;
354 res->start = sys_port;
355 res->end = sys_port + len;
368 if (r->end != 0x3fff)
371 if (r->start == 0xe4)
372 r->end = 0xe4 + 0x04 - 1;
373 else if (r->start == 0x2f8)
374 r->end = 0x2f8 + 0x08 - 1;
381 * hisi_lpc_acpi_set_io_res - set the resources for a child
390 * host-relative address resource. This function will return the translated
397 struct acpi_device *host = to_acpi_device(adev->dev.parent);
404 if (!adev->status.present) {
405 dev_dbg(&adev->dev, "device is not present\n");
406 return -EIO;
410 dev_dbg(&adev->dev, "has been enumerated\n");
411 return -EIO;
421 dev_dbg(&adev->dev, "failed to get resources\n");
422 return count ? count : -EIO;
431 return -ENOMEM;
435 resources[count] = *rentry->res;
450 dev_err(&adev->dev, "translate IO range %pR failed (%d)\n",
503 /* ipmi */
510 .name = "hisi-lpc-ipmi",
517 /* 8250-compatible uart */
530 .iobase = res->start,
544 for (; cell && cell->hid; cell++) {
545 if (!strcmp(cell->hid, hid)) {
558 pdev = platform_device_register_full(cell->pdevinfo);
567 * hisi_lpc_acpi_probe - probe children for ACPI FW
591 return -ENODEV;
600 * hisi_lpc_probe - the probe callback function for hisi lpc host,
604 * Returns 0 on success, non-zero on fail.
608 struct device *dev = &pdev->dev;
616 return -ENOMEM;
618 spin_lock_init(&lpcdev->cycle_lock);
620 lpcdev->membase = devm_platform_ioremap_resource(pdev, 0);
621 if (IS_ERR(lpcdev->membase))
622 return PTR_ERR(lpcdev->membase);
626 return -ENOMEM;
628 range->fwnode = dev_fwnode(dev);
629 range->flags = LOGIC_PIO_INDIRECT;
630 range->size = PIO_INDIRECT_SIZE;
631 range->hostdata = lpcdev;
632 range->ops = &hisi_lpc_ops;
633 lpcdev->io_host = range;
642 if (is_acpi_device_node(range->fwnode))
645 ret = of_platform_populate(dev->of_node, NULL, NULL, dev);
653 io_end = lpcdev->io_host->io_start + lpcdev->io_host->size;
654 dev_info(dev, "registered range [%pa - %pa]\n",
655 &lpcdev->io_host->io_start, &io_end);
662 struct device *dev = &pdev->dev;
664 struct logic_pio_hwaddr *range = lpcdev->io_host;
666 if (is_acpi_device_node(range->fwnode))
675 { .compatible = "hisilicon,hip06-lpc", },
676 { .compatible = "hisilicon,hip07-lpc", },