Lines Matching refs:tc6393xb
91 struct tc6393xb { struct
126 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_nand_enable() argument
129 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_nand_enable()
133 tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); in tc6393xb_nand_enable()
135 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_nand_enable()
224 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); in tc6393xb_ohci_enable() local
229 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_ohci_enable()
231 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); in tc6393xb_ohci_enable()
233 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); in tc6393xb_ohci_enable()
235 fer = tmio_ioread8(tc6393xb->scr + SCR_FER); in tc6393xb_ohci_enable()
237 tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); in tc6393xb_ohci_enable()
239 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_ohci_enable()
246 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); in tc6393xb_ohci_disable() local
251 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_ohci_disable()
253 fer = tmio_ioread8(tc6393xb->scr + SCR_FER); in tc6393xb_ohci_disable()
255 tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); in tc6393xb_ohci_disable()
257 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); in tc6393xb_ohci_disable()
259 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); in tc6393xb_ohci_disable()
261 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_ohci_disable()
268 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); in tc6393xb_fb_enable() local
272 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_fb_enable()
274 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); in tc6393xb_fb_enable()
277 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); in tc6393xb_fb_enable()
279 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_fb_enable()
286 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); in tc6393xb_fb_disable() local
290 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_fb_disable()
292 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); in tc6393xb_fb_disable()
295 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); in tc6393xb_fb_disable()
297 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_fb_disable()
305 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_lcd_set_power() local
309 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_lcd_set_power()
311 fer = ioread8(tc6393xb->scr + SCR_FER); in tc6393xb_lcd_set_power()
316 iowrite8(fer, tc6393xb->scr + SCR_FER); in tc6393xb_lcd_set_power()
318 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_lcd_set_power()
327 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_lcd_mode() local
330 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_lcd_mode()
332 iowrite16(mode->pixclock, tc6393xb->scr + SCR_PLL1CR + 0); in tc6393xb_lcd_mode()
333 iowrite16(mode->pixclock >> 16, tc6393xb->scr + SCR_PLL1CR + 2); in tc6393xb_lcd_mode()
335 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_lcd_mode()
344 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_mmc_enable() local
346 tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0, in tc6393xb_mmc_enable()
355 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_mmc_resume() local
357 tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0, in tc6393xb_mmc_resume()
366 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_mmc_pwr() local
368 tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state); in tc6393xb_mmc_pwr()
374 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_mmc_clk_div() local
376 tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state); in tc6393xb_mmc_clk_div()
426 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); in tc6393xb_gpio_get() local
429 return tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) in tc6393xb_gpio_get()
436 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); in __tc6393xb_gpio_set() local
439 dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); in __tc6393xb_gpio_set()
445 tmio_iowrite8(dsr, tc6393xb->scr + SCR_GPO_DSR(offset / 8)); in __tc6393xb_gpio_set()
451 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); in tc6393xb_gpio_set() local
454 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_gpio_set()
458 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_gpio_set()
464 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); in tc6393xb_gpio_direction_input() local
468 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_gpio_direction_input()
470 doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); in tc6393xb_gpio_direction_input()
472 tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); in tc6393xb_gpio_direction_input()
474 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_gpio_direction_input()
482 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); in tc6393xb_gpio_direction_output() local
486 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_gpio_direction_output()
490 doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); in tc6393xb_gpio_direction_output()
492 tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); in tc6393xb_gpio_direction_output()
494 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_gpio_direction_output()
499 static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base) in tc6393xb_register_gpio() argument
501 tc6393xb->gpio.label = "tc6393xb"; in tc6393xb_register_gpio()
502 tc6393xb->gpio.base = gpio_base; in tc6393xb_register_gpio()
503 tc6393xb->gpio.ngpio = 16; in tc6393xb_register_gpio()
504 tc6393xb->gpio.set = tc6393xb_gpio_set; in tc6393xb_register_gpio()
505 tc6393xb->gpio.get = tc6393xb_gpio_get; in tc6393xb_register_gpio()
506 tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; in tc6393xb_register_gpio()
507 tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; in tc6393xb_register_gpio()
509 return gpiochip_add(&tc6393xb->gpio); in tc6393xb_register_gpio()
517 struct tc6393xb *tc6393xb = irq_get_handler_data(irq); in tc6393xb_irq() local
521 irq_base = tc6393xb->irq_base; in tc6393xb_irq()
523 while ((isr = tmio_ioread8(tc6393xb->scr + SCR_ISR) & in tc6393xb_irq()
524 ~tmio_ioread8(tc6393xb->scr + SCR_IMR))) in tc6393xb_irq()
537 struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); in tc6393xb_irq_mask() local
541 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_irq_mask()
542 imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); in tc6393xb_irq_mask()
543 imr |= 1 << (data->irq - tc6393xb->irq_base); in tc6393xb_irq_mask()
544 tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); in tc6393xb_irq_mask()
545 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_irq_mask()
550 struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); in tc6393xb_irq_unmask() local
554 spin_lock_irqsave(&tc6393xb->lock, flags); in tc6393xb_irq_unmask()
555 imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); in tc6393xb_irq_unmask()
556 imr &= ~(1 << (data->irq - tc6393xb->irq_base)); in tc6393xb_irq_unmask()
557 tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); in tc6393xb_irq_unmask()
558 spin_unlock_irqrestore(&tc6393xb->lock, flags); in tc6393xb_irq_unmask()
570 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_attach_irq() local
573 irq_base = tc6393xb->irq_base; in tc6393xb_attach_irq()
577 irq_set_chip_data(irq, tc6393xb); in tc6393xb_attach_irq()
581 irq_set_irq_type(tc6393xb->irq, IRQ_TYPE_EDGE_FALLING); in tc6393xb_attach_irq()
582 irq_set_handler_data(tc6393xb->irq, tc6393xb); in tc6393xb_attach_irq()
583 irq_set_chained_handler(tc6393xb->irq, tc6393xb_irq); in tc6393xb_attach_irq()
588 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_detach_irq() local
591 irq_set_chained_handler(tc6393xb->irq, NULL); in tc6393xb_detach_irq()
592 irq_set_handler_data(tc6393xb->irq, NULL); in tc6393xb_detach_irq()
594 irq_base = tc6393xb->irq_base; in tc6393xb_detach_irq()
608 struct tc6393xb *tc6393xb; in tc6393xb_probe() local
616 tc6393xb = kzalloc(sizeof *tc6393xb, GFP_KERNEL); in tc6393xb_probe()
617 if (!tc6393xb) { in tc6393xb_probe()
622 spin_lock_init(&tc6393xb->lock); in tc6393xb_probe()
624 platform_set_drvdata(dev, tc6393xb); in tc6393xb_probe()
628 tc6393xb->irq = ret; in tc6393xb_probe()
632 tc6393xb->iomem = iomem; in tc6393xb_probe()
633 tc6393xb->irq_base = tcpd->irq_base; in tc6393xb_probe()
635 tc6393xb->clk = clk_get(&dev->dev, "CLK_CK3P6MI"); in tc6393xb_probe()
636 if (IS_ERR(tc6393xb->clk)) { in tc6393xb_probe()
637 ret = PTR_ERR(tc6393xb->clk); in tc6393xb_probe()
641 rscr = &tc6393xb->rscr; in tc6393xb_probe()
651 tc6393xb->scr = ioremap(rscr->start, resource_size(rscr)); in tc6393xb_probe()
652 if (!tc6393xb->scr) { in tc6393xb_probe()
657 ret = clk_enable(tc6393xb->clk); in tc6393xb_probe()
665 iowrite8(0, tc6393xb->scr + SCR_FER); in tc6393xb_probe()
666 iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); in tc6393xb_probe()
668 tc6393xb->scr + SCR_CCR); in tc6393xb_probe()
671 BIT(15), tc6393xb->scr + SCR_MCR); in tc6393xb_probe()
672 iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); in tc6393xb_probe()
673 iowrite8(0, tc6393xb->scr + SCR_IRR); in tc6393xb_probe()
674 iowrite8(0xbf, tc6393xb->scr + SCR_IMR); in tc6393xb_probe()
677 tmio_ioread8(tc6393xb->scr + SCR_REVID), in tc6393xb_probe()
678 (unsigned long) iomem->start, tc6393xb->irq); in tc6393xb_probe()
680 tc6393xb->gpio.base = -1; in tc6393xb_probe()
683 ret = tc6393xb_register_gpio(tc6393xb, tcpd->gpio_base); in tc6393xb_probe()
716 if (tc6393xb->gpio.base != -1) in tc6393xb_probe()
717 temp = gpiochip_remove(&tc6393xb->gpio); in tc6393xb_probe()
720 clk_disable(tc6393xb->clk); in tc6393xb_probe()
722 iounmap(tc6393xb->scr); in tc6393xb_probe()
724 release_resource(&tc6393xb->rscr); in tc6393xb_probe()
726 clk_put(tc6393xb->clk); in tc6393xb_probe()
729 kfree(tc6393xb); in tc6393xb_probe()
737 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_remove() local
747 if (tc6393xb->gpio.base != -1) { in tc6393xb_remove()
748 ret = gpiochip_remove(&tc6393xb->gpio); in tc6393xb_remove()
756 clk_disable(tc6393xb->clk); in tc6393xb_remove()
757 iounmap(tc6393xb->scr); in tc6393xb_remove()
758 release_resource(&tc6393xb->rscr); in tc6393xb_remove()
760 clk_put(tc6393xb->clk); in tc6393xb_remove()
761 kfree(tc6393xb); in tc6393xb_remove()
770 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_suspend() local
773 tc6393xb->suspend_state.ccr = ioread16(tc6393xb->scr + SCR_CCR); in tc6393xb_suspend()
774 tc6393xb->suspend_state.fer = ioread8(tc6393xb->scr + SCR_FER); in tc6393xb_suspend()
777 tc6393xb->suspend_state.gpo_dsr[i] = in tc6393xb_suspend()
778 ioread8(tc6393xb->scr + SCR_GPO_DSR(i)); in tc6393xb_suspend()
779 tc6393xb->suspend_state.gpo_doecr[i] = in tc6393xb_suspend()
780 ioread8(tc6393xb->scr + SCR_GPO_DOECR(i)); in tc6393xb_suspend()
781 tc6393xb->suspend_state.gpi_bcr[i] = in tc6393xb_suspend()
782 ioread8(tc6393xb->scr + SCR_GPI_BCR(i)); in tc6393xb_suspend()
785 clk_disable(tc6393xb->clk); in tc6393xb_suspend()
793 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); in tc6393xb_resume() local
797 clk_enable(tc6393xb->clk); in tc6393xb_resume()
806 iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER); in tc6393xb_resume()
807 iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); in tc6393xb_resume()
808 iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR); in tc6393xb_resume()
811 BIT(15), tc6393xb->scr + SCR_MCR); in tc6393xb_resume()
812 iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); in tc6393xb_resume()
813 iowrite8(0, tc6393xb->scr + SCR_IRR); in tc6393xb_resume()
814 iowrite8(0xbf, tc6393xb->scr + SCR_IMR); in tc6393xb_resume()
817 iowrite8(tc6393xb->suspend_state.gpo_dsr[i], in tc6393xb_resume()
818 tc6393xb->scr + SCR_GPO_DSR(i)); in tc6393xb_resume()
819 iowrite8(tc6393xb->suspend_state.gpo_doecr[i], in tc6393xb_resume()
820 tc6393xb->scr + SCR_GPO_DOECR(i)); in tc6393xb_resume()
821 iowrite8(tc6393xb->suspend_state.gpi_bcr[i], in tc6393xb_resume()
822 tc6393xb->scr + SCR_GPI_BCR(i)); in tc6393xb_resume()