18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * TI DA850/OMAP-L138 chip specific setup
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * Derived from: arch/arm/mach-davinci/da830.c
78c2ecf20Sopenharmony_ci * Original Copyrights follow:
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * 2009 (c) MontaVista Software, Inc. This file is licensed under
108c2ecf20Sopenharmony_ci * the terms of the GNU General Public License version 2. This program
118c2ecf20Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express
128c2ecf20Sopenharmony_ci * or implied.
138c2ecf20Sopenharmony_ci */
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
168c2ecf20Sopenharmony_ci#include <linux/clk/davinci.h>
178c2ecf20Sopenharmony_ci#include <linux/clkdev.h>
188c2ecf20Sopenharmony_ci#include <linux/cpufreq.h>
198c2ecf20Sopenharmony_ci#include <linux/gpio.h>
208c2ecf20Sopenharmony_ci#include <linux/init.h>
218c2ecf20Sopenharmony_ci#include <linux/io.h>
228c2ecf20Sopenharmony_ci#include <linux/irqchip/irq-davinci-cp-intc.h>
238c2ecf20Sopenharmony_ci#include <linux/mfd/da8xx-cfgchip.h>
248c2ecf20Sopenharmony_ci#include <linux/platform_data/clk-da8xx-cfgchip.h>
258c2ecf20Sopenharmony_ci#include <linux/platform_data/clk-davinci-pll.h>
268c2ecf20Sopenharmony_ci#include <linux/platform_data/davinci-cpufreq.h>
278c2ecf20Sopenharmony_ci#include <linux/platform_data/gpio-davinci.h>
288c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
298c2ecf20Sopenharmony_ci#include <linux/regmap.h>
308c2ecf20Sopenharmony_ci#include <linux/regulator/consumer.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include <asm/mach/map.h>
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#include <mach/common.h>
358c2ecf20Sopenharmony_ci#include <mach/cputype.h>
368c2ecf20Sopenharmony_ci#include <mach/da8xx.h>
378c2ecf20Sopenharmony_ci#include <mach/pm.h>
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#include <clocksource/timer-davinci.h>
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#include "irqs.h"
428c2ecf20Sopenharmony_ci#include "mux.h"
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define DA850_PLL1_BASE		0x01e1a000
458c2ecf20Sopenharmony_ci#define DA850_TIMER64P2_BASE	0x01f0c000
468c2ecf20Sopenharmony_ci#define DA850_TIMER64P3_BASE	0x01f0d000
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci#define DA850_REF_FREQ		24000000
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/*
518c2ecf20Sopenharmony_ci * Device specific mux setup
528c2ecf20Sopenharmony_ci *
538c2ecf20Sopenharmony_ci *		soc	description	mux	mode	mode	mux	dbg
548c2ecf20Sopenharmony_ci *					reg	offset	mask	mode
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_cistatic const struct mux_config da850_pins[] = {
578c2ecf20Sopenharmony_ci#ifdef CONFIG_DAVINCI_MUX
588c2ecf20Sopenharmony_ci	/* UART0 function */
598c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NUART0_CTS,	3,	24,	15,	2,	false)
608c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NUART0_RTS,	3,	28,	15,	2,	false)
618c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART0_RXD,	3,	16,	15,	2,	false)
628c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART0_TXD,	3,	20,	15,	2,	false)
638c2ecf20Sopenharmony_ci	/* UART1 function */
648c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART1_RXD,	4,	24,	15,	2,	false)
658c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART1_TXD,	4,	28,	15,	2,	false)
668c2ecf20Sopenharmony_ci	/* UART2 function */
678c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART2_RXD,	4,	16,	15,	2,	false)
688c2ecf20Sopenharmony_ci	MUX_CFG(DA850, UART2_TXD,	4,	20,	15,	2,	false)
698c2ecf20Sopenharmony_ci	/* I2C1 function */
708c2ecf20Sopenharmony_ci	MUX_CFG(DA850, I2C1_SCL,	4,	16,	15,	4,	false)
718c2ecf20Sopenharmony_ci	MUX_CFG(DA850, I2C1_SDA,	4,	20,	15,	4,	false)
728c2ecf20Sopenharmony_ci	/* I2C0 function */
738c2ecf20Sopenharmony_ci	MUX_CFG(DA850, I2C0_SDA,	4,	12,	15,	2,	false)
748c2ecf20Sopenharmony_ci	MUX_CFG(DA850, I2C0_SCL,	4,	8,	15,	2,	false)
758c2ecf20Sopenharmony_ci	/* EMAC function */
768c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXEN,	2,	4,	15,	8,	false)
778c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXCLK,	2,	8,	15,	8,	false)
788c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_COL,		2,	12,	15,	8,	false)
798c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXD_3,	2,	16,	15,	8,	false)
808c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXD_2,	2,	20,	15,	8,	false)
818c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXD_1,	2,	24,	15,	8,	false)
828c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_TXD_0,	2,	28,	15,	8,	false)
838c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXCLK,	3,	0,	15,	8,	false)
848c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXDV,	3,	4,	15,	8,	false)
858c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXER,	3,	8,	15,	8,	false)
868c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_CRS,		3,	12,	15,	8,	false)
878c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXD_3,	3,	16,	15,	8,	false)
888c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXD_2,	3,	20,	15,	8,	false)
898c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXD_1,	3,	24,	15,	8,	false)
908c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MII_RXD_0,	3,	28,	15,	8,	false)
918c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MDIO_CLK,	4,	0,	15,	8,	false)
928c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MDIO_D,		4,	4,	15,	8,	false)
938c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_TXD_0,	14,	12,	15,	8,	false)
948c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_TXD_1,	14,	8,	15,	8,	false)
958c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_TXEN,	14,	16,	15,	8,	false)
968c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_CRS_DV,	15,	4,	15,	8,	false)
978c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_RXD_0,	14,	24,	15,	8,	false)
988c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_RXD_1,	14,	20,	15,	8,	false)
998c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_RXER,	14,	28,	15,	8,	false)
1008c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RMII_MHZ_50_CLK,	15,	0,	15,	0,	false)
1018c2ecf20Sopenharmony_ci	/* McASP function */
1028c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	ACLKR,		0,	0,	15,	1,	false)
1038c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	ACLKX,		0,	4,	15,	1,	false)
1048c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AFSR,		0,	8,	15,	1,	false)
1058c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AFSX,		0,	12,	15,	1,	false)
1068c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AHCLKR,		0,	16,	15,	1,	false)
1078c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AHCLKX,		0,	20,	15,	1,	false)
1088c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AMUTE,		0,	24,	15,	1,	false)
1098c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_15,		1,	0,	15,	1,	false)
1108c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_14,		1,	4,	15,	1,	false)
1118c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_13,		1,	8,	15,	1,	false)
1128c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_12,		1,	12,	15,	1,	false)
1138c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_11,		1,	16,	15,	1,	false)
1148c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_10,		1,	20,	15,	1,	false)
1158c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_9,		1,	24,	15,	1,	false)
1168c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_8,		1,	28,	15,	1,	false)
1178c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_7,		2,	0,	15,	1,	false)
1188c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_6,		2,	4,	15,	1,	false)
1198c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_5,		2,	8,	15,	1,	false)
1208c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_4,		2,	12,	15,	1,	false)
1218c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_3,		2,	16,	15,	1,	false)
1228c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_2,		2,	20,	15,	1,	false)
1238c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_1,		2,	24,	15,	1,	false)
1248c2ecf20Sopenharmony_ci	MUX_CFG(DA850,	AXR_0,		2,	28,	15,	1,	false)
1258c2ecf20Sopenharmony_ci	/* LCD function */
1268c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_7,		16,	8,	15,	2,	false)
1278c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_6,		16,	12,	15,	2,	false)
1288c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_5,		16,	16,	15,	2,	false)
1298c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_4,		16,	20,	15,	2,	false)
1308c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_3,		16,	24,	15,	2,	false)
1318c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_2,		16,	28,	15,	2,	false)
1328c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_1,		17,	0,	15,	2,	false)
1338c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_0,		17,	4,	15,	2,	false)
1348c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_15,	17,	8,	15,	2,	false)
1358c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_14,	17,	12,	15,	2,	false)
1368c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_13,	17,	16,	15,	2,	false)
1378c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_12,	17,	20,	15,	2,	false)
1388c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_11,	17,	24,	15,	2,	false)
1398c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_10,	17,	28,	15,	2,	false)
1408c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_9,		18,	0,	15,	2,	false)
1418c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_D_8,		18,	4,	15,	2,	false)
1428c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_PCLK,	18,	24,	15,	2,	false)
1438c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_HSYNC,	19,	0,	15,	2,	false)
1448c2ecf20Sopenharmony_ci	MUX_CFG(DA850, LCD_VSYNC,	19,	4,	15,	2,	false)
1458c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NLCD_AC_ENB_CS,	19,	24,	15,	2,	false)
1468c2ecf20Sopenharmony_ci	/* MMC/SD0 function */
1478c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_DAT_0,	10,	8,	15,	2,	false)
1488c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_DAT_1,	10,	12,	15,	2,	false)
1498c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_DAT_2,	10,	16,	15,	2,	false)
1508c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_DAT_3,	10,	20,	15,	2,	false)
1518c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_CLK,	10,	0,	15,	2,	false)
1528c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD0_CMD,	10,	4,	15,	2,	false)
1538c2ecf20Sopenharmony_ci	/* MMC/SD1 function */
1548c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_DAT_0,	18,	8,	15,	2,	false)
1558c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_DAT_1,	19,	16,	15,	2,	false)
1568c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_DAT_2,	19,	12,	15,	2,	false)
1578c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_DAT_3,	19,	8,	15,	2,	false)
1588c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_CLK,	18,	12,	15,	2,	false)
1598c2ecf20Sopenharmony_ci	MUX_CFG(DA850, MMCSD1_CMD,	18,	16,	15,	2,	false)
1608c2ecf20Sopenharmony_ci	/* EMIF2.5/EMIFA function */
1618c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_7,		9,	0,	15,	1,	false)
1628c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_6,		9,	4,	15,	1,	false)
1638c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_5,		9,	8,	15,	1,	false)
1648c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_4,		9,	12,	15,	1,	false)
1658c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_3,		9,	16,	15,	1,	false)
1668c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_2,		9,	20,	15,	1,	false)
1678c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_1,		9,	24,	15,	1,	false)
1688c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_0,		9,	28,	15,	1,	false)
1698c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_1,		12,	24,	15,	1,	false)
1708c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_2,		12,	20,	15,	1,	false)
1718c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NEMA_CS_3,	7,	4,	15,	1,	false)
1728c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NEMA_CS_4,	7,	8,	15,	1,	false)
1738c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NEMA_WE,		7,	16,	15,	1,	false)
1748c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NEMA_OE,		7,	20,	15,	1,	false)
1758c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_0,		12,	28,	15,	1,	false)
1768c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_3,		12,	16,	15,	1,	false)
1778c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_4,		12,	12,	15,	1,	false)
1788c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_5,		12,	8,	15,	1,	false)
1798c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_6,		12,	4,	15,	1,	false)
1808c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_7,		12,	0,	15,	1,	false)
1818c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_8,		11,	28,	15,	1,	false)
1828c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_9,		11,	24,	15,	1,	false)
1838c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_10,	11,	20,	15,	1,	false)
1848c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_11,	11,	16,	15,	1,	false)
1858c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_12,	11,	12,	15,	1,	false)
1868c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_13,	11,	8,	15,	1,	false)
1878c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_14,	11,	4,	15,	1,	false)
1888c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_15,	11,	0,	15,	1,	false)
1898c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_16,	10,	28,	15,	1,	false)
1908c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_17,	10,	24,	15,	1,	false)
1918c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_18,	10,	20,	15,	1,	false)
1928c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_19,	10,	16,	15,	1,	false)
1938c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_20,	10,	12,	15,	1,	false)
1948c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_21,	10,	8,	15,	1,	false)
1958c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_22,	10,	4,	15,	1,	false)
1968c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_A_23,	10,	0,	15,	1,	false)
1978c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_8,		8,	28,	15,	1,	false)
1988c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_9,		8,	24,	15,	1,	false)
1998c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_10,	8,	20,	15,	1,	false)
2008c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_11,	8,	16,	15,	1,	false)
2018c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_12,	8,	12,	15,	1,	false)
2028c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_13,	8,	8,	15,	1,	false)
2038c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_14,	8,	4,	15,	1,	false)
2048c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_D_15,	8,	0,	15,	1,	false)
2058c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_BA_1,	5,	24,	15,	1,	false)
2068c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_CLK,		6,	0,	15,	1,	false)
2078c2ecf20Sopenharmony_ci	MUX_CFG(DA850, EMA_WAIT_1,	6,	24,	15,	1,	false)
2088c2ecf20Sopenharmony_ci	MUX_CFG(DA850, NEMA_CS_2,	7,	0,	15,	1,	false)
2098c2ecf20Sopenharmony_ci	/* GPIO function */
2108c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO2_4,		6,	12,	15,	8,	false)
2118c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO2_6,		6,	4,	15,	8,	false)
2128c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO2_8,		5,	28,	15,	8,	false)
2138c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO2_15,	5,	0,	15,	8,	false)
2148c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO3_12,	7,	12,	15,	8,	false)
2158c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO3_13,	7,	8,	15,	8,	false)
2168c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO4_0,		10,	28,	15,	8,	false)
2178c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO4_1,		10,	24,	15,	8,	false)
2188c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO6_9,		13,	24,	15,	8,	false)
2198c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO6_10,	13,	20,	15,	8,	false)
2208c2ecf20Sopenharmony_ci	MUX_CFG(DA850, GPIO6_13,	13,	8,	15,	8,	false)
2218c2ecf20Sopenharmony_ci	MUX_CFG(DA850, RTC_ALARM,	0,	28,	15,	2,	false)
2228c2ecf20Sopenharmony_ci	/* VPIF Capture */
2238c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN0,	15,	4,	15,	1,	false)
2248c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN1,	15,	0,	15,	1,	false)
2258c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN2,	14,	28,	15,	1,	false)
2268c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN3,	14,	24,	15,	1,	false)
2278c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN4,	14,	20,	15,	1,	false)
2288c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN5,	14,	16,	15,	1,	false)
2298c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN6,	14,	12,	15,	1,	false)
2308c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN7,	14,	8,	15,	1,	false)
2318c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN8,	16,	4,	15,	1,	false)
2328c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN9,	16,	0,	15,	1,	false)
2338c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN10,	15,	28,	15,	1,	false)
2348c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN11,	15,	24,	15,	1,	false)
2358c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN12,	15,	20,	15,	1,	false)
2368c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN13,	15,	16,	15,	1,	false)
2378c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN14,	15,	12,	15,	1,	false)
2388c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DIN15,	15,	8,	15,	1,	false)
2398c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKIN0,	14,	0,	15,	1,	false)
2408c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKIN1,	14,	4,	15,	1,	false)
2418c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKIN2,	19,	8,	15,	1,	false)
2428c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKIN3,	19,	16,	15,	1,	false)
2438c2ecf20Sopenharmony_ci	/* VPIF Display */
2448c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT0,	17,	4,	15,	1,	false)
2458c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT1,	17,	0,	15,	1,	false)
2468c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT2,	16,	28,	15,	1,	false)
2478c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT3,	16,	24,	15,	1,	false)
2488c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT4,	16,	20,	15,	1,	false)
2498c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT5,	16,	16,	15,	1,	false)
2508c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT6,	16,	12,	15,	1,	false)
2518c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT7,	16,	8,	15,	1,	false)
2528c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT8,	18,	4,	15,	1,	false)
2538c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT9,	18,	0,	15,	1,	false)
2548c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT10,	17,	28,	15,	1,	false)
2558c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT11,	17,	24,	15,	1,	false)
2568c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT12,	17,	20,	15,	1,	false)
2578c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT13,	17,	16,	15,	1,	false)
2588c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT14,	17,	12,	15,	1,	false)
2598c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_DOUT15,	17,	8,	15,	1,	false)
2608c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKO2,	19,	12,	15,	1,	false)
2618c2ecf20Sopenharmony_ci	MUX_CFG(DA850, VPIF_CLKO3,	19,	20,	15,	1,	false)
2628c2ecf20Sopenharmony_ci#endif
2638c2ecf20Sopenharmony_ci};
2648c2ecf20Sopenharmony_ci
2658c2ecf20Sopenharmony_ciconst short da850_i2c0_pins[] __initconst = {
2668c2ecf20Sopenharmony_ci	DA850_I2C0_SDA, DA850_I2C0_SCL,
2678c2ecf20Sopenharmony_ci	-1
2688c2ecf20Sopenharmony_ci};
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ciconst short da850_i2c1_pins[] __initconst = {
2718c2ecf20Sopenharmony_ci	DA850_I2C1_SCL, DA850_I2C1_SDA,
2728c2ecf20Sopenharmony_ci	-1
2738c2ecf20Sopenharmony_ci};
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ciconst short da850_lcdcntl_pins[] __initconst = {
2768c2ecf20Sopenharmony_ci	DA850_LCD_D_0, DA850_LCD_D_1, DA850_LCD_D_2, DA850_LCD_D_3,
2778c2ecf20Sopenharmony_ci	DA850_LCD_D_4, DA850_LCD_D_5, DA850_LCD_D_6, DA850_LCD_D_7,
2788c2ecf20Sopenharmony_ci	DA850_LCD_D_8, DA850_LCD_D_9, DA850_LCD_D_10, DA850_LCD_D_11,
2798c2ecf20Sopenharmony_ci	DA850_LCD_D_12, DA850_LCD_D_13, DA850_LCD_D_14, DA850_LCD_D_15,
2808c2ecf20Sopenharmony_ci	DA850_LCD_PCLK, DA850_LCD_HSYNC, DA850_LCD_VSYNC, DA850_NLCD_AC_ENB_CS,
2818c2ecf20Sopenharmony_ci	-1
2828c2ecf20Sopenharmony_ci};
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ciconst short da850_vpif_capture_pins[] __initconst = {
2858c2ecf20Sopenharmony_ci	DA850_VPIF_DIN0, DA850_VPIF_DIN1, DA850_VPIF_DIN2, DA850_VPIF_DIN3,
2868c2ecf20Sopenharmony_ci	DA850_VPIF_DIN4, DA850_VPIF_DIN5, DA850_VPIF_DIN6, DA850_VPIF_DIN7,
2878c2ecf20Sopenharmony_ci	DA850_VPIF_DIN8, DA850_VPIF_DIN9, DA850_VPIF_DIN10, DA850_VPIF_DIN11,
2888c2ecf20Sopenharmony_ci	DA850_VPIF_DIN12, DA850_VPIF_DIN13, DA850_VPIF_DIN14, DA850_VPIF_DIN15,
2898c2ecf20Sopenharmony_ci	DA850_VPIF_CLKIN0, DA850_VPIF_CLKIN1, DA850_VPIF_CLKIN2,
2908c2ecf20Sopenharmony_ci	DA850_VPIF_CLKIN3,
2918c2ecf20Sopenharmony_ci	-1
2928c2ecf20Sopenharmony_ci};
2938c2ecf20Sopenharmony_ci
2948c2ecf20Sopenharmony_ciconst short da850_vpif_display_pins[] __initconst = {
2958c2ecf20Sopenharmony_ci	DA850_VPIF_DOUT0, DA850_VPIF_DOUT1, DA850_VPIF_DOUT2, DA850_VPIF_DOUT3,
2968c2ecf20Sopenharmony_ci	DA850_VPIF_DOUT4, DA850_VPIF_DOUT5, DA850_VPIF_DOUT6, DA850_VPIF_DOUT7,
2978c2ecf20Sopenharmony_ci	DA850_VPIF_DOUT8, DA850_VPIF_DOUT9, DA850_VPIF_DOUT10,
2988c2ecf20Sopenharmony_ci	DA850_VPIF_DOUT11, DA850_VPIF_DOUT12, DA850_VPIF_DOUT13,
2998c2ecf20Sopenharmony_ci	DA850_VPIF_DOUT14, DA850_VPIF_DOUT15, DA850_VPIF_CLKO2,
3008c2ecf20Sopenharmony_ci	DA850_VPIF_CLKO3,
3018c2ecf20Sopenharmony_ci	-1
3028c2ecf20Sopenharmony_ci};
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_cistatic struct map_desc da850_io_desc[] = {
3058c2ecf20Sopenharmony_ci	{
3068c2ecf20Sopenharmony_ci		.virtual	= IO_VIRT,
3078c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(IO_PHYS),
3088c2ecf20Sopenharmony_ci		.length		= IO_SIZE,
3098c2ecf20Sopenharmony_ci		.type		= MT_DEVICE
3108c2ecf20Sopenharmony_ci	},
3118c2ecf20Sopenharmony_ci	{
3128c2ecf20Sopenharmony_ci		.virtual	= DA8XX_CP_INTC_VIRT,
3138c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(DA8XX_CP_INTC_BASE),
3148c2ecf20Sopenharmony_ci		.length		= DA8XX_CP_INTC_SIZE,
3158c2ecf20Sopenharmony_ci		.type		= MT_DEVICE
3168c2ecf20Sopenharmony_ci	},
3178c2ecf20Sopenharmony_ci};
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci/* Contents of JTAG ID register used to identify exact cpu type */
3208c2ecf20Sopenharmony_cistatic struct davinci_id da850_ids[] = {
3218c2ecf20Sopenharmony_ci	{
3228c2ecf20Sopenharmony_ci		.variant	= 0x0,
3238c2ecf20Sopenharmony_ci		.part_no	= 0xb7d1,
3248c2ecf20Sopenharmony_ci		.manufacturer	= 0x017,	/* 0x02f >> 1 */
3258c2ecf20Sopenharmony_ci		.cpu_id		= DAVINCI_CPU_ID_DA850,
3268c2ecf20Sopenharmony_ci		.name		= "da850/omap-l138",
3278c2ecf20Sopenharmony_ci	},
3288c2ecf20Sopenharmony_ci	{
3298c2ecf20Sopenharmony_ci		.variant	= 0x1,
3308c2ecf20Sopenharmony_ci		.part_no	= 0xb7d1,
3318c2ecf20Sopenharmony_ci		.manufacturer	= 0x017,	/* 0x02f >> 1 */
3328c2ecf20Sopenharmony_ci		.cpu_id		= DAVINCI_CPU_ID_DA850,
3338c2ecf20Sopenharmony_ci		.name		= "da850/omap-l138/am18x",
3348c2ecf20Sopenharmony_ci	},
3358c2ecf20Sopenharmony_ci};
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci/*
3388c2ecf20Sopenharmony_ci * Bottom half of timer 0 is used for clock_event, top half for
3398c2ecf20Sopenharmony_ci * clocksource.
3408c2ecf20Sopenharmony_ci */
3418c2ecf20Sopenharmony_cistatic const struct davinci_timer_cfg da850_timer_cfg = {
3428c2ecf20Sopenharmony_ci	.reg = DEFINE_RES_IO(DA8XX_TIMER64P0_BASE, SZ_4K),
3438c2ecf20Sopenharmony_ci	.irq = {
3448c2ecf20Sopenharmony_ci		DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_0)),
3458c2ecf20Sopenharmony_ci		DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_0)),
3468c2ecf20Sopenharmony_ci	},
3478c2ecf20Sopenharmony_ci};
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci#ifdef CONFIG_CPU_FREQ
3508c2ecf20Sopenharmony_ci/*
3518c2ecf20Sopenharmony_ci * Notes:
3528c2ecf20Sopenharmony_ci * According to the TRM, minimum PLLM results in maximum power savings.
3538c2ecf20Sopenharmony_ci * The OPP definitions below should keep the PLLM as low as possible.
3548c2ecf20Sopenharmony_ci *
3558c2ecf20Sopenharmony_ci * The output of the PLLM must be between 300 to 600 MHz.
3568c2ecf20Sopenharmony_ci */
3578c2ecf20Sopenharmony_cistruct da850_opp {
3588c2ecf20Sopenharmony_ci	unsigned int	freq;	/* in KHz */
3598c2ecf20Sopenharmony_ci	unsigned int	prediv;
3608c2ecf20Sopenharmony_ci	unsigned int	mult;
3618c2ecf20Sopenharmony_ci	unsigned int	postdiv;
3628c2ecf20Sopenharmony_ci	unsigned int	cvdd_min; /* in uV */
3638c2ecf20Sopenharmony_ci	unsigned int	cvdd_max; /* in uV */
3648c2ecf20Sopenharmony_ci};
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_456 = {
3678c2ecf20Sopenharmony_ci	.freq		= 456000,
3688c2ecf20Sopenharmony_ci	.prediv		= 1,
3698c2ecf20Sopenharmony_ci	.mult		= 19,
3708c2ecf20Sopenharmony_ci	.postdiv	= 1,
3718c2ecf20Sopenharmony_ci	.cvdd_min	= 1300000,
3728c2ecf20Sopenharmony_ci	.cvdd_max	= 1350000,
3738c2ecf20Sopenharmony_ci};
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_408 = {
3768c2ecf20Sopenharmony_ci	.freq		= 408000,
3778c2ecf20Sopenharmony_ci	.prediv		= 1,
3788c2ecf20Sopenharmony_ci	.mult		= 17,
3798c2ecf20Sopenharmony_ci	.postdiv	= 1,
3808c2ecf20Sopenharmony_ci	.cvdd_min	= 1300000,
3818c2ecf20Sopenharmony_ci	.cvdd_max	= 1350000,
3828c2ecf20Sopenharmony_ci};
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_372 = {
3858c2ecf20Sopenharmony_ci	.freq		= 372000,
3868c2ecf20Sopenharmony_ci	.prediv		= 2,
3878c2ecf20Sopenharmony_ci	.mult		= 31,
3888c2ecf20Sopenharmony_ci	.postdiv	= 1,
3898c2ecf20Sopenharmony_ci	.cvdd_min	= 1200000,
3908c2ecf20Sopenharmony_ci	.cvdd_max	= 1320000,
3918c2ecf20Sopenharmony_ci};
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_300 = {
3948c2ecf20Sopenharmony_ci	.freq		= 300000,
3958c2ecf20Sopenharmony_ci	.prediv		= 1,
3968c2ecf20Sopenharmony_ci	.mult		= 25,
3978c2ecf20Sopenharmony_ci	.postdiv	= 2,
3988c2ecf20Sopenharmony_ci	.cvdd_min	= 1200000,
3998c2ecf20Sopenharmony_ci	.cvdd_max	= 1320000,
4008c2ecf20Sopenharmony_ci};
4018c2ecf20Sopenharmony_ci
4028c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_200 = {
4038c2ecf20Sopenharmony_ci	.freq		= 200000,
4048c2ecf20Sopenharmony_ci	.prediv		= 1,
4058c2ecf20Sopenharmony_ci	.mult		= 25,
4068c2ecf20Sopenharmony_ci	.postdiv	= 3,
4078c2ecf20Sopenharmony_ci	.cvdd_min	= 1100000,
4088c2ecf20Sopenharmony_ci	.cvdd_max	= 1160000,
4098c2ecf20Sopenharmony_ci};
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_cistatic const struct da850_opp da850_opp_96 = {
4128c2ecf20Sopenharmony_ci	.freq		= 96000,
4138c2ecf20Sopenharmony_ci	.prediv		= 1,
4148c2ecf20Sopenharmony_ci	.mult		= 20,
4158c2ecf20Sopenharmony_ci	.postdiv	= 5,
4168c2ecf20Sopenharmony_ci	.cvdd_min	= 1000000,
4178c2ecf20Sopenharmony_ci	.cvdd_max	= 1050000,
4188c2ecf20Sopenharmony_ci};
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci#define OPP(freq) 		\
4218c2ecf20Sopenharmony_ci	{				\
4228c2ecf20Sopenharmony_ci		.driver_data = (unsigned int) &da850_opp_##freq,	\
4238c2ecf20Sopenharmony_ci		.frequency = freq * 1000, \
4248c2ecf20Sopenharmony_ci	}
4258c2ecf20Sopenharmony_ci
4268c2ecf20Sopenharmony_cistatic struct cpufreq_frequency_table da850_freq_table[] = {
4278c2ecf20Sopenharmony_ci	OPP(456),
4288c2ecf20Sopenharmony_ci	OPP(408),
4298c2ecf20Sopenharmony_ci	OPP(372),
4308c2ecf20Sopenharmony_ci	OPP(300),
4318c2ecf20Sopenharmony_ci	OPP(200),
4328c2ecf20Sopenharmony_ci	OPP(96),
4338c2ecf20Sopenharmony_ci	{
4348c2ecf20Sopenharmony_ci		.driver_data		= 0,
4358c2ecf20Sopenharmony_ci		.frequency	= CPUFREQ_TABLE_END,
4368c2ecf20Sopenharmony_ci	},
4378c2ecf20Sopenharmony_ci};
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci#ifdef CONFIG_REGULATOR
4408c2ecf20Sopenharmony_cistatic int da850_set_voltage(unsigned int index);
4418c2ecf20Sopenharmony_cistatic int da850_regulator_init(void);
4428c2ecf20Sopenharmony_ci#endif
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_cistatic struct davinci_cpufreq_config cpufreq_info = {
4458c2ecf20Sopenharmony_ci	.freq_table = da850_freq_table,
4468c2ecf20Sopenharmony_ci#ifdef CONFIG_REGULATOR
4478c2ecf20Sopenharmony_ci	.init = da850_regulator_init,
4488c2ecf20Sopenharmony_ci	.set_voltage = da850_set_voltage,
4498c2ecf20Sopenharmony_ci#endif
4508c2ecf20Sopenharmony_ci};
4518c2ecf20Sopenharmony_ci
4528c2ecf20Sopenharmony_ci#ifdef CONFIG_REGULATOR
4538c2ecf20Sopenharmony_cistatic struct regulator *cvdd;
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_cistatic int da850_set_voltage(unsigned int index)
4568c2ecf20Sopenharmony_ci{
4578c2ecf20Sopenharmony_ci	struct da850_opp *opp;
4588c2ecf20Sopenharmony_ci
4598c2ecf20Sopenharmony_ci	if (!cvdd)
4608c2ecf20Sopenharmony_ci		return -ENODEV;
4618c2ecf20Sopenharmony_ci
4628c2ecf20Sopenharmony_ci	opp = (struct da850_opp *) cpufreq_info.freq_table[index].driver_data;
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci	return regulator_set_voltage(cvdd, opp->cvdd_min, opp->cvdd_max);
4658c2ecf20Sopenharmony_ci}
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_cistatic int da850_regulator_init(void)
4688c2ecf20Sopenharmony_ci{
4698c2ecf20Sopenharmony_ci	cvdd = regulator_get(NULL, "cvdd");
4708c2ecf20Sopenharmony_ci	if (WARN(IS_ERR(cvdd), "Unable to obtain voltage regulator for CVDD;"
4718c2ecf20Sopenharmony_ci					" voltage scaling unsupported\n")) {
4728c2ecf20Sopenharmony_ci		return PTR_ERR(cvdd);
4738c2ecf20Sopenharmony_ci	}
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci	return 0;
4768c2ecf20Sopenharmony_ci}
4778c2ecf20Sopenharmony_ci#endif
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_cistatic struct platform_device da850_cpufreq_device = {
4808c2ecf20Sopenharmony_ci	.name			= "cpufreq-davinci",
4818c2ecf20Sopenharmony_ci	.dev = {
4828c2ecf20Sopenharmony_ci		.platform_data	= &cpufreq_info,
4838c2ecf20Sopenharmony_ci	},
4848c2ecf20Sopenharmony_ci	.id = -1,
4858c2ecf20Sopenharmony_ci};
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ciunsigned int da850_max_speed = 300000;
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ciint da850_register_cpufreq(char *async_clk)
4908c2ecf20Sopenharmony_ci{
4918c2ecf20Sopenharmony_ci	int i;
4928c2ecf20Sopenharmony_ci
4938c2ecf20Sopenharmony_ci	/* cpufreq driver can help keep an "async" clock constant */
4948c2ecf20Sopenharmony_ci	if (async_clk)
4958c2ecf20Sopenharmony_ci		clk_add_alias("async", da850_cpufreq_device.name,
4968c2ecf20Sopenharmony_ci							async_clk, NULL);
4978c2ecf20Sopenharmony_ci	for (i = 0; i < ARRAY_SIZE(da850_freq_table); i++) {
4988c2ecf20Sopenharmony_ci		if (da850_freq_table[i].frequency <= da850_max_speed) {
4998c2ecf20Sopenharmony_ci			cpufreq_info.freq_table = &da850_freq_table[i];
5008c2ecf20Sopenharmony_ci			break;
5018c2ecf20Sopenharmony_ci		}
5028c2ecf20Sopenharmony_ci	}
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci	return platform_device_register(&da850_cpufreq_device);
5058c2ecf20Sopenharmony_ci}
5068c2ecf20Sopenharmony_ci#else
5078c2ecf20Sopenharmony_ciint __init da850_register_cpufreq(char *async_clk)
5088c2ecf20Sopenharmony_ci{
5098c2ecf20Sopenharmony_ci	return 0;
5108c2ecf20Sopenharmony_ci}
5118c2ecf20Sopenharmony_ci#endif
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci/* VPIF resource, platform data */
5148c2ecf20Sopenharmony_cistatic u64 da850_vpif_dma_mask = DMA_BIT_MASK(32);
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_cistatic struct resource da850_vpif_resource[] = {
5178c2ecf20Sopenharmony_ci	{
5188c2ecf20Sopenharmony_ci		.start = DA8XX_VPIF_BASE,
5198c2ecf20Sopenharmony_ci		.end   = DA8XX_VPIF_BASE + 0xfff,
5208c2ecf20Sopenharmony_ci		.flags = IORESOURCE_MEM,
5218c2ecf20Sopenharmony_ci	}
5228c2ecf20Sopenharmony_ci};
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_cistatic struct platform_device da850_vpif_dev = {
5258c2ecf20Sopenharmony_ci	.name		= "vpif",
5268c2ecf20Sopenharmony_ci	.id		= -1,
5278c2ecf20Sopenharmony_ci	.dev		= {
5288c2ecf20Sopenharmony_ci		.dma_mask		= &da850_vpif_dma_mask,
5298c2ecf20Sopenharmony_ci		.coherent_dma_mask	= DMA_BIT_MASK(32),
5308c2ecf20Sopenharmony_ci	},
5318c2ecf20Sopenharmony_ci	.resource	= da850_vpif_resource,
5328c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(da850_vpif_resource),
5338c2ecf20Sopenharmony_ci};
5348c2ecf20Sopenharmony_ci
5358c2ecf20Sopenharmony_cistatic struct resource da850_vpif_display_resource[] = {
5368c2ecf20Sopenharmony_ci	{
5378c2ecf20Sopenharmony_ci		.start = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5388c2ecf20Sopenharmony_ci		.end   = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5398c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ,
5408c2ecf20Sopenharmony_ci	},
5418c2ecf20Sopenharmony_ci};
5428c2ecf20Sopenharmony_ci
5438c2ecf20Sopenharmony_cistatic struct platform_device da850_vpif_display_dev = {
5448c2ecf20Sopenharmony_ci	.name		= "vpif_display",
5458c2ecf20Sopenharmony_ci	.id		= -1,
5468c2ecf20Sopenharmony_ci	.dev		= {
5478c2ecf20Sopenharmony_ci		.dma_mask		= &da850_vpif_dma_mask,
5488c2ecf20Sopenharmony_ci		.coherent_dma_mask	= DMA_BIT_MASK(32),
5498c2ecf20Sopenharmony_ci	},
5508c2ecf20Sopenharmony_ci	.resource       = da850_vpif_display_resource,
5518c2ecf20Sopenharmony_ci	.num_resources  = ARRAY_SIZE(da850_vpif_display_resource),
5528c2ecf20Sopenharmony_ci};
5538c2ecf20Sopenharmony_ci
5548c2ecf20Sopenharmony_cistatic struct resource da850_vpif_capture_resource[] = {
5558c2ecf20Sopenharmony_ci	{
5568c2ecf20Sopenharmony_ci		.start = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5578c2ecf20Sopenharmony_ci		.end   = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5588c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ,
5598c2ecf20Sopenharmony_ci	},
5608c2ecf20Sopenharmony_ci	{
5618c2ecf20Sopenharmony_ci		.start = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5628c2ecf20Sopenharmony_ci		.end   = DAVINCI_INTC_IRQ(IRQ_DA850_VPIFINT),
5638c2ecf20Sopenharmony_ci		.flags = IORESOURCE_IRQ,
5648c2ecf20Sopenharmony_ci	},
5658c2ecf20Sopenharmony_ci};
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_cistatic struct platform_device da850_vpif_capture_dev = {
5688c2ecf20Sopenharmony_ci	.name		= "vpif_capture",
5698c2ecf20Sopenharmony_ci	.id		= -1,
5708c2ecf20Sopenharmony_ci	.dev		= {
5718c2ecf20Sopenharmony_ci		.dma_mask		= &da850_vpif_dma_mask,
5728c2ecf20Sopenharmony_ci		.coherent_dma_mask	= DMA_BIT_MASK(32),
5738c2ecf20Sopenharmony_ci	},
5748c2ecf20Sopenharmony_ci	.resource       = da850_vpif_capture_resource,
5758c2ecf20Sopenharmony_ci	.num_resources  = ARRAY_SIZE(da850_vpif_capture_resource),
5768c2ecf20Sopenharmony_ci};
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ciint __init da850_register_vpif(void)
5798c2ecf20Sopenharmony_ci{
5808c2ecf20Sopenharmony_ci	return platform_device_register(&da850_vpif_dev);
5818c2ecf20Sopenharmony_ci}
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ciint __init da850_register_vpif_display(struct vpif_display_config
5848c2ecf20Sopenharmony_ci						*display_config)
5858c2ecf20Sopenharmony_ci{
5868c2ecf20Sopenharmony_ci	da850_vpif_display_dev.dev.platform_data = display_config;
5878c2ecf20Sopenharmony_ci	return platform_device_register(&da850_vpif_display_dev);
5888c2ecf20Sopenharmony_ci}
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ciint __init da850_register_vpif_capture(struct vpif_capture_config
5918c2ecf20Sopenharmony_ci							*capture_config)
5928c2ecf20Sopenharmony_ci{
5938c2ecf20Sopenharmony_ci	da850_vpif_capture_dev.dev.platform_data = capture_config;
5948c2ecf20Sopenharmony_ci	return platform_device_register(&da850_vpif_capture_dev);
5958c2ecf20Sopenharmony_ci}
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_cistatic struct davinci_gpio_platform_data da850_gpio_platform_data = {
5988c2ecf20Sopenharmony_ci	.no_auto_base	= true,
5998c2ecf20Sopenharmony_ci	.base		= 0,
6008c2ecf20Sopenharmony_ci	.ngpio		= 144,
6018c2ecf20Sopenharmony_ci};
6028c2ecf20Sopenharmony_ci
6038c2ecf20Sopenharmony_ciint __init da850_register_gpio(void)
6048c2ecf20Sopenharmony_ci{
6058c2ecf20Sopenharmony_ci	return da8xx_register_gpio(&da850_gpio_platform_data);
6068c2ecf20Sopenharmony_ci}
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_cistatic const struct davinci_soc_info davinci_soc_info_da850 = {
6098c2ecf20Sopenharmony_ci	.io_desc		= da850_io_desc,
6108c2ecf20Sopenharmony_ci	.io_desc_num		= ARRAY_SIZE(da850_io_desc),
6118c2ecf20Sopenharmony_ci	.jtag_id_reg		= DA8XX_SYSCFG0_BASE + DA8XX_JTAG_ID_REG,
6128c2ecf20Sopenharmony_ci	.ids			= da850_ids,
6138c2ecf20Sopenharmony_ci	.ids_num		= ARRAY_SIZE(da850_ids),
6148c2ecf20Sopenharmony_ci	.pinmux_base		= DA8XX_SYSCFG0_BASE + 0x120,
6158c2ecf20Sopenharmony_ci	.pinmux_pins		= da850_pins,
6168c2ecf20Sopenharmony_ci	.pinmux_pins_num	= ARRAY_SIZE(da850_pins),
6178c2ecf20Sopenharmony_ci	.emac_pdata		= &da8xx_emac_pdata,
6188c2ecf20Sopenharmony_ci	.sram_dma		= DA8XX_SHARED_RAM_BASE,
6198c2ecf20Sopenharmony_ci	.sram_len		= SZ_128K,
6208c2ecf20Sopenharmony_ci};
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_civoid __init da850_init(void)
6238c2ecf20Sopenharmony_ci{
6248c2ecf20Sopenharmony_ci	davinci_common_init(&davinci_soc_info_da850);
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci	da8xx_syscfg0_base = ioremap(DA8XX_SYSCFG0_BASE, SZ_4K);
6278c2ecf20Sopenharmony_ci	if (WARN(!da8xx_syscfg0_base, "Unable to map syscfg0 module"))
6288c2ecf20Sopenharmony_ci		return;
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci	da8xx_syscfg1_base = ioremap(DA8XX_SYSCFG1_BASE, SZ_4K);
6318c2ecf20Sopenharmony_ci	WARN(!da8xx_syscfg1_base, "Unable to map syscfg1 module");
6328c2ecf20Sopenharmony_ci}
6338c2ecf20Sopenharmony_ci
6348c2ecf20Sopenharmony_cistatic const struct davinci_cp_intc_config da850_cp_intc_config = {
6358c2ecf20Sopenharmony_ci	.reg = {
6368c2ecf20Sopenharmony_ci		.start		= DA8XX_CP_INTC_BASE,
6378c2ecf20Sopenharmony_ci		.end		= DA8XX_CP_INTC_BASE + SZ_8K - 1,
6388c2ecf20Sopenharmony_ci		.flags		= IORESOURCE_MEM,
6398c2ecf20Sopenharmony_ci	},
6408c2ecf20Sopenharmony_ci	.num_irqs		= DA850_N_CP_INTC_IRQ,
6418c2ecf20Sopenharmony_ci};
6428c2ecf20Sopenharmony_ci
6438c2ecf20Sopenharmony_civoid __init da850_init_irq(void)
6448c2ecf20Sopenharmony_ci{
6458c2ecf20Sopenharmony_ci	davinci_cp_intc_init(&da850_cp_intc_config);
6468c2ecf20Sopenharmony_ci}
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_civoid __init da850_init_time(void)
6498c2ecf20Sopenharmony_ci{
6508c2ecf20Sopenharmony_ci	void __iomem *pll0;
6518c2ecf20Sopenharmony_ci	struct regmap *cfgchip;
6528c2ecf20Sopenharmony_ci	struct clk *clk;
6538c2ecf20Sopenharmony_ci	int rv;
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci	clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA850_REF_FREQ);
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci	pll0 = ioremap(DA8XX_PLL0_BASE, SZ_4K);
6588c2ecf20Sopenharmony_ci	cfgchip = da8xx_get_cfgchip();
6598c2ecf20Sopenharmony_ci
6608c2ecf20Sopenharmony_ci	da850_pll0_init(NULL, pll0, cfgchip);
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci	clk = clk_get(NULL, "timer0");
6638c2ecf20Sopenharmony_ci	if (WARN_ON(IS_ERR(clk))) {
6648c2ecf20Sopenharmony_ci		pr_err("Unable to get the timer clock\n");
6658c2ecf20Sopenharmony_ci		return;
6668c2ecf20Sopenharmony_ci	}
6678c2ecf20Sopenharmony_ci
6688c2ecf20Sopenharmony_ci	rv = davinci_timer_register(clk, &da850_timer_cfg);
6698c2ecf20Sopenharmony_ci	WARN(rv, "Unable to register the timer: %d\n", rv);
6708c2ecf20Sopenharmony_ci}
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_cistatic struct resource da850_pll1_resources[] = {
6738c2ecf20Sopenharmony_ci	{
6748c2ecf20Sopenharmony_ci		.start	= DA850_PLL1_BASE,
6758c2ecf20Sopenharmony_ci		.end	= DA850_PLL1_BASE + SZ_4K - 1,
6768c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
6778c2ecf20Sopenharmony_ci	},
6788c2ecf20Sopenharmony_ci};
6798c2ecf20Sopenharmony_ci
6808c2ecf20Sopenharmony_cistatic struct davinci_pll_platform_data da850_pll1_pdata;
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_cistatic struct platform_device da850_pll1_device = {
6838c2ecf20Sopenharmony_ci	.name		= "da850-pll1",
6848c2ecf20Sopenharmony_ci	.id		= -1,
6858c2ecf20Sopenharmony_ci	.resource	= da850_pll1_resources,
6868c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(da850_pll1_resources),
6878c2ecf20Sopenharmony_ci	.dev		= {
6888c2ecf20Sopenharmony_ci		.platform_data	= &da850_pll1_pdata,
6898c2ecf20Sopenharmony_ci	},
6908c2ecf20Sopenharmony_ci};
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistatic struct resource da850_psc0_resources[] = {
6938c2ecf20Sopenharmony_ci	{
6948c2ecf20Sopenharmony_ci		.start	= DA8XX_PSC0_BASE,
6958c2ecf20Sopenharmony_ci		.end	= DA8XX_PSC0_BASE + SZ_4K - 1,
6968c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
6978c2ecf20Sopenharmony_ci	},
6988c2ecf20Sopenharmony_ci};
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_cistatic struct platform_device da850_psc0_device = {
7018c2ecf20Sopenharmony_ci	.name		= "da850-psc0",
7028c2ecf20Sopenharmony_ci	.id		= -1,
7038c2ecf20Sopenharmony_ci	.resource	= da850_psc0_resources,
7048c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(da850_psc0_resources),
7058c2ecf20Sopenharmony_ci};
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_cistatic struct resource da850_psc1_resources[] = {
7088c2ecf20Sopenharmony_ci	{
7098c2ecf20Sopenharmony_ci		.start	= DA8XX_PSC1_BASE,
7108c2ecf20Sopenharmony_ci		.end	= DA8XX_PSC1_BASE + SZ_4K - 1,
7118c2ecf20Sopenharmony_ci		.flags	= IORESOURCE_MEM,
7128c2ecf20Sopenharmony_ci	},
7138c2ecf20Sopenharmony_ci};
7148c2ecf20Sopenharmony_ci
7158c2ecf20Sopenharmony_cistatic struct platform_device da850_psc1_device = {
7168c2ecf20Sopenharmony_ci	.name		= "da850-psc1",
7178c2ecf20Sopenharmony_ci	.id		= -1,
7188c2ecf20Sopenharmony_ci	.resource	= da850_psc1_resources,
7198c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(da850_psc1_resources),
7208c2ecf20Sopenharmony_ci};
7218c2ecf20Sopenharmony_ci
7228c2ecf20Sopenharmony_cistatic struct da8xx_cfgchip_clk_platform_data da850_async1_pdata;
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_cistatic struct platform_device da850_async1_clksrc_device = {
7258c2ecf20Sopenharmony_ci	.name		= "da850-async1-clksrc",
7268c2ecf20Sopenharmony_ci	.id		= -1,
7278c2ecf20Sopenharmony_ci	.dev		= {
7288c2ecf20Sopenharmony_ci		.platform_data	= &da850_async1_pdata,
7298c2ecf20Sopenharmony_ci	},
7308c2ecf20Sopenharmony_ci};
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_cistatic struct da8xx_cfgchip_clk_platform_data da850_async3_pdata;
7338c2ecf20Sopenharmony_ci
7348c2ecf20Sopenharmony_cistatic struct platform_device da850_async3_clksrc_device = {
7358c2ecf20Sopenharmony_ci	.name		= "da850-async3-clksrc",
7368c2ecf20Sopenharmony_ci	.id		= -1,
7378c2ecf20Sopenharmony_ci	.dev		= {
7388c2ecf20Sopenharmony_ci		.platform_data	= &da850_async3_pdata,
7398c2ecf20Sopenharmony_ci	},
7408c2ecf20Sopenharmony_ci};
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_cistatic struct da8xx_cfgchip_clk_platform_data da850_tbclksync_pdata;
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_cistatic struct platform_device da850_tbclksync_device = {
7458c2ecf20Sopenharmony_ci	.name		= "da830-tbclksync",
7468c2ecf20Sopenharmony_ci	.id		= -1,
7478c2ecf20Sopenharmony_ci	.dev		= {
7488c2ecf20Sopenharmony_ci		.platform_data	= &da850_tbclksync_pdata,
7498c2ecf20Sopenharmony_ci	},
7508c2ecf20Sopenharmony_ci};
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_civoid __init da850_register_clocks(void)
7538c2ecf20Sopenharmony_ci{
7548c2ecf20Sopenharmony_ci	/* PLL0 is registered in da850_init_time() */
7558c2ecf20Sopenharmony_ci
7568c2ecf20Sopenharmony_ci	da850_pll1_pdata.cfgchip = da8xx_get_cfgchip();
7578c2ecf20Sopenharmony_ci	platform_device_register(&da850_pll1_device);
7588c2ecf20Sopenharmony_ci
7598c2ecf20Sopenharmony_ci	da850_async1_pdata.cfgchip = da8xx_get_cfgchip();
7608c2ecf20Sopenharmony_ci	platform_device_register(&da850_async1_clksrc_device);
7618c2ecf20Sopenharmony_ci
7628c2ecf20Sopenharmony_ci	da850_async3_pdata.cfgchip = da8xx_get_cfgchip();
7638c2ecf20Sopenharmony_ci	platform_device_register(&da850_async3_clksrc_device);
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci	platform_device_register(&da850_psc0_device);
7668c2ecf20Sopenharmony_ci
7678c2ecf20Sopenharmony_ci	platform_device_register(&da850_psc1_device);
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci	da850_tbclksync_pdata.cfgchip = da8xx_get_cfgchip();
7708c2ecf20Sopenharmony_ci	platform_device_register(&da850_tbclksync_device);
7718c2ecf20Sopenharmony_ci}
772