#include <linux/clkdev.h>
#include <linux/clk-provider.h>
#include <linux/math64.h>
#include <linux/module.h>
#include <linux/of_device.h>
#include <linux/string.h>
#define ADPLL_PLLSS_MMR_LOCK_OFFSET 0x00
#define ADPLL_PLLSS_MMR_LOCK_ENABLED 0x1f125B64
#define ADPLL_PLLSS_MMR_UNLOCK_MAGIC 0x1eda4c3d
#define ADPLL_PWRCTRL_OFFSET 0x00
#define ADPLL_PWRCTRL_PONIN 5
#define ADPLL_PWRCTRL_PGOODIN 4
#define ADPLL_PWRCTRL_RET 3
#define ADPLL_PWRCTRL_ISORET 2
#define ADPLL_PWRCTRL_ISOSCAN 1
#define ADPLL_PWRCTRL_OFFMODE 0
#define ADPLL_CLKCTRL_OFFSET 0x04
#define ADPLL_CLKCTRL_CLKDCOLDOEN 29
#define ADPLL_CLKCTRL_IDLE 23
#define ADPLL_CLKCTRL_CLKOUTEN 20
#define ADPLL_CLKINPHIFSEL_ADPLL_S 19
#define ADPLL_CLKCTRL_CLKOUTLDOEN_ADPLL_LJ 19
#define ADPLL_CLKCTRL_ULOWCLKEN 18
#define ADPLL_CLKCTRL_CLKDCOLDOPWDNZ 17
#define ADPLL_CLKCTRL_M2PWDNZ 16
#define ADPLL_CLKCTRL_M3PWDNZ_ADPLL_S 15
#define ADPLL_CLKCTRL_LOWCURRSTDBY_ADPLL_S 13
#define ADPLL_CLKCTRL_LPMODE_ADPLL_S 12
#define ADPLL_CLKCTRL_REGM4XEN_ADPLL_S 10
#define ADPLL_CLKCTRL_SELFREQDCO_ADPLL_LJ 10
#define ADPLL_CLKCTRL_TINITZ 0
#define ADPLL_TENABLE_OFFSET 0x08
#define ADPLL_TENABLEDIV_OFFSET 0x8c
#define ADPLL_M2NDIV_OFFSET 0x10
#define ADPLL_M2NDIV_M2 16
#define ADPLL_M2NDIV_M2_ADPLL_S_WIDTH 5
#define ADPLL_M2NDIV_M2_ADPLL_LJ_WIDTH 7
#define ADPLL_MN2DIV_OFFSET 0x14
#define ADPLL_MN2DIV_N2 16
#define ADPLL_FRACDIV_OFFSET 0x18
#define ADPLL_FRACDIV_REGSD 24
#define ADPLL_FRACDIV_FRACTIONALM 0
#define ADPLL_FRACDIV_FRACTIONALM_MASK 0x3ffff
#define ADPLL_BWCTRL_OFFSET 0x1c
#define ADPLL_BWCTRL_BWCONTROL 1
#define ADPLL_BWCTRL_BW_INCR_DECRZ 0
#define ADPLL_RESERVED_OFFSET 0x20
#define ADPLL_STATUS_OFFSET 0x24
#define ADPLL_STATUS_PONOUT 31
#define ADPLL_STATUS_PGOODOUT 30
#define ADPLL_STATUS_LDOPWDN 29
#define ADPLL_STATUS_RECAL_BSTATUS3 28
#define ADPLL_STATUS_RECAL_OPPIN 27
#define ADPLL_STATUS_PHASELOCK 10
#define ADPLL_STATUS_FREQLOCK 9
#define ADPLL_STATUS_BYPASSACK 8
#define ADPLL_STATUS_LOSSREF 6
#define ADPLL_STATUS_CLKOUTENACK 5
#define ADPLL_STATUS_LOCK2 4
#define ADPLL_STATUS_M2CHANGEACK 3
#define ADPLL_STATUS_HIGHJITTER 1
#define ADPLL_STATUS_BYPASS 0
#define ADPLL_STATUS_PREPARED_MASK (BIT(ADPLL_STATUS_PHASELOCK) | \
BIT(ADPLL_STATUS_FREQLOCK))
#define ADPLL_M3DIV_OFFSET 0x28
#define ADPLL_M3DIV_M3_WIDTH 5