/*
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *              http://www.samsung.com
 *
 * Author: Sung-Hyun Na <sunghyun.na@samsung.com>
 *
 * Chip Abstraction Layer for USB PHY
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#include <linux/delay.h>
#include <linux/io.h>
#include "phy-samsung-usb-cal.h"
#include "phy-exynos-usbdp-reg.h"

void phy_exynos_usbdp_tune_each(struct exynos_usbphy_info *info, char *name,
	int val)
{
	void __iomem *regs_base = info->regs_base;
	u32 reg;

	if (!name)
		return;

	if (!strcmp(name, "sstx_deemph")) {
		reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0C);
		reg &= ~USBDP_TRSV0C_MAN_TX_DE_EMP_LVL_MASK;
		reg |= USBDP_TRSV0C_MAN_TX_DE_EMP_LVL_SET(val);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0C);
	} else if (!strcmp(name, "sstx_amp")) {
		reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0C);
		reg &= ~USBDP_TRSV0C_MAN_TX_DRVR_LVL_MASK;
		reg |= USBDP_TRSV0C_MAN_TX_DRVR_LVL_SET(val);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0C);
	} else if (!strcmp(name, "ssrx_los")) {
		reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0A);
		reg &= ~USBDP_TRSV0A_APB_CAL_OFFSET_DIFP_MASK;
		reg |= USBDP_TRSV0A_APB_CAL_OFFSET_DIFP_SET(val);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0A);

		reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0B);
		reg &= ~USBDP_TRSV0B_APB_CAL_OFFSET_DIFN_MASK;
		reg |= USBDP_TRSV0B_APB_CAL_OFFSET_DIFN_SET(val);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0B);
	} else if (!strcmp(name, "ssrx_ctle")) {
		reg = USBDP_TRSV02_RXAFE_LEQ_CSEL_GEN2_SET(0x2);
		reg |= USBDP_TRSV02_RXAFE_LEQ_CSEL_GEN1_SET(0x7);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R02);

		reg = USBDP_TRSV03_RXAFE_TERM_MODE;
		reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_MASK;
		reg |= USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_SET(0x7);
		reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN1_MASK;
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R03);

		reg = USBDP_TRSV04_RXAFE_TUNE_SET(val);
		reg |= USBDP_TRSV04_RXAFE_SQ_VFFSET_CTRL_SET(val);
		writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R04);
	}
}

void phy_exynos_usbdp_tune(struct exynos_usbphy_info *info)
{
	u32 cnt = 0;

	for (; info->tune_param[cnt].value != EXYNOS_USB_TUNE_LAST; cnt++) {
		char *para_name;
		int val;

		val = info->tune_param[cnt].value;
		if (val == -1)
			continue;
		para_name = info->tune_param[cnt].name;
		if (!para_name)
			break;
		phy_exynos_usbdp_tune_each(info, para_name, val);
	}
}
void phy_exynos_usbdp_enable(struct exynos_usbphy_info *info)
{
	void __iomem *regs_base = info->regs_base;
	u32 reg, reg_2c, reg_2d, reg_dp_b3;

	/* Recevier Detection Off */
	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R24);
	reg |= USBDP_TRSV24_MAN_TX_RCV_DET_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R24);

	/* Set Proper Value for PCS to avoid abnormal RX Detect */
	reg = readl(info->regs_base_2nd + USBDP_PCSREG_FRONT_END_MODE_VEC);
	reg |= USBDP_PCSREG_EN_REALIGN;
	writel(reg, info->regs_base_2nd + USBDP_PCSREG_FRONT_END_MODE_VEC);

	reg = USBDP_PCSREG_COMP_EN_ASSERT_SET(0x3f);
	writel(reg, info->regs_base_2nd + USBDP_PCSREG_DET_COMP_EN_SET);

	reg = 0;
	reg |= USBDP_CMN0E_PLL_AFC_VCO_CNT_RUN_NO_SET(0x4);
	reg |= USBDP_CMN0E_PLL_AFC_ANA_CPI_CTRL_SET(0x2);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R0E);

	reg = 0;
	reg |= USBDP_CMN0F_PLL_ANA_EN_PI;
	reg |= USBDP_CMN0F_PLL_ANA_DCC_EN_SET(0xf);
	reg |= USBDP_CMN0F_PLL_ANA_CPP_CTRL_SET(0x7);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R0F);

	reg = 0;
	reg |= USBDP_CMN10_PLL_ANA_VCI_SEL_SET(0x6);
	reg |= USBDP_CMN10_PLL_ANA_LPF_RSEL_SET(0x8);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R10);

	reg = 0;
	reg |= USBDP_CMN25_PLL_AGMC_TG_CODE_SET(0x30);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R25);

	reg = 0;
	reg |= USBDP_CMN26_PLL_AGMC_COMP_EN;
	reg |= USBDP_CMN26_PLL_AGMC_FROM_MAX_GM;
	reg |= USBDP_CMN26_PLL_AFC_FROM_PRE_CODE;
	reg |= USBDP_CMN26_PLL_AFC_MAN_BSEL_L_SET(0x3);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R26);

	reg = 0;
	reg |= USBDP_CMN27_PLL_ANA_LC_VREF_BYPASS_EN;
	reg |= USBDP_CMN27_PLL_ANA_LC_VCDO_CAP_OFFSET_SEL_SET(0x5);
	reg |= USBDP_CMN27_PLL_ANA_LC_VCO_BUFF_EN;
	reg |= USBDP_CMN27_PLL_ANA_LC_GM_COMP_VCI_SEL_SET(0x4);
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R27);

	reg = 0;
	reg |= USBDP_TRSV23_DATA_CLEAR_BY_SIGVAL;
	reg |= USBDP_TRSV23_FBB_H_BW_DIFF_SET(0x5);
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R23);

	/* SSC Setting */
	reg = readl(regs_base + EXYNOS_USBDP_COM_CMN_R24);
	reg |= USBDP_CMN24_SSC_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_CMN_R24);

	reg_2c = readl(regs_base + EXYNOS_USBDP_COM_CMN_R2C);
	reg_2d = readl(regs_base + EXYNOS_USBDP_COM_CMN_R2D);
	reg_dp_b3 = readl(regs_base + EXYNOS_USBDP_COM_DP_RB3);
	if (info->used_phy_port == 0) {
		reg_2c |= USBDP_CMN2C_MAN_USBDP_MODE_SET(0x3);
#if !defined(CONFIG_BOARD_ZEBU)
		reg_2d |= USBDP_CMN2D_USB_TX1_SEL;
		reg_2d &= ~USBDP_CMN2D_USB_TX3_SEL;
#else
		reg_2d |= USBDP_CMN2D_USB_TX3_SEL;
#endif
		reg_dp_b3 &= ~USBDP_DPB3_CMN_DUMMY_CTRL_7;
		reg_dp_b3 |= USBDP_DPB3_CMN_DUMMY_CTRL_6;
		reg_dp_b3 |= USBDP_DPB3_CMN_DUMMY_CTRL_1;
		reg_dp_b3 |= USBDP_DPB3_CMN_DUMMY_CTRL_0;
	} else {
		reg_2c &= ~USBDP_CMN2C_MAN_USBDP_MODE_MASK;
#if !defined(CONFIG_BOARD_ZEBU)
		reg_2d &= ~USBDP_CMN2D_USB_TX1_SEL;
		reg_2d |= USBDP_CMN2D_USB_TX3_SEL;
#else
		reg_2d |= USBDP_CMN2D_USB_TX3_SEL;
#endif
		reg_dp_b3 |= USBDP_DPB3_CMN_DUMMY_CTRL_7;
		reg_dp_b3 &= ~USBDP_DPB3_CMN_DUMMY_CTRL_6;
		reg_dp_b3 &= ~USBDP_DPB3_CMN_DUMMY_CTRL_1;
		reg_dp_b3 &= ~USBDP_DPB3_CMN_DUMMY_CTRL_0;
	}
	reg_2c |= USBDP_CMN2C_MAN_USBDP_MODE_EN;
	reg_2d &= ~USBDP_CMN2D_LCPLL_SSCDIV_MASK;
	reg_2d |= USBDP_CMN2D_LCPLL_SSCDIV_SET(0x1);
	writel(reg_2c, regs_base + EXYNOS_USBDP_COM_CMN_R2C);
	writel(reg_2d, regs_base + EXYNOS_USBDP_COM_CMN_R2D);
	writel(reg_dp_b3,  regs_base + EXYNOS_USBDP_COM_DP_RB3);

	reg = 0;
	reg |= USBDP_TRSV38_SFR_RX_LFPS_LPF_CTRL_SET(0x2);
	reg |= USBDP_TRSV38_SFR_RX_LFPS_TH_CTRL_SET(0x2);
	reg |= USBDP_TRSV38_RX_LFPS_DET_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R38);

	/* RX EQ tuning */
	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R01);
	reg &= ~USBDP_TRSV01_RXAFE_CTLE_SEL_MASK;
	reg |= USBDP_TRSV01_RXAFE_CTLE_SEL_SET(0x3);
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R01);

	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R03);
	reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN1_MASK;
	reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_MASK;
	reg |= USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN1_SET(0x0);
	reg |= USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_SET(0x5);
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R03);

	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0D);
	reg |= USBDP_TRSV0D_MAN_DRVR_DE_EMP_LVL_MAN_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0D);

	/* Sys Valid Debouncd Digital Filter */
	reg = 0;
	reg |= USBDP_TRSV34_INT_SIGVAL_FILT_SEL;
	reg |= USBDP_TRSV34_OUT_SIGVAL_FILT_SEL;
	reg |= USBDP_TRSV34_SIGVAL_FILT_DLY_CODE_SET(0x3);
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R34);

#if defined(CONFIG_BOARD_ZEBU)
	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R27);
	reg |= USBDP_TRSV27_MAN_RSTN_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R27);
#endif
	/* Recevier Detection On */
	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R24);
	reg &= ~USBDP_TRSV24_MAN_TX_RCV_DET_EN;
	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R24);

	/* Tune RX CTLE */
//	reg = USBDP_TRSV02_RXAFE_LEQ_CSEL_GEN2_SET(0x2);
//	reg |= USBDP_TRSV02_RXAFE_LEQ_CSEL_GEN1_SET(0x7);
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R02);
//
//	reg = USBDP_TRSV03_RXAFE_TERM_MODE;
//	reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_MASK;
//	reg |= USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN2_SET(0x7);
//	reg &= ~USBDP_TRSV03_RXAFE_LEQ_RSEL_GEN1_MASK;
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R03);
//
//	reg = USBDP_TRSV04_RXAFE_TUNE_SET(0x5);
//	reg |= USBDP_TRSV04_RXAFE_SQ_VFFSET_CTRL_SET(0x5);
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R04);

	/* Tune LOS Level */
//	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0A);
//	reg &= ~USBDP_TRSV0A_APB_CAL_OFFSET_DIFP_MASK;
//	reg |= USBDP_TRSV0A_APB_CAL_OFFSET_DIFP_SET(0x4);
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0A);
//
//	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0B);
//	reg &= ~USBDP_TRSV0B_APB_CAL_OFFSET_DIFN_MASK;
//	reg |= USBDP_TRSV0B_APB_CAL_OFFSET_DIFN_SET(0x4);
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0B);

//	/* Tune TX EQ */
//	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R0C);
//	reg &= ~USBDP_TRSV0C_MAN_TX_DE_EMP_LVL_MASK;
//	reg |= USBDP_TRSV0C_MAN_TX_DE_EMP_LVL_SET(0x9);
//	writel(reg, regs_base + EXYNOS_USBDP_COM_TRSV_R0C);

	/* Set Tune Value */
	phy_exynos_usbdp_tune(info);
}

int phy_exynos_usbdp_check_pll_lock(struct exynos_usbphy_info *info)
{
	void __iomem *regs_base = info->regs_base;
	u32 reg;

	reg = readl(regs_base + EXYNOS_USBDP_COM_CMN_R2F);
	pr_err("CMN_2F(0x%p) : 0x%x\n",
		regs_base + EXYNOS_USBDP_COM_CMN_R2F,
		reg);
	if (!(reg & USBDP_CMN2F_PLL_LOCK_DONE))
		return -1;

	reg = readl(regs_base + EXYNOS_USBDP_COM_TRSV_R4B);
	pr_err("TRSV_4B(0x%p) : 0x%x\n",
		regs_base + EXYNOS_USBDP_COM_TRSV_R4B,
		reg);
	if (!(reg & USBDP_TRSV4B_CDR_FLD_PLL_MODE_DONE))
		return -1;

	return 0;
}

void phy_exynos_usbdp_disable(struct exynos_usbphy_info *info)
{

}
