162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * opp2420_data.c - old-style "OPP" table for OMAP2420
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2005-2009 Texas Instruments, Inc.
662306a36Sopenharmony_ci * Copyright (C) 2004-2009 Nokia Corporation
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Richard Woodruff <r-woodruff2@ti.com>
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
1162306a36Sopenharmony_ci * These configurations are characterized by voltage and speed for clocks.
1262306a36Sopenharmony_ci * The device is only validated for certain combinations. One way to express
1362306a36Sopenharmony_ci * these combinations is via the 'ratios' which the clocks operate with
1462306a36Sopenharmony_ci * respect to each other. These ratio sets are for a given voltage/DPLL
1562306a36Sopenharmony_ci * setting. All configurations can be described by a DPLL setting and a ratio.
1662306a36Sopenharmony_ci *
1762306a36Sopenharmony_ci * XXX Missing voltage data.
1862306a36Sopenharmony_ci * XXX Missing 19.2MHz sys_clk rate sets (needed for N800/N810)
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci * THe format described in this file is deprecated.  Once a reasonable
2162306a36Sopenharmony_ci * OPP API exists, the data in this file should be converted to use it.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * This is technically part of the OMAP2xxx clock code.
2462306a36Sopenharmony_ci *
2562306a36Sopenharmony_ci * Considerable work is still needed to fully support dynamic frequency
2662306a36Sopenharmony_ci * changes on OMAP2xxx-series chips.  Readers interested in such a
2762306a36Sopenharmony_ci * project are encouraged to review the Maemo Diablo RX-34 and RX-44
2862306a36Sopenharmony_ci * kernel source at:
2962306a36Sopenharmony_ci *     http://repository.maemo.org/pool/diablo/free/k/kernel-source-diablo/
3062306a36Sopenharmony_ci */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#include <linux/kernel.h>
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#include "opp2xxx.h"
3562306a36Sopenharmony_ci#include "sdrc.h"
3662306a36Sopenharmony_ci#include "clock.h"
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci/*
3962306a36Sopenharmony_ci * Key dividers which make up a PRCM set. Ratios for a PRCM are mandated.
4062306a36Sopenharmony_ci * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
4162306a36Sopenharmony_ci * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
4262306a36Sopenharmony_ci * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
4362306a36Sopenharmony_ci *
4462306a36Sopenharmony_ci * Filling in table based on H4 boards available.  There are quite a
4562306a36Sopenharmony_ci * few more rate combinations which could be defined.
4662306a36Sopenharmony_ci *
4762306a36Sopenharmony_ci * When multiple values are defined the start up will try and choose
4862306a36Sopenharmony_ci * the fastest one. If a 'fast' value is defined, then automatically,
4962306a36Sopenharmony_ci * the /2 one should be included as it can be used.  Generally having
5062306a36Sopenharmony_ci * more than one fast set does not make sense, as static timings need
5162306a36Sopenharmony_ci * to be changed to change the set.  The exception is the bypass
5262306a36Sopenharmony_ci * setting which is available for low power bypass.
5362306a36Sopenharmony_ci *
5462306a36Sopenharmony_ci * Note: This table needs to be sorted, fastest to slowest.
5562306a36Sopenharmony_ci **/
5662306a36Sopenharmony_ciconst struct prcm_config omap2420_rate_table[] = {
5762306a36Sopenharmony_ci	/* PRCM I - FAST */
5862306a36Sopenharmony_ci	{S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL,		/* 330MHz ARM */
5962306a36Sopenharmony_ci		RI_CM_CLKSEL_DSP_VAL, RI_CM_CLKSEL_GFX_VAL,
6062306a36Sopenharmony_ci		RI_CM_CLKSEL1_CORE_VAL, MI_CM_CLKSEL1_PLL_12_VAL,
6162306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_165MHz,
6262306a36Sopenharmony_ci		RATE_IN_242X},
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci	/* PRCM II - FAST */
6562306a36Sopenharmony_ci	{S12M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL,		/* 300MHz ARM */
6662306a36Sopenharmony_ci		RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
6762306a36Sopenharmony_ci		RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
6862306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
6962306a36Sopenharmony_ci		RATE_IN_242X},
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci	{S13M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL,		/* 300MHz ARM */
7262306a36Sopenharmony_ci		RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
7362306a36Sopenharmony_ci		RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
7462306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
7562306a36Sopenharmony_ci		RATE_IN_242X},
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci	/* PRCM III - FAST */
7862306a36Sopenharmony_ci	{S12M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL,		/* 266MHz ARM */
7962306a36Sopenharmony_ci		RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
8062306a36Sopenharmony_ci		RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
8162306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
8262306a36Sopenharmony_ci		RATE_IN_242X},
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci	{S13M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL,		/* 266MHz ARM */
8562306a36Sopenharmony_ci		RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
8662306a36Sopenharmony_ci		RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
8762306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
8862306a36Sopenharmony_ci		RATE_IN_242X},
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci	/* PRCM II - SLOW */
9162306a36Sopenharmony_ci	{S12M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL,		/* 150MHz ARM */
9262306a36Sopenharmony_ci		RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
9362306a36Sopenharmony_ci		RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
9462306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
9562306a36Sopenharmony_ci		RATE_IN_242X},
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	{S13M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL,		/* 150MHz ARM */
9862306a36Sopenharmony_ci		RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
9962306a36Sopenharmony_ci		RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
10062306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
10162306a36Sopenharmony_ci		RATE_IN_242X},
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	/* PRCM III - SLOW */
10462306a36Sopenharmony_ci	{S12M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL,		/* 133MHz ARM */
10562306a36Sopenharmony_ci		RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
10662306a36Sopenharmony_ci		RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
10762306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
10862306a36Sopenharmony_ci		RATE_IN_242X},
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci	{S13M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL,		/* 133MHz ARM */
11162306a36Sopenharmony_ci		RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
11262306a36Sopenharmony_ci		RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
11362306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
11462306a36Sopenharmony_ci		RATE_IN_242X},
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci	/* PRCM-VII (boot-bypass) */
11762306a36Sopenharmony_ci	{S12M, S12M, S12M, RVII_CM_CLKSEL_MPU_VAL,		/* 12MHz ARM*/
11862306a36Sopenharmony_ci		RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
11962306a36Sopenharmony_ci		RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_12_VAL,
12062306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
12162306a36Sopenharmony_ci		RATE_IN_242X},
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci	/* PRCM-VII (boot-bypass) */
12462306a36Sopenharmony_ci	{S13M, S13M, S13M, RVII_CM_CLKSEL_MPU_VAL,		/* 13MHz ARM */
12562306a36Sopenharmony_ci		RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
12662306a36Sopenharmony_ci		RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_13_VAL,
12762306a36Sopenharmony_ci		MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
12862306a36Sopenharmony_ci		RATE_IN_242X},
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci	{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
13162306a36Sopenharmony_ci};
132