aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/cm_common.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:45:16 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 14:45:16 -0500
commit8287361abca36504da813638310d2547469283eb (patch)
tree8d98e9a910885efdb09ae5390a3ae44040557e2f /arch/arm/mach-omap2/cm_common.c
parent2989950cea13711f0cc573c26cde8fe08a36be03 (diff)
parent8556650dd3370a927217f16444aac5cc0c71e61b (diff)
Merge tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC Header cleanups from Olof Johansson: "This is a collection of header file cleanups, mostly for OMAP and AT91, that keeps moving the platforms in the direction of multiplatform by removing the need for mach-dependent header files used in drivers and other places." Fix up mostly trivial conflicts as per Olof. * tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (106 commits) ARM: OMAP2+: Move iommu/iovmm headers to platform_data ARM: OMAP2+: Make some definitions local ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h ARM: OMAP2+: Move iopgtable header to drivers/iommu/ ARM: OMAP: Merge iommu2.h into iommu.h atmel: move ATMEL_MAX_UART to platform_data/atmel.h ARM: OMAP: Remove omap_init_consistent_dma_size() arm: at91: move at91rm9200 rtc header in drivers/rtc arm: at91: move reset controller header to arm/arm/mach-at91 arm: at91: move pit define to the driver arm: at91: move at91_shdwc.h to arch/arm/mach-at91 arm: at91: move board header to arch/arm/mach-at91 arn: at91: move at91_tc.h to arch/arm/mach-at91 arm: at91 move at91_aic.h to arch/arm/mach-at91 arm: at91 move board.h to arch/arm/mach-at91 arm: at91: move platfarm_data to include/linux/platform_data/atmel.h arm: at91: drop machine defconfig ARM: OMAP: Remove NEED_MACH_GPIO_H ARM: OMAP: Remove unnecessary mach and plat includes ...
Diffstat (limited to 'arch/arm/mach-omap2/cm_common.c')
-rw-r--r--arch/arm/mach-omap2/cm_common.c71
1 files changed, 71 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
new file mode 100644
index 000000000000..3246cef151dc
--- /dev/null
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -0,0 +1,71 @@
1/*
2 * OMAP2+ common Clock Management (CM) IP block functions
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley <paul@pwsan.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 version 2 as
9 * published by the Free Software Foundation.
10 *
11 * XXX This code should eventually be moved to a CM driver.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16
17#include "cm2xxx.h"
18#include "cm3xxx.h"
19#include "cm44xx.h"
20
21/*
22 * cm_ll_data: function pointers to SoC-specific implementations of
23 * common CM functions
24 */
25static struct cm_ll_data null_cm_ll_data;
26static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
27
28/**
29 * cm_register - register per-SoC low-level data with the CM
30 * @cld: low-level per-SoC OMAP CM data & function pointers to register
31 *
32 * Register per-SoC low-level OMAP CM data and function pointers with
33 * the OMAP CM common interface. The caller must keep the data
34 * pointed to by @cld valid until it calls cm_unregister() and
35 * it returns successfully. Returns 0 upon success, -EINVAL if @cld
36 * is NULL, or -EEXIST if cm_register() has already been called
37 * without an intervening cm_unregister().
38 */
39int cm_register(struct cm_ll_data *cld)
40{
41 if (!cld)
42 return -EINVAL;
43
44 if (cm_ll_data != &null_cm_ll_data)
45 return -EEXIST;
46
47 cm_ll_data = cld;
48
49 return 0;
50}
51
52/**
53 * cm_unregister - unregister per-SoC low-level data & function pointers
54 * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
55 *
56 * Unregister per-SoC low-level OMAP CM data and function pointers
57 * that were previously registered with cm_register(). The
58 * caller may not destroy any of the data pointed to by @cld until
59 * this function returns successfully. Returns 0 upon success, or
60 * -EINVAL if @cld is NULL or if @cld does not match the struct
61 * cm_ll_data * previously registered by cm_register().
62 */
63int cm_unregister(struct cm_ll_data *cld)
64{
65 if (!cld || cm_ll_data != cld)
66 return -EINVAL;
67
68 cm_ll_data = &null_cm_ll_data;
69
70 return 0;
71}