aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/mioa701.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/mioa701.c')
-rw-r--r--arch/arm/mach-pxa/mioa701.c53
1 files changed, 16 insertions, 37 deletions
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 2b427e015b6f..97c93a7a285c 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -36,13 +36,15 @@
36#include <linux/power_supply.h> 36#include <linux/power_supply.h>
37#include <linux/wm97xx_batt.h> 37#include <linux/wm97xx_batt.h>
38#include <linux/mtd/physmap.h> 38#include <linux/mtd/physmap.h>
39#include <linux/usb/gpio_vbus.h>
39 40
40#include <asm/mach-types.h> 41#include <asm/mach-types.h>
41#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
42#include <mach/mfp-pxa27x.h> 43
44#include <mach/pxa27x.h>
45#include <mach/regs-rtc.h>
43#include <mach/pxa27x_keypad.h> 46#include <mach/pxa27x_keypad.h>
44#include <mach/pxafb.h> 47#include <mach/pxafb.h>
45#include <mach/pxa2xx-regs.h>
46#include <mach/mmc.h> 48#include <mach/mmc.h>
47#include <mach/udc.h> 49#include <mach/udc.h>
48#include <mach/pxa27x-udc.h> 50#include <mach/pxa27x-udc.h>
@@ -411,21 +413,6 @@ static void gsm_exit(void)
411/* 413/*
412 * USB UDC 414 * USB UDC
413 */ 415 */
414static void udc_power_command(int cmd)
415{
416 switch (cmd) {
417 case PXA2XX_UDC_CMD_DISCONNECT:
418 gpio_set_value(GPIO22_USB_ENABLE, 0);
419 break;
420 case PXA2XX_UDC_CMD_CONNECT:
421 gpio_set_value(GPIO22_USB_ENABLE, 1);
422 break;
423 default:
424 printk(KERN_INFO "udc_control: unknown command (0x%x)!\n", cmd);
425 break;
426 }
427}
428
429static int is_usb_connected(void) 416static int is_usb_connected(void)
430{ 417{
431 return !gpio_get_value(GPIO13_nUSB_DETECT); 418 return !gpio_get_value(GPIO13_nUSB_DETECT);
@@ -433,24 +420,15 @@ static int is_usb_connected(void)
433 420
434static struct pxa2xx_udc_mach_info mioa701_udc_info = { 421static struct pxa2xx_udc_mach_info mioa701_udc_info = {
435 .udc_is_connected = is_usb_connected, 422 .udc_is_connected = is_usb_connected,
436 .udc_command = udc_power_command, 423 .gpio_pullup = GPIO22_USB_ENABLE,
437}; 424};
438 425
439struct gpio_ress udc_gpios[] = { 426struct gpio_vbus_mach_info gpio_vbus_data = {
440 MIO_GPIO_OUT(GPIO22_USB_ENABLE, 0, "USB Vbus enable") 427 .gpio_vbus = GPIO13_nUSB_DETECT,
428 .gpio_vbus_inverted = 1,
429 .gpio_pullup = -1,
441}; 430};
442 431
443static int __init udc_init(void)
444{
445 pxa_set_udc_info(&mioa701_udc_info);
446 return mio_gpio_request(ARRAY_AND_SIZE(udc_gpios));
447}
448
449static void udc_exit(void)
450{
451 mio_gpio_free(ARRAY_AND_SIZE(udc_gpios));
452}
453
454/* 432/*
455 * SDIO/MMC Card controller 433 * SDIO/MMC Card controller
456 */ 434 */
@@ -789,6 +767,7 @@ MIO_SIMPLE_DEV(pxa2xx_ac97, "pxa2xx-ac97", NULL)
789MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL) 767MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL)
790MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) 768MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL)
791MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) 769MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL)
770MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data);
792 771
793static struct platform_device *devices[] __initdata = { 772static struct platform_device *devices[] __initdata = {
794 &mioa701_gpio_keys, 773 &mioa701_gpio_keys,
@@ -800,7 +779,8 @@ static struct platform_device *devices[] __initdata = {
800 &mioa701_sound, 779 &mioa701_sound,
801 &power_dev, 780 &power_dev,
802 &strataflash, 781 &strataflash,
803 &mioa701_board 782 &gpio_vbus,
783 &mioa701_board,
804}; 784};
805 785
806static void mioa701_machine_exit(void); 786static void mioa701_machine_exit(void);
@@ -808,13 +788,13 @@ static void mioa701_machine_exit(void);
808static void mioa701_poweroff(void) 788static void mioa701_poweroff(void)
809{ 789{
810 mioa701_machine_exit(); 790 mioa701_machine_exit();
811 arm_machine_restart('s'); 791 arm_machine_restart('s', NULL);
812} 792}
813 793
814static void mioa701_restart(char c) 794static void mioa701_restart(char c, const char *cmd)
815{ 795{
816 mioa701_machine_exit(); 796 mioa701_machine_exit();
817 arm_machine_restart('s'); 797 arm_machine_restart('s', cmd);
818} 798}
819 799
820struct gpio_ress global_gpios[] = { 800struct gpio_ress global_gpios[] = {
@@ -837,7 +817,7 @@ static void __init mioa701_machine_init(void)
837 pxa_set_mci_info(&mioa701_mci_info); 817 pxa_set_mci_info(&mioa701_mci_info);
838 pxa_set_keypad_info(&mioa701_keypad_info); 818 pxa_set_keypad_info(&mioa701_keypad_info);
839 wm97xx_bat_set_pdata(&mioa701_battery_data); 819 wm97xx_bat_set_pdata(&mioa701_battery_data);
840 udc_init(); 820 pxa_set_udc_info(&mioa701_udc_info);
841 pm_power_off = mioa701_poweroff; 821 pm_power_off = mioa701_poweroff;
842 arm_pm_restart = mioa701_restart; 822 arm_pm_restart = mioa701_restart;
843 platform_add_devices(devices, ARRAY_SIZE(devices)); 823 platform_add_devices(devices, ARRAY_SIZE(devices));
@@ -850,7 +830,6 @@ static void __init mioa701_machine_init(void)
850 830
851static void mioa701_machine_exit(void) 831static void mioa701_machine_exit(void)
852{ 832{
853 udc_exit();
854 bootstrap_exit(); 833 bootstrap_exit();
855 gsm_exit(); 834 gsm_exit();
856} 835}