aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/busses/i2c-pxa.c30
-rw-r--r--drivers/net/irda/pxaficp_ir.c24
-rw-r--r--drivers/pcmcia/pxa2xx_cm_x270.c15
-rw-r--r--drivers/pcmcia/pxa2xx_mainstone.c13
-rw-r--r--drivers/pcmcia/pxa2xx_sharpsl.c12
-rw-r--r--drivers/usb/gadget/Kconfig12
-rw-r--r--drivers/usb/gadget/Makefile2
-rw-r--r--drivers/usb/gadget/ether.c2
-rw-r--r--drivers/usb/gadget/gadget_chips.h4
-rw-r--r--drivers/usb/gadget/inode.c2
-rw-r--r--drivers/usb/gadget/pxa25x_udc.c (renamed from drivers/usb/gadget/pxa2xx_udc.c)309
-rw-r--r--drivers/usb/gadget/pxa25x_udc.h (renamed from drivers/usb/gadget/pxa2xx_udc.h)29
-rw-r--r--drivers/usb/gadget/pxa27x_udc.c9
-rw-r--r--drivers/usb/gadget/pxa27x_udc.h8
-rw-r--r--drivers/usb/host/ohci-pxa27x.c3
-rw-r--r--drivers/video/backlight/Kconfig7
-rw-r--r--drivers/video/backlight/Makefile1
-rw-r--r--drivers/video/backlight/pwm_bl.c185
-rw-r--r--drivers/video/pxafb.c44
19 files changed, 453 insertions, 258 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index eb69fbadc9cb..dde6ce963a19 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -39,7 +39,6 @@
39#include <asm/io.h> 39#include <asm/io.h>
40#include <asm/arch/i2c.h> 40#include <asm/arch/i2c.h>
41#include <asm/arch/pxa-regs.h> 41#include <asm/arch/pxa-regs.h>
42#include <asm/arch/pxa2xx-gpio.h>
43 42
44struct pxa_i2c { 43struct pxa_i2c {
45 spinlock_t lock; 44 spinlock_t lock;
@@ -945,32 +944,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
945 .functionality = i2c_pxa_functionality, 944 .functionality = i2c_pxa_functionality,
946}; 945};
947 946
948static void i2c_pxa_enable(struct platform_device *dev)
949{
950 if (cpu_is_pxa27x()) {
951 switch (dev->id) {
952 case 0:
953 pxa_gpio_mode(GPIO117_I2CSCL_MD);
954 pxa_gpio_mode(GPIO118_I2CSDA_MD);
955 break;
956 case 1:
957 local_irq_disable();
958 PCFR |= PCFR_PI2CEN;
959 local_irq_enable();
960 break;
961 }
962 }
963}
964
965static void i2c_pxa_disable(struct platform_device *dev)
966{
967 if (cpu_is_pxa27x() && dev->id == 1) {
968 local_irq_disable();
969 PCFR &= ~PCFR_PI2CEN;
970 local_irq_enable();
971 }
972}
973
974#define res_len(r) ((r)->end - (r)->start + 1) 947#define res_len(r) ((r)->end - (r)->start + 1)
975static int i2c_pxa_probe(struct platform_device *dev) 948static int i2c_pxa_probe(struct platform_device *dev)
976{ 949{
@@ -1036,7 +1009,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
1036#endif 1009#endif
1037 1010
1038 clk_enable(i2c->clk); 1011 clk_enable(i2c->clk);
1039 i2c_pxa_enable(dev);
1040 1012
1041 if (plat) { 1013 if (plat) {
1042 i2c->adap.class = plat->class; 1014 i2c->adap.class = plat->class;
@@ -1080,7 +1052,6 @@ eadapt:
1080 free_irq(irq, i2c); 1052 free_irq(irq, i2c);
1081ereqirq: 1053ereqirq:
1082 clk_disable(i2c->clk); 1054 clk_disable(i2c->clk);
1083 i2c_pxa_disable(dev);
1084 iounmap(i2c->reg_base); 1055 iounmap(i2c->reg_base);
1085eremap: 1056eremap:
1086 clk_put(i2c->clk); 1057 clk_put(i2c->clk);
@@ -1103,7 +1074,6 @@ static int __exit i2c_pxa_remove(struct platform_device *dev)
1103 1074
1104 clk_disable(i2c->clk); 1075 clk_disable(i2c->clk);
1105 clk_put(i2c->clk); 1076 clk_put(i2c->clk);
1106 i2c_pxa_disable(dev);
1107 1077
1108 iounmap(i2c->reg_base); 1078 iounmap(i2c->reg_base);
1109 release_mem_region(i2c->iobase, i2c->iosize); 1079 release_mem_region(i2c->iobase, i2c->iosize);
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index d5c2d27f3ea4..f76b0b6c277d 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -13,16 +13,8 @@
13 * 13 *
14 */ 14 */
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/types.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/netdevice.h> 16#include <linux/netdevice.h>
20#include <linux/slab.h>
21#include <linux/rtnetlink.h>
22#include <linux/interrupt.h>
23#include <linux/dma-mapping.h>
24#include <linux/platform_device.h> 17#include <linux/platform_device.h>
25#include <linux/pm.h>
26#include <linux/clk.h> 18#include <linux/clk.h>
27 19
28#include <net/irda/irda.h> 20#include <net/irda/irda.h>
@@ -30,17 +22,9 @@
30#include <net/irda/wrapper.h> 22#include <net/irda/wrapper.h>
31#include <net/irda/irda_device.h> 23#include <net/irda/irda_device.h>
32 24
33#include <asm/irq.h>
34#include <asm/dma.h> 25#include <asm/dma.h>
35#include <asm/delay.h>
36#include <asm/hardware.h>
37#include <asm/arch/irda.h> 26#include <asm/arch/irda.h>
38#include <asm/arch/pxa-regs.h> 27#include <asm/arch/pxa-regs.h>
39#include <asm/arch/pxa2xx-gpio.h>
40
41#ifdef CONFIG_MACH_MAINSTONE
42#include <asm/arch/mainstone.h>
43#endif
44 28
45#define IrSR_RXPL_NEG_IS_ZERO (1<<4) 29#define IrSR_RXPL_NEG_IS_ZERO (1<<4)
46#define IrSR_RXPL_POS_IS_ZERO 0x0 30#define IrSR_RXPL_POS_IS_ZERO 0x0
@@ -163,10 +147,6 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
163 /* set board transceiver to SIR mode */ 147 /* set board transceiver to SIR mode */
164 si->pdata->transceiver_mode(si->dev, IR_SIRMODE); 148 si->pdata->transceiver_mode(si->dev, IR_SIRMODE);
165 149
166 /* configure GPIO46/47 */
167 pxa_gpio_mode(GPIO46_STRXD_MD);
168 pxa_gpio_mode(GPIO47_STTXD_MD);
169
170 /* enable the STUART clock */ 150 /* enable the STUART clock */
171 pxa_irda_enable_sirclk(si); 151 pxa_irda_enable_sirclk(si);
172 } 152 }
@@ -201,10 +181,6 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
201 /* set board transceiver to FIR mode */ 181 /* set board transceiver to FIR mode */
202 si->pdata->transceiver_mode(si->dev, IR_FIRMODE); 182 si->pdata->transceiver_mode(si->dev, IR_FIRMODE);
203 183
204 /* configure GPIO46/47 */
205 pxa_gpio_mode(GPIO46_ICPRXD_MD);
206 pxa_gpio_mode(GPIO47_ICPTXD_MD);
207
208 /* enable the FICP clock */ 184 /* enable the FICP clock */
209 pxa_irda_enable_firclk(si); 185 pxa_irda_enable_firclk(si);
210 186
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c
index e7ab060ff118..f123fce65f2e 100644
--- a/drivers/pcmcia/pxa2xx_cm_x270.c
+++ b/drivers/pcmcia/pxa2xx_cm_x270.c
@@ -18,6 +18,7 @@
18 18
19#include <pcmcia/ss.h> 19#include <pcmcia/ss.h>
20#include <asm/hardware.h> 20#include <asm/hardware.h>
21#include <asm/mach-types.h>
21 22
22#include <asm/arch/pxa-regs.h> 23#include <asm/arch/pxa-regs.h>
23#include <asm/arch/pxa2xx-gpio.h> 24#include <asm/arch/pxa2xx-gpio.h>
@@ -130,7 +131,7 @@ static void cmx270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
130} 131}
131 132
132 133
133static struct pcmcia_low_level cmx270_pcmcia_ops = { 134static struct pcmcia_low_level cmx270_pcmcia_ops __initdata = {
134 .owner = THIS_MODULE, 135 .owner = THIS_MODULE,
135 .hw_init = cmx270_pcmcia_hw_init, 136 .hw_init = cmx270_pcmcia_hw_init,
136 .hw_shutdown = cmx270_pcmcia_shutdown, 137 .hw_shutdown = cmx270_pcmcia_shutdown,
@@ -147,15 +148,21 @@ static int __init cmx270_pcmcia_init(void)
147{ 148{
148 int ret; 149 int ret;
149 150
151 if (!machine_is_armcore())
152 return -ENODEV;
153
150 cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); 154 cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
151 155
152 if (!cmx270_pcmcia_device) 156 if (!cmx270_pcmcia_device)
153 return -ENOMEM; 157 return -ENOMEM;
154 158
155 cmx270_pcmcia_device->dev.platform_data = &cmx270_pcmcia_ops; 159 ret = platform_device_add_data(cmx270_pcmcia_device, &cmx270_pcmcia_ops,
160 sizeof(cmx270_pcmcia_ops));
156 161
157 printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n"); 162 if (ret == 0) {
158 ret = platform_device_add(cmx270_pcmcia_device); 163 printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n");
164 ret = platform_device_add(cmx270_pcmcia_device);
165 }
159 166
160 if (ret) 167 if (ret)
161 platform_device_put(cmx270_pcmcia_device); 168 platform_device_put(cmx270_pcmcia_device);
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c
index 145b85e0f02c..92d1cc33808c 100644
--- a/drivers/pcmcia/pxa2xx_mainstone.c
+++ b/drivers/pcmcia/pxa2xx_mainstone.c
@@ -22,6 +22,7 @@
22#include <pcmcia/ss.h> 22#include <pcmcia/ss.h>
23 23
24#include <asm/hardware.h> 24#include <asm/hardware.h>
25#include <asm/mach-types.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26 27
27#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
@@ -136,7 +137,7 @@ static void mst_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
136{ 137{
137} 138}
138 139
139static struct pcmcia_low_level mst_pcmcia_ops = { 140static struct pcmcia_low_level mst_pcmcia_ops __initdata = {
140 .owner = THIS_MODULE, 141 .owner = THIS_MODULE,
141 .hw_init = mst_pcmcia_hw_init, 142 .hw_init = mst_pcmcia_hw_init,
142 .hw_shutdown = mst_pcmcia_hw_shutdown, 143 .hw_shutdown = mst_pcmcia_hw_shutdown,
@@ -153,13 +154,17 @@ static int __init mst_pcmcia_init(void)
153{ 154{
154 int ret; 155 int ret;
155 156
157 if (!machine_is_mainstone())
158 return -ENODEV;
159
156 mst_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); 160 mst_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
157 if (!mst_pcmcia_device) 161 if (!mst_pcmcia_device)
158 return -ENOMEM; 162 return -ENOMEM;
159 163
160 mst_pcmcia_device->dev.platform_data = &mst_pcmcia_ops; 164 ret = platform_device_add_data(mst_pcmcia_device, &mst_pcmcia_ops,
161 165 sizeof(mst_pcmcia_ops));
162 ret = platform_device_add(mst_pcmcia_device); 166 if (ret == 0)
167 ret = platform_device_add(mst_pcmcia_device);
163 168
164 if (ret) 169 if (ret)
165 platform_device_put(mst_pcmcia_device); 170 platform_device_put(mst_pcmcia_device);
diff --git a/drivers/pcmcia/pxa2xx_sharpsl.c b/drivers/pcmcia/pxa2xx_sharpsl.c
index d5c33bd78d68..d71f93d45833 100644
--- a/drivers/pcmcia/pxa2xx_sharpsl.c
+++ b/drivers/pcmcia/pxa2xx_sharpsl.c
@@ -222,7 +222,7 @@ static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
222 sharpsl_pcmcia_init_reset(skt); 222 sharpsl_pcmcia_init_reset(skt);
223} 223}
224 224
225static struct pcmcia_low_level sharpsl_pcmcia_ops = { 225static struct pcmcia_low_level sharpsl_pcmcia_ops __initdata = {
226 .owner = THIS_MODULE, 226 .owner = THIS_MODULE,
227 .hw_init = sharpsl_pcmcia_hw_init, 227 .hw_init = sharpsl_pcmcia_hw_init,
228 .hw_shutdown = sharpsl_pcmcia_hw_shutdown, 228 .hw_shutdown = sharpsl_pcmcia_hw_shutdown,
@@ -261,10 +261,12 @@ static int __init sharpsl_pcmcia_init(void)
261 if (!sharpsl_pcmcia_device) 261 if (!sharpsl_pcmcia_device)
262 return -ENOMEM; 262 return -ENOMEM;
263 263
264 sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops; 264 ret = platform_device_add_data(sharpsl_pcmcia_device,
265 sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev; 265 &sharpsl_pcmcia_ops, sizeof(sharpsl_pcmcia_ops));
266 266 if (ret == 0) {
267 ret = platform_device_add(sharpsl_pcmcia_device); 267 sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
268 ret = platform_device_add(sharpsl_pcmcia_device);
269 }
268 270
269 if (ret) 271 if (ret)
270 platform_device_put(sharpsl_pcmcia_device); 272 platform_device_put(sharpsl_pcmcia_device);
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
index 3565d4352826..d6bab0d5f453 100644
--- a/drivers/usb/gadget/Kconfig
+++ b/drivers/usb/gadget/Kconfig
@@ -172,7 +172,7 @@ config USB_NET2280
172 default USB_GADGET 172 default USB_GADGET
173 select USB_GADGET_SELECTED 173 select USB_GADGET_SELECTED
174 174
175config USB_GADGET_PXA2XX 175config USB_GADGET_PXA25X
176 boolean "PXA 25x or IXP 4xx" 176 boolean "PXA 25x or IXP 4xx"
177 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX 177 depends on (ARCH_PXA && PXA25x) || ARCH_IXP4XX
178 help 178 help
@@ -184,19 +184,19 @@ config USB_GADGET_PXA2XX
184 zero (for control transfers). 184 zero (for control transfers).
185 185
186 Say "y" to link the driver statically, or "m" to build a 186 Say "y" to link the driver statically, or "m" to build a
187 dynamically linked module called "pxa2xx_udc" and force all 187 dynamically linked module called "pxa25x_udc" and force all
188 gadget drivers to also be dynamically linked. 188 gadget drivers to also be dynamically linked.
189 189
190config USB_PXA2XX 190config USB_PXA25X
191 tristate 191 tristate
192 depends on USB_GADGET_PXA2XX 192 depends on USB_GADGET_PXA25X
193 default USB_GADGET 193 default USB_GADGET
194 select USB_GADGET_SELECTED 194 select USB_GADGET_SELECTED
195 195
196# if there's only one gadget driver, using only two bulk endpoints, 196# if there's only one gadget driver, using only two bulk endpoints,
197# don't waste memory for the other endpoints 197# don't waste memory for the other endpoints
198config USB_PXA2XX_SMALL 198config USB_PXA25X_SMALL
199 depends on USB_GADGET_PXA2XX 199 depends on USB_GADGET_PXA25X
200 bool 200 bool
201 default n if USB_ETH_RNDIS 201 default n if USB_ETH_RNDIS
202 default y if USB_ZERO 202 default y if USB_ZERO
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 12357255d740..e258afd25faf 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -8,7 +8,7 @@ endif
8obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o 8obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o
9obj-$(CONFIG_USB_NET2280) += net2280.o 9obj-$(CONFIG_USB_NET2280) += net2280.o
10obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o 10obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o
11obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o 11obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o
12obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o 12obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o
13obj-$(CONFIG_USB_GOKU) += goku_udc.o 13obj-$(CONFIG_USB_GOKU) += goku_udc.o
14obj-$(CONFIG_USB_OMAP) += omap_udc.o 14obj-$(CONFIG_USB_OMAP) += omap_udc.o
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8d61ea67a817..4ce3950b997f 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -262,7 +262,7 @@ MODULE_PARM_DESC(host_addr, "Host Ethernet Address");
262/* For CDC-incapable hardware, choose the simple cdc subset. 262/* For CDC-incapable hardware, choose the simple cdc subset.
263 * Anything that talks bulk (without notable bugs) can do this. 263 * Anything that talks bulk (without notable bugs) can do this.
264 */ 264 */
265#ifdef CONFIG_USB_GADGET_PXA2XX 265#ifdef CONFIG_USB_GADGET_PXA25X
266#define DEV_CONFIG_SUBSET 266#define DEV_CONFIG_SUBSET
267#endif 267#endif
268 268
diff --git a/drivers/usb/gadget/gadget_chips.h b/drivers/usb/gadget/gadget_chips.h
index f7f159c1002b..ca5149ea7312 100644
--- a/drivers/usb/gadget/gadget_chips.h
+++ b/drivers/usb/gadget/gadget_chips.h
@@ -29,8 +29,8 @@
29#define gadget_is_dummy(g) 0 29#define gadget_is_dummy(g) 0
30#endif 30#endif
31 31
32#ifdef CONFIG_USB_GADGET_PXA2XX 32#ifdef CONFIG_USB_GADGET_PXA25X
33#define gadget_is_pxa(g) !strcmp("pxa2xx_udc", (g)->name) 33#define gadget_is_pxa(g) !strcmp("pxa25x_udc", (g)->name)
34#else 34#else
35#define gadget_is_pxa(g) 0 35#define gadget_is_pxa(g) 0
36#endif 36#endif
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 69b0a2754f2a..f132a9219e11 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -1501,7 +1501,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
1501 } 1501 }
1502 break; 1502 break;
1503 1503
1504#ifndef CONFIG_USB_GADGET_PXA2XX 1504#ifndef CONFIG_USB_GADGET_PXA25X
1505 /* PXA automagically handles this request too */ 1505 /* PXA automagically handles this request too */
1506 case USB_REQ_GET_CONFIGURATION: 1506 case USB_REQ_GET_CONFIGURATION:
1507 if (ctrl->bRequestType != 0x80) 1507 if (ctrl->bRequestType != 0x80)
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 08f699b1fc57..031dceb93023 100644
--- a/drivers/usb/gadget/pxa2xx_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -1,5 +1,4 @@
1/* 1/*
2 * linux/drivers/usb/gadget/pxa2xx_udc.c
3 * Intel PXA25x and IXP4xx on-chip full speed USB device controllers 2 * Intel PXA25x and IXP4xx on-chip full speed USB device controllers
4 * 3 *
5 * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker) 4 * Copyright (C) 2002 Intrinsyc, Inc. (Frank Becker)
@@ -46,19 +45,25 @@
46#include <linux/err.h> 45#include <linux/err.h>
47#include <linux/seq_file.h> 46#include <linux/seq_file.h>
48#include <linux/debugfs.h> 47#include <linux/debugfs.h>
48#include <linux/io.h>
49 49
50#include <asm/byteorder.h> 50#include <asm/byteorder.h>
51#include <asm/dma.h> 51#include <asm/dma.h>
52#include <asm/gpio.h> 52#include <asm/gpio.h>
53#include <asm/io.h>
54#include <asm/system.h> 53#include <asm/system.h>
55#include <asm/mach-types.h> 54#include <asm/mach-types.h>
56#include <asm/unaligned.h> 55#include <asm/unaligned.h>
57#include <asm/hardware.h>
58 56
59#include <linux/usb/ch9.h> 57#include <linux/usb/ch9.h>
60#include <linux/usb/gadget.h> 58#include <linux/usb/gadget.h>
61 59
60/*
61 * This driver is PXA25x only. Grab the right register definitions.
62 */
63#ifdef CONFIG_ARCH_PXA
64#include <asm/arch/pxa25x-udc.h>
65#endif
66
62#include <asm/mach/udc_pxa2xx.h> 67#include <asm/mach/udc_pxa2xx.h>
63 68
64 69
@@ -91,7 +96,7 @@
91#define DRIVER_DESC "PXA 25x USB Device Controller driver" 96#define DRIVER_DESC "PXA 25x USB Device Controller driver"
92 97
93 98
94static const char driver_name [] = "pxa2xx_udc"; 99static const char driver_name [] = "pxa25x_udc";
95 100
96static const char ep0name [] = "ep0"; 101static const char ep0name [] = "ep0";
97 102
@@ -111,10 +116,10 @@ static const char ep0name [] = "ep0";
111 116
112#endif 117#endif
113 118
114#include "pxa2xx_udc.h" 119#include "pxa25x_udc.h"
115 120
116 121
117#ifdef CONFIG_USB_PXA2XX_SMALL 122#ifdef CONFIG_USB_PXA25X_SMALL
118#define SIZE_STR " (small)" 123#define SIZE_STR " (small)"
119#else 124#else
120#define SIZE_STR "" 125#define SIZE_STR ""
@@ -126,8 +131,8 @@ static const char ep0name [] = "ep0";
126 * --------------------------------------------------------------------------- 131 * ---------------------------------------------------------------------------
127 */ 132 */
128 133
129static void pxa2xx_ep_fifo_flush (struct usb_ep *ep); 134static void pxa25x_ep_fifo_flush (struct usb_ep *ep);
130static void nuke (struct pxa2xx_ep *, int status); 135static void nuke (struct pxa25x_ep *, int status);
131 136
132/* one GPIO should be used to detect VBUS from the host */ 137/* one GPIO should be used to detect VBUS from the host */
133static int is_vbus_present(void) 138static int is_vbus_present(void)
@@ -212,24 +217,24 @@ static inline void udc_ack_int_UDCCR(int mask)
212/* 217/*
213 * endpoint enable/disable 218 * endpoint enable/disable
214 * 219 *
215 * we need to verify the descriptors used to enable endpoints. since pxa2xx 220 * we need to verify the descriptors used to enable endpoints. since pxa25x
216 * endpoint configurations are fixed, and are pretty much always enabled, 221 * endpoint configurations are fixed, and are pretty much always enabled,
217 * there's not a lot to manage here. 222 * there's not a lot to manage here.
218 * 223 *
219 * because pxa2xx can't selectively initialize bulk (or interrupt) endpoints, 224 * because pxa25x can't selectively initialize bulk (or interrupt) endpoints,
220 * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except 225 * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except
221 * for a single interface (with only the default altsetting) and for gadget 226 * for a single interface (with only the default altsetting) and for gadget
222 * drivers that don't halt endpoints (not reset by set_interface). that also 227 * drivers that don't halt endpoints (not reset by set_interface). that also
223 * means that if you use ISO, you must violate the USB spec rule that all 228 * means that if you use ISO, you must violate the USB spec rule that all
224 * iso endpoints must be in non-default altsettings. 229 * iso endpoints must be in non-default altsettings.
225 */ 230 */
226static int pxa2xx_ep_enable (struct usb_ep *_ep, 231static int pxa25x_ep_enable (struct usb_ep *_ep,
227 const struct usb_endpoint_descriptor *desc) 232 const struct usb_endpoint_descriptor *desc)
228{ 233{
229 struct pxa2xx_ep *ep; 234 struct pxa25x_ep *ep;
230 struct pxa2xx_udc *dev; 235 struct pxa25x_udc *dev;
231 236
232 ep = container_of (_ep, struct pxa2xx_ep, ep); 237 ep = container_of (_ep, struct pxa25x_ep, ep);
233 if (!_ep || !desc || ep->desc || _ep->name == ep0name 238 if (!_ep || !desc || ep->desc || _ep->name == ep0name
234 || desc->bDescriptorType != USB_DT_ENDPOINT 239 || desc->bDescriptorType != USB_DT_ENDPOINT
235 || ep->bEndpointAddress != desc->bEndpointAddress 240 || ep->bEndpointAddress != desc->bEndpointAddress
@@ -268,7 +273,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
268 ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); 273 ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize);
269 274
270 /* flush fifo (mostly for OUT buffers) */ 275 /* flush fifo (mostly for OUT buffers) */
271 pxa2xx_ep_fifo_flush (_ep); 276 pxa25x_ep_fifo_flush (_ep);
272 277
273 /* ... reset halt state too, if we could ... */ 278 /* ... reset halt state too, if we could ... */
274 279
@@ -276,12 +281,12 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep,
276 return 0; 281 return 0;
277} 282}
278 283
279static int pxa2xx_ep_disable (struct usb_ep *_ep) 284static int pxa25x_ep_disable (struct usb_ep *_ep)
280{ 285{
281 struct pxa2xx_ep *ep; 286 struct pxa25x_ep *ep;
282 unsigned long flags; 287 unsigned long flags;
283 288
284 ep = container_of (_ep, struct pxa2xx_ep, ep); 289 ep = container_of (_ep, struct pxa25x_ep, ep);
285 if (!_ep || !ep->desc) { 290 if (!_ep || !ep->desc) {
286 DMSG("%s, %s not enabled\n", __func__, 291 DMSG("%s, %s not enabled\n", __func__,
287 _ep ? ep->ep.name : NULL); 292 _ep ? ep->ep.name : NULL);
@@ -292,7 +297,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep)
292 nuke (ep, -ESHUTDOWN); 297 nuke (ep, -ESHUTDOWN);
293 298
294 /* flush fifo (mostly for IN buffers) */ 299 /* flush fifo (mostly for IN buffers) */
295 pxa2xx_ep_fifo_flush (_ep); 300 pxa25x_ep_fifo_flush (_ep);
296 301
297 ep->desc = NULL; 302 ep->desc = NULL;
298 ep->stopped = 1; 303 ep->stopped = 1;
@@ -304,18 +309,18 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep)
304 309
305/*-------------------------------------------------------------------------*/ 310/*-------------------------------------------------------------------------*/
306 311
307/* for the pxa2xx, these can just wrap kmalloc/kfree. gadget drivers 312/* for the pxa25x, these can just wrap kmalloc/kfree. gadget drivers
308 * must still pass correctly initialized endpoints, since other controller 313 * must still pass correctly initialized endpoints, since other controller
309 * drivers may care about how it's currently set up (dma issues etc). 314 * drivers may care about how it's currently set up (dma issues etc).
310 */ 315 */
311 316
312/* 317/*
313 * pxa2xx_ep_alloc_request - allocate a request data structure 318 * pxa25x_ep_alloc_request - allocate a request data structure
314 */ 319 */
315static struct usb_request * 320static struct usb_request *
316pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) 321pxa25x_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
317{ 322{
318 struct pxa2xx_request *req; 323 struct pxa25x_request *req;
319 324
320 req = kzalloc(sizeof(*req), gfp_flags); 325 req = kzalloc(sizeof(*req), gfp_flags);
321 if (!req) 326 if (!req)
@@ -327,14 +332,14 @@ pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags)
327 332
328 333
329/* 334/*
330 * pxa2xx_ep_free_request - deallocate a request data structure 335 * pxa25x_ep_free_request - deallocate a request data structure
331 */ 336 */
332static void 337static void
333pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) 338pxa25x_ep_free_request (struct usb_ep *_ep, struct usb_request *_req)
334{ 339{
335 struct pxa2xx_request *req; 340 struct pxa25x_request *req;
336 341
337 req = container_of (_req, struct pxa2xx_request, req); 342 req = container_of (_req, struct pxa25x_request, req);
338 WARN_ON (!list_empty (&req->queue)); 343 WARN_ON (!list_empty (&req->queue));
339 kfree(req); 344 kfree(req);
340} 345}
@@ -344,7 +349,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req)
344/* 349/*
345 * done - retire a request; caller blocked irqs 350 * done - retire a request; caller blocked irqs
346 */ 351 */
347static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status) 352static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status)
348{ 353{
349 unsigned stopped = ep->stopped; 354 unsigned stopped = ep->stopped;
350 355
@@ -367,13 +372,13 @@ static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status)
367} 372}
368 373
369 374
370static inline void ep0_idle (struct pxa2xx_udc *dev) 375static inline void ep0_idle (struct pxa25x_udc *dev)
371{ 376{
372 dev->ep0state = EP0_IDLE; 377 dev->ep0state = EP0_IDLE;
373} 378}
374 379
375static int 380static int
376write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) 381write_packet(volatile u32 *uddr, struct pxa25x_request *req, unsigned max)
377{ 382{
378 u8 *buf; 383 u8 *buf;
379 unsigned length, count; 384 unsigned length, count;
@@ -398,7 +403,7 @@ write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max)
398 * caller guarantees at least one packet buffer is ready (or a zlp). 403 * caller guarantees at least one packet buffer is ready (or a zlp).
399 */ 404 */
400static int 405static int
401write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) 406write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
402{ 407{
403 unsigned max; 408 unsigned max;
404 409
@@ -455,7 +460,7 @@ write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
455 * ep0 data stage. these chips want very simple state transitions. 460 * ep0 data stage. these chips want very simple state transitions.
456 */ 461 */
457static inline 462static inline
458void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) 463void ep0start(struct pxa25x_udc *dev, u32 flags, const char *tag)
459{ 464{
460 UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR; 465 UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR;
461 USIR0 = USIR0_IR0; 466 USIR0 = USIR0_IR0;
@@ -465,7 +470,7 @@ void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag)
465} 470}
466 471
467static int 472static int
468write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) 473write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
469{ 474{
470 unsigned count; 475 unsigned count;
471 int is_short; 476 int is_short;
@@ -525,7 +530,7 @@ write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
525 * request buffer having filled (and maybe overran till end-of-packet). 530 * request buffer having filled (and maybe overran till end-of-packet).
526 */ 531 */
527static int 532static int
528read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) 533read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
529{ 534{
530 for (;;) { 535 for (;;) {
531 u32 udccs; 536 u32 udccs;
@@ -602,7 +607,7 @@ read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
602 * protocols do use them. 607 * protocols do use them.
603 */ 608 */
604static int 609static int
605read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) 610read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req)
606{ 611{
607 u8 *buf, byte; 612 u8 *buf, byte;
608 unsigned bufferspace; 613 unsigned bufferspace;
@@ -641,21 +646,21 @@ read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req)
641/*-------------------------------------------------------------------------*/ 646/*-------------------------------------------------------------------------*/
642 647
643static int 648static int
644pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) 649pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
645{ 650{
646 struct pxa2xx_request *req; 651 struct pxa25x_request *req;
647 struct pxa2xx_ep *ep; 652 struct pxa25x_ep *ep;
648 struct pxa2xx_udc *dev; 653 struct pxa25x_udc *dev;
649 unsigned long flags; 654 unsigned long flags;
650 655
651 req = container_of(_req, struct pxa2xx_request, req); 656 req = container_of(_req, struct pxa25x_request, req);
652 if (unlikely (!_req || !_req->complete || !_req->buf 657 if (unlikely (!_req || !_req->complete || !_req->buf
653 || !list_empty(&req->queue))) { 658 || !list_empty(&req->queue))) {
654 DMSG("%s, bad params\n", __func__); 659 DMSG("%s, bad params\n", __func__);
655 return -EINVAL; 660 return -EINVAL;
656 } 661 }
657 662
658 ep = container_of(_ep, struct pxa2xx_ep, ep); 663 ep = container_of(_ep, struct pxa25x_ep, ep);
659 if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) { 664 if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) {
660 DMSG("%s, bad ep\n", __func__); 665 DMSG("%s, bad ep\n", __func__);
661 return -EINVAL; 666 return -EINVAL;
@@ -751,14 +756,14 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
751/* 756/*
752 * nuke - dequeue ALL requests 757 * nuke - dequeue ALL requests
753 */ 758 */
754static void nuke(struct pxa2xx_ep *ep, int status) 759static void nuke(struct pxa25x_ep *ep, int status)
755{ 760{
756 struct pxa2xx_request *req; 761 struct pxa25x_request *req;
757 762
758 /* called with irqs blocked */ 763 /* called with irqs blocked */
759 while (!list_empty(&ep->queue)) { 764 while (!list_empty(&ep->queue)) {
760 req = list_entry(ep->queue.next, 765 req = list_entry(ep->queue.next,
761 struct pxa2xx_request, 766 struct pxa25x_request,
762 queue); 767 queue);
763 done(ep, req, status); 768 done(ep, req, status);
764 } 769 }
@@ -768,13 +773,13 @@ static void nuke(struct pxa2xx_ep *ep, int status)
768 773
769 774
770/* dequeue JUST ONE request */ 775/* dequeue JUST ONE request */
771static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) 776static int pxa25x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
772{ 777{
773 struct pxa2xx_ep *ep; 778 struct pxa25x_ep *ep;
774 struct pxa2xx_request *req; 779 struct pxa25x_request *req;
775 unsigned long flags; 780 unsigned long flags;
776 781
777 ep = container_of(_ep, struct pxa2xx_ep, ep); 782 ep = container_of(_ep, struct pxa25x_ep, ep);
778 if (!_ep || ep->ep.name == ep0name) 783 if (!_ep || ep->ep.name == ep0name)
779 return -EINVAL; 784 return -EINVAL;
780 785
@@ -798,12 +803,12 @@ static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
798 803
799/*-------------------------------------------------------------------------*/ 804/*-------------------------------------------------------------------------*/
800 805
801static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) 806static int pxa25x_ep_set_halt(struct usb_ep *_ep, int value)
802{ 807{
803 struct pxa2xx_ep *ep; 808 struct pxa25x_ep *ep;
804 unsigned long flags; 809 unsigned long flags;
805 810
806 ep = container_of(_ep, struct pxa2xx_ep, ep); 811 ep = container_of(_ep, struct pxa25x_ep, ep);
807 if (unlikely (!_ep 812 if (unlikely (!_ep
808 || (!ep->desc && ep->ep.name != ep0name)) 813 || (!ep->desc && ep->ep.name != ep0name))
809 || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { 814 || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
@@ -853,11 +858,11 @@ static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value)
853 return 0; 858 return 0;
854} 859}
855 860
856static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) 861static int pxa25x_ep_fifo_status(struct usb_ep *_ep)
857{ 862{
858 struct pxa2xx_ep *ep; 863 struct pxa25x_ep *ep;
859 864
860 ep = container_of(_ep, struct pxa2xx_ep, ep); 865 ep = container_of(_ep, struct pxa25x_ep, ep);
861 if (!_ep) { 866 if (!_ep) {
862 DMSG("%s, bad ep\n", __func__); 867 DMSG("%s, bad ep\n", __func__);
863 return -ENODEV; 868 return -ENODEV;
@@ -872,11 +877,11 @@ static int pxa2xx_ep_fifo_status(struct usb_ep *_ep)
872 return (*ep->reg_ubcr & 0xfff) + 1; 877 return (*ep->reg_ubcr & 0xfff) + 1;
873} 878}
874 879
875static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) 880static void pxa25x_ep_fifo_flush(struct usb_ep *_ep)
876{ 881{
877 struct pxa2xx_ep *ep; 882 struct pxa25x_ep *ep;
878 883
879 ep = container_of(_ep, struct pxa2xx_ep, ep); 884 ep = container_of(_ep, struct pxa25x_ep, ep);
880 if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { 885 if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) {
881 DMSG("%s, bad ep\n", __func__); 886 DMSG("%s, bad ep\n", __func__);
882 return; 887 return;
@@ -898,19 +903,19 @@ static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep)
898} 903}
899 904
900 905
901static struct usb_ep_ops pxa2xx_ep_ops = { 906static struct usb_ep_ops pxa25x_ep_ops = {
902 .enable = pxa2xx_ep_enable, 907 .enable = pxa25x_ep_enable,
903 .disable = pxa2xx_ep_disable, 908 .disable = pxa25x_ep_disable,
904 909
905 .alloc_request = pxa2xx_ep_alloc_request, 910 .alloc_request = pxa25x_ep_alloc_request,
906 .free_request = pxa2xx_ep_free_request, 911 .free_request = pxa25x_ep_free_request,
907 912
908 .queue = pxa2xx_ep_queue, 913 .queue = pxa25x_ep_queue,
909 .dequeue = pxa2xx_ep_dequeue, 914 .dequeue = pxa25x_ep_dequeue,
910 915
911 .set_halt = pxa2xx_ep_set_halt, 916 .set_halt = pxa25x_ep_set_halt,
912 .fifo_status = pxa2xx_ep_fifo_status, 917 .fifo_status = pxa25x_ep_fifo_status,
913 .fifo_flush = pxa2xx_ep_fifo_flush, 918 .fifo_flush = pxa25x_ep_fifo_flush,
914}; 919};
915 920
916 921
@@ -919,12 +924,12 @@ static struct usb_ep_ops pxa2xx_ep_ops = {
919 * --------------------------------------------------------------------------- 924 * ---------------------------------------------------------------------------
920 */ 925 */
921 926
922static int pxa2xx_udc_get_frame(struct usb_gadget *_gadget) 927static int pxa25x_udc_get_frame(struct usb_gadget *_gadget)
923{ 928{
924 return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff); 929 return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff);
925} 930}
926 931
927static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget) 932static int pxa25x_udc_wakeup(struct usb_gadget *_gadget)
928{ 933{
929 /* host may not have enabled remote wakeup */ 934 /* host may not have enabled remote wakeup */
930 if ((UDCCS0 & UDCCS0_DRWF) == 0) 935 if ((UDCCS0 & UDCCS0_DRWF) == 0)
@@ -933,14 +938,14 @@ static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget)
933 return 0; 938 return 0;
934} 939}
935 940
936static void stop_activity(struct pxa2xx_udc *, struct usb_gadget_driver *); 941static void stop_activity(struct pxa25x_udc *, struct usb_gadget_driver *);
937static void udc_enable (struct pxa2xx_udc *); 942static void udc_enable (struct pxa25x_udc *);
938static void udc_disable(struct pxa2xx_udc *); 943static void udc_disable(struct pxa25x_udc *);
939 944
940/* We disable the UDC -- and its 48 MHz clock -- whenever it's not 945/* We disable the UDC -- and its 48 MHz clock -- whenever it's not
941 * in active use. 946 * in active use.
942 */ 947 */
943static int pullup(struct pxa2xx_udc *udc) 948static int pullup(struct pxa25x_udc *udc)
944{ 949{
945 int is_active = udc->vbus && udc->pullup && !udc->suspended; 950 int is_active = udc->vbus && udc->pullup && !udc->suspended;
946 DMSG("%s\n", is_active ? "active" : "inactive"); 951 DMSG("%s\n", is_active ? "active" : "inactive");
@@ -970,11 +975,11 @@ static int pullup(struct pxa2xx_udc *udc)
970} 975}
971 976
972/* VBUS reporting logically comes from a transceiver */ 977/* VBUS reporting logically comes from a transceiver */
973static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) 978static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
974{ 979{
975 struct pxa2xx_udc *udc; 980 struct pxa25x_udc *udc;
976 981
977 udc = container_of(_gadget, struct pxa2xx_udc, gadget); 982 udc = container_of(_gadget, struct pxa25x_udc, gadget);
978 udc->vbus = (is_active != 0); 983 udc->vbus = (is_active != 0);
979 DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); 984 DMSG("vbus %s\n", is_active ? "supplied" : "inactive");
980 pullup(udc); 985 pullup(udc);
@@ -982,11 +987,11 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
982} 987}
983 988
984/* drivers may have software control over D+ pullup */ 989/* drivers may have software control over D+ pullup */
985static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) 990static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
986{ 991{
987 struct pxa2xx_udc *udc; 992 struct pxa25x_udc *udc;
988 993
989 udc = container_of(_gadget, struct pxa2xx_udc, gadget); 994 udc = container_of(_gadget, struct pxa25x_udc, gadget);
990 995
991 /* not all boards support pullup control */ 996 /* not all boards support pullup control */
992 if (!udc->mach->gpio_pullup && !udc->mach->udc_command) 997 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
@@ -997,11 +1002,11 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active)
997 return 0; 1002 return 0;
998} 1003}
999 1004
1000static const struct usb_gadget_ops pxa2xx_udc_ops = { 1005static const struct usb_gadget_ops pxa25x_udc_ops = {
1001 .get_frame = pxa2xx_udc_get_frame, 1006 .get_frame = pxa25x_udc_get_frame,
1002 .wakeup = pxa2xx_udc_wakeup, 1007 .wakeup = pxa25x_udc_wakeup,
1003 .vbus_session = pxa2xx_udc_vbus_session, 1008 .vbus_session = pxa25x_udc_vbus_session,
1004 .pullup = pxa2xx_udc_pullup, 1009 .pullup = pxa25x_udc_pullup,
1005 1010
1006 // .vbus_draw ... boards may consume current from VBUS, up to 1011 // .vbus_draw ... boards may consume current from VBUS, up to
1007 // 100-500mA based on config. the 500uA suspend ceiling means 1012 // 100-500mA based on config. the 500uA suspend ceiling means
@@ -1015,7 +1020,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = {
1015static int 1020static int
1016udc_seq_show(struct seq_file *m, void *_d) 1021udc_seq_show(struct seq_file *m, void *_d)
1017{ 1022{
1018 struct pxa2xx_udc *dev = m->private; 1023 struct pxa25x_udc *dev = m->private;
1019 unsigned long flags; 1024 unsigned long flags;
1020 int i; 1025 int i;
1021 u32 tmp; 1026 u32 tmp;
@@ -1076,8 +1081,8 @@ udc_seq_show(struct seq_file *m, void *_d)
1076 1081
1077 /* dump endpoint queues */ 1082 /* dump endpoint queues */
1078 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { 1083 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
1079 struct pxa2xx_ep *ep = &dev->ep [i]; 1084 struct pxa25x_ep *ep = &dev->ep [i];
1080 struct pxa2xx_request *req; 1085 struct pxa25x_request *req;
1081 1086
1082 if (i != 0) { 1087 if (i != 0) {
1083 const struct usb_endpoint_descriptor *desc; 1088 const struct usb_endpoint_descriptor *desc;
@@ -1150,7 +1155,7 @@ static const struct file_operations debug_fops = {
1150/* 1155/*
1151 * udc_disable - disable USB device controller 1156 * udc_disable - disable USB device controller
1152 */ 1157 */
1153static void udc_disable(struct pxa2xx_udc *dev) 1158static void udc_disable(struct pxa25x_udc *dev)
1154{ 1159{
1155 /* block all irqs */ 1160 /* block all irqs */
1156 udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM); 1161 udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM);
@@ -1170,7 +1175,7 @@ static void udc_disable(struct pxa2xx_udc *dev)
1170/* 1175/*
1171 * udc_reinit - initialize software state 1176 * udc_reinit - initialize software state
1172 */ 1177 */
1173static void udc_reinit(struct pxa2xx_udc *dev) 1178static void udc_reinit(struct pxa25x_udc *dev)
1174{ 1179{
1175 u32 i; 1180 u32 i;
1176 1181
@@ -1181,7 +1186,7 @@ static void udc_reinit(struct pxa2xx_udc *dev)
1181 1186
1182 /* basic endpoint records init */ 1187 /* basic endpoint records init */
1183 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { 1188 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
1184 struct pxa2xx_ep *ep = &dev->ep[i]; 1189 struct pxa25x_ep *ep = &dev->ep[i];
1185 1190
1186 if (i != 0) 1191 if (i != 0)
1187 list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); 1192 list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list);
@@ -1198,7 +1203,7 @@ static void udc_reinit(struct pxa2xx_udc *dev)
1198/* until it's enabled, this UDC should be completely invisible 1203/* until it's enabled, this UDC should be completely invisible
1199 * to any USB host. 1204 * to any USB host.
1200 */ 1205 */
1201static void udc_enable (struct pxa2xx_udc *dev) 1206static void udc_enable (struct pxa25x_udc *dev)
1202{ 1207{
1203 udc_clear_mask_UDCCR(UDCCR_UDE); 1208 udc_clear_mask_UDCCR(UDCCR_UDE);
1204 1209
@@ -1254,7 +1259,7 @@ static void udc_enable (struct pxa2xx_udc *dev)
1254 */ 1259 */
1255int usb_gadget_register_driver(struct usb_gadget_driver *driver) 1260int usb_gadget_register_driver(struct usb_gadget_driver *driver)
1256{ 1261{
1257 struct pxa2xx_udc *dev = the_controller; 1262 struct pxa25x_udc *dev = the_controller;
1258 int retval; 1263 int retval;
1259 1264
1260 if (!driver 1265 if (!driver
@@ -1299,7 +1304,7 @@ fail:
1299EXPORT_SYMBOL(usb_gadget_register_driver); 1304EXPORT_SYMBOL(usb_gadget_register_driver);
1300 1305
1301static void 1306static void
1302stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) 1307stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver)
1303{ 1308{
1304 int i; 1309 int i;
1305 1310
@@ -1310,7 +1315,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver)
1310 1315
1311 /* prevent new request submissions, kill any outstanding requests */ 1316 /* prevent new request submissions, kill any outstanding requests */
1312 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { 1317 for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) {
1313 struct pxa2xx_ep *ep = &dev->ep[i]; 1318 struct pxa25x_ep *ep = &dev->ep[i];
1314 1319
1315 ep->stopped = 1; 1320 ep->stopped = 1;
1316 nuke(ep, -ESHUTDOWN); 1321 nuke(ep, -ESHUTDOWN);
@@ -1327,7 +1332,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver)
1327 1332
1328int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) 1333int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
1329{ 1334{
1330 struct pxa2xx_udc *dev = the_controller; 1335 struct pxa25x_udc *dev = the_controller;
1331 1336
1332 if (!dev) 1337 if (!dev)
1333 return -ENODEV; 1338 return -ENODEV;
@@ -1364,7 +1369,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver);
1364static irqreturn_t 1369static irqreturn_t
1365lubbock_vbus_irq(int irq, void *_dev) 1370lubbock_vbus_irq(int irq, void *_dev)
1366{ 1371{
1367 struct pxa2xx_udc *dev = _dev; 1372 struct pxa25x_udc *dev = _dev;
1368 int vbus; 1373 int vbus;
1369 1374
1370 dev->stats.irqs++; 1375 dev->stats.irqs++;
@@ -1383,7 +1388,7 @@ lubbock_vbus_irq(int irq, void *_dev)
1383 return IRQ_NONE; 1388 return IRQ_NONE;
1384 } 1389 }
1385 1390
1386 pxa2xx_udc_vbus_session(&dev->gadget, vbus); 1391 pxa25x_udc_vbus_session(&dev->gadget, vbus);
1387 return IRQ_HANDLED; 1392 return IRQ_HANDLED;
1388} 1393}
1389 1394
@@ -1391,20 +1396,20 @@ lubbock_vbus_irq(int irq, void *_dev)
1391 1396
1392static irqreturn_t udc_vbus_irq(int irq, void *_dev) 1397static irqreturn_t udc_vbus_irq(int irq, void *_dev)
1393{ 1398{
1394 struct pxa2xx_udc *dev = _dev; 1399 struct pxa25x_udc *dev = _dev;
1395 int vbus = gpio_get_value(dev->mach->gpio_vbus); 1400 int vbus = gpio_get_value(dev->mach->gpio_vbus);
1396 1401
1397 if (dev->mach->gpio_vbus_inverted) 1402 if (dev->mach->gpio_vbus_inverted)
1398 vbus = !vbus; 1403 vbus = !vbus;
1399 1404
1400 pxa2xx_udc_vbus_session(&dev->gadget, vbus); 1405 pxa25x_udc_vbus_session(&dev->gadget, vbus);
1401 return IRQ_HANDLED; 1406 return IRQ_HANDLED;
1402} 1407}
1403 1408
1404 1409
1405/*-------------------------------------------------------------------------*/ 1410/*-------------------------------------------------------------------------*/
1406 1411
1407static inline void clear_ep_state (struct pxa2xx_udc *dev) 1412static inline void clear_ep_state (struct pxa25x_udc *dev)
1408{ 1413{
1409 unsigned i; 1414 unsigned i;
1410 1415
@@ -1417,7 +1422,7 @@ static inline void clear_ep_state (struct pxa2xx_udc *dev)
1417 1422
1418static void udc_watchdog(unsigned long _dev) 1423static void udc_watchdog(unsigned long _dev)
1419{ 1424{
1420 struct pxa2xx_udc *dev = (void *)_dev; 1425 struct pxa25x_udc *dev = (void *)_dev;
1421 1426
1422 local_irq_disable(); 1427 local_irq_disable();
1423 if (dev->ep0state == EP0_STALL 1428 if (dev->ep0state == EP0_STALL
@@ -1430,11 +1435,11 @@ static void udc_watchdog(unsigned long _dev)
1430 local_irq_enable(); 1435 local_irq_enable();
1431} 1436}
1432 1437
1433static void handle_ep0 (struct pxa2xx_udc *dev) 1438static void handle_ep0 (struct pxa25x_udc *dev)
1434{ 1439{
1435 u32 udccs0 = UDCCS0; 1440 u32 udccs0 = UDCCS0;
1436 struct pxa2xx_ep *ep = &dev->ep [0]; 1441 struct pxa25x_ep *ep = &dev->ep [0];
1437 struct pxa2xx_request *req; 1442 struct pxa25x_request *req;
1438 union { 1443 union {
1439 struct usb_ctrlrequest r; 1444 struct usb_ctrlrequest r;
1440 u8 raw [8]; 1445 u8 raw [8];
@@ -1444,7 +1449,7 @@ static void handle_ep0 (struct pxa2xx_udc *dev)
1444 if (list_empty(&ep->queue)) 1449 if (list_empty(&ep->queue))
1445 req = NULL; 1450 req = NULL;
1446 else 1451 else
1447 req = list_entry(ep->queue.next, struct pxa2xx_request, queue); 1452 req = list_entry(ep->queue.next, struct pxa25x_request, queue);
1448 1453
1449 /* clear stall status */ 1454 /* clear stall status */
1450 if (udccs0 & UDCCS0_SST) { 1455 if (udccs0 & UDCCS0_SST) {
@@ -1654,9 +1659,9 @@ stall:
1654 USIR0 = USIR0_IR0; 1659 USIR0 = USIR0_IR0;
1655} 1660}
1656 1661
1657static void handle_ep(struct pxa2xx_ep *ep) 1662static void handle_ep(struct pxa25x_ep *ep)
1658{ 1663{
1659 struct pxa2xx_request *req; 1664 struct pxa25x_request *req;
1660 int is_in = ep->bEndpointAddress & USB_DIR_IN; 1665 int is_in = ep->bEndpointAddress & USB_DIR_IN;
1661 int completed; 1666 int completed;
1662 u32 udccs, tmp; 1667 u32 udccs, tmp;
@@ -1665,7 +1670,7 @@ static void handle_ep(struct pxa2xx_ep *ep)
1665 completed = 0; 1670 completed = 0;
1666 if (likely (!list_empty(&ep->queue))) 1671 if (likely (!list_empty(&ep->queue)))
1667 req = list_entry(ep->queue.next, 1672 req = list_entry(ep->queue.next,
1668 struct pxa2xx_request, queue); 1673 struct pxa25x_request, queue);
1669 else 1674 else
1670 req = NULL; 1675 req = NULL;
1671 1676
@@ -1702,16 +1707,16 @@ static void handle_ep(struct pxa2xx_ep *ep)
1702} 1707}
1703 1708
1704/* 1709/*
1705 * pxa2xx_udc_irq - interrupt handler 1710 * pxa25x_udc_irq - interrupt handler
1706 * 1711 *
1707 * avoid delays in ep0 processing. the control handshaking isn't always 1712 * avoid delays in ep0 processing. the control handshaking isn't always
1708 * under software control (pxa250c0 and the pxa255 are better), and delays 1713 * under software control (pxa250c0 and the pxa255 are better), and delays
1709 * could cause usb protocol errors. 1714 * could cause usb protocol errors.
1710 */ 1715 */
1711static irqreturn_t 1716static irqreturn_t
1712pxa2xx_udc_irq(int irq, void *_dev) 1717pxa25x_udc_irq(int irq, void *_dev)
1713{ 1718{
1714 struct pxa2xx_udc *dev = _dev; 1719 struct pxa25x_udc *dev = _dev;
1715 int handled; 1720 int handled;
1716 1721
1717 dev->stats.irqs++; 1722 dev->stats.irqs++;
@@ -1820,9 +1825,9 @@ static void nop_release (struct device *dev)
1820 * doing it at run-time) to save code, eliminate fault paths, and 1825 * doing it at run-time) to save code, eliminate fault paths, and
1821 * be more obviously correct. 1826 * be more obviously correct.
1822 */ 1827 */
1823static struct pxa2xx_udc memory = { 1828static struct pxa25x_udc memory = {
1824 .gadget = { 1829 .gadget = {
1825 .ops = &pxa2xx_udc_ops, 1830 .ops = &pxa25x_udc_ops,
1826 .ep0 = &memory.ep[0].ep, 1831 .ep0 = &memory.ep[0].ep,
1827 .name = driver_name, 1832 .name = driver_name,
1828 .dev = { 1833 .dev = {
@@ -1835,7 +1840,7 @@ static struct pxa2xx_udc memory = {
1835 .ep[0] = { 1840 .ep[0] = {
1836 .ep = { 1841 .ep = {
1837 .name = ep0name, 1842 .name = ep0name,
1838 .ops = &pxa2xx_ep_ops, 1843 .ops = &pxa25x_ep_ops,
1839 .maxpacket = EP0_FIFO_SIZE, 1844 .maxpacket = EP0_FIFO_SIZE,
1840 }, 1845 },
1841 .dev = &memory, 1846 .dev = &memory,
@@ -1847,7 +1852,7 @@ static struct pxa2xx_udc memory = {
1847 .ep[1] = { 1852 .ep[1] = {
1848 .ep = { 1853 .ep = {
1849 .name = "ep1in-bulk", 1854 .name = "ep1in-bulk",
1850 .ops = &pxa2xx_ep_ops, 1855 .ops = &pxa25x_ep_ops,
1851 .maxpacket = BULK_FIFO_SIZE, 1856 .maxpacket = BULK_FIFO_SIZE,
1852 }, 1857 },
1853 .dev = &memory, 1858 .dev = &memory,
@@ -1860,7 +1865,7 @@ static struct pxa2xx_udc memory = {
1860 .ep[2] = { 1865 .ep[2] = {
1861 .ep = { 1866 .ep = {
1862 .name = "ep2out-bulk", 1867 .name = "ep2out-bulk",
1863 .ops = &pxa2xx_ep_ops, 1868 .ops = &pxa25x_ep_ops,
1864 .maxpacket = BULK_FIFO_SIZE, 1869 .maxpacket = BULK_FIFO_SIZE,
1865 }, 1870 },
1866 .dev = &memory, 1871 .dev = &memory,
@@ -1871,11 +1876,11 @@ static struct pxa2xx_udc memory = {
1871 .reg_ubcr = &UBCR2, 1876 .reg_ubcr = &UBCR2,
1872 .reg_uddr = &UDDR2, 1877 .reg_uddr = &UDDR2,
1873 }, 1878 },
1874#ifndef CONFIG_USB_PXA2XX_SMALL 1879#ifndef CONFIG_USB_PXA25X_SMALL
1875 .ep[3] = { 1880 .ep[3] = {
1876 .ep = { 1881 .ep = {
1877 .name = "ep3in-iso", 1882 .name = "ep3in-iso",
1878 .ops = &pxa2xx_ep_ops, 1883 .ops = &pxa25x_ep_ops,
1879 .maxpacket = ISO_FIFO_SIZE, 1884 .maxpacket = ISO_FIFO_SIZE,
1880 }, 1885 },
1881 .dev = &memory, 1886 .dev = &memory,
@@ -1888,7 +1893,7 @@ static struct pxa2xx_udc memory = {
1888 .ep[4] = { 1893 .ep[4] = {
1889 .ep = { 1894 .ep = {
1890 .name = "ep4out-iso", 1895 .name = "ep4out-iso",
1891 .ops = &pxa2xx_ep_ops, 1896 .ops = &pxa25x_ep_ops,
1892 .maxpacket = ISO_FIFO_SIZE, 1897 .maxpacket = ISO_FIFO_SIZE,
1893 }, 1898 },
1894 .dev = &memory, 1899 .dev = &memory,
@@ -1902,7 +1907,7 @@ static struct pxa2xx_udc memory = {
1902 .ep[5] = { 1907 .ep[5] = {
1903 .ep = { 1908 .ep = {
1904 .name = "ep5in-int", 1909 .name = "ep5in-int",
1905 .ops = &pxa2xx_ep_ops, 1910 .ops = &pxa25x_ep_ops,
1906 .maxpacket = INT_FIFO_SIZE, 1911 .maxpacket = INT_FIFO_SIZE,
1907 }, 1912 },
1908 .dev = &memory, 1913 .dev = &memory,
@@ -1917,7 +1922,7 @@ static struct pxa2xx_udc memory = {
1917 .ep[6] = { 1922 .ep[6] = {
1918 .ep = { 1923 .ep = {
1919 .name = "ep6in-bulk", 1924 .name = "ep6in-bulk",
1920 .ops = &pxa2xx_ep_ops, 1925 .ops = &pxa25x_ep_ops,
1921 .maxpacket = BULK_FIFO_SIZE, 1926 .maxpacket = BULK_FIFO_SIZE,
1922 }, 1927 },
1923 .dev = &memory, 1928 .dev = &memory,
@@ -1930,7 +1935,7 @@ static struct pxa2xx_udc memory = {
1930 .ep[7] = { 1935 .ep[7] = {
1931 .ep = { 1936 .ep = {
1932 .name = "ep7out-bulk", 1937 .name = "ep7out-bulk",
1933 .ops = &pxa2xx_ep_ops, 1938 .ops = &pxa25x_ep_ops,
1934 .maxpacket = BULK_FIFO_SIZE, 1939 .maxpacket = BULK_FIFO_SIZE,
1935 }, 1940 },
1936 .dev = &memory, 1941 .dev = &memory,
@@ -1944,7 +1949,7 @@ static struct pxa2xx_udc memory = {
1944 .ep[8] = { 1949 .ep[8] = {
1945 .ep = { 1950 .ep = {
1946 .name = "ep8in-iso", 1951 .name = "ep8in-iso",
1947 .ops = &pxa2xx_ep_ops, 1952 .ops = &pxa25x_ep_ops,
1948 .maxpacket = ISO_FIFO_SIZE, 1953 .maxpacket = ISO_FIFO_SIZE,
1949 }, 1954 },
1950 .dev = &memory, 1955 .dev = &memory,
@@ -1957,7 +1962,7 @@ static struct pxa2xx_udc memory = {
1957 .ep[9] = { 1962 .ep[9] = {
1958 .ep = { 1963 .ep = {
1959 .name = "ep9out-iso", 1964 .name = "ep9out-iso",
1960 .ops = &pxa2xx_ep_ops, 1965 .ops = &pxa25x_ep_ops,
1961 .maxpacket = ISO_FIFO_SIZE, 1966 .maxpacket = ISO_FIFO_SIZE,
1962 }, 1967 },
1963 .dev = &memory, 1968 .dev = &memory,
@@ -1971,7 +1976,7 @@ static struct pxa2xx_udc memory = {
1971 .ep[10] = { 1976 .ep[10] = {
1972 .ep = { 1977 .ep = {
1973 .name = "ep10in-int", 1978 .name = "ep10in-int",
1974 .ops = &pxa2xx_ep_ops, 1979 .ops = &pxa25x_ep_ops,
1975 .maxpacket = INT_FIFO_SIZE, 1980 .maxpacket = INT_FIFO_SIZE,
1976 }, 1981 },
1977 .dev = &memory, 1982 .dev = &memory,
@@ -1986,7 +1991,7 @@ static struct pxa2xx_udc memory = {
1986 .ep[11] = { 1991 .ep[11] = {
1987 .ep = { 1992 .ep = {
1988 .name = "ep11in-bulk", 1993 .name = "ep11in-bulk",
1989 .ops = &pxa2xx_ep_ops, 1994 .ops = &pxa25x_ep_ops,
1990 .maxpacket = BULK_FIFO_SIZE, 1995 .maxpacket = BULK_FIFO_SIZE,
1991 }, 1996 },
1992 .dev = &memory, 1997 .dev = &memory,
@@ -1999,7 +2004,7 @@ static struct pxa2xx_udc memory = {
1999 .ep[12] = { 2004 .ep[12] = {
2000 .ep = { 2005 .ep = {
2001 .name = "ep12out-bulk", 2006 .name = "ep12out-bulk",
2002 .ops = &pxa2xx_ep_ops, 2007 .ops = &pxa25x_ep_ops,
2003 .maxpacket = BULK_FIFO_SIZE, 2008 .maxpacket = BULK_FIFO_SIZE,
2004 }, 2009 },
2005 .dev = &memory, 2010 .dev = &memory,
@@ -2013,7 +2018,7 @@ static struct pxa2xx_udc memory = {
2013 .ep[13] = { 2018 .ep[13] = {
2014 .ep = { 2019 .ep = {
2015 .name = "ep13in-iso", 2020 .name = "ep13in-iso",
2016 .ops = &pxa2xx_ep_ops, 2021 .ops = &pxa25x_ep_ops,
2017 .maxpacket = ISO_FIFO_SIZE, 2022 .maxpacket = ISO_FIFO_SIZE,
2018 }, 2023 },
2019 .dev = &memory, 2024 .dev = &memory,
@@ -2026,7 +2031,7 @@ static struct pxa2xx_udc memory = {
2026 .ep[14] = { 2031 .ep[14] = {
2027 .ep = { 2032 .ep = {
2028 .name = "ep14out-iso", 2033 .name = "ep14out-iso",
2029 .ops = &pxa2xx_ep_ops, 2034 .ops = &pxa25x_ep_ops,
2030 .maxpacket = ISO_FIFO_SIZE, 2035 .maxpacket = ISO_FIFO_SIZE,
2031 }, 2036 },
2032 .dev = &memory, 2037 .dev = &memory,
@@ -2040,7 +2045,7 @@ static struct pxa2xx_udc memory = {
2040 .ep[15] = { 2045 .ep[15] = {
2041 .ep = { 2046 .ep = {
2042 .name = "ep15in-int", 2047 .name = "ep15in-int",
2043 .ops = &pxa2xx_ep_ops, 2048 .ops = &pxa25x_ep_ops,
2044 .maxpacket = INT_FIFO_SIZE, 2049 .maxpacket = INT_FIFO_SIZE,
2045 }, 2050 },
2046 .dev = &memory, 2051 .dev = &memory,
@@ -2050,7 +2055,7 @@ static struct pxa2xx_udc memory = {
2050 .reg_udccs = &UDCCS15, 2055 .reg_udccs = &UDCCS15,
2051 .reg_uddr = &UDDR15, 2056 .reg_uddr = &UDDR15,
2052 }, 2057 },
2053#endif /* !CONFIG_USB_PXA2XX_SMALL */ 2058#endif /* !CONFIG_USB_PXA25X_SMALL */
2054}; 2059};
2055 2060
2056#define CP15R0_VENDOR_MASK 0xffffe000 2061#define CP15R0_VENDOR_MASK 0xffffe000
@@ -2090,9 +2095,9 @@ static struct pxa2xx_udc memory = {
2090/* 2095/*
2091 * probe - binds to the platform device 2096 * probe - binds to the platform device
2092 */ 2097 */
2093static int __init pxa2xx_udc_probe(struct platform_device *pdev) 2098static int __init pxa25x_udc_probe(struct platform_device *pdev)
2094{ 2099{
2095 struct pxa2xx_udc *dev = &memory; 2100 struct pxa25x_udc *dev = &memory;
2096 int retval, vbus_irq, irq; 2101 int retval, vbus_irq, irq;
2097 u32 chiprev; 2102 u32 chiprev;
2098 2103
@@ -2155,7 +2160,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2155 2160
2156 if (dev->mach->gpio_vbus) { 2161 if (dev->mach->gpio_vbus) {
2157 if ((retval = gpio_request(dev->mach->gpio_vbus, 2162 if ((retval = gpio_request(dev->mach->gpio_vbus,
2158 "pxa2xx_udc GPIO VBUS"))) { 2163 "pxa25x_udc GPIO VBUS"))) {
2159 dev_dbg(&pdev->dev, 2164 dev_dbg(&pdev->dev,
2160 "can't get vbus gpio %d, err: %d\n", 2165 "can't get vbus gpio %d, err: %d\n",
2161 dev->mach->gpio_vbus, retval); 2166 dev->mach->gpio_vbus, retval);
@@ -2168,7 +2173,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2168 2173
2169 if (dev->mach->gpio_pullup) { 2174 if (dev->mach->gpio_pullup) {
2170 if ((retval = gpio_request(dev->mach->gpio_pullup, 2175 if ((retval = gpio_request(dev->mach->gpio_pullup,
2171 "pca2xx_udc GPIO PULLUP"))) { 2176 "pca25x_udc GPIO PULLUP"))) {
2172 dev_dbg(&pdev->dev, 2177 dev_dbg(&pdev->dev,
2173 "can't get pullup gpio %d, err: %d\n", 2178 "can't get pullup gpio %d, err: %d\n",
2174 dev->mach->gpio_pullup, retval); 2179 dev->mach->gpio_pullup, retval);
@@ -2194,7 +2199,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev)
2194 dev->vbus = is_vbus_present(); 2199 dev->vbus = is_vbus_present();
2195 2200
2196 /* irq setup after old hardware state is cleaned up */ 2201 /* irq setup after old hardware state is cleaned up */
2197 retval = request_irq(irq, pxa2xx_udc_irq, 2202 retval = request_irq(irq, pxa25x_udc_irq,
2198 IRQF_DISABLED, driver_name, dev); 2203 IRQF_DISABLED, driver_name, dev);
2199 if (retval != 0) { 2204 if (retval != 0) {
2200 pr_err("%s: can't get irq %d, err %d\n", 2205 pr_err("%s: can't get irq %d, err %d\n",
@@ -2260,14 +2265,14 @@ lubbock_fail0:
2260 return retval; 2265 return retval;
2261} 2266}
2262 2267
2263static void pxa2xx_udc_shutdown(struct platform_device *_dev) 2268static void pxa25x_udc_shutdown(struct platform_device *_dev)
2264{ 2269{
2265 pullup_off(); 2270 pullup_off();
2266} 2271}
2267 2272
2268static int __exit pxa2xx_udc_remove(struct platform_device *pdev) 2273static int __exit pxa25x_udc_remove(struct platform_device *pdev)
2269{ 2274{
2270 struct pxa2xx_udc *dev = platform_get_drvdata(pdev); 2275 struct pxa25x_udc *dev = platform_get_drvdata(pdev);
2271 2276
2272 if (dev->driver) 2277 if (dev->driver)
2273 return -EBUSY; 2278 return -EBUSY;
@@ -2317,9 +2322,9 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev)
2317 * VBUS IRQs should probably be ignored so that the PXA device just acts 2322 * VBUS IRQs should probably be ignored so that the PXA device just acts
2318 * "dead" to USB hosts until system resume. 2323 * "dead" to USB hosts until system resume.
2319 */ 2324 */
2320static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) 2325static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state)
2321{ 2326{
2322 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2327 struct pxa25x_udc *udc = platform_get_drvdata(dev);
2323 unsigned long flags; 2328 unsigned long flags;
2324 2329
2325 if (!udc->mach->gpio_pullup && !udc->mach->udc_command) 2330 if (!udc->mach->gpio_pullup && !udc->mach->udc_command)
@@ -2333,9 +2338,9 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state)
2333 return 0; 2338 return 0;
2334} 2339}
2335 2340
2336static int pxa2xx_udc_resume(struct platform_device *dev) 2341static int pxa25x_udc_resume(struct platform_device *dev)
2337{ 2342{
2338 struct pxa2xx_udc *udc = platform_get_drvdata(dev); 2343 struct pxa25x_udc *udc = platform_get_drvdata(dev);
2339 unsigned long flags; 2344 unsigned long flags;
2340 2345
2341 udc->suspended = 0; 2346 udc->suspended = 0;
@@ -2347,27 +2352,27 @@ static int pxa2xx_udc_resume(struct platform_device *dev)
2347} 2352}
2348 2353
2349#else 2354#else
2350#define pxa2xx_udc_suspend NULL 2355#define pxa25x_udc_suspend NULL
2351#define pxa2xx_udc_resume NULL 2356#define pxa25x_udc_resume NULL
2352#endif 2357#endif
2353 2358
2354/*-------------------------------------------------------------------------*/ 2359/*-------------------------------------------------------------------------*/
2355 2360
2356static struct platform_driver udc_driver = { 2361static struct platform_driver udc_driver = {
2357 .shutdown = pxa2xx_udc_shutdown, 2362 .shutdown = pxa25x_udc_shutdown,
2358 .remove = __exit_p(pxa2xx_udc_remove), 2363 .remove = __exit_p(pxa25x_udc_remove),
2359 .suspend = pxa2xx_udc_suspend, 2364 .suspend = pxa25x_udc_suspend,
2360 .resume = pxa2xx_udc_resume, 2365 .resume = pxa25x_udc_resume,
2361 .driver = { 2366 .driver = {
2362 .owner = THIS_MODULE, 2367 .owner = THIS_MODULE,
2363 .name = "pxa2xx-udc", 2368 .name = "pxa25x-udc",
2364 }, 2369 },
2365}; 2370};
2366 2371
2367static int __init udc_init(void) 2372static int __init udc_init(void)
2368{ 2373{
2369 pr_info("%s: version %s\n", driver_name, DRIVER_VERSION); 2374 pr_info("%s: version %s\n", driver_name, DRIVER_VERSION);
2370 return platform_driver_probe(&udc_driver, pxa2xx_udc_probe); 2375 return platform_driver_probe(&udc_driver, pxa25x_udc_probe);
2371} 2376}
2372module_init(udc_init); 2377module_init(udc_init);
2373 2378
@@ -2380,4 +2385,4 @@ module_exit(udc_exit);
2380MODULE_DESCRIPTION(DRIVER_DESC); 2385MODULE_DESCRIPTION(DRIVER_DESC);
2381MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); 2386MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell");
2382MODULE_LICENSE("GPL"); 2387MODULE_LICENSE("GPL");
2383MODULE_ALIAS("platform:pxa2xx-udc"); 2388MODULE_ALIAS("platform:pxa25x-udc");
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa25x_udc.h
index e2c19e88c875..4d11ece7c95f 100644
--- a/drivers/usb/gadget/pxa2xx_udc.h
+++ b/drivers/usb/gadget/pxa25x_udc.h
@@ -1,6 +1,5 @@
1/* 1/*
2 * linux/drivers/usb/gadget/pxa2xx_udc.h 2 * Intel PXA25x on-chip full speed USB device controller
3 * Intel PXA2xx on-chip full speed USB device controller
4 * 3 *
5 * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix 4 * Copyright (C) 2003 Robert Schwebel <r.schwebel@pengutronix.de>, Pengutronix
6 * Copyright (C) 2003 David Brownell 5 * Copyright (C) 2003 David Brownell
@@ -21,14 +20,14 @@
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 21 */
23 22
24#ifndef __LINUX_USB_GADGET_PXA2XX_H 23#ifndef __LINUX_USB_GADGET_PXA25X_H
25#define __LINUX_USB_GADGET_PXA2XX_H 24#define __LINUX_USB_GADGET_PXA25X_H
26 25
27#include <linux/types.h> 26#include <linux/types.h>
28 27
29/*-------------------------------------------------------------------------*/ 28/*-------------------------------------------------------------------------*/
30 29
31/* pxa2xx has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */ 30/* pxa25x has this (move to include/asm-arm/arch-pxa/pxa-regs.h) */
32#define UFNRH_SIR (1 << 7) /* SOF interrupt request */ 31#define UFNRH_SIR (1 << 7) /* SOF interrupt request */
33#define UFNRH_SIM (1 << 6) /* SOF interrupt mask */ 32#define UFNRH_SIM (1 << 6) /* SOF interrupt mask */
34#define UFNRH_IPE14 (1 << 5) /* ISO packet error, ep14 */ 33#define UFNRH_IPE14 (1 << 5) /* ISO packet error, ep14 */
@@ -45,11 +44,11 @@
45 44
46/*-------------------------------------------------------------------------*/ 45/*-------------------------------------------------------------------------*/
47 46
48struct pxa2xx_udc; 47struct pxa25x_udc;
49 48
50struct pxa2xx_ep { 49struct pxa25x_ep {
51 struct usb_ep ep; 50 struct usb_ep ep;
52 struct pxa2xx_udc *dev; 51 struct pxa25x_udc *dev;
53 52
54 const struct usb_endpoint_descriptor *desc; 53 const struct usb_endpoint_descriptor *desc;
55 struct list_head queue; 54 struct list_head queue;
@@ -72,7 +71,7 @@ struct pxa2xx_ep {
72 volatile u32 *reg_uddr; 71 volatile u32 *reg_uddr;
73}; 72};
74 73
75struct pxa2xx_request { 74struct pxa25x_request {
76 struct usb_request req; 75 struct usb_request req;
77 struct list_head queue; 76 struct list_head queue;
78}; 77};
@@ -98,7 +97,7 @@ struct udc_stats {
98 unsigned long irqs; 97 unsigned long irqs;
99}; 98};
100 99
101#ifdef CONFIG_USB_PXA2XX_SMALL 100#ifdef CONFIG_USB_PXA25X_SMALL
102/* when memory's tight, SMALL config saves code+data. */ 101/* when memory's tight, SMALL config saves code+data. */
103#define PXA_UDC_NUM_ENDPOINTS 3 102#define PXA_UDC_NUM_ENDPOINTS 3
104#endif 103#endif
@@ -107,7 +106,7 @@ struct udc_stats {
107#define PXA_UDC_NUM_ENDPOINTS 16 106#define PXA_UDC_NUM_ENDPOINTS 16
108#endif 107#endif
109 108
110struct pxa2xx_udc { 109struct pxa25x_udc {
111 struct usb_gadget gadget; 110 struct usb_gadget gadget;
112 struct usb_gadget_driver *driver; 111 struct usb_gadget_driver *driver;
113 112
@@ -130,7 +129,7 @@ struct pxa2xx_udc {
130 struct clk *clk; 129 struct clk *clk;
131 struct pxa2xx_udc_mach_info *mach; 130 struct pxa2xx_udc_mach_info *mach;
132 u64 dma_mask; 131 u64 dma_mask;
133 struct pxa2xx_ep ep [PXA_UDC_NUM_ENDPOINTS]; 132 struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS];
134 133
135#ifdef CONFIG_USB_GADGET_DEBUG_FS 134#ifdef CONFIG_USB_GADGET_DEBUG_FS
136 struct dentry *debugfs_udc; 135 struct dentry *debugfs_udc;
@@ -144,7 +143,7 @@ struct pxa2xx_udc {
144/* lubbock can also report usb connect/disconnect irqs */ 143/* lubbock can also report usb connect/disconnect irqs */
145#endif 144#endif
146 145
147static struct pxa2xx_udc *the_controller; 146static struct pxa25x_udc *the_controller;
148 147
149/*-------------------------------------------------------------------------*/ 148/*-------------------------------------------------------------------------*/
150 149
@@ -209,7 +208,7 @@ dump_udccs0(const char *label)
209} 208}
210 209
211static void __maybe_unused 210static void __maybe_unused
212dump_state(struct pxa2xx_udc *dev) 211dump_state(struct pxa25x_udc *dev)
213{ 212{
214 u32 tmp; 213 u32 tmp;
215 unsigned i; 214 unsigned i;
@@ -264,4 +263,4 @@ dump_state(struct pxa2xx_udc *dev)
264#define INFO(stuff...) pr_info("udc: " stuff) 263#define INFO(stuff...) pr_info("udc: " stuff)
265 264
266 265
267#endif /* __LINUX_USB_GADGET_PXA2XX_H */ 266#endif /* __LINUX_USB_GADGET_PXA25X_H */
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index e02bfd4df3a6..9c0e82ec5c43 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -38,7 +38,7 @@
38#include <linux/usb.h> 38#include <linux/usb.h>
39#include <linux/usb/ch9.h> 39#include <linux/usb/ch9.h>
40#include <linux/usb/gadget.h> 40#include <linux/usb/gadget.h>
41 41#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */
42#include <asm/arch/udc.h> 42#include <asm/arch/udc.h>
43 43
44#include "pxa27x_udc.h" 44#include "pxa27x_udc.h"
@@ -2360,18 +2360,19 @@ static int pxa_udc_resume(struct platform_device *_dev)
2360 * Software must configure the USB OTG pad, UDC, and UHC 2360 * Software must configure the USB OTG pad, UDC, and UHC
2361 * to the state they were in before entering sleep mode. 2361 * to the state they were in before entering sleep mode.
2362 */ 2362 */
2363 PSSR |= PSSR_OTGPH; 2363 if (cpu_is_pxa27x())
2364 PSSR |= PSSR_OTGPH;
2364 2365
2365 return 0; 2366 return 0;
2366} 2367}
2367#endif 2368#endif
2368 2369
2369/* work with hotplug and coldplug */ 2370/* work with hotplug and coldplug */
2370MODULE_ALIAS("platform:pxa2xx-udc"); 2371MODULE_ALIAS("platform:pxa27x-udc");
2371 2372
2372static struct platform_driver udc_driver = { 2373static struct platform_driver udc_driver = {
2373 .driver = { 2374 .driver = {
2374 .name = "pxa2xx-udc", 2375 .name = "pxa27x-udc",
2375 .owner = THIS_MODULE, 2376 .owner = THIS_MODULE,
2376 }, 2377 },
2377 .remove = __exit_p(pxa_udc_remove), 2378 .remove = __exit_p(pxa_udc_remove),
diff --git a/drivers/usb/gadget/pxa27x_udc.h b/drivers/usb/gadget/pxa27x_udc.h
index 97453db924ff..1d1b7936ee11 100644
--- a/drivers/usb/gadget/pxa27x_udc.h
+++ b/drivers/usb/gadget/pxa27x_udc.h
@@ -484,12 +484,4 @@ static inline struct pxa_udc *to_gadget_udc(struct usb_gadget *gadget)
484#define ep_warn(ep, fmt, arg...) \ 484#define ep_warn(ep, fmt, arg...) \
485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg) 485 dev_warn(ep->dev->dev, "%s:%s:" fmt, EPNAME(ep), __func__, ## arg)
486 486
487/*
488 * Cannot include pxa-regs.h, as register names are similar.
489 * So PSSR is redefined here. This should be removed once UDC registers will
490 * be gone from pxa-regs.h.
491 */
492#define PSSR __REG(0x40F00004) /* Power Manager Sleep Status */
493#define PSSR_OTGPH (1 << 6) /* OTG Peripheral Hold */
494
495#endif /* __LINUX_USB_GADGET_PXA27X_H */ 487#endif /* __LINUX_USB_GADGET_PXA27X_H */
diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c
index 70b0d4b459e7..08b27d6bbd43 100644
--- a/drivers/usb/host/ohci-pxa27x.c
+++ b/drivers/usb/host/ohci-pxa27x.c
@@ -27,6 +27,7 @@
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/hardware.h> 28#include <asm/hardware.h>
29#include <asm/arch/pxa-regs.h> 29#include <asm/arch/pxa-regs.h>
30#include <asm/arch/pxa2xx-regs.h> /* FIXME: for PSSR */
30#include <asm/arch/ohci.h> 31#include <asm/arch/ohci.h>
31 32
32#define PXA_UHC_MAX_PORTNUM 3 33#define PXA_UHC_MAX_PORTNUM 3
@@ -104,7 +105,7 @@ static int pxa27x_start_hc(struct device *dev)
104 UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE); 105 UHCHIE = (UHCHIE_UPRIE | UHCHIE_RWIE);
105 106
106 /* Clear any OTG Pin Hold */ 107 /* Clear any OTG Pin Hold */
107 if (PSSR & PSSR_OTGPH) 108 if (cpu_is_pxa27x() && (PSSR & PSSR_OTGPH))
108 PSSR |= PSSR_OTGPH; 109 PSSR |= PSSR_OTGPH;
109 110
110 return 0; 111 return 0;
diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index dcd8073c2369..30bf7f2f1635 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -112,3 +112,10 @@ config BACKLIGHT_CARILLO_RANCH
112 help 112 help
113 If you have a Intel LE80578 (Carillo Ranch) say Y to enable the 113 If you have a Intel LE80578 (Carillo Ranch) say Y to enable the
114 backlight driver. 114 backlight driver.
115
116config BACKLIGHT_PWM
117 tristate "Generic PWM based Backlight Driver"
118 depends on BACKLIGHT_CLASS_DEVICE && HAVE_PWM
119 help
120 If you have a LCD backlight adjustable by PWM, say Y to enable
121 this driver.
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index 33f6c7cecc73..b51a7cd12500 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o
10obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o 10obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
11obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o 11obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
12obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o 12obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
13obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
new file mode 100644
index 000000000000..6338d0e2fe07
--- /dev/null
+++ b/drivers/video/backlight/pwm_bl.c
@@ -0,0 +1,185 @@
1/*
2 * linux/drivers/video/backlight/pwm_bl.c
3 *
4 * simple PWM based backlight control, board code has to setup
5 * 1) pin configuration so PWM waveforms can output
6 * 2) platform_data casts to the PWM id (0/1/2/3 on PXA)
7 *
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.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/platform_device.h>
17#include <linux/fb.h>
18#include <linux/backlight.h>
19#include <linux/err.h>
20#include <linux/pwm.h>
21#include <linux/pwm_backlight.h>
22
23struct pwm_bl_data {
24 struct pwm_device *pwm;
25 unsigned int period;
26 int (*notify)(int brightness);
27};
28
29static int pwm_backlight_update_status(struct backlight_device *bl)
30{
31 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
32 int brightness = bl->props.brightness;
33 int max = bl->props.max_brightness;
34
35 if (bl->props.power != FB_BLANK_UNBLANK)
36 brightness = 0;
37
38 if (bl->props.fb_blank != FB_BLANK_UNBLANK)
39 brightness = 0;
40
41 if (pb->notify)
42 brightness = pb->notify(brightness);
43
44 if (brightness == 0) {
45 pwm_config(pb->pwm, 0, pb->period);
46 pwm_disable(pb->pwm);
47 } else {
48 pwm_config(pb->pwm, brightness * pb->period / max, pb->period);
49 pwm_enable(pb->pwm);
50 }
51 return 0;
52}
53
54static int pwm_backlight_get_brightness(struct backlight_device *bl)
55{
56 return bl->props.brightness;
57}
58
59static struct backlight_ops pwm_backlight_ops = {
60 .update_status = pwm_backlight_update_status,
61 .get_brightness = pwm_backlight_get_brightness,
62};
63
64static int pwm_backlight_probe(struct platform_device *pdev)
65{
66 struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
67 struct backlight_device *bl;
68 struct pwm_bl_data *pb;
69 int ret;
70
71 if (!data)
72 return -EINVAL;
73
74 if (data->init) {
75 ret = data->init(&pdev->dev);
76 if (ret < 0)
77 return ret;
78 }
79
80 pb = kzalloc(sizeof(*pb), GFP_KERNEL);
81 if (!pb) {
82 ret = -ENOMEM;
83 goto err_alloc;
84 }
85
86 pb->period = data->pwm_period_ns;
87 pb->notify = data->notify;
88
89 pb->pwm = pwm_request(data->pwm_id, "backlight");
90 if (IS_ERR(pb->pwm)) {
91 dev_err(&pdev->dev, "unable to request PWM for backlight\n");
92 ret = PTR_ERR(pb->pwm);
93 goto err_pwm;
94 }
95
96 bl = backlight_device_register(pdev->name, &pdev->dev,
97 pb, &pwm_backlight_ops);
98 if (IS_ERR(bl)) {
99 dev_err(&pdev->dev, "failed to register backlight\n");
100 ret = PTR_ERR(bl);
101 goto err_bl;
102 }
103
104 bl->props.max_brightness = data->max_brightness;
105 bl->props.brightness = data->dft_brightness;
106 backlight_update_status(bl);
107
108 platform_set_drvdata(pdev, bl);
109 return 0;
110
111err_bl:
112 pwm_free(pb->pwm);
113err_pwm:
114 kfree(pb);
115err_alloc:
116 if (data->exit)
117 data->exit(&pdev->dev);
118 return ret;
119}
120
121static int pwm_backlight_remove(struct platform_device *pdev)
122{
123 struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
124 struct backlight_device *bl = platform_get_drvdata(pdev);
125 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
126
127 backlight_device_unregister(bl);
128 pwm_config(pb->pwm, 0, pb->period);
129 pwm_disable(pb->pwm);
130 pwm_free(pb->pwm);
131 kfree(pb);
132 if (data->exit)
133 data->exit(&pdev->dev);
134 return 0;
135}
136
137#ifdef CONFIG_PM
138static int pwm_backlight_suspend(struct platform_device *pdev,
139 pm_message_t state)
140{
141 struct backlight_device *bl = platform_get_drvdata(pdev);
142 struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
143
144 pwm_config(pb->pwm, 0, pb->period);
145 pwm_disable(pb->pwm);
146 return 0;
147}
148
149static int pwm_backlight_resume(struct platform_device *pdev)
150{
151 struct backlight_device *bl = platform_get_drvdata(pdev);
152
153 backlight_update_status(bl);
154 return 0;
155}
156#else
157#define pwm_backlight_suspend NULL
158#define pwm_backlight_resume NULL
159#endif
160
161static struct platform_driver pwm_backlight_driver = {
162 .driver = {
163 .name = "pwm-backlight",
164 .owner = THIS_MODULE,
165 },
166 .probe = pwm_backlight_probe,
167 .remove = pwm_backlight_remove,
168 .suspend = pwm_backlight_suspend,
169 .resume = pwm_backlight_resume,
170};
171
172static int __init pwm_backlight_init(void)
173{
174 return platform_driver_register(&pwm_backlight_driver);
175}
176module_init(pwm_backlight_init);
177
178static void __exit pwm_backlight_exit(void)
179{
180 platform_driver_unregister(&pwm_backlight_driver);
181}
182module_exit(pwm_backlight_exit);
183
184MODULE_DESCRIPTION("PWM based Backlight Driver");
185MODULE_LICENSE("GPL");
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c
index fafe7db20d6d..d0746261c957 100644
--- a/drivers/video/pxafb.c
+++ b/drivers/video/pxafb.c
@@ -1792,11 +1792,49 @@ failed:
1792 return ret; 1792 return ret;
1793} 1793}
1794 1794
1795static int __devexit pxafb_remove(struct platform_device *dev)
1796{
1797 struct pxafb_info *fbi = platform_get_drvdata(dev);
1798 struct resource *r;
1799 int irq;
1800 struct fb_info *info;
1801
1802 if (!fbi)
1803 return 0;
1804
1805 info = &fbi->fb;
1806
1807 unregister_framebuffer(info);
1808
1809 pxafb_disable_controller(fbi);
1810
1811 if (fbi->fb.cmap.len)
1812 fb_dealloc_cmap(&fbi->fb.cmap);
1813
1814 irq = platform_get_irq(dev, 0);
1815 free_irq(irq, fbi);
1816
1817 dma_free_writecombine(&dev->dev, fbi->map_size,
1818 fbi->map_cpu, fbi->map_dma);
1819
1820 iounmap(fbi->mmio_base);
1821
1822 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
1823 release_mem_region(r->start, r->end - r->start + 1);
1824
1825 clk_put(fbi->clk);
1826 kfree(fbi);
1827
1828 return 0;
1829}
1830
1795static struct platform_driver pxafb_driver = { 1831static struct platform_driver pxafb_driver = {
1796 .probe = pxafb_probe, 1832 .probe = pxafb_probe,
1833 .remove = pxafb_remove,
1797 .suspend = pxafb_suspend, 1834 .suspend = pxafb_suspend,
1798 .resume = pxafb_resume, 1835 .resume = pxafb_resume,
1799 .driver = { 1836 .driver = {
1837 .owner = THIS_MODULE,
1800 .name = "pxa2xx-fb", 1838 .name = "pxa2xx-fb",
1801 }, 1839 },
1802}; 1840};
@@ -1809,7 +1847,13 @@ static int __init pxafb_init(void)
1809 return platform_driver_register(&pxafb_driver); 1847 return platform_driver_register(&pxafb_driver);
1810} 1848}
1811 1849
1850static void __exit pxafb_exit(void)
1851{
1852 platform_driver_unregister(&pxafb_driver);
1853}
1854
1812module_init(pxafb_init); 1855module_init(pxafb_init);
1856module_exit(pxafb_exit);
1813 1857
1814MODULE_DESCRIPTION("loadable framebuffer driver for PXA"); 1858MODULE_DESCRIPTION("loadable framebuffer driver for PXA");
1815MODULE_LICENSE("GPL"); 1859MODULE_LICENSE("GPL");