• Home
  • Raw
  • Download

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()
610 struct hisi_lpc_dev *lpcdev; in hisi_lpc_probe() local
614 lpcdev = devm_kzalloc(dev, sizeof(*lpcdev), GFP_KERNEL); in hisi_lpc_probe()
615 if (!lpcdev) in hisi_lpc_probe()
618 spin_lock_init(&lpcdev->cycle_lock); in hisi_lpc_probe()
620 lpcdev->membase = devm_platform_ioremap_resource(pdev, 0); in hisi_lpc_probe()
621 if (IS_ERR(lpcdev->membase)) in hisi_lpc_probe()
622 return PTR_ERR(lpcdev->membase); in hisi_lpc_probe()
631 range->hostdata = lpcdev; in hisi_lpc_probe()
633 lpcdev->io_host = range; in hisi_lpc_probe()
651 dev_set_drvdata(dev, lpcdev); in hisi_lpc_probe()
653 io_end = lpcdev->io_host->io_start + lpcdev->io_host->size; in hisi_lpc_probe()
655 &lpcdev->io_host->io_start, &io_end); in hisi_lpc_probe()
663 struct hisi_lpc_dev *lpcdev = dev_get_drvdata(dev); in hisi_lpc_remove() local
664 struct logic_pio_hwaddr *range = lpcdev->io_host; in hisi_lpc_remove()