• Home
  • Raw
  • Download

Lines Matching refs:sachip

194 static int sa1111_map_irq(struct sa1111 *sachip, irq_hw_number_t hwirq)  in sa1111_map_irq()  argument
196 return irq_create_mapping(sachip->irqdomain, hwirq); in sa1111_map_irq()
215 struct sa1111 *sachip = irq_desc_get_handler_data(desc); in sa1111_irq_handler() local
217 void __iomem *mapbase = sachip->base + SA1111_INTC; in sa1111_irq_handler()
233 irqdomain = sachip->irqdomain; in sa1111_irq_handler()
263 struct sa1111 *sachip = irq_data_get_irq_chip_data(d); in sa1111_mask_irq() local
264 void __iomem *mapbase = sachip->base + SA1111_INTC + sa1111_irqbank(d); in sa1111_mask_irq()
274 struct sa1111 *sachip = irq_data_get_irq_chip_data(d); in sa1111_unmask_irq() local
275 void __iomem *mapbase = sachip->base + SA1111_INTC + sa1111_irqbank(d); in sa1111_unmask_irq()
292 struct sa1111 *sachip = irq_data_get_irq_chip_data(d); in sa1111_retrigger_irq() local
293 void __iomem *mapbase = sachip->base + SA1111_INTC + sa1111_irqbank(d); in sa1111_retrigger_irq()
316 struct sa1111 *sachip = irq_data_get_irq_chip_data(d); in sa1111_type_irq() local
317 void __iomem *mapbase = sachip->base + SA1111_INTC + sa1111_irqbank(d); in sa1111_type_irq()
339 struct sa1111 *sachip = irq_data_get_irq_chip_data(d); in sa1111_wake_irq() local
340 void __iomem *mapbase = sachip->base + SA1111_INTC + sa1111_irqbank(d); in sa1111_wake_irq()
366 struct sa1111 *sachip = d->host_data; in sa1111_irqdomain_map() local
372 irq_set_chip_data(irq, sachip); in sa1111_irqdomain_map()
384 static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base) in sa1111_setup_irq() argument
386 void __iomem *irqbase = sachip->base + SA1111_INTC; in sa1111_setup_irq()
392 request_mem_region(sachip->phys + SA1111_INTC, 512, "irq"); in sa1111_setup_irq()
396 dev_err(sachip->dev, "unable to allocate %u irqs: %d\n", in sa1111_setup_irq()
403 sachip->irq_base = ret; in sa1111_setup_irq()
424 sachip->irqdomain = irq_domain_add_linear(NULL, SA1111_IRQ_NR, in sa1111_setup_irq()
426 sachip); in sa1111_setup_irq()
427 if (!sachip->irqdomain) { in sa1111_setup_irq()
428 irq_free_descs(sachip->irq_base, SA1111_IRQ_NR); in sa1111_setup_irq()
432 irq_domain_associate_many(sachip->irqdomain, in sa1111_setup_irq()
433 sachip->irq_base + IRQ_GPAIN0, in sa1111_setup_irq()
435 irq_domain_associate_many(sachip->irqdomain, in sa1111_setup_irq()
436 sachip->irq_base + AUDXMTDMADONEA, in sa1111_setup_irq()
443 irq_set_irq_type(sachip->irq, IRQ_TYPE_EDGE_RISING); in sa1111_setup_irq()
444 irq_set_chained_handler_and_data(sachip->irq, sa1111_irq_handler, in sa1111_setup_irq()
445 sachip); in sa1111_setup_irq()
447 dev_info(sachip->dev, "Providing IRQ%u-%u\n", in sa1111_setup_irq()
448 sachip->irq_base, sachip->irq_base + SA1111_IRQ_NR - 1); in sa1111_setup_irq()
453 static void sa1111_remove_irq(struct sa1111 *sachip) in sa1111_remove_irq() argument
455 struct irq_domain *domain = sachip->irqdomain; in sa1111_remove_irq()
456 void __iomem *irqbase = sachip->base + SA1111_INTC; in sa1111_remove_irq()
465 irq_set_chained_handler_and_data(sachip->irq, NULL, NULL); in sa1111_remove_irq()
470 release_mem_region(sachip->phys + SA1111_INTC, 512); in sa1111_remove_irq()
486 static void __iomem *sa1111_gpio_map_reg(struct sa1111 *sachip, unsigned offset) in sa1111_gpio_map_reg() argument
488 void __iomem *reg = sachip->base + SA1111_GPIO; in sa1111_gpio_map_reg()
522 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_get_direction() local
523 void __iomem *reg = sa1111_gpio_map_reg(sachip, offset); in sa1111_gpio_get_direction()
531 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_direction_input() local
533 void __iomem *reg = sa1111_gpio_map_reg(sachip, offset); in sa1111_gpio_direction_input()
536 spin_lock_irqsave(&sachip->lock, flags); in sa1111_gpio_direction_input()
539 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_gpio_direction_input()
547 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_direction_output() local
549 void __iomem *reg = sa1111_gpio_map_reg(sachip, offset); in sa1111_gpio_direction_output()
552 spin_lock_irqsave(&sachip->lock, flags); in sa1111_gpio_direction_output()
557 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_gpio_direction_output()
564 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_get() local
565 void __iomem *reg = sa1111_gpio_map_reg(sachip, offset); in sa1111_gpio_get()
573 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_set() local
575 void __iomem *reg = sa1111_gpio_map_reg(sachip, offset); in sa1111_gpio_set()
578 spin_lock_irqsave(&sachip->lock, flags); in sa1111_gpio_set()
581 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_gpio_set()
587 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_set_multiple() local
589 void __iomem *reg = sachip->base + SA1111_GPIO; in sa1111_gpio_set_multiple()
595 spin_lock_irqsave(&sachip->lock, flags); in sa1111_gpio_set_multiple()
602 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_gpio_set_multiple()
607 struct sa1111 *sachip = gc_to_sa1111(gc); in sa1111_gpio_to_irq() local
609 return sa1111_map_irq(sachip, offset); in sa1111_gpio_to_irq()
612 static int sa1111_setup_gpios(struct sa1111 *sachip) in sa1111_setup_gpios() argument
614 sachip->gc.label = "sa1111"; in sa1111_setup_gpios()
615 sachip->gc.parent = sachip->dev; in sa1111_setup_gpios()
616 sachip->gc.owner = THIS_MODULE; in sa1111_setup_gpios()
617 sachip->gc.get_direction = sa1111_gpio_get_direction; in sa1111_setup_gpios()
618 sachip->gc.direction_input = sa1111_gpio_direction_input; in sa1111_setup_gpios()
619 sachip->gc.direction_output = sa1111_gpio_direction_output; in sa1111_setup_gpios()
620 sachip->gc.get = sa1111_gpio_get; in sa1111_setup_gpios()
621 sachip->gc.set = sa1111_gpio_set; in sa1111_setup_gpios()
622 sachip->gc.set_multiple = sa1111_gpio_set_multiple; in sa1111_setup_gpios()
623 sachip->gc.to_irq = sa1111_gpio_to_irq; in sa1111_setup_gpios()
624 sachip->gc.base = -1; in sa1111_setup_gpios()
625 sachip->gc.ngpio = 18; in sa1111_setup_gpios()
627 return devm_gpiochip_add_data(sachip->dev, &sachip->gc, sachip); in sa1111_setup_gpios()
644 static void sa1111_wake(struct sa1111 *sachip) in sa1111_wake() argument
648 spin_lock_irqsave(&sachip->lock, flags); in sa1111_wake()
650 clk_enable(sachip->clk); in sa1111_wake()
655 r = readl_relaxed(sachip->base + SA1111_SKCR); in sa1111_wake()
657 writel_relaxed(r, sachip->base + SA1111_SKCR); in sa1111_wake()
659 writel_relaxed(r, sachip->base + SA1111_SKCR); in sa1111_wake()
671 writel_relaxed(r, sachip->base + SA1111_SKCR); in sa1111_wake()
682 writel_relaxed(0, sachip->base + SA1111_SKPCR); in sa1111_wake()
684 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_wake()
704 sa1111_configure_smc(struct sa1111 *sachip, int sdram, unsigned int drac, in sa1111_configure_smc() argument
712 writel_relaxed(smcr, sachip->base + SA1111_SMCR); in sa1111_configure_smc()
719 if (sachip->dev->dma_mask) in sa1111_configure_smc()
720 *sachip->dev->dma_mask &= sa1111_dma_mask[drac >> 2]; in sa1111_configure_smc()
722 sachip->dev->coherent_dma_mask &= sa1111_dma_mask[drac >> 2]; in sa1111_configure_smc()
734 sa1111_init_one_child(struct sa1111 *sachip, struct resource *parent, in sa1111_init_one_child() argument
750 dev->dev.parent = sachip->dev; in sa1111_init_one_child()
753 dev->res.start = sachip->phys + info->offset; in sa1111_init_one_child()
757 dev->mapbase = sachip->base + info->offset; in sa1111_init_one_child()
767 if (info->dma && sachip->dev->dma_mask) { in sa1111_init_one_child()
768 dev->dma_mask = *sachip->dev->dma_mask; in sa1111_init_one_child()
770 dev->dev.coherent_dma_mask = sachip->dev->coherent_dma_mask; in sa1111_init_one_child()
775 dev_err(sachip->dev, "failed to allocate resource for %s\n", in sa1111_init_one_child()
809 struct sa1111 *sachip; in __sa1111_probe() local
817 sachip = devm_kzalloc(me, sizeof(struct sa1111), GFP_KERNEL); in __sa1111_probe()
818 if (!sachip) in __sa1111_probe()
821 sachip->clk = devm_clk_get(me, "SA1111_CLK"); in __sa1111_probe()
822 if (IS_ERR(sachip->clk)) in __sa1111_probe()
823 return PTR_ERR(sachip->clk); in __sa1111_probe()
825 ret = clk_prepare(sachip->clk); in __sa1111_probe()
829 spin_lock_init(&sachip->lock); in __sa1111_probe()
831 sachip->dev = me; in __sa1111_probe()
832 dev_set_drvdata(sachip->dev, sachip); in __sa1111_probe()
834 sachip->pdata = pd; in __sa1111_probe()
835 sachip->phys = mem->start; in __sa1111_probe()
836 sachip->irq = irq; in __sa1111_probe()
842 sachip->base = ioremap(mem->start, PAGE_SIZE * 2); in __sa1111_probe()
843 if (!sachip->base) { in __sa1111_probe()
851 id = readl_relaxed(sachip->base + SA1111_SKID); in __sa1111_probe()
864 sa1111_wake(sachip); in __sa1111_probe()
870 ret = sa1111_setup_irq(sachip, pd->irq_base); in __sa1111_probe()
875 ret = sa1111_setup_gpios(sachip); in __sa1111_probe()
890 sa1111_configure_smc(sachip, 1, in __sa1111_probe()
899 val = readl_relaxed(sachip->base + SA1111_SKPCR); in __sa1111_probe()
900 writel_relaxed(val | SKPCR_DCLKEN, sachip->base + SA1111_SKPCR); in __sa1111_probe()
909 g_sa1111 = sachip; in __sa1111_probe()
917 sa1111_init_one_child(sachip, mem, &sa1111_devices[i]); in __sa1111_probe()
922 sa1111_remove_irq(sachip); in __sa1111_probe()
924 clk_disable(sachip->clk); in __sa1111_probe()
926 iounmap(sachip->base); in __sa1111_probe()
928 clk_unprepare(sachip->clk); in __sa1111_probe()
943 static void __sa1111_remove(struct sa1111 *sachip) in __sa1111_remove() argument
945 device_for_each_child(sachip->dev, NULL, sa1111_remove_one); in __sa1111_remove()
947 sa1111_remove_irq(sachip); in __sa1111_remove()
949 clk_disable(sachip->clk); in __sa1111_remove()
950 clk_unprepare(sachip->clk); in __sa1111_remove()
952 iounmap(sachip->base); in __sa1111_remove()
980 struct sa1111 *sachip = dev_get_drvdata(dev); in sa1111_suspend_noirq() local
989 sachip->saved_state = save; in sa1111_suspend_noirq()
991 spin_lock_irqsave(&sachip->lock, flags); in sa1111_suspend_noirq()
996 base = sachip->base; in sa1111_suspend_noirq()
1004 writel_relaxed(0, sachip->base + SA1111_SKPWM0); in sa1111_suspend_noirq()
1005 writel_relaxed(0, sachip->base + SA1111_SKPWM1); in sa1111_suspend_noirq()
1007 base = sachip->base + SA1111_INTC; in sa1111_suspend_noirq()
1020 val = readl_relaxed(sachip->base + SA1111_SKCR); in sa1111_suspend_noirq()
1021 writel_relaxed(val | SKCR_SLEEP, sachip->base + SA1111_SKCR); in sa1111_suspend_noirq()
1023 clk_disable(sachip->clk); in sa1111_suspend_noirq()
1025 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_suspend_noirq()
1045 struct sa1111 *sachip = dev_get_drvdata(dev); in sa1111_resume_noirq() local
1050 save = sachip->saved_state; in sa1111_resume_noirq()
1058 id = readl_relaxed(sachip->base + SA1111_SKID); in sa1111_resume_noirq()
1060 __sa1111_remove(sachip); in sa1111_resume_noirq()
1069 sa1111_wake(sachip); in sa1111_resume_noirq()
1080 spin_lock_irqsave(&sachip->lock, flags); in sa1111_resume_noirq()
1082 writel_relaxed(0, sachip->base + SA1111_INTC + SA1111_INTEN0); in sa1111_resume_noirq()
1083 writel_relaxed(0, sachip->base + SA1111_INTC + SA1111_INTEN1); in sa1111_resume_noirq()
1085 base = sachip->base; in sa1111_resume_noirq()
1093 base = sachip->base + SA1111_INTC; in sa1111_resume_noirq()
1103 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_resume_noirq()
1105 sachip->saved_state = NULL; in sa1111_resume_noirq()
1133 struct sa1111 *sachip = platform_get_drvdata(pdev); in sa1111_remove() local
1135 if (sachip) { in sa1111_remove()
1137 kfree(sachip->saved_state); in sa1111_remove()
1138 sachip->saved_state = NULL; in sa1111_remove()
1140 __sa1111_remove(sachip); in sa1111_remove()
1184 static unsigned int __sa1111_pll_clock(struct sa1111 *sachip) in __sa1111_pll_clock() argument
1188 skcdr = readl_relaxed(sachip->base + SA1111_SKCDR); in __sa1111_pll_clock()
1208 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_pll_clock() local
1210 return __sa1111_pll_clock(sachip); in sa1111_pll_clock()
1224 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_select_audio_mode() local
1228 spin_lock_irqsave(&sachip->lock, flags); in sa1111_select_audio_mode()
1230 val = readl_relaxed(sachip->base + SA1111_SKCR); in sa1111_select_audio_mode()
1236 writel_relaxed(val, sachip->base + SA1111_SKCR); in sa1111_select_audio_mode()
1238 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_select_audio_mode()
1249 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_set_audio_rate() local
1255 div = (__sa1111_pll_clock(sachip) / 256 + rate / 2) / rate; in sa1111_set_audio_rate()
1261 writel_relaxed(div - 1, sachip->base + SA1111_SKAUD); in sa1111_set_audio_rate()
1273 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_get_audio_rate() local
1279 div = readl_relaxed(sachip->base + SA1111_SKAUD) + 1; in sa1111_get_audio_rate()
1281 return __sa1111_pll_clock(sachip) / (256 * div); in sa1111_get_audio_rate()
1295 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_enable_device() local
1300 if (sachip->pdata && sachip->pdata->enable) in sa1111_enable_device()
1301 ret = sachip->pdata->enable(sachip->pdata->data, sadev->devid); in sa1111_enable_device()
1304 spin_lock_irqsave(&sachip->lock, flags); in sa1111_enable_device()
1305 val = readl_relaxed(sachip->base + SA1111_SKPCR); in sa1111_enable_device()
1306 writel_relaxed(val | sadev->skpcr_mask, sachip->base + SA1111_SKPCR); in sa1111_enable_device()
1307 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_enable_device()
1319 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_disable_device() local
1323 spin_lock_irqsave(&sachip->lock, flags); in sa1111_disable_device()
1324 val = readl_relaxed(sachip->base + SA1111_SKPCR); in sa1111_disable_device()
1325 writel_relaxed(val & ~sadev->skpcr_mask, sachip->base + SA1111_SKPCR); in sa1111_disable_device()
1326 spin_unlock_irqrestore(&sachip->lock, flags); in sa1111_disable_device()
1328 if (sachip->pdata && sachip->pdata->disable) in sa1111_disable_device()
1329 sachip->pdata->disable(sachip->pdata->data, sadev->devid); in sa1111_disable_device()
1335 struct sa1111 *sachip = sa1111_chip_driver(sadev); in sa1111_get_irq() local
1338 return sa1111_map_irq(sachip, sadev->hwirq[num]); in sa1111_get_irq()