qemu/include/hw/misc/imx7_ccm.h
Andrey Smirnov e9e0ef15d2 i.MX: Add code to emulate i.MX7 CCM, PMU and ANALOG IP blocks
Add minimal code needed to allow upstream Linux guest to boot.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Philippe Mathieu-Daudé <f4bug@amsat.org>
Cc: Marcel Apfelbaum <marcel.apfelbaum@zoho.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org
Cc: yurovsky@gmail.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2018-02-09 10:40:29 +00:00

140 lines
3.2 KiB
C

/*
* Copyright (c) 2017, Impinj, Inc.
*
* i.MX7 CCM, PMU and ANALOG IP blocks emulation code
*
* Author: Andrey Smirnov <andrew.smirnov@gmail.com>
*
* This work is licensed under the terms of the GNU GPL, version 2 or later.
* See the COPYING file in the top-level directory.
*/
#ifndef IMX7_CCM_H
#define IMX7_CCM_H
#include "hw/misc/imx_ccm.h"
#include "qemu/bitops.h"
enum IMX7AnalogRegisters {
ANALOG_PLL_ARM,
ANALOG_PLL_ARM_SET,
ANALOG_PLL_ARM_CLR,
ANALOG_PLL_ARM_TOG,
ANALOG_PLL_DDR,
ANALOG_PLL_DDR_SET,
ANALOG_PLL_DDR_CLR,
ANALOG_PLL_DDR_TOG,
ANALOG_PLL_DDR_SS,
ANALOG_PLL_DDR_SS_SET,
ANALOG_PLL_DDR_SS_CLR,
ANALOG_PLL_DDR_SS_TOG,
ANALOG_PLL_DDR_NUM,
ANALOG_PLL_DDR_NUM_SET,
ANALOG_PLL_DDR_NUM_CLR,
ANALOG_PLL_DDR_NUM_TOG,
ANALOG_PLL_DDR_DENOM,
ANALOG_PLL_DDR_DENOM_SET,
ANALOG_PLL_DDR_DENOM_CLR,
ANALOG_P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ISC0,
ANALOG_PLL_MISC0_SET,
ANALOG_PLL_MISC0_CLR,
ANALOG_PLL_MISC0_TOG,
ANALOG_DIGPROG = 0x800 / sizeof(uint32_t),
ANALOG_MAX,
ANALOG_PLL_LOCK = BIT(31)
};
enum IMX7CCMRegisters {
CCM_MAX = 0xBE00 / sizeof(uint32_t) + 1,
};
enum IMX7PMURegisters {
PMU_MAX = 0x140 / sizeof(uint32_t),
};
#define TYPE_IMX7_CCM "imx7.ccm"
#define IMX7_CCM(obj) OBJECT_CHECK(IMX7CCMState, (obj), TYPE_IMX7_CCM)
typedef struct IMX7CCMState {
/* <private> */
IMXCCMState parent_obj;
/* <public> */
MemoryRegion iomem;
uint32_t ccm[CCM_MAX];
} IMX7CCMState;
#define TYPE_IMX7_ANALOG "imx7.analog"
#define IMX7_ANALOG(obj) OBJECT_CHECK(IMX7AnalogState, (obj), TYPE_IMX7_ANALOG)
typedef struct IMX7AnalogState {
/* <private> */
IMXCCMState parent_obj;
/* <public> */
struct {
MemoryRegion container;
MemoryRegion analog;
MemoryRegion digprog;
MemoryRegion pmu;
} mmio;
uint32_t analog[ANALOG_MAX];
uint32_t pmu[PMU_MAX];
} IMX7AnalogState;
#endif /* IMX7_CCM_H */