H A D | tc6393xb.c | 26 #include <linux/mfd/tc6393xb.h> 91 struct tc6393xb { struct 126 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_nand_enable() local 129 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_nand_enable() 133 tmio_iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); tc6393xb_nand_enable() 135 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_nand_enable() 224 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); tc6393xb_ohci_enable() local 229 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_ohci_enable() 231 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); tc6393xb_ohci_enable() 233 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tc6393xb_ohci_enable() 235 fer = tmio_ioread8(tc6393xb->scr + SCR_FER); tc6393xb_ohci_enable() 237 tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); tc6393xb_ohci_enable() 239 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_ohci_enable() 246 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); tc6393xb_ohci_disable() local 251 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_ohci_disable() 253 fer = tmio_ioread8(tc6393xb->scr + SCR_FER); tc6393xb_ohci_disable() 255 tmio_iowrite8(fer, tc6393xb->scr + SCR_FER); tc6393xb_ohci_disable() 257 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); tc6393xb_ohci_disable() 259 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tc6393xb_ohci_disable() 261 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_ohci_disable() 279 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); tc6393xb_fb_enable() local 283 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_fb_enable() 285 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); tc6393xb_fb_enable() 288 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tc6393xb_fb_enable() 290 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_fb_enable() 297 struct tc6393xb *tc6393xb = dev_get_drvdata(dev->dev.parent); tc6393xb_fb_disable() local 301 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_fb_disable() 303 ccr = tmio_ioread16(tc6393xb->scr + SCR_CCR); tc6393xb_fb_disable() 306 tmio_iowrite16(ccr, tc6393xb->scr + SCR_CCR); tc6393xb_fb_disable() 308 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_fb_disable() 316 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_lcd_set_power() local 320 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_lcd_set_power() 322 fer = ioread8(tc6393xb->scr + SCR_FER); tc6393xb_lcd_set_power() 327 iowrite8(fer, tc6393xb->scr + SCR_FER); tc6393xb_lcd_set_power() 329 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_lcd_set_power() 338 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_lcd_mode() local 341 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_lcd_mode() 343 iowrite16(mode->pixclock, tc6393xb->scr + SCR_PLL1CR + 0); tc6393xb_lcd_mode() 344 iowrite16(mode->pixclock >> 16, tc6393xb->scr + SCR_PLL1CR + 2); tc6393xb_lcd_mode() 346 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_lcd_mode() 355 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_mmc_enable() local 357 tmio_core_mmc_enable(tc6393xb->scr + 0x200, 0, tc6393xb_mmc_enable() 366 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_mmc_resume() local 368 tmio_core_mmc_resume(tc6393xb->scr + 0x200, 0, tc6393xb_mmc_resume() 377 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_mmc_pwr() local 379 tmio_core_mmc_pwr(tc6393xb->scr + 0x200, 0, state); tc6393xb_mmc_pwr() 385 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_mmc_clk_div() local 387 tmio_core_mmc_clk_div(tc6393xb->scr + 0x200, 0, state); tc6393xb_mmc_clk_div() 437 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); tc6393xb_gpio_get() local 440 return tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) tc6393xb_gpio_get() 447 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); __tc6393xb_gpio_set() local 450 dsr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); __tc6393xb_gpio_set() 456 tmio_iowrite8(dsr, tc6393xb->scr + SCR_GPO_DSR(offset / 8)); __tc6393xb_gpio_set() 462 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); tc6393xb_gpio_set() local 465 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_gpio_set() 469 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_gpio_set() 475 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); tc6393xb_gpio_direction_input() local 479 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_gpio_direction_input() 481 doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tc6393xb_gpio_direction_input() 483 tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tc6393xb_gpio_direction_input() 485 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_gpio_direction_input() 493 struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); tc6393xb_gpio_direction_output() local 497 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_gpio_direction_output() 501 doecr = tmio_ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tc6393xb_gpio_direction_output() 503 tmio_iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); tc6393xb_gpio_direction_output() 505 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_gpio_direction_output() 510 static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base) tc6393xb_register_gpio() argument 512 tc6393xb->gpio.label = "tc6393xb"; tc6393xb_register_gpio() 513 tc6393xb->gpio.base = gpio_base; tc6393xb_register_gpio() 514 tc6393xb->gpio.ngpio = 16; tc6393xb_register_gpio() 515 tc6393xb->gpio.set = tc6393xb_gpio_set; tc6393xb_register_gpio() 516 tc6393xb->gpio.get = tc6393xb_gpio_get; tc6393xb_register_gpio() 517 tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; tc6393xb_register_gpio() 518 tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; tc6393xb_register_gpio() 520 return gpiochip_add(&tc6393xb->gpio); tc6393xb_register_gpio() 527 struct tc6393xb *tc6393xb = irq_desc_get_handler_data(desc); tc6393xb_irq() local 531 irq_base = tc6393xb->irq_base; tc6393xb_irq() 533 while ((isr = tmio_ioread8(tc6393xb->scr + SCR_ISR) & tc6393xb_irq() 534 ~tmio_ioread8(tc6393xb->scr + SCR_IMR))) tc6393xb_irq() 547 struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); tc6393xb_irq_mask() local 551 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_irq_mask() 552 imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); tc6393xb_irq_mask() 553 imr |= 1 << (data->irq - tc6393xb->irq_base); tc6393xb_irq_mask() 554 tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); tc6393xb_irq_mask() 555 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_irq_mask() 560 struct tc6393xb *tc6393xb = irq_data_get_irq_chip_data(data); tc6393xb_irq_unmask() local 564 spin_lock_irqsave(&tc6393xb->lock, flags); tc6393xb_irq_unmask() 565 imr = tmio_ioread8(tc6393xb->scr + SCR_IMR); tc6393xb_irq_unmask() 566 imr &= ~(1 << (data->irq - tc6393xb->irq_base)); tc6393xb_irq_unmask() 567 tmio_iowrite8(imr, tc6393xb->scr + SCR_IMR); tc6393xb_irq_unmask() 568 spin_unlock_irqrestore(&tc6393xb->lock, flags); tc6393xb_irq_unmask() 572 .name = "tc6393xb", 580 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_attach_irq() local 583 irq_base = tc6393xb->irq_base; tc6393xb_attach_irq() 587 irq_set_chip_data(irq, tc6393xb); tc6393xb_attach_irq() 591 irq_set_irq_type(tc6393xb->irq, IRQ_TYPE_EDGE_FALLING); tc6393xb_attach_irq() 592 irq_set_chained_handler_and_data(tc6393xb->irq, tc6393xb_irq, tc6393xb_attach_irq() 593 tc6393xb); tc6393xb_attach_irq() 598 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_detach_irq() local 601 irq_set_chained_handler_and_data(tc6393xb->irq, NULL, NULL); tc6393xb_detach_irq() 603 irq_base = tc6393xb->irq_base; tc6393xb_detach_irq() 617 struct tc6393xb *tc6393xb; tc6393xb_probe() local 625 tc6393xb = kzalloc(sizeof *tc6393xb, GFP_KERNEL); tc6393xb_probe() 626 if (!tc6393xb) { tc6393xb_probe() 631 spin_lock_init(&tc6393xb->lock); tc6393xb_probe() 633 platform_set_drvdata(dev, tc6393xb); tc6393xb_probe() 637 tc6393xb->irq = ret; tc6393xb_probe() 641 tc6393xb->iomem = iomem; tc6393xb_probe() 642 tc6393xb->irq_base = tcpd->irq_base; tc6393xb_probe() 644 tc6393xb->clk = clk_get(&dev->dev, "CLK_CK3P6MI"); tc6393xb_probe() 645 if (IS_ERR(tc6393xb->clk)) { tc6393xb_probe() 646 ret = PTR_ERR(tc6393xb->clk); tc6393xb_probe() 650 rscr = &tc6393xb->rscr; tc6393xb_probe() 651 rscr->name = "tc6393xb-core"; tc6393xb_probe() 660 tc6393xb->scr = ioremap(rscr->start, resource_size(rscr)); tc6393xb_probe() 661 if (!tc6393xb->scr) { tc6393xb_probe() 666 ret = clk_prepare_enable(tc6393xb->clk); tc6393xb_probe() 674 iowrite8(0, tc6393xb->scr + SCR_FER); tc6393xb_probe() 675 iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); tc6393xb_probe() 677 tc6393xb->scr + SCR_CCR); tc6393xb_probe() 680 BIT(15), tc6393xb->scr + SCR_MCR); tc6393xb_probe() 681 iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); tc6393xb_probe() 682 iowrite8(0, tc6393xb->scr + SCR_IRR); tc6393xb_probe() 683 iowrite8(0xbf, tc6393xb->scr + SCR_IMR); tc6393xb_probe() 685 printk(KERN_INFO "Toshiba tc6393xb revision %d at 0x%08lx, irq %d\n", tc6393xb_probe() 686 tmio_ioread8(tc6393xb->scr + SCR_REVID), tc6393xb_probe() 687 (unsigned long) iomem->start, tc6393xb->irq); tc6393xb_probe() 689 tc6393xb->gpio.base = -1; tc6393xb_probe() 692 ret = tc6393xb_register_gpio(tc6393xb, tcpd->gpio_base); tc6393xb_probe() 725 if (tc6393xb->gpio.base != -1) tc6393xb_probe() 726 gpiochip_remove(&tc6393xb->gpio); tc6393xb_probe() 729 clk_disable_unprepare(tc6393xb->clk); tc6393xb_probe() 731 iounmap(tc6393xb->scr); tc6393xb_probe() 733 release_resource(&tc6393xb->rscr); tc6393xb_probe() 735 clk_put(tc6393xb->clk); tc6393xb_probe() 738 kfree(tc6393xb); tc6393xb_probe() 746 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_remove() local 756 if (tc6393xb->gpio.base != -1) tc6393xb_remove() 757 gpiochip_remove(&tc6393xb->gpio); tc6393xb_remove() 760 clk_disable_unprepare(tc6393xb->clk); tc6393xb_remove() 761 iounmap(tc6393xb->scr); tc6393xb_remove() 762 release_resource(&tc6393xb->rscr); tc6393xb_remove() 763 clk_put(tc6393xb->clk); tc6393xb_remove() 764 kfree(tc6393xb); tc6393xb_remove() 773 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_suspend() local 776 tc6393xb->suspend_state.ccr = ioread16(tc6393xb->scr + SCR_CCR); tc6393xb_suspend() 777 tc6393xb->suspend_state.fer = ioread8(tc6393xb->scr + SCR_FER); tc6393xb_suspend() 780 tc6393xb->suspend_state.gpo_dsr[i] = tc6393xb_suspend() 781 ioread8(tc6393xb->scr + SCR_GPO_DSR(i)); tc6393xb_suspend() 782 tc6393xb->suspend_state.gpo_doecr[i] = tc6393xb_suspend() 783 ioread8(tc6393xb->scr + SCR_GPO_DOECR(i)); tc6393xb_suspend() 784 tc6393xb->suspend_state.gpi_bcr[i] = tc6393xb_suspend() 785 ioread8(tc6393xb->scr + SCR_GPI_BCR(i)); tc6393xb_suspend() 788 clk_disable_unprepare(tc6393xb->clk); tc6393xb_suspend() 796 struct tc6393xb *tc6393xb = platform_get_drvdata(dev); tc6393xb_resume() local 800 clk_prepare_enable(tc6393xb->clk); tc6393xb_resume() 809 iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER); tc6393xb_resume() 810 iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); tc6393xb_resume() 811 iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR); tc6393xb_resume() 814 BIT(15), tc6393xb->scr + SCR_MCR); tc6393xb_resume() 815 iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); tc6393xb_resume() 816 iowrite8(0, tc6393xb->scr + SCR_IRR); tc6393xb_resume() 817 iowrite8(0xbf, tc6393xb->scr + SCR_IMR); tc6393xb_resume() 820 iowrite8(tc6393xb->suspend_state.gpo_dsr[i], tc6393xb_resume() 821 tc6393xb->scr + SCR_GPO_DSR(i)); tc6393xb_resume() 822 iowrite8(tc6393xb->suspend_state.gpo_doecr[i], tc6393xb_resume() 823 tc6393xb->scr + SCR_GPO_DOECR(i)); tc6393xb_resume() 824 iowrite8(tc6393xb->suspend_state.gpi_bcr[i], tc6393xb_resume() 825 tc6393xb->scr + SCR_GPI_BCR(i)); tc6393xb_resume() 842 .name = "tc6393xb", 861 MODULE_DESCRIPTION("tc6393xb Toshiba Mobile IO Controller"); 862 MODULE_ALIAS("platform:tc6393xb");
|