18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * linux/arch/arm/mach-sa1100/jornada720.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * HP Jornada720 init code
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
88c2ecf20Sopenharmony_ci * Copyright (C) 2006 Filip Zyzniewski <filip.zyzniewski@tefnet.pl>
98c2ecf20Sopenharmony_ci *  Copyright (C) 2005 Michael Gernoth <michael@gernoth.net>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/init.h>
138c2ecf20Sopenharmony_ci#include <linux/kernel.h>
148c2ecf20Sopenharmony_ci#include <linux/tty.h>
158c2ecf20Sopenharmony_ci#include <linux/delay.h>
168c2ecf20Sopenharmony_ci#include <linux/gpio/machine.h>
178c2ecf20Sopenharmony_ci#include <linux/platform_data/sa11x0-serial.h>
188c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
198c2ecf20Sopenharmony_ci#include <linux/ioport.h>
208c2ecf20Sopenharmony_ci#include <linux/mtd/mtd.h>
218c2ecf20Sopenharmony_ci#include <linux/mtd/partitions.h>
228c2ecf20Sopenharmony_ci#include <video/s1d13xxxfb.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <asm/hardware/sa1111.h>
258c2ecf20Sopenharmony_ci#include <asm/page.h>
268c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
278c2ecf20Sopenharmony_ci#include <asm/setup.h>
288c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
298c2ecf20Sopenharmony_ci#include <asm/mach/flash.h>
308c2ecf20Sopenharmony_ci#include <asm/mach/map.h>
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#include <mach/hardware.h>
338c2ecf20Sopenharmony_ci#include <mach/irqs.h>
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#include "generic.h"
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/*
388c2ecf20Sopenharmony_ci * HP Documentation referred in this file:
398c2ecf20Sopenharmony_ci * http://www.jlime.com/downloads/development/docs/jornada7xx/jornada720.txt
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* line 110 of HP's doc */
438c2ecf20Sopenharmony_ci#define TUCR_VAL	0x20000400
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci/* memory space (line 52 of HP's doc) */
468c2ecf20Sopenharmony_ci#define SA1111REGSTART	0x40000000
478c2ecf20Sopenharmony_ci#define SA1111REGLEN	0x00002000
488c2ecf20Sopenharmony_ci#define EPSONREGSTART	0x48000000
498c2ecf20Sopenharmony_ci#define EPSONREGLEN	0x00100000
508c2ecf20Sopenharmony_ci#define EPSONFBSTART	0x48200000
518c2ecf20Sopenharmony_ci/* 512kB framebuffer */
528c2ecf20Sopenharmony_ci#define EPSONFBLEN	512*1024
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_cistatic struct s1d13xxxfb_regval s1d13xxxfb_initregs[] = {
558c2ecf20Sopenharmony_ci	/* line 344 of HP's doc */
568c2ecf20Sopenharmony_ci	{0x0001,0x00},	// Miscellaneous Register
578c2ecf20Sopenharmony_ci	{0x01FC,0x00},	// Display Mode Register
588c2ecf20Sopenharmony_ci	{0x0004,0x00},	// General IO Pins Configuration Register 0
598c2ecf20Sopenharmony_ci	{0x0005,0x00},	// General IO Pins Configuration Register 1
608c2ecf20Sopenharmony_ci	{0x0008,0x00},	// General IO Pins Control Register 0
618c2ecf20Sopenharmony_ci	{0x0009,0x00},	// General IO Pins Control Register 1
628c2ecf20Sopenharmony_ci	{0x0010,0x01},	// Memory Clock Configuration Register
638c2ecf20Sopenharmony_ci	{0x0014,0x11},	// LCD Pixel Clock Configuration Register
648c2ecf20Sopenharmony_ci	{0x0018,0x01},	// CRT/TV Pixel Clock Configuration Register
658c2ecf20Sopenharmony_ci	{0x001C,0x01},	// MediaPlug Clock Configuration Register
668c2ecf20Sopenharmony_ci	{0x001E,0x01},	// CPU To Memory Wait State Select Register
678c2ecf20Sopenharmony_ci	{0x0020,0x00},	// Memory Configuration Register
688c2ecf20Sopenharmony_ci	{0x0021,0x45},	// DRAM Refresh Rate Register
698c2ecf20Sopenharmony_ci	{0x002A,0x01},	// DRAM Timings Control Register 0
708c2ecf20Sopenharmony_ci	{0x002B,0x03},	// DRAM Timings Control Register 1
718c2ecf20Sopenharmony_ci	{0x0030,0x1c},	// Panel Type Register
728c2ecf20Sopenharmony_ci	{0x0031,0x00},	// MOD Rate Register
738c2ecf20Sopenharmony_ci	{0x0032,0x4F},	// LCD Horizontal Display Width Register
748c2ecf20Sopenharmony_ci	{0x0034,0x07},	// LCD Horizontal Non-Display Period Register
758c2ecf20Sopenharmony_ci	{0x0035,0x01},	// TFT FPLINE Start Position Register
768c2ecf20Sopenharmony_ci	{0x0036,0x0B},	// TFT FPLINE Pulse Width Register
778c2ecf20Sopenharmony_ci	{0x0038,0xEF},	// LCD Vertical Display Height Register 0
788c2ecf20Sopenharmony_ci	{0x0039,0x00},	// LCD Vertical Display Height Register 1
798c2ecf20Sopenharmony_ci	{0x003A,0x13},	// LCD Vertical Non-Display Period Register
808c2ecf20Sopenharmony_ci	{0x003B,0x0B},	// TFT FPFRAME Start Position Register
818c2ecf20Sopenharmony_ci	{0x003C,0x01},	// TFT FPFRAME Pulse Width Register
828c2ecf20Sopenharmony_ci	{0x0040,0x05},	// LCD Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
838c2ecf20Sopenharmony_ci	{0x0041,0x00},	// LCD Miscellaneous Register
848c2ecf20Sopenharmony_ci	{0x0042,0x00},	// LCD Display Start Address Register 0
858c2ecf20Sopenharmony_ci	{0x0043,0x00},	// LCD Display Start Address Register 1
868c2ecf20Sopenharmony_ci	{0x0044,0x00},	// LCD Display Start Address Register 2
878c2ecf20Sopenharmony_ci	{0x0046,0x80},	// LCD Memory Address Offset Register 0
888c2ecf20Sopenharmony_ci	{0x0047,0x02},	// LCD Memory Address Offset Register 1
898c2ecf20Sopenharmony_ci	{0x0048,0x00},	// LCD Pixel Panning Register
908c2ecf20Sopenharmony_ci	{0x004A,0x00},	// LCD Display FIFO High Threshold Control Register
918c2ecf20Sopenharmony_ci	{0x004B,0x00},	// LCD Display FIFO Low Threshold Control Register
928c2ecf20Sopenharmony_ci	{0x0050,0x4F},	// CRT/TV Horizontal Display Width Register
938c2ecf20Sopenharmony_ci	{0x0052,0x13},	// CRT/TV Horizontal Non-Display Period Register
948c2ecf20Sopenharmony_ci	{0x0053,0x01},	// CRT/TV HRTC Start Position Register
958c2ecf20Sopenharmony_ci	{0x0054,0x0B},	// CRT/TV HRTC Pulse Width Register
968c2ecf20Sopenharmony_ci	{0x0056,0xDF},	// CRT/TV Vertical Display Height Register 0
978c2ecf20Sopenharmony_ci	{0x0057,0x01},	// CRT/TV Vertical Display Height Register 1
988c2ecf20Sopenharmony_ci	{0x0058,0x2B},	// CRT/TV Vertical Non-Display Period Register
998c2ecf20Sopenharmony_ci	{0x0059,0x09},	// CRT/TV VRTC Start Position Register
1008c2ecf20Sopenharmony_ci	{0x005A,0x01},	// CRT/TV VRTC Pulse Width Register
1018c2ecf20Sopenharmony_ci	{0x005B,0x10},	// TV Output Control Register
1028c2ecf20Sopenharmony_ci	{0x0060,0x03},	// CRT/TV Display Mode Register (2:4bpp,3:8bpp,5:16bpp)
1038c2ecf20Sopenharmony_ci	{0x0062,0x00},	// CRT/TV Display Start Address Register 0
1048c2ecf20Sopenharmony_ci	{0x0063,0x00},	// CRT/TV Display Start Address Register 1
1058c2ecf20Sopenharmony_ci	{0x0064,0x00},	// CRT/TV Display Start Address Register 2
1068c2ecf20Sopenharmony_ci	{0x0066,0x40},	// CRT/TV Memory Address Offset Register 0
1078c2ecf20Sopenharmony_ci	{0x0067,0x01},	// CRT/TV Memory Address Offset Register 1
1088c2ecf20Sopenharmony_ci	{0x0068,0x00},	// CRT/TV Pixel Panning Register
1098c2ecf20Sopenharmony_ci	{0x006A,0x00},	// CRT/TV Display FIFO High Threshold Control Register
1108c2ecf20Sopenharmony_ci	{0x006B,0x00},	// CRT/TV Display FIFO Low Threshold Control Register
1118c2ecf20Sopenharmony_ci	{0x0070,0x00},	// LCD Ink/Cursor Control Register
1128c2ecf20Sopenharmony_ci	{0x0071,0x01},	// LCD Ink/Cursor Start Address Register
1138c2ecf20Sopenharmony_ci	{0x0072,0x00},	// LCD Cursor X Position Register 0
1148c2ecf20Sopenharmony_ci	{0x0073,0x00},	// LCD Cursor X Position Register 1
1158c2ecf20Sopenharmony_ci	{0x0074,0x00},	// LCD Cursor Y Position Register 0
1168c2ecf20Sopenharmony_ci	{0x0075,0x00},	// LCD Cursor Y Position Register 1
1178c2ecf20Sopenharmony_ci	{0x0076,0x00},	// LCD Ink/Cursor Blue Color 0 Register
1188c2ecf20Sopenharmony_ci	{0x0077,0x00},	// LCD Ink/Cursor Green Color 0 Register
1198c2ecf20Sopenharmony_ci	{0x0078,0x00},	// LCD Ink/Cursor Red Color 0 Register
1208c2ecf20Sopenharmony_ci	{0x007A,0x1F},	// LCD Ink/Cursor Blue Color 1 Register
1218c2ecf20Sopenharmony_ci	{0x007B,0x3F},	// LCD Ink/Cursor Green Color 1 Register
1228c2ecf20Sopenharmony_ci	{0x007C,0x1F},	// LCD Ink/Cursor Red Color 1 Register
1238c2ecf20Sopenharmony_ci	{0x007E,0x00},	// LCD Ink/Cursor FIFO Threshold Register
1248c2ecf20Sopenharmony_ci	{0x0080,0x00},	// CRT/TV Ink/Cursor Control Register
1258c2ecf20Sopenharmony_ci	{0x0081,0x01},	// CRT/TV Ink/Cursor Start Address Register
1268c2ecf20Sopenharmony_ci	{0x0082,0x00},	// CRT/TV Cursor X Position Register 0
1278c2ecf20Sopenharmony_ci	{0x0083,0x00},	// CRT/TV Cursor X Position Register 1
1288c2ecf20Sopenharmony_ci	{0x0084,0x00},	// CRT/TV Cursor Y Position Register 0
1298c2ecf20Sopenharmony_ci	{0x0085,0x00},	// CRT/TV Cursor Y Position Register 1
1308c2ecf20Sopenharmony_ci	{0x0086,0x00},	// CRT/TV Ink/Cursor Blue Color 0 Register
1318c2ecf20Sopenharmony_ci	{0x0087,0x00},	// CRT/TV Ink/Cursor Green Color 0 Register
1328c2ecf20Sopenharmony_ci	{0x0088,0x00},	// CRT/TV Ink/Cursor Red Color 0 Register
1338c2ecf20Sopenharmony_ci	{0x008A,0x1F},	// CRT/TV Ink/Cursor Blue Color 1 Register
1348c2ecf20Sopenharmony_ci	{0x008B,0x3F},	// CRT/TV Ink/Cursor Green Color 1 Register
1358c2ecf20Sopenharmony_ci	{0x008C,0x1F},	// CRT/TV Ink/Cursor Red Color 1 Register
1368c2ecf20Sopenharmony_ci	{0x008E,0x00},	// CRT/TV Ink/Cursor FIFO Threshold Register
1378c2ecf20Sopenharmony_ci	{0x0100,0x00},	// BitBlt Control Register 0
1388c2ecf20Sopenharmony_ci	{0x0101,0x00},	// BitBlt Control Register 1
1398c2ecf20Sopenharmony_ci	{0x0102,0x00},	// BitBlt ROP Code/Color Expansion Register
1408c2ecf20Sopenharmony_ci	{0x0103,0x00},	// BitBlt Operation Register
1418c2ecf20Sopenharmony_ci	{0x0104,0x00},	// BitBlt Source Start Address Register 0
1428c2ecf20Sopenharmony_ci	{0x0105,0x00},	// BitBlt Source Start Address Register 1
1438c2ecf20Sopenharmony_ci	{0x0106,0x00},	// BitBlt Source Start Address Register 2
1448c2ecf20Sopenharmony_ci	{0x0108,0x00},	// BitBlt Destination Start Address Register 0
1458c2ecf20Sopenharmony_ci	{0x0109,0x00},	// BitBlt Destination Start Address Register 1
1468c2ecf20Sopenharmony_ci	{0x010A,0x00},	// BitBlt Destination Start Address Register 2
1478c2ecf20Sopenharmony_ci	{0x010C,0x00},	// BitBlt Memory Address Offset Register 0
1488c2ecf20Sopenharmony_ci	{0x010D,0x00},	// BitBlt Memory Address Offset Register 1
1498c2ecf20Sopenharmony_ci	{0x0110,0x00},	// BitBlt Width Register 0
1508c2ecf20Sopenharmony_ci	{0x0111,0x00},	// BitBlt Width Register 1
1518c2ecf20Sopenharmony_ci	{0x0112,0x00},	// BitBlt Height Register 0
1528c2ecf20Sopenharmony_ci	{0x0113,0x00},	// BitBlt Height Register 1
1538c2ecf20Sopenharmony_ci	{0x0114,0x00},	// BitBlt Background Color Register 0
1548c2ecf20Sopenharmony_ci	{0x0115,0x00},	// BitBlt Background Color Register 1
1558c2ecf20Sopenharmony_ci	{0x0118,0x00},	// BitBlt Foreground Color Register 0
1568c2ecf20Sopenharmony_ci	{0x0119,0x00},	// BitBlt Foreground Color Register 1
1578c2ecf20Sopenharmony_ci	{0x01E0,0x00},	// Look-Up Table Mode Register
1588c2ecf20Sopenharmony_ci	{0x01E2,0x00},	// Look-Up Table Address Register
1598c2ecf20Sopenharmony_ci	/* not sure, wouldn't like to mess with the driver */
1608c2ecf20Sopenharmony_ci	{0x01E4,0x00},	// Look-Up Table Data Register
1618c2ecf20Sopenharmony_ci	/* jornada doc says 0x00, but I trust the driver */
1628c2ecf20Sopenharmony_ci	{0x01F0,0x10},	// Power Save Configuration Register
1638c2ecf20Sopenharmony_ci	{0x01F1,0x00},	// Power Save Status Register
1648c2ecf20Sopenharmony_ci	{0x01F4,0x00},	// CPU-to-Memory Access Watchdog Timer Register
1658c2ecf20Sopenharmony_ci	{0x01FC,0x01},	// Display Mode Register(0x01:LCD, 0x02:CRT, 0x03:LCD&CRT)
1668c2ecf20Sopenharmony_ci};
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_cistatic struct s1d13xxxfb_pdata s1d13xxxfb_data = {
1698c2ecf20Sopenharmony_ci	.initregs		= s1d13xxxfb_initregs,
1708c2ecf20Sopenharmony_ci	.initregssize		= ARRAY_SIZE(s1d13xxxfb_initregs),
1718c2ecf20Sopenharmony_ci	.platform_init_video	= NULL
1728c2ecf20Sopenharmony_ci};
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_cistatic struct resource s1d13xxxfb_resources[] = {
1758c2ecf20Sopenharmony_ci	[0] = DEFINE_RES_MEM(EPSONFBSTART, EPSONFBLEN),
1768c2ecf20Sopenharmony_ci	[1] = DEFINE_RES_MEM(EPSONREGSTART, EPSONREGLEN),
1778c2ecf20Sopenharmony_ci};
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_cistatic struct platform_device s1d13xxxfb_device = {
1808c2ecf20Sopenharmony_ci	.name		= S1D_DEVICENAME,
1818c2ecf20Sopenharmony_ci	.id		= 0,
1828c2ecf20Sopenharmony_ci	.dev		= {
1838c2ecf20Sopenharmony_ci		.platform_data	= &s1d13xxxfb_data,
1848c2ecf20Sopenharmony_ci	},
1858c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(s1d13xxxfb_resources),
1868c2ecf20Sopenharmony_ci	.resource	= s1d13xxxfb_resources,
1878c2ecf20Sopenharmony_ci};
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table jornada_pcmcia_gpiod_table = {
1908c2ecf20Sopenharmony_ci	.dev_id = "1800",
1918c2ecf20Sopenharmony_ci	.table = {
1928c2ecf20Sopenharmony_ci		GPIO_LOOKUP("sa1111", 0, "s0-power", GPIO_ACTIVE_HIGH),
1938c2ecf20Sopenharmony_ci		GPIO_LOOKUP("sa1111", 1, "s1-power", GPIO_ACTIVE_HIGH),
1948c2ecf20Sopenharmony_ci		GPIO_LOOKUP("sa1111", 2, "s0-3v", GPIO_ACTIVE_HIGH),
1958c2ecf20Sopenharmony_ci		GPIO_LOOKUP("sa1111", 3, "s1-3v", GPIO_ACTIVE_HIGH),
1968c2ecf20Sopenharmony_ci		{ },
1978c2ecf20Sopenharmony_ci	},
1988c2ecf20Sopenharmony_ci};
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_cistatic struct resource sa1111_resources[] = {
2018c2ecf20Sopenharmony_ci	[0] = DEFINE_RES_MEM(SA1111REGSTART, SA1111REGLEN),
2028c2ecf20Sopenharmony_ci	[1] = DEFINE_RES_IRQ(IRQ_GPIO1),
2038c2ecf20Sopenharmony_ci};
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_cistatic struct sa1111_platform_data sa1111_info = {
2068c2ecf20Sopenharmony_ci	.disable_devs	= SA1111_DEVID_PS2_MSE,
2078c2ecf20Sopenharmony_ci};
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_cistatic u64 sa1111_dmamask = 0xffffffffUL;
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_cistatic struct platform_device sa1111_device = {
2128c2ecf20Sopenharmony_ci	.name		= "sa1111",
2138c2ecf20Sopenharmony_ci	.id		= 0,
2148c2ecf20Sopenharmony_ci	.dev		= {
2158c2ecf20Sopenharmony_ci		.dma_mask = &sa1111_dmamask,
2168c2ecf20Sopenharmony_ci		.coherent_dma_mask = 0xffffffff,
2178c2ecf20Sopenharmony_ci		.platform_data = &sa1111_info,
2188c2ecf20Sopenharmony_ci	},
2198c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(sa1111_resources),
2208c2ecf20Sopenharmony_ci	.resource	= sa1111_resources,
2218c2ecf20Sopenharmony_ci};
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_cistatic struct platform_device jornada_ssp_device = {
2248c2ecf20Sopenharmony_ci	.name           = "jornada_ssp",
2258c2ecf20Sopenharmony_ci	.id             = -1,
2268c2ecf20Sopenharmony_ci};
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_cistatic struct resource jornada_kbd_resources[] = {
2298c2ecf20Sopenharmony_ci	DEFINE_RES_IRQ(IRQ_GPIO0),
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistatic struct platform_device jornada_kbd_device = {
2338c2ecf20Sopenharmony_ci	.name		= "jornada720_kbd",
2348c2ecf20Sopenharmony_ci	.id		= -1,
2358c2ecf20Sopenharmony_ci	.num_resources	= ARRAY_SIZE(jornada_kbd_resources),
2368c2ecf20Sopenharmony_ci	.resource	= jornada_kbd_resources,
2378c2ecf20Sopenharmony_ci};
2388c2ecf20Sopenharmony_ci
2398c2ecf20Sopenharmony_cistatic struct gpiod_lookup_table jornada_ts_gpiod_table = {
2408c2ecf20Sopenharmony_ci	.dev_id		= "jornada_ts",
2418c2ecf20Sopenharmony_ci	.table		= {
2428c2ecf20Sopenharmony_ci		GPIO_LOOKUP("gpio", 9, "penup", GPIO_ACTIVE_HIGH),
2438c2ecf20Sopenharmony_ci	},
2448c2ecf20Sopenharmony_ci};
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_cistatic struct platform_device jornada_ts_device = {
2478c2ecf20Sopenharmony_ci	.name		= "jornada_ts",
2488c2ecf20Sopenharmony_ci	.id		= -1,
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistatic struct platform_device *devices[] __initdata = {
2528c2ecf20Sopenharmony_ci	&sa1111_device,
2538c2ecf20Sopenharmony_ci	&jornada_ssp_device,
2548c2ecf20Sopenharmony_ci	&s1d13xxxfb_device,
2558c2ecf20Sopenharmony_ci	&jornada_kbd_device,
2568c2ecf20Sopenharmony_ci	&jornada_ts_device,
2578c2ecf20Sopenharmony_ci};
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistatic int __init jornada720_init(void)
2608c2ecf20Sopenharmony_ci{
2618c2ecf20Sopenharmony_ci	int ret = -ENODEV;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	if (machine_is_jornada720()) {
2648c2ecf20Sopenharmony_ci		/* we want to use gpio20 as input to drive the clock of our uart 3 */
2658c2ecf20Sopenharmony_ci		GPDR |= GPIO_GPIO20;	/* Clear gpio20 pin as input */
2668c2ecf20Sopenharmony_ci		TUCR = TUCR_VAL;
2678c2ecf20Sopenharmony_ci		GPSR = GPIO_GPIO20;	/* start gpio20 pin */
2688c2ecf20Sopenharmony_ci		udelay(1);
2698c2ecf20Sopenharmony_ci		GPCR = GPIO_GPIO20;	/* stop gpio20 */
2708c2ecf20Sopenharmony_ci		udelay(1);
2718c2ecf20Sopenharmony_ci		GPSR = GPIO_GPIO20;	/* restart gpio20 */
2728c2ecf20Sopenharmony_ci		udelay(20);		/* give it some time to restart */
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci		gpiod_add_lookup_table(&jornada_ts_gpiod_table);
2758c2ecf20Sopenharmony_ci		gpiod_add_lookup_table(&jornada_pcmcia_gpiod_table);
2768c2ecf20Sopenharmony_ci
2778c2ecf20Sopenharmony_ci		ret = platform_add_devices(devices, ARRAY_SIZE(devices));
2788c2ecf20Sopenharmony_ci	}
2798c2ecf20Sopenharmony_ci
2808c2ecf20Sopenharmony_ci	return ret;
2818c2ecf20Sopenharmony_ci}
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ciarch_initcall(jornada720_init);
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_cistatic struct map_desc jornada720_io_desc[] __initdata = {
2868c2ecf20Sopenharmony_ci	{	/* Epson registers */
2878c2ecf20Sopenharmony_ci		.virtual	= 0xf0000000,
2888c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(EPSONREGSTART),
2898c2ecf20Sopenharmony_ci		.length		= EPSONREGLEN,
2908c2ecf20Sopenharmony_ci		.type		= MT_DEVICE
2918c2ecf20Sopenharmony_ci	}, {	/* Epson frame buffer */
2928c2ecf20Sopenharmony_ci		.virtual	= 0xf1000000,
2938c2ecf20Sopenharmony_ci		.pfn		= __phys_to_pfn(EPSONFBSTART),
2948c2ecf20Sopenharmony_ci		.length		= EPSONFBLEN,
2958c2ecf20Sopenharmony_ci		.type		= MT_DEVICE
2968c2ecf20Sopenharmony_ci	}
2978c2ecf20Sopenharmony_ci};
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cistatic void __init jornada720_map_io(void)
3008c2ecf20Sopenharmony_ci{
3018c2ecf20Sopenharmony_ci	sa1100_map_io();
3028c2ecf20Sopenharmony_ci	iotable_init(jornada720_io_desc, ARRAY_SIZE(jornada720_io_desc));
3038c2ecf20Sopenharmony_ci
3048c2ecf20Sopenharmony_ci	sa1100_register_uart(0, 3);
3058c2ecf20Sopenharmony_ci	sa1100_register_uart(1, 1);
3068c2ecf20Sopenharmony_ci}
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_cistatic struct mtd_partition jornada720_partitions[] = {
3098c2ecf20Sopenharmony_ci	{
3108c2ecf20Sopenharmony_ci		.name		= "JORNADA720 boot firmware",
3118c2ecf20Sopenharmony_ci		.size		= 0x00040000,
3128c2ecf20Sopenharmony_ci		.offset		= 0,
3138c2ecf20Sopenharmony_ci		.mask_flags	= MTD_WRITEABLE, /* force read-only */
3148c2ecf20Sopenharmony_ci	}, {
3158c2ecf20Sopenharmony_ci		.name		= "JORNADA720 kernel",
3168c2ecf20Sopenharmony_ci		.size		= 0x000c0000,
3178c2ecf20Sopenharmony_ci		.offset		= 0x00040000,
3188c2ecf20Sopenharmony_ci	}, {
3198c2ecf20Sopenharmony_ci		.name		= "JORNADA720 params",
3208c2ecf20Sopenharmony_ci		.size		= 0x00040000,
3218c2ecf20Sopenharmony_ci		.offset		= 0x00100000,
3228c2ecf20Sopenharmony_ci	}, {
3238c2ecf20Sopenharmony_ci		.name		= "JORNADA720 initrd",
3248c2ecf20Sopenharmony_ci		.size		= 0x00100000,
3258c2ecf20Sopenharmony_ci		.offset		= 0x00140000,
3268c2ecf20Sopenharmony_ci	}, {
3278c2ecf20Sopenharmony_ci		.name		= "JORNADA720 root cramfs",
3288c2ecf20Sopenharmony_ci		.size		= 0x00300000,
3298c2ecf20Sopenharmony_ci		.offset		= 0x00240000,
3308c2ecf20Sopenharmony_ci	}, {
3318c2ecf20Sopenharmony_ci		.name		= "JORNADA720 usr cramfs",
3328c2ecf20Sopenharmony_ci		.size		= 0x00800000,
3338c2ecf20Sopenharmony_ci		.offset		= 0x00540000,
3348c2ecf20Sopenharmony_ci	}, {
3358c2ecf20Sopenharmony_ci		.name		= "JORNADA720 usr local",
3368c2ecf20Sopenharmony_ci		.size		= 0, /* will expand to the end of the flash */
3378c2ecf20Sopenharmony_ci		.offset		= 0x00d00000,
3388c2ecf20Sopenharmony_ci	}
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_cistatic void jornada720_set_vpp(int vpp)
3428c2ecf20Sopenharmony_ci{
3438c2ecf20Sopenharmony_ci	if (vpp)
3448c2ecf20Sopenharmony_ci		/* enabling flash write (line 470 of HP's doc) */
3458c2ecf20Sopenharmony_ci		PPSR |= PPC_LDD7;
3468c2ecf20Sopenharmony_ci	else
3478c2ecf20Sopenharmony_ci		/* disabling flash write (line 470 of HP's doc) */
3488c2ecf20Sopenharmony_ci		PPSR &= ~PPC_LDD7;
3498c2ecf20Sopenharmony_ci	PPDR |= PPC_LDD7;
3508c2ecf20Sopenharmony_ci}
3518c2ecf20Sopenharmony_ci
3528c2ecf20Sopenharmony_cistatic struct flash_platform_data jornada720_flash_data = {
3538c2ecf20Sopenharmony_ci	.map_name	= "cfi_probe",
3548c2ecf20Sopenharmony_ci	.set_vpp	= jornada720_set_vpp,
3558c2ecf20Sopenharmony_ci	.parts		= jornada720_partitions,
3568c2ecf20Sopenharmony_ci	.nr_parts	= ARRAY_SIZE(jornada720_partitions),
3578c2ecf20Sopenharmony_ci};
3588c2ecf20Sopenharmony_ci
3598c2ecf20Sopenharmony_cistatic struct resource jornada720_flash_resource =
3608c2ecf20Sopenharmony_ci	DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M);
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_cistatic void __init jornada720_mach_init(void)
3638c2ecf20Sopenharmony_ci{
3648c2ecf20Sopenharmony_ci	sa11x0_register_mtd(&jornada720_flash_data, &jornada720_flash_resource, 1);
3658c2ecf20Sopenharmony_ci}
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ciMACHINE_START(JORNADA720, "HP Jornada 720")
3688c2ecf20Sopenharmony_ci	/* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */
3698c2ecf20Sopenharmony_ci	.atag_offset	= 0x100,
3708c2ecf20Sopenharmony_ci	.map_io		= jornada720_map_io,
3718c2ecf20Sopenharmony_ci	.nr_irqs	= SA1100_NR_IRQS,
3728c2ecf20Sopenharmony_ci	.init_irq	= sa1100_init_irq,
3738c2ecf20Sopenharmony_ci	.init_time	= sa1100_timer_init,
3748c2ecf20Sopenharmony_ci	.init_machine	= jornada720_mach_init,
3758c2ecf20Sopenharmony_ci	.init_late	= sa11x0_init_late,
3768c2ecf20Sopenharmony_ci#ifdef CONFIG_SA1111
3778c2ecf20Sopenharmony_ci	.dma_zone_size	= SZ_1M,
3788c2ecf20Sopenharmony_ci#endif
3798c2ecf20Sopenharmony_ci	.restart	= sa11x0_restart,
3808c2ecf20Sopenharmony_ciMACHINE_END
381