Thomas Gleixner | d2912cb | 2019-06-04 10:11:33 +0200 | [diff] [blame^] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Hardware definitions for Palm Zire72 |
| 4 | * |
| 5 | * Authors: |
| 6 | * Vladimir "Farcaller" Pouzanov <farcaller@gmail.com> |
| 7 | * Sergey Lapin <slapin@ossfans.org> |
| 8 | * Alex Osborne <bobofdoom@gmail.com> |
| 9 | * Jan Herman <2hp@seznam.cz> |
| 10 | * |
| 11 | * Rewrite for mainline: |
| 12 | * Marek Vasut <marek.vasut@gmail.com> |
| 13 | * |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 14 | * (find more info at www.hackndev.com) |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <linux/platform_device.h> |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 18 | #include <linux/syscore_ops.h> |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 19 | #include <linux/delay.h> |
| 20 | #include <linux/irq.h> |
| 21 | #include <linux/gpio_keys.h> |
| 22 | #include <linux/input.h> |
| 23 | #include <linux/pda_power.h> |
| 24 | #include <linux/pwm_backlight.h> |
| 25 | #include <linux/gpio.h> |
Marek Vasut | 241cf47 | 2010-06-04 03:07:33 +0200 | [diff] [blame] | 26 | #include <linux/wm97xx.h> |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 27 | #include <linux/power_supply.h> |
Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 28 | #include <linux/usb/gpio_vbus.h> |
Wolfram Sang | 1e9d421 | 2018-04-19 22:00:07 +0200 | [diff] [blame] | 29 | #include <linux/platform_data/i2c-gpio.h> |
Linus Walleij | b2e6355 | 2017-09-10 01:30:46 +0200 | [diff] [blame] | 30 | #include <linux/gpio/machine.h> |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 31 | |
| 32 | #include <asm/mach-types.h> |
Russell King | 2c74a0c | 2011-06-22 17:41:48 +0100 | [diff] [blame] | 33 | #include <asm/suspend.h> |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 34 | #include <asm/mach/arch.h> |
| 35 | #include <asm/mach/map.h> |
| 36 | |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 37 | #include "pxa27x.h" |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 38 | #include <mach/audio.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 39 | #include "palmz72.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 40 | #include <linux/platform_data/mmc-pxamci.h> |
| 41 | #include <linux/platform_data/video-pxafb.h> |
| 42 | #include <linux/platform_data/irda-pxaficp.h> |
| 43 | #include <linux/platform_data/keypad-pxa27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 44 | #include "udc.h" |
Arnd Bergmann | 293b2da | 2012-08-24 15:16:48 +0200 | [diff] [blame] | 45 | #include <linux/platform_data/asoc-palm27x.h> |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 46 | #include "palm27x.h" |
Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 47 | |
Arnd Bergmann | 4c25c5d | 2015-01-30 10:45:33 +0100 | [diff] [blame] | 48 | #include "pm.h" |
Mauro Carvalho Chehab | a71daaa | 2015-11-17 07:11:13 -0200 | [diff] [blame] | 49 | #include <linux/platform_data/media/camera-pxa.h> |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 50 | |
| 51 | #include <media/soc_camera.h> |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 52 | |
| 53 | #include "generic.h" |
| 54 | #include "devices.h" |
| 55 | |
| 56 | /****************************************************************************** |
| 57 | * Pin configuration |
| 58 | ******************************************************************************/ |
| 59 | static unsigned long palmz72_pin_config[] __initdata = { |
| 60 | /* MMC */ |
| 61 | GPIO32_MMC_CLK, |
| 62 | GPIO92_MMC_DAT_0, |
| 63 | GPIO109_MMC_DAT_1, |
| 64 | GPIO110_MMC_DAT_2, |
| 65 | GPIO111_MMC_DAT_3, |
| 66 | GPIO112_MMC_CMD, |
| 67 | GPIO14_GPIO, /* SD detect */ |
| 68 | GPIO115_GPIO, /* SD RO */ |
| 69 | GPIO98_GPIO, /* SD power */ |
| 70 | |
| 71 | /* AC97 */ |
| 72 | GPIO28_AC97_BITCLK, |
| 73 | GPIO29_AC97_SDATA_IN_0, |
| 74 | GPIO30_AC97_SDATA_OUT, |
| 75 | GPIO31_AC97_SYNC, |
Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 76 | GPIO89_AC97_SYSCLK, |
| 77 | GPIO113_AC97_nRESET, |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 78 | |
| 79 | /* IrDA */ |
| 80 | GPIO49_GPIO, /* ir disable */ |
| 81 | GPIO46_FICP_RXD, |
| 82 | GPIO47_FICP_TXD, |
| 83 | |
| 84 | /* PWM */ |
| 85 | GPIO16_PWM0_OUT, |
| 86 | |
| 87 | /* USB */ |
| 88 | GPIO15_GPIO, /* usb detect */ |
Marek Vasut | eb73e62 | 2009-06-01 22:34:14 +0200 | [diff] [blame] | 89 | GPIO95_GPIO, /* usb pullup */ |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 90 | |
| 91 | /* Matrix keypad */ |
| 92 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
| 93 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
| 94 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
| 95 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
| 96 | GPIO103_KP_MKOUT_0, |
| 97 | GPIO104_KP_MKOUT_1, |
| 98 | GPIO105_KP_MKOUT_2, |
| 99 | |
| 100 | /* LCD */ |
Eric Miao | bedbda9 | 2010-01-04 11:37:14 +0800 | [diff] [blame] | 101 | GPIOxx_LCD_TFT_16BPP, |
| 102 | |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 103 | GPIO20_GPIO, /* bl power */ |
| 104 | GPIO21_GPIO, /* LCD border switch */ |
| 105 | GPIO22_GPIO, /* LCD border color */ |
| 106 | GPIO96_GPIO, /* lcd power */ |
| 107 | |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 108 | /* PXA Camera */ |
| 109 | GPIO81_CIF_DD_0, |
| 110 | GPIO48_CIF_DD_5, |
| 111 | GPIO50_CIF_DD_3, |
| 112 | GPIO51_CIF_DD_2, |
| 113 | GPIO52_CIF_DD_4, |
| 114 | GPIO53_CIF_MCLK, |
| 115 | GPIO54_CIF_PCLK, |
| 116 | GPIO55_CIF_DD_1, |
| 117 | GPIO84_CIF_FV, |
| 118 | GPIO85_CIF_LV, |
| 119 | GPIO93_CIF_DD_6, |
| 120 | GPIO108_CIF_DD_7, |
| 121 | |
| 122 | GPIO56_GPIO, /* OV9640 Powerdown */ |
| 123 | GPIO57_GPIO, /* OV9640 Reset */ |
| 124 | GPIO91_GPIO, /* OV9640 Power */ |
| 125 | |
| 126 | /* I2C */ |
| 127 | GPIO117_GPIO, /* I2C_SCL */ |
| 128 | GPIO118_GPIO, /* I2C_SDA */ |
| 129 | |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 130 | /* Misc. */ |
| 131 | GPIO0_GPIO | WAKEUP_ON_LEVEL_HIGH, /* power detect */ |
| 132 | GPIO88_GPIO, /* green led */ |
| 133 | GPIO27_GPIO, /* WM9712 IRQ */ |
| 134 | }; |
| 135 | |
| 136 | /****************************************************************************** |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 137 | * GPIO keyboard |
| 138 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 139 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 140 | static const unsigned int palmz72_matrix_keys[] = { |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 141 | KEY(0, 0, KEY_POWER), |
| 142 | KEY(0, 1, KEY_F1), |
| 143 | KEY(0, 2, KEY_ENTER), |
| 144 | |
| 145 | KEY(1, 0, KEY_F2), |
| 146 | KEY(1, 1, KEY_F3), |
| 147 | KEY(1, 2, KEY_F4), |
| 148 | |
| 149 | KEY(2, 0, KEY_UP), |
| 150 | KEY(2, 2, KEY_DOWN), |
| 151 | |
| 152 | KEY(3, 0, KEY_RIGHT), |
| 153 | KEY(3, 2, KEY_LEFT), |
| 154 | }; |
| 155 | |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 156 | static struct matrix_keymap_data almz72_matrix_keymap_data = { |
| 157 | .keymap = palmz72_matrix_keys, |
| 158 | .keymap_size = ARRAY_SIZE(palmz72_matrix_keys), |
| 159 | }; |
| 160 | |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 161 | static struct pxa27x_keypad_platform_data palmz72_keypad_platform_data = { |
| 162 | .matrix_key_rows = 4, |
| 163 | .matrix_key_cols = 3, |
Chao Xie | 0a085a9 | 2013-05-05 20:24:58 -0700 | [diff] [blame] | 164 | .matrix_keymap_data = &almz72_matrix_keymap_data, |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 165 | |
| 166 | .debounce_interval = 30, |
| 167 | }; |
| 168 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 169 | static void __init palmz72_kpc_init(void) |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 170 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 171 | pxa_set_keypad_info(&palmz72_keypad_platform_data); |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 172 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 173 | #else |
| 174 | static inline void palmz72_kpc_init(void) {} |
| 175 | #endif |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 176 | |
| 177 | /****************************************************************************** |
| 178 | * LEDs |
| 179 | ******************************************************************************/ |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 180 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 181 | static struct gpio_led gpio_leds[] = { |
| 182 | { |
| 183 | .name = "palmz72:green:led", |
| 184 | .default_trigger = "none", |
| 185 | .gpio = GPIO_NR_PALMZ72_LED_GREEN, |
| 186 | }, |
| 187 | }; |
| 188 | |
| 189 | static struct gpio_led_platform_data gpio_led_info = { |
| 190 | .leds = gpio_leds, |
| 191 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 192 | }; |
| 193 | |
| 194 | static struct platform_device palmz72_leds = { |
| 195 | .name = "leds-gpio", |
| 196 | .id = -1, |
| 197 | .dev = { |
| 198 | .platform_data = &gpio_led_info, |
| 199 | } |
| 200 | }; |
| 201 | |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 202 | static void __init palmz72_leds_init(void) |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 203 | { |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 204 | platform_device_register(&palmz72_leds); |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 205 | } |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 206 | #else |
| 207 | static inline void palmz72_leds_init(void) {} |
| 208 | #endif |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 209 | |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 210 | #ifdef CONFIG_PM |
| 211 | |
| 212 | /* We have some black magic here |
| 213 | * PalmOS ROM on recover expects special struct physical address |
| 214 | * to be transferred via PSPR. Using this struct PalmOS restores |
| 215 | * its state after sleep. As for Linux, we need to setup it the |
| 216 | * same way. More than that, PalmOS ROM changes some values in memory. |
| 217 | * For now only one location is found, which needs special treatment. |
| 218 | * Thanks to Alex Osborne, Andrzej Zaborowski, and lots of other people |
| 219 | * for reading backtraces for me :) |
| 220 | */ |
| 221 | |
| 222 | #define PALMZ72_SAVE_DWORD ((unsigned long *)0xc0000050) |
| 223 | |
| 224 | static struct palmz72_resume_info palmz72_resume_info = { |
| 225 | .magic0 = 0xb4e6, |
| 226 | .magic1 = 1, |
| 227 | |
| 228 | /* reset state, MMU off etc */ |
| 229 | .arm_control = 0, |
| 230 | .aux_control = 0, |
| 231 | .ttb = 0, |
| 232 | .domain_access = 0, |
| 233 | .process_id = 0, |
| 234 | }; |
| 235 | |
| 236 | static unsigned long store_ptr; |
| 237 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 238 | /* syscore_ops for Palm Zire 72 PM */ |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 239 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 240 | static int palmz72_pm_suspend(void) |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 241 | { |
| 242 | /* setup the resume_info struct for the original bootloader */ |
Russell King | 4f5ad99 | 2011-02-06 17:41:26 +0000 | [diff] [blame] | 243 | palmz72_resume_info.resume_addr = (u32) cpu_resume; |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 244 | |
| 245 | /* Storing memory touched by ROM */ |
| 246 | store_ptr = *PALMZ72_SAVE_DWORD; |
| 247 | |
| 248 | /* Setting PSPR to a proper value */ |
Florian Fainelli | 64fc2a9 | 2017-01-15 03:59:29 +0100 | [diff] [blame] | 249 | PSPR = __pa_symbol(&palmz72_resume_info); |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 250 | |
| 251 | return 0; |
| 252 | } |
| 253 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 254 | static void palmz72_pm_resume(void) |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 255 | { |
| 256 | *PALMZ72_SAVE_DWORD = store_ptr; |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 257 | } |
| 258 | |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 259 | static struct syscore_ops palmz72_pm_syscore_ops = { |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 260 | .suspend = palmz72_pm_suspend, |
| 261 | .resume = palmz72_pm_resume, |
| 262 | }; |
| 263 | |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 264 | static int __init palmz72_pm_init(void) |
| 265 | { |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 266 | if (machine_is_palmz72()) { |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 267 | register_syscore_ops(&palmz72_pm_syscore_ops); |
| 268 | return 0; |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 269 | } |
Rafael J. Wysocki | 2eaa03b | 2011-04-22 22:03:11 +0200 | [diff] [blame] | 270 | return -ENODEV; |
Sergey Lapin | fda50a1 | 2008-08-29 15:53:24 +0100 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | device_initcall(palmz72_pm_init); |
| 274 | #endif |
| 275 | |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 276 | /****************************************************************************** |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 277 | * SoC Camera |
| 278 | ******************************************************************************/ |
| 279 | #if defined(CONFIG_SOC_CAMERA_OV9640) || \ |
| 280 | defined(CONFIG_SOC_CAMERA_OV9640_MODULE) |
| 281 | static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { |
| 282 | .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | |
| 283 | PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, |
| 284 | .mclk_10khz = 2600, |
| 285 | }; |
| 286 | |
| 287 | /* Board I2C devices. */ |
| 288 | static struct i2c_board_info palmz72_i2c_device[] = { |
| 289 | { |
| 290 | I2C_BOARD_INFO("ov9640", 0x30), |
| 291 | } |
| 292 | }; |
| 293 | |
| 294 | static int palmz72_camera_power(struct device *dev, int power) |
| 295 | { |
| 296 | gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); |
| 297 | mdelay(50); |
| 298 | return 0; |
| 299 | } |
| 300 | |
| 301 | static int palmz72_camera_reset(struct device *dev) |
| 302 | { |
| 303 | gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); |
| 304 | mdelay(50); |
| 305 | gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); |
| 306 | mdelay(50); |
| 307 | return 0; |
| 308 | } |
| 309 | |
| 310 | static struct soc_camera_link palmz72_iclink = { |
| 311 | .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ |
| 312 | .board_info = &palmz72_i2c_device[0], |
| 313 | .i2c_adapter_id = 0, |
| 314 | .module_name = "ov96xx", |
| 315 | .power = &palmz72_camera_power, |
| 316 | .reset = &palmz72_camera_reset, |
| 317 | .flags = SOCAM_DATAWIDTH_8, |
| 318 | }; |
| 319 | |
Linus Walleij | b2e6355 | 2017-09-10 01:30:46 +0200 | [diff] [blame] | 320 | static struct gpiod_lookup_table palmz72_i2c_gpiod_table = { |
Linus Walleij | f59c303 | 2018-05-26 18:37:34 +0200 | [diff] [blame] | 321 | .dev_id = "i2c-gpio.0", |
Linus Walleij | b2e6355 | 2017-09-10 01:30:46 +0200 | [diff] [blame] | 322 | .table = { |
Linus Walleij | 4d0ce62 | 2017-09-10 23:03:32 +0200 | [diff] [blame] | 323 | GPIO_LOOKUP_IDX("gpio-pxa", 118, NULL, 0, |
| 324 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
| 325 | GPIO_LOOKUP_IDX("gpio-pxa", 117, NULL, 1, |
| 326 | GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
Linus Walleij | b2e6355 | 2017-09-10 01:30:46 +0200 | [diff] [blame] | 327 | }, |
| 328 | }; |
| 329 | |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 330 | static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 331 | .udelay = 10, |
| 332 | .timeout = 100, |
| 333 | }; |
| 334 | |
| 335 | static struct platform_device palmz72_i2c_bus_device = { |
| 336 | .name = "i2c-gpio", |
| 337 | .id = 0, /* we use this as a replacement for i2c-pxa */ |
| 338 | .dev = { |
| 339 | .platform_data = &palmz72_i2c_bus_data, |
| 340 | } |
| 341 | }; |
| 342 | |
| 343 | static struct platform_device palmz72_camera = { |
| 344 | .name = "soc-camera-pdrv", |
| 345 | .id = -1, |
| 346 | .dev = { |
| 347 | .platform_data = &palmz72_iclink, |
| 348 | }, |
| 349 | }; |
| 350 | |
| 351 | /* Here we request the camera GPIOs and configure them. We power up the camera |
| 352 | * module, deassert the reset pin, but put it into powerdown (low to no power |
| 353 | * consumption) mode. This allows us to later bring the module up fast. */ |
| 354 | static struct gpio palmz72_camera_gpios[] = { |
| 355 | { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" }, |
| 356 | { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" }, |
| 357 | { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" }, |
| 358 | }; |
| 359 | |
| 360 | static inline void __init palmz72_cam_gpio_init(void) |
| 361 | { |
| 362 | int ret; |
| 363 | |
| 364 | ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); |
| 365 | if (!ret) |
| 366 | gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); |
| 367 | else |
| 368 | printk(KERN_ERR "Camera GPIO init failed!\n"); |
| 369 | |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | static void __init palmz72_camera_init(void) |
| 374 | { |
| 375 | palmz72_cam_gpio_init(); |
| 376 | pxa_set_camera_info(&palmz72_pxacamera_platform_data); |
Linus Walleij | b2e6355 | 2017-09-10 01:30:46 +0200 | [diff] [blame] | 377 | gpiod_add_lookup_table(&palmz72_i2c_gpiod_table); |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 378 | platform_device_register(&palmz72_i2c_bus_device); |
| 379 | platform_device_register(&palmz72_camera); |
| 380 | } |
| 381 | #else |
| 382 | static inline void palmz72_camera_init(void) {} |
| 383 | #endif |
| 384 | |
Linus Walleij | 58e2d87 | 2018-12-02 09:43:23 +0100 | [diff] [blame] | 385 | static struct gpiod_lookup_table palmz72_mci_gpio_table = { |
| 386 | .dev_id = "pxa2xx-mci.0", |
| 387 | .table = { |
| 388 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N, |
| 389 | "cd", GPIO_ACTIVE_LOW), |
| 390 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO, |
| 391 | "wp", GPIO_ACTIVE_LOW), |
Linus Walleij | f54005b | 2018-12-02 09:43:27 +0100 | [diff] [blame] | 392 | GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N, |
| 393 | "power", GPIO_ACTIVE_LOW), |
Linus Walleij | 58e2d87 | 2018-12-02 09:43:23 +0100 | [diff] [blame] | 394 | { }, |
| 395 | }, |
| 396 | }; |
| 397 | |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 398 | /****************************************************************************** |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 399 | * Machine init |
| 400 | ******************************************************************************/ |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 401 | static void __init palmz72_init(void) |
| 402 | { |
| 403 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmz72_pin_config)); |
Russell King | cc155c6 | 2009-11-09 13:34:08 +0800 | [diff] [blame] | 404 | pxa_set_ffuart_info(NULL); |
| 405 | pxa_set_btuart_info(NULL); |
| 406 | pxa_set_stuart_info(NULL); |
| 407 | |
Linus Walleij | f54005b | 2018-12-02 09:43:27 +0100 | [diff] [blame] | 408 | palm27x_mmc_init(&palmz72_mci_gpio_table); |
Marek Vasut | 31620e2 | 2010-07-13 08:16:45 +0200 | [diff] [blame] | 409 | palm27x_lcd_init(-1, &palm_320x320_lcd_mode); |
| 410 | palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, |
| 411 | GPIO_NR_PALMZ72_USB_PULLUP, 0); |
| 412 | palm27x_irda_init(GPIO_NR_PALMZ72_IR_DISABLE); |
| 413 | palm27x_ac97_init(PALMZ72_BAT_MIN_VOLTAGE, PALMZ72_BAT_MAX_VOLTAGE, |
| 414 | -1, 113); |
| 415 | palm27x_pwm_init(-1, -1); |
| 416 | palm27x_power_init(-1, -1); |
| 417 | palm27x_pmic_init(); |
| 418 | palmz72_kpc_init(); |
| 419 | palmz72_leds_init(); |
Marek Vasut | 54a93b6 | 2011-01-13 11:45:30 +0100 | [diff] [blame] | 420 | palmz72_camera_init(); |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 421 | } |
| 422 | |
| 423 | MACHINE_START(PALMZ72, "Palm Zire72") |
Nicolas Pitre | 7375aba | 2011-07-05 22:38:15 -0400 | [diff] [blame] | 424 | .atag_offset = 0x100, |
Marek Vasut | 851982c | 2010-10-11 02:20:19 +0200 | [diff] [blame] | 425 | .map_io = pxa27x_map_io, |
Rob Herring | 4e61109 | 2012-01-03 16:53:48 -0600 | [diff] [blame] | 426 | .nr_irqs = PXA_NR_IRQS, |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 427 | .init_irq = pxa27x_init_irq, |
Eric Miao | 8a97ae2 | 2011-05-18 21:30:04 +0800 | [diff] [blame] | 428 | .handle_irq = pxa27x_handle_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 429 | .init_time = pxa_timer_init, |
Russell King | 271a74f | 2011-11-04 14:15:53 +0000 | [diff] [blame] | 430 | .init_machine = palmz72_init, |
| 431 | .restart = pxa_restart, |
Sergey Lapin | c49e1e6 | 2008-08-29 15:47:52 +0100 | [diff] [blame] | 432 | MACHINE_END |