hugetlb: factor out prep_new_huge_page
[linux-2.6/mini2440.git] / drivers / pcmcia / pxa2xx_palmtx.c
blob4abde190c1f57f59a337478176ce67c01cb35015
1 /*
2 * linux/drivers/pcmcia/pxa2xx_palmtx.c
4 * Driver for Palm T|X PCMCIA
6 * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
14 #include <linux/module.h>
15 #include <linux/platform_device.h>
17 #include <asm/mach-types.h>
19 #include <asm/arch/gpio.h>
20 #include <asm/arch/palmtx.h>
22 #include "soc_common.h"
24 static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
26 skt->irq = IRQ_GPIO(GPIO_NR_PALMTX_PCMCIA_READY);
27 return 0;
30 static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
34 static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
35 struct pcmcia_state *state)
37 state->detect = 1; /* always inserted */
38 state->ready = !!gpio_get_value(GPIO_NR_PALMTX_PCMCIA_READY);
39 state->bvd1 = 1;
40 state->bvd2 = 1;
41 state->wrprot = 0;
42 state->vs_3v = 1;
43 state->vs_Xv = 0;
46 static int
47 palmtx_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
48 const socket_state_t *state)
50 gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER1, 1);
51 gpio_set_value(GPIO_NR_PALMTX_PCMCIA_POWER2, 1);
52 gpio_set_value(GPIO_NR_PALMTX_PCMCIA_RESET,
53 !!(state->flags & SS_RESET));
55 return 0;
58 static void palmtx_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
62 static void palmtx_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
66 static struct pcmcia_low_level palmtx_pcmcia_ops = {
67 .owner = THIS_MODULE,
69 .first = 0,
70 .nr = 1,
72 .hw_init = palmtx_pcmcia_hw_init,
73 .hw_shutdown = palmtx_pcmcia_hw_shutdown,
75 .socket_state = palmtx_pcmcia_socket_state,
76 .configure_socket = palmtx_pcmcia_configure_socket,
78 .socket_init = palmtx_pcmcia_socket_init,
79 .socket_suspend = palmtx_pcmcia_socket_suspend,
82 static struct platform_device *palmtx_pcmcia_device;
84 static int __init palmtx_pcmcia_init(void)
86 int ret;
88 if (!machine_is_palmtx())
89 return -ENODEV;
91 palmtx_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
92 if (!palmtx_pcmcia_device)
93 return -ENOMEM;
95 ret = platform_device_add_data(palmtx_pcmcia_device, &palmtx_pcmcia_ops,
96 sizeof(palmtx_pcmcia_ops));
98 if (!ret)
99 ret = platform_device_add(palmtx_pcmcia_device);
101 if (ret)
102 platform_device_put(palmtx_pcmcia_device);
104 return ret;
107 static void __exit palmtx_pcmcia_exit(void)
109 platform_device_unregister(palmtx_pcmcia_device);
112 fs_initcall(palmtx_pcmcia_init);
113 module_exit(palmtx_pcmcia_exit);
115 MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
116 MODULE_DESCRIPTION("PCMCIA support for Palm T|X");
117 MODULE_ALIAS("platform:pxa2xx-pcmcia");
118 MODULE_LICENSE("GPL");