/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * Copyright (c) 2020 MediaTek Inc.
 */

#ifndef MTK_SC_H
#define MTK_SC_H

#include <linux/io.h>
#include <linux/bitops.h>

#define D_2 2
#define D_3 3
#define D_4 4
#define D_5 5
#define D_6 6
#define D_8 8
#define D_9 9
#define D_10 10
#define D_11 11
#define D_12 12
#define D_13 13
#define D_16 16
#define D_17 17
#define D_20 20
#define D_22 22
#define D_24 24
#define D_31 31

#define D_100 100
#define D_110 110
#define D_255 255
#define D_259 259
#define D_300 300
#define D_512 512
#define D_700 700
#define D_960 960
#define D_1000 1000
#define D_1500 1500
#define D_4000 4000
#define D_4500 4500
#define D_9600 9600

#define MILLION 1000000
#define D_144000000 144000000

#define D_1000000000 1000000000

#define CLK_DIV_372 372

#define H_00 0x00
#define H_01 0x01
#define H_03 0x03
#define H_04 0x04
#define H_0F 0x0F
#define H_10 0x10
#define H_1E 0x1E
#define H_20 0x20
#define H_23 0x23
#define H_33 0x33
#define H_36 0x36
#define H_3B 0x3b
#define H_3E 0x3E
#define H_3F 0x3F
#define H_40 0x40
#define H_55 0x55
#define H_80 0x80
#define H_81 0x81
#define H_82 0x82
#define H_90 0x90
#define H_91 0x91
#define H_92 0x92
#define H_AA 0xAA
#define H_C0 0xC0
#define H_C1 0xC1
#define H_C2 0xC2
#define H_C3 0xC3
#define H_CC 0xCC
#define H_E0 0xE0
#define H_E1 0xE1
#define H_E2 0xE2
#define H_E3 0xE3



#define H_F0 0xF0
#define H_FE 0xFE
#define H_FF 0xFF
#define H_0001 0x0001
#define H_0002 0x0002
#define H_00FF 0x00FF
#define H_FFFC 0xFFFC
#define H_FFFD 0xFFFD
#define H_FFFE 0xFFFE

#define H_FFFF0000 0xFFFF0000

#define H_FFFFFFFF 0xFFFFFFFF


#ifdef pr_fmt
#undef pr_fmt
#endif
#define pr_fmt(fmt) "mtk_sc: " fmt

extern int sc_log_level;

#define MTK_SC_ERR(fmt, ...)		\
	pr_err("[%s][%d]" fmt,	\
	__func__, __LINE__, ##__VA_ARGS__) //Enabled Always

#define MTK_SC_INFO(fmt, ...)		\
	do {if (sc_log_level >= LOGLEVEL_INFO) \
	pr_info("[%s][%d]" fmt,	\
	__func__, __LINE__, ##__VA_ARGS__); \
	} while (0)

#define MTK_SC_DEBUG(fmt, ...)		\
	do {if (sc_log_level >= LOGLEVEL_DEBUG) \
	pr_info("[%s][%d]" fmt,	\
	__func__, __LINE__, ##__VA_ARGS__); \
	} while (0)

#endif
