.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Hardware definitions for Palm Zire72 |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | * Rewrite for mainline: |
---|
11 | 12 | * Marek Vasut <marek.vasut@gmail.com> |
---|
12 | 13 | * |
---|
13 | | - * This program is free software; you can redistribute it and/or modify |
---|
14 | | - * it under the terms of the GNU General Public License version 2 as |
---|
15 | | - * published by the Free Software Foundation. |
---|
16 | | - * |
---|
17 | 14 | * (find more info at www.hackndev.com) |
---|
18 | | - * |
---|
19 | 15 | */ |
---|
20 | 16 | |
---|
21 | 17 | #include <linux/platform_device.h> |
---|
.. | .. |
---|
29 | 25 | #include <linux/gpio.h> |
---|
30 | 26 | #include <linux/wm97xx.h> |
---|
31 | 27 | #include <linux/power_supply.h> |
---|
32 | | -#include <linux/usb/gpio_vbus.h> |
---|
33 | 28 | #include <linux/platform_data/i2c-gpio.h> |
---|
34 | 29 | #include <linux/gpio/machine.h> |
---|
35 | 30 | |
---|
.. | .. |
---|
51 | 46 | |
---|
52 | 47 | #include "pm.h" |
---|
53 | 48 | #include <linux/platform_data/media/camera-pxa.h> |
---|
54 | | - |
---|
55 | | -#include <media/soc_camera.h> |
---|
56 | 49 | |
---|
57 | 50 | #include "generic.h" |
---|
58 | 51 | #include "devices.h" |
---|
.. | .. |
---|
277 | 270 | device_initcall(palmz72_pm_init); |
---|
278 | 271 | #endif |
---|
279 | 272 | |
---|
280 | | -/****************************************************************************** |
---|
281 | | - * SoC Camera |
---|
282 | | - ******************************************************************************/ |
---|
283 | | -#if defined(CONFIG_SOC_CAMERA_OV9640) || \ |
---|
284 | | - defined(CONFIG_SOC_CAMERA_OV9640_MODULE) |
---|
285 | | -static struct pxacamera_platform_data palmz72_pxacamera_platform_data = { |
---|
286 | | - .flags = PXA_CAMERA_MASTER | PXA_CAMERA_DATAWIDTH_8 | |
---|
287 | | - PXA_CAMERA_PCLK_EN | PXA_CAMERA_MCLK_EN, |
---|
288 | | - .mclk_10khz = 2600, |
---|
289 | | -}; |
---|
290 | | - |
---|
291 | | -/* Board I2C devices. */ |
---|
292 | | -static struct i2c_board_info palmz72_i2c_device[] = { |
---|
293 | | - { |
---|
294 | | - I2C_BOARD_INFO("ov9640", 0x30), |
---|
295 | | - } |
---|
296 | | -}; |
---|
297 | | - |
---|
298 | | -static int palmz72_camera_power(struct device *dev, int power) |
---|
299 | | -{ |
---|
300 | | - gpio_set_value(GPIO_NR_PALMZ72_CAM_PWDN, !power); |
---|
301 | | - mdelay(50); |
---|
302 | | - return 0; |
---|
303 | | -} |
---|
304 | | - |
---|
305 | | -static int palmz72_camera_reset(struct device *dev) |
---|
306 | | -{ |
---|
307 | | - gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 1); |
---|
308 | | - mdelay(50); |
---|
309 | | - gpio_set_value(GPIO_NR_PALMZ72_CAM_RESET, 0); |
---|
310 | | - mdelay(50); |
---|
311 | | - return 0; |
---|
312 | | -} |
---|
313 | | - |
---|
314 | | -static struct soc_camera_link palmz72_iclink = { |
---|
315 | | - .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ |
---|
316 | | - .board_info = &palmz72_i2c_device[0], |
---|
317 | | - .i2c_adapter_id = 0, |
---|
318 | | - .module_name = "ov96xx", |
---|
319 | | - .power = &palmz72_camera_power, |
---|
320 | | - .reset = &palmz72_camera_reset, |
---|
321 | | - .flags = SOCAM_DATAWIDTH_8, |
---|
322 | | -}; |
---|
323 | | - |
---|
324 | | -static struct gpiod_lookup_table palmz72_i2c_gpiod_table = { |
---|
325 | | - .dev_id = "i2c-gpio.0", |
---|
326 | | - .table = { |
---|
327 | | - GPIO_LOOKUP_IDX("gpio-pxa", 118, NULL, 0, |
---|
328 | | - GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
---|
329 | | - GPIO_LOOKUP_IDX("gpio-pxa", 117, NULL, 1, |
---|
330 | | - GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN), |
---|
| 273 | +static struct gpiod_lookup_table palmz72_mci_gpio_table = { |
---|
| 274 | + .dev_id = "pxa2xx-mci.0", |
---|
| 275 | + .table = { |
---|
| 276 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N, |
---|
| 277 | + "cd", GPIO_ACTIVE_LOW), |
---|
| 278 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO, |
---|
| 279 | + "wp", GPIO_ACTIVE_LOW), |
---|
| 280 | + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_POWER_N, |
---|
| 281 | + "power", GPIO_ACTIVE_LOW), |
---|
| 282 | + { }, |
---|
331 | 283 | }, |
---|
332 | 284 | }; |
---|
333 | | - |
---|
334 | | -static struct i2c_gpio_platform_data palmz72_i2c_bus_data = { |
---|
335 | | - .udelay = 10, |
---|
336 | | - .timeout = 100, |
---|
337 | | -}; |
---|
338 | | - |
---|
339 | | -static struct platform_device palmz72_i2c_bus_device = { |
---|
340 | | - .name = "i2c-gpio", |
---|
341 | | - .id = 0, /* we use this as a replacement for i2c-pxa */ |
---|
342 | | - .dev = { |
---|
343 | | - .platform_data = &palmz72_i2c_bus_data, |
---|
344 | | - } |
---|
345 | | -}; |
---|
346 | | - |
---|
347 | | -static struct platform_device palmz72_camera = { |
---|
348 | | - .name = "soc-camera-pdrv", |
---|
349 | | - .id = -1, |
---|
350 | | - .dev = { |
---|
351 | | - .platform_data = &palmz72_iclink, |
---|
352 | | - }, |
---|
353 | | -}; |
---|
354 | | - |
---|
355 | | -/* Here we request the camera GPIOs and configure them. We power up the camera |
---|
356 | | - * module, deassert the reset pin, but put it into powerdown (low to no power |
---|
357 | | - * consumption) mode. This allows us to later bring the module up fast. */ |
---|
358 | | -static struct gpio palmz72_camera_gpios[] = { |
---|
359 | | - { GPIO_NR_PALMZ72_CAM_POWER, GPIOF_INIT_HIGH,"Camera DVDD" }, |
---|
360 | | - { GPIO_NR_PALMZ72_CAM_RESET, GPIOF_INIT_LOW, "Camera RESET" }, |
---|
361 | | - { GPIO_NR_PALMZ72_CAM_PWDN, GPIOF_INIT_LOW, "Camera PWDN" }, |
---|
362 | | -}; |
---|
363 | | - |
---|
364 | | -static inline void __init palmz72_cam_gpio_init(void) |
---|
365 | | -{ |
---|
366 | | - int ret; |
---|
367 | | - |
---|
368 | | - ret = gpio_request_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); |
---|
369 | | - if (!ret) |
---|
370 | | - gpio_free_array(ARRAY_AND_SIZE(palmz72_camera_gpios)); |
---|
371 | | - else |
---|
372 | | - printk(KERN_ERR "Camera GPIO init failed!\n"); |
---|
373 | | - |
---|
374 | | - return; |
---|
375 | | -} |
---|
376 | | - |
---|
377 | | -static void __init palmz72_camera_init(void) |
---|
378 | | -{ |
---|
379 | | - palmz72_cam_gpio_init(); |
---|
380 | | - pxa_set_camera_info(&palmz72_pxacamera_platform_data); |
---|
381 | | - gpiod_add_lookup_table(&palmz72_i2c_gpiod_table); |
---|
382 | | - platform_device_register(&palmz72_i2c_bus_device); |
---|
383 | | - platform_device_register(&palmz72_camera); |
---|
384 | | -} |
---|
385 | | -#else |
---|
386 | | -static inline void palmz72_camera_init(void) {} |
---|
387 | | -#endif |
---|
388 | 285 | |
---|
389 | 286 | /****************************************************************************** |
---|
390 | 287 | * Machine init |
---|
.. | .. |
---|
396 | 293 | pxa_set_btuart_info(NULL); |
---|
397 | 294 | pxa_set_stuart_info(NULL); |
---|
398 | 295 | |
---|
399 | | - palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO, |
---|
400 | | - GPIO_NR_PALMZ72_SD_POWER_N, 1); |
---|
| 296 | + palm27x_mmc_init(&palmz72_mci_gpio_table); |
---|
401 | 297 | palm27x_lcd_init(-1, &palm_320x320_lcd_mode); |
---|
402 | 298 | palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, |
---|
403 | 299 | GPIO_NR_PALMZ72_USB_PULLUP, 0); |
---|
.. | .. |
---|
409 | 305 | palm27x_pmic_init(); |
---|
410 | 306 | palmz72_kpc_init(); |
---|
411 | 307 | palmz72_leds_init(); |
---|
412 | | - palmz72_camera_init(); |
---|
413 | 308 | } |
---|
414 | 309 | |
---|
415 | 310 | MACHINE_START(PALMZ72, "Palm Zire72") |
---|