xref: /qemu/hw/misc/imx25_ccm.c (revision 03dd024ff57733a55cd2e455f361d053c81b1b29)
192eccc6eSJean-Christophe Dubois /*
292eccc6eSJean-Christophe Dubois  * IMX25 Clock Control Module
392eccc6eSJean-Christophe Dubois  *
492eccc6eSJean-Christophe Dubois  * Copyright (C) 2012 NICTA
592eccc6eSJean-Christophe Dubois  * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
692eccc6eSJean-Christophe Dubois  *
792eccc6eSJean-Christophe Dubois  * This work is licensed under the terms of the GNU GPL, version 2 or later.
892eccc6eSJean-Christophe Dubois  * See the COPYING file in the top-level directory.
992eccc6eSJean-Christophe Dubois  *
1092eccc6eSJean-Christophe Dubois  * To get the timer frequencies right, we need to emulate at least part of
1192eccc6eSJean-Christophe Dubois  * the CCM.
1292eccc6eSJean-Christophe Dubois  */
1392eccc6eSJean-Christophe Dubois 
148ef94f0bSPeter Maydell #include "qemu/osdep.h"
1592eccc6eSJean-Christophe Dubois #include "hw/misc/imx25_ccm.h"
16*03dd024fSPaolo Bonzini #include "qemu/log.h"
1792eccc6eSJean-Christophe Dubois 
1892eccc6eSJean-Christophe Dubois #ifndef DEBUG_IMX25_CCM
1992eccc6eSJean-Christophe Dubois #define DEBUG_IMX25_CCM 0
2092eccc6eSJean-Christophe Dubois #endif
2192eccc6eSJean-Christophe Dubois 
2292eccc6eSJean-Christophe Dubois #define DPRINTF(fmt, args...) \
2392eccc6eSJean-Christophe Dubois     do { \
2492eccc6eSJean-Christophe Dubois         if (DEBUG_IMX25_CCM) { \
2592eccc6eSJean-Christophe Dubois             fprintf(stderr, "[%s]%s: " fmt , TYPE_IMX25_CCM, \
2692eccc6eSJean-Christophe Dubois                                              __func__, ##args); \
2792eccc6eSJean-Christophe Dubois         } \
2892eccc6eSJean-Christophe Dubois     } while (0)
2992eccc6eSJean-Christophe Dubois 
3092eccc6eSJean-Christophe Dubois static char const *imx25_ccm_reg_name(uint32_t reg)
3192eccc6eSJean-Christophe Dubois {
3292eccc6eSJean-Christophe Dubois     static char unknown[20];
3392eccc6eSJean-Christophe Dubois 
3492eccc6eSJean-Christophe Dubois     switch (reg) {
3592eccc6eSJean-Christophe Dubois     case IMX25_CCM_MPCTL_REG:
3692eccc6eSJean-Christophe Dubois         return "mpctl";
3792eccc6eSJean-Christophe Dubois     case IMX25_CCM_UPCTL_REG:
3892eccc6eSJean-Christophe Dubois         return "upctl";
3992eccc6eSJean-Christophe Dubois     case IMX25_CCM_CCTL_REG:
4092eccc6eSJean-Christophe Dubois         return "cctl";
4192eccc6eSJean-Christophe Dubois     case IMX25_CCM_CGCR0_REG:
4292eccc6eSJean-Christophe Dubois         return "cgcr0";
4392eccc6eSJean-Christophe Dubois     case IMX25_CCM_CGCR1_REG:
4492eccc6eSJean-Christophe Dubois         return "cgcr1";
4592eccc6eSJean-Christophe Dubois     case IMX25_CCM_CGCR2_REG:
4692eccc6eSJean-Christophe Dubois         return "cgcr2";
4792eccc6eSJean-Christophe Dubois     case IMX25_CCM_PCDR0_REG:
4892eccc6eSJean-Christophe Dubois         return "pcdr0";
4992eccc6eSJean-Christophe Dubois     case IMX25_CCM_PCDR1_REG:
5092eccc6eSJean-Christophe Dubois         return "pcdr1";
5192eccc6eSJean-Christophe Dubois     case IMX25_CCM_PCDR2_REG:
5292eccc6eSJean-Christophe Dubois         return "pcdr2";
5392eccc6eSJean-Christophe Dubois     case IMX25_CCM_PCDR3_REG:
5492eccc6eSJean-Christophe Dubois         return "pcdr3";
5592eccc6eSJean-Christophe Dubois     case IMX25_CCM_RCSR_REG:
5692eccc6eSJean-Christophe Dubois         return "rcsr";
5792eccc6eSJean-Christophe Dubois     case IMX25_CCM_CRDR_REG:
5892eccc6eSJean-Christophe Dubois         return "crdr";
5992eccc6eSJean-Christophe Dubois     case IMX25_CCM_DCVR0_REG:
6092eccc6eSJean-Christophe Dubois         return "dcvr0";
6192eccc6eSJean-Christophe Dubois     case IMX25_CCM_DCVR1_REG:
6292eccc6eSJean-Christophe Dubois         return "dcvr1";
6392eccc6eSJean-Christophe Dubois     case IMX25_CCM_DCVR2_REG:
6492eccc6eSJean-Christophe Dubois         return "dcvr2";
6592eccc6eSJean-Christophe Dubois     case IMX25_CCM_DCVR3_REG:
6692eccc6eSJean-Christophe Dubois         return "dcvr3";
6792eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTR0_REG:
6892eccc6eSJean-Christophe Dubois         return "ltr0";
6992eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTR1_REG:
7092eccc6eSJean-Christophe Dubois         return "ltr1";
7192eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTR2_REG:
7292eccc6eSJean-Christophe Dubois         return "ltr2";
7392eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTR3_REG:
7492eccc6eSJean-Christophe Dubois         return "ltr3";
7592eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTBR0_REG:
7692eccc6eSJean-Christophe Dubois         return "ltbr0";
7792eccc6eSJean-Christophe Dubois     case IMX25_CCM_LTBR1_REG:
7892eccc6eSJean-Christophe Dubois         return "ltbr1";
7992eccc6eSJean-Christophe Dubois     case IMX25_CCM_PMCR0_REG:
8092eccc6eSJean-Christophe Dubois         return "pmcr0";
8192eccc6eSJean-Christophe Dubois     case IMX25_CCM_PMCR1_REG:
8292eccc6eSJean-Christophe Dubois         return "pmcr1";
8392eccc6eSJean-Christophe Dubois     case IMX25_CCM_PMCR2_REG:
8492eccc6eSJean-Christophe Dubois         return "pmcr2";
8592eccc6eSJean-Christophe Dubois     case IMX25_CCM_MCR_REG:
8692eccc6eSJean-Christophe Dubois         return "mcr";
8792eccc6eSJean-Christophe Dubois     case IMX25_CCM_LPIMR0_REG:
8892eccc6eSJean-Christophe Dubois         return "lpimr0";
8992eccc6eSJean-Christophe Dubois     case IMX25_CCM_LPIMR1_REG:
9092eccc6eSJean-Christophe Dubois         return "lpimr1";
9192eccc6eSJean-Christophe Dubois     default:
9292eccc6eSJean-Christophe Dubois         sprintf(unknown, "[%d ?]", reg);
9392eccc6eSJean-Christophe Dubois         return unknown;
9492eccc6eSJean-Christophe Dubois     }
9592eccc6eSJean-Christophe Dubois }
9692eccc6eSJean-Christophe Dubois #define CKIH_FREQ 24000000 /* 24MHz crystal input */
9792eccc6eSJean-Christophe Dubois 
9892eccc6eSJean-Christophe Dubois static const VMStateDescription vmstate_imx25_ccm = {
9992eccc6eSJean-Christophe Dubois     .name = TYPE_IMX25_CCM,
10092eccc6eSJean-Christophe Dubois     .version_id = 1,
10192eccc6eSJean-Christophe Dubois     .minimum_version_id = 1,
10292eccc6eSJean-Christophe Dubois     .fields = (VMStateField[]) {
10392eccc6eSJean-Christophe Dubois         VMSTATE_UINT32_ARRAY(reg, IMX25CCMState, IMX25_CCM_MAX_REG),
10492eccc6eSJean-Christophe Dubois         VMSTATE_END_OF_LIST()
10592eccc6eSJean-Christophe Dubois     },
10692eccc6eSJean-Christophe Dubois };
10792eccc6eSJean-Christophe Dubois 
10892eccc6eSJean-Christophe Dubois static uint32_t imx25_ccm_get_mpll_clk(IMXCCMState *dev)
10992eccc6eSJean-Christophe Dubois {
11092eccc6eSJean-Christophe Dubois     uint32_t freq;
11192eccc6eSJean-Christophe Dubois     IMX25CCMState *s = IMX25_CCM(dev);
11292eccc6eSJean-Christophe Dubois 
11392eccc6eSJean-Christophe Dubois     if (EXTRACT(s->reg[IMX25_CCM_CCTL_REG], MPLL_BYPASS)) {
11492eccc6eSJean-Christophe Dubois         freq = CKIH_FREQ;
11592eccc6eSJean-Christophe Dubois     } else {
11692eccc6eSJean-Christophe Dubois         freq = imx_ccm_calc_pll(s->reg[IMX25_CCM_MPCTL_REG], CKIH_FREQ);
11792eccc6eSJean-Christophe Dubois     }
11892eccc6eSJean-Christophe Dubois 
11992eccc6eSJean-Christophe Dubois     DPRINTF("freq = %d\n", freq);
12092eccc6eSJean-Christophe Dubois 
12192eccc6eSJean-Christophe Dubois     return freq;
12292eccc6eSJean-Christophe Dubois }
12392eccc6eSJean-Christophe Dubois 
12492eccc6eSJean-Christophe Dubois static uint32_t imx25_ccm_get_mcu_clk(IMXCCMState *dev)
12592eccc6eSJean-Christophe Dubois {
12692eccc6eSJean-Christophe Dubois     uint32_t freq;
12792eccc6eSJean-Christophe Dubois     IMX25CCMState *s = IMX25_CCM(dev);
12892eccc6eSJean-Christophe Dubois 
12992eccc6eSJean-Christophe Dubois     freq = imx25_ccm_get_mpll_clk(dev);
13092eccc6eSJean-Christophe Dubois 
13192eccc6eSJean-Christophe Dubois     if (EXTRACT(s->reg[IMX25_CCM_CCTL_REG], ARM_SRC)) {
13292eccc6eSJean-Christophe Dubois         freq = (freq * 3 / 4);
13392eccc6eSJean-Christophe Dubois     }
13492eccc6eSJean-Christophe Dubois 
13592eccc6eSJean-Christophe Dubois     freq = freq / (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], ARM_CLK_DIV));
13692eccc6eSJean-Christophe Dubois 
13792eccc6eSJean-Christophe Dubois     DPRINTF("freq = %d\n", freq);
13892eccc6eSJean-Christophe Dubois 
13992eccc6eSJean-Christophe Dubois     return freq;
14092eccc6eSJean-Christophe Dubois }
14192eccc6eSJean-Christophe Dubois 
14292eccc6eSJean-Christophe Dubois static uint32_t imx25_ccm_get_ahb_clk(IMXCCMState *dev)
14392eccc6eSJean-Christophe Dubois {
14492eccc6eSJean-Christophe Dubois     uint32_t freq;
14592eccc6eSJean-Christophe Dubois     IMX25CCMState *s = IMX25_CCM(dev);
14692eccc6eSJean-Christophe Dubois 
14792eccc6eSJean-Christophe Dubois     freq = imx25_ccm_get_mcu_clk(dev)
14892eccc6eSJean-Christophe Dubois            / (1 + EXTRACT(s->reg[IMX25_CCM_CCTL_REG], AHB_CLK_DIV));
14992eccc6eSJean-Christophe Dubois 
15092eccc6eSJean-Christophe Dubois     DPRINTF("freq = %d\n", freq);
15192eccc6eSJean-Christophe Dubois 
15292eccc6eSJean-Christophe Dubois     return freq;
15392eccc6eSJean-Christophe Dubois }
15492eccc6eSJean-Christophe Dubois 
15592eccc6eSJean-Christophe Dubois static uint32_t imx25_ccm_get_ipg_clk(IMXCCMState *dev)
15692eccc6eSJean-Christophe Dubois {
15792eccc6eSJean-Christophe Dubois     uint32_t freq;
15892eccc6eSJean-Christophe Dubois 
15992eccc6eSJean-Christophe Dubois     freq = imx25_ccm_get_ahb_clk(dev) / 2;
16092eccc6eSJean-Christophe Dubois 
16192eccc6eSJean-Christophe Dubois     DPRINTF("freq = %d\n", freq);
16292eccc6eSJean-Christophe Dubois 
16392eccc6eSJean-Christophe Dubois     return freq;
16492eccc6eSJean-Christophe Dubois }
16592eccc6eSJean-Christophe Dubois 
16692eccc6eSJean-Christophe Dubois static uint32_t imx25_ccm_get_clock_frequency(IMXCCMState *dev, IMXClk clock)
16792eccc6eSJean-Christophe Dubois {
16892eccc6eSJean-Christophe Dubois     uint32_t freq = 0;
16992eccc6eSJean-Christophe Dubois     DPRINTF("Clock = %d)\n", clock);
17092eccc6eSJean-Christophe Dubois 
17192eccc6eSJean-Christophe Dubois     switch (clock) {
172c91a5883SJean-Christophe Dubois     case CLK_NONE:
17392eccc6eSJean-Christophe Dubois         break;
17492eccc6eSJean-Christophe Dubois     case CLK_IPG:
175d552f675SJean-Christophe Dubois     case CLK_IPG_HIGH:
17692eccc6eSJean-Christophe Dubois         freq = imx25_ccm_get_ipg_clk(dev);
17792eccc6eSJean-Christophe Dubois         break;
17892eccc6eSJean-Christophe Dubois     case CLK_32k:
17992eccc6eSJean-Christophe Dubois         freq = CKIL_FREQ;
18092eccc6eSJean-Christophe Dubois         break;
18192eccc6eSJean-Christophe Dubois     default:
18292eccc6eSJean-Christophe Dubois         qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: unsupported clock %d\n",
18392eccc6eSJean-Christophe Dubois                       TYPE_IMX25_CCM, __func__, clock);
18492eccc6eSJean-Christophe Dubois         break;
18592eccc6eSJean-Christophe Dubois     }
18692eccc6eSJean-Christophe Dubois 
18792eccc6eSJean-Christophe Dubois     DPRINTF("Clock = %d) = %d\n", clock, freq);
18892eccc6eSJean-Christophe Dubois 
18992eccc6eSJean-Christophe Dubois     return freq;
19092eccc6eSJean-Christophe Dubois }
19192eccc6eSJean-Christophe Dubois 
19292eccc6eSJean-Christophe Dubois static void imx25_ccm_reset(DeviceState *dev)
19392eccc6eSJean-Christophe Dubois {
19492eccc6eSJean-Christophe Dubois     IMX25CCMState *s = IMX25_CCM(dev);
19592eccc6eSJean-Christophe Dubois 
19692eccc6eSJean-Christophe Dubois     DPRINTF("\n");
19792eccc6eSJean-Christophe Dubois 
19892eccc6eSJean-Christophe Dubois     memset(s->reg, 0, IMX25_CCM_MAX_REG * sizeof(uint32_t));
19992eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_MPCTL_REG] = 0x800b2c01;
20092eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_UPCTL_REG] = 0x84042800;
20192eccc6eSJean-Christophe Dubois     /*
20292eccc6eSJean-Christophe Dubois      * The value below gives:
20392eccc6eSJean-Christophe Dubois      * CPU = 133 MHz, AHB = 66,5 MHz, IPG = 33 MHz.
20492eccc6eSJean-Christophe Dubois      */
20592eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_CCTL_REG]  = 0xd0030000;
20692eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_CGCR0_REG] = 0x028A0100;
20792eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_CGCR1_REG] = 0x04008100;
20892eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_CGCR2_REG] = 0x00000438;
20992eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PCDR0_REG] = 0x01010101;
21092eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PCDR1_REG] = 0x01010101;
21192eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PCDR2_REG] = 0x01010101;
21292eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PCDR3_REG] = 0x01010101;
21392eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PMCR0_REG] = 0x00A00000;
21492eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PMCR1_REG] = 0x0000A030;
21592eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_PMCR2_REG] = 0x0000A030;
21692eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_MCR_REG]   = 0x43000000;
21792eccc6eSJean-Christophe Dubois 
21892eccc6eSJean-Christophe Dubois     /*
21992eccc6eSJean-Christophe Dubois      * default boot will change the reset values to allow:
22092eccc6eSJean-Christophe Dubois      * CPU = 399 MHz, AHB = 133 MHz, IPG = 66,5 MHz.
22192eccc6eSJean-Christophe Dubois      * For some reason, this doesn't work. With the value below, linux
22292eccc6eSJean-Christophe Dubois      * detects a 88 MHz IPG CLK instead of 66,5 MHz.
22392eccc6eSJean-Christophe Dubois     s->reg[IMX25_CCM_CCTL_REG]  = 0x20032000;
22492eccc6eSJean-Christophe Dubois      */
22592eccc6eSJean-Christophe Dubois }
22692eccc6eSJean-Christophe Dubois 
22792eccc6eSJean-Christophe Dubois static uint64_t imx25_ccm_read(void *opaque, hwaddr offset, unsigned size)
22892eccc6eSJean-Christophe Dubois {
2293a87d009SPeter Maydell     uint32_t value = 0;
23092eccc6eSJean-Christophe Dubois     IMX25CCMState *s = (IMX25CCMState *)opaque;
23192eccc6eSJean-Christophe Dubois 
23292eccc6eSJean-Christophe Dubois     if (offset < 0x70) {
23392eccc6eSJean-Christophe Dubois         value = s->reg[offset >> 2];
23492eccc6eSJean-Christophe Dubois     } else {
23592eccc6eSJean-Christophe Dubois         qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
23692eccc6eSJean-Christophe Dubois                       HWADDR_PRIx "\n", TYPE_IMX25_CCM, __func__, offset);
23792eccc6eSJean-Christophe Dubois     }
23892eccc6eSJean-Christophe Dubois 
23992eccc6eSJean-Christophe Dubois     DPRINTF("reg[%s] => 0x%" PRIx32 "\n", imx25_ccm_reg_name(offset >> 2),
24092eccc6eSJean-Christophe Dubois             value);
24192eccc6eSJean-Christophe Dubois 
24292eccc6eSJean-Christophe Dubois     return value;
24392eccc6eSJean-Christophe Dubois }
24492eccc6eSJean-Christophe Dubois 
24592eccc6eSJean-Christophe Dubois static void imx25_ccm_write(void *opaque, hwaddr offset, uint64_t value,
24692eccc6eSJean-Christophe Dubois                             unsigned size)
24792eccc6eSJean-Christophe Dubois {
24892eccc6eSJean-Christophe Dubois     IMX25CCMState *s = (IMX25CCMState *)opaque;
24992eccc6eSJean-Christophe Dubois 
25092eccc6eSJean-Christophe Dubois     DPRINTF("reg[%s] <= 0x%" PRIx32 "\n", imx25_ccm_reg_name(offset >> 2),
25192eccc6eSJean-Christophe Dubois             (uint32_t)value);
25292eccc6eSJean-Christophe Dubois 
25392eccc6eSJean-Christophe Dubois     if (offset < 0x70) {
25492eccc6eSJean-Christophe Dubois         /*
25592eccc6eSJean-Christophe Dubois          * We will do a better implementation later. In particular some bits
25692eccc6eSJean-Christophe Dubois          * cannot be written to.
25792eccc6eSJean-Christophe Dubois          */
25892eccc6eSJean-Christophe Dubois         s->reg[offset >> 2] = value;
25992eccc6eSJean-Christophe Dubois     } else {
26092eccc6eSJean-Christophe Dubois         qemu_log_mask(LOG_GUEST_ERROR, "[%s]%s: Bad register at offset 0x%"
26192eccc6eSJean-Christophe Dubois                       HWADDR_PRIx "\n", TYPE_IMX25_CCM, __func__, offset);
26292eccc6eSJean-Christophe Dubois     }
26392eccc6eSJean-Christophe Dubois }
26492eccc6eSJean-Christophe Dubois 
26592eccc6eSJean-Christophe Dubois static const struct MemoryRegionOps imx25_ccm_ops = {
26692eccc6eSJean-Christophe Dubois     .read = imx25_ccm_read,
26792eccc6eSJean-Christophe Dubois     .write = imx25_ccm_write,
26892eccc6eSJean-Christophe Dubois     .endianness = DEVICE_NATIVE_ENDIAN,
26992eccc6eSJean-Christophe Dubois     .valid = {
27092eccc6eSJean-Christophe Dubois         /*
27192eccc6eSJean-Christophe Dubois          * Our device would not work correctly if the guest was doing
27292eccc6eSJean-Christophe Dubois          * unaligned access. This might not be a limitation on the real
27392eccc6eSJean-Christophe Dubois          * device but in practice there is no reason for a guest to access
27492eccc6eSJean-Christophe Dubois          * this device unaligned.
27592eccc6eSJean-Christophe Dubois          */
27692eccc6eSJean-Christophe Dubois         .min_access_size = 4,
27792eccc6eSJean-Christophe Dubois         .max_access_size = 4,
27892eccc6eSJean-Christophe Dubois         .unaligned = false,
27992eccc6eSJean-Christophe Dubois     },
28092eccc6eSJean-Christophe Dubois };
28192eccc6eSJean-Christophe Dubois 
28292eccc6eSJean-Christophe Dubois static void imx25_ccm_init(Object *obj)
28392eccc6eSJean-Christophe Dubois {
28492eccc6eSJean-Christophe Dubois     DeviceState *dev = DEVICE(obj);
28592eccc6eSJean-Christophe Dubois     SysBusDevice *sd = SYS_BUS_DEVICE(obj);
28692eccc6eSJean-Christophe Dubois     IMX25CCMState *s = IMX25_CCM(obj);
28792eccc6eSJean-Christophe Dubois 
28892eccc6eSJean-Christophe Dubois     memory_region_init_io(&s->iomem, OBJECT(dev), &imx25_ccm_ops, s,
28992eccc6eSJean-Christophe Dubois                           TYPE_IMX25_CCM, 0x1000);
29092eccc6eSJean-Christophe Dubois     sysbus_init_mmio(sd, &s->iomem);
29192eccc6eSJean-Christophe Dubois }
29292eccc6eSJean-Christophe Dubois 
29392eccc6eSJean-Christophe Dubois static void imx25_ccm_class_init(ObjectClass *klass, void *data)
29492eccc6eSJean-Christophe Dubois {
29592eccc6eSJean-Christophe Dubois     DeviceClass *dc = DEVICE_CLASS(klass);
29692eccc6eSJean-Christophe Dubois     IMXCCMClass *ccm = IMX_CCM_CLASS(klass);
29792eccc6eSJean-Christophe Dubois 
29892eccc6eSJean-Christophe Dubois     dc->reset = imx25_ccm_reset;
29992eccc6eSJean-Christophe Dubois     dc->vmsd = &vmstate_imx25_ccm;
30092eccc6eSJean-Christophe Dubois     dc->desc = "i.MX25 Clock Control Module";
30192eccc6eSJean-Christophe Dubois 
30292eccc6eSJean-Christophe Dubois     ccm->get_clock_frequency = imx25_ccm_get_clock_frequency;
30392eccc6eSJean-Christophe Dubois }
30492eccc6eSJean-Christophe Dubois 
30592eccc6eSJean-Christophe Dubois static const TypeInfo imx25_ccm_info = {
30692eccc6eSJean-Christophe Dubois     .name          = TYPE_IMX25_CCM,
30792eccc6eSJean-Christophe Dubois     .parent        = TYPE_IMX_CCM,
30892eccc6eSJean-Christophe Dubois     .instance_size = sizeof(IMX25CCMState),
30992eccc6eSJean-Christophe Dubois     .instance_init = imx25_ccm_init,
31092eccc6eSJean-Christophe Dubois     .class_init    = imx25_ccm_class_init,
31192eccc6eSJean-Christophe Dubois };
31292eccc6eSJean-Christophe Dubois 
31392eccc6eSJean-Christophe Dubois static void imx25_ccm_register_types(void)
31492eccc6eSJean-Christophe Dubois {
31592eccc6eSJean-Christophe Dubois     type_register_static(&imx25_ccm_info);
31692eccc6eSJean-Christophe Dubois }
31792eccc6eSJean-Christophe Dubois 
31892eccc6eSJean-Christophe Dubois type_init(imx25_ccm_register_types)
319