diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:51:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-12 14:51:39 -0500 |
commit | d01e4afdbb65e030fd6f1f96c30a558e2eb0f279 (patch) | |
tree | 02ef82b2740cf93a98199eded5ef765fa6e03052 /arch/arm/mach-omap2/cm_common.c | |
parent | 8287361abca36504da813638310d2547469283eb (diff) | |
parent | 794b175fc0c0c4844dbb7b137a73bbfd01f6c608 (diff) |
Merge tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC cleanups on various subarchitectures from Olof Johansson:
"Cleanup patches for various ARM platforms and some of their associated
drivers. There's also a branch in here that enables Freescale i.MX to
be part of the multiplatform support -- the first "big" SoC that is
moved over (more multiplatform work comes in a separate branch later
during the merge window)."
Conflicts fixed as per Olof, including a silent semantic one in
arch/arm/mach-omap2/board-generic.c (omap_prcm_restart() was renamed to
omap3xxx_restart(), and a new user of the old name was added).
* tag 'cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (189 commits)
ARM: omap: fix typo on timer cleanup
ARM: EXYNOS: Remove unused regs-mem.h file
ARM: EXYNOS: Remove unused non-dt support for dwmci controller
ARM: Kirkwood: Use hw_pci.ops instead of hw_pci.scan
ARM: OMAP3: cm-t3517: use GPTIMER for system clock
ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
ARM: SAMSUNG: use devm_ functions for ADC driver
ARM: EXYNOS: no duplicate mask/unmask in eint0_15
ARM: S3C24XX: SPI clock channel setup is fixed for S3C2443
ARM: EXYNOS: Remove i2c0 resource information and setting of device names
ARM: Kirkwood: checkpatch cleanups
ARM: Kirkwood: Fix sparse warnings.
ARM: Kirkwood: Remove unused includes
ARM: kirkwood: cleanup lsxl board includes
ARM: integrator: use BUG_ON where possible
ARM: integrator: push down SC dependencies
ARM: integrator: delete static UART1 mapping
ARM: integrator: delete SC mapping on the CP
ARM: integrator: remove static CP syscon mapping
ARM: integrator: remove static AP syscon mapping
...
Diffstat (limited to 'arch/arm/mach-omap2/cm_common.c')
-rw-r--r-- | arch/arm/mach-omap2/cm_common.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c index 3246cef151dc..40b3b5a84458 100644 --- a/arch/arm/mach-omap2/cm_common.c +++ b/arch/arm/mach-omap2/cm_common.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * OMAP2+ common Clock Management (CM) IP block functions | 2 | * OMAP2+ common Clock Management (CM) IP block functions |
3 | * | 3 | * |
4 | * Copyright (C) 2012 Texas Instruments, Inc. | 4 | * Copyright (C) 2012 Texas Instruments, Inc. |
5 | * Paul Walmsley <paul@pwsan.com> | 5 | * Paul Walmsley |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 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 | 8 | * it under the terms of the GNU General Public License version 2 as |
@@ -13,10 +13,12 @@ | |||
13 | 13 | ||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/errno.h> | ||
16 | 17 | ||
17 | #include "cm2xxx.h" | 18 | #include "cm2xxx.h" |
18 | #include "cm3xxx.h" | 19 | #include "cm3xxx.h" |
19 | #include "cm44xx.h" | 20 | #include "cm44xx.h" |
21 | #include "common.h" | ||
20 | 22 | ||
21 | /* | 23 | /* |
22 | * cm_ll_data: function pointers to SoC-specific implementations of | 24 | * cm_ll_data: function pointers to SoC-specific implementations of |
@@ -25,6 +27,73 @@ | |||
25 | static struct cm_ll_data null_cm_ll_data; | 27 | static struct cm_ll_data null_cm_ll_data; |
26 | static struct cm_ll_data *cm_ll_data = &null_cm_ll_data; | 28 | static struct cm_ll_data *cm_ll_data = &null_cm_ll_data; |
27 | 29 | ||
30 | /* cm_base: base virtual address of the CM IP block */ | ||
31 | void __iomem *cm_base; | ||
32 | |||
33 | /* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */ | ||
34 | void __iomem *cm2_base; | ||
35 | |||
36 | /** | ||
37 | * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use) | ||
38 | * @cm: CM base virtual address | ||
39 | * @cm2: CM2 base virtual address (if present on the booted SoC) | ||
40 | * | ||
41 | * XXX Will be replaced when the PRM/CM drivers are completed. | ||
42 | */ | ||
43 | void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2) | ||
44 | { | ||
45 | cm_base = cm; | ||
46 | cm2_base = cm2; | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * cm_split_idlest_reg - split CM_IDLEST reg addr into its components | ||
51 | * @idlest_reg: CM_IDLEST* virtual address | ||
52 | * @prcm_inst: pointer to an s16 to return the PRCM instance offset | ||
53 | * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID | ||
54 | * | ||
55 | * Given an absolute CM_IDLEST register address @idlest_reg, passes | ||
56 | * the PRCM instance offset and IDLEST register ID back to the caller | ||
57 | * via the @prcm_inst and @idlest_reg_id. Returns -EINVAL upon error, | ||
58 | * or 0 upon success. XXX This function is only needed until absolute | ||
59 | * register addresses are removed from the OMAP struct clk records. | ||
60 | */ | ||
61 | int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
62 | u8 *idlest_reg_id) | ||
63 | { | ||
64 | if (!cm_ll_data->split_idlest_reg) { | ||
65 | WARN_ONCE(1, "cm: %s: no low-level function defined\n", | ||
66 | __func__); | ||
67 | return -EINVAL; | ||
68 | } | ||
69 | |||
70 | return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst, | ||
71 | idlest_reg_id); | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * cm_wait_module_ready - wait for a module to leave idle or standby | ||
76 | * @prcm_mod: PRCM module offset | ||
77 | * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) | ||
78 | * @idlest_shift: shift of the bit in the CM_IDLEST* register to check | ||
79 | * | ||
80 | * Wait for the PRCM to indicate that the module identified by | ||
81 | * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon | ||
82 | * success, -EBUSY if the module doesn't enable in time, or -EINVAL if | ||
83 | * no per-SoC wait_module_ready() function pointer has been registered | ||
84 | * or if the idlest register is unknown on the SoC. | ||
85 | */ | ||
86 | int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) | ||
87 | { | ||
88 | if (!cm_ll_data->wait_module_ready) { | ||
89 | WARN_ONCE(1, "cm: %s: no low-level function defined\n", | ||
90 | __func__); | ||
91 | return -EINVAL; | ||
92 | } | ||
93 | |||
94 | return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift); | ||
95 | } | ||
96 | |||
28 | /** | 97 | /** |
29 | * cm_register - register per-SoC low-level data with the CM | 98 | * cm_register - register per-SoC low-level data with the CM |
30 | * @cld: low-level per-SoC OMAP CM data & function pointers to register | 99 | * @cld: low-level per-SoC OMAP CM data & function pointers to register |