hw/vfio/ccw: avoid taking address members in packed structs
[qemu/ar7.git] / include / hw / misc / imx_ccm.h
blob33cbc099526837d8b5c186593ab710c7ba9138f3
1 /*
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.
9 */
11 #ifndef IMX_CCM_H
12 #define IMX_CCM_H
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 {
38 /* <private> */
39 SysBusDevice parent_obj;
41 /* <public> */
43 } IMXCCMState;
45 typedef enum {
46 CLK_NONE,
47 CLK_IPG,
48 CLK_IPG_HIGH,
49 CLK_32k,
50 CLK_EXT,
51 CLK_HIGH_DIV,
52 CLK_HIGH,
53 } IMXClk;
55 typedef struct IMXCCMClass {
56 /* <private> */
57 SysBusDeviceClass parent_class;
59 /* <public> */
60 uint32_t (*get_clock_frequency)(IMXCCMState *s, IMXClk clk);
61 } IMXCCMClass;
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 */