2 * OMAP2+ common Clock Management (CM) IP block functions
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley <paul@pwsan.com>
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.
11 * XXX This code should eventually be moved to a CM driver.
14 #include <linux/kernel.h>
15 #include <linux/init.h>
22 * cm_ll_data: function pointers to SoC-specific implementations of
25 static struct cm_ll_data null_cm_ll_data;
26 static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
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
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().
39 int cm_register(struct cm_ll_data *cld)
44 if (cm_ll_data != &null_cm_ll_data)
53 * cm_unregister - unregister per-SoC low-level data & function pointers
54 * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
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().
63 int cm_unregister(struct cm_ll_data *cld)
65 if (!cld || cm_ll_data != cld)
68 cm_ll_data = &null_cm_ll_data;