Lines Matching refs:lpcdev

101 static int hisi_lpc_target_in(struct hisi_lpc_dev *lpcdev,  in hisi_lpc_target_in()  argument
110 if (!buf || !opcnt || !para || !para->csize || !lpcdev) in hisi_lpc_target_in()
121 spin_lock_irqsave(&lpcdev->cycle_lock, flags); in hisi_lpc_target_in()
123 writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN); in hisi_lpc_target_in()
124 writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD); in hisi_lpc_target_in()
125 writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR); in hisi_lpc_target_in()
128 lpcdev->membase + LPC_REG_STARTUP_SIGNAL); in hisi_lpc_target_in()
131 ret = wait_lpc_idle(lpcdev->membase, waitcnt); in hisi_lpc_target_in()
133 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags); in hisi_lpc_target_in()
137 readsb(lpcdev->membase + LPC_REG_RDATA, buf, opcnt); in hisi_lpc_target_in()
139 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags); in hisi_lpc_target_in()
154 static int hisi_lpc_target_out(struct hisi_lpc_dev *lpcdev, in hisi_lpc_target_out() argument
163 if (!buf || !opcnt || !para || !lpcdev) in hisi_lpc_target_out()
174 spin_lock_irqsave(&lpcdev->cycle_lock, flags); in hisi_lpc_target_out()
176 writel_relaxed(opcnt, lpcdev->membase + LPC_REG_OP_LEN); in hisi_lpc_target_out()
177 writel_relaxed(cmd_word, lpcdev->membase + LPC_REG_CMD); in hisi_lpc_target_out()
178 writel_relaxed(addr, lpcdev->membase + LPC_REG_ADDR); in hisi_lpc_target_out()
180 writesb(lpcdev->membase + LPC_REG_WDATA, buf, opcnt); in hisi_lpc_target_out()
183 lpcdev->membase + LPC_REG_STARTUP_SIGNAL); in hisi_lpc_target_out()
186 ret = wait_lpc_idle(lpcdev->membase, waitcnt); in hisi_lpc_target_out()
188 spin_unlock_irqrestore(&lpcdev->cycle_lock, flags); in hisi_lpc_target_out()
193 static unsigned long hisi_lpc_pio_to_addr(struct hisi_lpc_dev *lpcdev, in hisi_lpc_pio_to_addr() argument
196 return pio - lpcdev->io_host->io_start + lpcdev->io_host->hw_start; in hisi_lpc_pio_to_addr()
209 struct hisi_lpc_dev *lpcdev = hostdata; in hisi_lpc_comm_in() local
215 if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH) in hisi_lpc_comm_in()
218 addr = hisi_lpc_pio_to_addr(lpcdev, pio); in hisi_lpc_comm_in()
223 ret = hisi_lpc_target_in(lpcdev, &iopara, addr, in hisi_lpc_comm_in()
243 struct hisi_lpc_dev *lpcdev = hostdata; in hisi_lpc_comm_out() local
249 if (!lpcdev || !dwidth || dwidth > LPC_MAX_DWIDTH) in hisi_lpc_comm_out()
253 addr = hisi_lpc_pio_to_addr(lpcdev, pio); in hisi_lpc_comm_out()
258 hisi_lpc_target_out(lpcdev, &iopara, addr, buf, dwidth); in hisi_lpc_comm_out()
275 struct hisi_lpc_dev *lpcdev = hostdata; in hisi_lpc_comm_ins() local
280 if (!lpcdev || !buf || !count || !dwidth || dwidth > LPC_MAX_DWIDTH) in hisi_lpc_comm_ins()
288 addr = hisi_lpc_pio_to_addr(lpcdev, pio); in hisi_lpc_comm_ins()
293 ret = hisi_lpc_target_in(lpcdev, &iopara, addr, buf, dwidth); in hisi_lpc_comm_ins()
314 struct hisi_lpc_dev *lpcdev = hostdata; in hisi_lpc_comm_outs() local
319 if (!lpcdev || !buf || !count || !dwidth || dwidth > LPC_MAX_DWIDTH) in hisi_lpc_comm_outs()
327 addr = hisi_lpc_pio_to_addr(lpcdev, pio); in hisi_lpc_comm_outs()
329 if (hisi_lpc_target_out(lpcdev, &iopara, addr, buf, dwidth)) in hisi_lpc_comm_outs()
624 struct hisi_lpc_dev *lpcdev; in hisi_lpc_probe() local
629 lpcdev = devm_kzalloc(dev, sizeof(*lpcdev), GFP_KERNEL); in hisi_lpc_probe()
630 if (!lpcdev) in hisi_lpc_probe()
633 spin_lock_init(&lpcdev->cycle_lock); in hisi_lpc_probe()
636 lpcdev->membase = devm_ioremap_resource(dev, res); in hisi_lpc_probe()
637 if (IS_ERR(lpcdev->membase)) in hisi_lpc_probe()
638 return PTR_ERR(lpcdev->membase); in hisi_lpc_probe()
647 range->hostdata = lpcdev; in hisi_lpc_probe()
649 lpcdev->io_host = range; in hisi_lpc_probe()
667 dev_set_drvdata(dev, lpcdev); in hisi_lpc_probe()
669 io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; in hisi_lpc_probe()
671 &lpcdev->io_host->io_start, &io_end); in hisi_lpc_probe()
680 struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); in hisi_lpc_remove() local
681 struct logic_pio_hwaddr *range = lpcdev->io_host; in hisi_lpc_remove()