2 * IMX Clock Control Module base class
4 * Copyright (C) 2012 NICTA
5 * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
14 #include "hw/sysbus.h"
16 #define CKIL_FREQ 32768 /* nominal 32khz clock */
18 /* PLL control registers */
19 #define PD(v) (((v) >> 26) & 0xf)
20 #define MFD(v) (((v) >> 16) & 0x3ff)
21 #define MFI(v) (((v) >> 10) & 0xf);
22 #define MFN(v) ((v) & 0x3ff)
24 #define PLL_PD(x) (((x) & 0xf) << 26)
25 #define PLL_MFD(x) (((x) & 0x3ff) << 16)
26 #define PLL_MFI(x) (((x) & 0xf) << 10)
27 #define PLL_MFN(x) (((x) & 0x3ff) << 0)
29 #define TYPE_IMX_CCM "imx.ccm"
30 #define IMX_CCM(obj) \
31 OBJECT_CHECK(IMXCCMState, (obj), TYPE_IMX_CCM)
32 #define IMX_CCM_CLASS(klass) \
33 OBJECT_CLASS_CHECK(IMXCCMClass, (klass), TYPE_IMX_CCM)
34 #define IMX_GET_CLASS(obj) \
35 OBJECT_GET_CLASS(IMXCCMClass, (obj), TYPE_IMX_CCM)
37 typedef struct IMXCCMState
{
39 SysBusDevice parent_obj
;
55 typedef struct IMXCCMClass
{
57 SysBusDeviceClass parent_class
;
60 uint32_t (*get_clock_frequency
)(IMXCCMState
*s
, IMXClk clk
);
63 uint32_t imx_ccm_calc_pll(uint32_t pllreg
, uint32_t base_freq
);
65 uint32_t imx_ccm_get_clock_frequency(IMXCCMState
*s
, IMXClk clock
);
67 #endif /* IMX_CCM_H */