Lines Matching refs:drvdata

97 	struct sun4i_ps2data *drvdata = dev_id;  in sun4i_ps2_interrupt()  local
104 spin_lock(&drvdata->lock); in sun4i_ps2_interrupt()
107 intr_status = readl(drvdata->reg_base + PS2_REG_LSTS); in sun4i_ps2_interrupt()
108 fifo_status = readl(drvdata->reg_base + PS2_REG_FSTS); in sun4i_ps2_interrupt()
118 writel(rval, drvdata->reg_base + PS2_REG_LSTS); in sun4i_ps2_interrupt()
125 writel(rval, drvdata->reg_base + PS2_REG_FSTS); in sun4i_ps2_interrupt()
130 byte = readl(drvdata->reg_base + PS2_REG_DATA) & 0xff; in sun4i_ps2_interrupt()
131 serio_interrupt(drvdata->serio, byte, rxflags); in sun4i_ps2_interrupt()
134 writel(intr_status, drvdata->reg_base + PS2_REG_LSTS); in sun4i_ps2_interrupt()
135 writel(fifo_status, drvdata->reg_base + PS2_REG_FSTS); in sun4i_ps2_interrupt()
137 spin_unlock(&drvdata->lock); in sun4i_ps2_interrupt()
144 struct sun4i_ps2data *drvdata = serio->port_data; in sun4i_ps2_open() local
154 writel(rval, drvdata->reg_base + PS2_REG_LCTL); in sun4i_ps2_open()
161 writel(rval, drvdata->reg_base + PS2_REG_FCTL); in sun4i_ps2_open()
163 src_clk = clk_get_rate(drvdata->clk); in sun4i_ps2_open()
168 writel(rval, drvdata->reg_base + PS2_REG_CLKDR); in sun4i_ps2_open()
174 spin_lock_irqsave(&drvdata->lock, flags); in sun4i_ps2_open()
175 writel(rval, drvdata->reg_base + PS2_REG_GCTL); in sun4i_ps2_open()
176 spin_unlock_irqrestore(&drvdata->lock, flags); in sun4i_ps2_open()
183 struct sun4i_ps2data *drvdata = serio->port_data; in sun4i_ps2_close() local
187 rval = readl(drvdata->reg_base + PS2_REG_GCTL); in sun4i_ps2_close()
188 writel(rval & ~(PS2_GCTL_INTEN), drvdata->reg_base + PS2_REG_GCTL); in sun4i_ps2_close()
190 synchronize_irq(drvdata->irq); in sun4i_ps2_close()
196 struct sun4i_ps2data *drvdata = serio->port_data; in sun4i_ps2_write() local
199 if (readl(drvdata->reg_base + PS2_REG_FSTS) & PS2_FSTS_TXRDY) { in sun4i_ps2_write()
200 writel(val, drvdata->reg_base + PS2_REG_DATA); in sun4i_ps2_write()
211 struct sun4i_ps2data *drvdata; in sun4i_ps2_probe() local
216 drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL); in sun4i_ps2_probe()
218 if (!drvdata || !serio) { in sun4i_ps2_probe()
223 spin_lock_init(&drvdata->lock); in sun4i_ps2_probe()
233 drvdata->reg_base = ioremap(res->start, resource_size(res)); in sun4i_ps2_probe()
234 if (!drvdata->reg_base) { in sun4i_ps2_probe()
240 drvdata->clk = clk_get(dev, NULL); in sun4i_ps2_probe()
241 if (IS_ERR(drvdata->clk)) { in sun4i_ps2_probe()
242 error = PTR_ERR(drvdata->clk); in sun4i_ps2_probe()
247 error = clk_prepare_enable(drvdata->clk); in sun4i_ps2_probe()
257 serio->port_data = drvdata; in sun4i_ps2_probe()
263 writel(0, drvdata->reg_base + PS2_REG_GCTL); in sun4i_ps2_probe()
266 drvdata->irq = platform_get_irq(pdev, 0); in sun4i_ps2_probe()
267 if (drvdata->irq < 0) { in sun4i_ps2_probe()
268 error = drvdata->irq; in sun4i_ps2_probe()
272 drvdata->serio = serio; in sun4i_ps2_probe()
273 drvdata->dev = dev; in sun4i_ps2_probe()
275 error = request_irq(drvdata->irq, sun4i_ps2_interrupt, 0, in sun4i_ps2_probe()
276 DRIVER_NAME, drvdata); in sun4i_ps2_probe()
278 dev_err(drvdata->dev, "failed to allocate interrupt %d: %d\n", in sun4i_ps2_probe()
279 drvdata->irq, error); in sun4i_ps2_probe()
284 platform_set_drvdata(pdev, drvdata); in sun4i_ps2_probe()
289 clk_disable_unprepare(drvdata->clk); in sun4i_ps2_probe()
291 clk_put(drvdata->clk); in sun4i_ps2_probe()
293 iounmap(drvdata->reg_base); in sun4i_ps2_probe()
296 kfree(drvdata); in sun4i_ps2_probe()
302 struct sun4i_ps2data *drvdata = platform_get_drvdata(pdev); in sun4i_ps2_remove() local
304 serio_unregister_port(drvdata->serio); in sun4i_ps2_remove()
306 free_irq(drvdata->irq, drvdata); in sun4i_ps2_remove()
308 clk_disable_unprepare(drvdata->clk); in sun4i_ps2_remove()
309 clk_put(drvdata->clk); in sun4i_ps2_remove()
311 iounmap(drvdata->reg_base); in sun4i_ps2_remove()
313 kfree(drvdata); in sun4i_ps2_remove()