Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * linux/arch/arm/mach-omap1/board-palmz71.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Modified from board-generic.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Support for the Palm Zire71 PDA.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Original version : Laurent Gonzalez
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Modified for zire71 : Marek Vasut
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/mtd/mtd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/mtd/partitions.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/mtd/physmap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <linux/omapfb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <linux/spi/spi.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <linux/spi/ads7846.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <linux/platform_data/omap1_bl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include <asm/mach/map.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #include "flash.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #include <mach/mux.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/omap-dma.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <mach/tc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #include <linux/platform_data/keypad-omap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #include <mach/hardware.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #include <mach/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #include "common.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define PALMZ71_USBDETECT_GPIO	0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define PALMZ71_PENIRQ_GPIO	6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define PALMZ71_MMC_WP_GPIO	8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define PALMZ71_HDQ_GPIO 	11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define PALMZ71_HOTSYNC_GPIO	OMAP_MPUIO(1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define PALMZ71_CABLE_GPIO	OMAP_MPUIO(2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) #define PALMZ71_SLIDER_GPIO	OMAP_MPUIO(3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define PALMZ71_MMC_IN_GPIO	OMAP_MPUIO(4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) static const unsigned int palmz71_keymap[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	KEY(0, 0, KEY_F1),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	KEY(1, 0, KEY_F2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	KEY(2, 0, KEY_F3),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	KEY(3, 0, KEY_F4),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	KEY(4, 0, KEY_POWER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	KEY(0, 1, KEY_LEFT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	KEY(1, 1, KEY_DOWN),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	KEY(2, 1, KEY_UP),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	KEY(3, 1, KEY_RIGHT),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	KEY(4, 1, KEY_ENTER),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	KEY(0, 2, KEY_CAMERA),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) static const struct matrix_keymap_data palmz71_keymap_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	.keymap		= palmz71_keymap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	.keymap_size	= ARRAY_SIZE(palmz71_keymap),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) static struct omap_kp_platform_data palmz71_kp_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	.rows	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	.cols	= 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	.keymap_data	= &palmz71_keymap_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	.rep	= true,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	.delay	= 80,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) static struct resource palmz71_kp_resources[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		.start	= INT_KEYBOARD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		.end	= INT_KEYBOARD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		.flags	= IORESOURCE_IRQ,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) static struct platform_device palmz71_kp_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	.name	= "omap-keypad",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		.platform_data = &palmz71_kp_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	.num_resources	= ARRAY_SIZE(palmz71_kp_resources),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	.resource	= palmz71_kp_resources,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static struct mtd_partition palmz71_rom_partitions[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	/* PalmOS "Small ROM", contains the bootloader and the debugger */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		.name		= "smallrom",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		.offset		= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		.size		= 0xa000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		.mask_flags	= MTD_WRITEABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	/* PalmOS "Big ROM", a filesystem with all the OS code and data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		.name	= "bigrom",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		.offset	= SZ_128K,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		 * 0x5f0000 bytes big in the multi-language ("EFIGS") version,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		 * 0x7b0000 bytes in the English-only ("enUS") version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		.size		= 0x7b0000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		.mask_flags	= MTD_WRITEABLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) static struct physmap_flash_data palmz71_rom_data = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	.width		= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	.set_vpp	= omap1_set_vpp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	.parts		= palmz71_rom_partitions,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	.nr_parts	= ARRAY_SIZE(palmz71_rom_partitions),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static struct resource palmz71_rom_resource = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	.start	= OMAP_CS0_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	.end	= OMAP_CS0_PHYS + SZ_8M - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	.flags	= IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static struct platform_device palmz71_rom_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	.name	= "physmap-flash",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	.dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		.platform_data = &palmz71_rom_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	.num_resources	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	.resource	= &palmz71_rom_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static struct platform_device palmz71_lcd_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	.name	= "lcd_palmz71",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) static struct platform_device palmz71_spi_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	.name	= "spi_palmz71",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static struct omap_backlight_config palmz71_backlight_config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	.default_intensity	= 0xa0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static struct platform_device palmz71_backlight_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	.name	= "omap-bl",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 		.platform_data = &palmz71_backlight_config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static struct platform_device *devices[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	&palmz71_rom_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	&palmz71_kp_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	&palmz71_lcd_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	&palmz71_spi_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	&palmz71_backlight_device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) palmz71_get_pendown_state(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	return !gpio_get_value(PALMZ71_PENIRQ_GPIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) static const struct ads7846_platform_data palmz71_ts_info = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	.model			= 7846,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	.vref_delay_usecs	= 100,	/* internal, no capacitor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	.x_plate_ohms		= 419,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	.y_plate_ohms		= 486,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	.get_pendown_state	= palmz71_get_pendown_state,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) static struct spi_board_info __initdata palmz71_boardinfo[] = { {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	/* MicroWire (bus 2) CS0 has an ads7846e */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	.modalias	= "ads7846",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	.platform_data	= &palmz71_ts_info,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	.max_speed_hz	= 120000	/* max sample rate at 3V */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 				* 26	/* command + data + overhead */,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	.bus_num	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	.chip_select	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) } };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) static struct omap_usb_config palmz71_usb_config __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	.register_dev	= 1,	/* Mini-B only receptacle */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	.hmc_mode	= 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	.pins[0]	= 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static const struct omap_lcd_config palmz71_lcd_config __initconst = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	.ctrl_name = "internal",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) static irqreturn_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) palmz71_powercable(int irq, void *dev_id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	if (gpio_get_value(PALMZ71_USBDETECT_GPIO)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 		printk(KERN_INFO "PM: Power cable connected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 				 IRQ_TYPE_EDGE_FALLING);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 		printk(KERN_INFO "PM: Power cable disconnected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 		irq_set_irq_type(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 				 IRQ_TYPE_EDGE_RISING);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) static void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) omap_mpu_wdt_mode(int mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	if (mode)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 		omap_writew(0x8000, OMAP_WDT_TIMER_MODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 		omap_writew(0x00f5, OMAP_WDT_TIMER_MODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 		omap_writew(0x00a0, OMAP_WDT_TIMER_MODE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) palmz71_gpio_setup(int early)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	if (early) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 		/* Only set GPIO1 so we have a working serial */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		gpio_direction_output(1, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 		/* Set MMC/SD host WP pin as input */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		if (gpio_request(PALMZ71_MMC_WP_GPIO, "MMC WP") < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			printk(KERN_ERR "Could not reserve WP GPIO!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 		gpio_direction_input(PALMZ71_MMC_WP_GPIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 		/* Monitor the Power-cable-connected signal */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 		if (gpio_request(PALMZ71_USBDETECT_GPIO, "USB detect") < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 			printk(KERN_ERR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 				"Could not reserve cable signal GPIO!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 			return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 		gpio_direction_input(PALMZ71_USBDETECT_GPIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 		if (request_irq(gpio_to_irq(PALMZ71_USBDETECT_GPIO),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 				palmz71_powercable, 0, "palmz71-cable", NULL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 			printk(KERN_ERR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 					"IRQ request for power cable failed!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 		palmz71_powercable(gpio_to_irq(PALMZ71_USBDETECT_GPIO), NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) static void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) omap_palmz71_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	/* mux pins for uarts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	omap_cfg_reg(UART1_TX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 	omap_cfg_reg(UART1_RTS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	omap_cfg_reg(UART2_TX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 	omap_cfg_reg(UART2_RTS);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	omap_cfg_reg(UART3_TX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 	omap_cfg_reg(UART3_RX);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 	palmz71_gpio_setup(1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 	omap_mpu_wdt_mode(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 	platform_add_devices(devices, ARRAY_SIZE(devices));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 	palmz71_boardinfo[0].irq = gpio_to_irq(PALMZ71_PENIRQ_GPIO);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	spi_register_board_info(palmz71_boardinfo,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 				ARRAY_SIZE(palmz71_boardinfo));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	omap1_usb_init(&palmz71_usb_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	omap_serial_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 	omap_register_i2c_bus(1, 100, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 	palmz71_gpio_setup(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 	omapfb_set_lcd_config(&palmz71_lcd_config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 	.atag_offset	= 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 	.map_io		= omap15xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	.init_early     = omap1_init_early,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	.init_irq	= omap1_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 	.handle_irq	= omap1_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	.init_machine	= omap_palmz71_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 	.init_late	= omap1_init_late,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 	.init_time	= omap1_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 	.restart	= omap1_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) MACHINE_END