Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM 32-bit SoC platform updates from Olof Johansson:
"Most of the SoC updates in this cycle are cleanups and moves to more
modern infrastructure:

- Davinci was moved to common clock framework

- OMAP1-based Amstrad E3 "Superphone" saw a bunch of cleanups to the
keyboard interface (bitbanged AT keyboard via GPIO).

- Removal of some stale code for Renesas platforms

- Power management improvements for i.MX6LL"

* tag 'armsoc-soc' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (112 commits)
ARM: uniphier: select RESET_CONTROLLER
arm64: uniphier: select RESET_CONTROLLER
ARM: uniphier: remove empty Makefile
ARM: exynos: Clear global variable on init error path
ARM: exynos: Remove outdated maintainer information
ARM: shmobile: Always enable ARCH_TIMER on SoCs with A7 and/or A15
ARM: shmobile: r8a7779: hide unused r8a7779_platform_cpu_kill
soc: r9a06g032: don't build SMP files for non-SMP config
ARM: shmobile: Add the R9A06G032 SMP enabler driver
ARM: at91: pm: configure wakeup sources for ULP1 mode
ARM: at91: pm: add PMC fast startup registers defines
ARM: at91: pm: Add ULP1 mode support
ARM: at91: pm: Use ULP0 naming instead of slow clock
ARM: hisi: handle of_iomap and fix missing of_node_put
ARM: hisi: check of_iomap and fix missing of_node_put
ARM: hisi: fix error handling and missing of_node_put
ARM: mx5: Set the DBGEN bit in ARM_GPC register
ARM: imx51: Configure M4IF to avoid visual artifacts
ARM: imx: call imx6sx_cpuidle_init() conditionally for 6sll
ARM: imx: fix i.MX6SLL build
...

+2446 -5321
+11 -5
MAINTAINERS
··· 1295 1295 F: arch/arm/boot/dts/aspeed-* 1296 1296 N: aspeed 1297 1297 1298 - ARM/ATMEL AT91 Clock Support 1299 - M: Boris Brezillon <boris.brezillon@bootlin.com> 1300 - S: Maintained 1301 - F: drivers/clk/at91 1302 - 1303 1298 ARM/CALXEDA HIGHBANK ARCHITECTURE 1304 1299 M: Rob Herring <robh@kernel.org> 1305 1300 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) ··· 1475 1480 T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git 1476 1481 F: arch/arm/mach-imx/*vf610* 1477 1482 F: arch/arm/boot/dts/vf* 1483 + 1484 + ARM/FREESCALE LAYERSCAPE ARM ARCHITECTURE 1485 + M: Shawn Guo <shawnguo@kernel.org> 1486 + M: Li Yang <leoyang.li@nxp.com> 1487 + L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1488 + S: Maintained 1489 + T: git git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git 1490 + F: arch/arm/boot/dts/ls1021a* 1491 + F: arch/arm64/boot/dts/freescale/fsl-* 1492 + F: arch/arm64/boot/dts/freescale/qoriq-* 1478 1493 1479 1494 ARM/GLOMATION GESBC9312SX MACHINE SUPPORT 1480 1495 M: Lennert Buytenhek <kernel@wantstofly.org> ··· 10576 10571 F: arch/arm/configs/omap1_defconfig 10577 10572 F: drivers/i2c/busses/i2c-omap.c 10578 10573 F: include/linux/platform_data/i2c-omap.h 10574 + F: include/linux/platform_data/ams-delta-fiq.h 10579 10575 10580 10576 OMAP2+ SUPPORT 10581 10577 M: Tony Lindgren <tony@atomide.com>
+4 -1
arch/arm/Kconfig
··· 603 603 config ARCH_DAVINCI 604 604 bool "TI DaVinci" 605 605 select ARCH_HAS_HOLES_MEMORYMODEL 606 - select CLKDEV_LOOKUP 606 + select COMMON_CLK 607 607 select CPU_ARM926T 608 608 select GENERIC_ALLOCATOR 609 609 select GENERIC_CLOCKEVENTS 610 610 select GENERIC_IRQ_CHIP 611 611 select GPIOLIB 612 612 select HAVE_IDE 613 + select PM_GENERIC_DOMAINS if PM 614 + select PM_GENERIC_DOMAINS_OF if PM && OF 615 + select RESET_CONTROLLER 613 616 select USE_OF 614 617 select ZONE_DMA 615 618 help
+12 -2
arch/arm/Kconfig.debug
··· 204 204 depends on ARCH_BCM_HR2 205 205 select DEBUG_UART_8250 206 206 207 + config DEBUG_BCM_IPROC_UART3 208 + bool "Kernel low-level debugging on BCM IPROC UART3" 209 + depends on ARCH_BCM_CYGNUS 210 + select DEBUG_UART_8250 211 + help 212 + Say Y here if you want the debug print routines to direct 213 + their output to the third serial port on these devices. 214 + 207 215 config DEBUG_BCM_KONA_UART 208 216 bool "Kernel low-level debugging messages via BCM KONA UART" 209 217 depends on ARCH_BCM_MOBILE ··· 1570 1562 default 0x18000400 if DEBUG_BCM_HR2 1571 1563 default 0x18010000 if DEBUG_SIRFATLAS7_UART0 1572 1564 default 0x18020000 if DEBUG_SIRFATLAS7_UART1 1565 + default 0x18023000 if DEBUG_BCM_IPROC_UART3 1573 1566 default 0x1c090000 if DEBUG_VEXPRESS_UART0_RS1 1574 1567 default 0x20001000 if DEBUG_HIP01_UART 1575 1568 default 0x20060000 if DEBUG_RK29_UART0 1576 1569 default 0x20064000 if DEBUG_RK29_UART1 || DEBUG_RK3X_UART2 1577 1570 default 0x20068000 if DEBUG_RK29_UART2 || DEBUG_RK3X_UART3 1578 1571 default 0x20201000 if DEBUG_BCM2835 1579 - default 0x3f201000 if DEBUG_BCM2836 1580 1572 default 0x3e000000 if DEBUG_BCM_KONA_UART 1573 + default 0x3f201000 if DEBUG_BCM2836 1581 1574 default 0x4000e400 if DEBUG_LL_UART_EFM32 1582 1575 default 0x40028000 if DEBUG_AT91_SAMV7_USART1 1583 1576 default 0x40081000 if DEBUG_LPC18XX_UART0 ··· 1691 1682 default 0xf1002000 if DEBUG_MT8127_UART0 1692 1683 default 0xf1006000 if DEBUG_MT6589_UART0 1693 1684 default 0xf1009000 if DEBUG_MT8135_UART3 1685 + default 0xf1023000 if DEBUG_BCM_IPROC_UART3 1694 1686 default 0xf11f1000 if DEBUG_VERSATILE 1695 1687 default 0xf1600000 if DEBUG_INTEGRATOR 1696 1688 default 0xf1c28000 if DEBUG_SUNXI_UART0 ··· 1807 1797 DEBUG_KEYSTONE_UART0 || DEBUG_KEYSTONE_UART1 || \ 1808 1798 DEBUG_ALPINE_UART0 || \ 1809 1799 DEBUG_DAVINCI_DMx_UART0 || DEBUG_DAVINCI_DA8XX_UART1 || \ 1810 - DEBUG_DAVINCI_DA8XX_UART2 || \ 1800 + DEBUG_DAVINCI_DA8XX_UART2 || DEBUG_BCM_IPROC_UART3 || \ 1811 1801 DEBUG_BCM_KONA_UART || DEBUG_RK32_UART2 1812 1802 1813 1803 config DEBUG_UART_8250_PALMCHIP
-1
arch/arm/Makefile
··· 219 219 machine-$(CONFIG_ARCH_TEGRA) += tegra 220 220 machine-$(CONFIG_ARCH_U300) += u300 221 221 machine-$(CONFIG_ARCH_U8500) += ux500 222 - machine-$(CONFIG_ARCH_UNIPHIER) += uniphier 223 222 machine-$(CONFIG_ARCH_VERSATILE) += versatile 224 223 machine-$(CONFIG_ARCH_VEXPRESS) += vexpress 225 224 machine-$(CONFIG_ARCH_VT8500) += vt8500
+9 -5
arch/arm/firmware/trusted_foundations.c
··· 31 31 32 32 static unsigned long cpu_boot_addr; 33 33 34 - static void __naked tf_generic_smc(u32 type, u32 arg1, u32 arg2) 34 + static void tf_generic_smc(u32 type, u32 arg1, u32 arg2) 35 35 { 36 + register u32 r0 asm("r0") = type; 37 + register u32 r1 asm("r1") = arg1; 38 + register u32 r2 asm("r2") = arg2; 39 + 36 40 asm volatile( 37 41 ".arch_extension sec\n\t" 38 - "stmfd sp!, {r4 - r11, lr}\n\t" 42 + "stmfd sp!, {r4 - r11}\n\t" 39 43 __asmeq("%0", "r0") 40 44 __asmeq("%1", "r1") 41 45 __asmeq("%2", "r2") 42 46 "mov r3, #0\n\t" 43 47 "mov r4, #0\n\t" 44 48 "smc #0\n\t" 45 - "ldmfd sp!, {r4 - r11, pc}" 49 + "ldmfd sp!, {r4 - r11}\n\t" 46 50 : 47 - : "r" (type), "r" (arg1), "r" (arg2) 48 - : "memory"); 51 + : "r" (r0), "r" (r1), "r" (r2) 52 + : "memory", "r3", "r12", "lr"); 49 53 } 50 54 51 55 static int tf_set_cpu_boot_addr(int cpu, unsigned long boot_addr)
+1 -4
arch/arm/include/debug/renesas-scif.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 2 3 * Renesas SCIF(A) debugging macro include header 3 4 * ··· 6 5 * 7 6 * Copyright (C) 2012-2013 Renesas Electronics Corporation 8 7 * Copyright (C) 1994-1999 Russell King 9 - * 10 - * This program is free software; you can redistribute it and/or modify 11 - * it under the terms of the GNU General Public License version 2 as 12 - * published by the Free Software Foundation. 13 8 */ 14 9 15 10 #define SCIF_PHYS CONFIG_DEBUG_UART_PHYS
+156 -31
arch/arm/mach-at91/pm.c
··· 40 40 #endif 41 41 42 42 static const match_table_t pm_modes __initconst = { 43 - { 0, "standby" }, 44 - { AT91_PM_SLOW_CLOCK, "ulp0" }, 43 + { AT91_PM_STANDBY, "standby" }, 44 + { AT91_PM_ULP0, "ulp0" }, 45 + { AT91_PM_ULP1, "ulp1" }, 45 46 { AT91_PM_BACKUP, "backup" }, 46 47 { -1, NULL }, 47 48 }; 48 49 49 50 static struct at91_pm_data pm_data = { 50 - .standby_mode = 0, 51 - .suspend_mode = AT91_PM_SLOW_CLOCK, 51 + .standby_mode = AT91_PM_STANDBY, 52 + .suspend_mode = AT91_PM_ULP0, 52 53 }; 53 54 54 55 #define at91_ramc_read(id, field) \ ··· 80 79 phys_addr_t resume; 81 80 } *pm_bu; 82 81 82 + struct wakeup_source_info { 83 + unsigned int pmc_fsmr_bit; 84 + unsigned int shdwc_mr_bit; 85 + bool set_polarity; 86 + }; 87 + 88 + static const struct wakeup_source_info ws_info[] = { 89 + { .pmc_fsmr_bit = AT91_PMC_FSTT(10), .set_polarity = true }, 90 + { .pmc_fsmr_bit = AT91_PMC_RTCAL, .shdwc_mr_bit = BIT(17) }, 91 + { .pmc_fsmr_bit = AT91_PMC_USBAL }, 92 + { .pmc_fsmr_bit = AT91_PMC_SDMMC_CD }, 93 + }; 94 + 95 + static const struct of_device_id sama5d2_ws_ids[] = { 96 + { .compatible = "atmel,sama5d2-gem", .data = &ws_info[0] }, 97 + { .compatible = "atmel,at91rm9200-rtc", .data = &ws_info[1] }, 98 + { .compatible = "atmel,sama5d3-udc", .data = &ws_info[2] }, 99 + { .compatible = "atmel,at91rm9200-ohci", .data = &ws_info[2] }, 100 + { .compatible = "usb-ohci", .data = &ws_info[2] }, 101 + { .compatible = "atmel,at91sam9g45-ehci", .data = &ws_info[2] }, 102 + { .compatible = "usb-ehci", .data = &ws_info[2] }, 103 + { .compatible = "atmel,sama5d2-sdhci", .data = &ws_info[3] }, 104 + { /* sentinel */ } 105 + }; 106 + 107 + static int at91_pm_config_ws(unsigned int pm_mode, bool set) 108 + { 109 + const struct wakeup_source_info *wsi; 110 + const struct of_device_id *match; 111 + struct platform_device *pdev; 112 + struct device_node *np; 113 + unsigned int mode = 0, polarity = 0, val = 0; 114 + 115 + if (pm_mode != AT91_PM_ULP1) 116 + return 0; 117 + 118 + if (!pm_data.pmc || !pm_data.shdwc) 119 + return -EPERM; 120 + 121 + if (!set) { 122 + writel(mode, pm_data.pmc + AT91_PMC_FSMR); 123 + return 0; 124 + } 125 + 126 + /* SHDWC.WUIR */ 127 + val = readl(pm_data.shdwc + 0x0c); 128 + mode |= (val & 0x3ff); 129 + polarity |= ((val >> 16) & 0x3ff); 130 + 131 + /* SHDWC.MR */ 132 + val = readl(pm_data.shdwc + 0x04); 133 + 134 + /* Loop through defined wakeup sources. */ 135 + for_each_matching_node_and_match(np, sama5d2_ws_ids, &match) { 136 + pdev = of_find_device_by_node(np); 137 + if (!pdev) 138 + continue; 139 + 140 + if (device_may_wakeup(&pdev->dev)) { 141 + wsi = match->data; 142 + 143 + /* Check if enabled on SHDWC. */ 144 + if (wsi->shdwc_mr_bit && !(val & wsi->shdwc_mr_bit)) 145 + goto put_node; 146 + 147 + mode |= wsi->pmc_fsmr_bit; 148 + if (wsi->set_polarity) 149 + polarity |= wsi->pmc_fsmr_bit; 150 + } 151 + 152 + put_node: 153 + of_node_put(np); 154 + } 155 + 156 + if (mode) { 157 + writel(mode, pm_data.pmc + AT91_PMC_FSMR); 158 + writel(polarity, pm_data.pmc + AT91_PMC_FSPR); 159 + } else { 160 + pr_err("AT91: PM: no ULP1 wakeup sources found!"); 161 + } 162 + 163 + return mode ? 0 : -EPERM; 164 + } 165 + 83 166 /* 84 167 * Called after processes are frozen, but before we shutdown devices. 85 168 */ ··· 182 97 pm_data.mode = -1; 183 98 } 184 99 185 - return 0; 100 + return at91_pm_config_ws(pm_data.mode, true); 186 101 } 187 102 188 103 /* ··· 230 145 */ 231 146 int at91_suspend_entering_slow_clock(void) 232 147 { 233 - return (pm_data.mode >= AT91_PM_SLOW_CLOCK); 148 + return (pm_data.mode >= AT91_PM_ULP0); 234 149 } 235 150 EXPORT_SYMBOL(at91_suspend_entering_slow_clock); 236 151 ··· 271 186 * event sources; and reduces DRAM power. But otherwise it's identical to 272 187 * PM_SUSPEND_ON: cpu idle, and nothing fancy done with main or cpu clocks. 273 188 * 274 - * AT91_PM_SLOW_CLOCK is like STANDBY plus slow clock mode, so drivers must 189 + * AT91_PM_ULP0 is like STANDBY plus slow clock mode, so drivers must 275 190 * suspend more deeply, the master clock switches to the clk32k and turns off 276 191 * the main oscillator 277 192 * ··· 289 204 /* 290 205 * Ensure that clocks are in a valid state. 291 206 */ 292 - if ((pm_data.mode >= AT91_PM_SLOW_CLOCK) && 207 + if (pm_data.mode >= AT91_PM_ULP0 && 293 208 !at91_pm_verify_clocks()) 294 209 goto error; 295 210 ··· 318 233 */ 319 234 static void at91_pm_end(void) 320 235 { 236 + at91_pm_config_ws(pm_data.mode, false); 321 237 } 322 238 323 239 ··· 564 478 &at91_pm_suspend_in_sram, at91_pm_suspend_in_sram_sz); 565 479 } 566 480 567 - static void __init at91_pm_backup_init(void) 481 + static bool __init at91_is_pm_mode_active(int pm_mode) 482 + { 483 + return (pm_data.standby_mode == pm_mode || 484 + pm_data.suspend_mode == pm_mode); 485 + } 486 + 487 + static int __init at91_pm_backup_init(void) 568 488 { 569 489 struct gen_pool *sram_pool; 570 490 struct device_node *np; 571 491 struct platform_device *pdev = NULL; 492 + int ret = -ENODEV; 572 493 573 - if ((pm_data.standby_mode != AT91_PM_BACKUP) && 574 - (pm_data.suspend_mode != AT91_PM_BACKUP)) 575 - return; 494 + if (!at91_is_pm_mode_active(AT91_PM_BACKUP)) 495 + return 0; 576 496 577 497 pm_bu = NULL; 578 - 579 - np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-shdwc"); 580 - if (!np) { 581 - pr_warn("%s: failed to find shdwc!\n", __func__); 582 - return; 583 - } 584 - 585 - pm_data.shdwc = of_iomap(np, 0); 586 - of_node_put(np); 587 498 588 499 np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-sfrbu"); 589 500 if (!np) { 590 501 pr_warn("%s: failed to find sfrbu!\n", __func__); 591 - goto sfrbu_fail; 502 + return ret; 592 503 } 593 504 594 505 pm_data.sfrbu = of_iomap(np, 0); ··· 612 529 pm_bu = (void *)gen_pool_alloc(sram_pool, sizeof(struct at91_pm_bu)); 613 530 if (!pm_bu) { 614 531 pr_warn("%s: unable to alloc securam!\n", __func__); 532 + ret = -ENOMEM; 615 533 goto securam_fail; 616 534 } 617 535 ··· 620 536 pm_bu->canary = __pa_symbol(&canary); 621 537 pm_bu->resume = __pa_symbol(cpu_resume); 622 538 623 - return; 539 + return 0; 624 540 625 - sfrbu_fail: 626 - iounmap(pm_data.shdwc); 627 - pm_data.shdwc = NULL; 628 541 securam_fail: 629 542 iounmap(pm_data.sfrbu); 630 543 pm_data.sfrbu = NULL; 544 + return ret; 545 + } 631 546 632 - if (pm_data.standby_mode == AT91_PM_BACKUP) 633 - pm_data.standby_mode = AT91_PM_SLOW_CLOCK; 634 - if (pm_data.suspend_mode == AT91_PM_BACKUP) 635 - pm_data.suspend_mode = AT91_PM_SLOW_CLOCK; 547 + static void __init at91_pm_use_default_mode(int pm_mode) 548 + { 549 + if (pm_mode != AT91_PM_ULP1 && pm_mode != AT91_PM_BACKUP) 550 + return; 551 + 552 + if (pm_data.standby_mode == pm_mode) 553 + pm_data.standby_mode = AT91_PM_ULP0; 554 + if (pm_data.suspend_mode == pm_mode) 555 + pm_data.suspend_mode = AT91_PM_ULP0; 556 + } 557 + 558 + static void __init at91_pm_modes_init(void) 559 + { 560 + struct device_node *np; 561 + int ret; 562 + 563 + if (!at91_is_pm_mode_active(AT91_PM_BACKUP) && 564 + !at91_is_pm_mode_active(AT91_PM_ULP1)) 565 + return; 566 + 567 + np = of_find_compatible_node(NULL, NULL, "atmel,sama5d2-shdwc"); 568 + if (!np) { 569 + pr_warn("%s: failed to find shdwc!\n", __func__); 570 + goto ulp1_default; 571 + } 572 + 573 + pm_data.shdwc = of_iomap(np, 0); 574 + of_node_put(np); 575 + 576 + ret = at91_pm_backup_init(); 577 + if (ret) { 578 + if (!at91_is_pm_mode_active(AT91_PM_ULP1)) 579 + goto unmap; 580 + else 581 + goto backup_default; 582 + } 583 + 584 + return; 585 + 586 + unmap: 587 + iounmap(pm_data.shdwc); 588 + pm_data.shdwc = NULL; 589 + ulp1_default: 590 + at91_pm_use_default_mode(AT91_PM_ULP1); 591 + backup_default: 592 + at91_pm_use_default_mode(AT91_PM_BACKUP); 636 593 } 637 594 638 595 struct pmc_info { ··· 769 644 if (!IS_ENABLED(CONFIG_SOC_SAMA5D2)) 770 645 return; 771 646 772 - at91_pm_backup_init(); 647 + at91_pm_modes_init(); 773 648 sama5_pm_init(); 774 649 } 775 650
+4 -2
arch/arm/mach-at91/pm.h
··· 21 21 #define AT91_MEMCTRL_SDRAMC 1 22 22 #define AT91_MEMCTRL_DDRSDR 2 23 23 24 - #define AT91_PM_SLOW_CLOCK 0x01 25 - #define AT91_PM_BACKUP 0x02 24 + #define AT91_PM_STANDBY 0x00 25 + #define AT91_PM_ULP0 0x01 26 + #define AT91_PM_ULP1 0x02 27 + #define AT91_PM_BACKUP 0x03 26 28 27 29 #ifndef __ASSEMBLY__ 28 30 struct at91_pm_data {
+122 -20
arch/arm/mach-at91/pm_suspend.S
··· 42 42 .endm 43 43 44 44 /* 45 + * Wait for main oscillator selection is done 46 + */ 47 + .macro wait_moscsels 48 + 1: ldr tmp1, [pmc, #AT91_PMC_SR] 49 + tst tmp1, #AT91_PMC_MOSCSELS 50 + beq 1b 51 + .endm 52 + 53 + /* 45 54 * Wait until PLLA has locked. 46 55 */ 47 56 .macro wait_pllalock ··· 121 112 bl at91_sramc_self_refresh 122 113 123 114 ldr r0, .pm_mode 124 - cmp r0, #AT91_PM_SLOW_CLOCK 125 - beq slow_clock 115 + cmp r0, #AT91_PM_STANDBY 116 + beq standby 126 117 cmp r0, #AT91_PM_BACKUP 127 118 beq backup_mode 128 119 120 + bl at91_ulp_mode 121 + b exit_suspend 122 + 123 + standby: 129 124 /* Wait for interrupt */ 130 125 ldr pmc, .pmc_base 131 126 at91_cpu_idle 132 127 b exit_suspend 133 128 134 - slow_clock: 135 - bl at91_slowck_mode 136 - b exit_suspend 137 129 backup_mode: 138 130 bl at91_backup_mode 139 131 b exit_suspend ··· 161 151 str tmp1, [r0, #0] 162 152 ENDPROC(at91_backup_mode) 163 153 164 - ENTRY(at91_slowck_mode) 154 + .macro at91_pm_ulp0_mode 155 + ldr pmc, .pmc_base 156 + 157 + /* Turn off the crystal oscillator */ 158 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 159 + bic tmp1, tmp1, #AT91_PMC_MOSCEN 160 + orr tmp1, tmp1, #AT91_PMC_KEY 161 + str tmp1, [pmc, #AT91_CKGR_MOR] 162 + 163 + /* Wait for interrupt */ 164 + at91_cpu_idle 165 + 166 + /* Turn on the crystal oscillator */ 167 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 168 + orr tmp1, tmp1, #AT91_PMC_MOSCEN 169 + orr tmp1, tmp1, #AT91_PMC_KEY 170 + str tmp1, [pmc, #AT91_CKGR_MOR] 171 + 172 + wait_moscrdy 173 + .endm 174 + 175 + /** 176 + * Note: This procedure only applies on the platform which uses 177 + * the external crystal oscillator as a main clock source. 178 + */ 179 + .macro at91_pm_ulp1_mode 180 + ldr pmc, .pmc_base 181 + 182 + /* Switch the main clock source to 12-MHz RC oscillator */ 183 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 184 + bic tmp1, tmp1, #AT91_PMC_MOSCSEL 185 + bic tmp1, tmp1, #AT91_PMC_KEY_MASK 186 + orr tmp1, tmp1, #AT91_PMC_KEY 187 + str tmp1, [pmc, #AT91_CKGR_MOR] 188 + 189 + wait_moscsels 190 + 191 + /* Disable the crystal oscillator */ 192 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 193 + bic tmp1, tmp1, #AT91_PMC_MOSCEN 194 + bic tmp1, tmp1, #AT91_PMC_KEY_MASK 195 + orr tmp1, tmp1, #AT91_PMC_KEY 196 + str tmp1, [pmc, #AT91_CKGR_MOR] 197 + 198 + /* Switch the master clock source to main clock */ 199 + ldr tmp1, [pmc, #AT91_PMC_MCKR] 200 + bic tmp1, tmp1, #AT91_PMC_CSS 201 + orr tmp1, tmp1, #AT91_PMC_CSS_MAIN 202 + str tmp1, [pmc, #AT91_PMC_MCKR] 203 + 204 + wait_mckrdy 205 + 206 + /* Enter the ULP1 mode by set WAITMODE bit in CKGR_MOR */ 207 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 208 + orr tmp1, tmp1, #AT91_PMC_WAITMODE 209 + bic tmp1, tmp1, #AT91_PMC_KEY_MASK 210 + orr tmp1, tmp1, #AT91_PMC_KEY 211 + str tmp1, [pmc, #AT91_CKGR_MOR] 212 + 213 + wait_mckrdy 214 + 215 + /* Enable the crystal oscillator */ 216 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 217 + orr tmp1, tmp1, #AT91_PMC_MOSCEN 218 + bic tmp1, tmp1, #AT91_PMC_KEY_MASK 219 + orr tmp1, tmp1, #AT91_PMC_KEY 220 + str tmp1, [pmc, #AT91_CKGR_MOR] 221 + 222 + wait_moscrdy 223 + 224 + /* Switch the master clock source to slow clock */ 225 + ldr tmp1, [pmc, #AT91_PMC_MCKR] 226 + bic tmp1, tmp1, #AT91_PMC_CSS 227 + str tmp1, [pmc, #AT91_PMC_MCKR] 228 + 229 + wait_mckrdy 230 + 231 + /* Switch main clock source to crystal oscillator */ 232 + ldr tmp1, [pmc, #AT91_CKGR_MOR] 233 + orr tmp1, tmp1, #AT91_PMC_MOSCSEL 234 + bic tmp1, tmp1, #AT91_PMC_KEY_MASK 235 + orr tmp1, tmp1, #AT91_PMC_KEY 236 + str tmp1, [pmc, #AT91_CKGR_MOR] 237 + 238 + wait_moscsels 239 + 240 + /* Switch the master clock source to main clock */ 241 + ldr tmp1, [pmc, #AT91_PMC_MCKR] 242 + bic tmp1, tmp1, #AT91_PMC_CSS 243 + orr tmp1, tmp1, #AT91_PMC_CSS_MAIN 244 + str tmp1, [pmc, #AT91_PMC_MCKR] 245 + 246 + wait_mckrdy 247 + .endm 248 + 249 + ENTRY(at91_ulp_mode) 165 250 ldr pmc, .pmc_base 166 251 167 252 /* Save Master clock setting */ ··· 279 174 orr tmp1, tmp1, #(1 << 29) /* bit 29 always set */ 280 175 str tmp1, [pmc, #AT91_CKGR_PLLAR] 281 176 282 - /* Turn off the main oscillator */ 283 - ldr tmp1, [pmc, #AT91_CKGR_MOR] 284 - bic tmp1, tmp1, #AT91_PMC_MOSCEN 285 - orr tmp1, tmp1, #AT91_PMC_KEY 286 - str tmp1, [pmc, #AT91_CKGR_MOR] 177 + ldr r0, .pm_mode 178 + cmp r0, #AT91_PM_ULP1 179 + beq ulp1_mode 287 180 288 - /* Wait for interrupt */ 289 - at91_cpu_idle 181 + at91_pm_ulp0_mode 182 + b ulp_exit 290 183 291 - /* Turn on the main oscillator */ 292 - ldr tmp1, [pmc, #AT91_CKGR_MOR] 293 - orr tmp1, tmp1, #AT91_PMC_MOSCEN 294 - orr tmp1, tmp1, #AT91_PMC_KEY 295 - str tmp1, [pmc, #AT91_CKGR_MOR] 184 + ulp1_mode: 185 + at91_pm_ulp1_mode 186 + b ulp_exit 296 187 297 - wait_moscrdy 188 + ulp_exit: 189 + ldr pmc, .pmc_base 298 190 299 191 /* Restore PLLA setting */ 300 192 ldr tmp1, .saved_pllar ··· 314 212 wait_mckrdy 315 213 316 214 mov pc, lr 317 - ENDPROC(at91_slowck_mode) 215 + ENDPROC(at91_ulp_mode) 318 216 319 217 /* 320 218 * void at91_sramc_self_refresh(unsigned int is_active)
+1 -12
arch/arm/mach-davinci/Kconfig
··· 59 59 default y 60 60 depends on ARCH_DAVINCI_DA850 61 61 select PINCTRL 62 + select TIMER_OF 62 63 help 63 64 Say y here to include support for TI DaVinci DA850 based using 64 65 Flattened Device Tree. More information at Documentation/devicetree ··· 231 230 Choose Y here to warn whenever driver initialization logic needs 232 231 to change the pin multiplexing setup. When there are no warnings 233 232 printed, it's safe to deselect DAVINCI_MUX for your product. 234 - 235 - config DAVINCI_RESET_CLOCKS 236 - bool "Reset unused clocks during boot" 237 - depends on ARCH_DAVINCI 238 - help 239 - Say Y if you want to reset unused clocks during boot. 240 - This option saves power, but assumes all drivers are 241 - using the clock framework. Broken drivers that do not 242 - yet use clock framework may not work with this option. 243 - If you are booting from another operating system, you 244 - probably do not want this option enabled until your 245 - device drivers work properly. 246 233 247 234 endmenu 248 235
+2 -2
arch/arm/mach-davinci/Makefile
··· 5 5 # 6 6 7 7 # Common objects 8 - obj-y := time.o clock.o serial.o psc.o \ 9 - usb.o common.o sram.o aemif.o 8 + obj-y := time.o serial.o usb.o \ 9 + common.o sram.o 10 10 11 11 obj-$(CONFIG_DAVINCI_MUX) += mux.o 12 12
-218
arch/arm/mach-davinci/aemif.c
··· 1 - /* 2 - * AEMIF support for DaVinci SoCs 3 - * 4 - * Copyright (C) 2010 Texas Instruments Incorporated. http://www.ti.com/ 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 - */ 10 - 11 - #include <linux/kernel.h> 12 - #include <linux/io.h> 13 - #include <linux/err.h> 14 - #include <linux/clk.h> 15 - #include <linux/module.h> 16 - #include <linux/time.h> 17 - 18 - #include <linux/platform_data/mtd-davinci-aemif.h> 19 - #include <linux/platform_data/mtd-davinci.h> 20 - 21 - /* Timing value configuration */ 22 - 23 - #define TA(x) ((x) << 2) 24 - #define RHOLD(x) ((x) << 4) 25 - #define RSTROBE(x) ((x) << 7) 26 - #define RSETUP(x) ((x) << 13) 27 - #define WHOLD(x) ((x) << 17) 28 - #define WSTROBE(x) ((x) << 20) 29 - #define WSETUP(x) ((x) << 26) 30 - 31 - #define TA_MAX 0x3 32 - #define RHOLD_MAX 0x7 33 - #define RSTROBE_MAX 0x3f 34 - #define RSETUP_MAX 0xf 35 - #define WHOLD_MAX 0x7 36 - #define WSTROBE_MAX 0x3f 37 - #define WSETUP_MAX 0xf 38 - 39 - #define TIMING_MASK (TA(TA_MAX) | \ 40 - RHOLD(RHOLD_MAX) | \ 41 - RSTROBE(RSTROBE_MAX) | \ 42 - RSETUP(RSETUP_MAX) | \ 43 - WHOLD(WHOLD_MAX) | \ 44 - WSTROBE(WSTROBE_MAX) | \ 45 - WSETUP(WSETUP_MAX)) 46 - 47 - static inline unsigned int davinci_aemif_readl(void __iomem *base, int offset) 48 - { 49 - return readl_relaxed(base + offset); 50 - } 51 - 52 - static inline void davinci_aemif_writel(void __iomem *base, 53 - int offset, unsigned long value) 54 - { 55 - writel_relaxed(value, base + offset); 56 - } 57 - 58 - /* 59 - * aemif_calc_rate - calculate timing data. 60 - * @wanted: The cycle time needed in nanoseconds. 61 - * @clk: The input clock rate in kHz. 62 - * @max: The maximum divider value that can be programmed. 63 - * 64 - * On success, returns the calculated timing value minus 1 for easy 65 - * programming into AEMIF timing registers, else negative errno. 66 - */ 67 - static int aemif_calc_rate(int wanted, unsigned long clk, int max) 68 - { 69 - int result; 70 - 71 - result = DIV_ROUND_UP((wanted * clk), NSEC_PER_MSEC) - 1; 72 - 73 - pr_debug("%s: result %d from %ld, %d\n", __func__, result, clk, wanted); 74 - 75 - /* It is generally OK to have a more relaxed timing than requested... */ 76 - if (result < 0) 77 - result = 0; 78 - 79 - /* ... But configuring tighter timings is not an option. */ 80 - else if (result > max) 81 - result = -EINVAL; 82 - 83 - return result; 84 - } 85 - 86 - /** 87 - * davinci_aemif_setup_timing - setup timing values for a given AEMIF interface 88 - * @t: timing values to be progammed 89 - * @base: The virtual base address of the AEMIF interface 90 - * @cs: chip-select to program the timing values for 91 - * @clkrate: the AEMIF clkrate 92 - * 93 - * This function programs the given timing values (in real clock) into the 94 - * AEMIF registers taking the AEMIF clock into account. 95 - * 96 - * This function does not use any locking while programming the AEMIF 97 - * because it is expected that there is only one user of a given 98 - * chip-select. 99 - * 100 - * Returns 0 on success, else negative errno. 101 - */ 102 - static int davinci_aemif_setup_timing(struct davinci_aemif_timing *t, 103 - void __iomem *base, unsigned cs, 104 - unsigned long clkrate) 105 - { 106 - unsigned set, val; 107 - int ta, rhold, rstrobe, rsetup, whold, wstrobe, wsetup; 108 - unsigned offset = A1CR_OFFSET + cs * 4; 109 - 110 - if (!t) 111 - return 0; /* Nothing to do */ 112 - 113 - clkrate /= 1000; /* turn clock into kHz for ease of use */ 114 - 115 - ta = aemif_calc_rate(t->ta, clkrate, TA_MAX); 116 - rhold = aemif_calc_rate(t->rhold, clkrate, RHOLD_MAX); 117 - rstrobe = aemif_calc_rate(t->rstrobe, clkrate, RSTROBE_MAX); 118 - rsetup = aemif_calc_rate(t->rsetup, clkrate, RSETUP_MAX); 119 - whold = aemif_calc_rate(t->whold, clkrate, WHOLD_MAX); 120 - wstrobe = aemif_calc_rate(t->wstrobe, clkrate, WSTROBE_MAX); 121 - wsetup = aemif_calc_rate(t->wsetup, clkrate, WSETUP_MAX); 122 - 123 - if (ta < 0 || rhold < 0 || rstrobe < 0 || rsetup < 0 || 124 - whold < 0 || wstrobe < 0 || wsetup < 0) { 125 - pr_err("%s: cannot get suitable timings\n", __func__); 126 - return -EINVAL; 127 - } 128 - 129 - set = TA(ta) | RHOLD(rhold) | RSTROBE(rstrobe) | RSETUP(rsetup) | 130 - WHOLD(whold) | WSTROBE(wstrobe) | WSETUP(wsetup); 131 - 132 - val = __raw_readl(base + offset); 133 - val &= ~TIMING_MASK; 134 - val |= set; 135 - __raw_writel(val, base + offset); 136 - 137 - return 0; 138 - } 139 - 140 - /** 141 - * davinci_aemif_setup - setup AEMIF interface by davinci_nand_pdata 142 - * @pdev - link to platform device to setup settings for 143 - * 144 - * This function does not use any locking while programming the AEMIF 145 - * because it is expected that there is only one user of a given 146 - * chip-select. 147 - * 148 - * Returns 0 on success, else negative errno. 149 - */ 150 - int davinci_aemif_setup(struct platform_device *pdev) 151 - { 152 - struct davinci_nand_pdata *pdata = dev_get_platdata(&pdev->dev); 153 - uint32_t val; 154 - unsigned long clkrate; 155 - struct resource *res; 156 - void __iomem *base; 157 - struct clk *clk; 158 - int ret = 0; 159 - 160 - clk = clk_get(&pdev->dev, "aemif"); 161 - if (IS_ERR(clk)) { 162 - ret = PTR_ERR(clk); 163 - dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret); 164 - return ret; 165 - } 166 - 167 - ret = clk_prepare_enable(clk); 168 - if (ret < 0) { 169 - dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n", 170 - ret); 171 - goto err_put; 172 - } 173 - 174 - res = platform_get_resource(pdev, IORESOURCE_MEM, 1); 175 - if (!res) { 176 - dev_err(&pdev->dev, "cannot get IORESOURCE_MEM\n"); 177 - ret = -ENOMEM; 178 - goto err; 179 - } 180 - 181 - base = ioremap(res->start, resource_size(res)); 182 - if (!base) { 183 - dev_err(&pdev->dev, "ioremap failed for resource %pR\n", res); 184 - ret = -ENOMEM; 185 - goto err; 186 - } 187 - 188 - /* 189 - * Setup Async configuration register in case we did not boot 190 - * from NAND and so bootloader did not bother to set it up. 191 - */ 192 - val = davinci_aemif_readl(base, A1CR_OFFSET + pdata->core_chipsel * 4); 193 - /* 194 - * Extended Wait is not valid and Select Strobe mode is not 195 - * used 196 - */ 197 - val &= ~(ACR_ASIZE_MASK | ACR_EW_MASK | ACR_SS_MASK); 198 - if (pdata->options & NAND_BUSWIDTH_16) 199 - val |= 0x1; 200 - 201 - davinci_aemif_writel(base, A1CR_OFFSET + pdata->core_chipsel * 4, val); 202 - 203 - clkrate = clk_get_rate(clk); 204 - 205 - if (pdata->timing) 206 - ret = davinci_aemif_setup_timing(pdata->timing, base, 207 - pdata->core_chipsel, clkrate); 208 - 209 - if (ret < 0) 210 - dev_dbg(&pdev->dev, "NAND timing values setup fail\n"); 211 - 212 - iounmap(base); 213 - err: 214 - clk_disable_unprepare(clk); 215 - err_put: 216 - clk_put(clk); 217 - return ret; 218 - }
+48 -20
arch/arm/mach-davinci/board-da830-evm.c
··· 28 28 #include <linux/platform_data/mtd-davinci-aemif.h> 29 29 #include <linux/platform_data/spi-davinci.h> 30 30 #include <linux/platform_data/usb-davinci.h> 31 + #include <linux/platform_data/ti-aemif.h> 31 32 #include <linux/regulator/machine.h> 32 33 33 34 #include <asm/mach-types.h> ··· 111 110 { 112 111 int ret; 113 112 114 - /* USB_REFCLKIN is not used. */ 115 - ret = da8xx_register_usb20_phy_clk(false); 113 + ret = da8xx_register_usb_phy_clocks(); 116 114 if (ret) 117 - pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n", 118 - __func__, ret); 119 - 120 - ret = da8xx_register_usb11_phy_clk(false); 121 - if (ret) 122 - pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n", 115 + pr_warn("%s: USB PHY CLK registration failed: %d\n", 123 116 __func__, ret); 124 117 125 118 ret = da8xx_register_usb_phy(); ··· 334 339 }, 335 340 }; 336 341 337 - static struct platform_device da830_evm_nand_device = { 338 - .name = "davinci_nand", 339 - .id = 1, 340 - .dev = { 341 - .platform_data = &da830_evm_nand_pdata, 342 + static struct platform_device da830_evm_aemif_devices[] = { 343 + { 344 + .name = "davinci_nand", 345 + .id = 1, 346 + .dev = { 347 + .platform_data = &da830_evm_nand_pdata, 348 + }, 349 + .num_resources = ARRAY_SIZE(da830_evm_nand_resources), 350 + .resource = da830_evm_nand_resources, 342 351 }, 343 - .num_resources = ARRAY_SIZE(da830_evm_nand_resources), 344 - .resource = da830_evm_nand_resources, 352 + }; 353 + 354 + static struct resource da830_evm_aemif_resource[] = { 355 + { 356 + .start = DA8XX_AEMIF_CTL_BASE, 357 + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, 358 + .flags = IORESOURCE_MEM, 359 + }, 360 + }; 361 + 362 + static struct aemif_abus_data da830_evm_aemif_abus_data[] = { 363 + { 364 + .cs = 3, 365 + }, 366 + }; 367 + 368 + static struct aemif_platform_data da830_evm_aemif_pdata = { 369 + .abus_data = da830_evm_aemif_abus_data, 370 + .num_abus_data = ARRAY_SIZE(da830_evm_aemif_abus_data), 371 + .sub_devices = da830_evm_aemif_devices, 372 + .num_sub_devices = ARRAY_SIZE(da830_evm_aemif_devices), 373 + .cs_offset = 2, 374 + }; 375 + 376 + static struct platform_device da830_evm_aemif_device = { 377 + .name = "ti-aemif", 378 + .id = -1, 379 + .dev = { 380 + .platform_data = &da830_evm_aemif_pdata, 381 + }, 382 + .resource = da830_evm_aemif_resource, 383 + .num_resources = ARRAY_SIZE(da830_evm_aemif_resource), 345 384 }; 346 385 347 386 /* ··· 406 377 if (ret) 407 378 pr_warn("%s: emif25 mux setup failed: %d\n", __func__, ret); 408 379 409 - ret = platform_device_register(&da830_evm_nand_device); 380 + ret = platform_device_register(&da830_evm_aemif_device); 410 381 if (ret) 411 - pr_warn("%s: NAND device not registered\n", __func__); 412 - 413 - if (davinci_aemif_setup(&da830_evm_nand_device)) 414 - pr_warn("%s: Cannot configure AEMIF\n", __func__); 382 + pr_warn("%s: AEMIF device not registered\n", __func__); 415 383 416 384 gpio_direction_output(mux_mode, 1); 417 385 } ··· 582 556 { 583 557 struct davinci_soc_info *soc_info = &davinci_soc_info; 584 558 int ret; 559 + 560 + da830_register_clocks(); 585 561 586 562 ret = da830_register_gpio(); 587 563 if (ret)
+54 -43
arch/arm/mach-davinci/board-da850-evm.c
··· 33 33 #include <linux/platform_data/gpio-davinci.h> 34 34 #include <linux/platform_data/mtd-davinci.h> 35 35 #include <linux/platform_data/mtd-davinci-aemif.h> 36 + #include <linux/platform_data/ti-aemif.h> 36 37 #include <linux/platform_data/spi-davinci.h> 37 38 #include <linux/platform_data/uio_pruss.h> 38 39 #include <linux/regulator/machine.h> ··· 186 185 }, 187 186 }; 188 187 189 - static struct platform_device da850_evm_norflash_device = { 190 - .name = "physmap-flash", 191 - .id = 0, 192 - .dev = { 193 - .platform_data = &da850_evm_norflash_data, 194 - }, 195 - .num_resources = 1, 196 - .resource = da850_evm_norflash_resource, 197 - }; 198 - 199 188 /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash 200 189 * (128K blocks). It may be used instead of the (default) SPI flash 201 190 * to boot, using TI's tools to install the secondary boot loader ··· 257 266 }, 258 267 }; 259 268 260 - static struct platform_device da850_evm_nandflash_device = { 261 - .name = "davinci_nand", 262 - .id = 1, 263 - .dev = { 264 - .platform_data = &da850_evm_nandflash_data, 269 + static struct resource da850_evm_aemif_resource[] = { 270 + { 271 + .start = DA8XX_AEMIF_CTL_BASE, 272 + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, 273 + .flags = IORESOURCE_MEM, 274 + } 275 + }; 276 + 277 + static struct aemif_abus_data da850_evm_aemif_abus_data[] = { 278 + { 279 + .cs = 3, 280 + } 281 + }; 282 + 283 + static struct platform_device da850_evm_aemif_devices[] = { 284 + { 285 + .name = "davinci_nand", 286 + .id = 1, 287 + .dev = { 288 + .platform_data = &da850_evm_nandflash_data, 289 + }, 290 + .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), 291 + .resource = da850_evm_nandflash_resource, 265 292 }, 266 - .num_resources = ARRAY_SIZE(da850_evm_nandflash_resource), 267 - .resource = da850_evm_nandflash_resource, 293 + { 294 + .name = "physmap-flash", 295 + .id = 0, 296 + .dev = { 297 + .platform_data = &da850_evm_norflash_data, 298 + }, 299 + .num_resources = 1, 300 + .resource = da850_evm_norflash_resource, 301 + } 268 302 }; 269 303 270 - static struct platform_device *da850_evm_devices[] = { 271 - &da850_evm_nandflash_device, 272 - &da850_evm_norflash_device, 304 + static struct aemif_platform_data da850_evm_aemif_pdata = { 305 + .cs_offset = 2, 306 + .abus_data = da850_evm_aemif_abus_data, 307 + .num_abus_data = ARRAY_SIZE(da850_evm_aemif_abus_data), 308 + .sub_devices = da850_evm_aemif_devices, 309 + .num_sub_devices = ARRAY_SIZE(da850_evm_aemif_devices), 273 310 }; 274 311 275 - #define DA8XX_AEMIF_CE2CFG_OFFSET 0x10 276 - #define DA8XX_AEMIF_ASIZE_16BIT 0x1 277 - 278 - static void __init da850_evm_init_nor(void) 279 - { 280 - void __iomem *aemif_addr; 281 - 282 - aemif_addr = ioremap(DA8XX_AEMIF_CTL_BASE, SZ_32K); 283 - 284 - /* Configure data bus width of CS2 to 16 bit */ 285 - writel(readl(aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET) | 286 - DA8XX_AEMIF_ASIZE_16BIT, 287 - aemif_addr + DA8XX_AEMIF_CE2CFG_OFFSET); 288 - 289 - iounmap(aemif_addr); 290 - } 312 + static struct platform_device da850_evm_aemif_device = { 313 + .name = "ti-aemif", 314 + .id = -1, 315 + .dev = { 316 + .platform_data = &da850_evm_aemif_pdata, 317 + }, 318 + .resource = da850_evm_aemif_resource, 319 + .num_resources = ARRAY_SIZE(da850_evm_aemif_resource), 320 + }; 291 321 292 322 static const short da850_evm_nand_pins[] = { 293 323 DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, ··· 351 339 pr_warn("%s: NOR mux setup failed: %d\n", 352 340 __func__, ret); 353 341 354 - da850_evm_init_nor(); 355 - 356 - platform_add_devices(da850_evm_devices, 357 - ARRAY_SIZE(da850_evm_devices)); 358 - 359 - if (davinci_aemif_setup(&da850_evm_nandflash_device)) 360 - pr_warn("%s: Cannot configure AEMIF.\n", __func__); 342 + ret = platform_device_register(&da850_evm_aemif_device); 343 + if (ret) 344 + pr_warn("%s: registering aemif failed: %d\n", 345 + __func__, ret); 361 346 } 362 347 } 363 348 ··· 1348 1339 static __init void da850_evm_init(void) 1349 1340 { 1350 1341 int ret; 1342 + 1343 + da850_register_clocks(); 1351 1344 1352 1345 ret = da850_register_gpio(); 1353 1346 if (ret)
+2
arch/arm/mach-davinci/board-dm355-evm.c
··· 394 394 struct clk *aemif; 395 395 int ret; 396 396 397 + dm355_register_clocks(); 398 + 397 399 ret = dm355_gpio_register(); 398 400 if (ret) 399 401 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
+2
arch/arm/mach-davinci/board-dm355-leopard.c
··· 234 234 struct clk *aemif; 235 235 int ret; 236 236 237 + dm355_register_clocks(); 238 + 237 239 ret = dm355_gpio_register(); 238 240 if (ret) 239 241 pr_warn("%s: GPIO init failed: %d\n", __func__, ret);
+48 -13
arch/arm/mach-davinci/board-dm365-evm.c
··· 28 28 #include <linux/spi/spi.h> 29 29 #include <linux/spi/eeprom.h> 30 30 #include <linux/v4l2-dv-timings.h> 31 + #include <linux/platform_data/ti-aemif.h> 31 32 32 33 #include <asm/mach-types.h> 33 34 #include <asm/mach/arch.h> ··· 160 159 }, 161 160 }; 162 161 163 - static struct platform_device davinci_nand_device = { 164 - .name = "davinci_nand", 165 - .id = 0, 166 - .num_resources = ARRAY_SIZE(davinci_nand_resources), 167 - .resource = davinci_nand_resources, 168 - .dev = { 169 - .platform_data = &davinci_nand_data, 162 + static struct platform_device davinci_aemif_devices[] = { 163 + { 164 + .name = "davinci_nand", 165 + .id = 0, 166 + .num_resources = ARRAY_SIZE(davinci_nand_resources), 167 + .resource = davinci_nand_resources, 168 + .dev = { 169 + .platform_data = &davinci_nand_data, 170 + }, 171 + } 172 + }; 173 + 174 + static struct resource davinci_aemif_resources[] = { 175 + { 176 + .start = DM365_ASYNC_EMIF_CONTROL_BASE, 177 + .end = DM365_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, 178 + .flags = IORESOURCE_MEM, 170 179 }, 180 + }; 181 + 182 + static struct aemif_abus_data da850_evm_aemif_abus_data[] = { 183 + { 184 + .cs = 1, 185 + }, 186 + }; 187 + 188 + static struct aemif_platform_data davinci_aemif_pdata = { 189 + .abus_data = da850_evm_aemif_abus_data, 190 + .num_abus_data = ARRAY_SIZE(da850_evm_aemif_abus_data), 191 + .sub_devices = davinci_aemif_devices, 192 + .num_sub_devices = ARRAY_SIZE(davinci_aemif_devices), 193 + }; 194 + 195 + static struct platform_device davinci_aemif_device = { 196 + .name = "ti-aemif", 197 + .id = -1, 198 + .dev = { 199 + .platform_data = &davinci_aemif_pdata, 200 + }, 201 + .resource = davinci_aemif_resources, 202 + .num_resources = ARRAY_SIZE(davinci_aemif_resources), 171 203 }; 172 204 173 205 static struct at24_platform_data eeprom_info = { ··· 571 537 i2c_register_board_info(1, i2c_info, ARRAY_SIZE(i2c_info)); 572 538 } 573 539 574 - static struct platform_device *dm365_evm_nand_devices[] __initdata = { 575 - &davinci_nand_device, 576 - }; 577 - 578 540 static inline int have_leds(void) 579 541 { 580 542 #ifdef CONFIG_LEDS_CLASS ··· 658 628 u8 mux, resets; 659 629 const char *label; 660 630 struct clk *aemif_clk; 631 + int rc; 661 632 662 633 /* Make sure we can configure the CPLD through CS1. Then 663 634 * leave it on for later access to MMC and LED registers. ··· 691 660 /* external keypad mux */ 692 661 mux |= BIT(7); 693 662 694 - platform_add_devices(dm365_evm_nand_devices, 695 - ARRAY_SIZE(dm365_evm_nand_devices)); 663 + rc = platform_device_register(&davinci_aemif_device); 664 + if (rc) 665 + pr_warn("%s(): error registering the aemif device: %d\n", 666 + __func__, rc); 696 667 } else { 697 668 /* no OneNAND support yet */ 698 669 } ··· 774 741 static __init void dm365_evm_init(void) 775 742 { 776 743 int ret; 744 + 745 + dm365_register_clocks(); 777 746 778 747 ret = dm365_gpio_register(); 779 748 if (ret)
+44 -13
arch/arm/mach-davinci/board-dm644x-evm.c
··· 42 42 #include <linux/platform_data/mmc-davinci.h> 43 43 #include <linux/platform_data/usb-davinci.h> 44 44 #include <linux/platform_data/mtd-davinci-aemif.h> 45 + #include <linux/platform_data/ti-aemif.h> 45 46 46 47 #include "davinci.h" 47 48 ··· 175 174 }, 176 175 }; 177 176 178 - static struct platform_device davinci_evm_nandflash_device = { 179 - .name = "davinci_nand", 180 - .id = 0, 181 - .dev = { 182 - .platform_data = &davinci_evm_nandflash_data, 177 + static struct resource davinci_evm_aemif_resource[] = { 178 + { 179 + .start = DM644X_ASYNC_EMIF_CONTROL_BASE, 180 + .end = DM644X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, 181 + .flags = IORESOURCE_MEM, 183 182 }, 184 - .num_resources = ARRAY_SIZE(davinci_evm_nandflash_resource), 185 - .resource = davinci_evm_nandflash_resource, 183 + }; 184 + 185 + static struct aemif_abus_data davinci_evm_aemif_abus_data[] = { 186 + { 187 + .cs = 1, 188 + }, 189 + }; 190 + 191 + static struct platform_device davinci_evm_nandflash_devices[] = { 192 + { 193 + .name = "davinci_nand", 194 + .id = 0, 195 + .dev = { 196 + .platform_data = &davinci_evm_nandflash_data, 197 + }, 198 + .num_resources = ARRAY_SIZE(davinci_evm_nandflash_resource), 199 + .resource = davinci_evm_nandflash_resource, 200 + }, 201 + }; 202 + 203 + static struct aemif_platform_data davinci_evm_aemif_pdata = { 204 + .abus_data = davinci_evm_aemif_abus_data, 205 + .num_abus_data = ARRAY_SIZE(davinci_evm_aemif_abus_data), 206 + .sub_devices = davinci_evm_nandflash_devices, 207 + .num_sub_devices = ARRAY_SIZE(davinci_evm_nandflash_devices), 208 + }; 209 + 210 + static struct platform_device davinci_evm_aemif_device = { 211 + .name = "ti-aemif", 212 + .id = -1, 213 + .dev = { 214 + .platform_data = &davinci_evm_aemif_pdata, 215 + }, 216 + .resource = davinci_evm_aemif_resource, 217 + .num_resources = ARRAY_SIZE(davinci_evm_aemif_resource), 186 218 }; 187 219 188 220 static u64 davinci_fb_dma_mask = DMA_BIT_MASK(32); ··· 807 773 struct clk *aemif_clk; 808 774 struct davinci_soc_info *soc_info = &davinci_soc_info; 809 775 776 + dm644x_register_clocks(); 777 + 810 778 dm644x_init_devices(); 811 779 812 780 ret = dm644x_gpio_register(); ··· 829 793 830 794 /* only one device will be jumpered and detected */ 831 795 if (HAS_NAND) { 832 - platform_device_register(&davinci_evm_nandflash_device); 833 - 834 - if (davinci_aemif_setup(&davinci_evm_nandflash_device)) 835 - pr_warn("%s: Cannot configure AEMIF\n", 836 - __func__); 837 - 796 + platform_device_register(&davinci_evm_aemif_device); 838 797 #ifdef CONFIG_I2C 839 798 evm_leds[7].default_trigger = "nand-disk"; 840 799 #endif
+45 -13
arch/arm/mach-davinci/board-dm646x-evm.c
··· 24 24 #include <linux/i2c.h> 25 25 #include <linux/platform_data/at24.h> 26 26 #include <linux/platform_data/pcf857x.h> 27 + #include <linux/platform_data/ti-aemif.h> 27 28 28 29 #include <media/i2c/tvp514x.h> 29 30 #include <media/i2c/adv7343.h> ··· 107 106 }, 108 107 }; 109 108 110 - static struct platform_device davinci_nand_device = { 111 - .name = "davinci_nand", 112 - .id = 0, 113 - 114 - .num_resources = ARRAY_SIZE(davinci_nand_resources), 115 - .resource = davinci_nand_resources, 116 - 117 - .dev = { 118 - .platform_data = &davinci_nand_data, 109 + static struct platform_device davinci_aemif_devices[] = { 110 + { 111 + .name = "davinci_nand", 112 + .id = 0, 113 + .num_resources = ARRAY_SIZE(davinci_nand_resources), 114 + .resource = davinci_nand_resources, 115 + .dev = { 116 + .platform_data = &davinci_nand_data, 117 + }, 119 118 }, 119 + }; 120 + 121 + static struct resource davinci_aemif_resources[] = { 122 + { 123 + .start = DM646X_ASYNC_EMIF_CONTROL_BASE, 124 + .end = DM646X_ASYNC_EMIF_CONTROL_BASE + SZ_4K - 1, 125 + .flags = IORESOURCE_MEM, 126 + }, 127 + }; 128 + 129 + static struct aemif_abus_data davinci_aemif_abus_data[] = { 130 + { 131 + .cs = 1, 132 + }, 133 + }; 134 + 135 + static struct aemif_platform_data davinci_aemif_pdata = { 136 + .abus_data = davinci_aemif_abus_data, 137 + .num_abus_data = ARRAY_SIZE(davinci_aemif_abus_data), 138 + .sub_devices = davinci_aemif_devices, 139 + .num_sub_devices = ARRAY_SIZE(davinci_aemif_devices), 140 + }; 141 + 142 + static struct platform_device davinci_aemif_device = { 143 + .name = "ti-aemif", 144 + .id = -1, 145 + .dev = { 146 + .platform_data = &davinci_aemif_pdata, 147 + }, 148 + .resource = davinci_aemif_resources, 149 + .num_resources = ARRAY_SIZE(davinci_aemif_resources), 120 150 }; 121 151 122 152 #define HAS_ATA (IS_ENABLED(CONFIG_BLK_DEV_PALMCHIP_BK3710) || \ ··· 808 776 int ret; 809 777 struct davinci_soc_info *soc_info = &davinci_soc_info; 810 778 779 + dm646x_register_clocks(); 780 + 811 781 ret = dm646x_gpio_register(); 812 782 if (ret) 813 783 pr_warn("%s: GPIO init failed: %d\n", __func__, ret); ··· 825 791 if (machine_is_davinci_dm6467tevm()) 826 792 davinci_nand_data.timing = &dm6467tevm_nandflash_timing; 827 793 828 - platform_device_register(&davinci_nand_device); 829 - 830 - if (davinci_aemif_setup(&davinci_nand_device)) 831 - pr_warn("%s: Cannot configure AEMIF.\n", __func__); 794 + if (platform_device_register(&davinci_aemif_device)) 795 + pr_warn("%s: Cannot register AEMIF device.\n", __func__); 832 796 833 797 dm646x_init_edma(dm646x_edma_rsv); 834 798
+43 -14
arch/arm/mach-davinci/board-mityomapl138.c
··· 30 30 #include <mach/da8xx.h> 31 31 #include <linux/platform_data/mtd-davinci.h> 32 32 #include <linux/platform_data/mtd-davinci-aemif.h> 33 + #include <linux/platform_data/ti-aemif.h> 33 34 #include <mach/mux.h> 34 35 #include <linux/platform_data/spi-davinci.h> 35 36 ··· 423 422 }, 424 423 }; 425 424 426 - static struct platform_device mityomapl138_nandflash_device = { 427 - .name = "davinci_nand", 428 - .id = 1, 429 - .dev = { 430 - .platform_data = &mityomapl138_nandflash_data, 425 + static struct platform_device mityomapl138_aemif_devices[] = { 426 + { 427 + .name = "davinci_nand", 428 + .id = 1, 429 + .dev = { 430 + .platform_data = &mityomapl138_nandflash_data, 431 + }, 432 + .num_resources = ARRAY_SIZE(mityomapl138_nandflash_resource), 433 + .resource = mityomapl138_nandflash_resource, 431 434 }, 432 - .num_resources = ARRAY_SIZE(mityomapl138_nandflash_resource), 433 - .resource = mityomapl138_nandflash_resource, 434 435 }; 435 436 436 - static struct platform_device *mityomapl138_devices[] __initdata = { 437 - &mityomapl138_nandflash_device, 437 + static struct resource mityomapl138_aemif_resources[] = { 438 + { 439 + .start = DA8XX_AEMIF_CTL_BASE, 440 + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K - 1, 441 + .flags = IORESOURCE_MEM, 442 + }, 443 + }; 444 + 445 + static struct aemif_abus_data mityomapl138_aemif_abus_data[] = { 446 + { 447 + .cs = 1, 448 + }, 449 + }; 450 + 451 + static struct aemif_platform_data mityomapl138_aemif_pdata = { 452 + .abus_data = mityomapl138_aemif_abus_data, 453 + .num_abus_data = ARRAY_SIZE(mityomapl138_aemif_abus_data), 454 + .sub_devices = mityomapl138_aemif_devices, 455 + .num_sub_devices = ARRAY_SIZE(mityomapl138_aemif_devices), 456 + }; 457 + 458 + static struct platform_device mityomapl138_aemif_device = { 459 + .name = "ti-aemif", 460 + .id = -1, 461 + .dev = { 462 + .platform_data = &mityomapl138_aemif_pdata, 463 + }, 464 + .resource = mityomapl138_aemif_resources, 465 + .num_resources = ARRAY_SIZE(mityomapl138_aemif_resources), 438 466 }; 439 467 440 468 static void __init mityomapl138_setup_nand(void) 441 469 { 442 - platform_add_devices(mityomapl138_devices, 443 - ARRAY_SIZE(mityomapl138_devices)); 444 - 445 - if (davinci_aemif_setup(&mityomapl138_nandflash_device)) 446 - pr_warn("%s: Cannot configure AEMIF\n", __func__); 470 + if (platform_device_register(&mityomapl138_aemif_device)) 471 + pr_warn("%s: Cannot register AEMIF device\n", __func__); 447 472 } 448 473 449 474 static const short mityomap_mii_pins[] = { ··· 529 502 static void __init mityomapl138_init(void) 530 503 { 531 504 int ret; 505 + 506 + da850_register_clocks(); 532 507 533 508 /* for now, no special EDMA channels are reserved */ 534 509 ret = da850_register_edma(NULL);
+2
arch/arm/mach-davinci/board-neuros-osd2.c
··· 175 175 struct clk *aemif_clk; 176 176 struct davinci_soc_info *soc_info = &davinci_soc_info; 177 177 178 + dm644x_register_clocks(); 179 + 178 180 dm644x_init_devices(); 179 181 180 182 ret = dm644x_gpio_register();
+136 -7
arch/arm/mach-davinci/board-omapl138-hawk.c
··· 15 15 #include <linux/interrupt.h> 16 16 #include <linux/gpio.h> 17 17 #include <linux/gpio/machine.h> 18 + #include <linux/mtd/partitions.h> 19 + #include <linux/mtd/rawnand.h> 18 20 #include <linux/platform_data/gpio-davinci.h> 21 + #include <linux/platform_data/mtd-davinci.h> 22 + #include <linux/platform_data/mtd-davinci-aemif.h> 23 + #include <linux/platform_data/ti-aemif.h> 19 24 #include <linux/regulator/machine.h> 20 25 21 26 #include <asm/mach-types.h> ··· 171 166 gpiod_remove_lookup_table(&mmc_gpios_table); 172 167 } 173 168 169 + static struct mtd_partition omapl138_hawk_nandflash_partition[] = { 170 + { 171 + .name = "u-boot env", 172 + .offset = 0, 173 + .size = SZ_128K, 174 + .mask_flags = MTD_WRITEABLE, 175 + }, 176 + { 177 + .name = "u-boot", 178 + .offset = MTDPART_OFS_APPEND, 179 + .size = SZ_512K, 180 + .mask_flags = MTD_WRITEABLE, 181 + }, 182 + { 183 + .name = "free space", 184 + .offset = MTDPART_OFS_APPEND, 185 + .size = MTDPART_SIZ_FULL, 186 + .mask_flags = 0, 187 + }, 188 + }; 189 + 190 + static struct davinci_aemif_timing omapl138_hawk_nandflash_timing = { 191 + .wsetup = 24, 192 + .wstrobe = 21, 193 + .whold = 14, 194 + .rsetup = 19, 195 + .rstrobe = 50, 196 + .rhold = 0, 197 + .ta = 20, 198 + }; 199 + 200 + static struct davinci_nand_pdata omapl138_hawk_nandflash_data = { 201 + .core_chipsel = 1, 202 + .parts = omapl138_hawk_nandflash_partition, 203 + .nr_parts = ARRAY_SIZE(omapl138_hawk_nandflash_partition), 204 + .ecc_mode = NAND_ECC_HW, 205 + .ecc_bits = 4, 206 + .bbt_options = NAND_BBT_USE_FLASH, 207 + .options = NAND_BUSWIDTH_16, 208 + .timing = &omapl138_hawk_nandflash_timing, 209 + .mask_chipsel = 0, 210 + .mask_ale = 0, 211 + .mask_cle = 0, 212 + }; 213 + 214 + static struct resource omapl138_hawk_nandflash_resource[] = { 215 + { 216 + .start = DA8XX_AEMIF_CS3_BASE, 217 + .end = DA8XX_AEMIF_CS3_BASE + SZ_32M, 218 + .flags = IORESOURCE_MEM, 219 + }, 220 + { 221 + .start = DA8XX_AEMIF_CTL_BASE, 222 + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, 223 + .flags = IORESOURCE_MEM, 224 + }, 225 + }; 226 + 227 + static struct resource omapl138_hawk_aemif_resource[] = { 228 + { 229 + .start = DA8XX_AEMIF_CTL_BASE, 230 + .end = DA8XX_AEMIF_CTL_BASE + SZ_32K, 231 + .flags = IORESOURCE_MEM, 232 + } 233 + }; 234 + 235 + static struct aemif_abus_data omapl138_hawk_aemif_abus_data[] = { 236 + { 237 + .cs = 3, 238 + } 239 + }; 240 + 241 + static struct platform_device omapl138_hawk_aemif_devices[] = { 242 + { 243 + .name = "davinci_nand", 244 + .id = -1, 245 + .dev = { 246 + .platform_data = &omapl138_hawk_nandflash_data, 247 + }, 248 + .resource = omapl138_hawk_nandflash_resource, 249 + .num_resources = ARRAY_SIZE(omapl138_hawk_nandflash_resource), 250 + } 251 + }; 252 + 253 + static struct aemif_platform_data omapl138_hawk_aemif_pdata = { 254 + .cs_offset = 2, 255 + .abus_data = omapl138_hawk_aemif_abus_data, 256 + .num_abus_data = ARRAY_SIZE(omapl138_hawk_aemif_abus_data), 257 + .sub_devices = omapl138_hawk_aemif_devices, 258 + .num_sub_devices = ARRAY_SIZE(omapl138_hawk_aemif_devices), 259 + }; 260 + 261 + static struct platform_device omapl138_hawk_aemif_device = { 262 + .name = "ti-aemif", 263 + .id = -1, 264 + .dev = { 265 + .platform_data = &omapl138_hawk_aemif_pdata, 266 + }, 267 + .resource = omapl138_hawk_aemif_resource, 268 + .num_resources = ARRAY_SIZE(omapl138_hawk_aemif_resource), 269 + }; 270 + 271 + static const short omapl138_hawk_nand_pins[] = { 272 + DA850_EMA_WAIT_1, DA850_NEMA_OE, DA850_NEMA_WE, DA850_NEMA_CS_3, 273 + DA850_EMA_D_0, DA850_EMA_D_1, DA850_EMA_D_2, DA850_EMA_D_3, 274 + DA850_EMA_D_4, DA850_EMA_D_5, DA850_EMA_D_6, DA850_EMA_D_7, 275 + DA850_EMA_D_8, DA850_EMA_D_9, DA850_EMA_D_10, DA850_EMA_D_11, 276 + DA850_EMA_D_12, DA850_EMA_D_13, DA850_EMA_D_14, DA850_EMA_D_15, 277 + DA850_EMA_A_1, DA850_EMA_A_2, 278 + -1 279 + }; 280 + 281 + static int omapl138_hawk_register_aemif(void) 282 + { 283 + int ret; 284 + 285 + ret = davinci_cfg_reg_list(omapl138_hawk_nand_pins); 286 + if (ret) 287 + pr_warn("%s: NAND mux setup failed: %d\n", __func__, ret); 288 + 289 + return platform_device_register(&omapl138_hawk_aemif_device); 290 + } 291 + 174 292 static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id); 175 293 static da8xx_ocic_handler_t hawk_usb_ocic_handler; 176 294 ··· 364 236 return; 365 237 } 366 238 367 - ret = da8xx_register_usb20_phy_clk(false); 239 + ret = da8xx_register_usb_phy_clocks(); 368 240 if (ret) 369 - pr_warn("%s: USB 2.0 PHY CLK registration failed: %d\n", 370 - __func__, ret); 371 - 372 - ret = da8xx_register_usb11_phy_clk(false); 373 - if (ret) 374 - pr_warn("%s: USB 1.1 PHY CLK registration failed: %d\n", 241 + pr_warn("%s: USB PHY CLK registration failed: %d\n", 375 242 __func__, ret); 376 243 377 244 ret = da8xx_register_usb_phy(); ··· 408 285 { 409 286 int ret; 410 287 288 + da850_register_clocks(); 289 + 411 290 ret = da850_register_gpio(); 412 291 if (ret) 413 292 pr_warn("%s: GPIO init failed: %d\n", __func__, ret); ··· 425 300 omapl138_hawk_mmc_init(); 426 301 427 302 omapl138_hawk_usb_init(); 303 + 304 + ret = omapl138_hawk_register_aemif(); 305 + if (ret) 306 + pr_warn("%s: aemif registration failed: %d\n", __func__, ret); 428 307 429 308 ret = da8xx_register_watchdog(); 430 309 if (ret)
+2
arch/arm/mach-davinci/board-sffsdr.c
··· 134 134 { 135 135 struct davinci_soc_info *soc_info = &davinci_soc_info; 136 136 137 + dm644x_register_clocks(); 138 + 137 139 dm644x_init_devices(); 138 140 139 141 platform_add_devices(davinci_sffsdr_devices,
-745
arch/arm/mach-davinci/clock.c
··· 1 - /* 2 - * Clock and PLL control for DaVinci devices 3 - * 4 - * Copyright (C) 2006-2007 Texas Instruments. 5 - * Copyright (C) 2008-2009 Deep Root Systems, LLC 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; either version 2 of the License, or 10 - * (at your option) any later version. 11 - */ 12 - 13 - #include <linux/module.h> 14 - #include <linux/kernel.h> 15 - #include <linux/init.h> 16 - #include <linux/errno.h> 17 - #include <linux/clk.h> 18 - #include <linux/err.h> 19 - #include <linux/mutex.h> 20 - #include <linux/io.h> 21 - #include <linux/delay.h> 22 - 23 - #include <mach/hardware.h> 24 - 25 - #include <mach/clock.h> 26 - #include "psc.h" 27 - #include <mach/cputype.h> 28 - #include "clock.h" 29 - 30 - static LIST_HEAD(clocks); 31 - static DEFINE_MUTEX(clocks_mutex); 32 - static DEFINE_SPINLOCK(clockfw_lock); 33 - 34 - void davinci_clk_enable(struct clk *clk) 35 - { 36 - if (clk->parent) 37 - davinci_clk_enable(clk->parent); 38 - if (clk->usecount++ == 0) { 39 - if (clk->flags & CLK_PSC) 40 - davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 41 - true, clk->flags); 42 - else if (clk->clk_enable) 43 - clk->clk_enable(clk); 44 - } 45 - } 46 - 47 - void davinci_clk_disable(struct clk *clk) 48 - { 49 - if (WARN_ON(clk->usecount == 0)) 50 - return; 51 - if (--clk->usecount == 0) { 52 - if (!(clk->flags & CLK_PLL) && (clk->flags & CLK_PSC)) 53 - davinci_psc_config(clk->domain, clk->gpsc, clk->lpsc, 54 - false, clk->flags); 55 - else if (clk->clk_disable) 56 - clk->clk_disable(clk); 57 - } 58 - if (clk->parent) 59 - davinci_clk_disable(clk->parent); 60 - } 61 - 62 - int davinci_clk_reset(struct clk *clk, bool reset) 63 - { 64 - unsigned long flags; 65 - 66 - if (clk == NULL || IS_ERR(clk)) 67 - return -EINVAL; 68 - 69 - spin_lock_irqsave(&clockfw_lock, flags); 70 - if (clk->flags & CLK_PSC) 71 - davinci_psc_reset(clk->gpsc, clk->lpsc, reset); 72 - spin_unlock_irqrestore(&clockfw_lock, flags); 73 - 74 - return 0; 75 - } 76 - EXPORT_SYMBOL(davinci_clk_reset); 77 - 78 - int davinci_clk_reset_assert(struct clk *clk) 79 - { 80 - if (clk == NULL || IS_ERR(clk) || !clk->reset) 81 - return -EINVAL; 82 - 83 - return clk->reset(clk, true); 84 - } 85 - EXPORT_SYMBOL(davinci_clk_reset_assert); 86 - 87 - int davinci_clk_reset_deassert(struct clk *clk) 88 - { 89 - if (clk == NULL || IS_ERR(clk) || !clk->reset) 90 - return -EINVAL; 91 - 92 - return clk->reset(clk, false); 93 - } 94 - EXPORT_SYMBOL(davinci_clk_reset_deassert); 95 - 96 - int clk_enable(struct clk *clk) 97 - { 98 - unsigned long flags; 99 - 100 - if (!clk) 101 - return 0; 102 - else if (IS_ERR(clk)) 103 - return -EINVAL; 104 - 105 - spin_lock_irqsave(&clockfw_lock, flags); 106 - davinci_clk_enable(clk); 107 - spin_unlock_irqrestore(&clockfw_lock, flags); 108 - 109 - return 0; 110 - } 111 - EXPORT_SYMBOL(clk_enable); 112 - 113 - void clk_disable(struct clk *clk) 114 - { 115 - unsigned long flags; 116 - 117 - if (clk == NULL || IS_ERR(clk)) 118 - return; 119 - 120 - spin_lock_irqsave(&clockfw_lock, flags); 121 - davinci_clk_disable(clk); 122 - spin_unlock_irqrestore(&clockfw_lock, flags); 123 - } 124 - EXPORT_SYMBOL(clk_disable); 125 - 126 - unsigned long clk_get_rate(struct clk *clk) 127 - { 128 - if (clk == NULL || IS_ERR(clk)) 129 - return 0; 130 - 131 - return clk->rate; 132 - } 133 - EXPORT_SYMBOL(clk_get_rate); 134 - 135 - long clk_round_rate(struct clk *clk, unsigned long rate) 136 - { 137 - if (clk == NULL || IS_ERR(clk)) 138 - return 0; 139 - 140 - if (clk->round_rate) 141 - return clk->round_rate(clk, rate); 142 - 143 - return clk->rate; 144 - } 145 - EXPORT_SYMBOL(clk_round_rate); 146 - 147 - /* Propagate rate to children */ 148 - static void propagate_rate(struct clk *root) 149 - { 150 - struct clk *clk; 151 - 152 - list_for_each_entry(clk, &root->children, childnode) { 153 - if (clk->recalc) 154 - clk->rate = clk->recalc(clk); 155 - propagate_rate(clk); 156 - } 157 - } 158 - 159 - int clk_set_rate(struct clk *clk, unsigned long rate) 160 - { 161 - unsigned long flags; 162 - int ret = -EINVAL; 163 - 164 - if (!clk) 165 - return 0; 166 - else if (IS_ERR(clk)) 167 - return -EINVAL; 168 - 169 - if (clk->set_rate) 170 - ret = clk->set_rate(clk, rate); 171 - 172 - spin_lock_irqsave(&clockfw_lock, flags); 173 - if (ret == 0) { 174 - if (clk->recalc) 175 - clk->rate = clk->recalc(clk); 176 - propagate_rate(clk); 177 - } 178 - spin_unlock_irqrestore(&clockfw_lock, flags); 179 - 180 - return ret; 181 - } 182 - EXPORT_SYMBOL(clk_set_rate); 183 - 184 - int clk_set_parent(struct clk *clk, struct clk *parent) 185 - { 186 - unsigned long flags; 187 - 188 - if (!clk) 189 - return 0; 190 - else if (IS_ERR(clk)) 191 - return -EINVAL; 192 - 193 - /* Cannot change parent on enabled clock */ 194 - if (WARN_ON(clk->usecount)) 195 - return -EINVAL; 196 - 197 - mutex_lock(&clocks_mutex); 198 - if (clk->set_parent) { 199 - int ret = clk->set_parent(clk, parent); 200 - 201 - if (ret) { 202 - mutex_unlock(&clocks_mutex); 203 - return ret; 204 - } 205 - } 206 - clk->parent = parent; 207 - list_del_init(&clk->childnode); 208 - list_add(&clk->childnode, &clk->parent->children); 209 - mutex_unlock(&clocks_mutex); 210 - 211 - spin_lock_irqsave(&clockfw_lock, flags); 212 - if (clk->recalc) 213 - clk->rate = clk->recalc(clk); 214 - propagate_rate(clk); 215 - spin_unlock_irqrestore(&clockfw_lock, flags); 216 - 217 - return 0; 218 - } 219 - EXPORT_SYMBOL(clk_set_parent); 220 - 221 - struct clk *clk_get_parent(struct clk *clk) 222 - { 223 - if (!clk) 224 - return NULL; 225 - 226 - return clk->parent; 227 - } 228 - EXPORT_SYMBOL(clk_get_parent); 229 - 230 - int clk_register(struct clk *clk) 231 - { 232 - if (clk == NULL || IS_ERR(clk)) 233 - return -EINVAL; 234 - 235 - if (WARN(clk->parent && !clk->parent->rate, 236 - "CLK: %s parent %s has no rate!\n", 237 - clk->name, clk->parent->name)) 238 - return -EINVAL; 239 - 240 - INIT_LIST_HEAD(&clk->children); 241 - 242 - mutex_lock(&clocks_mutex); 243 - list_add_tail(&clk->node, &clocks); 244 - if (clk->parent) { 245 - if (clk->set_parent) { 246 - int ret = clk->set_parent(clk, clk->parent); 247 - 248 - if (ret) { 249 - mutex_unlock(&clocks_mutex); 250 - return ret; 251 - } 252 - } 253 - list_add_tail(&clk->childnode, &clk->parent->children); 254 - } 255 - mutex_unlock(&clocks_mutex); 256 - 257 - /* If rate is already set, use it */ 258 - if (clk->rate) 259 - return 0; 260 - 261 - /* Else, see if there is a way to calculate it */ 262 - if (clk->recalc) 263 - clk->rate = clk->recalc(clk); 264 - 265 - /* Otherwise, default to parent rate */ 266 - else if (clk->parent) 267 - clk->rate = clk->parent->rate; 268 - 269 - return 0; 270 - } 271 - EXPORT_SYMBOL(clk_register); 272 - 273 - void clk_unregister(struct clk *clk) 274 - { 275 - if (clk == NULL || IS_ERR(clk)) 276 - return; 277 - 278 - mutex_lock(&clocks_mutex); 279 - list_del(&clk->node); 280 - list_del(&clk->childnode); 281 - mutex_unlock(&clocks_mutex); 282 - } 283 - EXPORT_SYMBOL(clk_unregister); 284 - 285 - #ifdef CONFIG_DAVINCI_RESET_CLOCKS 286 - /* 287 - * Disable any unused clocks left on by the bootloader 288 - */ 289 - int __init davinci_clk_disable_unused(void) 290 - { 291 - struct clk *ck; 292 - 293 - spin_lock_irq(&clockfw_lock); 294 - list_for_each_entry(ck, &clocks, node) { 295 - if (ck->usecount > 0) 296 - continue; 297 - if (!(ck->flags & CLK_PSC)) 298 - continue; 299 - 300 - /* ignore if in Disabled or SwRstDisable states */ 301 - if (!davinci_psc_is_clk_active(ck->gpsc, ck->lpsc)) 302 - continue; 303 - 304 - pr_debug("Clocks: disable unused %s\n", ck->name); 305 - 306 - davinci_psc_config(ck->domain, ck->gpsc, ck->lpsc, 307 - false, ck->flags); 308 - } 309 - spin_unlock_irq(&clockfw_lock); 310 - 311 - return 0; 312 - } 313 - #endif 314 - 315 - static unsigned long clk_sysclk_recalc(struct clk *clk) 316 - { 317 - u32 v, plldiv; 318 - struct pll_data *pll; 319 - unsigned long rate = clk->rate; 320 - 321 - /* If this is the PLL base clock, no more calculations needed */ 322 - if (clk->pll_data) 323 - return rate; 324 - 325 - if (WARN_ON(!clk->parent)) 326 - return rate; 327 - 328 - rate = clk->parent->rate; 329 - 330 - /* Otherwise, the parent must be a PLL */ 331 - if (WARN_ON(!clk->parent->pll_data)) 332 - return rate; 333 - 334 - pll = clk->parent->pll_data; 335 - 336 - /* If pre-PLL, source clock is before the multiplier and divider(s) */ 337 - if (clk->flags & PRE_PLL) 338 - rate = pll->input_rate; 339 - 340 - if (!clk->div_reg) 341 - return rate; 342 - 343 - v = __raw_readl(pll->base + clk->div_reg); 344 - if (v & PLLDIV_EN) { 345 - plldiv = (v & pll->div_ratio_mask) + 1; 346 - if (plldiv) 347 - rate /= plldiv; 348 - } 349 - 350 - return rate; 351 - } 352 - 353 - int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate) 354 - { 355 - unsigned v; 356 - struct pll_data *pll; 357 - unsigned long input; 358 - unsigned ratio = 0; 359 - 360 - /* If this is the PLL base clock, wrong function to call */ 361 - if (clk->pll_data) 362 - return -EINVAL; 363 - 364 - /* There must be a parent... */ 365 - if (WARN_ON(!clk->parent)) 366 - return -EINVAL; 367 - 368 - /* ... the parent must be a PLL... */ 369 - if (WARN_ON(!clk->parent->pll_data)) 370 - return -EINVAL; 371 - 372 - /* ... and this clock must have a divider. */ 373 - if (WARN_ON(!clk->div_reg)) 374 - return -EINVAL; 375 - 376 - pll = clk->parent->pll_data; 377 - 378 - input = clk->parent->rate; 379 - 380 - /* If pre-PLL, source clock is before the multiplier and divider(s) */ 381 - if (clk->flags & PRE_PLL) 382 - input = pll->input_rate; 383 - 384 - if (input > rate) { 385 - /* 386 - * Can afford to provide an output little higher than requested 387 - * only if maximum rate supported by hardware on this sysclk 388 - * is known. 389 - */ 390 - if (clk->maxrate) { 391 - ratio = DIV_ROUND_CLOSEST(input, rate); 392 - if (input / ratio > clk->maxrate) 393 - ratio = 0; 394 - } 395 - 396 - if (ratio == 0) 397 - ratio = DIV_ROUND_UP(input, rate); 398 - 399 - ratio--; 400 - } 401 - 402 - if (ratio > pll->div_ratio_mask) 403 - return -EINVAL; 404 - 405 - do { 406 - v = __raw_readl(pll->base + PLLSTAT); 407 - } while (v & PLLSTAT_GOSTAT); 408 - 409 - v = __raw_readl(pll->base + clk->div_reg); 410 - v &= ~pll->div_ratio_mask; 411 - v |= ratio | PLLDIV_EN; 412 - __raw_writel(v, pll->base + clk->div_reg); 413 - 414 - v = __raw_readl(pll->base + PLLCMD); 415 - v |= PLLCMD_GOSET; 416 - __raw_writel(v, pll->base + PLLCMD); 417 - 418 - do { 419 - v = __raw_readl(pll->base + PLLSTAT); 420 - } while (v & PLLSTAT_GOSTAT); 421 - 422 - return 0; 423 - } 424 - EXPORT_SYMBOL(davinci_set_sysclk_rate); 425 - 426 - static unsigned long clk_leafclk_recalc(struct clk *clk) 427 - { 428 - if (WARN_ON(!clk->parent)) 429 - return clk->rate; 430 - 431 - return clk->parent->rate; 432 - } 433 - 434 - int davinci_simple_set_rate(struct clk *clk, unsigned long rate) 435 - { 436 - clk->rate = rate; 437 - return 0; 438 - } 439 - 440 - static unsigned long clk_pllclk_recalc(struct clk *clk) 441 - { 442 - u32 ctrl, mult = 1, prediv = 1, postdiv = 1; 443 - u8 bypass; 444 - struct pll_data *pll = clk->pll_data; 445 - unsigned long rate = clk->rate; 446 - 447 - ctrl = __raw_readl(pll->base + PLLCTL); 448 - rate = pll->input_rate = clk->parent->rate; 449 - 450 - if (ctrl & PLLCTL_PLLEN) { 451 - bypass = 0; 452 - mult = __raw_readl(pll->base + PLLM); 453 - if (cpu_is_davinci_dm365()) 454 - mult = 2 * (mult & PLLM_PLLM_MASK); 455 - else 456 - mult = (mult & PLLM_PLLM_MASK) + 1; 457 - } else 458 - bypass = 1; 459 - 460 - if (pll->flags & PLL_HAS_PREDIV) { 461 - prediv = __raw_readl(pll->base + PREDIV); 462 - if (prediv & PLLDIV_EN) 463 - prediv = (prediv & pll->div_ratio_mask) + 1; 464 - else 465 - prediv = 1; 466 - } 467 - 468 - /* pre-divider is fixed, but (some?) chips won't report that */ 469 - if (cpu_is_davinci_dm355() && pll->num == 1) 470 - prediv = 8; 471 - 472 - if (pll->flags & PLL_HAS_POSTDIV) { 473 - postdiv = __raw_readl(pll->base + POSTDIV); 474 - if (postdiv & PLLDIV_EN) 475 - postdiv = (postdiv & pll->div_ratio_mask) + 1; 476 - else 477 - postdiv = 1; 478 - } 479 - 480 - if (!bypass) { 481 - rate /= prediv; 482 - rate *= mult; 483 - rate /= postdiv; 484 - } 485 - 486 - pr_debug("PLL%d: input = %lu MHz [ ", 487 - pll->num, clk->parent->rate / 1000000); 488 - if (bypass) 489 - pr_debug("bypass "); 490 - if (prediv > 1) 491 - pr_debug("/ %d ", prediv); 492 - if (mult > 1) 493 - pr_debug("* %d ", mult); 494 - if (postdiv > 1) 495 - pr_debug("/ %d ", postdiv); 496 - pr_debug("] --> %lu MHz output.\n", rate / 1000000); 497 - 498 - return rate; 499 - } 500 - 501 - /** 502 - * davinci_set_pllrate - set the output rate of a given PLL. 503 - * 504 - * Note: Currently tested to work with OMAP-L138 only. 505 - * 506 - * @pll: pll whose rate needs to be changed. 507 - * @prediv: The pre divider value. Passing 0 disables the pre-divider. 508 - * @pllm: The multiplier value. Passing 0 leads to multiply-by-one. 509 - * @postdiv: The post divider value. Passing 0 disables the post-divider. 510 - */ 511 - int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv, 512 - unsigned int mult, unsigned int postdiv) 513 - { 514 - u32 ctrl; 515 - unsigned int locktime; 516 - unsigned long flags; 517 - 518 - if (pll->base == NULL) 519 - return -EINVAL; 520 - 521 - /* 522 - * PLL lock time required per OMAP-L138 datasheet is 523 - * (2000 * prediv)/sqrt(pllm) OSCIN cycles. We approximate sqrt(pllm) 524 - * as 4 and OSCIN cycle as 25 MHz. 525 - */ 526 - if (prediv) { 527 - locktime = ((2000 * prediv) / 100); 528 - prediv = (prediv - 1) | PLLDIV_EN; 529 - } else { 530 - locktime = PLL_LOCK_TIME; 531 - } 532 - if (postdiv) 533 - postdiv = (postdiv - 1) | PLLDIV_EN; 534 - if (mult) 535 - mult = mult - 1; 536 - 537 - /* Protect against simultaneous calls to PLL setting seqeunce */ 538 - spin_lock_irqsave(&clockfw_lock, flags); 539 - 540 - ctrl = __raw_readl(pll->base + PLLCTL); 541 - 542 - /* Switch the PLL to bypass mode */ 543 - ctrl &= ~(PLLCTL_PLLENSRC | PLLCTL_PLLEN); 544 - __raw_writel(ctrl, pll->base + PLLCTL); 545 - 546 - udelay(PLL_BYPASS_TIME); 547 - 548 - /* Reset and enable PLL */ 549 - ctrl &= ~(PLLCTL_PLLRST | PLLCTL_PLLDIS); 550 - __raw_writel(ctrl, pll->base + PLLCTL); 551 - 552 - if (pll->flags & PLL_HAS_PREDIV) 553 - __raw_writel(prediv, pll->base + PREDIV); 554 - 555 - __raw_writel(mult, pll->base + PLLM); 556 - 557 - if (pll->flags & PLL_HAS_POSTDIV) 558 - __raw_writel(postdiv, pll->base + POSTDIV); 559 - 560 - udelay(PLL_RESET_TIME); 561 - 562 - /* Bring PLL out of reset */ 563 - ctrl |= PLLCTL_PLLRST; 564 - __raw_writel(ctrl, pll->base + PLLCTL); 565 - 566 - udelay(locktime); 567 - 568 - /* Remove PLL from bypass mode */ 569 - ctrl |= PLLCTL_PLLEN; 570 - __raw_writel(ctrl, pll->base + PLLCTL); 571 - 572 - spin_unlock_irqrestore(&clockfw_lock, flags); 573 - 574 - return 0; 575 - } 576 - EXPORT_SYMBOL(davinci_set_pllrate); 577 - 578 - /** 579 - * davinci_set_refclk_rate() - Set the reference clock rate 580 - * @rate: The new rate. 581 - * 582 - * Sets the reference clock rate to a given value. This will most likely 583 - * result in the entire clock tree getting updated. 584 - * 585 - * This is used to support boards which use a reference clock different 586 - * than that used by default in <soc>.c file. The reference clock rate 587 - * should be updated early in the boot process; ideally soon after the 588 - * clock tree has been initialized once with the default reference clock 589 - * rate (davinci_clk_init()). 590 - * 591 - * Returns 0 on success, error otherwise. 592 - */ 593 - int davinci_set_refclk_rate(unsigned long rate) 594 - { 595 - struct clk *refclk; 596 - 597 - refclk = clk_get(NULL, "ref"); 598 - if (IS_ERR(refclk)) { 599 - pr_err("%s: failed to get reference clock\n", __func__); 600 - return PTR_ERR(refclk); 601 - } 602 - 603 - clk_set_rate(refclk, rate); 604 - 605 - clk_put(refclk); 606 - 607 - return 0; 608 - } 609 - 610 - int __init davinci_clk_init(struct clk_lookup *clocks) 611 - { 612 - struct clk_lookup *c; 613 - struct clk *clk; 614 - size_t num_clocks = 0; 615 - 616 - for (c = clocks; c->clk; c++) { 617 - clk = c->clk; 618 - 619 - if (!clk->recalc) { 620 - 621 - /* Check if clock is a PLL */ 622 - if (clk->pll_data) 623 - clk->recalc = clk_pllclk_recalc; 624 - 625 - /* Else, if it is a PLL-derived clock */ 626 - else if (clk->flags & CLK_PLL) 627 - clk->recalc = clk_sysclk_recalc; 628 - 629 - /* Otherwise, it is a leaf clock (PSC clock) */ 630 - else if (clk->parent) 631 - clk->recalc = clk_leafclk_recalc; 632 - } 633 - 634 - if (clk->pll_data) { 635 - struct pll_data *pll = clk->pll_data; 636 - 637 - if (!pll->div_ratio_mask) 638 - pll->div_ratio_mask = PLLDIV_RATIO_MASK; 639 - 640 - if (pll->phys_base && !pll->base) { 641 - pll->base = ioremap(pll->phys_base, SZ_4K); 642 - WARN_ON(!pll->base); 643 - } 644 - } 645 - 646 - if (clk->recalc) 647 - clk->rate = clk->recalc(clk); 648 - 649 - if (clk->lpsc) 650 - clk->flags |= CLK_PSC; 651 - 652 - if (clk->flags & PSC_LRST) 653 - clk->reset = davinci_clk_reset; 654 - 655 - clk_register(clk); 656 - num_clocks++; 657 - 658 - /* Turn on clocks that Linux doesn't otherwise manage */ 659 - if (clk->flags & ALWAYS_ENABLED) 660 - clk_enable(clk); 661 - } 662 - 663 - clkdev_add_table(clocks, num_clocks); 664 - 665 - return 0; 666 - } 667 - 668 - #ifdef CONFIG_DEBUG_FS 669 - 670 - #include <linux/debugfs.h> 671 - #include <linux/seq_file.h> 672 - 673 - #define CLKNAME_MAX 10 /* longest clock name */ 674 - #define NEST_DELTA 2 675 - #define NEST_MAX 4 676 - 677 - static void 678 - dump_clock(struct seq_file *s, unsigned nest, struct clk *parent) 679 - { 680 - char *state; 681 - char buf[CLKNAME_MAX + NEST_DELTA * NEST_MAX]; 682 - struct clk *clk; 683 - unsigned i; 684 - 685 - if (parent->flags & CLK_PLL) 686 - state = "pll"; 687 - else if (parent->flags & CLK_PSC) 688 - state = "psc"; 689 - else 690 - state = ""; 691 - 692 - /* <nest spaces> name <pad to end> */ 693 - memset(buf, ' ', sizeof(buf) - 1); 694 - buf[sizeof(buf) - 1] = 0; 695 - i = strlen(parent->name); 696 - memcpy(buf + nest, parent->name, 697 - min(i, (unsigned)(sizeof(buf) - 1 - nest))); 698 - 699 - seq_printf(s, "%s users=%2d %-3s %9ld Hz\n", 700 - buf, parent->usecount, state, clk_get_rate(parent)); 701 - /* REVISIT show device associations too */ 702 - 703 - /* cost is now small, but not linear... */ 704 - list_for_each_entry(clk, &parent->children, childnode) { 705 - dump_clock(s, nest + NEST_DELTA, clk); 706 - } 707 - } 708 - 709 - static int davinci_ck_show(struct seq_file *m, void *v) 710 - { 711 - struct clk *clk; 712 - 713 - /* 714 - * Show clock tree; We trust nonzero usecounts equate to PSC enables... 715 - */ 716 - mutex_lock(&clocks_mutex); 717 - list_for_each_entry(clk, &clocks, node) 718 - if (!clk->parent) 719 - dump_clock(m, 0, clk); 720 - mutex_unlock(&clocks_mutex); 721 - 722 - return 0; 723 - } 724 - 725 - static int davinci_ck_open(struct inode *inode, struct file *file) 726 - { 727 - return single_open(file, davinci_ck_show, NULL); 728 - } 729 - 730 - static const struct file_operations davinci_ck_operations = { 731 - .open = davinci_ck_open, 732 - .read = seq_read, 733 - .llseek = seq_lseek, 734 - .release = single_release, 735 - }; 736 - 737 - static int __init davinci_clk_debugfs_init(void) 738 - { 739 - debugfs_create_file("davinci_clocks", S_IFREG | S_IRUGO, NULL, NULL, 740 - &davinci_ck_operations); 741 - return 0; 742 - 743 - } 744 - device_initcall(davinci_clk_debugfs_init); 745 - #endif /* CONFIG_DEBUG_FS */
-76
arch/arm/mach-davinci/clock.h
··· 12 12 #ifndef __ARCH_ARM_DAVINCI_CLOCK_H 13 13 #define __ARCH_ARM_DAVINCI_CLOCK_H 14 14 15 - #define DAVINCI_PLL1_BASE 0x01c40800 16 - #define DAVINCI_PLL2_BASE 0x01c40c00 17 - #define MAX_PLL 2 18 - 19 15 /* PLL/Reset register offsets */ 20 16 #define PLLCTL 0x100 21 17 #define PLLCTL_PLLEN BIT(0) ··· 60 64 * Units are micro seconds. 61 65 */ 62 66 #define PLL_LOCK_TIME 20 63 - 64 - #ifndef __ASSEMBLER__ 65 - 66 - #include <linux/list.h> 67 - #include <linux/clkdev.h> 68 - 69 - #define PLLSTAT_GOSTAT BIT(0) 70 - #define PLLCMD_GOSET BIT(0) 71 - 72 - struct pll_data { 73 - u32 phys_base; 74 - void __iomem *base; 75 - u32 num; 76 - u32 flags; 77 - u32 input_rate; 78 - u32 div_ratio_mask; 79 - }; 80 - #define PLL_HAS_PREDIV 0x01 81 - #define PLL_HAS_POSTDIV 0x02 82 - 83 - struct clk { 84 - struct list_head node; 85 - struct module *owner; 86 - const char *name; 87 - unsigned long rate; 88 - unsigned long maxrate; /* H/W supported max rate */ 89 - u8 usecount; 90 - u8 lpsc; 91 - u8 gpsc; 92 - u8 domain; 93 - u32 flags; 94 - struct clk *parent; 95 - struct list_head children; /* list of children */ 96 - struct list_head childnode; /* parent's child list node */ 97 - struct pll_data *pll_data; 98 - u32 div_reg; 99 - unsigned long (*recalc) (struct clk *); 100 - int (*set_rate) (struct clk *clk, unsigned long rate); 101 - int (*round_rate) (struct clk *clk, unsigned long rate); 102 - int (*reset) (struct clk *clk, bool reset); 103 - void (*clk_enable) (struct clk *clk); 104 - void (*clk_disable) (struct clk *clk); 105 - int (*set_parent) (struct clk *clk, struct clk *parent); 106 - }; 107 - 108 - /* Clock flags: SoC-specific flags start at BIT(16) */ 109 - #define ALWAYS_ENABLED BIT(1) 110 - #define CLK_PSC BIT(2) 111 - #define CLK_PLL BIT(3) /* PLL-derived clock */ 112 - #define PRE_PLL BIT(4) /* source is before PLL mult/div */ 113 - #define PSC_SWRSTDISABLE BIT(5) /* Disable state is SwRstDisable */ 114 - #define PSC_FORCE BIT(6) /* Force module state transtition */ 115 - #define PSC_LRST BIT(8) /* Use local reset on enable/disable */ 116 - 117 - #define CLK(dev, con, ck) \ 118 - { \ 119 - .dev_id = dev, \ 120 - .con_id = con, \ 121 - .clk = ck, \ 122 - } \ 123 - 124 - int davinci_clk_init(struct clk_lookup *clocks); 125 - int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv, 126 - unsigned int mult, unsigned int postdiv); 127 - int davinci_set_sysclk_rate(struct clk *clk, unsigned long rate); 128 - int davinci_set_refclk_rate(unsigned long rate); 129 - int davinci_simple_set_rate(struct clk *clk, unsigned long rate); 130 - int davinci_clk_reset(struct clk *clk, bool reset); 131 - void davinci_clk_enable(struct clk *clk); 132 - void davinci_clk_disable(struct clk *clk); 133 - 134 - #endif 135 67 136 68 #endif
-3
arch/arm/mach-davinci/common.c
··· 20 20 #include <mach/common.h> 21 21 #include <mach/cputype.h> 22 22 23 - #include "clock.h" 24 - 25 23 struct davinci_soc_info davinci_soc_info; 26 24 EXPORT_SYMBOL(davinci_soc_info); 27 25 ··· 116 118 void __init davinci_init_late(void) 117 119 { 118 120 davinci_cpufreq_init(); 119 - davinci_clk_disable_unused(); 120 121 }
+54 -408
arch/arm/mach-davinci/da830.c
··· 8 8 * is licensed "as is" without any warranty of any kind, whether express 9 9 * or implied. 10 10 */ 11 + #include <linux/clk-provider.h> 12 + #include <linux/clk/davinci.h> 11 13 #include <linux/gpio.h> 12 14 #include <linux/init.h> 13 - #include <linux/clk.h> 14 15 #include <linux/platform_data/gpio-davinci.h> 15 16 16 17 #include <asm/mach/map.h> 17 18 18 - #include "psc.h" 19 - #include <mach/irqs.h> 20 - #include <mach/cputype.h> 21 19 #include <mach/common.h> 22 - #include <mach/time.h> 20 + #include <mach/cputype.h> 23 21 #include <mach/da8xx.h> 22 + #include <mach/irqs.h> 23 + #include <mach/time.h> 24 24 25 - #include "clock.h" 26 25 #include "mux.h" 27 26 28 27 /* Offsets of the 8 compare registers on the da830 */ ··· 35 36 #define DA830_CMP12_7 0x7c 36 37 37 38 #define DA830_REF_FREQ 24000000 38 - 39 - static struct pll_data pll0_data = { 40 - .num = 1, 41 - .phys_base = DA8XX_PLL0_BASE, 42 - .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV, 43 - }; 44 - 45 - static struct clk ref_clk = { 46 - .name = "ref_clk", 47 - .rate = DA830_REF_FREQ, 48 - }; 49 - 50 - static struct clk pll0_clk = { 51 - .name = "pll0", 52 - .parent = &ref_clk, 53 - .pll_data = &pll0_data, 54 - .flags = CLK_PLL, 55 - }; 56 - 57 - static struct clk pll0_aux_clk = { 58 - .name = "pll0_aux_clk", 59 - .parent = &pll0_clk, 60 - .flags = CLK_PLL | PRE_PLL, 61 - }; 62 - 63 - static struct clk pll0_sysclk2 = { 64 - .name = "pll0_sysclk2", 65 - .parent = &pll0_clk, 66 - .flags = CLK_PLL, 67 - .div_reg = PLLDIV2, 68 - }; 69 - 70 - static struct clk pll0_sysclk3 = { 71 - .name = "pll0_sysclk3", 72 - .parent = &pll0_clk, 73 - .flags = CLK_PLL, 74 - .div_reg = PLLDIV3, 75 - }; 76 - 77 - static struct clk pll0_sysclk4 = { 78 - .name = "pll0_sysclk4", 79 - .parent = &pll0_clk, 80 - .flags = CLK_PLL, 81 - .div_reg = PLLDIV4, 82 - }; 83 - 84 - static struct clk pll0_sysclk5 = { 85 - .name = "pll0_sysclk5", 86 - .parent = &pll0_clk, 87 - .flags = CLK_PLL, 88 - .div_reg = PLLDIV5, 89 - }; 90 - 91 - static struct clk pll0_sysclk6 = { 92 - .name = "pll0_sysclk6", 93 - .parent = &pll0_clk, 94 - .flags = CLK_PLL, 95 - .div_reg = PLLDIV6, 96 - }; 97 - 98 - static struct clk pll0_sysclk7 = { 99 - .name = "pll0_sysclk7", 100 - .parent = &pll0_clk, 101 - .flags = CLK_PLL, 102 - .div_reg = PLLDIV7, 103 - }; 104 - 105 - static struct clk i2c0_clk = { 106 - .name = "i2c0", 107 - .parent = &pll0_aux_clk, 108 - }; 109 - 110 - static struct clk timerp64_0_clk = { 111 - .name = "timer0", 112 - .parent = &pll0_aux_clk, 113 - }; 114 - 115 - static struct clk timerp64_1_clk = { 116 - .name = "timer1", 117 - .parent = &pll0_aux_clk, 118 - }; 119 - 120 - static struct clk arm_rom_clk = { 121 - .name = "arm_rom", 122 - .parent = &pll0_sysclk2, 123 - .lpsc = DA8XX_LPSC0_ARM_RAM_ROM, 124 - .flags = ALWAYS_ENABLED, 125 - }; 126 - 127 - static struct clk scr0_ss_clk = { 128 - .name = "scr0_ss", 129 - .parent = &pll0_sysclk2, 130 - .lpsc = DA8XX_LPSC0_SCR0_SS, 131 - .flags = ALWAYS_ENABLED, 132 - }; 133 - 134 - static struct clk scr1_ss_clk = { 135 - .name = "scr1_ss", 136 - .parent = &pll0_sysclk2, 137 - .lpsc = DA8XX_LPSC0_SCR1_SS, 138 - .flags = ALWAYS_ENABLED, 139 - }; 140 - 141 - static struct clk scr2_ss_clk = { 142 - .name = "scr2_ss", 143 - .parent = &pll0_sysclk2, 144 - .lpsc = DA8XX_LPSC0_SCR2_SS, 145 - .flags = ALWAYS_ENABLED, 146 - }; 147 - 148 - static struct clk dmax_clk = { 149 - .name = "dmax", 150 - .parent = &pll0_sysclk2, 151 - .lpsc = DA8XX_LPSC0_PRUSS, 152 - .flags = ALWAYS_ENABLED, 153 - }; 154 - 155 - static struct clk tpcc_clk = { 156 - .name = "tpcc", 157 - .parent = &pll0_sysclk2, 158 - .lpsc = DA8XX_LPSC0_TPCC, 159 - .flags = ALWAYS_ENABLED | CLK_PSC, 160 - }; 161 - 162 - static struct clk tptc0_clk = { 163 - .name = "tptc0", 164 - .parent = &pll0_sysclk2, 165 - .lpsc = DA8XX_LPSC0_TPTC0, 166 - .flags = ALWAYS_ENABLED, 167 - }; 168 - 169 - static struct clk tptc1_clk = { 170 - .name = "tptc1", 171 - .parent = &pll0_sysclk2, 172 - .lpsc = DA8XX_LPSC0_TPTC1, 173 - .flags = ALWAYS_ENABLED, 174 - }; 175 - 176 - static struct clk mmcsd_clk = { 177 - .name = "mmcsd", 178 - .parent = &pll0_sysclk2, 179 - .lpsc = DA8XX_LPSC0_MMC_SD, 180 - }; 181 - 182 - static struct clk uart0_clk = { 183 - .name = "uart0", 184 - .parent = &pll0_sysclk2, 185 - .lpsc = DA8XX_LPSC0_UART0, 186 - }; 187 - 188 - static struct clk uart1_clk = { 189 - .name = "uart1", 190 - .parent = &pll0_sysclk2, 191 - .lpsc = DA8XX_LPSC1_UART1, 192 - .gpsc = 1, 193 - }; 194 - 195 - static struct clk uart2_clk = { 196 - .name = "uart2", 197 - .parent = &pll0_sysclk2, 198 - .lpsc = DA8XX_LPSC1_UART2, 199 - .gpsc = 1, 200 - }; 201 - 202 - static struct clk spi0_clk = { 203 - .name = "spi0", 204 - .parent = &pll0_sysclk2, 205 - .lpsc = DA8XX_LPSC0_SPI0, 206 - }; 207 - 208 - static struct clk spi1_clk = { 209 - .name = "spi1", 210 - .parent = &pll0_sysclk2, 211 - .lpsc = DA8XX_LPSC1_SPI1, 212 - .gpsc = 1, 213 - }; 214 - 215 - static struct clk ecap0_clk = { 216 - .name = "ecap0", 217 - .parent = &pll0_sysclk2, 218 - .lpsc = DA8XX_LPSC1_ECAP, 219 - .gpsc = 1, 220 - }; 221 - 222 - static struct clk ecap1_clk = { 223 - .name = "ecap1", 224 - .parent = &pll0_sysclk2, 225 - .lpsc = DA8XX_LPSC1_ECAP, 226 - .gpsc = 1, 227 - }; 228 - 229 - static struct clk ecap2_clk = { 230 - .name = "ecap2", 231 - .parent = &pll0_sysclk2, 232 - .lpsc = DA8XX_LPSC1_ECAP, 233 - .gpsc = 1, 234 - }; 235 - 236 - static struct clk pwm0_clk = { 237 - .name = "pwm0", 238 - .parent = &pll0_sysclk2, 239 - .lpsc = DA8XX_LPSC1_PWM, 240 - .gpsc = 1, 241 - }; 242 - 243 - static struct clk pwm1_clk = { 244 - .name = "pwm1", 245 - .parent = &pll0_sysclk2, 246 - .lpsc = DA8XX_LPSC1_PWM, 247 - .gpsc = 1, 248 - }; 249 - 250 - static struct clk pwm2_clk = { 251 - .name = "pwm2", 252 - .parent = &pll0_sysclk2, 253 - .lpsc = DA8XX_LPSC1_PWM, 254 - .gpsc = 1, 255 - }; 256 - 257 - static struct clk eqep0_clk = { 258 - .name = "eqep0", 259 - .parent = &pll0_sysclk2, 260 - .lpsc = DA830_LPSC1_EQEP, 261 - .gpsc = 1, 262 - }; 263 - 264 - static struct clk eqep1_clk = { 265 - .name = "eqep1", 266 - .parent = &pll0_sysclk2, 267 - .lpsc = DA830_LPSC1_EQEP, 268 - .gpsc = 1, 269 - }; 270 - 271 - static struct clk lcdc_clk = { 272 - .name = "lcdc", 273 - .parent = &pll0_sysclk2, 274 - .lpsc = DA8XX_LPSC1_LCDC, 275 - .gpsc = 1, 276 - }; 277 - 278 - static struct clk mcasp0_clk = { 279 - .name = "mcasp0", 280 - .parent = &pll0_sysclk2, 281 - .lpsc = DA8XX_LPSC1_McASP0, 282 - .gpsc = 1, 283 - }; 284 - 285 - static struct clk mcasp1_clk = { 286 - .name = "mcasp1", 287 - .parent = &pll0_sysclk2, 288 - .lpsc = DA830_LPSC1_McASP1, 289 - .gpsc = 1, 290 - }; 291 - 292 - static struct clk mcasp2_clk = { 293 - .name = "mcasp2", 294 - .parent = &pll0_sysclk2, 295 - .lpsc = DA830_LPSC1_McASP2, 296 - .gpsc = 1, 297 - }; 298 - 299 - static struct clk usb20_clk = { 300 - .name = "usb20", 301 - .parent = &pll0_sysclk2, 302 - .lpsc = DA8XX_LPSC1_USB20, 303 - .gpsc = 1, 304 - }; 305 - 306 - static struct clk cppi41_clk = { 307 - .name = "cppi41", 308 - .parent = &usb20_clk, 309 - }; 310 - 311 - static struct clk aemif_clk = { 312 - .name = "aemif", 313 - .parent = &pll0_sysclk3, 314 - .lpsc = DA8XX_LPSC0_EMIF25, 315 - .flags = ALWAYS_ENABLED, 316 - }; 317 - 318 - static struct clk aintc_clk = { 319 - .name = "aintc", 320 - .parent = &pll0_sysclk4, 321 - .lpsc = DA8XX_LPSC0_AINTC, 322 - .flags = ALWAYS_ENABLED, 323 - }; 324 - 325 - static struct clk secu_mgr_clk = { 326 - .name = "secu_mgr", 327 - .parent = &pll0_sysclk4, 328 - .lpsc = DA8XX_LPSC0_SECU_MGR, 329 - .flags = ALWAYS_ENABLED, 330 - }; 331 - 332 - static struct clk emac_clk = { 333 - .name = "emac", 334 - .parent = &pll0_sysclk4, 335 - .lpsc = DA8XX_LPSC1_CPGMAC, 336 - .gpsc = 1, 337 - }; 338 - 339 - static struct clk gpio_clk = { 340 - .name = "gpio", 341 - .parent = &pll0_sysclk4, 342 - .lpsc = DA8XX_LPSC1_GPIO, 343 - .gpsc = 1, 344 - }; 345 - 346 - static struct clk i2c1_clk = { 347 - .name = "i2c1", 348 - .parent = &pll0_sysclk4, 349 - .lpsc = DA8XX_LPSC1_I2C, 350 - .gpsc = 1, 351 - }; 352 - 353 - static struct clk usb11_clk = { 354 - .name = "usb11", 355 - .parent = &pll0_sysclk4, 356 - .lpsc = DA8XX_LPSC1_USB11, 357 - .gpsc = 1, 358 - }; 359 - 360 - static struct clk emif3_clk = { 361 - .name = "emif3", 362 - .parent = &pll0_sysclk5, 363 - .lpsc = DA8XX_LPSC1_EMIF3C, 364 - .gpsc = 1, 365 - .flags = ALWAYS_ENABLED, 366 - }; 367 - 368 - static struct clk arm_clk = { 369 - .name = "arm", 370 - .parent = &pll0_sysclk6, 371 - .lpsc = DA8XX_LPSC0_ARM, 372 - .flags = ALWAYS_ENABLED, 373 - }; 374 - 375 - static struct clk rmii_clk = { 376 - .name = "rmii", 377 - .parent = &pll0_sysclk7, 378 - }; 379 - 380 - static struct clk_lookup da830_clks[] = { 381 - CLK(NULL, "ref", &ref_clk), 382 - CLK(NULL, "pll0", &pll0_clk), 383 - CLK(NULL, "pll0_aux", &pll0_aux_clk), 384 - CLK(NULL, "pll0_sysclk2", &pll0_sysclk2), 385 - CLK(NULL, "pll0_sysclk3", &pll0_sysclk3), 386 - CLK(NULL, "pll0_sysclk4", &pll0_sysclk4), 387 - CLK(NULL, "pll0_sysclk5", &pll0_sysclk5), 388 - CLK(NULL, "pll0_sysclk6", &pll0_sysclk6), 389 - CLK(NULL, "pll0_sysclk7", &pll0_sysclk7), 390 - CLK("i2c_davinci.1", NULL, &i2c0_clk), 391 - CLK(NULL, "timer0", &timerp64_0_clk), 392 - CLK("davinci-wdt", NULL, &timerp64_1_clk), 393 - CLK(NULL, "arm_rom", &arm_rom_clk), 394 - CLK(NULL, "scr0_ss", &scr0_ss_clk), 395 - CLK(NULL, "scr1_ss", &scr1_ss_clk), 396 - CLK(NULL, "scr2_ss", &scr2_ss_clk), 397 - CLK(NULL, "dmax", &dmax_clk), 398 - CLK(NULL, "tpcc", &tpcc_clk), 399 - CLK(NULL, "tptc0", &tptc0_clk), 400 - CLK(NULL, "tptc1", &tptc1_clk), 401 - CLK("da830-mmc.0", NULL, &mmcsd_clk), 402 - CLK("serial8250.0", NULL, &uart0_clk), 403 - CLK("serial8250.1", NULL, &uart1_clk), 404 - CLK("serial8250.2", NULL, &uart2_clk), 405 - CLK("spi_davinci.0", NULL, &spi0_clk), 406 - CLK("spi_davinci.1", NULL, &spi1_clk), 407 - CLK(NULL, "ecap0", &ecap0_clk), 408 - CLK(NULL, "ecap1", &ecap1_clk), 409 - CLK(NULL, "ecap2", &ecap2_clk), 410 - CLK(NULL, "pwm0", &pwm0_clk), 411 - CLK(NULL, "pwm1", &pwm1_clk), 412 - CLK(NULL, "pwm2", &pwm2_clk), 413 - CLK("eqep.0", NULL, &eqep0_clk), 414 - CLK("eqep.1", NULL, &eqep1_clk), 415 - CLK("da8xx_lcdc.0", "fck", &lcdc_clk), 416 - CLK("davinci-mcasp.0", NULL, &mcasp0_clk), 417 - CLK("davinci-mcasp.1", NULL, &mcasp1_clk), 418 - CLK("davinci-mcasp.2", NULL, &mcasp2_clk), 419 - CLK("musb-da8xx", NULL, &usb20_clk), 420 - CLK("cppi41-dmaengine", NULL, &cppi41_clk), 421 - CLK(NULL, "aemif", &aemif_clk), 422 - CLK(NULL, "aintc", &aintc_clk), 423 - CLK(NULL, "secu_mgr", &secu_mgr_clk), 424 - CLK("davinci_emac.1", NULL, &emac_clk), 425 - CLK("davinci_mdio.0", "fck", &emac_clk), 426 - CLK(NULL, "gpio", &gpio_clk), 427 - CLK("i2c_davinci.2", NULL, &i2c1_clk), 428 - CLK("ohci-da8xx", NULL, &usb11_clk), 429 - CLK(NULL, "emif3", &emif3_clk), 430 - CLK(NULL, "arm", &arm_clk), 431 - CLK(NULL, "rmii", &rmii_clk), 432 - CLK(NULL, NULL, NULL), 433 - }; 434 39 435 40 /* 436 41 * Device specific mux setup ··· 733 1130 }, 734 1131 }; 735 1132 736 - static u32 da830_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE }; 737 - 738 1133 /* Contents of JTAG ID register used to identify exact cpu type */ 739 1134 static struct davinci_id da830_ids[] = { 740 1135 { ··· 801 1200 .jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG, 802 1201 .ids = da830_ids, 803 1202 .ids_num = ARRAY_SIZE(da830_ids), 804 - .psc_bases = da830_psc_bases, 805 - .psc_bases_num = ARRAY_SIZE(da830_psc_bases), 806 1203 .pinmux_base = DA8XX_SYSCFG0_BASE + 0x120, 807 1204 .pinmux_pins = da830_pins, 808 1205 .pinmux_pins_num = ARRAY_SIZE(da830_pins), ··· 822 1223 823 1224 void __init da830_init_time(void) 824 1225 { 825 - davinci_clk_init(da830_clks); 826 - davinci_timer_init(); 1226 + void __iomem *pll; 1227 + struct clk *clk; 1228 + 1229 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA830_REF_FREQ); 1230 + 1231 + pll = ioremap(DA8XX_PLL0_BASE, SZ_4K); 1232 + 1233 + da830_pll_init(NULL, pll, NULL); 1234 + 1235 + clk = clk_get(NULL, "timer0"); 1236 + 1237 + davinci_timer_init(clk); 1238 + } 1239 + 1240 + static struct resource da830_psc0_resources[] = { 1241 + { 1242 + .start = DA8XX_PSC0_BASE, 1243 + .end = DA8XX_PSC0_BASE + SZ_4K - 1, 1244 + .flags = IORESOURCE_MEM, 1245 + }, 1246 + }; 1247 + 1248 + static struct platform_device da830_psc0_device = { 1249 + .name = "da830-psc0", 1250 + .id = -1, 1251 + .resource = da830_psc0_resources, 1252 + .num_resources = ARRAY_SIZE(da830_psc0_resources), 1253 + }; 1254 + 1255 + static struct resource da830_psc1_resources[] = { 1256 + { 1257 + .start = DA8XX_PSC1_BASE, 1258 + .end = DA8XX_PSC1_BASE + SZ_4K - 1, 1259 + .flags = IORESOURCE_MEM, 1260 + }, 1261 + }; 1262 + 1263 + static struct platform_device da830_psc1_device = { 1264 + .name = "da830-psc1", 1265 + .id = -1, 1266 + .resource = da830_psc1_resources, 1267 + .num_resources = ARRAY_SIZE(da830_psc1_resources), 1268 + }; 1269 + 1270 + void __init da830_register_clocks(void) 1271 + { 1272 + /* PLL is registered in da830_init_time() */ 1273 + platform_device_register(&da830_psc0_device); 1274 + platform_device_register(&da830_psc1_device); 827 1275 }
+130 -652
arch/arm/mach-davinci/da850.c
··· 11 11 * is licensed "as is" without any warranty of any kind, whether express 12 12 * or implied. 13 13 */ 14 + 15 + #include <linux/clk-provider.h> 16 + #include <linux/clk/davinci.h> 14 17 #include <linux/clkdev.h> 18 + #include <linux/cpufreq.h> 15 19 #include <linux/gpio.h> 16 20 #include <linux/init.h> 17 - #include <linux/clk.h> 18 - #include <linux/platform_device.h> 19 - #include <linux/cpufreq.h> 20 - #include <linux/regulator/consumer.h> 21 + #include <linux/mfd/da8xx-cfgchip.h> 22 + #include <linux/platform_data/clk-da8xx-cfgchip.h> 23 + #include <linux/platform_data/clk-davinci-pll.h> 21 24 #include <linux/platform_data/gpio-davinci.h> 25 + #include <linux/platform_device.h> 26 + #include <linux/regmap.h> 27 + #include <linux/regulator/consumer.h> 22 28 23 29 #include <asm/mach/map.h> 24 30 25 - #include "psc.h" 26 - #include <mach/irqs.h> 27 - #include <mach/cputype.h> 28 31 #include <mach/common.h> 29 - #include <mach/time.h> 30 - #include <mach/da8xx.h> 31 32 #include <mach/cpufreq.h> 33 + #include <mach/cputype.h> 34 + #include <mach/da8xx.h> 35 + #include <mach/irqs.h> 32 36 #include <mach/pm.h> 37 + #include <mach/time.h> 33 38 34 - #include "clock.h" 35 39 #include "mux.h" 36 40 37 41 #define DA850_PLL1_BASE 0x01e1a000 ··· 43 39 #define DA850_TIMER64P3_BASE 0x01f0d000 44 40 45 41 #define DA850_REF_FREQ 24000000 46 - 47 - #define CFGCHIP3_ASYNC3_CLKSRC BIT(4) 48 - #define CFGCHIP3_PLL1_MASTER_LOCK BIT(5) 49 - #define CFGCHIP0_PLL_MASTER_LOCK BIT(4) 50 - 51 - static int da850_set_armrate(struct clk *clk, unsigned long rate); 52 - static int da850_round_armrate(struct clk *clk, unsigned long rate); 53 - static int da850_set_pll0rate(struct clk *clk, unsigned long armrate); 54 - 55 - static struct pll_data pll0_data = { 56 - .num = 1, 57 - .phys_base = DA8XX_PLL0_BASE, 58 - .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV, 59 - }; 60 - 61 - static struct clk ref_clk = { 62 - .name = "ref_clk", 63 - .rate = DA850_REF_FREQ, 64 - .set_rate = davinci_simple_set_rate, 65 - }; 66 - 67 - static struct clk pll0_clk = { 68 - .name = "pll0", 69 - .parent = &ref_clk, 70 - .pll_data = &pll0_data, 71 - .flags = CLK_PLL, 72 - .set_rate = da850_set_pll0rate, 73 - }; 74 - 75 - static struct clk pll0_aux_clk = { 76 - .name = "pll0_aux_clk", 77 - .parent = &pll0_clk, 78 - .flags = CLK_PLL | PRE_PLL, 79 - }; 80 - 81 - static struct clk pll0_sysclk1 = { 82 - .name = "pll0_sysclk1", 83 - .parent = &pll0_clk, 84 - .flags = CLK_PLL, 85 - .div_reg = PLLDIV1, 86 - }; 87 - 88 - static struct clk pll0_sysclk2 = { 89 - .name = "pll0_sysclk2", 90 - .parent = &pll0_clk, 91 - .flags = CLK_PLL, 92 - .div_reg = PLLDIV2, 93 - }; 94 - 95 - static struct clk pll0_sysclk3 = { 96 - .name = "pll0_sysclk3", 97 - .parent = &pll0_clk, 98 - .flags = CLK_PLL, 99 - .div_reg = PLLDIV3, 100 - .set_rate = davinci_set_sysclk_rate, 101 - .maxrate = 100000000, 102 - }; 103 - 104 - static struct clk pll0_sysclk4 = { 105 - .name = "pll0_sysclk4", 106 - .parent = &pll0_clk, 107 - .flags = CLK_PLL, 108 - .div_reg = PLLDIV4, 109 - }; 110 - 111 - static struct clk pll0_sysclk5 = { 112 - .name = "pll0_sysclk5", 113 - .parent = &pll0_clk, 114 - .flags = CLK_PLL, 115 - .div_reg = PLLDIV5, 116 - }; 117 - 118 - static struct clk pll0_sysclk6 = { 119 - .name = "pll0_sysclk6", 120 - .parent = &pll0_clk, 121 - .flags = CLK_PLL, 122 - .div_reg = PLLDIV6, 123 - }; 124 - 125 - static struct clk pll0_sysclk7 = { 126 - .name = "pll0_sysclk7", 127 - .parent = &pll0_clk, 128 - .flags = CLK_PLL, 129 - .div_reg = PLLDIV7, 130 - }; 131 - 132 - static struct pll_data pll1_data = { 133 - .num = 2, 134 - .phys_base = DA850_PLL1_BASE, 135 - .flags = PLL_HAS_POSTDIV, 136 - }; 137 - 138 - static struct clk pll1_clk = { 139 - .name = "pll1", 140 - .parent = &ref_clk, 141 - .pll_data = &pll1_data, 142 - .flags = CLK_PLL, 143 - }; 144 - 145 - static struct clk pll1_aux_clk = { 146 - .name = "pll1_aux_clk", 147 - .parent = &pll1_clk, 148 - .flags = CLK_PLL | PRE_PLL, 149 - }; 150 - 151 - static struct clk pll1_sysclk2 = { 152 - .name = "pll1_sysclk2", 153 - .parent = &pll1_clk, 154 - .flags = CLK_PLL, 155 - .div_reg = PLLDIV2, 156 - }; 157 - 158 - static struct clk pll1_sysclk3 = { 159 - .name = "pll1_sysclk3", 160 - .parent = &pll1_clk, 161 - .flags = CLK_PLL, 162 - .div_reg = PLLDIV3, 163 - }; 164 - 165 - static int da850_async3_set_parent(struct clk *clk, struct clk *parent) 166 - { 167 - u32 val; 168 - 169 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 170 - 171 - if (parent == &pll0_sysclk2) { 172 - val &= ~CFGCHIP3_ASYNC3_CLKSRC; 173 - } else if (parent == &pll1_sysclk2) { 174 - val |= CFGCHIP3_ASYNC3_CLKSRC; 175 - } else { 176 - pr_err("Bad parent on async3 clock mux\n"); 177 - return -EINVAL; 178 - } 179 - 180 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 181 - 182 - return 0; 183 - } 184 - 185 - static struct clk async3_clk = { 186 - .name = "async3", 187 - .parent = &pll1_sysclk2, 188 - .set_parent = da850_async3_set_parent, 189 - }; 190 - 191 - static struct clk i2c0_clk = { 192 - .name = "i2c0", 193 - .parent = &pll0_aux_clk, 194 - }; 195 - 196 - static struct clk timerp64_0_clk = { 197 - .name = "timer0", 198 - .parent = &pll0_aux_clk, 199 - }; 200 - 201 - static struct clk timerp64_1_clk = { 202 - .name = "timer1", 203 - .parent = &pll0_aux_clk, 204 - }; 205 - 206 - static struct clk arm_rom_clk = { 207 - .name = "arm_rom", 208 - .parent = &pll0_sysclk2, 209 - .lpsc = DA8XX_LPSC0_ARM_RAM_ROM, 210 - .flags = ALWAYS_ENABLED, 211 - }; 212 - 213 - static struct clk tpcc0_clk = { 214 - .name = "tpcc0", 215 - .parent = &pll0_sysclk2, 216 - .lpsc = DA8XX_LPSC0_TPCC, 217 - .flags = ALWAYS_ENABLED | CLK_PSC, 218 - }; 219 - 220 - static struct clk tptc0_clk = { 221 - .name = "tptc0", 222 - .parent = &pll0_sysclk2, 223 - .lpsc = DA8XX_LPSC0_TPTC0, 224 - .flags = ALWAYS_ENABLED, 225 - }; 226 - 227 - static struct clk tptc1_clk = { 228 - .name = "tptc1", 229 - .parent = &pll0_sysclk2, 230 - .lpsc = DA8XX_LPSC0_TPTC1, 231 - .flags = ALWAYS_ENABLED, 232 - }; 233 - 234 - static struct clk tpcc1_clk = { 235 - .name = "tpcc1", 236 - .parent = &pll0_sysclk2, 237 - .lpsc = DA850_LPSC1_TPCC1, 238 - .gpsc = 1, 239 - .flags = CLK_PSC | ALWAYS_ENABLED, 240 - }; 241 - 242 - static struct clk tptc2_clk = { 243 - .name = "tptc2", 244 - .parent = &pll0_sysclk2, 245 - .lpsc = DA850_LPSC1_TPTC2, 246 - .gpsc = 1, 247 - .flags = ALWAYS_ENABLED, 248 - }; 249 - 250 - static struct clk pruss_clk = { 251 - .name = "pruss", 252 - .parent = &pll0_sysclk2, 253 - .lpsc = DA8XX_LPSC0_PRUSS, 254 - }; 255 - 256 - static struct clk uart0_clk = { 257 - .name = "uart0", 258 - .parent = &pll0_sysclk2, 259 - .lpsc = DA8XX_LPSC0_UART0, 260 - }; 261 - 262 - static struct clk uart1_clk = { 263 - .name = "uart1", 264 - .parent = &async3_clk, 265 - .lpsc = DA8XX_LPSC1_UART1, 266 - .gpsc = 1, 267 - }; 268 - 269 - static struct clk uart2_clk = { 270 - .name = "uart2", 271 - .parent = &async3_clk, 272 - .lpsc = DA8XX_LPSC1_UART2, 273 - .gpsc = 1, 274 - }; 275 - 276 - static struct clk aintc_clk = { 277 - .name = "aintc", 278 - .parent = &pll0_sysclk4, 279 - .lpsc = DA8XX_LPSC0_AINTC, 280 - .flags = ALWAYS_ENABLED, 281 - }; 282 - 283 - static struct clk gpio_clk = { 284 - .name = "gpio", 285 - .parent = &pll0_sysclk4, 286 - .lpsc = DA8XX_LPSC1_GPIO, 287 - .gpsc = 1, 288 - }; 289 - 290 - static struct clk i2c1_clk = { 291 - .name = "i2c1", 292 - .parent = &pll0_sysclk4, 293 - .lpsc = DA8XX_LPSC1_I2C, 294 - .gpsc = 1, 295 - }; 296 - 297 - static struct clk emif3_clk = { 298 - .name = "emif3", 299 - .parent = &pll0_sysclk5, 300 - .lpsc = DA8XX_LPSC1_EMIF3C, 301 - .gpsc = 1, 302 - .flags = ALWAYS_ENABLED, 303 - }; 304 - 305 - static struct clk arm_clk = { 306 - .name = "arm", 307 - .parent = &pll0_sysclk6, 308 - .lpsc = DA8XX_LPSC0_ARM, 309 - .flags = ALWAYS_ENABLED, 310 - .set_rate = da850_set_armrate, 311 - .round_rate = da850_round_armrate, 312 - }; 313 - 314 - static struct clk rmii_clk = { 315 - .name = "rmii", 316 - .parent = &pll0_sysclk7, 317 - }; 318 - 319 - static struct clk emac_clk = { 320 - .name = "emac", 321 - .parent = &pll0_sysclk4, 322 - .lpsc = DA8XX_LPSC1_CPGMAC, 323 - .gpsc = 1, 324 - }; 325 - 326 - /* 327 - * In order to avoid adding the emac_clk to the clock lookup table twice (and 328 - * screwing up the linked list in the process) create a separate clock for 329 - * mdio inheriting the rate from emac_clk. 330 - */ 331 - static struct clk mdio_clk = { 332 - .name = "mdio", 333 - .parent = &emac_clk, 334 - }; 335 - 336 - static struct clk mcasp_clk = { 337 - .name = "mcasp", 338 - .parent = &async3_clk, 339 - .lpsc = DA8XX_LPSC1_McASP0, 340 - .gpsc = 1, 341 - }; 342 - 343 - static struct clk mcbsp0_clk = { 344 - .name = "mcbsp0", 345 - .parent = &async3_clk, 346 - .lpsc = DA850_LPSC1_McBSP0, 347 - .gpsc = 1, 348 - }; 349 - 350 - static struct clk mcbsp1_clk = { 351 - .name = "mcbsp1", 352 - .parent = &async3_clk, 353 - .lpsc = DA850_LPSC1_McBSP1, 354 - .gpsc = 1, 355 - }; 356 - 357 - static struct clk lcdc_clk = { 358 - .name = "lcdc", 359 - .parent = &pll0_sysclk2, 360 - .lpsc = DA8XX_LPSC1_LCDC, 361 - .gpsc = 1, 362 - }; 363 - 364 - static struct clk mmcsd0_clk = { 365 - .name = "mmcsd0", 366 - .parent = &pll0_sysclk2, 367 - .lpsc = DA8XX_LPSC0_MMC_SD, 368 - }; 369 - 370 - static struct clk mmcsd1_clk = { 371 - .name = "mmcsd1", 372 - .parent = &pll0_sysclk2, 373 - .lpsc = DA850_LPSC1_MMC_SD1, 374 - .gpsc = 1, 375 - }; 376 - 377 - static struct clk aemif_clk = { 378 - .name = "aemif", 379 - .parent = &pll0_sysclk3, 380 - .lpsc = DA8XX_LPSC0_EMIF25, 381 - .flags = ALWAYS_ENABLED, 382 - }; 383 - 384 - /* 385 - * In order to avoid adding the aemif_clk to the clock lookup table twice (and 386 - * screwing up the linked list in the process) create a separate clock for 387 - * nand inheriting the rate from aemif_clk. 388 - */ 389 - static struct clk aemif_nand_clk = { 390 - .name = "nand", 391 - .parent = &aemif_clk, 392 - }; 393 - 394 - static struct clk usb11_clk = { 395 - .name = "usb11", 396 - .parent = &pll0_sysclk4, 397 - .lpsc = DA8XX_LPSC1_USB11, 398 - .gpsc = 1, 399 - }; 400 - 401 - static struct clk usb20_clk = { 402 - .name = "usb20", 403 - .parent = &pll0_sysclk2, 404 - .lpsc = DA8XX_LPSC1_USB20, 405 - .gpsc = 1, 406 - }; 407 - 408 - static struct clk cppi41_clk = { 409 - .name = "cppi41", 410 - .parent = &usb20_clk, 411 - }; 412 - 413 - static struct clk spi0_clk = { 414 - .name = "spi0", 415 - .parent = &pll0_sysclk2, 416 - .lpsc = DA8XX_LPSC0_SPI0, 417 - }; 418 - 419 - static struct clk spi1_clk = { 420 - .name = "spi1", 421 - .parent = &async3_clk, 422 - .lpsc = DA8XX_LPSC1_SPI1, 423 - .gpsc = 1, 424 - }; 425 - 426 - static struct clk vpif_clk = { 427 - .name = "vpif", 428 - .parent = &pll0_sysclk2, 429 - .lpsc = DA850_LPSC1_VPIF, 430 - .gpsc = 1, 431 - }; 432 - 433 - static struct clk sata_clk = { 434 - .name = "sata", 435 - .parent = &pll0_sysclk2, 436 - .lpsc = DA850_LPSC1_SATA, 437 - .gpsc = 1, 438 - .flags = PSC_FORCE, 439 - }; 440 - 441 - static struct clk dsp_clk = { 442 - .name = "dsp", 443 - .parent = &pll0_sysclk1, 444 - .domain = DAVINCI_GPSC_DSPDOMAIN, 445 - .lpsc = DA8XX_LPSC0_GEM, 446 - .flags = PSC_LRST | PSC_FORCE, 447 - }; 448 - 449 - static struct clk ehrpwm_clk = { 450 - .name = "ehrpwm", 451 - .parent = &async3_clk, 452 - .lpsc = DA8XX_LPSC1_PWM, 453 - .gpsc = 1, 454 - }; 455 - 456 - static struct clk ehrpwm0_clk = { 457 - .name = "ehrpwm0", 458 - .parent = &ehrpwm_clk, 459 - }; 460 - 461 - static struct clk ehrpwm1_clk = { 462 - .name = "ehrpwm1", 463 - .parent = &ehrpwm_clk, 464 - }; 465 - 466 - #define DA8XX_EHRPWM_TBCLKSYNC BIT(12) 467 - 468 - static void ehrpwm_tblck_enable(struct clk *clk) 469 - { 470 - u32 val; 471 - 472 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG)); 473 - val |= DA8XX_EHRPWM_TBCLKSYNC; 474 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG)); 475 - } 476 - 477 - static void ehrpwm_tblck_disable(struct clk *clk) 478 - { 479 - u32 val; 480 - 481 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG)); 482 - val &= ~DA8XX_EHRPWM_TBCLKSYNC; 483 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP1_REG)); 484 - } 485 - 486 - static struct clk ehrpwm_tbclk = { 487 - .name = "ehrpwm_tbclk", 488 - .parent = &ehrpwm_clk, 489 - .clk_enable = ehrpwm_tblck_enable, 490 - .clk_disable = ehrpwm_tblck_disable, 491 - }; 492 - 493 - static struct clk ehrpwm0_tbclk = { 494 - .name = "ehrpwm0_tbclk", 495 - .parent = &ehrpwm_tbclk, 496 - }; 497 - 498 - static struct clk ehrpwm1_tbclk = { 499 - .name = "ehrpwm1_tbclk", 500 - .parent = &ehrpwm_tbclk, 501 - }; 502 - 503 - static struct clk ecap_clk = { 504 - .name = "ecap", 505 - .parent = &async3_clk, 506 - .lpsc = DA8XX_LPSC1_ECAP, 507 - .gpsc = 1, 508 - }; 509 - 510 - static struct clk ecap0_clk = { 511 - .name = "ecap0_clk", 512 - .parent = &ecap_clk, 513 - }; 514 - 515 - static struct clk ecap1_clk = { 516 - .name = "ecap1_clk", 517 - .parent = &ecap_clk, 518 - }; 519 - 520 - static struct clk ecap2_clk = { 521 - .name = "ecap2_clk", 522 - .parent = &ecap_clk, 523 - }; 524 - 525 - static struct clk_lookup da850_clks[] = { 526 - CLK(NULL, "ref", &ref_clk), 527 - CLK(NULL, "pll0", &pll0_clk), 528 - CLK(NULL, "pll0_aux", &pll0_aux_clk), 529 - CLK(NULL, "pll0_sysclk1", &pll0_sysclk1), 530 - CLK(NULL, "pll0_sysclk2", &pll0_sysclk2), 531 - CLK(NULL, "pll0_sysclk3", &pll0_sysclk3), 532 - CLK(NULL, "pll0_sysclk4", &pll0_sysclk4), 533 - CLK(NULL, "pll0_sysclk5", &pll0_sysclk5), 534 - CLK(NULL, "pll0_sysclk6", &pll0_sysclk6), 535 - CLK(NULL, "pll0_sysclk7", &pll0_sysclk7), 536 - CLK(NULL, "pll1", &pll1_clk), 537 - CLK(NULL, "pll1_aux", &pll1_aux_clk), 538 - CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), 539 - CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 540 - CLK(NULL, "async3", &async3_clk), 541 - CLK("i2c_davinci.1", NULL, &i2c0_clk), 542 - CLK(NULL, "timer0", &timerp64_0_clk), 543 - CLK("davinci-wdt", NULL, &timerp64_1_clk), 544 - CLK(NULL, "arm_rom", &arm_rom_clk), 545 - CLK(NULL, "tpcc0", &tpcc0_clk), 546 - CLK(NULL, "tptc0", &tptc0_clk), 547 - CLK(NULL, "tptc1", &tptc1_clk), 548 - CLK(NULL, "tpcc1", &tpcc1_clk), 549 - CLK(NULL, "tptc2", &tptc2_clk), 550 - CLK("pruss_uio", "pruss", &pruss_clk), 551 - CLK("serial8250.0", NULL, &uart0_clk), 552 - CLK("serial8250.1", NULL, &uart1_clk), 553 - CLK("serial8250.2", NULL, &uart2_clk), 554 - CLK(NULL, "aintc", &aintc_clk), 555 - CLK(NULL, "gpio", &gpio_clk), 556 - CLK("i2c_davinci.2", NULL, &i2c1_clk), 557 - CLK(NULL, "emif3", &emif3_clk), 558 - CLK(NULL, "arm", &arm_clk), 559 - CLK(NULL, "rmii", &rmii_clk), 560 - CLK("davinci_emac.1", NULL, &emac_clk), 561 - CLK("davinci_mdio.0", "fck", &mdio_clk), 562 - CLK("davinci-mcasp.0", NULL, &mcasp_clk), 563 - CLK("davinci-mcbsp.0", NULL, &mcbsp0_clk), 564 - CLK("davinci-mcbsp.1", NULL, &mcbsp1_clk), 565 - CLK("da8xx_lcdc.0", "fck", &lcdc_clk), 566 - CLK("da830-mmc.0", NULL, &mmcsd0_clk), 567 - CLK("da830-mmc.1", NULL, &mmcsd1_clk), 568 - CLK("ti-aemif", NULL, &aemif_clk), 569 - CLK("davinci-nand.0", "aemif", &aemif_nand_clk), 570 - CLK("ohci-da8xx", NULL, &usb11_clk), 571 - CLK("musb-da8xx", NULL, &usb20_clk), 572 - CLK("cppi41-dmaengine", NULL, &cppi41_clk), 573 - CLK("spi_davinci.0", NULL, &spi0_clk), 574 - CLK("spi_davinci.1", NULL, &spi1_clk), 575 - CLK("vpif", NULL, &vpif_clk), 576 - CLK("ahci_da850", "fck", &sata_clk), 577 - CLK("davinci-rproc.0", NULL, &dsp_clk), 578 - CLK(NULL, NULL, &ehrpwm_clk), 579 - CLK("ehrpwm.0", "fck", &ehrpwm0_clk), 580 - CLK("ehrpwm.1", "fck", &ehrpwm1_clk), 581 - CLK(NULL, NULL, &ehrpwm_tbclk), 582 - CLK("ehrpwm.0", "tbclk", &ehrpwm0_tbclk), 583 - CLK("ehrpwm.1", "tbclk", &ehrpwm1_tbclk), 584 - CLK(NULL, NULL, &ecap_clk), 585 - CLK("ecap.0", "fck", &ecap0_clk), 586 - CLK("ecap.1", "fck", &ecap1_clk), 587 - CLK("ecap.2", "fck", &ecap2_clk), 588 - CLK(NULL, NULL, NULL), 589 - }; 590 42 591 43 /* 592 44 * Device specific mux setup ··· 418 958 }, 419 959 }; 420 960 421 - static u32 da850_psc_bases[] = { DA8XX_PSC0_BASE, DA8XX_PSC1_BASE }; 422 - 423 961 /* Contents of JTAG ID register used to identify exact cpu type */ 424 962 static struct davinci_id da850_ids[] = { 425 963 { ··· 627 1169 628 1170 return platform_device_register(&da850_cpufreq_device); 629 1171 } 630 - 631 - static int da850_round_armrate(struct clk *clk, unsigned long rate) 632 - { 633 - int ret = 0, diff; 634 - unsigned int best = (unsigned int) -1; 635 - struct cpufreq_frequency_table *table = cpufreq_info.freq_table; 636 - struct cpufreq_frequency_table *pos; 637 - 638 - rate /= 1000; /* convert to kHz */ 639 - 640 - cpufreq_for_each_entry(pos, table) { 641 - diff = pos->frequency - rate; 642 - if (diff < 0) 643 - diff = -diff; 644 - 645 - if (diff < best) { 646 - best = diff; 647 - ret = pos->frequency; 648 - } 649 - } 650 - 651 - return ret * 1000; 652 - } 653 - 654 - static int da850_set_armrate(struct clk *clk, unsigned long index) 655 - { 656 - struct clk *pllclk = &pll0_clk; 657 - 658 - return clk_set_rate(pllclk, index); 659 - } 660 - 661 - static int da850_set_pll0rate(struct clk *clk, unsigned long rate) 662 - { 663 - struct pll_data *pll = clk->pll_data; 664 - struct cpufreq_frequency_table *freq; 665 - unsigned int prediv, mult, postdiv; 666 - struct da850_opp *opp = NULL; 667 - int ret; 668 - 669 - rate /= 1000; 670 - 671 - for (freq = da850_freq_table; 672 - freq->frequency != CPUFREQ_TABLE_END; freq++) { 673 - /* rate is in Hz, freq->frequency is in KHz */ 674 - if (freq->frequency == rate) { 675 - opp = (struct da850_opp *)freq->driver_data; 676 - break; 677 - } 678 - } 679 - 680 - if (!opp) 681 - return -EINVAL; 682 - 683 - prediv = opp->prediv; 684 - mult = opp->mult; 685 - postdiv = opp->postdiv; 686 - 687 - ret = davinci_set_pllrate(pll, prediv, mult, postdiv); 688 - if (WARN_ON(ret)) 689 - return ret; 690 - 691 - return 0; 692 - } 693 1172 #else 694 1173 int __init da850_register_cpufreq(char *async_clk) 695 1174 { 696 1175 return 0; 697 - } 698 - 699 - static int da850_set_armrate(struct clk *clk, unsigned long rate) 700 - { 701 - return -EINVAL; 702 - } 703 - 704 - static int da850_set_pll0rate(struct clk *clk, unsigned long armrate) 705 - { 706 - return -EINVAL; 707 - } 708 - 709 - static int da850_round_armrate(struct clk *clk, unsigned long rate) 710 - { 711 - return clk->rate; 712 1176 } 713 1177 #endif 714 1178 ··· 733 1353 .jtag_id_reg = DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG, 734 1354 .ids = da850_ids, 735 1355 .ids_num = ARRAY_SIZE(da850_ids), 736 - .psc_bases = da850_psc_bases, 737 - .psc_bases_num = ARRAY_SIZE(da850_psc_bases), 738 1356 .pinmux_base = DA8XX_SYSCFG0_BASE + 0x120, 739 1357 .pinmux_pins = da850_pins, 740 1358 .pinmux_pins_num = ARRAY_SIZE(da850_pins), ··· 748 1370 749 1371 void __init da850_init(void) 750 1372 { 751 - unsigned int v; 752 - 753 1373 davinci_common_init(&davinci_soc_info_da850); 754 1374 755 1375 da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K); ··· 755 1379 return; 756 1380 757 1381 da8xx_syscfg1_base = ioremap(DA8XX_SYSCFG1_BASE, SZ_4K); 758 - if (WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module")) 759 - return; 760 - 761 - /* Unlock writing to PLL0 registers */ 762 - v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); 763 - v &= ~CFGCHIP0_PLL_MASTER_LOCK; 764 - __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP0_REG)); 765 - 766 - /* Unlock writing to PLL1 registers */ 767 - v = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 768 - v &= ~CFGCHIP3_PLL1_MASTER_LOCK; 769 - __raw_writel(v, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP3_REG)); 1382 + WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module"); 770 1383 } 771 1384 772 1385 void __init da850_init_time(void) 773 1386 { 774 - davinci_clk_init(da850_clks); 775 - davinci_timer_init(); 1387 + void __iomem *pll0; 1388 + struct regmap *cfgchip; 1389 + struct clk *clk; 1390 + 1391 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA850_REF_FREQ); 1392 + 1393 + pll0 = ioremap(DA8XX_PLL0_BASE, SZ_4K); 1394 + cfgchip = da8xx_get_cfgchip(); 1395 + 1396 + da850_pll0_init(NULL, pll0, cfgchip); 1397 + 1398 + clk = clk_get(NULL, "timer0"); 1399 + 1400 + davinci_timer_init(clk); 1401 + } 1402 + 1403 + static struct resource da850_pll1_resources[] = { 1404 + { 1405 + .start = DA850_PLL1_BASE, 1406 + .end = DA850_PLL1_BASE + SZ_4K - 1, 1407 + .flags = IORESOURCE_MEM, 1408 + }, 1409 + }; 1410 + 1411 + static struct davinci_pll_platform_data da850_pll1_pdata; 1412 + 1413 + static struct platform_device da850_pll1_device = { 1414 + .name = "da850-pll1", 1415 + .id = -1, 1416 + .resource = da850_pll1_resources, 1417 + .num_resources = ARRAY_SIZE(da850_pll1_resources), 1418 + .dev = { 1419 + .platform_data = &da850_pll1_pdata, 1420 + }, 1421 + }; 1422 + 1423 + static struct resource da850_psc0_resources[] = { 1424 + { 1425 + .start = DA8XX_PSC0_BASE, 1426 + .end = DA8XX_PSC0_BASE + SZ_4K - 1, 1427 + .flags = IORESOURCE_MEM, 1428 + }, 1429 + }; 1430 + 1431 + static struct platform_device da850_psc0_device = { 1432 + .name = "da850-psc0", 1433 + .id = -1, 1434 + .resource = da850_psc0_resources, 1435 + .num_resources = ARRAY_SIZE(da850_psc0_resources), 1436 + }; 1437 + 1438 + static struct resource da850_psc1_resources[] = { 1439 + { 1440 + .start = DA8XX_PSC1_BASE, 1441 + .end = DA8XX_PSC1_BASE + SZ_4K - 1, 1442 + .flags = IORESOURCE_MEM, 1443 + }, 1444 + }; 1445 + 1446 + static struct platform_device da850_psc1_device = { 1447 + .name = "da850-psc1", 1448 + .id = -1, 1449 + .resource = da850_psc1_resources, 1450 + .num_resources = ARRAY_SIZE(da850_psc1_resources), 1451 + }; 1452 + 1453 + static struct da8xx_cfgchip_clk_platform_data da850_async1_pdata; 1454 + 1455 + static struct platform_device da850_async1_clksrc_device = { 1456 + .name = "da850-async1-clksrc", 1457 + .id = -1, 1458 + .dev = { 1459 + .platform_data = &da850_async1_pdata, 1460 + }, 1461 + }; 1462 + 1463 + static struct da8xx_cfgchip_clk_platform_data da850_async3_pdata; 1464 + 1465 + static struct platform_device da850_async3_clksrc_device = { 1466 + .name = "da850-async3-clksrc", 1467 + .id = -1, 1468 + .dev = { 1469 + .platform_data = &da850_async3_pdata, 1470 + }, 1471 + }; 1472 + 1473 + static struct da8xx_cfgchip_clk_platform_data da850_tbclksync_pdata; 1474 + 1475 + static struct platform_device da850_tbclksync_device = { 1476 + .name = "da830-tbclksync", 1477 + .id = -1, 1478 + .dev = { 1479 + .platform_data = &da850_tbclksync_pdata, 1480 + }, 1481 + }; 1482 + 1483 + void __init da850_register_clocks(void) 1484 + { 1485 + /* PLL0 is registered in da850_init_time() */ 1486 + 1487 + da850_pll1_pdata.cfgchip = da8xx_get_cfgchip(); 1488 + platform_device_register(&da850_pll1_device); 1489 + 1490 + da850_async1_pdata.cfgchip = da8xx_get_cfgchip(); 1491 + platform_device_register(&da850_async1_clksrc_device); 1492 + 1493 + da850_async3_pdata.cfgchip = da8xx_get_cfgchip(); 1494 + platform_device_register(&da850_async3_clksrc_device); 1495 + 1496 + platform_device_register(&da850_psc0_device); 1497 + 1498 + platform_device_register(&da850_psc1_device); 1499 + 1500 + da850_tbclksync_pdata.cfgchip = da8xx_get_cfgchip(); 1501 + platform_device_register(&da850_tbclksync_device); 776 1502 }
-66
arch/arm/mach-davinci/da8xx-dt.c
··· 7 7 * it under the terms of the GNU General Public License version 2 as 8 8 * published by the Free Software Foundation. 9 9 */ 10 - #include <linux/io.h> 11 - #include <linux/of_irq.h> 12 - #include <linux/of_platform.h> 13 - #include <linux/irqdomain.h> 14 - #include <linux/platform_data/ti-aemif.h> 15 10 16 11 #include <asm/mach/arch.h> 17 12 18 13 #include <mach/common.h> 19 - #include "cp_intc.h" 20 14 #include <mach/da8xx.h> 21 - 22 - static struct of_dev_auxdata da850_aemif_auxdata_lookup[] = { 23 - OF_DEV_AUXDATA("ti,davinci-nand", 0x62000000, "davinci-nand.0", NULL), 24 - {} 25 - }; 26 - 27 - static struct aemif_platform_data aemif_data = { 28 - .dev_lookup = da850_aemif_auxdata_lookup, 29 - }; 30 - 31 - static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = { 32 - OF_DEV_AUXDATA("ti,davinci-i2c", 0x01c22000, "i2c_davinci.1", NULL), 33 - OF_DEV_AUXDATA("ti,davinci-i2c", 0x01e28000, "i2c_davinci.2", NULL), 34 - OF_DEV_AUXDATA("ti,davinci-wdt", 0x01c21000, "davinci-wdt", NULL), 35 - OF_DEV_AUXDATA("ti,da830-mmc", 0x01c40000, "da830-mmc.0", NULL), 36 - OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f00000, "ehrpwm.0", NULL), 37 - OF_DEV_AUXDATA("ti,da850-ehrpwm", 0x01f02000, "ehrpwm.1", NULL), 38 - OF_DEV_AUXDATA("ti,da850-ecap", 0x01f06000, "ecap.0", NULL), 39 - OF_DEV_AUXDATA("ti,da850-ecap", 0x01f07000, "ecap.1", NULL), 40 - OF_DEV_AUXDATA("ti,da850-ecap", 0x01f08000, "ecap.2", NULL), 41 - OF_DEV_AUXDATA("ti,da830-spi", 0x01c41000, "spi_davinci.0", NULL), 42 - OF_DEV_AUXDATA("ti,da830-spi", 0x01f0e000, "spi_davinci.1", NULL), 43 - OF_DEV_AUXDATA("ns16550a", 0x01c42000, "serial8250.0", NULL), 44 - OF_DEV_AUXDATA("ns16550a", 0x01d0c000, "serial8250.1", NULL), 45 - OF_DEV_AUXDATA("ns16550a", 0x01d0d000, "serial8250.2", NULL), 46 - OF_DEV_AUXDATA("ti,davinci_mdio", 0x01e24000, "davinci_mdio.0", NULL), 47 - OF_DEV_AUXDATA("ti,davinci-dm6467-emac", 0x01e20000, "davinci_emac.1", 48 - NULL), 49 - OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL), 50 - OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", &aemif_data), 51 - OF_DEV_AUXDATA("ti,da850-tilcdc", 0x01e13000, "da8xx_lcdc.0", NULL), 52 - OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL), 53 - OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL), 54 - OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL), 55 - OF_DEV_AUXDATA("ti,da850-ahci", 0x01e18000, "ahci_da850", NULL), 56 - OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL), 57 - OF_DEV_AUXDATA("ti,da850-dsp", 0x11800000, "davinci-rproc.0", NULL), 58 - {} 59 - }; 60 15 61 16 #ifdef CONFIG_ARCH_DAVINCI_DA850 62 17 63 18 static void __init da850_init_machine(void) 64 19 { 65 - /* All existing boards use 100MHz SATA refclkpn */ 66 - static const unsigned long sata_refclkpn = 100 * 1000 * 1000; 67 - 68 - int ret; 69 - 70 - ret = da8xx_register_usb20_phy_clk(false); 71 - if (ret) 72 - pr_warn("%s: registering USB 2.0 PHY clock failed: %d", 73 - __func__, ret); 74 - ret = da8xx_register_usb11_phy_clk(false); 75 - if (ret) 76 - pr_warn("%s: registering USB 1.1 PHY clock failed: %d", 77 - __func__, ret); 78 - 79 - ret = da850_register_sata_refclk(sata_refclkpn); 80 - if (ret) 81 - pr_warn("%s: registering SATA REFCLK failed: %d", 82 - __func__, ret); 83 - 84 - of_platform_default_populate(NULL, da850_auxdata_lookup, NULL); 85 20 davinci_pm_init(); 86 21 pdata_quirks_init(); 87 22 } ··· 31 96 32 97 DT_MACHINE_START(DA850_DT, "Generic DA850/OMAP-L138/AM18x") 33 98 .map_io = da850_init, 34 - .init_time = da850_init_time, 35 99 .init_machine = da850_init_machine, 36 100 .dt_compat = da850_boards_compat, 37 101 .init_late = davinci_init_late,
+8
arch/arm/mach-davinci/davinci.h
··· 35 35 #include <media/davinci/vpbe.h> 36 36 #include <media/davinci/vpbe_osd.h> 37 37 38 + #define DAVINCI_PLL1_BASE 0x01c40800 39 + #define DAVINCI_PLL2_BASE 0x01c40c00 40 + #define DAVINCI_PWR_SLEEP_CNTRL_BASE 0x01c41000 41 + 38 42 #define DAVINCI_SYSTEM_MODULE_BASE 0x01c40000 39 43 #define SYSMOD_VDAC_CONFIG 0x2c 40 44 #define SYSMOD_VIDCLKCTL 0x38 ··· 88 84 /* DM355 function declarations */ 89 85 void dm355_init(void); 90 86 void dm355_init_time(void); 87 + void dm355_register_clocks(void); 91 88 void dm355_init_spi0(unsigned chipselect_mask, 92 89 const struct spi_board_info *info, unsigned len); 93 90 void dm355_init_asp1(u32 evt_enable); ··· 98 93 /* DM365 function declarations */ 99 94 void dm365_init(void); 100 95 void dm365_init_time(void); 96 + void dm365_register_clocks(void); 101 97 void dm365_init_asp(void); 102 98 void dm365_init_vc(void); 103 99 void dm365_init_ks(struct davinci_ks_platform_data *pdata); ··· 112 106 void dm644x_init(void); 113 107 void dm644x_init_devices(void); 114 108 void dm644x_init_time(void); 109 + void dm644x_register_clocks(void); 115 110 void dm644x_init_asp(void); 116 111 int dm644x_init_video(struct vpfe_config *, struct vpbe_config *); 117 112 int dm644x_gpio_register(void); ··· 120 113 /* DM646x function declarations */ 121 114 void dm646x_init(void); 122 115 void dm646x_init_time(unsigned long ref_clk_rate, unsigned long aux_clkin_rate); 116 + void dm646x_register_clocks(void); 123 117 void dm646x_init_mcasp0(struct snd_platform_data *pdata); 124 118 void dm646x_init_mcasp1(struct snd_platform_data *pdata); 125 119 int dm646x_init_edma(struct edma_rsv_info *rsv);
+16 -27
arch/arm/mach-davinci/devices-da8xx.c
··· 10 10 * the Free Software Foundation; either version 2 of the License, or 11 11 * (at your option) any later version. 12 12 */ 13 + #include <linux/ahci_platform.h> 14 + #include <linux/clk-provider.h> 15 + #include <linux/clk.h> 16 + #include <linux/clkdev.h> 17 + #include <linux/dma-contiguous.h> 18 + #include <linux/dmaengine.h> 13 19 #include <linux/init.h> 14 20 #include <linux/platform_device.h> 15 - #include <linux/dma-contiguous.h> 16 - #include <linux/serial_8250.h> 17 - #include <linux/ahci_platform.h> 18 - #include <linux/clk.h> 19 21 #include <linux/reboot.h> 20 - #include <linux/dmaengine.h> 22 + #include <linux/serial_8250.h> 21 23 22 - #include <mach/cputype.h> 23 24 #include <mach/common.h> 24 - #include <mach/time.h> 25 + #include <mach/cputype.h> 25 26 #include <mach/da8xx.h> 26 - #include <mach/clock.h> 27 + #include <mach/time.h> 28 + 29 + #include "asp.h" 27 30 #include "cpuidle.h" 28 31 #include "sram.h" 29 - 30 - #include "clock.h" 31 - #include "asp.h" 32 32 33 33 #define DA8XX_TPCC_BASE 0x01c00000 34 34 #define DA8XX_TPTC0_BASE 0x01c08000 ··· 1040 1040 } 1041 1041 1042 1042 #ifdef CONFIG_ARCH_DAVINCI_DA850 1043 - static struct clk sata_refclk = { 1044 - .name = "sata_refclk", 1045 - .set_rate = davinci_simple_set_rate, 1046 - }; 1047 - 1048 - static struct clk_lookup sata_refclk_lookup = 1049 - CLK("ahci_da850", "refclk", &sata_refclk); 1050 - 1051 1043 int __init da850_register_sata_refclk(int rate) 1052 1044 { 1053 - int ret; 1045 + struct clk *clk; 1054 1046 1055 - sata_refclk.rate = rate; 1056 - ret = clk_register(&sata_refclk); 1057 - if (ret) 1058 - return ret; 1047 + clk = clk_register_fixed_rate(NULL, "sata_refclk", NULL, 0, rate); 1048 + if (IS_ERR(clk)) 1049 + return PTR_ERR(clk); 1059 1050 1060 - clkdev_add(&sata_refclk_lookup); 1061 - 1062 - return 0; 1051 + return clk_register_clkdev(clk, "refclk", "ahci_da850"); 1063 1052 } 1064 1053 1065 1054 static struct resource da850_sata_resources[] = {
-1
arch/arm/mach-davinci/devices.c
··· 26 26 27 27 28 28 #include "davinci.h" 29 - #include "clock.h" 30 29 31 30 #define DAVINCI_I2C_BASE 0x01C21000 32 31 #define DAVINCI_ATA_BASE 0x01C66000
+50 -362
arch/arm/mach-davinci/dm355.c
··· 8 8 * is licensed "as is" without any warranty of any kind, whether express 9 9 * or implied. 10 10 */ 11 - #include <linux/init.h> 12 - #include <linux/clk.h> 13 - #include <linux/serial_8250.h> 14 - #include <linux/platform_device.h> 11 + 12 + #include <linux/clk-provider.h> 13 + #include <linux/clk/davinci.h> 14 + #include <linux/clkdev.h> 15 15 #include <linux/dma-mapping.h> 16 16 #include <linux/dmaengine.h> 17 - #include <linux/spi/spi.h> 17 + #include <linux/init.h> 18 18 #include <linux/platform_data/edma.h> 19 19 #include <linux/platform_data/gpio-davinci.h> 20 20 #include <linux/platform_data/spi-davinci.h> 21 + #include <linux/platform_device.h> 22 + #include <linux/serial_8250.h> 23 + #include <linux/spi/spi.h> 21 24 22 25 #include <asm/mach/map.h> 23 26 24 - #include <mach/cputype.h> 25 - #include "psc.h" 26 - #include <mach/mux.h> 27 - #include <mach/irqs.h> 28 - #include <mach/time.h> 29 - #include <mach/serial.h> 30 27 #include <mach/common.h> 28 + #include <mach/cputype.h> 29 + #include <mach/irqs.h> 30 + #include <mach/mux.h> 31 + #include <mach/serial.h> 32 + #include <mach/time.h> 31 33 32 - #include "davinci.h" 33 - #include "clock.h" 34 - #include "mux.h" 35 34 #include "asp.h" 35 + #include "davinci.h" 36 + #include "mux.h" 36 37 37 38 #define DM355_UART2_BASE (IO_PHYS + 0x206000) 38 39 #define DM355_OSD_BASE (IO_PHYS + 0x70200) ··· 43 42 * Device specific clocks 44 43 */ 45 44 #define DM355_REF_FREQ 24000000 /* 24 or 36 MHz */ 46 - 47 - static struct pll_data pll1_data = { 48 - .num = 1, 49 - .phys_base = DAVINCI_PLL1_BASE, 50 - .flags = PLL_HAS_PREDIV | PLL_HAS_POSTDIV, 51 - }; 52 - 53 - static struct pll_data pll2_data = { 54 - .num = 2, 55 - .phys_base = DAVINCI_PLL2_BASE, 56 - .flags = PLL_HAS_PREDIV, 57 - }; 58 - 59 - static struct clk ref_clk = { 60 - .name = "ref_clk", 61 - /* FIXME -- crystal rate is board-specific */ 62 - .rate = DM355_REF_FREQ, 63 - }; 64 - 65 - static struct clk pll1_clk = { 66 - .name = "pll1", 67 - .parent = &ref_clk, 68 - .flags = CLK_PLL, 69 - .pll_data = &pll1_data, 70 - }; 71 - 72 - static struct clk pll1_aux_clk = { 73 - .name = "pll1_aux_clk", 74 - .parent = &pll1_clk, 75 - .flags = CLK_PLL | PRE_PLL, 76 - }; 77 - 78 - static struct clk pll1_sysclk1 = { 79 - .name = "pll1_sysclk1", 80 - .parent = &pll1_clk, 81 - .flags = CLK_PLL, 82 - .div_reg = PLLDIV1, 83 - }; 84 - 85 - static struct clk pll1_sysclk2 = { 86 - .name = "pll1_sysclk2", 87 - .parent = &pll1_clk, 88 - .flags = CLK_PLL, 89 - .div_reg = PLLDIV2, 90 - }; 91 - 92 - static struct clk pll1_sysclk3 = { 93 - .name = "pll1_sysclk3", 94 - .parent = &pll1_clk, 95 - .flags = CLK_PLL, 96 - .div_reg = PLLDIV3, 97 - }; 98 - 99 - static struct clk pll1_sysclk4 = { 100 - .name = "pll1_sysclk4", 101 - .parent = &pll1_clk, 102 - .flags = CLK_PLL, 103 - .div_reg = PLLDIV4, 104 - }; 105 - 106 - static struct clk pll1_sysclkbp = { 107 - .name = "pll1_sysclkbp", 108 - .parent = &pll1_clk, 109 - .flags = CLK_PLL | PRE_PLL, 110 - .div_reg = BPDIV 111 - }; 112 - 113 - static struct clk vpss_dac_clk = { 114 - .name = "vpss_dac", 115 - .parent = &pll1_sysclk3, 116 - .lpsc = DM355_LPSC_VPSS_DAC, 117 - }; 118 - 119 - static struct clk vpss_master_clk = { 120 - .name = "vpss_master", 121 - .parent = &pll1_sysclk4, 122 - .lpsc = DAVINCI_LPSC_VPSSMSTR, 123 - .flags = CLK_PSC, 124 - }; 125 - 126 - static struct clk vpss_slave_clk = { 127 - .name = "vpss_slave", 128 - .parent = &pll1_sysclk4, 129 - .lpsc = DAVINCI_LPSC_VPSSSLV, 130 - }; 131 - 132 - static struct clk clkout1_clk = { 133 - .name = "clkout1", 134 - .parent = &pll1_aux_clk, 135 - /* NOTE: clkout1 can be externally gated by muxing GPIO-18 */ 136 - }; 137 - 138 - static struct clk clkout2_clk = { 139 - .name = "clkout2", 140 - .parent = &pll1_sysclkbp, 141 - }; 142 - 143 - static struct clk pll2_clk = { 144 - .name = "pll2", 145 - .parent = &ref_clk, 146 - .flags = CLK_PLL, 147 - .pll_data = &pll2_data, 148 - }; 149 - 150 - static struct clk pll2_sysclk1 = { 151 - .name = "pll2_sysclk1", 152 - .parent = &pll2_clk, 153 - .flags = CLK_PLL, 154 - .div_reg = PLLDIV1, 155 - }; 156 - 157 - static struct clk pll2_sysclkbp = { 158 - .name = "pll2_sysclkbp", 159 - .parent = &pll2_clk, 160 - .flags = CLK_PLL | PRE_PLL, 161 - .div_reg = BPDIV 162 - }; 163 - 164 - static struct clk clkout3_clk = { 165 - .name = "clkout3", 166 - .parent = &pll2_sysclkbp, 167 - /* NOTE: clkout3 can be externally gated by muxing GPIO-16 */ 168 - }; 169 - 170 - static struct clk arm_clk = { 171 - .name = "arm_clk", 172 - .parent = &pll1_sysclk1, 173 - .lpsc = DAVINCI_LPSC_ARM, 174 - .flags = ALWAYS_ENABLED, 175 - }; 176 - 177 - /* 178 - * NOT LISTED below, and not touched by Linux 179 - * - in SyncReset state by default 180 - * .lpsc = DAVINCI_LPSC_TPCC, 181 - * .lpsc = DAVINCI_LPSC_TPTC0, 182 - * .lpsc = DAVINCI_LPSC_TPTC1, 183 - * .lpsc = DAVINCI_LPSC_DDR_EMIF, .parent = &sysclk2_clk, 184 - * .lpsc = DAVINCI_LPSC_MEMSTICK, 185 - * - in Enabled state by default 186 - * .lpsc = DAVINCI_LPSC_SYSTEM_SUBSYS, 187 - * .lpsc = DAVINCI_LPSC_SCR2, // "bus" 188 - * .lpsc = DAVINCI_LPSC_SCR3, // "bus" 189 - * .lpsc = DAVINCI_LPSC_SCR4, // "bus" 190 - * .lpsc = DAVINCI_LPSC_CROSSBAR, // "emulation" 191 - * .lpsc = DAVINCI_LPSC_CFG27, // "test" 192 - * .lpsc = DAVINCI_LPSC_CFG3, // "test" 193 - * .lpsc = DAVINCI_LPSC_CFG5, // "test" 194 - */ 195 - 196 - static struct clk mjcp_clk = { 197 - .name = "mjcp", 198 - .parent = &pll1_sysclk1, 199 - .lpsc = DAVINCI_LPSC_IMCOP, 200 - }; 201 - 202 - static struct clk uart0_clk = { 203 - .name = "uart0", 204 - .parent = &pll1_aux_clk, 205 - .lpsc = DAVINCI_LPSC_UART0, 206 - }; 207 - 208 - static struct clk uart1_clk = { 209 - .name = "uart1", 210 - .parent = &pll1_aux_clk, 211 - .lpsc = DAVINCI_LPSC_UART1, 212 - }; 213 - 214 - static struct clk uart2_clk = { 215 - .name = "uart2", 216 - .parent = &pll1_sysclk2, 217 - .lpsc = DAVINCI_LPSC_UART2, 218 - }; 219 - 220 - static struct clk i2c_clk = { 221 - .name = "i2c", 222 - .parent = &pll1_aux_clk, 223 - .lpsc = DAVINCI_LPSC_I2C, 224 - }; 225 - 226 - static struct clk asp0_clk = { 227 - .name = "asp0", 228 - .parent = &pll1_sysclk2, 229 - .lpsc = DAVINCI_LPSC_McBSP, 230 - }; 231 - 232 - static struct clk asp1_clk = { 233 - .name = "asp1", 234 - .parent = &pll1_sysclk2, 235 - .lpsc = DM355_LPSC_McBSP1, 236 - }; 237 - 238 - static struct clk mmcsd0_clk = { 239 - .name = "mmcsd0", 240 - .parent = &pll1_sysclk2, 241 - .lpsc = DAVINCI_LPSC_MMC_SD, 242 - }; 243 - 244 - static struct clk mmcsd1_clk = { 245 - .name = "mmcsd1", 246 - .parent = &pll1_sysclk2, 247 - .lpsc = DM355_LPSC_MMC_SD1, 248 - }; 249 - 250 - static struct clk spi0_clk = { 251 - .name = "spi0", 252 - .parent = &pll1_sysclk2, 253 - .lpsc = DAVINCI_LPSC_SPI, 254 - }; 255 - 256 - static struct clk spi1_clk = { 257 - .name = "spi1", 258 - .parent = &pll1_sysclk2, 259 - .lpsc = DM355_LPSC_SPI1, 260 - }; 261 - 262 - static struct clk spi2_clk = { 263 - .name = "spi2", 264 - .parent = &pll1_sysclk2, 265 - .lpsc = DM355_LPSC_SPI2, 266 - }; 267 - 268 - static struct clk gpio_clk = { 269 - .name = "gpio", 270 - .parent = &pll1_sysclk2, 271 - .lpsc = DAVINCI_LPSC_GPIO, 272 - }; 273 - 274 - static struct clk aemif_clk = { 275 - .name = "aemif", 276 - .parent = &pll1_sysclk2, 277 - .lpsc = DAVINCI_LPSC_AEMIF, 278 - }; 279 - 280 - static struct clk pwm0_clk = { 281 - .name = "pwm0", 282 - .parent = &pll1_aux_clk, 283 - .lpsc = DAVINCI_LPSC_PWM0, 284 - }; 285 - 286 - static struct clk pwm1_clk = { 287 - .name = "pwm1", 288 - .parent = &pll1_aux_clk, 289 - .lpsc = DAVINCI_LPSC_PWM1, 290 - }; 291 - 292 - static struct clk pwm2_clk = { 293 - .name = "pwm2", 294 - .parent = &pll1_aux_clk, 295 - .lpsc = DAVINCI_LPSC_PWM2, 296 - }; 297 - 298 - static struct clk pwm3_clk = { 299 - .name = "pwm3", 300 - .parent = &pll1_aux_clk, 301 - .lpsc = DM355_LPSC_PWM3, 302 - }; 303 - 304 - static struct clk timer0_clk = { 305 - .name = "timer0", 306 - .parent = &pll1_aux_clk, 307 - .lpsc = DAVINCI_LPSC_TIMER0, 308 - }; 309 - 310 - static struct clk timer1_clk = { 311 - .name = "timer1", 312 - .parent = &pll1_aux_clk, 313 - .lpsc = DAVINCI_LPSC_TIMER1, 314 - }; 315 - 316 - static struct clk timer2_clk = { 317 - .name = "timer2", 318 - .parent = &pll1_aux_clk, 319 - .lpsc = DAVINCI_LPSC_TIMER2, 320 - .usecount = 1, /* REVISIT: why can't this be disabled? */ 321 - }; 322 - 323 - static struct clk timer3_clk = { 324 - .name = "timer3", 325 - .parent = &pll1_aux_clk, 326 - .lpsc = DM355_LPSC_TIMER3, 327 - }; 328 - 329 - static struct clk rto_clk = { 330 - .name = "rto", 331 - .parent = &pll1_aux_clk, 332 - .lpsc = DM355_LPSC_RTO, 333 - }; 334 - 335 - static struct clk usb_clk = { 336 - .name = "usb", 337 - .parent = &pll1_sysclk2, 338 - .lpsc = DAVINCI_LPSC_USB, 339 - }; 340 - 341 - static struct clk_lookup dm355_clks[] = { 342 - CLK(NULL, "ref", &ref_clk), 343 - CLK(NULL, "pll1", &pll1_clk), 344 - CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), 345 - CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), 346 - CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 347 - CLK(NULL, "pll1_sysclk4", &pll1_sysclk4), 348 - CLK(NULL, "pll1_aux", &pll1_aux_clk), 349 - CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), 350 - CLK(NULL, "vpss_dac", &vpss_dac_clk), 351 - CLK("vpss", "master", &vpss_master_clk), 352 - CLK("vpss", "slave", &vpss_slave_clk), 353 - CLK(NULL, "clkout1", &clkout1_clk), 354 - CLK(NULL, "clkout2", &clkout2_clk), 355 - CLK(NULL, "pll2", &pll2_clk), 356 - CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), 357 - CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp), 358 - CLK(NULL, "clkout3", &clkout3_clk), 359 - CLK(NULL, "arm", &arm_clk), 360 - CLK(NULL, "mjcp", &mjcp_clk), 361 - CLK("serial8250.0", NULL, &uart0_clk), 362 - CLK("serial8250.1", NULL, &uart1_clk), 363 - CLK("serial8250.2", NULL, &uart2_clk), 364 - CLK("i2c_davinci.1", NULL, &i2c_clk), 365 - CLK("davinci-mcbsp.0", NULL, &asp0_clk), 366 - CLK("davinci-mcbsp.1", NULL, &asp1_clk), 367 - CLK("dm6441-mmc.0", NULL, &mmcsd0_clk), 368 - CLK("dm6441-mmc.1", NULL, &mmcsd1_clk), 369 - CLK("spi_davinci.0", NULL, &spi0_clk), 370 - CLK("spi_davinci.1", NULL, &spi1_clk), 371 - CLK("spi_davinci.2", NULL, &spi2_clk), 372 - CLK(NULL, "gpio", &gpio_clk), 373 - CLK(NULL, "aemif", &aemif_clk), 374 - CLK(NULL, "pwm0", &pwm0_clk), 375 - CLK(NULL, "pwm1", &pwm1_clk), 376 - CLK(NULL, "pwm2", &pwm2_clk), 377 - CLK(NULL, "pwm3", &pwm3_clk), 378 - CLK(NULL, "timer0", &timer0_clk), 379 - CLK(NULL, "timer1", &timer1_clk), 380 - CLK("davinci-wdt", NULL, &timer2_clk), 381 - CLK(NULL, "timer3", &timer3_clk), 382 - CLK(NULL, "rto", &rto_clk), 383 - CLK(NULL, "usb", &usb_clk), 384 - CLK(NULL, NULL, NULL), 385 - }; 386 - 387 - /*----------------------------------------------------------------------*/ 388 45 389 46 static u64 dm355_spi0_dma_mask = DMA_BIT_MASK(32); 390 47 ··· 585 926 }, 586 927 }; 587 928 588 - static u32 dm355_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE }; 589 - 590 929 /* 591 930 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 592 931 * T0_TOP: Timer 0, top : clocksource for generic timekeeping ··· 669 1012 .jtag_id_reg = 0x01c40028, 670 1013 .ids = dm355_ids, 671 1014 .ids_num = ARRAY_SIZE(dm355_ids), 672 - .psc_bases = dm355_psc_bases, 673 - .psc_bases_num = ARRAY_SIZE(dm355_psc_bases), 674 1015 .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, 675 1016 .pinmux_pins = dm355_pins, 676 1017 .pinmux_pins_num = ARRAY_SIZE(dm355_pins), ··· 701 1046 702 1047 void __init dm355_init_time(void) 703 1048 { 704 - davinci_clk_init(dm355_clks); 705 - davinci_timer_init(); 1049 + void __iomem *pll1, *psc; 1050 + struct clk *clk; 1051 + 1052 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM355_REF_FREQ); 1053 + 1054 + pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K); 1055 + dm355_pll1_init(NULL, pll1, NULL); 1056 + 1057 + psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K); 1058 + dm355_psc_init(NULL, psc); 1059 + 1060 + clk = clk_get(NULL, "timer0"); 1061 + 1062 + davinci_timer_init(clk); 1063 + } 1064 + 1065 + static struct resource dm355_pll2_resources[] = { 1066 + { 1067 + .start = DAVINCI_PLL2_BASE, 1068 + .end = DAVINCI_PLL2_BASE + SZ_1K - 1, 1069 + .flags = IORESOURCE_MEM, 1070 + }, 1071 + }; 1072 + 1073 + static struct platform_device dm355_pll2_device = { 1074 + .name = "dm355-pll2", 1075 + .id = -1, 1076 + .resource = dm355_pll2_resources, 1077 + .num_resources = ARRAY_SIZE(dm355_pll2_resources), 1078 + }; 1079 + 1080 + void __init dm355_register_clocks(void) 1081 + { 1082 + /* PLL1 and PSC are registered in dm355_init_time() */ 1083 + platform_device_register(&dm355_pll2_device); 706 1084 } 707 1085 708 1086 int __init dm355_init_video(struct vpfe_config *vpfe_cfg,
+37 -454
arch/arm/mach-davinci/dm365.c
··· 12 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 13 * GNU General Public License for more details. 14 14 */ 15 - #include <linux/init.h> 16 - #include <linux/clk.h> 17 - #include <linux/serial_8250.h> 18 - #include <linux/platform_device.h> 15 + 16 + #include <linux/clk-provider.h> 17 + #include <linux/clk/davinci.h> 18 + #include <linux/clkdev.h> 19 19 #include <linux/dma-mapping.h> 20 20 #include <linux/dmaengine.h> 21 - #include <linux/spi/spi.h> 21 + #include <linux/init.h> 22 22 #include <linux/platform_data/edma.h> 23 23 #include <linux/platform_data/gpio-davinci.h> 24 24 #include <linux/platform_data/keyscan-davinci.h> 25 25 #include <linux/platform_data/spi-davinci.h> 26 + #include <linux/platform_device.h> 27 + #include <linux/serial_8250.h> 28 + #include <linux/spi/spi.h> 26 29 27 30 #include <asm/mach/map.h> 28 31 29 - #include <mach/cputype.h> 30 - #include "psc.h" 31 - #include <mach/mux.h> 32 - #include <mach/irqs.h> 33 - #include <mach/time.h> 34 - #include <mach/serial.h> 35 32 #include <mach/common.h> 33 + #include <mach/cputype.h> 34 + #include <mach/irqs.h> 35 + #include <mach/mux.h> 36 + #include <mach/serial.h> 37 + #include <mach/time.h> 36 38 37 - #include "davinci.h" 38 - #include "clock.h" 39 - #include "mux.h" 40 39 #include "asp.h" 40 + #include "davinci.h" 41 + #include "mux.h" 41 42 42 43 #define DM365_REF_FREQ 24000000 /* 24 MHz on the DM365 EVM */ 43 44 #define DM365_RTC_BASE 0x01c69000 ··· 54 53 #define DM365_EMAC_CNTRL_MOD_OFFSET 0x3000 55 54 #define DM365_EMAC_CNTRL_RAM_OFFSET 0x1000 56 55 #define DM365_EMAC_CNTRL_RAM_SIZE 0x2000 57 - 58 - static struct pll_data pll1_data = { 59 - .num = 1, 60 - .phys_base = DAVINCI_PLL1_BASE, 61 - .flags = PLL_HAS_POSTDIV | PLL_HAS_PREDIV, 62 - }; 63 - 64 - static struct pll_data pll2_data = { 65 - .num = 2, 66 - .phys_base = DAVINCI_PLL2_BASE, 67 - .flags = PLL_HAS_POSTDIV | PLL_HAS_PREDIV, 68 - }; 69 - 70 - static struct clk ref_clk = { 71 - .name = "ref_clk", 72 - .rate = DM365_REF_FREQ, 73 - }; 74 - 75 - static struct clk pll1_clk = { 76 - .name = "pll1", 77 - .parent = &ref_clk, 78 - .flags = CLK_PLL, 79 - .pll_data = &pll1_data, 80 - }; 81 - 82 - static struct clk pll1_aux_clk = { 83 - .name = "pll1_aux_clk", 84 - .parent = &pll1_clk, 85 - .flags = CLK_PLL | PRE_PLL, 86 - }; 87 - 88 - static struct clk pll1_sysclkbp = { 89 - .name = "pll1_sysclkbp", 90 - .parent = &pll1_clk, 91 - .flags = CLK_PLL | PRE_PLL, 92 - .div_reg = BPDIV 93 - }; 94 - 95 - static struct clk clkout0_clk = { 96 - .name = "clkout0", 97 - .parent = &pll1_clk, 98 - .flags = CLK_PLL | PRE_PLL, 99 - }; 100 - 101 - static struct clk pll1_sysclk1 = { 102 - .name = "pll1_sysclk1", 103 - .parent = &pll1_clk, 104 - .flags = CLK_PLL, 105 - .div_reg = PLLDIV1, 106 - }; 107 - 108 - static struct clk pll1_sysclk2 = { 109 - .name = "pll1_sysclk2", 110 - .parent = &pll1_clk, 111 - .flags = CLK_PLL, 112 - .div_reg = PLLDIV2, 113 - }; 114 - 115 - static struct clk pll1_sysclk3 = { 116 - .name = "pll1_sysclk3", 117 - .parent = &pll1_clk, 118 - .flags = CLK_PLL, 119 - .div_reg = PLLDIV3, 120 - }; 121 - 122 - static struct clk pll1_sysclk4 = { 123 - .name = "pll1_sysclk4", 124 - .parent = &pll1_clk, 125 - .flags = CLK_PLL, 126 - .div_reg = PLLDIV4, 127 - }; 128 - 129 - static struct clk pll1_sysclk5 = { 130 - .name = "pll1_sysclk5", 131 - .parent = &pll1_clk, 132 - .flags = CLK_PLL, 133 - .div_reg = PLLDIV5, 134 - }; 135 - 136 - static struct clk pll1_sysclk6 = { 137 - .name = "pll1_sysclk6", 138 - .parent = &pll1_clk, 139 - .flags = CLK_PLL, 140 - .div_reg = PLLDIV6, 141 - }; 142 - 143 - static struct clk pll1_sysclk7 = { 144 - .name = "pll1_sysclk7", 145 - .parent = &pll1_clk, 146 - .flags = CLK_PLL, 147 - .div_reg = PLLDIV7, 148 - }; 149 - 150 - static struct clk pll1_sysclk8 = { 151 - .name = "pll1_sysclk8", 152 - .parent = &pll1_clk, 153 - .flags = CLK_PLL, 154 - .div_reg = PLLDIV8, 155 - }; 156 - 157 - static struct clk pll1_sysclk9 = { 158 - .name = "pll1_sysclk9", 159 - .parent = &pll1_clk, 160 - .flags = CLK_PLL, 161 - .div_reg = PLLDIV9, 162 - }; 163 - 164 - static struct clk pll2_clk = { 165 - .name = "pll2", 166 - .parent = &ref_clk, 167 - .flags = CLK_PLL, 168 - .pll_data = &pll2_data, 169 - }; 170 - 171 - static struct clk pll2_aux_clk = { 172 - .name = "pll2_aux_clk", 173 - .parent = &pll2_clk, 174 - .flags = CLK_PLL | PRE_PLL, 175 - }; 176 - 177 - static struct clk clkout1_clk = { 178 - .name = "clkout1", 179 - .parent = &pll2_clk, 180 - .flags = CLK_PLL | PRE_PLL, 181 - }; 182 - 183 - static struct clk pll2_sysclk1 = { 184 - .name = "pll2_sysclk1", 185 - .parent = &pll2_clk, 186 - .flags = CLK_PLL, 187 - .div_reg = PLLDIV1, 188 - }; 189 - 190 - static struct clk pll2_sysclk2 = { 191 - .name = "pll2_sysclk2", 192 - .parent = &pll2_clk, 193 - .flags = CLK_PLL, 194 - .div_reg = PLLDIV2, 195 - }; 196 - 197 - static struct clk pll2_sysclk3 = { 198 - .name = "pll2_sysclk3", 199 - .parent = &pll2_clk, 200 - .flags = CLK_PLL, 201 - .div_reg = PLLDIV3, 202 - }; 203 - 204 - static struct clk pll2_sysclk4 = { 205 - .name = "pll2_sysclk4", 206 - .parent = &pll2_clk, 207 - .flags = CLK_PLL, 208 - .div_reg = PLLDIV4, 209 - }; 210 - 211 - static struct clk pll2_sysclk5 = { 212 - .name = "pll2_sysclk5", 213 - .parent = &pll2_clk, 214 - .flags = CLK_PLL, 215 - .div_reg = PLLDIV5, 216 - }; 217 - 218 - static struct clk pll2_sysclk6 = { 219 - .name = "pll2_sysclk6", 220 - .parent = &pll2_clk, 221 - .flags = CLK_PLL, 222 - .div_reg = PLLDIV6, 223 - }; 224 - 225 - static struct clk pll2_sysclk7 = { 226 - .name = "pll2_sysclk7", 227 - .parent = &pll2_clk, 228 - .flags = CLK_PLL, 229 - .div_reg = PLLDIV7, 230 - }; 231 - 232 - static struct clk pll2_sysclk8 = { 233 - .name = "pll2_sysclk8", 234 - .parent = &pll2_clk, 235 - .flags = CLK_PLL, 236 - .div_reg = PLLDIV8, 237 - }; 238 - 239 - static struct clk pll2_sysclk9 = { 240 - .name = "pll2_sysclk9", 241 - .parent = &pll2_clk, 242 - .flags = CLK_PLL, 243 - .div_reg = PLLDIV9, 244 - }; 245 - 246 - static struct clk vpss_dac_clk = { 247 - .name = "vpss_dac", 248 - .parent = &pll1_sysclk3, 249 - .lpsc = DM365_LPSC_DAC_CLK, 250 - }; 251 - 252 - static struct clk vpss_master_clk = { 253 - .name = "vpss_master", 254 - .parent = &pll1_sysclk5, 255 - .lpsc = DM365_LPSC_VPSSMSTR, 256 - .flags = CLK_PSC, 257 - }; 258 - 259 - static struct clk vpss_slave_clk = { 260 - .name = "vpss_slave", 261 - .parent = &pll1_sysclk5, 262 - .lpsc = DAVINCI_LPSC_VPSSSLV, 263 - }; 264 - 265 - static struct clk arm_clk = { 266 - .name = "arm_clk", 267 - .parent = &pll2_sysclk2, 268 - .lpsc = DAVINCI_LPSC_ARM, 269 - .flags = ALWAYS_ENABLED, 270 - }; 271 - 272 - static struct clk uart0_clk = { 273 - .name = "uart0", 274 - .parent = &pll1_aux_clk, 275 - .lpsc = DAVINCI_LPSC_UART0, 276 - }; 277 - 278 - static struct clk uart1_clk = { 279 - .name = "uart1", 280 - .parent = &pll1_sysclk4, 281 - .lpsc = DAVINCI_LPSC_UART1, 282 - }; 283 - 284 - static struct clk i2c_clk = { 285 - .name = "i2c", 286 - .parent = &pll1_aux_clk, 287 - .lpsc = DAVINCI_LPSC_I2C, 288 - }; 289 - 290 - static struct clk mmcsd0_clk = { 291 - .name = "mmcsd0", 292 - .parent = &pll1_sysclk8, 293 - .lpsc = DAVINCI_LPSC_MMC_SD, 294 - }; 295 - 296 - static struct clk mmcsd1_clk = { 297 - .name = "mmcsd1", 298 - .parent = &pll1_sysclk4, 299 - .lpsc = DM365_LPSC_MMC_SD1, 300 - }; 301 - 302 - static struct clk spi0_clk = { 303 - .name = "spi0", 304 - .parent = &pll1_sysclk4, 305 - .lpsc = DAVINCI_LPSC_SPI, 306 - }; 307 - 308 - static struct clk spi1_clk = { 309 - .name = "spi1", 310 - .parent = &pll1_sysclk4, 311 - .lpsc = DM365_LPSC_SPI1, 312 - }; 313 - 314 - static struct clk spi2_clk = { 315 - .name = "spi2", 316 - .parent = &pll1_sysclk4, 317 - .lpsc = DM365_LPSC_SPI2, 318 - }; 319 - 320 - static struct clk spi3_clk = { 321 - .name = "spi3", 322 - .parent = &pll1_sysclk4, 323 - .lpsc = DM365_LPSC_SPI3, 324 - }; 325 - 326 - static struct clk spi4_clk = { 327 - .name = "spi4", 328 - .parent = &pll1_aux_clk, 329 - .lpsc = DM365_LPSC_SPI4, 330 - }; 331 - 332 - static struct clk gpio_clk = { 333 - .name = "gpio", 334 - .parent = &pll1_sysclk4, 335 - .lpsc = DAVINCI_LPSC_GPIO, 336 - }; 337 - 338 - static struct clk aemif_clk = { 339 - .name = "aemif", 340 - .parent = &pll1_sysclk4, 341 - .lpsc = DAVINCI_LPSC_AEMIF, 342 - }; 343 - 344 - static struct clk pwm0_clk = { 345 - .name = "pwm0", 346 - .parent = &pll1_aux_clk, 347 - .lpsc = DAVINCI_LPSC_PWM0, 348 - }; 349 - 350 - static struct clk pwm1_clk = { 351 - .name = "pwm1", 352 - .parent = &pll1_aux_clk, 353 - .lpsc = DAVINCI_LPSC_PWM1, 354 - }; 355 - 356 - static struct clk pwm2_clk = { 357 - .name = "pwm2", 358 - .parent = &pll1_aux_clk, 359 - .lpsc = DAVINCI_LPSC_PWM2, 360 - }; 361 - 362 - static struct clk pwm3_clk = { 363 - .name = "pwm3", 364 - .parent = &ref_clk, 365 - .lpsc = DM365_LPSC_PWM3, 366 - }; 367 - 368 - static struct clk timer0_clk = { 369 - .name = "timer0", 370 - .parent = &pll1_aux_clk, 371 - .lpsc = DAVINCI_LPSC_TIMER0, 372 - }; 373 - 374 - static struct clk timer1_clk = { 375 - .name = "timer1", 376 - .parent = &pll1_aux_clk, 377 - .lpsc = DAVINCI_LPSC_TIMER1, 378 - }; 379 - 380 - static struct clk timer2_clk = { 381 - .name = "timer2", 382 - .parent = &pll1_aux_clk, 383 - .lpsc = DAVINCI_LPSC_TIMER2, 384 - .usecount = 1, 385 - }; 386 - 387 - static struct clk timer3_clk = { 388 - .name = "timer3", 389 - .parent = &pll1_aux_clk, 390 - .lpsc = DM365_LPSC_TIMER3, 391 - }; 392 - 393 - static struct clk usb_clk = { 394 - .name = "usb", 395 - .parent = &pll1_aux_clk, 396 - .lpsc = DAVINCI_LPSC_USB, 397 - }; 398 - 399 - static struct clk emac_clk = { 400 - .name = "emac", 401 - .parent = &pll1_sysclk4, 402 - .lpsc = DM365_LPSC_EMAC, 403 - }; 404 - 405 - static struct clk voicecodec_clk = { 406 - .name = "voice_codec", 407 - .parent = &pll2_sysclk4, 408 - .lpsc = DM365_LPSC_VOICE_CODEC, 409 - }; 410 - 411 - static struct clk asp0_clk = { 412 - .name = "asp0", 413 - .parent = &pll1_sysclk4, 414 - .lpsc = DM365_LPSC_McBSP1, 415 - }; 416 - 417 - static struct clk rto_clk = { 418 - .name = "rto", 419 - .parent = &pll1_sysclk4, 420 - .lpsc = DM365_LPSC_RTO, 421 - }; 422 - 423 - static struct clk mjcp_clk = { 424 - .name = "mjcp", 425 - .parent = &pll1_sysclk3, 426 - .lpsc = DM365_LPSC_MJCP, 427 - }; 428 - 429 - static struct clk_lookup dm365_clks[] = { 430 - CLK(NULL, "ref", &ref_clk), 431 - CLK(NULL, "pll1", &pll1_clk), 432 - CLK(NULL, "pll1_aux", &pll1_aux_clk), 433 - CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), 434 - CLK(NULL, "clkout0", &clkout0_clk), 435 - CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), 436 - CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), 437 - CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 438 - CLK(NULL, "pll1_sysclk4", &pll1_sysclk4), 439 - CLK(NULL, "pll1_sysclk5", &pll1_sysclk5), 440 - CLK(NULL, "pll1_sysclk6", &pll1_sysclk6), 441 - CLK(NULL, "pll1_sysclk7", &pll1_sysclk7), 442 - CLK(NULL, "pll1_sysclk8", &pll1_sysclk8), 443 - CLK(NULL, "pll1_sysclk9", &pll1_sysclk9), 444 - CLK(NULL, "pll2", &pll2_clk), 445 - CLK(NULL, "pll2_aux", &pll2_aux_clk), 446 - CLK(NULL, "clkout1", &clkout1_clk), 447 - CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), 448 - CLK(NULL, "pll2_sysclk2", &pll2_sysclk2), 449 - CLK(NULL, "pll2_sysclk3", &pll2_sysclk3), 450 - CLK(NULL, "pll2_sysclk4", &pll2_sysclk4), 451 - CLK(NULL, "pll2_sysclk5", &pll2_sysclk5), 452 - CLK(NULL, "pll2_sysclk6", &pll2_sysclk6), 453 - CLK(NULL, "pll2_sysclk7", &pll2_sysclk7), 454 - CLK(NULL, "pll2_sysclk8", &pll2_sysclk8), 455 - CLK(NULL, "pll2_sysclk9", &pll2_sysclk9), 456 - CLK(NULL, "vpss_dac", &vpss_dac_clk), 457 - CLK("vpss", "master", &vpss_master_clk), 458 - CLK("vpss", "slave", &vpss_slave_clk), 459 - CLK(NULL, "arm", &arm_clk), 460 - CLK("serial8250.0", NULL, &uart0_clk), 461 - CLK("serial8250.1", NULL, &uart1_clk), 462 - CLK("i2c_davinci.1", NULL, &i2c_clk), 463 - CLK("da830-mmc.0", NULL, &mmcsd0_clk), 464 - CLK("da830-mmc.1", NULL, &mmcsd1_clk), 465 - CLK("spi_davinci.0", NULL, &spi0_clk), 466 - CLK("spi_davinci.1", NULL, &spi1_clk), 467 - CLK("spi_davinci.2", NULL, &spi2_clk), 468 - CLK("spi_davinci.3", NULL, &spi3_clk), 469 - CLK("spi_davinci.4", NULL, &spi4_clk), 470 - CLK(NULL, "gpio", &gpio_clk), 471 - CLK(NULL, "aemif", &aemif_clk), 472 - CLK(NULL, "pwm0", &pwm0_clk), 473 - CLK(NULL, "pwm1", &pwm1_clk), 474 - CLK(NULL, "pwm2", &pwm2_clk), 475 - CLK(NULL, "pwm3", &pwm3_clk), 476 - CLK(NULL, "timer0", &timer0_clk), 477 - CLK(NULL, "timer1", &timer1_clk), 478 - CLK("davinci-wdt", NULL, &timer2_clk), 479 - CLK(NULL, "timer3", &timer3_clk), 480 - CLK(NULL, "usb", &usb_clk), 481 - CLK("davinci_emac.1", NULL, &emac_clk), 482 - CLK("davinci_mdio.0", "fck", &emac_clk), 483 - CLK("davinci_voicecodec", NULL, &voicecodec_clk), 484 - CLK("davinci-mcbsp", NULL, &asp0_clk), 485 - CLK(NULL, "rto", &rto_clk), 486 - CLK(NULL, "mjcp", &mjcp_clk), 487 - CLK(NULL, NULL, NULL), 488 - }; 489 - 490 - /*----------------------------------------------------------------------*/ 491 56 492 57 #define INTMUX 0x18 493 58 #define EVTMUX 0x1c ··· 621 1054 }, 622 1055 }; 623 1056 624 - static u32 dm365_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE }; 625 - 626 1057 static struct davinci_timer_info dm365_timer_info = { 627 1058 .timers = davinci_timer_instance, 628 1059 .clockevent_id = T0_BOT, ··· 681 1116 .jtag_id_reg = 0x01c40028, 682 1117 .ids = dm365_ids, 683 1118 .ids_num = ARRAY_SIZE(dm365_ids), 684 - .psc_bases = dm365_psc_bases, 685 - .psc_bases_num = ARRAY_SIZE(dm365_psc_bases), 686 1119 .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, 687 1120 .pinmux_pins = dm365_pins, 688 1121 .pinmux_pins_num = ARRAY_SIZE(dm365_pins), ··· 734 1171 735 1172 void __init dm365_init_time(void) 736 1173 { 737 - davinci_clk_init(dm365_clks); 738 - davinci_timer_init(); 1174 + void __iomem *pll1, *pll2, *psc; 1175 + struct clk *clk; 1176 + 1177 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM365_REF_FREQ); 1178 + 1179 + pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K); 1180 + dm365_pll1_init(NULL, pll1, NULL); 1181 + 1182 + pll2 = ioremap(DAVINCI_PLL2_BASE, SZ_1K); 1183 + dm365_pll2_init(NULL, pll2, NULL); 1184 + 1185 + psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K); 1186 + dm365_psc_init(NULL, psc); 1187 + 1188 + clk = clk_get(NULL, "timer0"); 1189 + 1190 + davinci_timer_init(clk); 1191 + } 1192 + 1193 + void __init dm365_register_clocks(void) 1194 + { 1195 + /* all clocks are currently registered in dm365_init_time() */ 739 1196 } 740 1197 741 1198 static struct resource dm365_vpss_resources[] = {
+46 -300
arch/arm/mach-davinci/dm644x.c
··· 8 8 * is licensed "as is" without any warranty of any kind, whether express 9 9 * or implied. 10 10 */ 11 - #include <linux/init.h> 12 - #include <linux/clk.h> 13 - #include <linux/serial_8250.h> 11 + 12 + #include <linux/clk-provider.h> 13 + #include <linux/clk/davinci.h> 14 + #include <linux/clkdev.h> 14 15 #include <linux/dmaengine.h> 15 - #include <linux/platform_device.h> 16 + #include <linux/init.h> 16 17 #include <linux/platform_data/edma.h> 17 18 #include <linux/platform_data/gpio-davinci.h> 19 + #include <linux/platform_device.h> 20 + #include <linux/serial_8250.h> 18 21 19 22 #include <asm/mach/map.h> 20 23 24 + #include <mach/common.h> 21 25 #include <mach/cputype.h> 22 26 #include <mach/irqs.h> 23 - #include "psc.h" 24 27 #include <mach/mux.h> 25 - #include <mach/time.h> 26 28 #include <mach/serial.h> 27 - #include <mach/common.h> 29 + #include <mach/time.h> 28 30 29 - #include "davinci.h" 30 - #include "clock.h" 31 - #include "mux.h" 32 31 #include "asp.h" 32 + #include "davinci.h" 33 + #include "mux.h" 33 34 34 35 /* 35 36 * Device specific clocks ··· 43 42 #define DM644X_EMAC_CNTRL_MOD_OFFSET 0x1000 44 43 #define DM644X_EMAC_CNTRL_RAM_OFFSET 0x2000 45 44 #define DM644X_EMAC_CNTRL_RAM_SIZE 0x2000 46 - 47 - static struct pll_data pll1_data = { 48 - .num = 1, 49 - .phys_base = DAVINCI_PLL1_BASE, 50 - }; 51 - 52 - static struct pll_data pll2_data = { 53 - .num = 2, 54 - .phys_base = DAVINCI_PLL2_BASE, 55 - }; 56 - 57 - static struct clk ref_clk = { 58 - .name = "ref_clk", 59 - .rate = DM644X_REF_FREQ, 60 - }; 61 - 62 - static struct clk pll1_clk = { 63 - .name = "pll1", 64 - .parent = &ref_clk, 65 - .pll_data = &pll1_data, 66 - .flags = CLK_PLL, 67 - }; 68 - 69 - static struct clk pll1_sysclk1 = { 70 - .name = "pll1_sysclk1", 71 - .parent = &pll1_clk, 72 - .flags = CLK_PLL, 73 - .div_reg = PLLDIV1, 74 - }; 75 - 76 - static struct clk pll1_sysclk2 = { 77 - .name = "pll1_sysclk2", 78 - .parent = &pll1_clk, 79 - .flags = CLK_PLL, 80 - .div_reg = PLLDIV2, 81 - }; 82 - 83 - static struct clk pll1_sysclk3 = { 84 - .name = "pll1_sysclk3", 85 - .parent = &pll1_clk, 86 - .flags = CLK_PLL, 87 - .div_reg = PLLDIV3, 88 - }; 89 - 90 - static struct clk pll1_sysclk5 = { 91 - .name = "pll1_sysclk5", 92 - .parent = &pll1_clk, 93 - .flags = CLK_PLL, 94 - .div_reg = PLLDIV5, 95 - }; 96 - 97 - static struct clk pll1_aux_clk = { 98 - .name = "pll1_aux_clk", 99 - .parent = &pll1_clk, 100 - .flags = CLK_PLL | PRE_PLL, 101 - }; 102 - 103 - static struct clk pll1_sysclkbp = { 104 - .name = "pll1_sysclkbp", 105 - .parent = &pll1_clk, 106 - .flags = CLK_PLL | PRE_PLL, 107 - .div_reg = BPDIV 108 - }; 109 - 110 - static struct clk pll2_clk = { 111 - .name = "pll2", 112 - .parent = &ref_clk, 113 - .pll_data = &pll2_data, 114 - .flags = CLK_PLL, 115 - }; 116 - 117 - static struct clk pll2_sysclk1 = { 118 - .name = "pll2_sysclk1", 119 - .parent = &pll2_clk, 120 - .flags = CLK_PLL, 121 - .div_reg = PLLDIV1, 122 - }; 123 - 124 - static struct clk pll2_sysclk2 = { 125 - .name = "pll2_sysclk2", 126 - .parent = &pll2_clk, 127 - .flags = CLK_PLL, 128 - .div_reg = PLLDIV2, 129 - }; 130 - 131 - static struct clk pll2_sysclkbp = { 132 - .name = "pll2_sysclkbp", 133 - .parent = &pll2_clk, 134 - .flags = CLK_PLL | PRE_PLL, 135 - .div_reg = BPDIV 136 - }; 137 - 138 - static struct clk dsp_clk = { 139 - .name = "dsp", 140 - .parent = &pll1_sysclk1, 141 - .lpsc = DAVINCI_LPSC_GEM, 142 - .domain = DAVINCI_GPSC_DSPDOMAIN, 143 - .usecount = 1, /* REVISIT how to disable? */ 144 - }; 145 - 146 - static struct clk arm_clk = { 147 - .name = "arm", 148 - .parent = &pll1_sysclk2, 149 - .lpsc = DAVINCI_LPSC_ARM, 150 - .flags = ALWAYS_ENABLED, 151 - }; 152 - 153 - static struct clk vicp_clk = { 154 - .name = "vicp", 155 - .parent = &pll1_sysclk2, 156 - .lpsc = DAVINCI_LPSC_IMCOP, 157 - .domain = DAVINCI_GPSC_DSPDOMAIN, 158 - .usecount = 1, /* REVISIT how to disable? */ 159 - }; 160 - 161 - static struct clk vpss_master_clk = { 162 - .name = "vpss_master", 163 - .parent = &pll1_sysclk3, 164 - .lpsc = DAVINCI_LPSC_VPSSMSTR, 165 - .flags = CLK_PSC, 166 - }; 167 - 168 - static struct clk vpss_slave_clk = { 169 - .name = "vpss_slave", 170 - .parent = &pll1_sysclk3, 171 - .lpsc = DAVINCI_LPSC_VPSSSLV, 172 - }; 173 - 174 - static struct clk uart0_clk = { 175 - .name = "uart0", 176 - .parent = &pll1_aux_clk, 177 - .lpsc = DAVINCI_LPSC_UART0, 178 - }; 179 - 180 - static struct clk uart1_clk = { 181 - .name = "uart1", 182 - .parent = &pll1_aux_clk, 183 - .lpsc = DAVINCI_LPSC_UART1, 184 - }; 185 - 186 - static struct clk uart2_clk = { 187 - .name = "uart2", 188 - .parent = &pll1_aux_clk, 189 - .lpsc = DAVINCI_LPSC_UART2, 190 - }; 191 - 192 - static struct clk emac_clk = { 193 - .name = "emac", 194 - .parent = &pll1_sysclk5, 195 - .lpsc = DAVINCI_LPSC_EMAC_WRAPPER, 196 - }; 197 - 198 - static struct clk i2c_clk = { 199 - .name = "i2c", 200 - .parent = &pll1_aux_clk, 201 - .lpsc = DAVINCI_LPSC_I2C, 202 - }; 203 - 204 - static struct clk ide_clk = { 205 - .name = "ide", 206 - .parent = &pll1_sysclk5, 207 - .lpsc = DAVINCI_LPSC_ATA, 208 - }; 209 - 210 - static struct clk asp_clk = { 211 - .name = "asp0", 212 - .parent = &pll1_sysclk5, 213 - .lpsc = DAVINCI_LPSC_McBSP, 214 - }; 215 - 216 - static struct clk mmcsd_clk = { 217 - .name = "mmcsd", 218 - .parent = &pll1_sysclk5, 219 - .lpsc = DAVINCI_LPSC_MMC_SD, 220 - }; 221 - 222 - static struct clk spi_clk = { 223 - .name = "spi", 224 - .parent = &pll1_sysclk5, 225 - .lpsc = DAVINCI_LPSC_SPI, 226 - }; 227 - 228 - static struct clk gpio_clk = { 229 - .name = "gpio", 230 - .parent = &pll1_sysclk5, 231 - .lpsc = DAVINCI_LPSC_GPIO, 232 - }; 233 - 234 - static struct clk usb_clk = { 235 - .name = "usb", 236 - .parent = &pll1_sysclk5, 237 - .lpsc = DAVINCI_LPSC_USB, 238 - }; 239 - 240 - static struct clk vlynq_clk = { 241 - .name = "vlynq", 242 - .parent = &pll1_sysclk5, 243 - .lpsc = DAVINCI_LPSC_VLYNQ, 244 - }; 245 - 246 - static struct clk aemif_clk = { 247 - .name = "aemif", 248 - .parent = &pll1_sysclk5, 249 - .lpsc = DAVINCI_LPSC_AEMIF, 250 - }; 251 - 252 - static struct clk pwm0_clk = { 253 - .name = "pwm0", 254 - .parent = &pll1_aux_clk, 255 - .lpsc = DAVINCI_LPSC_PWM0, 256 - }; 257 - 258 - static struct clk pwm1_clk = { 259 - .name = "pwm1", 260 - .parent = &pll1_aux_clk, 261 - .lpsc = DAVINCI_LPSC_PWM1, 262 - }; 263 - 264 - static struct clk pwm2_clk = { 265 - .name = "pwm2", 266 - .parent = &pll1_aux_clk, 267 - .lpsc = DAVINCI_LPSC_PWM2, 268 - }; 269 - 270 - static struct clk timer0_clk = { 271 - .name = "timer0", 272 - .parent = &pll1_aux_clk, 273 - .lpsc = DAVINCI_LPSC_TIMER0, 274 - }; 275 - 276 - static struct clk timer1_clk = { 277 - .name = "timer1", 278 - .parent = &pll1_aux_clk, 279 - .lpsc = DAVINCI_LPSC_TIMER1, 280 - }; 281 - 282 - static struct clk timer2_clk = { 283 - .name = "timer2", 284 - .parent = &pll1_aux_clk, 285 - .lpsc = DAVINCI_LPSC_TIMER2, 286 - .usecount = 1, /* REVISIT: why can't this be disabled? */ 287 - }; 288 - 289 - static struct clk_lookup dm644x_clks[] = { 290 - CLK(NULL, "ref", &ref_clk), 291 - CLK(NULL, "pll1", &pll1_clk), 292 - CLK(NULL, "pll1_sysclk1", &pll1_sysclk1), 293 - CLK(NULL, "pll1_sysclk2", &pll1_sysclk2), 294 - CLK(NULL, "pll1_sysclk3", &pll1_sysclk3), 295 - CLK(NULL, "pll1_sysclk5", &pll1_sysclk5), 296 - CLK(NULL, "pll1_aux", &pll1_aux_clk), 297 - CLK(NULL, "pll1_sysclkbp", &pll1_sysclkbp), 298 - CLK(NULL, "pll2", &pll2_clk), 299 - CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), 300 - CLK(NULL, "pll2_sysclk2", &pll2_sysclk2), 301 - CLK(NULL, "pll2_sysclkbp", &pll2_sysclkbp), 302 - CLK(NULL, "dsp", &dsp_clk), 303 - CLK(NULL, "arm", &arm_clk), 304 - CLK(NULL, "vicp", &vicp_clk), 305 - CLK("vpss", "master", &vpss_master_clk), 306 - CLK("vpss", "slave", &vpss_slave_clk), 307 - CLK(NULL, "arm", &arm_clk), 308 - CLK("serial8250.0", NULL, &uart0_clk), 309 - CLK("serial8250.1", NULL, &uart1_clk), 310 - CLK("serial8250.2", NULL, &uart2_clk), 311 - CLK("davinci_emac.1", NULL, &emac_clk), 312 - CLK("davinci_mdio.0", "fck", &emac_clk), 313 - CLK("i2c_davinci.1", NULL, &i2c_clk), 314 - CLK("palm_bk3710", NULL, &ide_clk), 315 - CLK("davinci-mcbsp", NULL, &asp_clk), 316 - CLK("dm6441-mmc.0", NULL, &mmcsd_clk), 317 - CLK(NULL, "spi", &spi_clk), 318 - CLK(NULL, "gpio", &gpio_clk), 319 - CLK(NULL, "usb", &usb_clk), 320 - CLK(NULL, "vlynq", &vlynq_clk), 321 - CLK(NULL, "aemif", &aemif_clk), 322 - CLK(NULL, "pwm0", &pwm0_clk), 323 - CLK(NULL, "pwm1", &pwm1_clk), 324 - CLK(NULL, "pwm2", &pwm2_clk), 325 - CLK(NULL, "timer0", &timer0_clk), 326 - CLK(NULL, "timer1", &timer1_clk), 327 - CLK("davinci-wdt", NULL, &timer2_clk), 328 - CLK(NULL, NULL, NULL), 329 - }; 330 45 331 46 static struct emac_platform_data dm644x_emac_pdata = { 332 47 .ctrl_reg_offset = DM644X_EMAC_CNTRL_OFFSET, ··· 536 819 }, 537 820 }; 538 821 539 - static u32 dm644x_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE }; 540 - 541 822 /* 542 823 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 543 824 * T0_TOP: Timer 0, top : clocksource for generic timekeeping ··· 620 905 .jtag_id_reg = 0x01c40028, 621 906 .ids = dm644x_ids, 622 907 .ids_num = ARRAY_SIZE(dm644x_ids), 623 - .psc_bases = dm644x_psc_bases, 624 - .psc_bases_num = ARRAY_SIZE(dm644x_psc_bases), 625 908 .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, 626 909 .pinmux_pins = dm644x_pins, 627 910 .pinmux_pins_num = ARRAY_SIZE(dm644x_pins), ··· 647 934 648 935 void __init dm644x_init_time(void) 649 936 { 650 - davinci_clk_init(dm644x_clks); 651 - davinci_timer_init(); 937 + void __iomem *pll1, *psc; 938 + struct clk *clk; 939 + 940 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM644X_REF_FREQ); 941 + 942 + pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K); 943 + dm644x_pll1_init(NULL, pll1, NULL); 944 + 945 + psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K); 946 + dm644x_psc_init(NULL, psc); 947 + 948 + clk = clk_get(NULL, "timer0"); 949 + 950 + davinci_timer_init(clk); 951 + } 952 + 953 + static struct resource dm644x_pll2_resources[] = { 954 + { 955 + .start = DAVINCI_PLL2_BASE, 956 + .end = DAVINCI_PLL2_BASE + SZ_1K - 1, 957 + .flags = IORESOURCE_MEM, 958 + }, 959 + }; 960 + 961 + static struct platform_device dm644x_pll2_device = { 962 + .name = "dm644x-pll2", 963 + .id = -1, 964 + .resource = dm644x_pll2_resources, 965 + .num_resources = ARRAY_SIZE(dm644x_pll2_resources), 966 + }; 967 + 968 + void __init dm644x_register_clocks(void) 969 + { 970 + /* PLL1 and PSC are registered in dm644x_init_time() */ 971 + platform_device_register(&dm644x_pll2_device); 652 972 } 653 973 654 974 int __init dm644x_init_video(struct vpfe_config *vpfe_cfg,
+46 -328
arch/arm/mach-davinci/dm646x.c
··· 8 8 * is licensed "as is" without any warranty of any kind, whether express 9 9 * or implied. 10 10 */ 11 + 12 + #include <linux/clk-provider.h> 13 + #include <linux/clk/davinci.h> 14 + #include <linux/clkdev.h> 11 15 #include <linux/dma-mapping.h> 12 16 #include <linux/dmaengine.h> 13 17 #include <linux/init.h> 14 - #include <linux/clk.h> 15 - #include <linux/serial_8250.h> 16 - #include <linux/platform_device.h> 17 18 #include <linux/platform_data/edma.h> 18 19 #include <linux/platform_data/gpio-davinci.h> 20 + #include <linux/platform_device.h> 21 + #include <linux/serial_8250.h> 19 22 20 23 #include <asm/mach/map.h> 21 24 25 + #include <mach/common.h> 22 26 #include <mach/cputype.h> 23 27 #include <mach/irqs.h> 24 - #include "psc.h" 25 28 #include <mach/mux.h> 26 - #include <mach/time.h> 27 29 #include <mach/serial.h> 28 - #include <mach/common.h> 30 + #include <mach/time.h> 29 31 30 - #include "davinci.h" 31 - #include "clock.h" 32 - #include "mux.h" 33 32 #include "asp.h" 33 + #include "davinci.h" 34 + #include "mux.h" 34 35 35 36 #define DAVINCI_VPIF_BASE (0x01C12000) 36 37 ··· 46 45 #define DM646X_EMAC_CNTRL_MOD_OFFSET 0x1000 47 46 #define DM646X_EMAC_CNTRL_RAM_OFFSET 0x2000 48 47 #define DM646X_EMAC_CNTRL_RAM_SIZE 0x2000 49 - 50 - static struct pll_data pll1_data = { 51 - .num = 1, 52 - .phys_base = DAVINCI_PLL1_BASE, 53 - }; 54 - 55 - static struct pll_data pll2_data = { 56 - .num = 2, 57 - .phys_base = DAVINCI_PLL2_BASE, 58 - }; 59 - 60 - static struct clk ref_clk = { 61 - .name = "ref_clk", 62 - /* rate is initialized in dm646x_init_time() */ 63 - }; 64 - 65 - static struct clk aux_clkin = { 66 - .name = "aux_clkin", 67 - /* rate is initialized in dm646x_init_time() */ 68 - }; 69 - 70 - static struct clk pll1_clk = { 71 - .name = "pll1", 72 - .parent = &ref_clk, 73 - .pll_data = &pll1_data, 74 - .flags = CLK_PLL, 75 - }; 76 - 77 - static struct clk pll1_sysclk1 = { 78 - .name = "pll1_sysclk1", 79 - .parent = &pll1_clk, 80 - .flags = CLK_PLL, 81 - .div_reg = PLLDIV1, 82 - }; 83 - 84 - static struct clk pll1_sysclk2 = { 85 - .name = "pll1_sysclk2", 86 - .parent = &pll1_clk, 87 - .flags = CLK_PLL, 88 - .div_reg = PLLDIV2, 89 - }; 90 - 91 - static struct clk pll1_sysclk3 = { 92 - .name = "pll1_sysclk3", 93 - .parent = &pll1_clk, 94 - .flags = CLK_PLL, 95 - .div_reg = PLLDIV3, 96 - }; 97 - 98 - static struct clk pll1_sysclk4 = { 99 - .name = "pll1_sysclk4", 100 - .parent = &pll1_clk, 101 - .flags = CLK_PLL, 102 - .div_reg = PLLDIV4, 103 - }; 104 - 105 - static struct clk pll1_sysclk5 = { 106 - .name = "pll1_sysclk5", 107 - .parent = &pll1_clk, 108 - .flags = CLK_PLL, 109 - .div_reg = PLLDIV5, 110 - }; 111 - 112 - static struct clk pll1_sysclk6 = { 113 - .name = "pll1_sysclk6", 114 - .parent = &pll1_clk, 115 - .flags = CLK_PLL, 116 - .div_reg = PLLDIV6, 117 - }; 118 - 119 - static struct clk pll1_sysclk8 = { 120 - .name = "pll1_sysclk8", 121 - .parent = &pll1_clk, 122 - .flags = CLK_PLL, 123 - .div_reg = PLLDIV8, 124 - }; 125 - 126 - static struct clk pll1_sysclk9 = { 127 - .name = "pll1_sysclk9", 128 - .parent = &pll1_clk, 129 - .flags = CLK_PLL, 130 - .div_reg = PLLDIV9, 131 - }; 132 - 133 - static struct clk pll1_sysclkbp = { 134 - .name = "pll1_sysclkbp", 135 - .parent = &pll1_clk, 136 - .flags = CLK_PLL | PRE_PLL, 137 - .div_reg = BPDIV, 138 - }; 139 - 140 - static struct clk pll1_aux_clk = { 141 - .name = "pll1_aux_clk", 142 - .parent = &pll1_clk, 143 - .flags = CLK_PLL | PRE_PLL, 144 - }; 145 - 146 - static struct clk pll2_clk = { 147 - .name = "pll2_clk", 148 - .parent = &ref_clk, 149 - .pll_data = &pll2_data, 150 - .flags = CLK_PLL, 151 - }; 152 - 153 - static struct clk pll2_sysclk1 = { 154 - .name = "pll2_sysclk1", 155 - .parent = &pll2_clk, 156 - .flags = CLK_PLL, 157 - .div_reg = PLLDIV1, 158 - }; 159 - 160 - static struct clk dsp_clk = { 161 - .name = "dsp", 162 - .parent = &pll1_sysclk1, 163 - .lpsc = DM646X_LPSC_C64X_CPU, 164 - .usecount = 1, /* REVISIT how to disable? */ 165 - }; 166 - 167 - static struct clk arm_clk = { 168 - .name = "arm", 169 - .parent = &pll1_sysclk2, 170 - .lpsc = DM646X_LPSC_ARM, 171 - .flags = ALWAYS_ENABLED, 172 - }; 173 - 174 - static struct clk edma_cc_clk = { 175 - .name = "edma_cc", 176 - .parent = &pll1_sysclk2, 177 - .lpsc = DM646X_LPSC_TPCC, 178 - .flags = ALWAYS_ENABLED, 179 - }; 180 - 181 - static struct clk edma_tc0_clk = { 182 - .name = "edma_tc0", 183 - .parent = &pll1_sysclk2, 184 - .lpsc = DM646X_LPSC_TPTC0, 185 - .flags = ALWAYS_ENABLED, 186 - }; 187 - 188 - static struct clk edma_tc1_clk = { 189 - .name = "edma_tc1", 190 - .parent = &pll1_sysclk2, 191 - .lpsc = DM646X_LPSC_TPTC1, 192 - .flags = ALWAYS_ENABLED, 193 - }; 194 - 195 - static struct clk edma_tc2_clk = { 196 - .name = "edma_tc2", 197 - .parent = &pll1_sysclk2, 198 - .lpsc = DM646X_LPSC_TPTC2, 199 - .flags = ALWAYS_ENABLED, 200 - }; 201 - 202 - static struct clk edma_tc3_clk = { 203 - .name = "edma_tc3", 204 - .parent = &pll1_sysclk2, 205 - .lpsc = DM646X_LPSC_TPTC3, 206 - .flags = ALWAYS_ENABLED, 207 - }; 208 - 209 - static struct clk uart0_clk = { 210 - .name = "uart0", 211 - .parent = &aux_clkin, 212 - .lpsc = DM646X_LPSC_UART0, 213 - }; 214 - 215 - static struct clk uart1_clk = { 216 - .name = "uart1", 217 - .parent = &aux_clkin, 218 - .lpsc = DM646X_LPSC_UART1, 219 - }; 220 - 221 - static struct clk uart2_clk = { 222 - .name = "uart2", 223 - .parent = &aux_clkin, 224 - .lpsc = DM646X_LPSC_UART2, 225 - }; 226 - 227 - static struct clk i2c_clk = { 228 - .name = "I2CCLK", 229 - .parent = &pll1_sysclk3, 230 - .lpsc = DM646X_LPSC_I2C, 231 - }; 232 - 233 - static struct clk gpio_clk = { 234 - .name = "gpio", 235 - .parent = &pll1_sysclk3, 236 - .lpsc = DM646X_LPSC_GPIO, 237 - }; 238 - 239 - static struct clk mcasp0_clk = { 240 - .name = "mcasp0", 241 - .parent = &pll1_sysclk3, 242 - .lpsc = DM646X_LPSC_McASP0, 243 - }; 244 - 245 - static struct clk mcasp1_clk = { 246 - .name = "mcasp1", 247 - .parent = &pll1_sysclk3, 248 - .lpsc = DM646X_LPSC_McASP1, 249 - }; 250 - 251 - static struct clk aemif_clk = { 252 - .name = "aemif", 253 - .parent = &pll1_sysclk3, 254 - .lpsc = DM646X_LPSC_AEMIF, 255 - .flags = ALWAYS_ENABLED, 256 - }; 257 - 258 - static struct clk emac_clk = { 259 - .name = "emac", 260 - .parent = &pll1_sysclk3, 261 - .lpsc = DM646X_LPSC_EMAC, 262 - }; 263 - 264 - static struct clk pwm0_clk = { 265 - .name = "pwm0", 266 - .parent = &pll1_sysclk3, 267 - .lpsc = DM646X_LPSC_PWM0, 268 - .usecount = 1, /* REVIST: disabling hangs system */ 269 - }; 270 - 271 - static struct clk pwm1_clk = { 272 - .name = "pwm1", 273 - .parent = &pll1_sysclk3, 274 - .lpsc = DM646X_LPSC_PWM1, 275 - .usecount = 1, /* REVIST: disabling hangs system */ 276 - }; 277 - 278 - static struct clk timer0_clk = { 279 - .name = "timer0", 280 - .parent = &pll1_sysclk3, 281 - .lpsc = DM646X_LPSC_TIMER0, 282 - }; 283 - 284 - static struct clk timer1_clk = { 285 - .name = "timer1", 286 - .parent = &pll1_sysclk3, 287 - .lpsc = DM646X_LPSC_TIMER1, 288 - }; 289 - 290 - static struct clk timer2_clk = { 291 - .name = "timer2", 292 - .parent = &pll1_sysclk3, 293 - .flags = ALWAYS_ENABLED, /* no LPSC, always enabled; c.f. spruep9a */ 294 - }; 295 - 296 - 297 - static struct clk ide_clk = { 298 - .name = "ide", 299 - .parent = &pll1_sysclk4, 300 - .lpsc = DAVINCI_LPSC_ATA, 301 - }; 302 - 303 - static struct clk vpif0_clk = { 304 - .name = "vpif0", 305 - .parent = &ref_clk, 306 - .lpsc = DM646X_LPSC_VPSSMSTR, 307 - .flags = ALWAYS_ENABLED, 308 - }; 309 - 310 - static struct clk vpif1_clk = { 311 - .name = "vpif1", 312 - .parent = &ref_clk, 313 - .lpsc = DM646X_LPSC_VPSSSLV, 314 - .flags = ALWAYS_ENABLED, 315 - }; 316 - 317 - static struct clk_lookup dm646x_clks[] = { 318 - CLK(NULL, "ref", &ref_clk), 319 - CLK(NULL, "aux", &aux_clkin), 320 - CLK(NULL, "pll1", &pll1_clk), 321 - CLK(NULL, "pll1_sysclk", &pll1_sysclk1), 322 - CLK(NULL, "pll1_sysclk", &pll1_sysclk2), 323 - CLK(NULL, "pll1_sysclk", &pll1_sysclk3), 324 - CLK(NULL, "pll1_sysclk", &pll1_sysclk4), 325 - CLK(NULL, "pll1_sysclk", &pll1_sysclk5), 326 - CLK(NULL, "pll1_sysclk", &pll1_sysclk6), 327 - CLK(NULL, "pll1_sysclk", &pll1_sysclk8), 328 - CLK(NULL, "pll1_sysclk", &pll1_sysclk9), 329 - CLK(NULL, "pll1_sysclk", &pll1_sysclkbp), 330 - CLK(NULL, "pll1_aux", &pll1_aux_clk), 331 - CLK(NULL, "pll2", &pll2_clk), 332 - CLK(NULL, "pll2_sysclk1", &pll2_sysclk1), 333 - CLK(NULL, "dsp", &dsp_clk), 334 - CLK(NULL, "arm", &arm_clk), 335 - CLK(NULL, "edma_cc", &edma_cc_clk), 336 - CLK(NULL, "edma_tc0", &edma_tc0_clk), 337 - CLK(NULL, "edma_tc1", &edma_tc1_clk), 338 - CLK(NULL, "edma_tc2", &edma_tc2_clk), 339 - CLK(NULL, "edma_tc3", &edma_tc3_clk), 340 - CLK("serial8250.0", NULL, &uart0_clk), 341 - CLK("serial8250.1", NULL, &uart1_clk), 342 - CLK("serial8250.2", NULL, &uart2_clk), 343 - CLK("i2c_davinci.1", NULL, &i2c_clk), 344 - CLK(NULL, "gpio", &gpio_clk), 345 - CLK("davinci-mcasp.0", NULL, &mcasp0_clk), 346 - CLK("davinci-mcasp.1", NULL, &mcasp1_clk), 347 - CLK(NULL, "aemif", &aemif_clk), 348 - CLK("davinci_emac.1", NULL, &emac_clk), 349 - CLK("davinci_mdio.0", "fck", &emac_clk), 350 - CLK(NULL, "pwm0", &pwm0_clk), 351 - CLK(NULL, "pwm1", &pwm1_clk), 352 - CLK(NULL, "timer0", &timer0_clk), 353 - CLK(NULL, "timer1", &timer1_clk), 354 - CLK("davinci-wdt", NULL, &timer2_clk), 355 - CLK("palm_bk3710", NULL, &ide_clk), 356 - CLK(NULL, "vpif0", &vpif0_clk), 357 - CLK(NULL, "vpif1", &vpif1_clk), 358 - CLK(NULL, NULL, NULL), 359 - }; 360 48 361 49 static struct emac_platform_data dm646x_emac_pdata = { 362 50 .ctrl_reg_offset = DM646X_EMAC_CNTRL_OFFSET, ··· 486 796 }, 487 797 }; 488 798 489 - static u32 dm646x_psc_bases[] = { DAVINCI_PWR_SLEEP_CNTRL_BASE }; 490 - 491 799 /* 492 800 * T0_BOT: Timer 0, bottom: clockevent source for hrtimers 493 801 * T0_TOP: Timer 0, top : clocksource for generic timekeeping ··· 570 882 .jtag_id_reg = 0x01c40028, 571 883 .ids = dm646x_ids, 572 884 .ids_num = ARRAY_SIZE(dm646x_ids), 573 - .psc_bases = dm646x_psc_bases, 574 - .psc_bases_num = ARRAY_SIZE(dm646x_psc_bases), 575 885 .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, 576 886 .pinmux_pins = dm646x_pins, 577 887 .pinmux_pins_num = ARRAY_SIZE(dm646x_pins), ··· 640 954 void __init dm646x_init_time(unsigned long ref_clk_rate, 641 955 unsigned long aux_clkin_rate) 642 956 { 643 - ref_clk.rate = ref_clk_rate; 644 - aux_clkin.rate = aux_clkin_rate; 645 - davinci_clk_init(dm646x_clks); 646 - davinci_timer_init(); 957 + void __iomem *pll1, *psc; 958 + struct clk *clk; 959 + 960 + clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, ref_clk_rate); 961 + clk_register_fixed_rate(NULL, "aux_clkin", NULL, 0, aux_clkin_rate); 962 + 963 + pll1 = ioremap(DAVINCI_PLL1_BASE, SZ_1K); 964 + dm646x_pll1_init(NULL, pll1, NULL); 965 + 966 + psc = ioremap(DAVINCI_PWR_SLEEP_CNTRL_BASE, SZ_4K); 967 + dm646x_psc_init(NULL, psc); 968 + 969 + clk = clk_get(NULL, "timer0"); 970 + 971 + davinci_timer_init(clk); 972 + } 973 + 974 + static struct resource dm646x_pll2_resources[] = { 975 + { 976 + .start = DAVINCI_PLL2_BASE, 977 + .end = DAVINCI_PLL2_BASE + SZ_1K - 1, 978 + .flags = IORESOURCE_MEM, 979 + }, 980 + }; 981 + 982 + static struct platform_device dm646x_pll2_device = { 983 + .name = "dm646x-pll2", 984 + .id = -1, 985 + .resource = dm646x_pll2_resources, 986 + .num_resources = ARRAY_SIZE(dm646x_pll2_resources), 987 + }; 988 + 989 + void __init dm646x_register_clocks(void) 990 + { 991 + /* PLL1 and PSC are registered in dm646x_init_time() */ 992 + platform_device_register(&dm646x_pll2_device); 647 993 } 648 994 649 995 static int __init dm646x_init_devices(void)
-3
arch/arm/mach-davinci/include/mach/clock.h
··· 15 15 16 16 struct clk; 17 17 18 - extern int clk_register(struct clk *clk); 19 - extern void clk_unregister(struct clk *clk); 20 - 21 18 int davinci_clk_reset_assert(struct clk *c); 22 19 int davinci_clk_reset_deassert(struct clk *c); 23 20
+2 -9
arch/arm/mach-davinci/include/mach/common.h
··· 12 12 #ifndef __ARCH_ARM_MACH_DAVINCI_COMMON_H 13 13 #define __ARCH_ARM_MACH_DAVINCI_COMMON_H 14 14 15 + #include <linux/clk.h> 15 16 #include <linux/compiler.h> 16 17 #include <linux/types.h> 17 18 #include <linux/reboot.h> 18 19 19 - extern void davinci_timer_init(void); 20 + void davinci_timer_init(struct clk *clk); 20 21 21 22 extern void davinci_irq_init(void); 22 23 extern void __iomem *davinci_intc_base; ··· 54 53 u32 jtag_id_reg; 55 54 struct davinci_id *ids; 56 55 unsigned long ids_num; 57 - u32 *psc_bases; 58 - unsigned long psc_bases_num; 59 56 u32 pinmux_base; 60 57 const struct mux_config *pinmux_pins; 61 58 unsigned long pinmux_pins_num; ··· 80 81 extern void davinci_common_init(const struct davinci_soc_info *soc_info); 81 82 extern void davinci_init_ide(void); 82 83 void davinci_init_late(void); 83 - 84 - #ifdef CONFIG_DAVINCI_RESET_CLOCKS 85 - int davinci_clk_disable_unused(void); 86 - #else 87 - static inline int davinci_clk_disable_unused(void) { return 0; } 88 - #endif 89 84 90 85 #ifdef CONFIG_CPU_FREQ 91 86 int davinci_cpufreq_init(void);
+3 -3
arch/arm/mach-davinci/include/mach/da8xx.h
··· 89 89 90 90 void da830_init(void); 91 91 void da830_init_time(void); 92 + void da830_register_clocks(void); 92 93 93 94 void da850_init(void); 94 95 void da850_init_time(void); 96 + void da850_register_clocks(void); 95 97 96 98 int da830_register_edma(struct edma_rsv_info *rsv); 97 99 int da850_register_edma(struct edma_rsv_info *rsv[2]); ··· 103 101 int da8xx_register_usb_phy(void); 104 102 int da8xx_register_usb20(unsigned mA, unsigned potpgt); 105 103 int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); 106 - int da8xx_register_usb_refclkin(int rate); 107 - int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); 108 - int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); 104 + int da8xx_register_usb_phy_clocks(void); 109 105 int da850_register_sata_refclk(int rate); 110 106 int da8xx_register_emac(void); 111 107 int da8xx_register_uio_pruss(void);
+5
arch/arm/mach-davinci/pm_domain.c
··· 13 13 #include <linux/pm_runtime.h> 14 14 #include <linux/pm_clock.h> 15 15 #include <linux/platform_device.h> 16 + #include <linux/of.h> 16 17 17 18 static struct dev_pm_domain davinci_pm_domain = { 18 19 .ops = { ··· 29 28 30 29 static int __init davinci_pm_runtime_init(void) 31 30 { 31 + if (of_have_populated_dt()) 32 + return 0; 33 + 34 + /* Use pm_clk as fallback if we're not using genpd. */ 32 35 pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier); 33 36 34 37 return 0;
-137
arch/arm/mach-davinci/psc.c
··· 1 - /* 2 - * TI DaVinci Power and Sleep Controller (PSC) 3 - * 4 - * Copyright (C) 2006 Texas Instruments. 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; either version 2 of the License, or 9 - * (at your option) any later version. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - * 16 - * You should have received a copy of the GNU General Public License 17 - * along with this program; if not, write to the Free Software 18 - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 - * 20 - */ 21 - #include <linux/kernel.h> 22 - #include <linux/init.h> 23 - #include <linux/io.h> 24 - 25 - #include <mach/cputype.h> 26 - #include "psc.h" 27 - 28 - #include "clock.h" 29 - 30 - /* Return nonzero iff the domain's clock is active */ 31 - int __init davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id) 32 - { 33 - void __iomem *psc_base; 34 - u32 mdstat; 35 - struct davinci_soc_info *soc_info = &davinci_soc_info; 36 - 37 - if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { 38 - pr_warn("PSC: Bad psc data: 0x%x[%d]\n", 39 - (int)soc_info->psc_bases, ctlr); 40 - return 0; 41 - } 42 - 43 - psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); 44 - mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 45 - iounmap(psc_base); 46 - 47 - /* if clocked, state can be "Enable" or "SyncReset" */ 48 - return mdstat & BIT(12); 49 - } 50 - 51 - /* Control "reset" line associated with PSC domain */ 52 - void davinci_psc_reset(unsigned int ctlr, unsigned int id, bool reset) 53 - { 54 - u32 mdctl; 55 - void __iomem *psc_base; 56 - struct davinci_soc_info *soc_info = &davinci_soc_info; 57 - 58 - if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { 59 - pr_warn("PSC: Bad psc data: 0x%x[%d]\n", 60 - (int)soc_info->psc_bases, ctlr); 61 - return; 62 - } 63 - 64 - psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); 65 - 66 - mdctl = readl(psc_base + MDCTL + 4 * id); 67 - if (reset) 68 - mdctl &= ~MDCTL_LRST; 69 - else 70 - mdctl |= MDCTL_LRST; 71 - writel(mdctl, psc_base + MDCTL + 4 * id); 72 - 73 - iounmap(psc_base); 74 - } 75 - 76 - /* Enable or disable a PSC domain */ 77 - void davinci_psc_config(unsigned int domain, unsigned int ctlr, 78 - unsigned int id, bool enable, u32 flags) 79 - { 80 - u32 epcpr, ptcmd, ptstat, pdstat, pdctl, mdstat, mdctl; 81 - void __iomem *psc_base; 82 - struct davinci_soc_info *soc_info = &davinci_soc_info; 83 - u32 next_state = PSC_STATE_ENABLE; 84 - 85 - if (!soc_info->psc_bases || (ctlr >= soc_info->psc_bases_num)) { 86 - pr_warn("PSC: Bad psc data: 0x%x[%d]\n", 87 - (int)soc_info->psc_bases, ctlr); 88 - return; 89 - } 90 - 91 - psc_base = ioremap(soc_info->psc_bases[ctlr], SZ_4K); 92 - 93 - if (!enable) { 94 - if (flags & PSC_SWRSTDISABLE) 95 - next_state = PSC_STATE_SWRSTDISABLE; 96 - else 97 - next_state = PSC_STATE_DISABLE; 98 - } 99 - 100 - mdctl = __raw_readl(psc_base + MDCTL + 4 * id); 101 - mdctl &= ~MDSTAT_STATE_MASK; 102 - mdctl |= next_state; 103 - if (flags & PSC_FORCE) 104 - mdctl |= MDCTL_FORCE; 105 - __raw_writel(mdctl, psc_base + MDCTL + 4 * id); 106 - 107 - pdstat = __raw_readl(psc_base + PDSTAT + 4 * domain); 108 - if ((pdstat & PDSTAT_STATE_MASK) == 0) { 109 - pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); 110 - pdctl |= PDCTL_NEXT; 111 - __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); 112 - 113 - ptcmd = 1 << domain; 114 - __raw_writel(ptcmd, psc_base + PTCMD); 115 - 116 - do { 117 - epcpr = __raw_readl(psc_base + EPCPR); 118 - } while ((((epcpr >> domain) & 1) == 0)); 119 - 120 - pdctl = __raw_readl(psc_base + PDCTL + 4 * domain); 121 - pdctl |= PDCTL_EPCGOOD; 122 - __raw_writel(pdctl, psc_base + PDCTL + 4 * domain); 123 - } else { 124 - ptcmd = 1 << domain; 125 - __raw_writel(ptcmd, psc_base + PTCMD); 126 - } 127 - 128 - do { 129 - ptstat = __raw_readl(psc_base + PTSTAT); 130 - } while (!(((ptstat >> domain) & 1) == 0)); 131 - 132 - do { 133 - mdstat = __raw_readl(psc_base + MDSTAT + 4 * id); 134 - } while (!((mdstat & MDSTAT_STATE_MASK) == next_state)); 135 - 136 - iounmap(psc_base); 137 - }
-12
arch/arm/mach-davinci/psc.h
··· 27 27 #ifndef __ASM_ARCH_PSC_H 28 28 #define __ASM_ARCH_PSC_H 29 29 30 - #define DAVINCI_PWR_SLEEP_CNTRL_BASE 0x01C41000 31 - 32 30 /* Power and Sleep Controller (PSC) Domains */ 33 31 #define DAVINCI_GPSC_ARMDOMAIN 0 34 32 #define DAVINCI_GPSC_DSPDOMAIN 1 ··· 203 205 #define MDCTL_FORCE BIT(31) 204 206 #define PDCTL_NEXT BIT(0) 205 207 #define PDCTL_EPCGOOD BIT(8) 206 - 207 - #ifndef __ASSEMBLER__ 208 - 209 - extern int davinci_psc_is_clk_active(unsigned int ctlr, unsigned int id); 210 - extern void davinci_psc_reset(unsigned int ctlr, unsigned int id, 211 - bool reset); 212 - extern void davinci_psc_config(unsigned int domain, unsigned int ctlr, 213 - unsigned int id, bool enable, u32 flags); 214 - 215 - #endif 216 208 217 209 #endif /* __ASM_ARCH_PSC_H */
+16 -6
arch/arm/mach-davinci/time.c
··· 17 17 #include <linux/io.h> 18 18 #include <linux/clk.h> 19 19 #include <linux/err.h> 20 + #include <linux/of.h> 20 21 #include <linux/platform_device.h> 21 22 #include <linux/sched_clock.h> 22 23 ··· 27 26 #include <mach/cputype.h> 28 27 #include <mach/hardware.h> 29 28 #include <mach/time.h> 30 - 31 - #include "clock.h" 32 29 33 30 static struct clock_event_device clockevent_davinci; 34 31 static unsigned int davinci_clock_tick_rate; ··· 333 334 .set_state_oneshot = davinci_set_oneshot, 334 335 }; 335 336 336 - 337 - void __init davinci_timer_init(void) 337 + void __init davinci_timer_init(struct clk *timer_clk) 338 338 { 339 - struct clk *timer_clk; 340 339 struct davinci_soc_info *soc_info = &davinci_soc_info; 341 340 unsigned int clockevent_id; 342 341 unsigned int clocksource_id; ··· 370 373 } 371 374 } 372 375 373 - timer_clk = clk_get(NULL, "timer0"); 374 376 BUG_ON(IS_ERR(timer_clk)); 375 377 clk_prepare_enable(timer_clk); 376 378 ··· 398 402 for (i=0; i< ARRAY_SIZE(timers); i++) 399 403 timer32_config(&timers[i]); 400 404 } 405 + 406 + static int __init of_davinci_timer_init(struct device_node *np) 407 + { 408 + struct clk *clk; 409 + 410 + clk = of_clk_get(np, 0); 411 + if (IS_ERR(clk)) 412 + return PTR_ERR(clk); 413 + 414 + davinci_timer_init(clk); 415 + 416 + return 0; 417 + } 418 + TIMER_OF_DECLARE(davinci_timer, "ti,da830-timer", of_davinci_timer_init);
+13 -229
arch/arm/mach-davinci/usb-da8xx.c
··· 2 2 /* 3 3 * DA8xx USB 4 4 */ 5 - #include <linux/clk.h> 5 + #include <linux/clk-provider.h> 6 6 #include <linux/delay.h> 7 7 #include <linux/dma-mapping.h> 8 8 #include <linux/init.h> 9 9 #include <linux/mfd/da8xx-cfgchip.h> 10 + #include <linux/mfd/syscon.h> 10 11 #include <linux/phy/phy.h> 12 + #include <linux/platform_data/clk-da8xx-cfgchip.h> 11 13 #include <linux/platform_data/phy-da8xx-usb.h> 12 14 #include <linux/platform_data/usb-davinci.h> 13 15 #include <linux/platform_device.h> 14 16 #include <linux/usb/musb.h> 15 17 16 - #include <mach/clock.h> 17 18 #include <mach/common.h> 18 19 #include <mach/cputype.h> 19 20 #include <mach/da8xx.h> 20 21 #include <mach/irqs.h> 21 22 22 - #include "clock.h" 23 - 24 23 #define DA8XX_USB0_BASE 0x01e00000 25 24 #define DA8XX_USB1_BASE 0x01e25000 26 25 26 + #ifndef CONFIG_COMMON_CLK 27 27 static struct clk *usb20_clk; 28 + #endif 28 29 29 30 static struct da8xx_usb_phy_platform_data da8xx_usb_phy_pdata; 30 31 ··· 82 81 .name = "musb-da8xx", 83 82 .id = -1, 84 83 .dev = { 85 - /* 86 - * Setting init_name so that clock lookup will work in 87 - * usb20_phy_clk_enable() even if this device is not registered. 88 - */ 89 - .init_name = "musb-da8xx", 90 84 .platform_data = &usb_data, 91 85 .dma_mask = &usb_dmamask, 92 86 .coherent_dma_mask = DMA_BIT_MASK(32), ··· 130 134 return platform_device_register(&da8xx_usb11_device); 131 135 } 132 136 133 - static struct clk usb_refclkin = { 134 - .name = "usb_refclkin", 135 - .set_rate = davinci_simple_set_rate, 137 + static struct platform_device da8xx_usb_phy_clks_device = { 138 + .name = "da830-usb-phy-clks", 139 + .id = -1, 136 140 }; 137 141 138 - static struct clk_lookup usb_refclkin_lookup = 139 - CLK(NULL, "usb_refclkin", &usb_refclkin); 140 - 141 - /** 142 - * da8xx_register_usb_refclkin - register USB_REFCLKIN clock 143 - * 144 - * @rate: The clock rate in Hz 145 - * 146 - * This clock is only needed if the board provides an external USB_REFCLKIN 147 - * signal, in which case it will be used as the parent of usb20_phy_clk and/or 148 - * usb11_phy_clk. 149 - */ 150 - int __init da8xx_register_usb_refclkin(int rate) 142 + int __init da8xx_register_usb_phy_clocks(void) 151 143 { 152 - int ret; 144 + struct da8xx_cfgchip_clk_platform_data pdata; 153 145 154 - usb_refclkin.rate = rate; 155 - ret = clk_register(&usb_refclkin); 156 - if (ret) 157 - return ret; 146 + pdata.cfgchip = da8xx_get_cfgchip(); 147 + da8xx_usb_phy_clks_device.dev.platform_data = &pdata; 158 148 159 - clkdev_add(&usb_refclkin_lookup); 160 - 161 - return 0; 162 - } 163 - 164 - static void usb20_phy_clk_enable(struct clk *clk) 165 - { 166 - u32 val; 167 - u32 timeout = 500000; /* 500 msec */ 168 - 169 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 170 - 171 - /* The USB 2.O PLL requires that the USB 2.O PSC is enabled as well. */ 172 - davinci_clk_enable(usb20_clk); 173 - 174 - /* 175 - * Turn on the USB 2.0 PHY, but just the PLL, and not OTG. The USB 1.1 176 - * host may use the PLL clock without USB 2.0 OTG being used. 177 - */ 178 - val &= ~(CFGCHIP2_RESET | CFGCHIP2_PHYPWRDN); 179 - val |= CFGCHIP2_PHY_PLLON; 180 - 181 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 182 - 183 - while (--timeout) { 184 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 185 - if (val & CFGCHIP2_PHYCLKGD) 186 - goto done; 187 - udelay(1); 188 - } 189 - 190 - pr_err("Timeout waiting for USB 2.0 PHY clock good\n"); 191 - done: 192 - davinci_clk_disable(usb20_clk); 193 - } 194 - 195 - static void usb20_phy_clk_disable(struct clk *clk) 196 - { 197 - u32 val; 198 - 199 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 200 - val |= CFGCHIP2_PHYPWRDN; 201 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 202 - } 203 - 204 - static int usb20_phy_clk_set_parent(struct clk *clk, struct clk *parent) 205 - { 206 - u32 val; 207 - 208 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 209 - 210 - /* Set the mux depending on the parent clock. */ 211 - if (parent == &usb_refclkin) { 212 - val &= ~CFGCHIP2_USB2PHYCLKMUX; 213 - } else if (strcmp(parent->name, "pll0_aux_clk") == 0) { 214 - val |= CFGCHIP2_USB2PHYCLKMUX; 215 - } else { 216 - pr_err("Bad parent on USB 2.0 PHY clock\n"); 217 - return -EINVAL; 218 - } 219 - 220 - /* reference frequency also comes from parent clock */ 221 - val &= ~CFGCHIP2_REFFREQ_MASK; 222 - switch (clk_get_rate(parent)) { 223 - case 12000000: 224 - val |= CFGCHIP2_REFFREQ_12MHZ; 225 - break; 226 - case 13000000: 227 - val |= CFGCHIP2_REFFREQ_13MHZ; 228 - break; 229 - case 19200000: 230 - val |= CFGCHIP2_REFFREQ_19_2MHZ; 231 - break; 232 - case 20000000: 233 - val |= CFGCHIP2_REFFREQ_20MHZ; 234 - break; 235 - case 24000000: 236 - val |= CFGCHIP2_REFFREQ_24MHZ; 237 - break; 238 - case 26000000: 239 - val |= CFGCHIP2_REFFREQ_26MHZ; 240 - break; 241 - case 38400000: 242 - val |= CFGCHIP2_REFFREQ_38_4MHZ; 243 - break; 244 - case 40000000: 245 - val |= CFGCHIP2_REFFREQ_40MHZ; 246 - break; 247 - case 48000000: 248 - val |= CFGCHIP2_REFFREQ_48MHZ; 249 - break; 250 - default: 251 - pr_err("Bad parent clock rate on USB 2.0 PHY clock\n"); 252 - return -EINVAL; 253 - } 254 - 255 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 256 - 257 - return 0; 258 - } 259 - 260 - static struct clk usb20_phy_clk = { 261 - .name = "usb0_clk48", 262 - .clk_enable = usb20_phy_clk_enable, 263 - .clk_disable = usb20_phy_clk_disable, 264 - .set_parent = usb20_phy_clk_set_parent, 265 - }; 266 - 267 - static struct clk_lookup usb20_phy_clk_lookup = 268 - CLK("da8xx-usb-phy", "usb0_clk48", &usb20_phy_clk); 269 - 270 - /** 271 - * da8xx_register_usb20_phy_clk - register USB0PHYCLKMUX clock 272 - * 273 - * @use_usb_refclkin: Selects the parent clock - either "usb_refclkin" if true 274 - * or "pll0_aux" if false. 275 - */ 276 - int __init da8xx_register_usb20_phy_clk(bool use_usb_refclkin) 277 - { 278 - struct clk *parent; 279 - int ret; 280 - 281 - usb20_clk = clk_get(&da8xx_usb20_dev.dev, "usb20"); 282 - ret = PTR_ERR_OR_ZERO(usb20_clk); 283 - if (ret) 284 - return ret; 285 - 286 - parent = clk_get(NULL, use_usb_refclkin ? "usb_refclkin" : "pll0_aux"); 287 - ret = PTR_ERR_OR_ZERO(parent); 288 - if (ret) { 289 - clk_put(usb20_clk); 290 - return ret; 291 - } 292 - 293 - usb20_phy_clk.parent = parent; 294 - ret = clk_register(&usb20_phy_clk); 295 - if (!ret) 296 - clkdev_add(&usb20_phy_clk_lookup); 297 - 298 - clk_put(parent); 299 - 300 - return ret; 301 - } 302 - 303 - static int usb11_phy_clk_set_parent(struct clk *clk, struct clk *parent) 304 - { 305 - u32 val; 306 - 307 - val = readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 308 - 309 - /* Set the USB 1.1 PHY clock mux based on the parent clock. */ 310 - if (parent == &usb20_phy_clk) { 311 - val &= ~CFGCHIP2_USB1PHYCLKMUX; 312 - } else if (parent == &usb_refclkin) { 313 - val |= CFGCHIP2_USB1PHYCLKMUX; 314 - } else { 315 - pr_err("Bad parent on USB 1.1 PHY clock\n"); 316 - return -EINVAL; 317 - } 318 - 319 - writel(val, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG)); 320 - 321 - return 0; 322 - } 323 - 324 - static struct clk usb11_phy_clk = { 325 - .name = "usb1_clk48", 326 - .set_parent = usb11_phy_clk_set_parent, 327 - }; 328 - 329 - static struct clk_lookup usb11_phy_clk_lookup = 330 - CLK("da8xx-usb-phy", "usb1_clk48", &usb11_phy_clk); 331 - 332 - /** 333 - * da8xx_register_usb11_phy_clk - register USB1PHYCLKMUX clock 334 - * 335 - * @use_usb_refclkin: Selects the parent clock - either "usb_refclkin" if true 336 - * or "usb0_clk48" if false. 337 - */ 338 - int __init da8xx_register_usb11_phy_clk(bool use_usb_refclkin) 339 - { 340 - struct clk *parent; 341 - int ret = 0; 342 - 343 - if (use_usb_refclkin) 344 - parent = clk_get(NULL, "usb_refclkin"); 345 - else 346 - parent = clk_get(&da8xx_usb_phy.dev, "usb0_clk48"); 347 - if (IS_ERR(parent)) 348 - return PTR_ERR(parent); 349 - 350 - usb11_phy_clk.parent = parent; 351 - ret = clk_register(&usb11_phy_clk); 352 - if (!ret) 353 - clkdev_add(&usb11_phy_clk_lookup); 354 - 355 - clk_put(parent); 356 - 357 - return ret; 149 + return platform_device_register(&da8xx_usb_phy_clks_device); 358 150 }
-2
arch/arm/mach-exynos/exynos.c
··· 190 190 } 191 191 192 192 DT_MACHINE_START(EXYNOS_DT, "SAMSUNG EXYNOS (Flattened Device Tree)") 193 - /* Maintainer: Thomas Abraham <thomas.abraham@linaro.org> */ 194 - /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ 195 193 .l2c_aux_val = 0x3c400001, 196 194 .l2c_aux_mask = 0xc20fffff, 197 195 .smp = smp_ops(exynos_smp_ops),
+1
arch/arm/mach-exynos/suspend.c
··· 203 203 NULL); 204 204 if (!domain) { 205 205 iounmap(pmu_base_addr); 206 + pmu_base_addr = NULL; 206 207 return -ENOMEM; 207 208 } 208 209
+26 -15
arch/arm/mach-hisi/hotplug.c
··· 148 148 struct device_node *node; 149 149 150 150 node = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl"); 151 - if (node) { 152 - ctrl_base = of_iomap(node, 0); 153 - id = HI3620_CTRL; 154 - return 0; 151 + if (!node) { 152 + id = ERROR_CTRL; 153 + return -ENOENT; 155 154 } 156 - id = ERROR_CTRL; 157 - return -ENOENT; 155 + 156 + ctrl_base = of_iomap(node, 0); 157 + of_node_put(node); 158 + if (!ctrl_base) { 159 + id = ERROR_CTRL; 160 + return -ENOMEM; 161 + } 162 + 163 + id = HI3620_CTRL; 164 + return 0; 158 165 } 159 166 160 167 void hi3xxx_set_cpu(int cpu, bool enable) ··· 180 173 struct device_node *np; 181 174 182 175 np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl"); 183 - if (np) { 184 - ctrl_base = of_iomap(np, 0); 185 - return true; 186 - } 187 - return false; 176 + if (!np) 177 + return false; 178 + 179 + ctrl_base = of_iomap(np, 0); 180 + of_node_put(np); 181 + if (!ctrl_base) 182 + return false; 183 + 184 + return true; 188 185 } 189 186 190 187 void hix5hd2_set_cpu(int cpu, bool enable) ··· 230 219 231 220 if (!ctrl_base) { 232 221 np = of_find_compatible_node(NULL, NULL, "hisilicon,hip01-sysctrl"); 233 - if (np) 234 - ctrl_base = of_iomap(np, 0); 235 - else 236 - BUG(); 222 + BUG_ON(!np); 223 + ctrl_base = of_iomap(np, 0); 224 + of_node_put(np); 225 + BUG_ON(!ctrl_base); 237 226 } 238 227 239 228 if (enable) {
+21 -12
arch/arm/mach-imx/Kconfig
··· 523 523 help 524 524 This enables support for Freescale i.MX6 UltraLite processor. 525 525 526 - config SOC_IMX7D 527 - bool "i.MX7 Dual support" 528 - select PINCTRL_IMX7D 529 - select ARM_GIC 530 - select HAVE_ARM_ARCH_TIMER 531 - select HAVE_IMX_ANATOP 532 - select HAVE_IMX_MMDC 533 - select HAVE_IMX_SRC 534 - select IMX_GPCV2 535 - help 536 - This enables support for Freescale i.MX7 Dual processor. 537 - 538 526 config SOC_LS1021A 539 527 bool "Freescale LS1021A support" 540 528 select ARM_GIC ··· 536 548 comment "Cortex-A/Cortex-M asymmetric multiprocessing platforms" 537 549 538 550 if ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M 551 + 552 + config SOC_IMX7D_CA7 553 + bool 554 + select ARM_GIC 555 + select HAVE_ARM_ARCH_TIMER 556 + select HAVE_IMX_ANATOP 557 + select HAVE_IMX_MMDC 558 + select HAVE_IMX_SRC 559 + select IMX_GPCV2 560 + 561 + config SOC_IMX7D_CM4 562 + bool 563 + select ARMV7M_SYSTICK 564 + 565 + config SOC_IMX7D 566 + bool "i.MX7 Dual support" 567 + select PINCTRL_IMX7D 568 + select SOC_IMX7D_CA7 if ARCH_MULTI_V7 569 + select SOC_IMX7D_CM4 if ARM_SINGLE_ARMV7M 570 + help 571 + This enables support for Freescale i.MX7 Dual processor. 539 572 540 573 config SOC_VF610 541 574 bool "Vybrid Family VF610 support"
+3 -2
arch/arm/mach-imx/Makefile
··· 26 26 obj-$(CONFIG_SOC_IMX5) += cpuidle-imx5.o 27 27 obj-$(CONFIG_SOC_IMX6Q) += cpuidle-imx6q.o 28 28 obj-$(CONFIG_SOC_IMX6SL) += cpuidle-imx6sl.o 29 - obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sl.o 29 + obj-$(CONFIG_SOC_IMX6SLL) += cpuidle-imx6sx.o 30 30 obj-$(CONFIG_SOC_IMX6SX) += cpuidle-imx6sx.o 31 31 obj-$(CONFIG_SOC_IMX6UL) += cpuidle-imx6sx.o 32 32 endif ··· 81 81 obj-$(CONFIG_SOC_IMX6SLL) += mach-imx6sl.o 82 82 obj-$(CONFIG_SOC_IMX6SX) += mach-imx6sx.o 83 83 obj-$(CONFIG_SOC_IMX6UL) += mach-imx6ul.o 84 - obj-$(CONFIG_SOC_IMX7D) += mach-imx7d.o 84 + obj-$(CONFIG_SOC_IMX7D_CA7) += mach-imx7d.o 85 + obj-$(CONFIG_SOC_IMX7D_CM4) += mach-imx7d-cm4.o 85 86 86 87 ifeq ($(CONFIG_SUSPEND),y) 87 88 AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
+2 -1
arch/arm/mach-imx/common.h
··· 38 38 void imx27_soc_init(void); 39 39 void imx31_soc_init(void); 40 40 void imx35_soc_init(void); 41 - void epit_timer_init(void __iomem *base, int irq); 42 41 int mx21_clocks_init(unsigned long lref, unsigned long fref); 43 42 int mx27_clocks_init(unsigned long fref); 44 43 int mx31_clocks_init(unsigned long fref); ··· 57 58 void imx6_enable_rbc(bool enable); 58 59 void imx_gpc_check_dt(void); 59 60 void imx_gpc_set_arm_power_in_lpm(bool power_off); 61 + void imx_gpc_set_l2_mem_power_in_lpm(bool power_off); 60 62 void imx_gpc_set_arm_power_up_timing(u32 sw2iso, u32 sw); 61 63 void imx_gpc_set_arm_power_down_timing(u32 sw2iso, u32 sw); 62 64 void imx25_pm_init(void); 63 65 void imx27_pm_init(void); 66 + void imx5_pmu_init(void); 64 67 65 68 enum mxc_cpu_pwr_mode { 66 69 WAIT_CLOCKED, /* wfi only */
+45
arch/arm/mach-imx/cpu-imx5.c
··· 117 117 return mx5_cpu_rev; 118 118 } 119 119 EXPORT_SYMBOL(mx53_revision); 120 + 121 + #define ARM_GPC 0x4 122 + #define DBGEN BIT(16) 123 + 124 + /* 125 + * This enables the DBGEN bit in ARM_GPC register, which is 126 + * required for accessing some performance counter features. 127 + * Technically it is only required while perf is used, but to 128 + * keep the source code simple we just enable it all the time 129 + * when the kernel configuration allows using the feature. 130 + */ 131 + void __init imx5_pmu_init(void) 132 + { 133 + void __iomem *tigerp_base; 134 + struct device_node *np; 135 + u32 gpc; 136 + 137 + if (!IS_ENABLED(CONFIG_ARM_PMU)) 138 + return; 139 + 140 + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a8-pmu"); 141 + if (!np) 142 + return; 143 + 144 + if (!of_property_read_bool(np, "secure-reg-access")) 145 + goto exit; 146 + 147 + of_node_put(np); 148 + 149 + np = of_find_compatible_node(NULL, NULL, "fsl,imx51-tigerp"); 150 + if (!np) 151 + return; 152 + 153 + tigerp_base = of_iomap(np, 0); 154 + if (!tigerp_base) 155 + goto exit; 156 + 157 + gpc = readl_relaxed(tigerp_base + ARM_GPC); 158 + gpc |= DBGEN; 159 + writel_relaxed(gpc, tigerp_base + ARM_GPC); 160 + iounmap(tigerp_base); 161 + exit: 162 + of_node_put(np); 163 + 164 + }
+1
arch/arm/mach-imx/cpu.c
··· 68 68 69 69 for_each_compatible_node(np, NULL, compat) { 70 70 aips_base_addr = of_iomap(np, 0); 71 + WARN_ON(!aips_base_addr); 71 72 imx_set_aips(aips_base_addr); 72 73 } 73 74 }
+2 -5
arch/arm/mach-imx/cpuidle-imx6sl.c
··· 12 12 13 13 #include "common.h" 14 14 #include "cpuidle.h" 15 - #include "hardware.h" 16 15 17 16 static int imx6sl_enter_wait(struct cpuidle_device *dev, 18 17 struct cpuidle_driver *drv, int index) ··· 21 22 * Software workaround for ERR005311, see function 22 23 * description for details. 23 24 */ 24 - if (cpu_is_imx6sl()) 25 - imx6sl_set_wait_clk(true); 25 + imx6sl_set_wait_clk(true); 26 26 cpu_do_idle(); 27 - if (cpu_is_imx6sl()) 28 - imx6sl_set_wait_clk(false); 27 + imx6sl_set_wait_clk(false); 29 28 imx6_set_lpm(WAIT_CLOCKED); 30 29 31 30 return index;
+1
arch/arm/mach-imx/cpuidle-imx6sx.c
··· 103 103 { 104 104 imx6_set_int_mem_clk_lpm(true); 105 105 imx6_enable_rbc(false); 106 + imx_gpc_set_l2_mem_power_in_lpm(false); 106 107 /* 107 108 * set ARM power up/down timing to the fastest, 108 109 * sw2iso and sw can be set to one 32K cycle = 31us
+14
arch/arm/mach-imx/gpc.c
··· 20 20 #include "common.h" 21 21 #include "hardware.h" 22 22 23 + #define GPC_CNTR 0x0 23 24 #define GPC_IMR1 0x008 24 25 #define GPC_PGC_CPU_PDN 0x2a0 25 26 #define GPC_PGC_CPU_PUPSCR 0x2a4 26 27 #define GPC_PGC_CPU_PDNSCR 0x2a8 27 28 #define GPC_PGC_SW2ISO_SHIFT 0x8 28 29 #define GPC_PGC_SW_SHIFT 0x0 30 + 31 + #define GPC_CNTR_L2_PGE_SHIFT 22 29 32 30 33 #define IMR_NUM 4 31 34 #define GPC_MAX_IRQS (IMR_NUM * 32) ··· 52 49 void imx_gpc_set_arm_power_in_lpm(bool power_off) 53 50 { 54 51 writel_relaxed(power_off, gpc_base + GPC_PGC_CPU_PDN); 52 + } 53 + 54 + void imx_gpc_set_l2_mem_power_in_lpm(bool power_off) 55 + { 56 + u32 val; 57 + 58 + val = readl_relaxed(gpc_base + GPC_CNTR); 59 + val &= ~(1 << GPC_CNTR_L2_PGE_SHIFT); 60 + if (power_off) 61 + val |= 1 << GPC_CNTR_L2_PGE_SHIFT; 62 + writel_relaxed(val, gpc_base + GPC_CNTR); 55 63 } 56 64 57 65 void imx_gpc_pre_suspend(bool arm_power_off)
-18
arch/arm/mach-imx/imx31-dt.c
··· 9 9 * http://www.gnu.org/copyleft/gpl.html 10 10 */ 11 11 12 - #include <linux/irq.h> 13 - #include <linux/of_irq.h> 14 - #include <linux/of_platform.h> 15 12 #include <asm/mach/arch.h> 16 - #include <asm/mach/time.h> 17 - 18 13 #include "common.h" 19 - #include "mx31.h" 20 14 21 15 static const char * const imx31_dt_board_compat[] __initconst = { 22 16 "fsl,imx31", 23 17 NULL 24 18 }; 25 19 26 - /* FIXME: replace with DT binding */ 27 - static const struct resource imx31_rnga_res[] __initconst = { 28 - DEFINE_RES_MEM(MX31_RNGA_BASE_ADDR, SZ_16K), 29 - }; 30 - 31 - static void __init imx31_dt_mach_init(void) 32 - { 33 - platform_device_register_simple("mxc_rnga", -1, imx31_rnga_res, 34 - ARRAY_SIZE(imx31_rnga_res)); 35 - } 36 - 37 20 DT_MACHINE_START(IMX31_DT, "Freescale i.MX31 (Device Tree Support)") 38 21 .map_io = mx31_map_io, 39 22 .init_early = imx31_init_early, 40 23 .init_irq = mx31_init_irq, 41 - .init_machine = imx31_dt_mach_init, 42 24 .dt_compat = imx31_dt_board_compat, 43 25 MACHINE_END
+29 -1
arch/arm/mach-imx/mach-imx51.c
··· 12 12 13 13 #include <linux/io.h> 14 14 #include <linux/irq.h> 15 + #include <linux/of_address.h> 15 16 #include <linux/of_irq.h> 16 17 #include <linux/of_platform.h> 17 18 #include <asm/mach/arch.h> ··· 49 48 iounmap(hsc_addr); 50 49 } 51 50 51 + static void __init imx51_m4if_setup(void) 52 + { 53 + void __iomem *m4if_base; 54 + struct device_node *np; 55 + 56 + np = of_find_compatible_node(NULL, NULL, "fsl,imx51-m4if"); 57 + if (!np) 58 + return; 59 + 60 + m4if_base = of_iomap(np, 0); 61 + if (!m4if_base) { 62 + pr_err("Unable to map M4IF registers\n"); 63 + return; 64 + } 65 + 66 + /* 67 + * Configure VPU and IPU with higher priorities 68 + * in order to avoid artifacts during video playback 69 + */ 70 + writel_relaxed(0x00000203, m4if_base + 0x40); 71 + writel_relaxed(0x00000000, m4if_base + 0x44); 72 + writel_relaxed(0x00120125, m4if_base + 0x9c); 73 + writel_relaxed(0x001901A3, m4if_base + 0x48); 74 + iounmap(m4if_base); 75 + } 76 + 52 77 static void __init imx51_dt_init(void) 53 78 { 54 79 imx51_ipu_mipi_setup(); 55 80 imx_src_init(); 56 - 81 + imx51_m4if_setup(); 82 + imx5_pmu_init(); 57 83 imx_aips_allow_unprivileged_access("fsl,imx51-aipstz"); 58 84 } 59 85
+1 -1
arch/arm/mach-imx/mach-imx53.c
··· 31 31 static void __init imx53_dt_init(void) 32 32 { 33 33 imx_src_init(); 34 - 34 + imx5_pmu_init(); 35 35 imx_aips_allow_unprivileged_access("fsl,imx53-aipstz"); 36 36 } 37 37
+4 -1
arch/arm/mach-imx/mach-imx6sl.c
··· 42 42 if (IS_ENABLED(CONFIG_ARM_IMX6Q_CPUFREQ)) 43 43 platform_device_register_simple("imx6q-cpufreq", -1, NULL, 0); 44 44 45 - imx6sl_cpuidle_init(); 45 + if (IS_ENABLED(CONFIG_SOC_IMX6SL) && cpu_is_imx6sl()) 46 + imx6sl_cpuidle_init(); 47 + else if (IS_ENABLED(CONFIG_SOC_IMX6SLL)) 48 + imx6sx_cpuidle_init(); 46 49 } 47 50 48 51 static void __init imx6sl_init_machine(void)
+18
arch/arm/mach-imx/mach-imx7d-cm4.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Copyright (c) 2018 Pengutronix, Oleksij Rempel <o.rempel@pengutronix.de> 4 + */ 5 + 6 + #include <linux/kernel.h> 7 + #include <asm/v7m.h> 8 + #include <asm/mach/arch.h> 9 + 10 + static const char * const imx7d_cm4_dt_compat[] __initconst = { 11 + "fsl,imx7d-cm4", 12 + NULL, 13 + }; 14 + 15 + DT_MACHINE_START(IMX7D, "Freescale i.MX7 Dual Cortex-M4 (Device Tree)") 16 + .dt_compat = imx7d_cm4_dt_compat, 17 + .restart = armv7m_restart, 18 + MACHINE_END
+30 -3
arch/arm/mach-imx/pm-imx6.c
··· 130 130 0x330, 0x334, 0x320, /* SDCKE0, SDCKE1, RESET */ 131 131 }; 132 132 133 + static const u32 imx6sll_mmdc_io_offset[] __initconst = { 134 + 0x294, 0x298, 0x29c, 0x2a0, /* DQM0 ~ DQM3 */ 135 + 0x544, 0x54c, 0x554, 0x558, /* GPR_B0DS ~ GPR_B3DS */ 136 + 0x530, 0x540, 0x2ac, 0x52c, /* MODE_CTL, MODE, SDCLK_0, GPR_ADDDS */ 137 + 0x2a4, 0x2a8, /* SDCKE0, SDCKE1*/ 138 + }; 139 + 133 140 static const u32 imx6sx_mmdc_io_offset[] __initconst = { 134 141 0x2ec, 0x2f0, 0x2f4, 0x2f8, /* DQM0 ~ DQM3 */ 135 142 0x60c, 0x610, 0x61c, 0x620, /* GPR_B0DS ~ GPR_B3DS */ ··· 180 173 .pl310_compat = "arm,pl310-cache", 181 174 .mmdc_io_num = ARRAY_SIZE(imx6sl_mmdc_io_offset), 182 175 .mmdc_io_offset = imx6sl_mmdc_io_offset, 176 + }; 177 + 178 + static const struct imx6_pm_socdata imx6sll_pm_data __initconst = { 179 + .mmdc_compat = "fsl,imx6sll-mmdc", 180 + .src_compat = "fsl,imx6sll-src", 181 + .iomuxc_compat = "fsl,imx6sll-iomuxc", 182 + .gpc_compat = "fsl,imx6sll-gpc", 183 + .pl310_compat = "arm,pl310-cache", 184 + .mmdc_io_num = ARRAY_SIZE(imx6sll_mmdc_io_offset), 185 + .mmdc_io_offset = imx6sll_mmdc_io_offset, 183 186 }; 184 187 185 188 static const struct imx6_pm_socdata imx6sx_pm_data __initconst = { ··· 313 296 if (cpu_is_imx6sl()) 314 297 val |= BM_CLPCR_BYPASS_PMIC_READY; 315 298 if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul() || 316 - cpu_is_imx6ull()) 299 + cpu_is_imx6ull() || cpu_is_imx6sll()) 317 300 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; 318 301 else 319 302 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; ··· 331 314 if (cpu_is_imx6sl() || cpu_is_imx6sx()) 332 315 val |= BM_CLPCR_BYPASS_PMIC_READY; 333 316 if (cpu_is_imx6sl() || cpu_is_imx6sx() || cpu_is_imx6ul() || 334 - cpu_is_imx6ull()) 317 + cpu_is_imx6ull() || cpu_is_imx6sll()) 335 318 val |= BM_CLPCR_BYP_MMDC_CH0_LPM_HS; 336 319 else 337 320 val |= BM_CLPCR_BYP_MMDC_CH1_LPM_HS; ··· 648 631 649 632 void __init imx6sl_pm_init(void) 650 633 { 651 - imx6_pm_common_init(&imx6sl_pm_data); 634 + struct regmap *gpr; 635 + 636 + if (cpu_is_imx6sl()) { 637 + imx6_pm_common_init(&imx6sl_pm_data); 638 + } else { 639 + imx6_pm_common_init(&imx6sll_pm_data); 640 + gpr = syscon_regmap_lookup_by_compatible("fsl,imx6q-iomuxc-gpr"); 641 + if (!IS_ERR(gpr)) 642 + regmap_update_bits(gpr, IOMUXC_GPR5, 643 + IMX6SLL_GPR5_AFCG_X_BYPASS_MASK, 0); 644 + } 652 645 } 653 646 654 647 void __init imx6sx_pm_init(void)
+23 -26
arch/arm/mach-mvebu/platsmp.c
··· 35 35 #define AXP_BOOTROM_BASE 0xfff00000 36 36 #define AXP_BOOTROM_SIZE 0x100000 37 37 38 + static struct clk *boot_cpu_clk; 39 + 38 40 static struct clk *get_cpu_clk(int cpu) 39 41 { 40 42 struct clk *cpu_clk; ··· 50 48 return cpu_clk; 51 49 } 52 50 53 - static void set_secondary_cpu_clock(unsigned int cpu) 54 - { 55 - int thiscpu; 56 - unsigned long rate; 57 - struct clk *cpu_clk; 58 - 59 - thiscpu = get_cpu(); 60 - 61 - cpu_clk = get_cpu_clk(thiscpu); 62 - if (!cpu_clk) 63 - goto out; 64 - clk_prepare_enable(cpu_clk); 65 - rate = clk_get_rate(cpu_clk); 66 - 67 - cpu_clk = get_cpu_clk(cpu); 68 - if (!cpu_clk) 69 - goto out; 70 - clk_set_rate(cpu_clk, rate); 71 - clk_prepare_enable(cpu_clk); 72 - 73 - out: 74 - put_cpu(); 75 - } 76 - 77 51 static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle) 78 52 { 79 53 int ret, hw_cpu; ··· 57 79 pr_info("Booting CPU %d\n", cpu); 58 80 59 81 hw_cpu = cpu_logical_map(cpu); 60 - set_secondary_cpu_clock(hw_cpu); 61 82 mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup); 62 83 63 84 /* ··· 99 122 panic("Invalid number of CPUs in DT\n"); 100 123 } 101 124 125 + static int armada_xp_sync_secondary_clk(unsigned int cpu) 126 + { 127 + struct clk *cpu_clk = get_cpu_clk(cpu); 128 + 129 + if (!cpu_clk || !boot_cpu_clk) 130 + return 0; 131 + 132 + clk_prepare_enable(cpu_clk); 133 + clk_set_rate(cpu_clk, clk_get_rate(boot_cpu_clk)); 134 + 135 + return 0; 136 + } 137 + 102 138 static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus) 103 139 { 104 140 struct device_node *node; ··· 120 130 121 131 flush_cache_all(); 122 132 set_cpu_coherent(); 133 + 134 + boot_cpu_clk = get_cpu_clk(smp_processor_id()); 135 + if (boot_cpu_clk) { 136 + clk_prepare_enable(boot_cpu_clk); 137 + cpuhp_setup_state_nocalls(CPUHP_AP_ARM_MVEBU_SYNC_CLOCKS, 138 + "arm/mvebu/sync_clocks:online", 139 + armada_xp_sync_secondary_clk, NULL); 140 + } 123 141 124 142 /* 125 143 * In order to boot the secondary CPUs we need to ensure ··· 221 223 int ret, hw_cpu; 222 224 223 225 hw_cpu = cpu_logical_map(cpu); 224 - set_secondary_cpu_clock(hw_cpu); 225 226 mv98dx3236_resume_set_cpu_boot_addr(hw_cpu, 226 227 armada_xp_secondary_startup); 227 228
+3 -3
arch/arm/mach-mvebu/pmsu.c
··· 116 116 PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu)); 117 117 } 118 118 119 - extern unsigned char mvebu_boot_wa_start; 120 - extern unsigned char mvebu_boot_wa_end; 119 + extern unsigned char mvebu_boot_wa_start[]; 120 + extern unsigned char mvebu_boot_wa_end[]; 121 121 122 122 /* 123 123 * This function sets up the boot address workaround needed for SMP ··· 130 130 phys_addr_t resume_addr_reg) 131 131 { 132 132 void __iomem *sram_virt_base; 133 - u32 code_len = &mvebu_boot_wa_end - &mvebu_boot_wa_start; 133 + u32 code_len = mvebu_boot_wa_end - mvebu_boot_wa_start; 134 134 135 135 mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE); 136 136 mvebu_mbus_add_window_by_id(crypto_eng_target, crypto_eng_attribute,
+3 -2
arch/arm/mach-omap1/ams-delta-fiq-handler.S
··· 14 14 */ 15 15 16 16 #include <linux/linkage.h> 17 + #include <linux/platform_data/ams-delta-fiq.h> 18 + 17 19 #include <asm/assembler.h> 18 - 19 20 #include <mach/board-ams-delta.h> 20 - #include <mach/ams-delta-fiq.h> 21 21 22 + #include "ams-delta-fiq.h" 22 23 #include "iomap.h" 23 24 #include "soc.h" 24 25
+92 -21
arch/arm/mach-omap1/ams-delta-fiq.c
··· 13 13 * under the terms of the GNU General Public License version 2 as published by 14 14 * the Free Software Foundation. 15 15 */ 16 - #include <linux/gpio.h> 16 + #include <linux/gpio/consumer.h> 17 + #include <linux/gpio/driver.h> 17 18 #include <linux/interrupt.h> 18 19 #include <linux/irq.h> 19 20 #include <linux/module.h> 20 21 #include <linux/io.h> 22 + #include <linux/platform_data/ams-delta-fiq.h> 23 + #include <linux/platform_device.h> 21 24 22 25 #include <mach/board-ams-delta.h> 23 26 24 27 #include <asm/fiq.h> 25 28 26 - #include <mach/ams-delta-fiq.h> 29 + #include "ams-delta-fiq.h" 27 30 28 31 static struct fiq_handler fh = { 29 32 .name = "ams-delta-fiq" ··· 37 34 * The FIQ and IRQ isrs can both read and write it. 38 35 * It is structured as a header section several 32bit slots, 39 36 * followed by the circular buffer where the FIQ isr stores 40 - * keystrokes received from the qwerty keyboard. 41 - * See ams-delta-fiq.h for details of offsets. 37 + * keystrokes received from the qwerty keyboard. See 38 + * <linux/platform_data/ams-delta-fiq.h> for details of offsets. 42 39 */ 43 - unsigned int fiq_buffer[1024]; 44 - EXPORT_SYMBOL(fiq_buffer); 40 + static unsigned int fiq_buffer[1024]; 45 41 42 + static struct irq_chip *irq_chip; 43 + static struct irq_data *irq_data[16]; 46 44 static unsigned int irq_counter[16]; 45 + 46 + static const char *pin_name[16] __initconst = { 47 + [AMS_DELTA_GPIO_PIN_KEYBRD_DATA] = "keybrd_data", 48 + [AMS_DELTA_GPIO_PIN_KEYBRD_CLK] = "keybrd_clk", 49 + }; 47 50 48 51 static irqreturn_t deferred_fiq(int irq, void *dev_id) 49 52 { 53 + struct irq_data *d; 50 54 int gpio, irq_num, fiq_count; 51 - struct irq_chip *irq_chip; 52 - 53 - irq_chip = irq_get_chip(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); 54 55 55 56 /* 56 57 * For each handled GPIO interrupt, keep calling its interrupt handler ··· 62 55 */ 63 56 for (gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK; 64 57 gpio <= AMS_DELTA_GPIO_PIN_HOOK_SWITCH; gpio++) { 65 - irq_num = gpio_to_irq(gpio); 58 + d = irq_data[gpio]; 59 + irq_num = d->irq; 66 60 fiq_count = fiq_buffer[FIQ_CNT_INT_00 + gpio]; 67 61 68 62 if (irq_counter[gpio] < fiq_count && 69 63 gpio != AMS_DELTA_GPIO_PIN_KEYBRD_CLK) { 70 - struct irq_data *d = irq_get_irq_data(irq_num); 71 - 72 64 /* 73 65 * handle_simple_irq() that OMAP GPIO edge 74 66 * interrupts default to since commit 80ac93c27441 75 67 * requires interrupt already acked and unmasked. 76 68 */ 77 - if (irq_chip) { 78 - if (irq_chip->irq_ack) 79 - irq_chip->irq_ack(d); 80 - if (irq_chip->irq_unmask) 81 - irq_chip->irq_unmask(d); 82 - } 69 + if (irq_chip->irq_ack) 70 + irq_chip->irq_ack(d); 71 + if (irq_chip->irq_unmask) 72 + irq_chip->irq_unmask(d); 83 73 } 84 74 for (; irq_counter[gpio] < fiq_count; irq_counter[gpio]++) 85 75 generic_handle_irq(irq_num); ··· 84 80 return IRQ_HANDLED; 85 81 } 86 82 87 - void __init ams_delta_init_fiq(void) 83 + void __init ams_delta_init_fiq(struct gpio_chip *chip, 84 + struct platform_device *serio) 88 85 { 86 + struct gpio_desc *gpiod, *data = NULL, *clk = NULL; 89 87 void *fiqhandler_start; 90 88 unsigned int fiqhandler_length; 91 89 struct pt_regs FIQ_regs; 92 90 unsigned long val, offset; 93 91 int i, retval; 92 + 93 + /* Store irq_chip location for IRQ handler use */ 94 + irq_chip = chip->irq.chip; 95 + if (!irq_chip) { 96 + pr_err("%s: GPIO chip %s is missing IRQ function\n", __func__, 97 + chip->label); 98 + return; 99 + } 100 + 101 + for (i = 0; i < ARRAY_SIZE(irq_data); i++) { 102 + gpiod = gpiochip_request_own_desc(chip, i, pin_name[i]); 103 + if (IS_ERR(gpiod)) { 104 + pr_err("%s: failed to get GPIO pin %d (%ld)\n", 105 + __func__, i, PTR_ERR(gpiod)); 106 + return; 107 + } 108 + /* Store irq_data location for IRQ handler use */ 109 + irq_data[i] = irq_get_irq_data(gpiod_to_irq(gpiod)); 110 + 111 + /* 112 + * FIQ handler takes full control over serio data and clk GPIO 113 + * pins. Initiaize them and keep requested so nobody can 114 + * interfere. Fail if any of those two couldn't be requested. 115 + */ 116 + switch (i) { 117 + case AMS_DELTA_GPIO_PIN_KEYBRD_DATA: 118 + data = gpiod; 119 + gpiod_direction_input(data); 120 + break; 121 + case AMS_DELTA_GPIO_PIN_KEYBRD_CLK: 122 + clk = gpiod; 123 + gpiod_direction_input(clk); 124 + break; 125 + default: 126 + gpiochip_free_own_desc(gpiod); 127 + break; 128 + } 129 + } 130 + if (!data || !clk) 131 + goto out_gpio; 94 132 95 133 fiqhandler_start = &qwerty_fiqin_start; 96 134 fiqhandler_length = &qwerty_fiqin_end - &qwerty_fiqin_start; ··· 143 97 if (retval) { 144 98 pr_err("ams_delta_init_fiq(): couldn't claim FIQ, ret=%d\n", 145 99 retval); 146 - return; 100 + goto out_gpio; 147 101 } 148 102 149 103 retval = request_irq(INT_DEFERRED_FIQ, deferred_fiq, ··· 151 105 if (retval < 0) { 152 106 pr_err("Failed to get deferred_fiq IRQ, ret=%d\n", retval); 153 107 release_fiq(&fh); 154 - return; 108 + goto out_gpio; 155 109 } 156 110 /* 157 111 * Since no set_type() method is provided by OMAP irq chip, ··· 201 155 offset = IRQ_ILR0_REG_OFFSET + (INT_GPIO_BANK1 - NR_IRQS_LEGACY) * 0x4; 202 156 val = omap_readl(OMAP_IH1_BASE + offset) | 1; 203 157 omap_writel(val, OMAP_IH1_BASE + offset); 158 + 159 + /* Initialize serio device IRQ resource and platform_data */ 160 + serio->resource[0].start = gpiod_to_irq(clk); 161 + serio->resource[0].end = serio->resource[0].start; 162 + serio->dev.platform_data = fiq_buffer; 163 + 164 + /* 165 + * Since FIQ handler performs handling of GPIO registers for 166 + * "keybrd_clk" IRQ pin, ams_delta_serio driver used to set 167 + * handle_simple_irq() as active IRQ handler for that pin to avoid 168 + * bad interaction with gpio-omap driver. This is no longer needed 169 + * as handle_simple_irq() is now the default handler for OMAP GPIO 170 + * edge interrupts. 171 + * This comment replaces the obsolete code which has been removed 172 + * from the ams_delta_serio driver and stands here only as a reminder 173 + * of that dependency on gpio-omap driver behavior. 174 + */ 175 + 176 + return; 177 + 178 + out_gpio: 179 + if (data) 180 + gpiochip_free_own_desc(data); 181 + if (clk) 182 + gpiochip_free_own_desc(clk); 204 183 }
+42
arch/arm/mach-omap1/ams-delta-fiq.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 3 + /* 4 + * arch/arm/mach-omap1/ams-delta-fiq.h 5 + * 6 + * Taken from the original Amstrad modifications to fiq.h 7 + * 8 + * Copyright (c) 2004 Amstrad Plc 9 + * Copyright (c) 2006 Matt Callow 10 + * Copyright (c) 2010 Janusz Krzysztofik 11 + * 12 + * This program is free software; you can redistribute it and/or modify 13 + * it under the terms of the GNU General Public License version 2 as 14 + * published by the Free Software Foundation. 15 + */ 16 + #ifndef __AMS_DELTA_FIQ_H 17 + #define __AMS_DELTA_FIQ_H 18 + 19 + #include <mach/irqs.h> 20 + 21 + /* 22 + * Interrupt number used for passing control from FIQ to IRQ. 23 + * IRQ12, described as reserved, has been selected. 24 + */ 25 + #define INT_DEFERRED_FIQ INT_1510_RES12 26 + /* 27 + * Base address of an interrupt handler that the INT_DEFERRED_FIQ belongs to. 28 + */ 29 + #if (INT_DEFERRED_FIQ < IH2_BASE) 30 + #define DEFERRED_FIQ_IH_BASE OMAP_IH1_BASE 31 + #else 32 + #define DEFERRED_FIQ_IH_BASE OMAP_IH2_BASE 33 + #endif 34 + 35 + #ifndef __ASSEMBLER__ 36 + extern unsigned char qwerty_fiqin_start, qwerty_fiqin_end; 37 + 38 + extern void __init ams_delta_init_fiq(struct gpio_chip *chip, 39 + struct platform_device *pdev); 40 + #endif 41 + 42 + #endif
+246 -57
arch/arm/mach-omap1/board-ams-delta.c
··· 41 41 #include <mach/mux.h> 42 42 43 43 #include <mach/hardware.h> 44 - #include <mach/ams-delta-fiq.h> 45 44 #include "camera.h" 46 45 #include <mach/usb.h> 47 46 47 + #include "ams-delta-fiq.h" 48 48 #include "iomap.h" 49 49 #include "common.h" 50 50 ··· 179 179 }, 180 180 }; 181 181 182 + #define LATCH1_LABEL "latch1" 183 + 182 184 static struct bgpio_pdata latch1_pdata = { 185 + .label = LATCH1_LABEL, 183 186 .base = LATCH1_GPIO_BASE, 184 187 .ngpio = LATCH1_NGPIO, 185 188 }; ··· 196 193 .platform_data = &latch1_pdata, 197 194 }, 198 195 }; 196 + 197 + #define LATCH1_PIN_LED_CAMERA 0 198 + #define LATCH1_PIN_LED_ADVERT 1 199 + #define LATCH1_PIN_LED_MAIL 2 200 + #define LATCH1_PIN_LED_HANDSFREE 3 201 + #define LATCH1_PIN_LED_VOICEMAIL 4 202 + #define LATCH1_PIN_LED_VOICE 5 203 + #define LATCH1_PIN_DOCKIT1 6 204 + #define LATCH1_PIN_DOCKIT2 7 199 205 200 206 static struct resource latch2_resources[] = { 201 207 [0] = { ··· 410 398 }, 411 399 }; 412 400 413 - static const struct gpio_led gpio_leds[] __initconst = { 414 - { 401 + /* 402 + * Dynamically allocated GPIO numbers must be obtained fromm GPIO device 403 + * before they can be put in the gpio_led table. Before that happens, 404 + * initialize the table with invalid GPIO numbers, not 0. 405 + */ 406 + static struct gpio_led gpio_leds[] __initdata = { 407 + [LATCH1_PIN_LED_CAMERA] = { 415 408 .name = "camera", 416 - .gpio = LATCH1_GPIO_BASE + 0, 409 + .gpio = -EINVAL, 417 410 .default_state = LEDS_GPIO_DEFSTATE_OFF, 418 411 #ifdef CONFIG_LEDS_TRIGGERS 419 412 .default_trigger = "ams_delta_camera", 420 413 #endif 421 414 }, 422 - { 415 + [LATCH1_PIN_LED_ADVERT] = { 423 416 .name = "advert", 424 - .gpio = LATCH1_GPIO_BASE + 1, 417 + .gpio = -EINVAL, 425 418 .default_state = LEDS_GPIO_DEFSTATE_OFF, 426 419 }, 427 - { 420 + [LATCH1_PIN_LED_MAIL] = { 428 421 .name = "email", 429 - .gpio = LATCH1_GPIO_BASE + 2, 422 + .gpio = -EINVAL, 430 423 .default_state = LEDS_GPIO_DEFSTATE_OFF, 431 424 }, 432 - { 425 + [LATCH1_PIN_LED_HANDSFREE] = { 433 426 .name = "handsfree", 434 - .gpio = LATCH1_GPIO_BASE + 3, 427 + .gpio = -EINVAL, 435 428 .default_state = LEDS_GPIO_DEFSTATE_OFF, 436 429 }, 437 - { 430 + [LATCH1_PIN_LED_VOICEMAIL] = { 438 431 .name = "voicemail", 439 - .gpio = LATCH1_GPIO_BASE + 4, 432 + .gpio = -EINVAL, 440 433 .default_state = LEDS_GPIO_DEFSTATE_OFF, 441 434 }, 442 - { 435 + [LATCH1_PIN_LED_VOICE] = { 443 436 .name = "voice", 444 - .gpio = LATCH1_GPIO_BASE + 5, 437 + .gpio = -EINVAL, 445 438 .default_state = LEDS_GPIO_DEFSTATE_OFF, 446 439 }, 447 440 }; ··· 521 504 .id = -1, 522 505 }; 523 506 524 - static struct gpiod_lookup_table ams_delta_serio_gpio_table = { 507 + static struct resource ams_delta_serio_resources[] = { 508 + { 509 + .flags = IORESOURCE_IRQ, 510 + /* 511 + * Initialize IRQ resource with invalid IRQ number. 512 + * It will be replaced with dynamically allocated GPIO IRQ 513 + * obtained from GPIO chip as soon as the chip is available. 514 + */ 515 + .start = -EINVAL, 516 + .end = -EINVAL, 517 + }, 518 + }; 519 + 520 + static struct platform_device ams_delta_serio_device = { 521 + .name = "ams-delta-serio", 522 + .id = PLATFORM_DEVID_NONE, 523 + .dev = { 524 + /* 525 + * Initialize .platform_data explicitly with NULL to 526 + * indicate it is going to be used. It will be replaced 527 + * with FIQ buffer address as soon as FIQ is initialized. 528 + */ 529 + .platform_data = NULL, 530 + }, 531 + .num_resources = ARRAY_SIZE(ams_delta_serio_resources), 532 + .resource = ams_delta_serio_resources, 533 + }; 534 + 535 + static struct regulator_consumer_supply keybrd_pwr_consumers[] = { 536 + /* 537 + * Initialize supply .dev_name with NULL. It will be replaced 538 + * with serio dev_name() as soon as the serio device is registered. 539 + */ 540 + REGULATOR_SUPPLY("vcc", NULL), 541 + }; 542 + 543 + static struct regulator_init_data keybrd_pwr_initdata = { 544 + .constraints = { 545 + .valid_ops_mask = REGULATOR_CHANGE_STATUS, 546 + }, 547 + .num_consumer_supplies = ARRAY_SIZE(keybrd_pwr_consumers), 548 + .consumer_supplies = keybrd_pwr_consumers, 549 + }; 550 + 551 + static struct fixed_voltage_config keybrd_pwr_config = { 552 + .supply_name = "keybrd_pwr", 553 + .microvolts = 5000000, 554 + .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 555 + .enable_high = 1, 556 + .init_data = &keybrd_pwr_initdata, 557 + }; 558 + 559 + static struct platform_device keybrd_pwr_device = { 560 + .name = "reg-fixed-voltage", 561 + .id = PLATFORM_DEVID_AUTO, 562 + .dev = { 563 + .platform_data = &keybrd_pwr_config, 564 + }, 565 + }; 566 + 567 + static struct gpiod_lookup_table keybrd_pwr_gpio_table = { 525 568 .table = { 526 - GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_KEYBRD_DATA, 527 - "data", 0), 528 - GPIO_LOOKUP(OMAP_GPIO_LABEL, AMS_DELTA_GPIO_PIN_KEYBRD_CLK, 529 - "clock", 0), 530 - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_PWR, 531 - "power", 0), 532 - GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, 533 - "dataout", 0), 569 + GPIO_LOOKUP(LATCH2_LABEL, LATCH2_PIN_KEYBRD_PWR, NULL, 570 + GPIO_ACTIVE_HIGH), 534 571 { }, 535 572 }, 536 573 }; ··· 595 524 &ams_delta_kp_device, 596 525 &ams_delta_camera_device, 597 526 &ams_delta_audio_device, 598 - }; 599 - 600 - static struct platform_device *late_devices[] __initdata = { 527 + &ams_delta_serio_device, 601 528 &ams_delta_nand_device, 602 529 &ams_delta_lcd_device, 603 530 &cx20442_codec_device, ··· 603 534 604 535 static struct gpiod_lookup_table *ams_delta_gpio_tables[] __initdata = { 605 536 &ams_delta_audio_gpio_table, 606 - &ams_delta_serio_gpio_table, 607 - }; 608 - 609 - static struct gpiod_lookup_table *late_gpio_tables[] __initdata = { 537 + &keybrd_pwr_gpio_table, 610 538 &ams_delta_lcd_gpio_table, 611 539 &ams_delta_nand_gpio_table, 612 540 }; 541 + 542 + /* 543 + * Some drivers may not use GPIO lookup tables but need to be provided 544 + * with GPIO numbers. The same applies to GPIO based IRQ lines - some 545 + * drivers may even not use GPIO layer but expect just IRQ numbers. 546 + * We could either define GPIO lookup tables then use them on behalf 547 + * of those devices, or we can use GPIO driver level methods for 548 + * identification of GPIO and IRQ numbers. For the purpose of the latter, 549 + * defina a helper function which identifies GPIO chips by their labels. 550 + */ 551 + static int gpiochip_match_by_label(struct gpio_chip *chip, void *data) 552 + { 553 + char *label = data; 554 + 555 + return !strcmp(label, chip->label); 556 + } 557 + 558 + static struct gpiod_hog ams_delta_gpio_hogs[] = { 559 + GPIO_HOG(LATCH2_LABEL, LATCH2_PIN_KEYBRD_DATAOUT, "keybrd_dataout", 560 + GPIO_ACTIVE_HIGH, GPIOD_OUT_LOW), 561 + {}, 562 + }; 563 + 564 + /* 565 + * The purpose of this function is to take care of proper initialization of 566 + * devices and data structures which depend on GPIO lines provided by OMAP GPIO 567 + * banks but their drivers don't use GPIO lookup tables or GPIO layer at all. 568 + * The function may be called as soon as OMAP GPIO devices are probed. 569 + * Since that happens at postcore_initcall, it can be called successfully 570 + * from init_machine or later. 571 + * Dependent devices may be registered from within this function or later. 572 + */ 573 + static void __init omap_gpio_deps_init(void) 574 + { 575 + struct gpio_chip *chip; 576 + 577 + chip = gpiochip_find(OMAP_GPIO_LABEL, gpiochip_match_by_label); 578 + if (!chip) { 579 + pr_err("%s: OMAP GPIO chip not found\n", __func__); 580 + return; 581 + } 582 + 583 + ams_delta_init_fiq(chip, &ams_delta_serio_device); 584 + } 613 585 614 586 static void __init ams_delta_init(void) 615 587 { ··· 672 562 omap_cfg_reg(J19_1610_CAM_D6); 673 563 omap_cfg_reg(J18_1610_CAM_D7); 674 564 565 + omap_gpio_deps_init(); 566 + gpiod_add_hogs(ams_delta_gpio_hogs); 567 + 675 568 omap_serial_init(); 676 569 omap_register_i2c_bus(1, 100, NULL, 0); 677 570 ··· 684 571 led_trigger_register_simple("ams_delta_camera", 685 572 &ams_delta_camera_led_trigger); 686 573 #endif 687 - gpio_led_register_device(-1, &leds_pdata); 688 574 platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices)); 689 575 690 576 /* 691 - * As soon as devices have been registered, assign their dev_names 692 - * to respective GPIO lookup tables before they are added. 577 + * As soon as regulator consumers have been registered, assign their 578 + * dev_names to consumer supply entries of respective regulators. 579 + */ 580 + keybrd_pwr_consumers[0].dev_name = 581 + dev_name(&ams_delta_serio_device.dev); 582 + 583 + /* 584 + * Once consumer supply entries are populated with dev_names, 585 + * register regulator devices. At this stage only the keyboard 586 + * power regulator has its consumer supply table fully populated. 587 + */ 588 + platform_device_register(&keybrd_pwr_device); 589 + 590 + /* 591 + * As soon as GPIO consumers have been registered, assign 592 + * their dev_names to respective GPIO lookup tables. 693 593 */ 694 594 ams_delta_audio_gpio_table.dev_id = 695 595 dev_name(&ams_delta_audio_device.dev); 696 - /* 697 - * No device name is assigned to GPIO lookup table for serio device 698 - * as long as serio driver is not converted to platform device driver. 699 - */ 596 + keybrd_pwr_gpio_table.dev_id = dev_name(&keybrd_pwr_device.dev); 597 + ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev); 598 + ams_delta_lcd_gpio_table.dev_id = dev_name(&ams_delta_lcd_device.dev); 700 599 600 + /* 601 + * Once GPIO lookup tables are populated with dev_names, register them. 602 + */ 701 603 gpiod_add_lookup_tables(ams_delta_gpio_tables, 702 604 ARRAY_SIZE(ams_delta_gpio_tables)); 703 - 704 - ams_delta_init_fiq(); 705 605 706 606 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); 707 607 ··· 769 643 }, 770 644 }; 771 645 772 - static int __init late_init(void) 646 + /* 647 + * leds-gpio driver doesn't make use of GPIO lookup tables, 648 + * it has to be provided with GPIO numbers over platform data 649 + * if GPIO descriptor info can't be obtained from device tree. 650 + * We could either define GPIO lookup tables and use them on behalf 651 + * of the leds-gpio device, or we can use GPIO driver level methods 652 + * for identification of GPIO numbers as long as we don't support 653 + * device tree. Let's do the latter. 654 + */ 655 + static void __init ams_delta_led_init(struct gpio_chip *chip) 773 656 { 657 + struct gpio_desc *gpiod; 658 + int i; 659 + 660 + for (i = LATCH1_PIN_LED_CAMERA; i < LATCH1_PIN_DOCKIT1; i++) { 661 + gpiod = gpiochip_request_own_desc(chip, i, NULL); 662 + if (IS_ERR(gpiod)) { 663 + pr_warn("%s: %s GPIO %d request failed (%ld)\n", 664 + __func__, LATCH1_LABEL, i, PTR_ERR(gpiod)); 665 + continue; 666 + } 667 + 668 + /* Assign GPIO numbers to LED device. */ 669 + gpio_leds[i].gpio = desc_to_gpio(gpiod); 670 + 671 + gpiochip_free_own_desc(gpiod); 672 + } 673 + 674 + gpio_led_register_device(PLATFORM_DEVID_NONE, &leds_pdata); 675 + } 676 + 677 + /* 678 + * The purpose of this function is to take care of assignment of GPIO numbers 679 + * to platform devices which depend on GPIO lines provided by Amstrad Delta 680 + * latch1 and/or latch2 GPIO devices but don't use GPIO lookup tables. 681 + * The function may be called as soon as latch1/latch2 GPIO devices are 682 + * initilized. Since basic-mmio-gpio driver is not registered before 683 + * device_initcall, this may happen at erliest during device_initcall_sync. 684 + * Dependent devices shouldn't be registered before that, their 685 + * registration may be performed from within this function or later. 686 + */ 687 + static int __init ams_delta_gpio_init(void) 688 + { 689 + struct gpio_chip *chip; 774 690 int err; 775 691 776 692 if (!machine_is_ams_delta()) 777 693 return -ENODEV; 778 694 695 + chip = gpiochip_find(LATCH1_LABEL, gpiochip_match_by_label); 696 + if (!chip) 697 + pr_err("%s: latch1 GPIO chip not found\n", __func__); 698 + else 699 + ams_delta_led_init(chip); 700 + 779 701 err = gpio_request_array(latch_gpios, ARRAY_SIZE(latch_gpios)); 780 - if (err) { 702 + if (err) 781 703 pr_err("Couldn't take over latch1/latch2 GPIO pins\n"); 782 - return err; 783 - } 784 704 785 - platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); 705 + return err; 706 + } 707 + device_initcall_sync(ams_delta_gpio_init); 786 708 787 - /* 788 - * As soon as devices have been registered, assign their dev_names 789 - * to respective GPIO lookup tables before they are added. 790 - */ 791 - ams_delta_lcd_gpio_table.dev_id = dev_name(&ams_delta_lcd_device.dev); 792 - ams_delta_nand_gpio_table.dev_id = dev_name(&ams_delta_nand_device.dev); 793 - 794 - gpiod_add_lookup_tables(late_gpio_tables, ARRAY_SIZE(late_gpio_tables)); 709 + static int __init modem_nreset_init(void) 710 + { 711 + int err; 795 712 796 713 err = platform_device_register(&modem_nreset_device); 797 - if (err) { 714 + if (err) 798 715 pr_err("Couldn't register the modem regulator device\n"); 799 - return err; 800 - } 716 + 717 + return err; 718 + } 719 + 720 + 721 + static int __init ams_delta_modem_init(void) 722 + { 723 + int err; 801 724 802 725 omap_cfg_reg(M14_1510_GPIO2); 803 726 ams_delta_modem_ports[0].irq = ··· 867 692 868 693 err = platform_device_register(&ams_delta_modem_device); 869 694 if (err) 870 - goto gpio_free; 695 + gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 696 + 697 + return err; 698 + } 699 + 700 + static int __init late_init(void) 701 + { 702 + int err; 703 + 704 + err = modem_nreset_init(); 705 + if (err) 706 + return err; 707 + 708 + err = ams_delta_modem_init(); 709 + if (err) 710 + return err; 871 711 872 712 /* 873 713 * Once the modem device is registered, the modem_nreset ··· 898 708 899 709 unregister: 900 710 platform_device_unregister(&ams_delta_modem_device); 901 - gpio_free: 902 711 gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 903 712 return err; 904 713 }
+1 -1
arch/arm/mach-omap1/board-h2.c
··· 274 274 .resource = h2_kp_resources, 275 275 }; 276 276 277 - static struct gpio_led h2_gpio_led_pins[] = { 277 + static const struct gpio_led h2_gpio_led_pins[] = { 278 278 { 279 279 .name = "h2:red", 280 280 .default_trigger = "heartbeat",
+1 -1
arch/arm/mach-omap1/board-h3.c
··· 326 326 }, 327 327 }; 328 328 329 - static struct gpio_led h3_gpio_led_pins[] = { 329 + static const struct gpio_led h3_gpio_led_pins[] = { 330 330 { 331 331 .name = "h3:red", 332 332 .default_trigger = "heartbeat",
+1 -1
arch/arm/mach-omap1/board-htcherald.c
··· 292 292 }; 293 293 294 294 /* LEDs for the Herald. These connect to the HTCPLD GPIO device. */ 295 - static struct gpio_led gpio_leds[] = { 295 + static const struct gpio_led gpio_leds[] = { 296 296 {"dpad", NULL, HTCPLD_GPIO_LED_DPAD, 0, 0, LEDS_GPIO_DEFSTATE_OFF}, 297 297 {"kbd", NULL, HTCPLD_GPIO_LED_KBD, 0, 0, LEDS_GPIO_DEFSTATE_OFF}, 298 298 {"vibrate", NULL, HTCPLD_GPIO_LED_VIBRATE, 0, 0, LEDS_GPIO_DEFSTATE_OFF},
+2 -2
arch/arm/mach-omap1/board-osk.c
··· 167 167 &osk5912_cf_device, 168 168 }; 169 169 170 - static struct gpio_led tps_leds[] = { 170 + static const struct gpio_led tps_leds[] = { 171 171 /* NOTE: D9 and D2 have hardware blink support. 172 172 * Also, D9 requires non-battery power. 173 173 */ ··· 385 385 .id = -1, 386 386 }; 387 387 388 - static struct gpio_led mistral_gpio_led_pins[] = { 388 + static const struct gpio_led mistral_gpio_led_pins[] = { 389 389 { 390 390 .name = "mistral:red", 391 391 .default_trigger = "heartbeat",
+5 -26
arch/arm/mach-omap1/include/mach/ams-delta-fiq.h include/linux/platform_data/ams-delta-fiq.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + 1 3 /* 2 - * arch/arm/mach-omap1/include/ams-delta-fiq.h 4 + * include/linux/platform_data/ams-delta-fiq.h 3 5 * 4 6 * Taken from the original Amstrad modifications to fiq.h 5 7 * ··· 13 11 * it under the terms of the GNU General Public License version 2 as 14 12 * published by the Free Software Foundation. 15 13 */ 16 - #ifndef __AMS_DELTA_FIQ_H 17 - #define __AMS_DELTA_FIQ_H 18 - 19 - #include <mach/irqs.h> 20 - 21 - /* 22 - * Interrupt number used for passing control from FIQ to IRQ. 23 - * IRQ12, described as reserved, has been selected. 24 - */ 25 - #define INT_DEFERRED_FIQ INT_1510_RES12 26 - /* 27 - * Base address of an interrupt handler that the INT_DEFERRED_FIQ belongs to. 28 - */ 29 - #if (INT_DEFERRED_FIQ < IH2_BASE) 30 - #define DEFERRED_FIQ_IH_BASE OMAP_IH1_BASE 31 - #else 32 - #define DEFERRED_FIQ_IH_BASE OMAP_IH2_BASE 33 - #endif 14 + #ifndef __LINUX_PLATFORM_DATA_AMS_DELTA_FIQ_H 15 + #define __LINUX_PLATFORM_DATA_AMS_DELTA_FIQ_H 34 16 35 17 /* 36 18 * These are the offsets from the beginning of the fiq_buffer. They are put here ··· 54 68 #define FIQ_CNT_INT_15 29 55 69 56 70 #define FIQ_CIRC_BUFF 30 /*Start of circular buffer */ 57 - 58 - #ifndef __ASSEMBLER__ 59 - extern unsigned int fiq_buffer[]; 60 - extern unsigned char qwerty_fiqin_start, qwerty_fiqin_end; 61 - 62 - extern void __init ams_delta_init_fiq(void); 63 - #endif 64 71 65 72 #endif
+8 -4
arch/arm/mach-omap2/omap_hwmod_reset.c
··· 92 92 */ 93 93 void omap_hwmod_rtc_unlock(struct omap_hwmod *oh) 94 94 { 95 - local_irq_disable(); 95 + unsigned long flags; 96 + 97 + local_irq_save(flags); 96 98 omap_rtc_wait_not_busy(oh); 97 99 omap_hwmod_write(OMAP_RTC_KICK0_VALUE, oh, OMAP_RTC_KICK0_REG); 98 100 omap_hwmod_write(OMAP_RTC_KICK1_VALUE, oh, OMAP_RTC_KICK1_REG); 99 - local_irq_enable(); 101 + local_irq_restore(flags); 100 102 } 101 103 102 104 /** ··· 112 110 */ 113 111 void omap_hwmod_rtc_lock(struct omap_hwmod *oh) 114 112 { 115 - local_irq_disable(); 113 + unsigned long flags; 114 + 115 + local_irq_save(flags); 116 116 omap_rtc_wait_not_busy(oh); 117 117 omap_hwmod_write(0x0, oh, OMAP_RTC_KICK0_REG); 118 118 omap_hwmod_write(0x0, oh, OMAP_RTC_KICK1_REG); 119 - local_irq_enable(); 119 + local_irq_restore(flags); 120 120 }
+2
arch/arm/mach-omap2/pm-asm-offsets.c
··· 27 27 offsetof(struct am33xx_pm_ro_sram_data, amx3_pm_sram_data_virt)); 28 28 DEFINE(AMX3_PM_RO_SRAM_DATA_PHYS_OFFSET, 29 29 offsetof(struct am33xx_pm_ro_sram_data, amx3_pm_sram_data_phys)); 30 + DEFINE(AMX3_PM_RTC_BASE_VIRT_OFFSET, 31 + offsetof(struct am33xx_pm_ro_sram_data, rtc_base_virt)); 30 32 DEFINE(AMX3_PM_RO_SRAM_DATA_SIZE, 31 33 sizeof(struct am33xx_pm_ro_sram_data)); 32 34
+6 -31
arch/arm/mach-omap2/pm-debug.c
··· 47 47 48 48 static int pm_dbg_init(void); 49 49 50 - enum { 51 - DEBUG_FILE_COUNTERS = 0, 52 - DEBUG_FILE_TIMERS, 53 - }; 54 - 55 50 static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = { 56 51 "OFF", 57 52 "RET", ··· 136 141 return 0; 137 142 } 138 143 139 - static int pm_dbg_show_counters(struct seq_file *s, void *unused) 144 + static int pm_dbg_counters_show(struct seq_file *s, void *unused) 140 145 { 141 146 pwrdm_for_each(pwrdm_dbg_show_counter, s); 142 147 clkdm_for_each(clkdm_dbg_show_counter, s); 143 148 144 149 return 0; 145 150 } 151 + DEFINE_SHOW_ATTRIBUTE(pm_dbg_counters); 146 152 147 - static int pm_dbg_show_timers(struct seq_file *s, void *unused) 153 + static int pm_dbg_timers_show(struct seq_file *s, void *unused) 148 154 { 149 155 pwrdm_for_each(pwrdm_dbg_show_timer, s); 150 156 return 0; 151 157 } 152 - 153 - static int pm_dbg_open(struct inode *inode, struct file *file) 154 - { 155 - switch ((int)inode->i_private) { 156 - case DEBUG_FILE_COUNTERS: 157 - return single_open(file, pm_dbg_show_counters, 158 - &inode->i_private); 159 - case DEBUG_FILE_TIMERS: 160 - default: 161 - return single_open(file, pm_dbg_show_timers, 162 - &inode->i_private); 163 - } 164 - } 165 - 166 - static const struct file_operations debug_fops = { 167 - .open = pm_dbg_open, 168 - .read = seq_read, 169 - .llseek = seq_lseek, 170 - .release = single_release, 171 - }; 158 + DEFINE_SHOW_ATTRIBUTE(pm_dbg_timers); 172 159 173 160 static int pwrdm_suspend_get(void *data, u64 *val) 174 161 { ··· 236 259 if (!d) 237 260 return -EINVAL; 238 261 239 - (void) debugfs_create_file("count", S_IRUGO, 240 - d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); 241 - (void) debugfs_create_file("time", S_IRUGO, 242 - d, (void *)DEBUG_FILE_TIMERS, &debug_fops); 262 + (void) debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops); 263 + (void) debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops); 243 264 244 265 pwrdm_for_each(pwrdms_setup, (void *)d); 245 266
+16 -4
arch/arm/mach-omap2/pm33xx-core.c
··· 26 26 static struct powerdomain *cefuse_pwrdm, *gfx_pwrdm, *per_pwrdm, *mpu_pwrdm; 27 27 static struct clockdomain *gfx_l4ls_clkdm; 28 28 static void __iomem *scu_base; 29 + static struct omap_hwmod *rtc_oh; 29 30 30 31 static int __init am43xx_map_scu(void) 31 32 { ··· 107 106 pr_err("PM: GFX domain did not transition: %x\n", status); 108 107 } 109 108 110 - static int am33xx_suspend(unsigned int state, int (*fn)(unsigned long)) 109 + static int am33xx_suspend(unsigned int state, int (*fn)(unsigned long), 110 + unsigned long args) 111 111 { 112 112 int ret = 0; 113 113 114 114 amx3_pre_suspend_common(); 115 - ret = cpu_suspend(0, fn); 115 + ret = cpu_suspend(args, fn); 116 116 amx3_post_suspend_common(); 117 117 118 118 /* ··· 130 128 return ret; 131 129 } 132 130 133 - static int am43xx_suspend(unsigned int state, int (*fn)(unsigned long)) 131 + static int am43xx_suspend(unsigned int state, int (*fn)(unsigned long), 132 + unsigned long args) 134 133 { 135 134 int ret = 0; 136 135 137 136 amx3_pre_suspend_common(); 138 137 scu_power_mode(scu_base, SCU_PM_POWEROFF); 139 - ret = cpu_suspend(0, fn); 138 + ret = cpu_suspend(args, fn); 140 139 scu_power_mode(scu_base, SCU_PM_NORMAL); 141 140 amx3_post_suspend_common(); 142 141 ··· 154 151 return NULL; 155 152 } 156 153 154 + void __iomem *am43xx_get_rtc_base_addr(void) 155 + { 156 + rtc_oh = omap_hwmod_lookup("rtc"); 157 + 158 + return omap_hwmod_get_mpu_rt_va(rtc_oh); 159 + } 160 + 157 161 static struct am33xx_pm_platform_data am33xx_ops = { 158 162 .init = am33xx_suspend_init, 159 163 .soc_suspend = am33xx_suspend, 160 164 .get_sram_addrs = amx3_get_sram_addrs, 165 + .get_rtc_base_addr = am43xx_get_rtc_base_addr, 161 166 }; 162 167 163 168 static struct am33xx_pm_platform_data am43xx_ops = { 164 169 .init = am43xx_suspend_init, 165 170 .soc_suspend = am43xx_suspend, 166 171 .get_sram_addrs = amx3_get_sram_addrs, 172 + .get_rtc_base_addr = am43xx_get_rtc_base_addr, 167 173 }; 168 174 169 175 static struct am33xx_pm_platform_data *am33xx_pm_get_pdata(void)
+50 -2
arch/arm/mach-omap2/sleep33xx.S
··· 8 8 9 9 #include <generated/ti-pm-asm-offsets.h> 10 10 #include <linux/linkage.h> 11 + #include <linux/platform_data/pm33xx.h> 11 12 #include <linux/ti-emif-sram.h> 12 13 #include <asm/assembler.h> 13 14 #include <asm/memory.h> ··· 20 19 #define AM33XX_CM_CLKCTRL_MODULEMODE_DISABLE 0x0003 21 20 #define AM33XX_CM_CLKCTRL_MODULEMODE_ENABLE 0x0002 22 21 22 + /* replicated define because linux/bitops.h cannot be included in assembly */ 23 + #define BIT(nr) (1 << (nr)) 24 + 23 25 .arm 24 26 .align 3 25 27 26 28 ENTRY(am33xx_do_wfi) 27 29 stmfd sp!, {r4 - r11, lr} @ save registers on stack 30 + 31 + /* Save wfi_flags arg to data space */ 32 + mov r4, r0 33 + adr r3, am33xx_pm_ro_sram_data 34 + ldr r2, [r3, #AMX3_PM_RO_SRAM_DATA_VIRT_OFFSET] 35 + str r4, [r2, #AMX3_PM_WFI_FLAGS_OFFSET] 36 + 37 + /* Only flush cache is we know we are losing MPU context */ 38 + tst r4, #WFI_FLAG_FLUSH_CACHE 39 + beq cache_skip_flush 28 40 29 41 /* 30 42 * Flush all data from the L1 and L2 data cache before disabling ··· 62 48 ldr r1, kernel_flush 63 49 blx r1 64 50 51 + adr r3, am33xx_pm_ro_sram_data 52 + ldr r2, [r3, #AMX3_PM_RO_SRAM_DATA_VIRT_OFFSET] 53 + ldr r4, [r2, #AMX3_PM_WFI_FLAGS_OFFSET] 54 + 55 + cache_skip_flush: 56 + /* Check if we want self refresh */ 57 + tst r4, #WFI_FLAG_SELF_REFRESH 58 + beq emif_skip_enter_sr 59 + 65 60 adr r9, am33xx_emif_sram_table 66 61 67 62 ldr r3, [r9, #EMIF_PM_ENTER_SR_OFFSET] 68 63 blx r3 69 64 65 + emif_skip_enter_sr: 66 + /* Only necessary if PER is losing context */ 67 + tst r4, #WFI_FLAG_SAVE_EMIF 68 + beq emif_skip_save 69 + 70 70 ldr r3, [r9, #EMIF_PM_SAVE_CONTEXT_OFFSET] 71 71 blx r3 72 + 73 + emif_skip_save: 74 + /* Only can disable EMIF if we have entered self refresh */ 75 + tst r4, #WFI_FLAG_SELF_REFRESH 76 + beq emif_skip_disable 72 77 73 78 /* Disable EMIF */ 74 79 ldr r1, virt_emif_clkctrl ··· 102 69 cmp r2, r3 103 70 bne wait_emif_disable 104 71 72 + emif_skip_disable: 73 + tst r4, #WFI_FLAG_WAKE_M3 74 + beq wkup_m3_skip 75 + 105 76 /* 106 77 * For the MPU WFI to be registered as an interrupt 107 78 * to WKUP_M3, MPU_CLKCTRL.MODULEMODE needs to be set ··· 116 79 bic r2, r2, #AM33XX_CM_CLKCTRL_MODULEMODE_DISABLE 117 80 str r2, [r1] 118 81 82 + wkup_m3_skip: 119 83 /* 120 84 * Execute an ISB instruction to ensure that all of the 121 85 * CP15 register changes have been committed. ··· 170 132 cmp r2, r3 171 133 bne wait_emif_enable 172 134 135 + /* Only necessary if PER is losing context */ 136 + tst r4, #WFI_FLAG_SELF_REFRESH 137 + beq emif_skip_exit_sr_abt 173 138 139 + adr r9, am33xx_emif_sram_table 174 140 ldr r1, [r9, #EMIF_PM_ABORT_SR_OFFSET] 175 141 blx r1 142 + 143 + emif_skip_exit_sr_abt: 144 + tst r4, #WFI_FLAG_FLUSH_CACHE 145 + beq cache_skip_restore 176 146 177 147 /* 178 148 * Set SCTLR.C bit to allow data cache allocation ··· 190 144 mcr p15, 0, r0, c1, c0, 0 191 145 isb 192 146 147 + cache_skip_restore: 193 148 /* Let the suspend code know about the abort */ 194 149 mov r0, #1 195 150 ldmfd sp!, {r4 - r11, pc} @ restore regs and return ··· 228 181 * Local variables 229 182 */ 230 183 .align 231 - resume_addr: 232 - .word cpu_resume - PAGE_OFFSET + 0x80000000 233 184 kernel_flush: 234 185 .word v7_flush_dcache_all 235 186 virt_mpu_clkctrl: ··· 249 204 .word am33xx_resume_offset 250 205 .word am33xx_emif_sram_table 251 206 .word am33xx_pm_ro_sram_data 207 + 208 + resume_addr: 209 + .word cpu_resume - PAGE_OFFSET + 0x80000000 252 210 253 211 .align 3 254 212 ENTRY(am33xx_pm_ro_sram_data)
+104 -6
arch/arm/mach-omap2/sleep43xx.S
··· 9 9 #include <generated/ti-pm-asm-offsets.h> 10 10 #include <linux/linkage.h> 11 11 #include <linux/ti-emif-sram.h> 12 - 12 + #include <linux/platform_data/pm33xx.h> 13 13 #include <asm/assembler.h> 14 14 #include <asm/hardware/cache-l2x0.h> 15 15 #include <asm/memory.h> ··· 21 21 #include "omap44xx.h" 22 22 #include "prm33xx.h" 23 23 #include "prcm43xx.h" 24 + 25 + /* replicated define because linux/bitops.h cannot be included in assembly */ 26 + #define BIT(nr) (1 << (nr)) 24 27 25 28 #define AM33XX_CM_CLKCTRL_MODULESTATE_DISABLED 0x00030000 26 29 #define AM33XX_CM_CLKCTRL_MODULEMODE_DISABLE 0x0003 ··· 48 45 AM43XX_CM_PER_EMIF_CLKCTRL_OFFSET) 49 46 #define AM43XX_PRM_EMIF_CTRL_OFFSET 0x0030 50 47 48 + #define RTC_SECONDS_REG 0x0 49 + #define RTC_PMIC_REG 0x98 50 + #define RTC_PMIC_POWER_EN BIT(16) 51 + #define RTC_PMIC_EXT_WAKEUP_STS BIT(12) 52 + #define RTC_PMIC_EXT_WAKEUP_POL BIT(4) 53 + #define RTC_PMIC_EXT_WAKEUP_EN BIT(0) 54 + 51 55 .arm 52 56 .align 3 53 57 54 58 ENTRY(am43xx_do_wfi) 55 59 stmfd sp!, {r4 - r11, lr} @ save registers on stack 60 + 61 + /* Save wfi_flags arg to data space */ 62 + mov r4, r0 63 + adr r3, am43xx_pm_ro_sram_data 64 + ldr r2, [r3, #AMX3_PM_RO_SRAM_DATA_VIRT_OFFSET] 65 + str r4, [r2, #AMX3_PM_WFI_FLAGS_OFFSET] 56 66 57 67 #ifdef CONFIG_CACHE_L2X0 58 68 /* Retrieve l2 cache virt address BEFORE we shut off EMIF */ ··· 73 57 blx r1 74 58 mov r8, r0 75 59 #endif 60 + 61 + /* Only flush cache is we know we are losing MPU context */ 62 + tst r4, #WFI_FLAG_FLUSH_CACHE 63 + beq cache_skip_flush 76 64 77 65 /* 78 66 * Flush all data from the L1 and L2 data cache before disabling ··· 148 128 bne sync 149 129 #endif 150 130 131 + /* Restore wfi_flags */ 132 + adr r3, am43xx_pm_ro_sram_data 133 + ldr r2, [r3, #AMX3_PM_RO_SRAM_DATA_VIRT_OFFSET] 134 + ldr r4, [r2, #AMX3_PM_WFI_FLAGS_OFFSET] 135 + 136 + cache_skip_flush: 137 + /* 138 + * If we are trying to enter RTC+DDR mode we must perform 139 + * a read from the rtc address space to ensure translation 140 + * presence in the TLB to avoid page table walk after DDR 141 + * is unavailable. 142 + */ 143 + tst r4, #WFI_FLAG_RTC_ONLY 144 + beq skip_rtc_va_refresh 145 + 146 + adr r3, am43xx_pm_ro_sram_data 147 + ldr r1, [r3, #AMX3_PM_RTC_BASE_VIRT_OFFSET] 148 + ldr r0, [r1] 149 + 150 + skip_rtc_va_refresh: 151 + /* Check if we want self refresh */ 152 + tst r4, #WFI_FLAG_SELF_REFRESH 153 + beq emif_skip_enter_sr 154 + 151 155 adr r9, am43xx_emif_sram_table 152 156 153 157 ldr r3, [r9, #EMIF_PM_ENTER_SR_OFFSET] 154 158 blx r3 155 159 160 + emif_skip_enter_sr: 161 + /* Only necessary if PER is losing context */ 162 + tst r4, #WFI_FLAG_SAVE_EMIF 163 + beq emif_skip_save 164 + 156 165 ldr r3, [r9, #EMIF_PM_SAVE_CONTEXT_OFFSET] 157 - blx r3 166 + blx r3 167 + 168 + emif_skip_save: 169 + /* Only can disable EMIF if we have entered self refresh */ 170 + tst r4, #WFI_FLAG_SELF_REFRESH 171 + beq emif_skip_disable 158 172 159 173 /* Disable EMIF */ 160 174 ldr r1, am43xx_virt_emif_clkctrl ··· 201 147 mov r3, #AM33XX_CM_CLKCTRL_MODULESTATE_DISABLED 202 148 cmp r2, r3 203 149 bne wait_emif_disable 150 + 151 + emif_skip_disable: 152 + tst r4, #WFI_FLAG_RTC_ONLY 153 + beq skip_rtc_only 154 + 155 + adr r3, am43xx_pm_ro_sram_data 156 + ldr r1, [r3, #AMX3_PM_RTC_BASE_VIRT_OFFSET] 157 + 158 + ldr r0, [r1, #RTC_PMIC_REG] 159 + orr r0, r0, #RTC_PMIC_POWER_EN 160 + orr r0, r0, #RTC_PMIC_EXT_WAKEUP_STS 161 + orr r0, r0, #RTC_PMIC_EXT_WAKEUP_EN 162 + orr r0, r0, #RTC_PMIC_EXT_WAKEUP_POL 163 + str r0, [r1, #RTC_PMIC_REG] 164 + ldr r0, [r1, #RTC_PMIC_REG] 165 + /* Wait for 2 seconds to lose power */ 166 + mov r3, #2 167 + ldr r2, [r1, #RTC_SECONDS_REG] 168 + rtc_loop: 169 + ldr r0, [r1, #RTC_SECONDS_REG] 170 + cmp r0, r2 171 + beq rtc_loop 172 + mov r2, r0 173 + subs r3, r3, #1 174 + bne rtc_loop 175 + 176 + b re_enable_emif 177 + 178 + skip_rtc_only: 179 + 180 + tst r4, #WFI_FLAG_WAKE_M3 181 + beq wkup_m3_skip 204 182 205 183 /* 206 184 * For the MPU WFI to be registered as an interrupt ··· 251 165 mov r2, #AM43XX_CM_CLKSTCTRL_CLKTRCTRL_SW_SLEEP 252 166 str r2, [r1] 253 167 168 + wkup_m3_skip: 254 169 /* 255 170 * Execute a barrier instruction to ensure that all cache, 256 171 * TLB and branch predictor maintenance operations issued ··· 296 209 mov r2, #AM33XX_CM_CLKCTRL_MODULEMODE_ENABLE 297 210 str r2, [r1] 298 211 212 + re_enable_emif: 299 213 /* Re-enable EMIF */ 300 214 ldr r1, am43xx_virt_emif_clkctrl 301 215 mov r2, #AM33XX_CM_CLKCTRL_MODULEMODE_ENABLE ··· 306 218 cmp r2, r3 307 219 bne wait_emif_enable 308 220 221 + tst r4, #WFI_FLAG_FLUSH_CACHE 222 + beq cache_skip_restore 223 + 309 224 /* 310 225 * Set SCTLR.C bit to allow data cache allocation 311 226 */ ··· 317 226 mcr p15, 0, r0, c1, c0, 0 318 227 isb 319 228 320 - ldr r1, [r9, #EMIF_PM_ABORT_SR_OFFSET] 321 - blx r1 229 + cache_skip_restore: 230 + /* Only necessary if PER is losing context */ 231 + tst r4, #WFI_FLAG_SELF_REFRESH 232 + beq emif_skip_exit_sr_abt 322 233 234 + adr r9, am43xx_emif_sram_table 235 + ldr r1, [r9, #EMIF_PM_ABORT_SR_OFFSET] 236 + blx r1 237 + 238 + emif_skip_exit_sr_abt: 323 239 /* Let the suspend code know about the abort */ 324 240 mov r0, #1 325 241 ldmfd sp!, {r4 - r11, pc} @ restore regs and return ··· 431 333 * Local variables 432 334 */ 433 335 .align 434 - resume_addr: 435 - .word cpu_resume - PAGE_OFFSET + 0x80000000 436 336 kernel_flush: 437 337 .word v7_flush_dcache_all 438 338 ddr_start: ··· 477 381 .word am43xx_emif_sram_table 478 382 .word am43xx_pm_ro_sram_data 479 383 384 + resume_addr: 385 + .word cpu_resume - PAGE_OFFSET + 0x80000000 480 386 .align 3 481 387 482 388 ENTRY(am43xx_pm_ro_sram_data)
+13
arch/arm/mach-pxa/devices.c
··· 3 3 #include <linux/kernel.h> 4 4 #include <linux/init.h> 5 5 #include <linux/platform_device.h> 6 + #include <linux/clkdev.h> 6 7 #include <linux/dma-mapping.h> 7 8 #include <linux/dmaengine.h> 8 9 #include <linux/spi/pxa2xx_spi.h> ··· 478 477 479 478 void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops) 480 479 { 480 + int ret; 481 + 482 + ret = clk_add_alias("ac97_clk", "pxa2xx-ac97:0", "AC97CLK", 483 + &pxa_device_ac97.dev); 484 + if (ret) 485 + pr_err("PXA AC97 clock1 alias error: %d\n", ret); 486 + 487 + ret = clk_add_alias("ac97_clk", "pxa2xx-ac97:1", "AC97CLK", 488 + &pxa_device_ac97.dev); 489 + if (ret) 490 + pr_err("PXA AC97 clock2 alias error: %d\n", ret); 491 + 481 492 pxa_register_device(&pxa_device_ac97, ops); 482 493 } 483 494
+4
arch/arm/mach-pxa/hx4700.c
··· 54 54 55 55 #include "devices.h" 56 56 #include "generic.h" 57 + #include "udc.h" 57 58 58 59 /* Physical address space information */ 59 60 ··· 595 594 }, 596 595 }; 597 596 597 + static struct pxa2xx_udc_mach_info hx4700_udc_info; 598 + 598 599 /* 599 600 * Touchscreen - TSC2046 connected to SSP2 600 601 */ ··· 894 891 gpio_set_value(GPIO71_HX4700_ASIC3_nRESET, 1); 895 892 mdelay(10); 896 893 894 + pxa_set_udc_info(&hx4700_udc_info); 897 895 regulator_has_full_constraints(); 898 896 } 899 897
-2
arch/arm/mach-pxa/mioa701.c
··· 677 677 MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) 678 678 MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) 679 679 MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) 680 - MIO_SIMPLE_DEV(wm9713_acodec, "wm9713-codec", NULL); 681 680 MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); 682 681 683 682 static struct platform_device *devices[] __initdata = { 684 683 &mioa701_gpio_keys, 685 684 &mioa701_backlight, 686 685 &mioa701_led, 687 - &wm9713_acodec, 688 686 &pxa2xx_pcm, 689 687 &mioa701_sound, 690 688 &power_dev,
-11
arch/arm/mach-pxa/zylonite.c
··· 47 47 int lcd_id; 48 48 int lcd_orientation; 49 49 50 - struct platform_device pxa_device_wm9713_audio = { 51 - .name = "wm9713-codec", 52 - .id = -1, 53 - }; 54 - 55 - static void __init zylonite_init_wm9713_audio(void) 56 - { 57 - platform_device_register(&pxa_device_wm9713_audio); 58 - } 59 - 60 50 static struct resource smc91x_resources[] = { 61 51 [0] = { 62 52 .start = ZYLONITE_ETH_PHYS + 0x300, ··· 418 428 zylonite_init_nand(); 419 429 zylonite_init_leds(); 420 430 zylonite_init_ohci(); 421 - zylonite_init_wm9713_audio(); 422 431 } 423 432 424 433 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
+1 -1
arch/arm/mach-s3c24xx/include/mach/s3c2412.h
··· 6 6 */ 7 7 8 8 #ifndef __ARCH_ARM_MACH_S3C24XX_S3C2412_H 9 - #define __ARCH_ARM_REGS_S3C24XX_S3C2412_H __FILE__ 9 + #define __ARCH_ARM_MACH_S3C24XX_S3C2412_H __FILE__ 10 10 11 11 #define S3C2412_MEMREG(x) (S3C24XX_VA_MEMCTRL + (x)) 12 12 #define S3C2412_EBIREG(x) (S3C2412_VA_EBI + (x))
+2
arch/arm/mach-shmobile/Kconfig
··· 15 15 16 16 config ARCH_RCAR_GEN2 17 17 bool 18 + select HAVE_ARM_ARCH_TIMER 18 19 select PM 19 20 select PM_GENERIC_DOMAINS 20 21 select RENESAS_IRQC ··· 59 58 bool "R-Mobile APE6 (R8A73A40)" 60 59 select ARCH_RMOBILE 61 60 select ARM_ERRATA_798181 if SMP 61 + select HAVE_ARM_ARCH_TIMER 62 62 select RENESAS_IRQC 63 63 64 64 config ARCH_R8A7740
+2 -6
arch/arm/mach-shmobile/Makefile
··· 11 11 obj-$(CONFIG_ARCH_R8A73A4) += setup-r8a73a4.o 12 12 obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o 13 13 obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 14 - obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o pm-r8a7779.o 15 - obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 16 - obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o 14 + obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o 17 15 obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o 18 16 obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o 19 17 ··· 21 23 # Shared SoC family objects 22 24 obj-$(CONFIG_ARCH_RCAR_GEN2) += setup-rcar-gen2.o platsmp-apmu.o $(cpu-y) 23 25 CFLAGS_setup-rcar-gen2.o += -march=armv7-a 24 - obj-$(CONFIG_ARCH_RCAR_GEN2) += headsmp-apmu.o 25 26 obj-$(CONFIG_ARCH_R8A7790) += regulator-quirk-rcar-gen2.o 26 27 obj-$(CONFIG_ARCH_R8A7791) += regulator-quirk-rcar-gen2.o 27 28 obj-$(CONFIG_ARCH_R8A7793) += regulator-quirk-rcar-gen2.o 28 29 29 30 # SMP objects 30 31 smp-y := $(cpu-y) 32 + smp-$(CONFIG_ARCH_RCAR_GEN2) += headsmp-apmu.o 31 33 smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o 32 34 smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o 33 - smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o 34 - smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o 35 35 smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o 36 36 37 37 # PM objects
-1
arch/arm/mach-shmobile/common.h
··· 15 15 extern void shmobile_smp_hook(unsigned int cpu, unsigned long fn, 16 16 unsigned long arg); 17 17 extern bool shmobile_smp_cpu_can_disable(unsigned int cpu); 18 - extern bool shmobile_smp_init_fallback_ops(void); 19 18 extern void shmobile_boot_apmu(void); 20 19 extern void shmobile_boot_scu(void); 21 20 extern void shmobile_smp_scu_prepare_cpus(phys_addr_t scu_base_phys,
+1 -6
arch/arm/mach-shmobile/headsmp-apmu.S
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 2 3 * SMP support for APMU based systems with Cortex A7/A15 3 4 * 4 5 * Copyright (C) 2014 Renesas Electronics Corporation 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License version 2 as 8 - * published by the Free Software Foundation. 9 6 */ 10 7 11 8 #include <linux/linkage.h> 12 9 #include <asm/assembler.h> 13 10 14 - #ifdef CONFIG_SMP 15 11 ENTRY(shmobile_boot_apmu) 16 12 bl secure_cntvoff_init 17 13 b secondary_startup 18 14 ENDPROC(shmobile_boot_apmu) 19 - #endif
+101 -144
arch/arm/mach-shmobile/platsmp-apmu.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * SMP support for SoCs with APMU 3 4 * 4 5 * Copyright (C) 2014 Renesas Electronics Corporation 5 6 * Copyright (C) 2013 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License version 2 as 9 - * published by the Free Software Foundation. 10 7 */ 11 8 #include <linux/cpu_pm.h> 12 9 #include <linux/delay.h> ··· 20 23 #include <asm/smp_plat.h> 21 24 #include <asm/suspend.h> 22 25 #include "common.h" 23 - #include "platsmp-apmu.h" 24 26 #include "rcar-gen2.h" 25 27 26 28 static struct { ··· 83 87 return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL; 84 88 } 85 89 90 + #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) 91 + /* nicked from arch/arm/mach-exynos/hotplug.c */ 92 + static inline void cpu_enter_lowpower_a15(void) 93 + { 94 + unsigned int v; 95 + 96 + asm volatile( 97 + " mrc p15, 0, %0, c1, c0, 0\n" 98 + " bic %0, %0, %1\n" 99 + " mcr p15, 0, %0, c1, c0, 0\n" 100 + : "=&r" (v) 101 + : "Ir" (CR_C) 102 + : "cc"); 103 + 104 + flush_cache_louis(); 105 + 106 + asm volatile( 107 + /* 108 + * Turn off coherency 109 + */ 110 + " mrc p15, 0, %0, c1, c0, 1\n" 111 + " bic %0, %0, %1\n" 112 + " mcr p15, 0, %0, c1, c0, 1\n" 113 + : "=&r" (v) 114 + : "Ir" (0x40) 115 + : "cc"); 116 + 117 + isb(); 118 + dsb(); 119 + } 120 + 121 + static void shmobile_smp_apmu_cpu_shutdown(unsigned int cpu) 122 + { 123 + 124 + /* Select next sleep mode using the APMU */ 125 + apmu_wrap(cpu, apmu_power_off); 126 + 127 + /* Do ARM specific CPU shutdown */ 128 + cpu_enter_lowpower_a15(); 129 + } 130 + #endif 131 + 132 + #if defined(CONFIG_HOTPLUG_CPU) 133 + static void shmobile_smp_apmu_cpu_die(unsigned int cpu) 134 + { 135 + /* For this particular CPU deregister boot vector */ 136 + shmobile_smp_hook(cpu, 0, 0); 137 + 138 + /* Shutdown CPU core */ 139 + shmobile_smp_apmu_cpu_shutdown(cpu); 140 + 141 + /* jump to shared mach-shmobile sleep / reset code */ 142 + shmobile_smp_sleep(); 143 + } 144 + 145 + static int shmobile_smp_apmu_cpu_kill(unsigned int cpu) 146 + { 147 + return apmu_wrap(cpu, apmu_power_off_poll); 148 + } 149 + #endif 150 + 151 + #if defined(CONFIG_SUSPEND) 152 + static int shmobile_smp_apmu_do_suspend(unsigned long cpu) 153 + { 154 + shmobile_smp_hook(cpu, __pa_symbol(cpu_resume), 0); 155 + shmobile_smp_apmu_cpu_shutdown(cpu); 156 + cpu_do_idle(); /* WFI selects Core Standby */ 157 + return 1; 158 + } 159 + 160 + static inline void cpu_leave_lowpower(void) 161 + { 162 + unsigned int v; 163 + 164 + asm volatile("mrc p15, 0, %0, c1, c0, 0\n" 165 + " orr %0, %0, %1\n" 166 + " mcr p15, 0, %0, c1, c0, 0\n" 167 + " mrc p15, 0, %0, c1, c0, 1\n" 168 + " orr %0, %0, %2\n" 169 + " mcr p15, 0, %0, c1, c0, 1\n" 170 + : "=&r" (v) 171 + : "Ir" (CR_C), "Ir" (0x40) 172 + : "cc"); 173 + } 174 + 175 + static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) 176 + { 177 + cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); 178 + cpu_leave_lowpower(); 179 + return 0; 180 + } 181 + 182 + void __init shmobile_smp_apmu_suspend_init(void) 183 + { 184 + shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend; 185 + } 186 + #endif 187 + 86 188 #ifdef CONFIG_SMP 87 189 static void apmu_init_cpu(struct resource *res, int cpu, int bit) 88 190 { ··· 198 104 x = readl(apmu_cpus[cpu].iomem + DBGRCR_OFFS); 199 105 x |= DBGCPUREN | DBGCPUNREN(bit) | DBGCPUPREN; 200 106 writel(x, apmu_cpus[cpu].iomem + DBGRCR_OFFS); 201 - } 202 - 203 - static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit), 204 - struct rcar_apmu_config *apmu_config, int num) 205 - { 206 - int id; 207 - int k; 208 - int bit, index; 209 - bool is_allowed; 210 - 211 - for (k = 0; k < num; k++) { 212 - /* only enable the cluster that includes the boot CPU */ 213 - is_allowed = false; 214 - for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) { 215 - id = apmu_config[k].cpus[bit]; 216 - if (id >= 0) { 217 - if (id == cpu_logical_map(0)) 218 - is_allowed = true; 219 - } 220 - } 221 - if (!is_allowed) 222 - continue; 223 - 224 - for (bit = 0; bit < ARRAY_SIZE(apmu_config[k].cpus); bit++) { 225 - id = apmu_config[k].cpus[bit]; 226 - if (id >= 0) { 227 - index = get_logical_index(id); 228 - if (index >= 0) 229 - fn(&apmu_config[k].iomem, index, bit); 230 - } 231 - } 232 - } 233 107 } 234 108 235 109 static const struct of_device_id apmu_ids[] = { ··· 256 194 shmobile_boot_fn_gen2 = shmobile_boot_fn; 257 195 } 258 196 259 - void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, 260 - struct rcar_apmu_config *apmu_config, 261 - int num) 262 - { 263 - shmobile_smp_apmu_setup_boot(); 264 - apmu_parse_cfg(apmu_init_cpu, apmu_config, num); 265 - } 266 - 267 - int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) 197 + static int shmobile_smp_apmu_boot_secondary(unsigned int cpu, 198 + struct task_struct *idle) 268 199 { 269 200 /* For this particular CPU register boot vector */ 270 201 shmobile_smp_hook(cpu, __pa_symbol(shmobile_boot_apmu), 0); ··· 284 229 285 230 CPU_METHOD_OF_DECLARE(shmobile_smp_apmu, "renesas,apmu", &apmu_smp_ops); 286 231 #endif /* CONFIG_SMP */ 287 - 288 - #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) 289 - /* nicked from arch/arm/mach-exynos/hotplug.c */ 290 - static inline void cpu_enter_lowpower_a15(void) 291 - { 292 - unsigned int v; 293 - 294 - asm volatile( 295 - " mrc p15, 0, %0, c1, c0, 0\n" 296 - " bic %0, %0, %1\n" 297 - " mcr p15, 0, %0, c1, c0, 0\n" 298 - : "=&r" (v) 299 - : "Ir" (CR_C) 300 - : "cc"); 301 - 302 - flush_cache_louis(); 303 - 304 - asm volatile( 305 - /* 306 - * Turn off coherency 307 - */ 308 - " mrc p15, 0, %0, c1, c0, 1\n" 309 - " bic %0, %0, %1\n" 310 - " mcr p15, 0, %0, c1, c0, 1\n" 311 - : "=&r" (v) 312 - : "Ir" (0x40) 313 - : "cc"); 314 - 315 - isb(); 316 - dsb(); 317 - } 318 - 319 - static void shmobile_smp_apmu_cpu_shutdown(unsigned int cpu) 320 - { 321 - 322 - /* Select next sleep mode using the APMU */ 323 - apmu_wrap(cpu, apmu_power_off); 324 - 325 - /* Do ARM specific CPU shutdown */ 326 - cpu_enter_lowpower_a15(); 327 - } 328 - 329 - static inline void cpu_leave_lowpower(void) 330 - { 331 - unsigned int v; 332 - 333 - asm volatile("mrc p15, 0, %0, c1, c0, 0\n" 334 - " orr %0, %0, %1\n" 335 - " mcr p15, 0, %0, c1, c0, 0\n" 336 - " mrc p15, 0, %0, c1, c0, 1\n" 337 - " orr %0, %0, %2\n" 338 - " mcr p15, 0, %0, c1, c0, 1\n" 339 - : "=&r" (v) 340 - : "Ir" (CR_C), "Ir" (0x40) 341 - : "cc"); 342 - } 343 - #endif 344 - 345 - #if defined(CONFIG_HOTPLUG_CPU) 346 - void shmobile_smp_apmu_cpu_die(unsigned int cpu) 347 - { 348 - /* For this particular CPU deregister boot vector */ 349 - shmobile_smp_hook(cpu, 0, 0); 350 - 351 - /* Shutdown CPU core */ 352 - shmobile_smp_apmu_cpu_shutdown(cpu); 353 - 354 - /* jump to shared mach-shmobile sleep / reset code */ 355 - shmobile_smp_sleep(); 356 - } 357 - 358 - int shmobile_smp_apmu_cpu_kill(unsigned int cpu) 359 - { 360 - return apmu_wrap(cpu, apmu_power_off_poll); 361 - } 362 - #endif 363 - 364 - #if defined(CONFIG_SUSPEND) 365 - static int shmobile_smp_apmu_do_suspend(unsigned long cpu) 366 - { 367 - shmobile_smp_hook(cpu, __pa_symbol(cpu_resume), 0); 368 - shmobile_smp_apmu_cpu_shutdown(cpu); 369 - cpu_do_idle(); /* WFI selects Core Standby */ 370 - return 1; 371 - } 372 - 373 - static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) 374 - { 375 - cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); 376 - cpu_leave_lowpower(); 377 - return 0; 378 - } 379 - 380 - void __init shmobile_smp_apmu_suspend_init(void) 381 - { 382 - shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend; 383 - } 384 - #endif
-32
arch/arm/mach-shmobile/platsmp-apmu.h
··· 1 - /* 2 - * rmobile apmu definition 3 - * 4 - * Copyright (C) 2014 Renesas Electronics Corporation 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; version 2 of the License. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 - */ 15 - 16 - #ifndef PLATSMP_APMU_H 17 - #define PLATSMP_APMU_H 18 - 19 - struct rcar_apmu_config { 20 - struct resource iomem; 21 - int cpus[4]; 22 - }; 23 - 24 - extern void shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus, 25 - struct rcar_apmu_config *apmu_config, 26 - int num); 27 - extern int shmobile_smp_apmu_boot_secondary(unsigned int cpu, 28 - struct task_struct *idle); 29 - extern void shmobile_smp_apmu_cpu_die(unsigned int cpu); 30 - extern int shmobile_smp_apmu_cpu_kill(unsigned int cpu); 31 - 32 - #endif /* PLATSMP_APMU_H */
-9
arch/arm/mach-shmobile/platsmp.c
··· 36 36 return true; /* Hotplug of any CPU is supported */ 37 37 } 38 38 #endif 39 - 40 - bool __init shmobile_smp_init_fallback_ops(void) 41 - { 42 - /* fallback on PSCI/smp_ops if no other DT based method is detected */ 43 - if (!IS_ENABLED(CONFIG_SMP)) 44 - return false; 45 - 46 - return platform_can_secondary_boot() ? true : false; 47 - }
-41
arch/arm/mach-shmobile/pm-r8a7779.c
··· 1 - /* 2 - * r8a7779 Power management support 3 - * 4 - * Copyright (C) 2011 Renesas Solutions Corp. 5 - * Copyright (C) 2011 Magnus Damm 6 - * 7 - * This file is subject to the terms and conditions of the GNU General Public 8 - * License. See the file "COPYING" in the main directory of this archive 9 - * for more details. 10 - */ 11 - 12 - #include <linux/soc/renesas/rcar-sysc.h> 13 - 14 - #include <asm/io.h> 15 - 16 - #include "r8a7779.h" 17 - 18 - /* SYSC */ 19 - #define SYSCIER 0x0c 20 - #define SYSCIMR 0x10 21 - 22 - #if defined(CONFIG_PM) || defined(CONFIG_SMP) 23 - 24 - static void __init r8a7779_sysc_init(void) 25 - { 26 - rcar_sysc_init(0xffd85000, 0x0131000e); 27 - } 28 - 29 - #else /* CONFIG_PM || CONFIG_SMP */ 30 - 31 - static inline void r8a7779_sysc_init(void) {} 32 - 33 - #endif /* CONFIG_PM || CONFIG_SMP */ 34 - 35 - void __init r8a7779_pm_init(void) 36 - { 37 - static int once; 38 - 39 - if (!once++) 40 - r8a7779_sysc_init(); 41 - }
-25
arch/arm/mach-shmobile/pm-rcar-gen2.c
··· 15 15 #include <linux/of.h> 16 16 #include <linux/of_address.h> 17 17 #include <linux/smp.h> 18 - #include <linux/soc/renesas/rcar-sysc.h> 19 18 #include <asm/io.h> 20 19 #include <asm/cputype.h> 21 20 #include "common.h" ··· 45 46 return (addr >> 8) & 0xfffffc00; 46 47 } 47 48 48 - /* SYSC */ 49 - #define SYSCIER 0x0c 50 - #define SYSCIMR 0x10 51 - 52 - #if defined(CONFIG_SMP) 53 - 54 - static void __init rcar_gen2_sysc_init(u32 syscier) 55 - { 56 - rcar_sysc_init(0xe6180000, syscier); 57 - } 58 - 59 - #else /* CONFIG_SMP */ 60 - 61 - static inline void rcar_gen2_sysc_init(u32 syscier) {} 62 - 63 - #endif /* CONFIG_SMP */ 64 - 65 49 void __init rcar_gen2_pm_init(void) 66 50 { 67 51 void __iomem *p; ··· 54 72 bool has_a7 = false; 55 73 bool has_a15 = false; 56 74 struct resource res; 57 - u32 syscier = 0; 58 75 int error; 59 76 60 77 if (once++) ··· 69 88 else if (of_device_is_compatible(np, "arm,cortex-a7")) 70 89 has_a7 = true; 71 90 } 72 - 73 - if (of_machine_is_compatible("renesas,r8a7790")) 74 - syscier = 0x013111ef; 75 - else if (of_machine_is_compatible("renesas,r8a7791")) 76 - syscier = 0x00111003; 77 91 78 92 np = of_find_compatible_node(NULL, NULL, "renesas,smp-sram"); 79 93 if (!np) { ··· 131 155 } 132 156 iounmap(p); 133 157 134 - rcar_gen2_sysc_init(syscier); 135 158 shmobile_smp_apmu_suspend_init(); 136 159 }
-2
arch/arm/mach-shmobile/r8a7779.h
··· 2 2 #ifndef __ASM_R8A7779_H__ 3 3 #define __ASM_R8A7779_H__ 4 4 5 - extern void r8a7779_pm_init(void); 6 - 7 5 extern const struct smp_operations r8a7779_smp_ops; 8 6 9 7 #endif /* __ASM_R8A7779_H__ */
-7
arch/arm/mach-shmobile/r8a7790.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_R8A7790_H__ 3 - #define __ASM_R8A7790_H__ 4 - 5 - extern const struct smp_operations r8a7790_smp_ops; 6 - 7 - #endif /* __ASM_R8A7790_H__ */
-7
arch/arm/mach-shmobile/r8a7791.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __ASM_R8A7791_H__ 3 - #define __ASM_R8A7791_H__ 4 - 5 - extern const struct smp_operations r8a7791_smp_ops; 6 - 7 - #endif /* __ASM_R8A7791_H__ */
+1 -9
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * R-Car Generation 2 da9063/da9210 regulator quirk 3 4 * ··· 17 16 * been initialized, but before the i2c slave drivers are initialized. 18 17 * 19 18 * Copyright (C) 2015 Glider bvba 20 - * 21 - * This program is free software; you can redistribute it and/or modify 22 - * it under the terms of the GNU General Public License as published by 23 - * the Free Software Foundation; version 2 of the License. 24 - * 25 - * This program is distributed in the hope that it will be useful, 26 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 27 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 - * GNU General Public License for more details. 29 19 */ 30 20 31 21 #include <linux/device.h>
+1 -9
arch/arm/mach-shmobile/setup-emev2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * Emma Mobile EV2 processor support 3 4 * 4 5 * Copyright (C) 2012 Magnus Damm 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License as published by 8 - * the Free Software Foundation; version 2 of the License. 9 - * 10 - * This program is distributed in the hope that it will be useful, 11 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 - * GNU General Public License for more details. 14 6 */ 15 7 #include <linux/kernel.h> 16 8 #include <linux/init.h>
+1 -9
arch/arm/mach-shmobile/setup-r7s72100.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * r7s72100 processor support 3 4 * 4 5 * Copyright (C) 2013 Renesas Solutions Corp. 5 6 * Copyright (C) 2013 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 17 9 #include <linux/kernel.h>
+1 -10
arch/arm/mach-shmobile/setup-r8a73a4.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * r8a73a4 processor support 3 4 * 4 5 * Copyright (C) 2013 Renesas Solutions Corp. 5 6 * Copyright (C) 2013 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 17 9 #include <linux/init.h> ··· 18 26 }; 19 27 20 28 DT_MACHINE_START(R8A73A4_DT, "Generic R8A73A4 (Flattened Device Tree)") 21 - .init_early = shmobile_init_delay, 22 29 .init_late = shmobile_init_late, 23 30 .dt_compat = r8a73a4_boards_compat_dt, 24 31 MACHINE_END
+1 -9
arch/arm/mach-shmobile/setup-r8a7740.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * R8A7740 processor support 3 4 * 4 5 * Copyright (C) 2011 Renesas Solutions Corp. 5 6 * Copyright (C) 2011 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 #include <linux/kernel.h> 17 9 #include <linux/init.h>
+1 -9
arch/arm/mach-shmobile/setup-r8a7778.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * r8a7778 processor support 3 4 * 4 5 * Copyright (C) 2013 Renesas Solutions Corp. 5 6 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 6 7 * Copyright (C) 2013 Cogent Embedded, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; version 2 of the License. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 18 10 #include <linux/io.h>
+1 -9
arch/arm/mach-shmobile/setup-r8a7779.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * r8a7779 processor support 3 4 * 4 5 * Copyright (C) 2011, 2013 Renesas Solutions Corp. 5 6 * Copyright (C) 2011 Magnus Damm 6 7 * Copyright (C) 2013 Cogent Embedded, Inc. 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; version 2 of the License. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 #include <linux/init.h> 18 10 #include <linux/irq.h>
-38
arch/arm/mach-shmobile/setup-r8a7790.c
··· 1 - /* 2 - * r8a7790 processor support 3 - * 4 - * Copyright (C) 2013 Renesas Solutions Corp. 5 - * Copyright (C) 2013 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - */ 16 - 17 - #include <linux/init.h> 18 - 19 - #include <asm/mach/arch.h> 20 - 21 - #include "common.h" 22 - #include "r8a7790.h" 23 - #include "rcar-gen2.h" 24 - 25 - static const char * const r8a7790_boards_compat_dt[] __initconst = { 26 - "renesas,r8a7790", 27 - NULL, 28 - }; 29 - 30 - DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 31 - .smp_init = smp_init_ops(shmobile_smp_init_fallback_ops), 32 - .smp = smp_ops(r8a7790_smp_ops), 33 - .init_early = shmobile_init_delay, 34 - .init_time = rcar_gen2_timer_init, 35 - .init_late = shmobile_init_late, 36 - .reserve = rcar_gen2_reserve, 37 - .dt_compat = r8a7790_boards_compat_dt, 38 - MACHINE_END
-39
arch/arm/mach-shmobile/setup-r8a7791.c
··· 1 - /* 2 - * r8a7791 processor support 3 - * 4 - * Copyright (C) 2013 Renesas Electronics Corporation 5 - * Copyright (C) 2013 Renesas Solutions Corp. 6 - * Copyright (C) 2013 Magnus Damm 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; version 2 of the License. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 - */ 17 - 18 - #include <linux/init.h> 19 - 20 - #include <asm/mach/arch.h> 21 - 22 - #include "common.h" 23 - #include "r8a7791.h" 24 - #include "rcar-gen2.h" 25 - 26 - static const char *const r8a7791_boards_compat_dt[] __initconst = { 27 - "renesas,r8a7791", 28 - NULL, 29 - }; 30 - 31 - DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") 32 - .smp_init = smp_init_ops(shmobile_smp_init_fallback_ops), 33 - .smp = smp_ops(r8a7791_smp_ops), 34 - .init_early = shmobile_init_delay, 35 - .init_time = rcar_gen2_timer_init, 36 - .init_late = shmobile_init_late, 37 - .reserve = rcar_gen2_reserve, 38 - .dt_compat = r8a7791_boards_compat_dt, 39 - MACHINE_END
+3 -17
arch/arm/mach-shmobile/setup-rcar-gen2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * R-Car Generation 2 support 3 4 * 4 5 * Copyright (C) 2013 Renesas Solutions Corp. 5 6 * Copyright (C) 2013 Magnus Damm 6 7 * Copyright (C) 2014 Ulrich Hecht 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; version 2 of the License. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 18 10 #include <linux/clk-provider.h> ··· 59 67 60 68 void __init rcar_gen2_timer_init(void) 61 69 { 62 - #ifdef CONFIG_ARM_ARCH_TIMER 63 70 void __iomem *base; 64 71 u32 freq; 65 72 ··· 100 109 } 101 110 102 111 iounmap(base); 103 - #endif /* CONFIG_ARM_ARCH_TIMER */ 104 112 105 113 of_clk_init(NULL); 106 114 timer_probe(); ··· 176 186 } 177 187 178 188 static const char * const rcar_gen2_boards_compat_dt[] __initconst = { 179 - /* 180 - * R8A7790 and R8A7791 can't be handled here as long as they need SMP 181 - * initialization fallback. 182 - */ 189 + "renesas,r8a7790", 190 + "renesas,r8a7791", 183 191 "renesas,r8a7792", 184 192 "renesas,r8a7793", 185 193 "renesas,r8a7794", ··· 185 197 }; 186 198 187 199 DT_MACHINE_START(RCAR_GEN2_DT, "Generic R-Car Gen2 (Flattened Device Tree)") 188 - .init_early = shmobile_init_delay, 189 200 .init_late = shmobile_init_late, 190 201 .init_time = rcar_gen2_timer_init, 191 202 .reserve = rcar_gen2_reserve, ··· 199 212 }; 200 213 201 214 DT_MACHINE_START(RZ_G1_DT, "Generic RZ/G1 (Flattened Device Tree)") 202 - .init_early = shmobile_init_delay, 203 215 .init_late = shmobile_init_late, 204 216 .init_time = rcar_gen2_timer_init, 205 217 .reserve = rcar_gen2_reserve,
+1 -9
arch/arm/mach-shmobile/setup-sh73a0.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * sh73a0 processor support 3 4 * 4 5 * Copyright (C) 2010 Takashi Yoshii 5 6 * Copyright (C) 2010 Magnus Damm 6 7 * Copyright (C) 2008 Yoshihiro Shimoda 7 - * 8 - * This program is free software; you can redistribute it and/or modify 9 - * it under the terms of the GNU General Public License as published by 10 - * the Free Software Foundation; version 2 of the License. 11 - * 12 - * This program is distributed in the hope that it will be useful, 13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 - * GNU General Public License for more details. 16 8 */ 17 9 #include <linux/kernel.h> 18 10 #include <linux/init.h>
+1 -9
arch/arm/mach-shmobile/smp-emev2.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * SMP support for Emma Mobile EV2 3 4 * 4 5 * Copyright (C) 2012 Renesas Solutions Corp. 5 6 * Copyright (C) 2012 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 #include <linux/kernel.h> 17 9 #include <linux/init.h>
+15 -65
arch/arm/mach-shmobile/smp-r8a7779.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * SMP support for R-Mobile / SH-Mobile - r8a7779 portion 3 4 * 4 5 * Copyright (C) 2011 Renesas Solutions Corp. 5 6 * Copyright (C) 2011 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 7 */ 16 8 #include <linux/kernel.h> 17 9 #include <linux/init.h> ··· 23 31 #define AVECR IOMEM(0xfe700040) 24 32 #define R8A7779_SCU_BASE 0xf0000000 25 33 26 - static const struct rcar_sysc_ch r8a7779_ch_cpu1 = { 27 - .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 28 - .chan_bit = 1, /* ARM1 */ 29 - .isr_bit = 1, /* ARM1 */ 30 - }; 31 - 32 - static const struct rcar_sysc_ch r8a7779_ch_cpu2 = { 33 - .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 34 - .chan_bit = 2, /* ARM2 */ 35 - .isr_bit = 2, /* ARM2 */ 36 - }; 37 - 38 - static const struct rcar_sysc_ch r8a7779_ch_cpu3 = { 39 - .chan_offs = 0x40, /* PWRSR0 .. PWRER0 */ 40 - .chan_bit = 3, /* ARM3 */ 41 - .isr_bit = 3, /* ARM3 */ 42 - }; 43 - 44 - static const struct rcar_sysc_ch * const r8a7779_ch_cpu[4] = { 45 - [1] = &r8a7779_ch_cpu1, 46 - [2] = &r8a7779_ch_cpu2, 47 - [3] = &r8a7779_ch_cpu3, 48 - }; 49 - 50 - static int r8a7779_platform_cpu_kill(unsigned int cpu) 34 + static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 51 35 { 52 - const struct rcar_sysc_ch *ch = NULL; 53 36 int ret = -EIO; 54 37 55 38 cpu = cpu_logical_map(cpu); 56 - 57 - if (cpu < ARRAY_SIZE(r8a7779_ch_cpu)) 58 - ch = r8a7779_ch_cpu[cpu]; 59 - 60 - if (ch) 61 - ret = rcar_sysc_power_down(ch); 62 - 63 - return ret ? ret : 1; 64 - } 65 - 66 - static int r8a7779_boot_secondary(unsigned int cpu, struct task_struct *idle) 67 - { 68 - const struct rcar_sysc_ch *ch = NULL; 69 - unsigned int lcpu = cpu_logical_map(cpu); 70 - int ret; 71 - 72 - if (lcpu < ARRAY_SIZE(r8a7779_ch_cpu)) 73 - ch = r8a7779_ch_cpu[lcpu]; 74 - 75 - if (ch) 76 - ret = rcar_sysc_power_up(ch); 77 - else 78 - ret = -EIO; 39 + if (cpu) 40 + ret = rcar_sysc_power_up_cpu(cpu); 79 41 80 42 return ret; 81 43 } ··· 41 95 42 96 /* setup r8a7779 specific SCU bits */ 43 97 shmobile_smp_scu_prepare_cpus(R8A7779_SCU_BASE, max_cpus); 44 - 45 - r8a7779_pm_init(); 46 - 47 - /* power off secondary CPUs */ 48 - r8a7779_platform_cpu_kill(1); 49 - r8a7779_platform_cpu_kill(2); 50 - r8a7779_platform_cpu_kill(3); 51 98 } 52 99 53 100 #ifdef CONFIG_HOTPLUG_CPU 101 + static int r8a7779_platform_cpu_kill(unsigned int cpu) 102 + { 103 + int ret = -EIO; 104 + 105 + cpu = cpu_logical_map(cpu); 106 + if (cpu) 107 + ret = rcar_sysc_power_down_cpu(cpu); 108 + 109 + return ret ? ret : 1; 110 + } 111 + 54 112 static int r8a7779_cpu_kill(unsigned int cpu) 55 113 { 56 114 if (shmobile_smp_scu_cpu_kill(cpu))
-71
arch/arm/mach-shmobile/smp-r8a7790.c
··· 1 - /* 2 - * SMP support for r8a7790 3 - * 4 - * Copyright (C) 2012-2013 Renesas Solutions Corp. 5 - * Copyright (C) 2012 Takashi Yoshii <takashi.yoshii.ze@renesas.com> 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - */ 16 - #include <linux/kernel.h> 17 - #include <linux/init.h> 18 - #include <linux/smp.h> 19 - #include <linux/io.h> 20 - #include <linux/soc/renesas/rcar-sysc.h> 21 - 22 - #include <asm/smp_plat.h> 23 - 24 - #include "common.h" 25 - #include "platsmp-apmu.h" 26 - #include "rcar-gen2.h" 27 - #include "r8a7790.h" 28 - 29 - static const struct rcar_sysc_ch r8a7790_ca15_scu = { 30 - .chan_offs = 0x180, /* PWRSR5 .. PWRER5 */ 31 - .isr_bit = 12, /* CA15-SCU */ 32 - }; 33 - 34 - static const struct rcar_sysc_ch r8a7790_ca7_scu = { 35 - .chan_offs = 0x100, /* PWRSR3 .. PWRER3 */ 36 - .isr_bit = 21, /* CA7-SCU */ 37 - }; 38 - 39 - static struct rcar_apmu_config r8a7790_apmu_config[] = { 40 - { 41 - .iomem = DEFINE_RES_MEM(0xe6152000, 0x188), 42 - .cpus = { 0, 1, 2, 3 }, 43 - }, 44 - { 45 - .iomem = DEFINE_RES_MEM(0xe6151000, 0x188), 46 - .cpus = { 0x100, 0x0101, 0x102, 0x103 }, 47 - } 48 - }; 49 - 50 - static void __init r8a7790_smp_prepare_cpus(unsigned int max_cpus) 51 - { 52 - /* let APMU code install data related to shmobile_boot_vector */ 53 - shmobile_smp_apmu_prepare_cpus(max_cpus, 54 - r8a7790_apmu_config, 55 - ARRAY_SIZE(r8a7790_apmu_config)); 56 - 57 - /* turn on power to SCU */ 58 - rcar_gen2_pm_init(); 59 - rcar_sysc_power_up(&r8a7790_ca15_scu); 60 - rcar_sysc_power_up(&r8a7790_ca7_scu); 61 - } 62 - 63 - const struct smp_operations r8a7790_smp_ops __initconst = { 64 - .smp_prepare_cpus = r8a7790_smp_prepare_cpus, 65 - .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, 66 - #ifdef CONFIG_HOTPLUG_CPU 67 - .cpu_can_disable = shmobile_smp_cpu_can_disable, 68 - .cpu_die = shmobile_smp_apmu_cpu_die, 69 - .cpu_kill = shmobile_smp_apmu_cpu_kill, 70 - #endif 71 - };
-53
arch/arm/mach-shmobile/smp-r8a7791.c
··· 1 - /* 2 - * SMP support for r8a7791 3 - * 4 - * Copyright (C) 2013 Renesas Solutions Corp. 5 - * Copyright (C) 2013 Magnus Damm 6 - * 7 - * This program is free software; you can redistribute it and/or modify 8 - * it under the terms of the GNU General Public License as published by 9 - * the Free Software Foundation; version 2 of the License. 10 - * 11 - * This program is distributed in the hope that it will be useful, 12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 - * GNU General Public License for more details. 15 - */ 16 - #include <linux/kernel.h> 17 - #include <linux/init.h> 18 - #include <linux/smp.h> 19 - #include <linux/io.h> 20 - 21 - #include <asm/smp_plat.h> 22 - 23 - #include "common.h" 24 - #include "platsmp-apmu.h" 25 - #include "r8a7791.h" 26 - #include "rcar-gen2.h" 27 - 28 - static struct rcar_apmu_config r8a7791_apmu_config[] = { 29 - { 30 - .iomem = DEFINE_RES_MEM(0xe6152000, 0x188), 31 - .cpus = { 0, 1 }, 32 - } 33 - }; 34 - 35 - static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) 36 - { 37 - /* let APMU code install data related to shmobile_boot_vector */ 38 - shmobile_smp_apmu_prepare_cpus(max_cpus, 39 - r8a7791_apmu_config, 40 - ARRAY_SIZE(r8a7791_apmu_config)); 41 - 42 - rcar_gen2_pm_init(); 43 - } 44 - 45 - const struct smp_operations r8a7791_smp_ops __initconst = { 46 - .smp_prepare_cpus = r8a7791_smp_prepare_cpus, 47 - .smp_boot_secondary = shmobile_smp_apmu_boot_secondary, 48 - #ifdef CONFIG_HOTPLUG_CPU 49 - .cpu_can_disable = shmobile_smp_cpu_can_disable, 50 - .cpu_die = shmobile_smp_apmu_cpu_die, 51 - .cpu_kill = shmobile_smp_apmu_cpu_kill, 52 - #endif 53 - };
-8
arch/arm/mach-shmobile/timer.c
··· 32 32 for_each_child_of_node(cpus, np) { 33 33 u32 freq; 34 34 35 - if (IS_ENABLED(CONFIG_ARM_ARCH_TIMER) && 36 - (of_device_is_compatible(np, "arm,cortex-a7") || 37 - of_device_is_compatible(np, "arm,cortex-a15"))) { 38 - of_node_put(np); 39 - of_node_put(cpus); 40 - return; 41 - } 42 - 43 35 if (!of_property_read_u32(np, "clock-frequency", &freq)) 44 36 max_freq = max(max_freq, freq); 45 37 }
+1
arch/arm/mach-uniphier/Kconfig
··· 9 9 select HAVE_ARM_SCU 10 10 select HAVE_ARM_TWD if SMP 11 11 select PINCTRL 12 + select RESET_CONTROLLER 12 13 help 13 14 Support for UniPhier SoC family developed by Socionext Inc. 14 15 (formerly, System LSI Business Division of Panasonic Corporation)
arch/arm/mach-uniphier/Makefile
+1
arch/arm64/Kconfig.platforms
··· 261 261 bool "Socionext UniPhier SoC Family" 262 262 select ARCH_HAS_RESET_CONTROLLER 263 263 select PINCTRL 264 + select RESET_CONTROLLER 264 265 help 265 266 This enables support for Socionext UniPhier SoC family. 266 267
+2 -1
drivers/clk/davinci/psc-da830.c
··· 14 14 15 15 #include "psc.h" 16 16 17 + LPSC_CLKDEV1(aemif_clkdev, NULL, "ti-aemif"); 17 18 LPSC_CLKDEV1(spi0_clkdev, NULL, "spi_davinci.0"); 18 19 LPSC_CLKDEV1(mmcsd_clkdev, NULL, "da830-mmc.0"); 19 20 LPSC_CLKDEV1(uart0_clkdev, NULL, "serial8250.0"); ··· 23 22 LPSC(0, 0, tpcc, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 24 23 LPSC(1, 0, tptc0, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 25 24 LPSC(2, 0, tptc1, pll0_sysclk2, NULL, LPSC_ALWAYS_ENABLED), 26 - LPSC(3, 0, aemif, pll0_sysclk3, NULL, LPSC_ALWAYS_ENABLED), 25 + LPSC(3, 0, aemif, pll0_sysclk3, aemif_clkdev, LPSC_ALWAYS_ENABLED), 27 26 LPSC(4, 0, spi0, pll0_sysclk2, spi0_clkdev, 0), 28 27 LPSC(5, 0, mmcsd, pll0_sysclk2, mmcsd_clkdev, 0), 29 28 LPSC(6, 0, aintc, pll0_sysclk4, NULL, LPSC_ALWAYS_ENABLED),
+1 -2
drivers/clk/davinci/psc-da850.c
··· 16 16 17 17 #include "psc.h" 18 18 19 - LPSC_CLKDEV2(emifa_clkdev, NULL, "ti-aemif", 20 - "aemif", "davinci_nand.0"); 19 + LPSC_CLKDEV1(emifa_clkdev, NULL, "ti-aemif"); 21 20 LPSC_CLKDEV1(spi0_clkdev, NULL, "spi_davinci.0"); 22 21 LPSC_CLKDEV1(mmcsd0_clkdev, NULL, "da830-mmc.0"); 23 22 LPSC_CLKDEV1(uart0_clkdev, NULL, "serial8250.0");
+2 -1
drivers/clk/davinci/psc-dm365.c
··· 21 21 LPSC_CLKDEV1(asp0_clkdev, NULL, "davinci-mcbsp"); 22 22 LPSC_CLKDEV1(usb_clkdev, "usb", NULL); 23 23 LPSC_CLKDEV1(spi2_clkdev, NULL, "spi_davinci.2"); 24 - LPSC_CLKDEV1(aemif_clkdev, "aemif", NULL); 24 + LPSC_CLKDEV2(aemif_clkdev, "aemif", NULL, 25 + NULL, "ti-aemif"); 25 26 LPSC_CLKDEV1(mmcsd0_clkdev, NULL, "da830-mmc.0"); 26 27 LPSC_CLKDEV1(i2c_clkdev, NULL, "i2c_davinci.1"); 27 28 LPSC_CLKDEV1(uart0_clkdev, NULL, "serial8250.0");
+2 -1
drivers/clk/davinci/psc-dm644x.c
··· 21 21 "fck", "davinci_mdio.0"); 22 22 LPSC_CLKDEV1(usb_clkdev, "usb", NULL); 23 23 LPSC_CLKDEV1(ide_clkdev, NULL, "palm_bk3710"); 24 - LPSC_CLKDEV1(aemif_clkdev, "aemif", NULL); 24 + LPSC_CLKDEV2(aemif_clkdev, "aemif", NULL, 25 + NULL, "ti-aemif"); 25 26 LPSC_CLKDEV1(mmcsd_clkdev, NULL, "dm6441-mmc.0"); 26 27 LPSC_CLKDEV1(asp0_clkdev, NULL, "davinci-mcbsp"); 27 28 LPSC_CLKDEV1(i2c_clkdev, NULL, "i2c_davinci.1");
+2 -1
drivers/clk/davinci/psc-dm646x.c
··· 18 18 LPSC_CLKDEV1(ide_clkdev, NULL, "palm_bk3710"); 19 19 LPSC_CLKDEV2(emac_clkdev, NULL, "davinci_emac.1", 20 20 "fck", "davinci_mdio.0"); 21 - LPSC_CLKDEV1(aemif_clkdev, "aemif", NULL); 21 + LPSC_CLKDEV2(aemif_clkdev, "aemif", NULL, 22 + NULL, "ti-aemif"); 22 23 LPSC_CLKDEV1(mcasp0_clkdev, NULL, "davinci-mcasp.0"); 23 24 LPSC_CLKDEV1(mcasp1_clkdev, NULL, "davinci-mcasp.1"); 24 25 LPSC_CLKDEV1(uart0_clkdev, NULL, "serial8250.0");
+100 -96
drivers/input/serio/ams_delta_serio.c
··· 20 20 * However, when used with the E3 mailboard that producecs non-standard 21 21 * scancodes, a custom key table must be prepared and loaded from userspace. 22 22 */ 23 - #include <linux/gpio.h> 24 23 #include <linux/irq.h> 24 + #include <linux/platform_data/ams-delta-fiq.h> 25 + #include <linux/platform_device.h> 26 + #include <linux/regulator/consumer.h> 25 27 #include <linux/serio.h> 26 28 #include <linux/slab.h> 27 29 #include <linux/module.h> 28 30 29 - #include <asm/mach-types.h> 30 - #include <mach/board-ams-delta.h> 31 - 32 - #include <mach/ams-delta-fiq.h> 31 + #define DRIVER_NAME "ams-delta-serio" 33 32 34 33 MODULE_AUTHOR("Matt Callow"); 35 34 MODULE_DESCRIPTION("AMS Delta (E3) keyboard port driver"); 36 35 MODULE_LICENSE("GPL"); 37 36 38 - static struct serio *ams_delta_serio; 37 + struct ams_delta_serio { 38 + struct serio *serio; 39 + struct regulator *vcc; 40 + unsigned int *fiq_buffer; 41 + }; 39 42 40 - static int check_data(int data) 43 + static int check_data(struct serio *serio, int data) 41 44 { 42 45 int i, parity = 0; 43 46 44 47 /* check valid stop bit */ 45 48 if (!(data & 0x400)) { 46 - dev_warn(&ams_delta_serio->dev, 47 - "invalid stop bit, data=0x%X\n", 48 - data); 49 + dev_warn(&serio->dev, "invalid stop bit, data=0x%X\n", data); 49 50 return SERIO_FRAME; 50 51 } 51 52 /* calculate the parity */ ··· 56 55 } 57 56 /* it should be odd */ 58 57 if (!(parity & 0x01)) { 59 - dev_warn(&ams_delta_serio->dev, 60 - "parity check failed, data=0x%X parity=0x%X\n", 61 - data, parity); 58 + dev_warn(&serio->dev, 59 + "parity check failed, data=0x%X parity=0x%X\n", data, 60 + parity); 62 61 return SERIO_PARITY; 63 62 } 64 63 return 0; ··· 66 65 67 66 static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id) 68 67 { 69 - int *circ_buff = &fiq_buffer[FIQ_CIRC_BUFF]; 68 + struct ams_delta_serio *priv = dev_id; 69 + int *circ_buff = &priv->fiq_buffer[FIQ_CIRC_BUFF]; 70 70 int data, dfl; 71 71 u8 scancode; 72 72 73 - fiq_buffer[FIQ_IRQ_PEND] = 0; 73 + priv->fiq_buffer[FIQ_IRQ_PEND] = 0; 74 74 75 75 /* 76 76 * Read data from the circular buffer, check it 77 77 * and then pass it on the serio 78 78 */ 79 - while (fiq_buffer[FIQ_KEYS_CNT] > 0) { 79 + while (priv->fiq_buffer[FIQ_KEYS_CNT] > 0) { 80 80 81 - data = circ_buff[fiq_buffer[FIQ_HEAD_OFFSET]++]; 82 - fiq_buffer[FIQ_KEYS_CNT]--; 83 - if (fiq_buffer[FIQ_HEAD_OFFSET] == fiq_buffer[FIQ_BUF_LEN]) 84 - fiq_buffer[FIQ_HEAD_OFFSET] = 0; 81 + data = circ_buff[priv->fiq_buffer[FIQ_HEAD_OFFSET]++]; 82 + priv->fiq_buffer[FIQ_KEYS_CNT]--; 83 + if (priv->fiq_buffer[FIQ_HEAD_OFFSET] == 84 + priv->fiq_buffer[FIQ_BUF_LEN]) 85 + priv->fiq_buffer[FIQ_HEAD_OFFSET] = 0; 85 86 86 - dfl = check_data(data); 87 + dfl = check_data(priv->serio, data); 87 88 scancode = (u8) (data >> 1) & 0xFF; 88 - serio_interrupt(ams_delta_serio, scancode, dfl); 89 + serio_interrupt(priv->serio, scancode, dfl); 89 90 } 90 91 return IRQ_HANDLED; 91 92 } 92 93 93 94 static int ams_delta_serio_open(struct serio *serio) 94 95 { 95 - /* enable keyboard */ 96 - gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1); 96 + struct ams_delta_serio *priv = serio->port_data; 97 97 98 - return 0; 98 + /* enable keyboard */ 99 + return regulator_enable(priv->vcc); 99 100 } 100 101 101 102 static void ams_delta_serio_close(struct serio *serio) 102 103 { 104 + struct ams_delta_serio *priv = serio->port_data; 105 + 103 106 /* disable keyboard */ 104 - gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0); 107 + regulator_disable(priv->vcc); 105 108 } 106 109 107 - static const struct gpio ams_delta_gpios[] __initconst_or_module = { 108 - { 109 - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA, 110 - .flags = GPIOF_DIR_IN, 111 - .label = "serio-data", 112 - }, 113 - { 114 - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK, 115 - .flags = GPIOF_DIR_IN, 116 - .label = "serio-clock", 117 - }, 118 - { 119 - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 120 - .flags = GPIOF_OUT_INIT_LOW, 121 - .label = "serio-power", 122 - }, 123 - { 124 - .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT, 125 - .flags = GPIOF_OUT_INIT_LOW, 126 - .label = "serio-dataout", 127 - }, 128 - }; 129 - 130 - static int __init ams_delta_serio_init(void) 110 + static int ams_delta_serio_init(struct platform_device *pdev) 131 111 { 132 - int err; 112 + struct ams_delta_serio *priv; 113 + struct serio *serio; 114 + int irq, err; 133 115 134 - if (!machine_is_ams_delta()) 135 - return -ENODEV; 136 - 137 - ams_delta_serio = kzalloc(sizeof(struct serio), GFP_KERNEL); 138 - if (!ams_delta_serio) 116 + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); 117 + if (!priv) 139 118 return -ENOMEM; 140 119 141 - ams_delta_serio->id.type = SERIO_8042; 142 - ams_delta_serio->open = ams_delta_serio_open; 143 - ams_delta_serio->close = ams_delta_serio_close; 144 - strlcpy(ams_delta_serio->name, "AMS DELTA keyboard adapter", 145 - sizeof(ams_delta_serio->name)); 146 - strlcpy(ams_delta_serio->phys, "GPIO/serio0", 147 - sizeof(ams_delta_serio->phys)); 120 + priv->fiq_buffer = pdev->dev.platform_data; 121 + if (!priv->fiq_buffer) 122 + return -EINVAL; 148 123 149 - err = gpio_request_array(ams_delta_gpios, 150 - ARRAY_SIZE(ams_delta_gpios)); 151 - if (err) { 152 - pr_err("ams_delta_serio: Couldn't request gpio pins\n"); 153 - goto serio; 124 + priv->vcc = devm_regulator_get(&pdev->dev, "vcc"); 125 + if (IS_ERR(priv->vcc)) { 126 + err = PTR_ERR(priv->vcc); 127 + dev_err(&pdev->dev, "regulator request failed (%d)\n", err); 128 + /* 129 + * When running on a non-dt platform and requested regulator 130 + * is not available, devm_regulator_get() never returns 131 + * -EPROBE_DEFER as it is not able to justify if the regulator 132 + * may still appear later. On the other hand, the board can 133 + * still set full constriants flag at late_initcall in order 134 + * to instruct devm_regulator_get() to returnn a dummy one 135 + * if sufficient. Hence, if we get -ENODEV here, let's convert 136 + * it to -EPROBE_DEFER and wait for the board to decide or 137 + * let Deferred Probe infrastructure handle this error. 138 + */ 139 + if (err == -ENODEV) 140 + err = -EPROBE_DEFER; 141 + return err; 154 142 } 155 143 156 - err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 157 - ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, 158 - "ams-delta-serio", 0); 144 + irq = platform_get_irq(pdev, 0); 145 + if (irq < 0) 146 + return -ENXIO; 147 + 148 + err = devm_request_irq(&pdev->dev, irq, ams_delta_serio_interrupt, 149 + IRQ_TYPE_EDGE_RISING, DRIVER_NAME, priv); 159 150 if (err < 0) { 160 - pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", 161 - gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); 162 - goto gpio; 151 + dev_err(&pdev->dev, "IRQ request failed (%d)\n", err); 152 + return err; 163 153 } 164 - /* 165 - * Since GPIO register handling for keyboard clock pin is performed 166 - * at FIQ level, switch back from edge to simple interrupt handler 167 - * to avoid bad interaction. 168 - */ 169 - irq_set_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 170 - handle_simple_irq); 171 154 172 - serio_register_port(ams_delta_serio); 173 - dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name); 155 + serio = kzalloc(sizeof(*serio), GFP_KERNEL); 156 + if (!serio) 157 + return -ENOMEM; 158 + 159 + priv->serio = serio; 160 + 161 + serio->id.type = SERIO_8042; 162 + serio->open = ams_delta_serio_open; 163 + serio->close = ams_delta_serio_close; 164 + strlcpy(serio->name, "AMS DELTA keyboard adapter", sizeof(serio->name)); 165 + strlcpy(serio->phys, dev_name(&pdev->dev), sizeof(serio->phys)); 166 + serio->dev.parent = &pdev->dev; 167 + serio->port_data = priv; 168 + 169 + serio_register_port(serio); 170 + 171 + platform_set_drvdata(pdev, priv); 172 + 173 + dev_info(&serio->dev, "%s\n", serio->name); 174 174 175 175 return 0; 176 - gpio: 177 - gpio_free_array(ams_delta_gpios, 178 - ARRAY_SIZE(ams_delta_gpios)); 179 - serio: 180 - kfree(ams_delta_serio); 181 - return err; 182 176 } 183 - module_init(ams_delta_serio_init); 184 177 185 - static void __exit ams_delta_serio_exit(void) 178 + static int ams_delta_serio_exit(struct platform_device *pdev) 186 179 { 187 - serio_unregister_port(ams_delta_serio); 188 - free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); 189 - gpio_free_array(ams_delta_gpios, 190 - ARRAY_SIZE(ams_delta_gpios)); 180 + struct ams_delta_serio *priv = platform_get_drvdata(pdev); 181 + 182 + serio_unregister_port(priv->serio); 183 + 184 + return 0; 191 185 } 192 - module_exit(ams_delta_serio_exit); 186 + 187 + static struct platform_driver ams_delta_serio_driver = { 188 + .probe = ams_delta_serio_init, 189 + .remove = ams_delta_serio_exit, 190 + .driver = { 191 + .name = DRIVER_NAME 192 + }, 193 + }; 194 + module_platform_driver(ams_delta_serio_driver);
+2 -11
drivers/net/ethernet/smsc/smc911x.c
··· 74 74 #include <linux/skbuff.h> 75 75 76 76 #include <linux/dmaengine.h> 77 - #include <linux/dma/pxa-dma.h> 78 77 79 78 #include <asm/io.h> 80 79 ··· 1794 1795 #ifdef SMC_USE_DMA 1795 1796 struct dma_slave_config config; 1796 1797 dma_cap_mask_t mask; 1797 - struct pxad_param param; 1798 1798 #endif 1799 1799 1800 1800 DBG(SMC_DEBUG_FUNC, dev, "--> %s\n", __func__); ··· 1969 1971 1970 1972 dma_cap_zero(mask); 1971 1973 dma_cap_set(DMA_SLAVE, mask); 1972 - param.prio = PXAD_PRIO_LOWEST; 1973 - param.drcmr = -1UL; 1974 - 1975 - lp->rxdma = 1976 - dma_request_slave_channel_compat(mask, pxad_filter_fn, 1977 - &param, &dev->dev, "rx"); 1978 - lp->txdma = 1979 - dma_request_slave_channel_compat(mask, pxad_filter_fn, 1980 - &param, &dev->dev, "tx"); 1974 + lp->rxdma = dma_request_channel(mask, NULL, NULL); 1975 + lp->txdma = dma_request_channel(mask, NULL, NULL); 1981 1976 lp->rxdma_active = 0; 1982 1977 lp->txdma_active = 0; 1983 1978
+1 -8
drivers/net/ethernet/smsc/smc91x.c
··· 2019 2019 # endif 2020 2020 if (lp->cfg.flags & SMC91X_USE_DMA) { 2021 2021 dma_cap_mask_t mask; 2022 - struct pxad_param param; 2023 2022 2024 2023 dma_cap_zero(mask); 2025 2024 dma_cap_set(DMA_SLAVE, mask); 2026 - param.prio = PXAD_PRIO_LOWEST; 2027 - param.drcmr = -1UL; 2028 - 2029 - lp->dma_chan = 2030 - dma_request_slave_channel_compat(mask, pxad_filter_fn, 2031 - &param, &dev->dev, 2032 - "data"); 2025 + lp->dma_chan = dma_request_channel(mask, NULL, NULL); 2033 2026 } 2034 2027 #endif 2035 2028
-1
drivers/net/ethernet/smsc/smc91x.h
··· 301 301 * as RX which can overrun memory and lose packets. 302 302 */ 303 303 #include <linux/dma-mapping.h> 304 - #include <linux/dma/pxa-dma.h> 305 304 306 305 #ifdef SMC_insl 307 306 #undef SMC_insl
+3
drivers/soc/renesas/Makefile
··· 18 18 obj-$(CONFIG_SYSC_R8A77980) += r8a77980-sysc.o 19 19 obj-$(CONFIG_SYSC_R8A77990) += r8a77990-sysc.o 20 20 obj-$(CONFIG_SYSC_R8A77995) += r8a77995-sysc.o 21 + ifdef CONFIG_SMP 22 + obj-$(CONFIG_ARCH_R9A06G032) += r9a06g032-smp.o 23 + endif 21 24 22 25 # Family 23 26 obj-$(CONFIG_RST_RCAR) += rcar-rst.o
+96
drivers/soc/renesas/r9a06g032-smp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * R9A06G032 Second CA7 enabler. 4 + * 5 + * Copyright (C) 2018 Renesas Electronics Europe Limited 6 + * 7 + * Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com> 8 + * Derived from actions,s500-smp 9 + */ 10 + 11 + #include <linux/io.h> 12 + #include <linux/of.h> 13 + #include <linux/of_address.h> 14 + #include <linux/smp.h> 15 + 16 + /* 17 + * The second CPU is parked in ROM at boot time. It requires waking it after 18 + * writing an address into the BOOTADDR register of sysctrl. 19 + * 20 + * So the default value of the "cpu-release-addr" corresponds to BOOTADDR... 21 + * 22 + * *However* the BOOTADDR register is not available when the kernel 23 + * starts in NONSEC mode. 24 + * 25 + * So for NONSEC mode, the bootloader re-parks the second CPU into a pen 26 + * in SRAM, and changes the "cpu-release-addr" of linux's DT to a SRAM address, 27 + * which is not restricted. 28 + */ 29 + 30 + static void __iomem *cpu_bootaddr; 31 + 32 + static DEFINE_SPINLOCK(cpu_lock); 33 + 34 + static int 35 + r9a06g032_smp_boot_secondary(unsigned int cpu, 36 + struct task_struct *idle) 37 + { 38 + if (!cpu_bootaddr) 39 + return -ENODEV; 40 + 41 + spin_lock(&cpu_lock); 42 + 43 + writel(__pa_symbol(secondary_startup), cpu_bootaddr); 44 + arch_send_wakeup_ipi_mask(cpumask_of(cpu)); 45 + 46 + spin_unlock(&cpu_lock); 47 + 48 + return 0; 49 + } 50 + 51 + static void __init r9a06g032_smp_prepare_cpus(unsigned int max_cpus) 52 + { 53 + struct device_node *dn; 54 + int ret = -EINVAL, dns; 55 + u32 bootaddr; 56 + 57 + dn = of_get_cpu_node(1, NULL); 58 + if (!dn) { 59 + pr_err("CPU#1: missing device tree node\n"); 60 + return; 61 + } 62 + /* 63 + * Determine the address from which the CPU is polling. 64 + * The bootloader *does* change this property. 65 + * Note: The property can be either 64 or 32 bits, so handle both cases 66 + */ 67 + if (of_find_property(dn, "cpu-release-addr", &dns)) { 68 + if (dns == sizeof(u64)) { 69 + u64 temp; 70 + 71 + ret = of_property_read_u64(dn, 72 + "cpu-release-addr", &temp); 73 + bootaddr = temp; 74 + } else { 75 + ret = of_property_read_u32(dn, 76 + "cpu-release-addr", 77 + &bootaddr); 78 + } 79 + } 80 + of_node_put(dn); 81 + if (ret) { 82 + pr_err("CPU#1: invalid cpu-release-addr property\n"); 83 + return; 84 + } 85 + pr_info("CPU#1: cpu-release-addr %08x\n", bootaddr); 86 + 87 + cpu_bootaddr = ioremap(bootaddr, sizeof(bootaddr)); 88 + } 89 + 90 + static const struct smp_operations r9a06g032_smp_ops __initconst = { 91 + .smp_prepare_cpus = r9a06g032_smp_prepare_cpus, 92 + .smp_boot_secondary = r9a06g032_smp_boot_secondary, 93 + }; 94 + 95 + CPU_METHOD_OF_DECLARE(r9a06g032_smp, 96 + "renesas,r9a06g032-smp", &r9a06g032_smp_ops);
+41 -23
drivers/soc/renesas/rcar-sysc.c
··· 58 58 59 59 #define RCAR_PD_ALWAYS_ON 32 /* Always-on power area */ 60 60 61 + struct rcar_sysc_ch { 62 + u16 chan_offs; 63 + u8 chan_bit; 64 + u8 isr_bit; 65 + }; 66 + 61 67 static void __iomem *rcar_sysc_base; 62 68 static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */ 63 69 ··· 149 143 return ret; 150 144 } 151 145 152 - int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch) 146 + static int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch) 153 147 { 154 148 return rcar_sysc_power(sysc_ch, false); 155 149 } 156 150 157 - int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch) 151 + static int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch) 158 152 { 159 153 return rcar_sysc_power(sysc_ch, true); 160 154 } ··· 321 315 struct generic_pm_domain *domains[RCAR_PD_ALWAYS_ON + 1]; 322 316 }; 323 317 318 + static struct genpd_onecell_data *rcar_sysc_onecell_data; 319 + 324 320 static int __init rcar_sysc_pd_init(void) 325 321 { 326 322 const struct rcar_sysc_info *info; ··· 333 325 void __iomem *base; 334 326 unsigned int i; 335 327 int error; 336 - 337 - if (rcar_sysc_base) 338 - return 0; 339 328 340 329 np = of_find_matching_node_and_match(NULL, rcar_sysc_matches, &match); 341 330 if (!np) ··· 366 361 367 362 domains->onecell_data.domains = domains->domains; 368 363 domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains); 364 + rcar_sysc_onecell_data = &domains->onecell_data; 369 365 370 366 for (i = 0, syscier = 0; i < info->num_areas; i++) 371 367 syscier |= BIT(info->areas[i].isr_bit); ··· 454 448 } 455 449 } 456 450 457 - void __init rcar_sysc_init(phys_addr_t base, u32 syscier) 451 + #ifdef CONFIG_ARCH_R8A7779 452 + static int rcar_sysc_power_cpu(unsigned int idx, bool on) 458 453 { 459 - u32 syscimr; 454 + struct generic_pm_domain *genpd; 455 + struct rcar_sysc_pd *pd; 456 + unsigned int i; 460 457 461 - if (!rcar_sysc_pd_init()) 462 - return; 458 + if (!rcar_sysc_onecell_data) 459 + return -ENODEV; 463 460 464 - rcar_sysc_base = ioremap_nocache(base, PAGE_SIZE); 461 + for (i = 0; i < rcar_sysc_onecell_data->num_domains; i++) { 462 + genpd = rcar_sysc_onecell_data->domains[i]; 463 + if (!genpd) 464 + continue; 465 465 466 - /* 467 - * Mask all interrupt sources to prevent the CPU from receiving them. 468 - * Make sure not to clear reserved bits that were set before. 469 - */ 470 - syscimr = ioread32(rcar_sysc_base + SYSCIMR); 471 - syscimr |= syscier; 472 - pr_debug("%s: syscimr = 0x%08x\n", __func__, syscimr); 473 - iowrite32(syscimr, rcar_sysc_base + SYSCIMR); 466 + pd = to_rcar_pd(genpd); 467 + if (!(pd->flags & PD_CPU) || pd->ch.chan_bit != idx) 468 + continue; 474 469 475 - /* 476 - * SYSC needs all interrupt sources enabled to control power. 477 - */ 478 - pr_debug("%s: syscier = 0x%08x\n", __func__, syscier); 479 - iowrite32(syscier, rcar_sysc_base + SYSCIER); 470 + return on ? rcar_sysc_power_up(&pd->ch) 471 + : rcar_sysc_power_down(&pd->ch); 472 + } 473 + 474 + return -ENOENT; 480 475 } 476 + 477 + int rcar_sysc_power_down_cpu(unsigned int cpu) 478 + { 479 + return rcar_sysc_power_cpu(cpu, false); 480 + } 481 + 482 + int rcar_sysc_power_up_cpu(unsigned int cpu) 483 + { 484 + return rcar_sysc_power_cpu(cpu, true); 485 + } 486 + #endif /* CONFIG_ARCH_R8A7779 */
+15 -1
drivers/soc/ti/pm33xx.c
··· 41 41 static struct device *pm33xx_dev; 42 42 static struct wkup_m3_ipc *m3_ipc; 43 43 44 + static unsigned long suspend_wfi_flags; 45 + 44 46 static u32 sram_suspend_address(unsigned long addr) 45 47 { 46 48 return ((unsigned long)am33xx_do_wfi_sram + ··· 55 53 int i, ret = 0; 56 54 57 55 ret = pm_ops->soc_suspend((unsigned long)suspend_state, 58 - am33xx_do_wfi_sram); 56 + am33xx_do_wfi_sram, suspend_wfi_flags); 59 57 60 58 if (ret) { 61 59 dev_err(pm33xx_dev, "PM: Kernel suspend failure\n"); ··· 229 227 ro_sram_data.amx3_pm_sram_data_virt = ocmcram_location_data; 230 228 ro_sram_data.amx3_pm_sram_data_phys = 231 229 gen_pool_virt_to_phys(sram_pool_data, ocmcram_location_data); 230 + ro_sram_data.rtc_base_virt = pm_ops->get_rtc_base_addr(); 232 231 233 232 /* Save physical address to calculate resume offset during pm init */ 234 233 am33xx_do_wfi_sram_phys = gen_pool_virt_to_phys(sram_pool, ··· 312 309 #ifdef CONFIG_SUSPEND 313 310 suspend_set_ops(&am33xx_pm_ops); 314 311 #endif /* CONFIG_SUSPEND */ 312 + 313 + /* 314 + * For a system suspend we must flush the caches, we want 315 + * the DDR in self-refresh, we want to save the context 316 + * of the EMIF, and we want the wkup_m3 to handle low-power 317 + * transition. 318 + */ 319 + suspend_wfi_flags |= WFI_FLAG_FLUSH_CACHE; 320 + suspend_wfi_flags |= WFI_FLAG_SELF_REFRESH; 321 + suspend_wfi_flags |= WFI_FLAG_SAVE_EMIF; 322 + suspend_wfi_flags |= WFI_FLAG_WAKE_M3; 315 323 316 324 ret = pm_ops->init(); 317 325 if (ret) {
+15
include/linux/clk/at91_pmc.h
··· 47 47 #define AT91_CKGR_MOR 0x20 /* Main Oscillator Register [not on SAM9RL] */ 48 48 #define AT91_PMC_MOSCEN (1 << 0) /* Main Oscillator Enable */ 49 49 #define AT91_PMC_OSCBYPASS (1 << 1) /* Oscillator Bypass */ 50 + #define AT91_PMC_WAITMODE (1 << 2) /* Wait Mode Command */ 50 51 #define AT91_PMC_MOSCRCEN (1 << 3) /* Main On-Chip RC Oscillator Enable [some SAM9] */ 51 52 #define AT91_PMC_OSCOUNT (0xff << 8) /* Main Oscillator Start-up Time */ 53 + #define AT91_PMC_KEY_MASK (0xff << 16) 52 54 #define AT91_PMC_KEY (0x37 << 16) /* MOR Writing Key */ 53 55 #define AT91_PMC_MOSCSEL (1 << 24) /* Main Oscillator Selection [some SAM9] */ 54 56 #define AT91_PMC_CFDEN (1 << 25) /* Clock Failure Detector Enable [some SAM9] */ ··· 156 154 #define AT91_PMC_CFDEV (1 << 18) /* Clock Failure Detector Event [some SAM9] */ 157 155 #define AT91_PMC_GCKRDY (1 << 24) /* Generated Clocks */ 158 156 #define AT91_PMC_IMR 0x6c /* Interrupt Mask Register */ 157 + 158 + #define AT91_PMC_FSMR 0x70 /* Fast Startup Mode Register */ 159 + #define AT91_PMC_FSTT(n) BIT(n) 160 + #define AT91_PMC_RTCAL BIT(17) /* RTC Alarm Enable */ 161 + #define AT91_PMC_USBAL BIT(18) /* USB Resume Enable */ 162 + #define AT91_PMC_SDMMC_CD BIT(19) /* SDMMC Card Detect Enable */ 163 + #define AT91_PMC_LPM BIT(20) /* Low-power Mode */ 164 + #define AT91_PMC_RXLP_MCE BIT(24) /* Backup UART Receive Enable */ 165 + #define AT91_PMC_ACC_CE BIT(25) /* ACC Enable */ 166 + 167 + #define AT91_PMC_FSPR 0x74 /* Fast Startup Polarity Reg */ 168 + 169 + #define AT91_PMC_FS_INPUT_MASK 0x7ff 159 170 160 171 #define AT91_PMC_PLLICPR 0x80 /* PLL Charge Pump Current Register */ 161 172
+1
include/linux/cpuhotplug.h
··· 144 144 CPUHP_AP_SMPBOOT_THREADS, 145 145 CPUHP_AP_X86_VDSO_VMA_ONLINE, 146 146 CPUHP_AP_IRQ_AFFINITY_ONLINE, 147 + CPUHP_AP_ARM_MVEBU_SYNC_CLOCKS, 147 148 CPUHP_AP_PERF_ONLINE, 148 149 CPUHP_AP_PERF_X86_ONLINE, 149 150 CPUHP_AP_PERF_X86_UNCORE_ONLINE,
+3
include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
··· 457 457 #define MCLK_DIR(x) (x == 1 ? IMX6UL_GPR1_SAI1_MCLK_DIR : x == 2 ? \ 458 458 IMX6UL_GPR1_SAI2_MCLK_DIR : IMX6UL_GPR1_SAI3_MCLK_DIR) 459 459 460 + /* For imx6sll iomux gpr register field define */ 461 + #define IMX6SLL_GPR5_AFCG_X_BYPASS_MASK (0x1f << 11) 462 + 460 463 #endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
-1
include/linux/platform_data/mtd-davinci-aemif.h
··· 33 33 u8 ta; 34 34 }; 35 35 36 - int davinci_aemif_setup(struct platform_device *pdev); 37 36 #endif
+28 -1
include/linux/platform_data/pm33xx.h
··· 12 12 #include <linux/kbuild.h> 13 13 #include <linux/types.h> 14 14 15 + /* 16 + * WFI Flags for sleep code control 17 + * 18 + * These flags allow PM code to exclude certain operations from happening 19 + * in the low level ASM code found in sleep33xx.S and sleep43xx.S 20 + * 21 + * WFI_FLAG_FLUSH_CACHE: Flush the ARM caches and disable caching. Only 22 + * needed when MPU will lose context. 23 + * WFI_FLAG_SELF_REFRESH: Let EMIF place DDR memory into self-refresh and 24 + * disable EMIF. 25 + * WFI_FLAG_SAVE_EMIF: Save context of all EMIF registers and restore in 26 + * resume path. Only needed if PER domain loses context 27 + * and must also have WFI_FLAG_SELF_REFRESH set. 28 + * WFI_FLAG_WAKE_M3: Disable MPU clock or clockdomain to cause wkup_m3 to 29 + * execute when WFI instruction executes. 30 + * WFI_FLAG_RTC_ONLY: Configure the RTC to enter RTC+DDR mode. 31 + */ 32 + #define WFI_FLAG_FLUSH_CACHE BIT(0) 33 + #define WFI_FLAG_SELF_REFRESH BIT(1) 34 + #define WFI_FLAG_SAVE_EMIF BIT(2) 35 + #define WFI_FLAG_WAKE_M3 BIT(3) 36 + #define WFI_FLAG_RTC_ONLY BIT(4) 37 + 15 38 #ifndef __ASSEMBLER__ 16 39 struct am33xx_pm_sram_addr { 17 40 void (*do_wfi)(void); ··· 42 19 unsigned long *resume_offset; 43 20 unsigned long *emif_sram_table; 44 21 unsigned long *ro_sram_data; 22 + unsigned long resume_address; 45 23 }; 46 24 47 25 struct am33xx_pm_platform_data { 48 26 int (*init)(void); 49 - int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long)); 27 + int (*soc_suspend)(unsigned int state, int (*fn)(unsigned long), 28 + unsigned long args); 50 29 struct am33xx_pm_sram_addr *(*get_sram_addrs)(void); 30 + void __iomem *(*get_rtc_base_addr)(void); 51 31 }; 52 32 53 33 struct am33xx_pm_sram_data { ··· 62 36 struct am33xx_pm_ro_sram_data { 63 37 u32 amx3_pm_sram_data_virt; 64 38 u32 amx3_pm_sram_data_phys; 39 + void __iomem *rtc_base_virt; 65 40 } __packed __aligned(8); 66 41 67 42 #endif /* __ASSEMBLER__ */
+2 -11
include/linux/soc/renesas/rcar-sysc.h
··· 2 2 #ifndef __LINUX_SOC_RENESAS_RCAR_SYSC_H__ 3 3 #define __LINUX_SOC_RENESAS_RCAR_SYSC_H__ 4 4 5 - #include <linux/types.h> 6 - 7 - struct rcar_sysc_ch { 8 - u16 chan_offs; 9 - u8 chan_bit; 10 - u8 isr_bit; 11 - }; 12 - 13 - int rcar_sysc_power_down(const struct rcar_sysc_ch *sysc_ch); 14 - int rcar_sysc_power_up(const struct rcar_sysc_ch *sysc_ch); 15 - void rcar_sysc_init(phys_addr_t base, u32 syscier); 5 + int rcar_sysc_power_down_cpu(unsigned int cpu); 6 + int rcar_sysc_power_up_cpu(unsigned int cpu); 16 7 17 8 #endif /* __LINUX_SOC_RENESAS_RCAR_SYSC_H__ */