diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-07-13 07:05:49 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-13 07:05:49 -0400 |
commit | 044e5f45e4ad890d03bd1e8bb44c634397cac24d (patch) | |
tree | a6063f77bd719d933823915d2273eaadb6331611 /drivers | |
parent | f0006314d37639714da9658cf4ff3f1f9f420764 (diff) | |
parent | faf64ed4968e354624f330c6da6c1ce8b05a0713 (diff) |
Merge branch 'pxa' into devel
Conflicts:
arch/arm/configs/em_x270_defconfig
arch/arm/configs/xm_x270_defconfig
Diffstat (limited to 'drivers')
33 files changed, 1735 insertions, 446 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 | ||
44 | struct pxa_i2c { | 43 | struct 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 | ||
948 | static 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 | |||
965 | static 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) |
975 | static int i2c_pxa_probe(struct platform_device *dev) | 948 | static 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); |
1081 | ereqirq: | 1053 | ereqirq: |
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); |
1085 | eremap: | 1056 | eremap: |
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/input/keyboard/tosakbd.c b/drivers/input/keyboard/tosakbd.c index 94e444b4ee15..b12b7ee4b6aa 100644 --- a/drivers/input/keyboard/tosakbd.c +++ b/drivers/input/keyboard/tosakbd.c | |||
@@ -215,8 +215,6 @@ static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) | |||
215 | unsigned long flags; | 215 | unsigned long flags; |
216 | 216 | ||
217 | spin_lock_irqsave(&tosakbd->lock, flags); | 217 | spin_lock_irqsave(&tosakbd->lock, flags); |
218 | PGSR1 = (PGSR1 & ~TOSA_GPIO_LOW_STROBE_BIT); | ||
219 | PGSR2 = (PGSR2 & ~TOSA_GPIO_HIGH_STROBE_BIT); | ||
220 | tosakbd->suspended = 1; | 218 | tosakbd->suspended = 1; |
221 | spin_unlock_irqrestore(&tosakbd->lock, flags); | 219 | spin_unlock_irqrestore(&tosakbd->lock, flags); |
222 | 220 | ||
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index ae96bd6242f2..0f6a885a6c19 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig | |||
@@ -5,6 +5,10 @@ | |||
5 | menu "Multifunction device drivers" | 5 | menu "Multifunction device drivers" |
6 | depends on HAS_IOMEM | 6 | depends on HAS_IOMEM |
7 | 7 | ||
8 | config MFD_CORE | ||
9 | tristate | ||
10 | default n | ||
11 | |||
8 | config MFD_SM501 | 12 | config MFD_SM501 |
9 | tristate "Support for Silicon Motion SM501" | 13 | tristate "Support for Silicon Motion SM501" |
10 | ---help--- | 14 | ---help--- |
@@ -38,6 +42,13 @@ config HTC_PASIC3 | |||
38 | HTC Magician devices, respectively. Actual functionality is | 42 | HTC Magician devices, respectively. Actual functionality is |
39 | handled by the leds-pasic3 and ds1wm drivers. | 43 | handled by the leds-pasic3 and ds1wm drivers. |
40 | 44 | ||
45 | config MFD_TC6393XB | ||
46 | bool "Support Toshiba TC6393XB" | ||
47 | depends on HAVE_GPIO_LIB | ||
48 | select MFD_CORE | ||
49 | help | ||
50 | Support for Toshiba Mobile IO Controller TC6393XB | ||
51 | |||
41 | endmenu | 52 | endmenu |
42 | 53 | ||
43 | menu "Multimedia Capabilities Port drivers" | 54 | menu "Multimedia Capabilities Port drivers" |
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index eef4e26807df..33daa2f45dd8 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile | |||
@@ -8,6 +8,10 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o | |||
8 | obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o | 8 | obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o |
9 | obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o | 9 | obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o |
10 | 10 | ||
11 | obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o | ||
12 | |||
13 | obj-$(CONFIG_MFD_CORE) += mfd-core.o | ||
14 | |||
11 | obj-$(CONFIG_MCP) += mcp-core.o | 15 | obj-$(CONFIG_MCP) += mcp-core.o |
12 | obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o | 16 | obj-$(CONFIG_MCP_SA11X0) += mcp-sa11x0.o |
13 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o | 17 | obj-$(CONFIG_MCP_UCB1200) += ucb1x00-core.o |
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c new file mode 100644 index 000000000000..d7d88ce053a6 --- /dev/null +++ b/drivers/mfd/mfd-core.c | |||
@@ -0,0 +1,114 @@ | |||
1 | /* | ||
2 | * drivers/mfd/mfd-core.c | ||
3 | * | ||
4 | * core MFD support | ||
5 | * Copyright (c) 2006 Ian Molton | ||
6 | * Copyright (c) 2007,2008 Dmitry Baryshkov | ||
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 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/mfd/core.h> | ||
17 | |||
18 | static int mfd_add_device(struct platform_device *parent, | ||
19 | const struct mfd_cell *cell, | ||
20 | struct resource *mem_base, | ||
21 | int irq_base) | ||
22 | { | ||
23 | struct resource res[cell->num_resources]; | ||
24 | struct platform_device *pdev; | ||
25 | int ret = -ENOMEM; | ||
26 | int r; | ||
27 | |||
28 | pdev = platform_device_alloc(cell->name, parent->id); | ||
29 | if (!pdev) | ||
30 | goto fail_alloc; | ||
31 | |||
32 | pdev->dev.parent = &parent->dev; | ||
33 | |||
34 | ret = platform_device_add_data(pdev, | ||
35 | cell, sizeof(struct mfd_cell)); | ||
36 | if (ret) | ||
37 | goto fail_device; | ||
38 | |||
39 | memzero(res, sizeof(res)); | ||
40 | for (r = 0; r < cell->num_resources; r++) { | ||
41 | res[r].name = cell->resources[r].name; | ||
42 | res[r].flags = cell->resources[r].flags; | ||
43 | |||
44 | /* Find out base to use */ | ||
45 | if (cell->resources[r].flags & IORESOURCE_MEM) { | ||
46 | res[r].parent = mem_base; | ||
47 | res[r].start = mem_base->start + | ||
48 | cell->resources[r].start; | ||
49 | res[r].end = mem_base->start + | ||
50 | cell->resources[r].end; | ||
51 | } else if (cell->resources[r].flags & IORESOURCE_IRQ) { | ||
52 | res[r].start = irq_base + | ||
53 | cell->resources[r].start; | ||
54 | res[r].end = irq_base + | ||
55 | cell->resources[r].end; | ||
56 | } else { | ||
57 | res[r].parent = cell->resources[r].parent; | ||
58 | res[r].start = cell->resources[r].start; | ||
59 | res[r].end = cell->resources[r].end; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | platform_device_add_resources(pdev, res, cell->num_resources); | ||
64 | |||
65 | ret = platform_device_add(pdev); | ||
66 | if (ret) | ||
67 | goto fail_device; | ||
68 | |||
69 | return 0; | ||
70 | |||
71 | /* platform_device_del(pdev); */ | ||
72 | fail_device: | ||
73 | platform_device_put(pdev); | ||
74 | fail_alloc: | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | int mfd_add_devices( | ||
79 | struct platform_device *parent, | ||
80 | const struct mfd_cell *cells, int n_devs, | ||
81 | struct resource *mem_base, | ||
82 | int irq_base) | ||
83 | { | ||
84 | int i; | ||
85 | int ret = 0; | ||
86 | |||
87 | for (i = 0; i < n_devs; i++) { | ||
88 | ret = mfd_add_device(parent, cells + i, mem_base, irq_base); | ||
89 | if (ret) | ||
90 | break; | ||
91 | } | ||
92 | |||
93 | if (ret) | ||
94 | mfd_remove_devices(parent); | ||
95 | |||
96 | return ret; | ||
97 | } | ||
98 | EXPORT_SYMBOL(mfd_add_devices); | ||
99 | |||
100 | static int mfd_remove_devices_fn(struct device *dev, void *unused) | ||
101 | { | ||
102 | platform_device_unregister( | ||
103 | container_of(dev, struct platform_device, dev)); | ||
104 | return 0; | ||
105 | } | ||
106 | |||
107 | void mfd_remove_devices(struct platform_device *parent) | ||
108 | { | ||
109 | device_for_each_child(&parent->dev, NULL, mfd_remove_devices_fn); | ||
110 | } | ||
111 | EXPORT_SYMBOL(mfd_remove_devices); | ||
112 | |||
113 | MODULE_LICENSE("GPL"); | ||
114 | MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov"); | ||
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c new file mode 100644 index 000000000000..2d87501b6fd4 --- /dev/null +++ b/drivers/mfd/tc6393xb.c | |||
@@ -0,0 +1,600 @@ | |||
1 | /* | ||
2 | * Toshiba TC6393XB SoC support | ||
3 | * | ||
4 | * Copyright(c) 2005-2006 Chris Humbert | ||
5 | * Copyright(c) 2005 Dirk Opfer | ||
6 | * Copyright(c) 2005 Ian Molton <spyro@f2s.com> | ||
7 | * Copyright(c) 2007 Dmitry Baryshkov | ||
8 | * | ||
9 | * Based on code written by Sharp/Lineo for 2.4 kernels | ||
10 | * Based on locomo.c | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | */ | ||
16 | |||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/platform_device.h> | ||
22 | #include <linux/fb.h> | ||
23 | #include <linux/clk.h> | ||
24 | #include <linux/mfd/core.h> | ||
25 | #include <linux/mfd/tmio.h> | ||
26 | #include <linux/mfd/tc6393xb.h> | ||
27 | #include <linux/gpio.h> | ||
28 | |||
29 | #define SCR_REVID 0x08 /* b Revision ID */ | ||
30 | #define SCR_ISR 0x50 /* b Interrupt Status */ | ||
31 | #define SCR_IMR 0x52 /* b Interrupt Mask */ | ||
32 | #define SCR_IRR 0x54 /* b Interrupt Routing */ | ||
33 | #define SCR_GPER 0x60 /* w GP Enable */ | ||
34 | #define SCR_GPI_SR(i) (0x64 + (i)) /* b3 GPI Status */ | ||
35 | #define SCR_GPI_IMR(i) (0x68 + (i)) /* b3 GPI INT Mask */ | ||
36 | #define SCR_GPI_EDER(i) (0x6c + (i)) /* b3 GPI Edge Detect Enable */ | ||
37 | #define SCR_GPI_LIR(i) (0x70 + (i)) /* b3 GPI Level Invert */ | ||
38 | #define SCR_GPO_DSR(i) (0x78 + (i)) /* b3 GPO Data Set */ | ||
39 | #define SCR_GPO_DOECR(i) (0x7c + (i)) /* b3 GPO Data OE Control */ | ||
40 | #define SCR_GP_IARCR(i) (0x80 + (i)) /* b3 GP Internal Active Register Control */ | ||
41 | #define SCR_GP_IARLCR(i) (0x84 + (i)) /* b3 GP INTERNAL Active Register Level Control */ | ||
42 | #define SCR_GPI_BCR(i) (0x88 + (i)) /* b3 GPI Buffer Control */ | ||
43 | #define SCR_GPA_IARCR 0x8c /* w GPa Internal Active Register Control */ | ||
44 | #define SCR_GPA_IARLCR 0x90 /* w GPa Internal Active Register Level Control */ | ||
45 | #define SCR_GPA_BCR 0x94 /* w GPa Buffer Control */ | ||
46 | #define SCR_CCR 0x98 /* w Clock Control */ | ||
47 | #define SCR_PLL2CR 0x9a /* w PLL2 Control */ | ||
48 | #define SCR_PLL1CR 0x9c /* l PLL1 Control */ | ||
49 | #define SCR_DIARCR 0xa0 /* b Device Internal Active Register Control */ | ||
50 | #define SCR_DBOCR 0xa1 /* b Device Buffer Off Control */ | ||
51 | #define SCR_FER 0xe0 /* b Function Enable */ | ||
52 | #define SCR_MCR 0xe4 /* w Mode Control */ | ||
53 | #define SCR_CONFIG 0xfc /* b Configuration Control */ | ||
54 | #define SCR_DEBUG 0xff /* b Debug */ | ||
55 | |||
56 | #define SCR_CCR_CK32K BIT(0) | ||
57 | #define SCR_CCR_USBCK BIT(1) | ||
58 | #define SCR_CCR_UNK1 BIT(4) | ||
59 | #define SCR_CCR_MCLK_MASK (7 << 8) | ||
60 | #define SCR_CCR_MCLK_OFF (0 << 8) | ||
61 | #define SCR_CCR_MCLK_12 (1 << 8) | ||
62 | #define SCR_CCR_MCLK_24 (2 << 8) | ||
63 | #define SCR_CCR_MCLK_48 (3 << 8) | ||
64 | #define SCR_CCR_HCLK_MASK (3 << 12) | ||
65 | #define SCR_CCR_HCLK_24 (0 << 12) | ||
66 | #define SCR_CCR_HCLK_48 (1 << 12) | ||
67 | |||
68 | #define SCR_FER_USBEN BIT(0) /* USB host enable */ | ||
69 | #define SCR_FER_LCDCVEN BIT(1) /* polysilicon TFT enable */ | ||
70 | #define SCR_FER_SLCDEN BIT(2) /* SLCD enable */ | ||
71 | |||
72 | #define SCR_MCR_RDY_MASK (3 << 0) | ||
73 | #define SCR_MCR_RDY_OPENDRAIN (0 << 0) | ||
74 | #define SCR_MCR_RDY_TRISTATE (1 << 0) | ||
75 | #define SCR_MCR_RDY_PUSHPULL (2 << 0) | ||
76 | #define SCR_MCR_RDY_UNK BIT(2) | ||
77 | #define SCR_MCR_RDY_EN BIT(3) | ||
78 | #define SCR_MCR_INT_MASK (3 << 4) | ||
79 | #define SCR_MCR_INT_OPENDRAIN (0 << 4) | ||
80 | #define SCR_MCR_INT_TRISTATE (1 << 4) | ||
81 | #define SCR_MCR_INT_PUSHPULL (2 << 4) | ||
82 | #define SCR_MCR_INT_UNK BIT(6) | ||
83 | #define SCR_MCR_INT_EN BIT(7) | ||
84 | /* bits 8 - 16 are unknown */ | ||
85 | |||
86 | #define TC_GPIO_BIT(i) (1 << (i & 0x7)) | ||
87 | |||
88 | /*--------------------------------------------------------------------------*/ | ||
89 | |||
90 | struct tc6393xb { | ||
91 | void __iomem *scr; | ||
92 | |||
93 | struct gpio_chip gpio; | ||
94 | |||
95 | struct clk *clk; /* 3,6 Mhz */ | ||
96 | |||
97 | spinlock_t lock; /* protects RMW cycles */ | ||
98 | |||
99 | struct { | ||
100 | u8 fer; | ||
101 | u16 ccr; | ||
102 | u8 gpi_bcr[3]; | ||
103 | u8 gpo_dsr[3]; | ||
104 | u8 gpo_doecr[3]; | ||
105 | } suspend_state; | ||
106 | |||
107 | struct resource rscr; | ||
108 | struct resource *iomem; | ||
109 | int irq; | ||
110 | int irq_base; | ||
111 | }; | ||
112 | |||
113 | enum { | ||
114 | TC6393XB_CELL_NAND, | ||
115 | }; | ||
116 | |||
117 | /*--------------------------------------------------------------------------*/ | ||
118 | |||
119 | static int tc6393xb_nand_enable(struct platform_device *nand) | ||
120 | { | ||
121 | struct platform_device *dev = to_platform_device(nand->dev.parent); | ||
122 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
123 | unsigned long flags; | ||
124 | |||
125 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
126 | |||
127 | /* SMD buffer on */ | ||
128 | dev_dbg(&dev->dev, "SMD buffer on\n"); | ||
129 | iowrite8(0xff, tc6393xb->scr + SCR_GPI_BCR(1)); | ||
130 | |||
131 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
132 | |||
133 | return 0; | ||
134 | } | ||
135 | |||
136 | static struct resource __devinitdata tc6393xb_nand_resources[] = { | ||
137 | { | ||
138 | .name = TMIO_NAND_CONFIG, | ||
139 | .start = 0x0100, | ||
140 | .end = 0x01ff, | ||
141 | .flags = IORESOURCE_MEM, | ||
142 | }, | ||
143 | { | ||
144 | .name = TMIO_NAND_CONTROL, | ||
145 | .start = 0x1000, | ||
146 | .end = 0x1007, | ||
147 | .flags = IORESOURCE_MEM, | ||
148 | }, | ||
149 | { | ||
150 | .name = TMIO_NAND_IRQ, | ||
151 | .start = IRQ_TC6393_NAND, | ||
152 | .end = IRQ_TC6393_NAND, | ||
153 | .flags = IORESOURCE_IRQ, | ||
154 | }, | ||
155 | }; | ||
156 | |||
157 | static struct mfd_cell __devinitdata tc6393xb_cells[] = { | ||
158 | [TC6393XB_CELL_NAND] = { | ||
159 | .name = "tmio-nand", | ||
160 | .enable = tc6393xb_nand_enable, | ||
161 | .num_resources = ARRAY_SIZE(tc6393xb_nand_resources), | ||
162 | .resources = tc6393xb_nand_resources, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | /*--------------------------------------------------------------------------*/ | ||
167 | |||
168 | static int tc6393xb_gpio_get(struct gpio_chip *chip, | ||
169 | unsigned offset) | ||
170 | { | ||
171 | struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); | ||
172 | |||
173 | /* XXX: does dsr also represent inputs? */ | ||
174 | return ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)) | ||
175 | & TC_GPIO_BIT(offset); | ||
176 | } | ||
177 | |||
178 | static void __tc6393xb_gpio_set(struct gpio_chip *chip, | ||
179 | unsigned offset, int value) | ||
180 | { | ||
181 | struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); | ||
182 | u8 dsr; | ||
183 | |||
184 | dsr = ioread8(tc6393xb->scr + SCR_GPO_DSR(offset / 8)); | ||
185 | if (value) | ||
186 | dsr |= TC_GPIO_BIT(offset); | ||
187 | else | ||
188 | dsr &= ~TC_GPIO_BIT(offset); | ||
189 | |||
190 | iowrite8(dsr, tc6393xb->scr + SCR_GPO_DSR(offset / 8)); | ||
191 | } | ||
192 | |||
193 | static void tc6393xb_gpio_set(struct gpio_chip *chip, | ||
194 | unsigned offset, int value) | ||
195 | { | ||
196 | struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); | ||
197 | unsigned long flags; | ||
198 | |||
199 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
200 | |||
201 | __tc6393xb_gpio_set(chip, offset, value); | ||
202 | |||
203 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
204 | } | ||
205 | |||
206 | static int tc6393xb_gpio_direction_input(struct gpio_chip *chip, | ||
207 | unsigned offset) | ||
208 | { | ||
209 | struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); | ||
210 | unsigned long flags; | ||
211 | u8 doecr; | ||
212 | |||
213 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
214 | |||
215 | doecr = ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); | ||
216 | doecr &= ~TC_GPIO_BIT(offset); | ||
217 | iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); | ||
218 | |||
219 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
220 | |||
221 | return 0; | ||
222 | } | ||
223 | |||
224 | static int tc6393xb_gpio_direction_output(struct gpio_chip *chip, | ||
225 | unsigned offset, int value) | ||
226 | { | ||
227 | struct tc6393xb *tc6393xb = container_of(chip, struct tc6393xb, gpio); | ||
228 | unsigned long flags; | ||
229 | u8 doecr; | ||
230 | |||
231 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
232 | |||
233 | __tc6393xb_gpio_set(chip, offset, value); | ||
234 | |||
235 | doecr = ioread8(tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); | ||
236 | doecr |= TC_GPIO_BIT(offset); | ||
237 | iowrite8(doecr, tc6393xb->scr + SCR_GPO_DOECR(offset / 8)); | ||
238 | |||
239 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | |||
244 | static int tc6393xb_register_gpio(struct tc6393xb *tc6393xb, int gpio_base) | ||
245 | { | ||
246 | tc6393xb->gpio.label = "tc6393xb"; | ||
247 | tc6393xb->gpio.base = gpio_base; | ||
248 | tc6393xb->gpio.ngpio = 16; | ||
249 | tc6393xb->gpio.set = tc6393xb_gpio_set; | ||
250 | tc6393xb->gpio.get = tc6393xb_gpio_get; | ||
251 | tc6393xb->gpio.direction_input = tc6393xb_gpio_direction_input; | ||
252 | tc6393xb->gpio.direction_output = tc6393xb_gpio_direction_output; | ||
253 | |||
254 | return gpiochip_add(&tc6393xb->gpio); | ||
255 | } | ||
256 | |||
257 | /*--------------------------------------------------------------------------*/ | ||
258 | |||
259 | static void | ||
260 | tc6393xb_irq(unsigned int irq, struct irq_desc *desc) | ||
261 | { | ||
262 | struct tc6393xb *tc6393xb = get_irq_data(irq); | ||
263 | unsigned int isr; | ||
264 | unsigned int i, irq_base; | ||
265 | |||
266 | irq_base = tc6393xb->irq_base; | ||
267 | |||
268 | while ((isr = ioread8(tc6393xb->scr + SCR_ISR) & | ||
269 | ~ioread8(tc6393xb->scr + SCR_IMR))) | ||
270 | for (i = 0; i < TC6393XB_NR_IRQS; i++) { | ||
271 | if (isr & (1 << i)) | ||
272 | generic_handle_irq(irq_base + i); | ||
273 | } | ||
274 | } | ||
275 | |||
276 | static void tc6393xb_irq_ack(unsigned int irq) | ||
277 | { | ||
278 | } | ||
279 | |||
280 | static void tc6393xb_irq_mask(unsigned int irq) | ||
281 | { | ||
282 | struct tc6393xb *tc6393xb = get_irq_chip_data(irq); | ||
283 | unsigned long flags; | ||
284 | u8 imr; | ||
285 | |||
286 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
287 | imr = ioread8(tc6393xb->scr + SCR_IMR); | ||
288 | imr |= 1 << (irq - tc6393xb->irq_base); | ||
289 | iowrite8(imr, tc6393xb->scr + SCR_IMR); | ||
290 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
291 | } | ||
292 | |||
293 | static void tc6393xb_irq_unmask(unsigned int irq) | ||
294 | { | ||
295 | struct tc6393xb *tc6393xb = get_irq_chip_data(irq); | ||
296 | unsigned long flags; | ||
297 | u8 imr; | ||
298 | |||
299 | spin_lock_irqsave(&tc6393xb->lock, flags); | ||
300 | imr = ioread8(tc6393xb->scr + SCR_IMR); | ||
301 | imr &= ~(1 << (irq - tc6393xb->irq_base)); | ||
302 | iowrite8(imr, tc6393xb->scr + SCR_IMR); | ||
303 | spin_unlock_irqrestore(&tc6393xb->lock, flags); | ||
304 | } | ||
305 | |||
306 | static struct irq_chip tc6393xb_chip = { | ||
307 | .name = "tc6393xb", | ||
308 | .ack = tc6393xb_irq_ack, | ||
309 | .mask = tc6393xb_irq_mask, | ||
310 | .unmask = tc6393xb_irq_unmask, | ||
311 | }; | ||
312 | |||
313 | static void tc6393xb_attach_irq(struct platform_device *dev) | ||
314 | { | ||
315 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
316 | unsigned int irq, irq_base; | ||
317 | |||
318 | irq_base = tc6393xb->irq_base; | ||
319 | |||
320 | for (irq = irq_base; irq < irq_base + TC6393XB_NR_IRQS; irq++) { | ||
321 | set_irq_chip(irq, &tc6393xb_chip); | ||
322 | set_irq_chip_data(irq, tc6393xb); | ||
323 | set_irq_handler(irq, handle_edge_irq); | ||
324 | set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); | ||
325 | } | ||
326 | |||
327 | set_irq_type(tc6393xb->irq, IRQT_FALLING); | ||
328 | set_irq_data(tc6393xb->irq, tc6393xb); | ||
329 | set_irq_chained_handler(tc6393xb->irq, tc6393xb_irq); | ||
330 | } | ||
331 | |||
332 | static void tc6393xb_detach_irq(struct platform_device *dev) | ||
333 | { | ||
334 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
335 | unsigned int irq, irq_base; | ||
336 | |||
337 | set_irq_chained_handler(tc6393xb->irq, NULL); | ||
338 | set_irq_data(tc6393xb->irq, NULL); | ||
339 | |||
340 | irq_base = tc6393xb->irq_base; | ||
341 | |||
342 | for (irq = irq_base; irq < irq_base + TC6393XB_NR_IRQS; irq++) { | ||
343 | set_irq_flags(irq, 0); | ||
344 | set_irq_chip(irq, NULL); | ||
345 | set_irq_chip_data(irq, NULL); | ||
346 | } | ||
347 | } | ||
348 | |||
349 | /*--------------------------------------------------------------------------*/ | ||
350 | |||
351 | static int tc6393xb_hw_init(struct platform_device *dev) | ||
352 | { | ||
353 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
354 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
355 | int i; | ||
356 | |||
357 | iowrite8(tc6393xb->suspend_state.fer, tc6393xb->scr + SCR_FER); | ||
358 | iowrite16(tcpd->scr_pll2cr, tc6393xb->scr + SCR_PLL2CR); | ||
359 | iowrite16(tc6393xb->suspend_state.ccr, tc6393xb->scr + SCR_CCR); | ||
360 | iowrite16(SCR_MCR_RDY_OPENDRAIN | SCR_MCR_RDY_UNK | SCR_MCR_RDY_EN | | ||
361 | SCR_MCR_INT_OPENDRAIN | SCR_MCR_INT_UNK | SCR_MCR_INT_EN | | ||
362 | BIT(15), tc6393xb->scr + SCR_MCR); | ||
363 | iowrite16(tcpd->scr_gper, tc6393xb->scr + SCR_GPER); | ||
364 | iowrite8(0, tc6393xb->scr + SCR_IRR); | ||
365 | iowrite8(0xbf, tc6393xb->scr + SCR_IMR); | ||
366 | |||
367 | for (i = 0; i < 3; i++) { | ||
368 | iowrite8(tc6393xb->suspend_state.gpo_dsr[i], | ||
369 | tc6393xb->scr + SCR_GPO_DSR(i)); | ||
370 | iowrite8(tc6393xb->suspend_state.gpo_doecr[i], | ||
371 | tc6393xb->scr + SCR_GPO_DOECR(i)); | ||
372 | iowrite8(tc6393xb->suspend_state.gpi_bcr[i], | ||
373 | tc6393xb->scr + SCR_GPI_BCR(i)); | ||
374 | } | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | static int __devinit tc6393xb_probe(struct platform_device *dev) | ||
380 | { | ||
381 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
382 | struct tc6393xb *tc6393xb; | ||
383 | struct resource *iomem; | ||
384 | struct resource *rscr; | ||
385 | int retval, temp; | ||
386 | int i; | ||
387 | |||
388 | iomem = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
389 | if (!iomem) | ||
390 | return -EINVAL; | ||
391 | |||
392 | tc6393xb = kzalloc(sizeof *tc6393xb, GFP_KERNEL); | ||
393 | if (!tc6393xb) { | ||
394 | retval = -ENOMEM; | ||
395 | goto err_kzalloc; | ||
396 | } | ||
397 | |||
398 | spin_lock_init(&tc6393xb->lock); | ||
399 | |||
400 | platform_set_drvdata(dev, tc6393xb); | ||
401 | tc6393xb->iomem = iomem; | ||
402 | tc6393xb->irq = platform_get_irq(dev, 0); | ||
403 | tc6393xb->irq_base = tcpd->irq_base; | ||
404 | |||
405 | tc6393xb->clk = clk_get(&dev->dev, "GPIO27_CLK" /* "CK3P6MI" */); | ||
406 | if (IS_ERR(tc6393xb->clk)) { | ||
407 | retval = PTR_ERR(tc6393xb->clk); | ||
408 | goto err_clk_get; | ||
409 | } | ||
410 | |||
411 | rscr = &tc6393xb->rscr; | ||
412 | rscr->name = "tc6393xb-core"; | ||
413 | rscr->start = iomem->start; | ||
414 | rscr->end = iomem->start + 0xff; | ||
415 | rscr->flags = IORESOURCE_MEM; | ||
416 | |||
417 | retval = request_resource(iomem, rscr); | ||
418 | if (retval) | ||
419 | goto err_request_scr; | ||
420 | |||
421 | tc6393xb->scr = ioremap(rscr->start, rscr->end - rscr->start + 1); | ||
422 | if (!tc6393xb->scr) { | ||
423 | retval = -ENOMEM; | ||
424 | goto err_ioremap; | ||
425 | } | ||
426 | |||
427 | retval = clk_enable(tc6393xb->clk); | ||
428 | if (retval) | ||
429 | goto err_clk_enable; | ||
430 | |||
431 | retval = tcpd->enable(dev); | ||
432 | if (retval) | ||
433 | goto err_enable; | ||
434 | |||
435 | tc6393xb->suspend_state.fer = 0; | ||
436 | for (i = 0; i < 3; i++) { | ||
437 | tc6393xb->suspend_state.gpo_dsr[i] = | ||
438 | (tcpd->scr_gpo_dsr >> (8 * i)) & 0xff; | ||
439 | tc6393xb->suspend_state.gpo_doecr[i] = | ||
440 | (tcpd->scr_gpo_doecr >> (8 * i)) & 0xff; | ||
441 | } | ||
442 | /* | ||
443 | * It may be necessary to change this back to | ||
444 | * platform-dependant code | ||
445 | */ | ||
446 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | | ||
447 | SCR_CCR_HCLK_48; | ||
448 | |||
449 | retval = tc6393xb_hw_init(dev); | ||
450 | if (retval) | ||
451 | goto err_hw_init; | ||
452 | |||
453 | printk(KERN_INFO "Toshiba tc6393xb revision %d at 0x%08lx, irq %d\n", | ||
454 | ioread8(tc6393xb->scr + SCR_REVID), | ||
455 | (unsigned long) iomem->start, tc6393xb->irq); | ||
456 | |||
457 | tc6393xb->gpio.base = -1; | ||
458 | |||
459 | if (tcpd->gpio_base >= 0) { | ||
460 | retval = tc6393xb_register_gpio(tc6393xb, tcpd->gpio_base); | ||
461 | if (retval) | ||
462 | goto err_gpio_add; | ||
463 | } | ||
464 | |||
465 | if (tc6393xb->irq) | ||
466 | tc6393xb_attach_irq(dev); | ||
467 | |||
468 | tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; | ||
469 | |||
470 | retval = mfd_add_devices(dev, | ||
471 | tc6393xb_cells, ARRAY_SIZE(tc6393xb_cells), | ||
472 | iomem, tcpd->irq_base); | ||
473 | |||
474 | return 0; | ||
475 | |||
476 | if (tc6393xb->irq) | ||
477 | tc6393xb_detach_irq(dev); | ||
478 | |||
479 | err_gpio_add: | ||
480 | if (tc6393xb->gpio.base != -1) | ||
481 | temp = gpiochip_remove(&tc6393xb->gpio); | ||
482 | err_hw_init: | ||
483 | tcpd->disable(dev); | ||
484 | err_clk_enable: | ||
485 | clk_disable(tc6393xb->clk); | ||
486 | err_enable: | ||
487 | iounmap(tc6393xb->scr); | ||
488 | err_ioremap: | ||
489 | release_resource(&tc6393xb->rscr); | ||
490 | err_request_scr: | ||
491 | clk_put(tc6393xb->clk); | ||
492 | err_clk_get: | ||
493 | kfree(tc6393xb); | ||
494 | err_kzalloc: | ||
495 | return retval; | ||
496 | } | ||
497 | |||
498 | static int __devexit tc6393xb_remove(struct platform_device *dev) | ||
499 | { | ||
500 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
501 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
502 | int ret; | ||
503 | |||
504 | mfd_remove_devices(dev); | ||
505 | |||
506 | if (tc6393xb->irq) | ||
507 | tc6393xb_detach_irq(dev); | ||
508 | |||
509 | if (tc6393xb->gpio.base != -1) { | ||
510 | ret = gpiochip_remove(&tc6393xb->gpio); | ||
511 | if (ret) { | ||
512 | dev_err(&dev->dev, "Can't remove gpio chip: %d\n", ret); | ||
513 | return ret; | ||
514 | } | ||
515 | } | ||
516 | |||
517 | ret = tcpd->disable(dev); | ||
518 | |||
519 | clk_disable(tc6393xb->clk); | ||
520 | |||
521 | iounmap(tc6393xb->scr); | ||
522 | |||
523 | release_resource(&tc6393xb->rscr); | ||
524 | |||
525 | platform_set_drvdata(dev, NULL); | ||
526 | |||
527 | clk_put(tc6393xb->clk); | ||
528 | |||
529 | kfree(tc6393xb); | ||
530 | |||
531 | return ret; | ||
532 | } | ||
533 | |||
534 | #ifdef CONFIG_PM | ||
535 | static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state) | ||
536 | { | ||
537 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
538 | struct tc6393xb *tc6393xb = platform_get_drvdata(dev); | ||
539 | int i; | ||
540 | |||
541 | |||
542 | tc6393xb->suspend_state.ccr = ioread16(tc6393xb->scr + SCR_CCR); | ||
543 | tc6393xb->suspend_state.fer = ioread8(tc6393xb->scr + SCR_FER); | ||
544 | |||
545 | for (i = 0; i < 3; i++) { | ||
546 | tc6393xb->suspend_state.gpo_dsr[i] = | ||
547 | ioread8(tc6393xb->scr + SCR_GPO_DSR(i)); | ||
548 | tc6393xb->suspend_state.gpo_doecr[i] = | ||
549 | ioread8(tc6393xb->scr + SCR_GPO_DOECR(i)); | ||
550 | tc6393xb->suspend_state.gpi_bcr[i] = | ||
551 | ioread8(tc6393xb->scr + SCR_GPI_BCR(i)); | ||
552 | } | ||
553 | |||
554 | return tcpd->suspend(dev); | ||
555 | } | ||
556 | |||
557 | static int tc6393xb_resume(struct platform_device *dev) | ||
558 | { | ||
559 | struct tc6393xb_platform_data *tcpd = dev->dev.platform_data; | ||
560 | int ret = tcpd->resume(dev); | ||
561 | |||
562 | if (ret) | ||
563 | return ret; | ||
564 | |||
565 | return tc6393xb_hw_init(dev); | ||
566 | } | ||
567 | #else | ||
568 | #define tc6393xb_suspend NULL | ||
569 | #define tc6393xb_resume NULL | ||
570 | #endif | ||
571 | |||
572 | static struct platform_driver tc6393xb_driver = { | ||
573 | .probe = tc6393xb_probe, | ||
574 | .remove = __devexit_p(tc6393xb_remove), | ||
575 | .suspend = tc6393xb_suspend, | ||
576 | .resume = tc6393xb_resume, | ||
577 | |||
578 | .driver = { | ||
579 | .name = "tc6393xb", | ||
580 | .owner = THIS_MODULE, | ||
581 | }, | ||
582 | }; | ||
583 | |||
584 | static int __init tc6393xb_init(void) | ||
585 | { | ||
586 | return platform_driver_register(&tc6393xb_driver); | ||
587 | } | ||
588 | |||
589 | static void __exit tc6393xb_exit(void) | ||
590 | { | ||
591 | platform_driver_unregister(&tc6393xb_driver); | ||
592 | } | ||
593 | |||
594 | subsys_initcall(tc6393xb_init); | ||
595 | module_exit(tc6393xb_exit); | ||
596 | |||
597 | MODULE_LICENSE("GPL"); | ||
598 | MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov and Dirk Opfer"); | ||
599 | MODULE_DESCRIPTION("tc6393xb Toshiba Mobile IO Controller"); | ||
600 | MODULE_ALIAS("platform:tc6393xb"); | ||
diff --git a/drivers/mtd/nand/cmx270_nand.c b/drivers/mtd/nand/cmx270_nand.c index cb663ef245d5..fc8529bedfdf 100644 --- a/drivers/mtd/nand/cmx270_nand.c +++ b/drivers/mtd/nand/cmx270_nand.c | |||
@@ -20,9 +20,11 @@ | |||
20 | 20 | ||
21 | #include <linux/mtd/nand.h> | 21 | #include <linux/mtd/nand.h> |
22 | #include <linux/mtd/partitions.h> | 22 | #include <linux/mtd/partitions.h> |
23 | #include <linux/gpio.h> | ||
23 | 24 | ||
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
25 | #include <asm/irq.h> | 26 | #include <asm/irq.h> |
27 | #include <asm/mach-types.h> | ||
26 | 28 | ||
27 | #include <asm/arch/hardware.h> | 29 | #include <asm/arch/hardware.h> |
28 | #include <asm/arch/pxa-regs.h> | 30 | #include <asm/arch/pxa-regs.h> |
@@ -30,20 +32,6 @@ | |||
30 | #define GPIO_NAND_CS (11) | 32 | #define GPIO_NAND_CS (11) |
31 | #define GPIO_NAND_RB (89) | 33 | #define GPIO_NAND_RB (89) |
32 | 34 | ||
33 | /* This macro needed to ensure in-order operation of GPIO and local | ||
34 | * bus. Without both asm command and dummy uncached read there're | ||
35 | * states when NAND access is broken. I've looked for such macro(s) in | ||
36 | * include/asm-arm but found nothing approptiate. | ||
37 | * dmac_clean_range is close, but is makes cache invalidation | ||
38 | * unnecessary here and it cannot be used in module | ||
39 | */ | ||
40 | #define DRAIN_WB() \ | ||
41 | do { \ | ||
42 | unsigned char dummy; \ | ||
43 | asm volatile ("mcr p15, 0, r0, c7, c10, 4":::"r0"); \ | ||
44 | dummy=*((unsigned char*)UNCACHED_ADDR); \ | ||
45 | } while(0) | ||
46 | |||
47 | /* MTD structure for CM-X270 board */ | 35 | /* MTD structure for CM-X270 board */ |
48 | static struct mtd_info *cmx270_nand_mtd; | 36 | static struct mtd_info *cmx270_nand_mtd; |
49 | 37 | ||
@@ -103,14 +91,14 @@ static int cmx270_verify_buf(struct mtd_info *mtd, const u_char *buf, int len) | |||
103 | 91 | ||
104 | static inline void nand_cs_on(void) | 92 | static inline void nand_cs_on(void) |
105 | { | 93 | { |
106 | GPCR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS); | 94 | gpio_set_value(GPIO_NAND_CS, 0); |
107 | } | 95 | } |
108 | 96 | ||
109 | static void nand_cs_off(void) | 97 | static void nand_cs_off(void) |
110 | { | 98 | { |
111 | DRAIN_WB(); | 99 | dsb(); |
112 | 100 | ||
113 | GPSR(GPIO_NAND_CS) = GPIO_bit(GPIO_NAND_CS); | 101 | gpio_set_value(GPIO_NAND_CS, 1); |
114 | } | 102 | } |
115 | 103 | ||
116 | /* | 104 | /* |
@@ -122,7 +110,7 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat, | |||
122 | struct nand_chip* this = mtd->priv; | 110 | struct nand_chip* this = mtd->priv; |
123 | unsigned int nandaddr = (unsigned int)this->IO_ADDR_W; | 111 | unsigned int nandaddr = (unsigned int)this->IO_ADDR_W; |
124 | 112 | ||
125 | DRAIN_WB(); | 113 | dsb(); |
126 | 114 | ||
127 | if (ctrl & NAND_CTRL_CHANGE) { | 115 | if (ctrl & NAND_CTRL_CHANGE) { |
128 | if ( ctrl & NAND_ALE ) | 116 | if ( ctrl & NAND_ALE ) |
@@ -139,12 +127,12 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat, | |||
139 | nand_cs_off(); | 127 | nand_cs_off(); |
140 | } | 128 | } |
141 | 129 | ||
142 | DRAIN_WB(); | 130 | dsb(); |
143 | this->IO_ADDR_W = (void __iomem*)nandaddr; | 131 | this->IO_ADDR_W = (void __iomem*)nandaddr; |
144 | if (dat != NAND_CMD_NONE) | 132 | if (dat != NAND_CMD_NONE) |
145 | writel((dat << 16), this->IO_ADDR_W); | 133 | writel((dat << 16), this->IO_ADDR_W); |
146 | 134 | ||
147 | DRAIN_WB(); | 135 | dsb(); |
148 | } | 136 | } |
149 | 137 | ||
150 | /* | 138 | /* |
@@ -152,9 +140,9 @@ static void cmx270_hwcontrol(struct mtd_info *mtd, int dat, | |||
152 | */ | 140 | */ |
153 | static int cmx270_device_ready(struct mtd_info *mtd) | 141 | static int cmx270_device_ready(struct mtd_info *mtd) |
154 | { | 142 | { |
155 | DRAIN_WB(); | 143 | dsb(); |
156 | 144 | ||
157 | return (GPLR(GPIO_NAND_RB) & GPIO_bit(GPIO_NAND_RB)); | 145 | return (gpio_get_value(GPIO_NAND_RB)); |
158 | } | 146 | } |
159 | 147 | ||
160 | /* | 148 | /* |
@@ -168,20 +156,40 @@ static int cmx270_init(void) | |||
168 | int mtd_parts_nb = 0; | 156 | int mtd_parts_nb = 0; |
169 | int ret; | 157 | int ret; |
170 | 158 | ||
159 | if (!machine_is_armcore()) | ||
160 | return -ENODEV; | ||
161 | |||
162 | ret = gpio_request(GPIO_NAND_CS, "NAND CS"); | ||
163 | if (ret) { | ||
164 | pr_warning("CM-X270: failed to request NAND CS gpio\n"); | ||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | gpio_direction_output(GPIO_NAND_CS, 1); | ||
169 | |||
170 | ret = gpio_request(GPIO_NAND_RB, "NAND R/B"); | ||
171 | if (ret) { | ||
172 | pr_warning("CM-X270: failed to request NAND R/B gpio\n"); | ||
173 | goto err_gpio_request; | ||
174 | } | ||
175 | |||
176 | gpio_direction_input(GPIO_NAND_RB); | ||
177 | |||
171 | /* Allocate memory for MTD device structure and private data */ | 178 | /* Allocate memory for MTD device structure and private data */ |
172 | cmx270_nand_mtd = kzalloc(sizeof(struct mtd_info) + | 179 | cmx270_nand_mtd = kzalloc(sizeof(struct mtd_info) + |
173 | sizeof(struct nand_chip), | 180 | sizeof(struct nand_chip), |
174 | GFP_KERNEL); | 181 | GFP_KERNEL); |
175 | if (!cmx270_nand_mtd) { | 182 | if (!cmx270_nand_mtd) { |
176 | printk("Unable to allocate CM-X270 NAND MTD device structure.\n"); | 183 | pr_debug("Unable to allocate CM-X270 NAND MTD device structure.\n"); |
177 | return -ENOMEM; | 184 | ret = -ENOMEM; |
185 | goto err_kzalloc; | ||
178 | } | 186 | } |
179 | 187 | ||
180 | cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12); | 188 | cmx270_nand_io = ioremap(PXA_CS1_PHYS, 12); |
181 | if (!cmx270_nand_io) { | 189 | if (!cmx270_nand_io) { |
182 | printk("Unable to ioremap NAND device\n"); | 190 | pr_debug("Unable to ioremap NAND device\n"); |
183 | ret = -EINVAL; | 191 | ret = -EINVAL; |
184 | goto err1; | 192 | goto err_ioremap; |
185 | } | 193 | } |
186 | 194 | ||
187 | /* Get pointer to private data */ | 195 | /* Get pointer to private data */ |
@@ -209,9 +217,9 @@ static int cmx270_init(void) | |||
209 | 217 | ||
210 | /* Scan to find existence of the device */ | 218 | /* Scan to find existence of the device */ |
211 | if (nand_scan (cmx270_nand_mtd, 1)) { | 219 | if (nand_scan (cmx270_nand_mtd, 1)) { |
212 | printk(KERN_NOTICE "No NAND device\n"); | 220 | pr_notice("No NAND device\n"); |
213 | ret = -ENXIO; | 221 | ret = -ENXIO; |
214 | goto err2; | 222 | goto err_scan; |
215 | } | 223 | } |
216 | 224 | ||
217 | #ifdef CONFIG_MTD_CMDLINE_PARTS | 225 | #ifdef CONFIG_MTD_CMDLINE_PARTS |
@@ -229,18 +237,22 @@ static int cmx270_init(void) | |||
229 | } | 237 | } |
230 | 238 | ||
231 | /* Register the partitions */ | 239 | /* Register the partitions */ |
232 | printk(KERN_NOTICE "Using %s partition definition\n", part_type); | 240 | pr_notice("Using %s partition definition\n", part_type); |
233 | ret = add_mtd_partitions(cmx270_nand_mtd, mtd_parts, mtd_parts_nb); | 241 | ret = add_mtd_partitions(cmx270_nand_mtd, mtd_parts, mtd_parts_nb); |
234 | if (ret) | 242 | if (ret) |
235 | goto err2; | 243 | goto err_scan; |
236 | 244 | ||
237 | /* Return happy */ | 245 | /* Return happy */ |
238 | return 0; | 246 | return 0; |
239 | 247 | ||
240 | err2: | 248 | err_scan: |
241 | iounmap(cmx270_nand_io); | 249 | iounmap(cmx270_nand_io); |
242 | err1: | 250 | err_ioremap: |
243 | kfree(cmx270_nand_mtd); | 251 | kfree(cmx270_nand_mtd); |
252 | err_kzalloc: | ||
253 | gpio_free(GPIO_NAND_RB); | ||
254 | err_gpio_request: | ||
255 | gpio_free(GPIO_NAND_CS); | ||
244 | 256 | ||
245 | return ret; | 257 | return ret; |
246 | 258 | ||
@@ -255,6 +267,9 @@ static void cmx270_cleanup(void) | |||
255 | /* Release resources, unregister device */ | 267 | /* Release resources, unregister device */ |
256 | nand_release(cmx270_nand_mtd); | 268 | nand_release(cmx270_nand_mtd); |
257 | 269 | ||
270 | gpio_free(GPIO_NAND_RB); | ||
271 | gpio_free(GPIO_NAND_CS); | ||
272 | |||
258 | iounmap(cmx270_nand_io); | 273 | iounmap(cmx270_nand_io); |
259 | 274 | ||
260 | /* Free the MTD device structure */ | 275 | /* Free the MTD device structure */ |
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/net/smc91x.c b/drivers/net/smc91x.c index f2051b209da2..2040965d7724 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -308,7 +308,7 @@ static void smc_reset(struct net_device *dev) | |||
308 | * can't handle it then there will be no recovery except for | 308 | * can't handle it then there will be no recovery except for |
309 | * a hard reset or power cycle | 309 | * a hard reset or power cycle |
310 | */ | 310 | */ |
311 | if (nowait) | 311 | if (lp->cfg.flags & SMC91X_NOWAIT) |
312 | cfg |= CONFIG_NO_WAIT; | 312 | cfg |= CONFIG_NO_WAIT; |
313 | 313 | ||
314 | /* | 314 | /* |
@@ -1939,8 +1939,11 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr, | |||
1939 | if (retval) | 1939 | if (retval) |
1940 | goto err_out; | 1940 | goto err_out; |
1941 | 1941 | ||
1942 | #ifdef SMC_USE_PXA_DMA | 1942 | #ifdef CONFIG_ARCH_PXA |
1943 | { | 1943 | # ifdef SMC_USE_PXA_DMA |
1944 | lp->cfg.flags |= SMC91X_USE_DMA; | ||
1945 | # endif | ||
1946 | if (lp->cfg.flags & SMC91X_USE_DMA) { | ||
1944 | int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, | 1947 | int dma = pxa_request_dma(dev->name, DMA_PRIO_LOW, |
1945 | smc_pxa_dma_irq, NULL); | 1948 | smc_pxa_dma_irq, NULL); |
1946 | if (dma >= 0) | 1949 | if (dma >= 0) |
@@ -1980,7 +1983,7 @@ static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr, | |||
1980 | } | 1983 | } |
1981 | 1984 | ||
1982 | err_out: | 1985 | err_out: |
1983 | #ifdef SMC_USE_PXA_DMA | 1986 | #ifdef CONFIG_ARCH_PXA |
1984 | if (retval && dev->dma != (unsigned char)-1) | 1987 | if (retval && dev->dma != (unsigned char)-1) |
1985 | pxa_free_dma(dev->dma); | 1988 | pxa_free_dma(dev->dma); |
1986 | #endif | 1989 | #endif |
@@ -2050,9 +2053,11 @@ static int smc_enable_device(struct platform_device *pdev) | |||
2050 | return 0; | 2053 | return 0; |
2051 | } | 2054 | } |
2052 | 2055 | ||
2053 | static int smc_request_attrib(struct platform_device *pdev) | 2056 | static int smc_request_attrib(struct platform_device *pdev, |
2057 | struct net_device *ndev) | ||
2054 | { | 2058 | { |
2055 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); | 2059 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); |
2060 | struct smc_local *lp = netdev_priv(ndev); | ||
2056 | 2061 | ||
2057 | if (!res) | 2062 | if (!res) |
2058 | return 0; | 2063 | return 0; |
@@ -2063,9 +2068,11 @@ static int smc_request_attrib(struct platform_device *pdev) | |||
2063 | return 0; | 2068 | return 0; |
2064 | } | 2069 | } |
2065 | 2070 | ||
2066 | static void smc_release_attrib(struct platform_device *pdev) | 2071 | static void smc_release_attrib(struct platform_device *pdev, |
2072 | struct net_device *ndev) | ||
2067 | { | 2073 | { |
2068 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); | 2074 | struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib"); |
2075 | struct smc_local *lp = netdev_priv(ndev); | ||
2069 | 2076 | ||
2070 | if (res) | 2077 | if (res) |
2071 | release_mem_region(res->start, ATTRIB_SIZE); | 2078 | release_mem_region(res->start, ATTRIB_SIZE); |
@@ -2123,27 +2130,14 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2123 | struct net_device *ndev; | 2130 | struct net_device *ndev; |
2124 | struct resource *res, *ires; | 2131 | struct resource *res, *ires; |
2125 | unsigned int __iomem *addr; | 2132 | unsigned int __iomem *addr; |
2133 | unsigned long irq_flags = SMC_IRQ_FLAGS; | ||
2126 | int ret; | 2134 | int ret; |
2127 | 2135 | ||
2128 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); | ||
2129 | if (!res) | ||
2130 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
2131 | if (!res) { | ||
2132 | ret = -ENODEV; | ||
2133 | goto out; | ||
2134 | } | ||
2135 | |||
2136 | |||
2137 | if (!request_mem_region(res->start, SMC_IO_EXTENT, CARDNAME)) { | ||
2138 | ret = -EBUSY; | ||
2139 | goto out; | ||
2140 | } | ||
2141 | |||
2142 | ndev = alloc_etherdev(sizeof(struct smc_local)); | 2136 | ndev = alloc_etherdev(sizeof(struct smc_local)); |
2143 | if (!ndev) { | 2137 | if (!ndev) { |
2144 | printk("%s: could not allocate device.\n", CARDNAME); | 2138 | printk("%s: could not allocate device.\n", CARDNAME); |
2145 | ret = -ENOMEM; | 2139 | ret = -ENOMEM; |
2146 | goto out_release_io; | 2140 | goto out; |
2147 | } | 2141 | } |
2148 | SET_NETDEV_DEV(ndev, &pdev->dev); | 2142 | SET_NETDEV_DEV(ndev, &pdev->dev); |
2149 | 2143 | ||
@@ -2152,37 +2146,47 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2152 | */ | 2146 | */ |
2153 | 2147 | ||
2154 | lp = netdev_priv(ndev); | 2148 | lp = netdev_priv(ndev); |
2155 | lp->cfg.irq_flags = SMC_IRQ_FLAGS; | ||
2156 | 2149 | ||
2157 | #ifdef SMC_DYNAMIC_BUS_CONFIG | 2150 | if (pd) { |
2158 | if (pd) | ||
2159 | memcpy(&lp->cfg, pd, sizeof(lp->cfg)); | 2151 | memcpy(&lp->cfg, pd, sizeof(lp->cfg)); |
2160 | else { | 2152 | lp->io_shift = SMC91X_IO_SHIFT(lp->cfg.flags); |
2161 | lp->cfg.flags = SMC91X_USE_8BIT; | 2153 | } else { |
2162 | lp->cfg.flags |= SMC91X_USE_16BIT; | 2154 | lp->cfg.flags |= (SMC_CAN_USE_8BIT) ? SMC91X_USE_8BIT : 0; |
2163 | lp->cfg.flags |= SMC91X_USE_32BIT; | 2155 | lp->cfg.flags |= (SMC_CAN_USE_16BIT) ? SMC91X_USE_16BIT : 0; |
2156 | lp->cfg.flags |= (SMC_CAN_USE_32BIT) ? SMC91X_USE_32BIT : 0; | ||
2157 | lp->cfg.flags |= (nowait) ? SMC91X_NOWAIT : 0; | ||
2164 | } | 2158 | } |
2165 | 2159 | ||
2166 | lp->cfg.flags &= ~(SMC_CAN_USE_8BIT ? 0 : SMC91X_USE_8BIT); | ||
2167 | lp->cfg.flags &= ~(SMC_CAN_USE_16BIT ? 0 : SMC91X_USE_16BIT); | ||
2168 | lp->cfg.flags &= ~(SMC_CAN_USE_32BIT ? 0 : SMC91X_USE_32BIT); | ||
2169 | #endif | ||
2170 | |||
2171 | ndev->dma = (unsigned char)-1; | 2160 | ndev->dma = (unsigned char)-1; |
2172 | 2161 | ||
2162 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); | ||
2163 | if (!res) | ||
2164 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
2165 | if (!res) { | ||
2166 | ret = -ENODEV; | ||
2167 | goto out_free_netdev; | ||
2168 | } | ||
2169 | |||
2170 | |||
2171 | if (!request_mem_region(res->start, SMC_IO_EXTENT, CARDNAME)) { | ||
2172 | ret = -EBUSY; | ||
2173 | goto out_free_netdev; | ||
2174 | } | ||
2175 | |||
2173 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 2176 | ires = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
2174 | if (!ires) { | 2177 | if (!ires) { |
2175 | ret = -ENODEV; | 2178 | ret = -ENODEV; |
2176 | goto out_free_netdev; | 2179 | goto out_release_io; |
2177 | } | 2180 | } |
2178 | 2181 | ||
2179 | ndev->irq = ires->start; | 2182 | ndev->irq = ires->start; |
2180 | if (SMC_IRQ_FLAGS == -1) | ||
2181 | lp->cfg.irq_flags = ires->flags & IRQF_TRIGGER_MASK; | ||
2182 | 2183 | ||
2183 | ret = smc_request_attrib(pdev); | 2184 | if (ires->flags & IRQF_TRIGGER_MASK) |
2185 | irq_flags = ires->flags & IRQF_TRIGGER_MASK; | ||
2186 | |||
2187 | ret = smc_request_attrib(pdev, ndev); | ||
2184 | if (ret) | 2188 | if (ret) |
2185 | goto out_free_netdev; | 2189 | goto out_release_io; |
2186 | #if defined(CONFIG_SA1100_ASSABET) | 2190 | #if defined(CONFIG_SA1100_ASSABET) |
2187 | NCR_0 |= NCR_ENET_OSC_EN; | 2191 | NCR_0 |= NCR_ENET_OSC_EN; |
2188 | #endif | 2192 | #endif |
@@ -2197,7 +2201,7 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2197 | goto out_release_attrib; | 2201 | goto out_release_attrib; |
2198 | } | 2202 | } |
2199 | 2203 | ||
2200 | #ifdef SMC_USE_PXA_DMA | 2204 | #ifdef CONFIG_ARCH_PXA |
2201 | { | 2205 | { |
2202 | struct smc_local *lp = netdev_priv(ndev); | 2206 | struct smc_local *lp = netdev_priv(ndev); |
2203 | lp->device = &pdev->dev; | 2207 | lp->device = &pdev->dev; |
@@ -2205,7 +2209,7 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2205 | } | 2209 | } |
2206 | #endif | 2210 | #endif |
2207 | 2211 | ||
2208 | ret = smc_probe(ndev, addr, lp->cfg.irq_flags); | 2212 | ret = smc_probe(ndev, addr, irq_flags); |
2209 | if (ret != 0) | 2213 | if (ret != 0) |
2210 | goto out_iounmap; | 2214 | goto out_iounmap; |
2211 | 2215 | ||
@@ -2217,11 +2221,11 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2217 | platform_set_drvdata(pdev, NULL); | 2221 | platform_set_drvdata(pdev, NULL); |
2218 | iounmap(addr); | 2222 | iounmap(addr); |
2219 | out_release_attrib: | 2223 | out_release_attrib: |
2220 | smc_release_attrib(pdev); | 2224 | smc_release_attrib(pdev, ndev); |
2221 | out_free_netdev: | ||
2222 | free_netdev(ndev); | ||
2223 | out_release_io: | 2225 | out_release_io: |
2224 | release_mem_region(res->start, SMC_IO_EXTENT); | 2226 | release_mem_region(res->start, SMC_IO_EXTENT); |
2227 | out_free_netdev: | ||
2228 | free_netdev(ndev); | ||
2225 | out: | 2229 | out: |
2226 | printk("%s: not found (%d).\n", CARDNAME, ret); | 2230 | printk("%s: not found (%d).\n", CARDNAME, ret); |
2227 | 2231 | ||
@@ -2240,14 +2244,14 @@ static int smc_drv_remove(struct platform_device *pdev) | |||
2240 | 2244 | ||
2241 | free_irq(ndev->irq, ndev); | 2245 | free_irq(ndev->irq, ndev); |
2242 | 2246 | ||
2243 | #ifdef SMC_USE_PXA_DMA | 2247 | #ifdef CONFIG_ARCH_PXA |
2244 | if (ndev->dma != (unsigned char)-1) | 2248 | if (ndev->dma != (unsigned char)-1) |
2245 | pxa_free_dma(ndev->dma); | 2249 | pxa_free_dma(ndev->dma); |
2246 | #endif | 2250 | #endif |
2247 | iounmap(lp->base); | 2251 | iounmap(lp->base); |
2248 | 2252 | ||
2249 | smc_release_datacs(pdev,ndev); | 2253 | smc_release_datacs(pdev,ndev); |
2250 | smc_release_attrib(pdev); | 2254 | smc_release_attrib(pdev,ndev); |
2251 | 2255 | ||
2252 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); | 2256 | res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-regs"); |
2253 | if (!res) | 2257 | if (!res) |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 8606818653f8..22209b6f1405 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -40,23 +40,46 @@ | |||
40 | * Define your architecture specific bus configuration parameters here. | 40 | * Define your architecture specific bus configuration parameters here. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #if defined(CONFIG_ARCH_LUBBOCK) | 43 | #if defined(CONFIG_ARCH_LUBBOCK) ||\ |
44 | defined(CONFIG_MACH_MAINSTONE) ||\ | ||
45 | defined(CONFIG_MACH_ZYLONITE) ||\ | ||
46 | defined(CONFIG_MACH_LITTLETON) | ||
44 | 47 | ||
45 | /* We can only do 16-bit reads and writes in the static memory space. */ | 48 | #include <asm/mach-types.h> |
46 | #define SMC_CAN_USE_8BIT 0 | 49 | |
50 | /* Now the bus width is specified in the platform data | ||
51 | * pretend here to support all I/O access types | ||
52 | */ | ||
53 | #define SMC_CAN_USE_8BIT 1 | ||
47 | #define SMC_CAN_USE_16BIT 1 | 54 | #define SMC_CAN_USE_16BIT 1 |
48 | #define SMC_CAN_USE_32BIT 0 | 55 | #define SMC_CAN_USE_32BIT 1 |
49 | #define SMC_NOWAIT 1 | 56 | #define SMC_NOWAIT 1 |
50 | 57 | ||
51 | /* The first two address lines aren't connected... */ | 58 | #define SMC_IO_SHIFT (lp->io_shift) |
52 | #define SMC_IO_SHIFT 2 | ||
53 | 59 | ||
60 | #define SMC_inb(a, r) readb((a) + (r)) | ||
54 | #define SMC_inw(a, r) readw((a) + (r)) | 61 | #define SMC_inw(a, r) readw((a) + (r)) |
55 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | 62 | #define SMC_inl(a, r) readl((a) + (r)) |
63 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
64 | #define SMC_outl(v, a, r) writel(v, (a) + (r)) | ||
56 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) | 65 | #define SMC_insw(a, r, p, l) readsw((a) + (r), p, l) |
57 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 66 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
67 | #define SMC_insl(a, r, p, l) readsl((a) + (r), p, l) | ||
68 | #define SMC_outsl(a, r, p, l) writesl((a) + (r), p, l) | ||
58 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | 69 | #define SMC_IRQ_FLAGS (-1) /* from resource */ |
59 | 70 | ||
71 | /* We actually can't write halfwords properly if not word aligned */ | ||
72 | static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg) | ||
73 | { | ||
74 | if (machine_is_mainstone() && reg & 2) { | ||
75 | unsigned int v = val << 16; | ||
76 | v |= readl(ioaddr + (reg & ~2)) & 0xffff; | ||
77 | writel(v, ioaddr + (reg & ~2)); | ||
78 | } else { | ||
79 | writew(val, ioaddr + reg); | ||
80 | } | ||
81 | } | ||
82 | |||
60 | #elif defined(CONFIG_BLACKFIN) | 83 | #elif defined(CONFIG_BLACKFIN) |
61 | 84 | ||
62 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH | 85 | #define SMC_IRQ_FLAGS IRQF_TRIGGER_HIGH |
@@ -195,7 +218,6 @@ | |||
195 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) | 218 | #define SMC_outsw(a, r, p, l) writesw((a) + (r), p, l) |
196 | 219 | ||
197 | #elif defined(CONFIG_ARCH_INNOKOM) || \ | 220 | #elif defined(CONFIG_ARCH_INNOKOM) || \ |
198 | defined(CONFIG_MACH_MAINSTONE) || \ | ||
199 | defined(CONFIG_ARCH_PXA_IDP) || \ | 221 | defined(CONFIG_ARCH_PXA_IDP) || \ |
200 | defined(CONFIG_ARCH_RAMSES) || \ | 222 | defined(CONFIG_ARCH_RAMSES) || \ |
201 | defined(CONFIG_ARCH_PCM027) | 223 | defined(CONFIG_ARCH_PCM027) |
@@ -229,22 +251,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
229 | } | 251 | } |
230 | } | 252 | } |
231 | 253 | ||
232 | #elif defined(CONFIG_MACH_ZYLONITE) | ||
233 | |||
234 | #define SMC_CAN_USE_8BIT 1 | ||
235 | #define SMC_CAN_USE_16BIT 1 | ||
236 | #define SMC_CAN_USE_32BIT 0 | ||
237 | #define SMC_IO_SHIFT 0 | ||
238 | #define SMC_NOWAIT 1 | ||
239 | #define SMC_USE_PXA_DMA 1 | ||
240 | #define SMC_inb(a, r) readb((a) + (r)) | ||
241 | #define SMC_inw(a, r) readw((a) + (r)) | ||
242 | #define SMC_insw(a, r, p, l) insw((a) + (r), p, l) | ||
243 | #define SMC_outsw(a, r, p, l) outsw((a) + (r), p, l) | ||
244 | #define SMC_outb(v, a, r) writeb(v, (a) + (r)) | ||
245 | #define SMC_outw(v, a, r) writew(v, (a) + (r)) | ||
246 | #define SMC_IRQ_FLAGS (-1) /* from resource */ | ||
247 | |||
248 | #elif defined(CONFIG_ARCH_OMAP) | 254 | #elif defined(CONFIG_ARCH_OMAP) |
249 | 255 | ||
250 | /* We can only do 16-bit reads and writes in the static memory space. */ | 256 | /* We can only do 16-bit reads and writes in the static memory space. */ |
@@ -454,7 +460,6 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
454 | #define RPC_LSA_DEFAULT RPC_LED_100_10 | 460 | #define RPC_LSA_DEFAULT RPC_LED_100_10 |
455 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX | 461 | #define RPC_LSB_DEFAULT RPC_LED_TX_RX |
456 | 462 | ||
457 | #define SMC_DYNAMIC_BUS_CONFIG | ||
458 | #endif | 463 | #endif |
459 | 464 | ||
460 | 465 | ||
@@ -493,7 +498,7 @@ struct smc_local { | |||
493 | 498 | ||
494 | spinlock_t lock; | 499 | spinlock_t lock; |
495 | 500 | ||
496 | #ifdef SMC_USE_PXA_DMA | 501 | #ifdef CONFIG_ARCH_PXA |
497 | /* DMA needs the physical address of the chip */ | 502 | /* DMA needs the physical address of the chip */ |
498 | u_long physaddr; | 503 | u_long physaddr; |
499 | struct device *device; | 504 | struct device *device; |
@@ -501,20 +506,17 @@ struct smc_local { | |||
501 | void __iomem *base; | 506 | void __iomem *base; |
502 | void __iomem *datacs; | 507 | void __iomem *datacs; |
503 | 508 | ||
509 | /* the low address lines on some platforms aren't connected... */ | ||
510 | int io_shift; | ||
511 | |||
504 | struct smc91x_platdata cfg; | 512 | struct smc91x_platdata cfg; |
505 | }; | 513 | }; |
506 | 514 | ||
507 | #ifdef SMC_DYNAMIC_BUS_CONFIG | 515 | #define SMC_8BIT(p) ((p)->cfg.flags & SMC91X_USE_8BIT) |
508 | #define SMC_8BIT(p) (((p)->cfg.flags & SMC91X_USE_8BIT) && SMC_CAN_USE_8BIT) | 516 | #define SMC_16BIT(p) ((p)->cfg.flags & SMC91X_USE_16BIT) |
509 | #define SMC_16BIT(p) (((p)->cfg.flags & SMC91X_USE_16BIT) && SMC_CAN_USE_16BIT) | 517 | #define SMC_32BIT(p) ((p)->cfg.flags & SMC91X_USE_32BIT) |
510 | #define SMC_32BIT(p) (((p)->cfg.flags & SMC91X_USE_32BIT) && SMC_CAN_USE_32BIT) | ||
511 | #else | ||
512 | #define SMC_8BIT(p) SMC_CAN_USE_8BIT | ||
513 | #define SMC_16BIT(p) SMC_CAN_USE_16BIT | ||
514 | #define SMC_32BIT(p) SMC_CAN_USE_32BIT | ||
515 | #endif | ||
516 | 518 | ||
517 | #ifdef SMC_USE_PXA_DMA | 519 | #ifdef CONFIG_ARCH_PXA |
518 | /* | 520 | /* |
519 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is | 521 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is |
520 | * always happening in irq context so no need to worry about races. TX is | 522 | * always happening in irq context so no need to worry about races. TX is |
@@ -608,7 +610,7 @@ smc_pxa_dma_irq(int dma, void *dummy) | |||
608 | { | 610 | { |
609 | DCSR(dma) = 0; | 611 | DCSR(dma) = 0; |
610 | } | 612 | } |
611 | #endif /* SMC_USE_PXA_DMA */ | 613 | #endif /* CONFIG_ARCH_PXA */ |
612 | 614 | ||
613 | 615 | ||
614 | /* | 616 | /* |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 1b0eb5aaf650..86dd324c8ce0 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -219,7 +219,8 @@ config PCMCIA_SA1111 | |||
219 | config PCMCIA_PXA2XX | 219 | config PCMCIA_PXA2XX |
220 | tristate "PXA2xx support" | 220 | tristate "PXA2xx support" |
221 | depends on ARM && ARCH_PXA && PCMCIA | 221 | depends on ARM && ARCH_PXA && PCMCIA |
222 | depends on ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL || MACH_ARMCORE | 222 | depends on (ARCH_LUBBOCK || MACH_MAINSTONE || PXA_SHARPSL \ |
223 | || MACH_ARMCORE || ARCH_PXA_PALM) | ||
223 | help | 224 | help |
224 | Say Y here to include support for the PXA2xx PCMCIA controller | 225 | Say Y here to include support for the PXA2xx PCMCIA controller |
225 | 226 | ||
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 6f6478ba7174..8e6dd22e9300 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -71,4 +71,5 @@ pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o | |||
71 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | 71 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o |
72 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 72 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
73 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o | 73 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o |
74 | pxa2xx_cs-$(CONFIG_MACH_PALMTX) += pxa2xx_palmtx.o | ||
74 | 75 | ||
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c index e7ab060ff118..bb95db7d2b76 100644 --- a/drivers/pcmcia/pxa2xx_cm_x270.c +++ b/drivers/pcmcia/pxa2xx_cm_x270.c | |||
@@ -5,82 +5,60 @@ | |||
5 | * it under the terms of the GNU General Public License version 2 as | 5 | * it under the terms of the GNU General Public License version 2 as |
6 | * published by the Free Software Foundation. | 6 | * published by the Free Software Foundation. |
7 | * | 7 | * |
8 | * Compulab Ltd., 2003, 2007 | 8 | * Compulab Ltd., 2003, 2007, 2008 |
9 | * Mike Rapoport <mike@compulab.co.il> | 9 | * Mike Rapoport <mike@compulab.co.il> |
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
16 | #include <linux/irq.h> | 14 | #include <linux/irq.h> |
17 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/gpio.h> | ||
18 | 17 | ||
19 | #include <pcmcia/ss.h> | 18 | #include <asm/mach-types.h> |
20 | #include <asm/hardware.h> | ||
21 | |||
22 | #include <asm/arch/pxa-regs.h> | 19 | #include <asm/arch/pxa-regs.h> |
23 | #include <asm/arch/pxa2xx-gpio.h> | ||
24 | #include <asm/arch/cm-x270.h> | ||
25 | 20 | ||
26 | #include "soc_common.h" | 21 | #include "soc_common.h" |
27 | 22 | ||
23 | #define GPIO_PCMCIA_S0_CD_VALID (84) | ||
24 | #define GPIO_PCMCIA_S0_RDYINT (82) | ||
25 | #define GPIO_PCMCIA_RESET (53) | ||
26 | |||
27 | #define PCMCIA_S0_CD_VALID IRQ_GPIO(GPIO_PCMCIA_S0_CD_VALID) | ||
28 | #define PCMCIA_S0_RDYINT IRQ_GPIO(GPIO_PCMCIA_S0_RDYINT) | ||
29 | |||
30 | |||
28 | static struct pcmcia_irqs irqs[] = { | 31 | static struct pcmcia_irqs irqs[] = { |
29 | { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, | 32 | { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, |
30 | { 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" }, | ||
31 | }; | 33 | }; |
32 | 34 | ||
33 | static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | 35 | static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) |
34 | { | 36 | { |
35 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | 37 | int ret = gpio_request(GPIO_PCMCIA_RESET, "PCCard reset"); |
36 | GPIO_bit(GPIO49_nPWE) | | 38 | if (ret) |
37 | GPIO_bit(GPIO50_nPIOR) | | 39 | return ret; |
38 | GPIO_bit(GPIO51_nPIOW) | | 40 | gpio_direction_output(GPIO_PCMCIA_RESET, 0); |
39 | GPIO_bit(GPIO85_nPCE_1) | | 41 | |
40 | GPIO_bit(GPIO54_nPCE_2); | 42 | skt->irq = PCMCIA_S0_RDYINT; |
41 | 43 | ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | |
42 | pxa_gpio_mode(GPIO48_nPOE_MD); | 44 | if (!ret) |
43 | pxa_gpio_mode(GPIO49_nPWE_MD); | 45 | gpio_free(GPIO_PCMCIA_RESET); |
44 | pxa_gpio_mode(GPIO50_nPIOR_MD); | 46 | |
45 | pxa_gpio_mode(GPIO51_nPIOW_MD); | 47 | return ret; |
46 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
47 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
48 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
49 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
50 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
51 | |||
52 | /* Reset signal */ | ||
53 | pxa_gpio_mode(GPIO53_nPCE_2 | GPIO_OUT); | ||
54 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
55 | |||
56 | set_irq_type(PCMCIA_S0_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
57 | set_irq_type(PCMCIA_S1_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
58 | |||
59 | /* irq's for slots: */ | ||
60 | set_irq_type(PCMCIA_S0_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
61 | set_irq_type(PCMCIA_S1_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
62 | |||
63 | skt->irq = (skt->nr == 0) ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | ||
64 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
65 | } | 48 | } |
66 | 49 | ||
67 | static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt) | 50 | static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt) |
68 | { | 51 | { |
69 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 52 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
70 | 53 | gpio_free(GPIO_PCMCIA_RESET); | |
71 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_CD_VALID), IRQ_TYPE_NONE); | ||
72 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_CD_VALID), IRQ_TYPE_NONE); | ||
73 | |||
74 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_RDYINT), IRQ_TYPE_NONE); | ||
75 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_RDYINT), IRQ_TYPE_NONE); | ||
76 | } | 54 | } |
77 | 55 | ||
78 | 56 | ||
79 | static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | 57 | static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, |
80 | struct pcmcia_state *state) | 58 | struct pcmcia_state *state) |
81 | { | 59 | { |
82 | state->detect = (PCC_DETECT(skt->nr) == 0) ? 1 : 0; | 60 | state->detect = (gpio_get_value(GPIO_PCMCIA_S0_CD_VALID) == 0) ? 1 : 0; |
83 | state->ready = (PCC_READY(skt->nr) == 0) ? 0 : 1; | 61 | state->ready = (gpio_get_value(GPIO_PCMCIA_S0_RDYINT) == 0) ? 0 : 1; |
84 | state->bvd1 = 1; | 62 | state->bvd1 = 1; |
85 | state->bvd2 = 1; | 63 | state->bvd2 = 1; |
86 | state->vs_3v = 0; | 64 | state->vs_3v = 0; |
@@ -92,32 +70,16 @@ static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | |||
92 | static int cmx270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 70 | static int cmx270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
93 | const socket_state_t *state) | 71 | const socket_state_t *state) |
94 | { | 72 | { |
95 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
96 | pxa_gpio_mode(GPIO49_nPWE | GPIO_OUT); | ||
97 | |||
98 | switch (skt->nr) { | 73 | switch (skt->nr) { |
99 | case 0: | 74 | case 0: |
100 | if (state->flags & SS_RESET) { | 75 | if (state->flags & SS_RESET) { |
101 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | 76 | gpio_set_value(GPIO_PCMCIA_RESET, 1); |
102 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
103 | udelay(10); | 77 | udelay(10); |
104 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | 78 | gpio_set_value(GPIO_PCMCIA_RESET, 0); |
105 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
106 | } | ||
107 | break; | ||
108 | case 1: | ||
109 | if (state->flags & SS_RESET) { | ||
110 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
111 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
112 | udelay(10); | ||
113 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
114 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
115 | } | 79 | } |
116 | break; | 80 | break; |
117 | } | 81 | } |
118 | 82 | ||
119 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
120 | |||
121 | return 0; | 83 | return 0; |
122 | } | 84 | } |
123 | 85 | ||
@@ -130,7 +92,7 @@ static void cmx270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | |||
130 | } | 92 | } |
131 | 93 | ||
132 | 94 | ||
133 | static struct pcmcia_low_level cmx270_pcmcia_ops = { | 95 | static struct pcmcia_low_level cmx270_pcmcia_ops __initdata = { |
134 | .owner = THIS_MODULE, | 96 | .owner = THIS_MODULE, |
135 | .hw_init = cmx270_pcmcia_hw_init, | 97 | .hw_init = cmx270_pcmcia_hw_init, |
136 | .hw_shutdown = cmx270_pcmcia_shutdown, | 98 | .hw_shutdown = cmx270_pcmcia_shutdown, |
@@ -138,7 +100,7 @@ static struct pcmcia_low_level cmx270_pcmcia_ops = { | |||
138 | .configure_socket = cmx270_pcmcia_configure_socket, | 100 | .configure_socket = cmx270_pcmcia_configure_socket, |
139 | .socket_init = cmx270_pcmcia_socket_init, | 101 | .socket_init = cmx270_pcmcia_socket_init, |
140 | .socket_suspend = cmx270_pcmcia_socket_suspend, | 102 | .socket_suspend = cmx270_pcmcia_socket_suspend, |
141 | .nr = 2, | 103 | .nr = 1, |
142 | }; | 104 | }; |
143 | 105 | ||
144 | static struct platform_device *cmx270_pcmcia_device; | 106 | static struct platform_device *cmx270_pcmcia_device; |
@@ -147,15 +109,21 @@ static int __init cmx270_pcmcia_init(void) | |||
147 | { | 109 | { |
148 | int ret; | 110 | int ret; |
149 | 111 | ||
112 | if (!machine_is_armcore()) | ||
113 | return -ENODEV; | ||
114 | |||
150 | cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | 115 | cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); |
151 | 116 | ||
152 | if (!cmx270_pcmcia_device) | 117 | if (!cmx270_pcmcia_device) |
153 | return -ENOMEM; | 118 | return -ENOMEM; |
154 | 119 | ||
155 | cmx270_pcmcia_device->dev.platform_data = &cmx270_pcmcia_ops; | 120 | ret = platform_device_add_data(cmx270_pcmcia_device, &cmx270_pcmcia_ops, |
121 | sizeof(cmx270_pcmcia_ops)); | ||
156 | 122 | ||
157 | printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n"); | 123 | if (ret == 0) { |
158 | ret = platform_device_add(cmx270_pcmcia_device); | 124 | printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n"); |
125 | ret = platform_device_add(cmx270_pcmcia_device); | ||
126 | } | ||
159 | 127 | ||
160 | if (ret) | 128 | if (ret) |
161 | platform_device_put(cmx270_pcmcia_device); | 129 | 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 | ||
139 | static struct pcmcia_low_level mst_pcmcia_ops = { | 140 | static 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_palmtx.c b/drivers/pcmcia/pxa2xx_palmtx.c new file mode 100644 index 000000000000..4abde190c1f5 --- /dev/null +++ b/drivers/pcmcia/pxa2xx_palmtx.c | |||
@@ -0,0 +1,118 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa2xx_palmtx.c | ||
3 | * | ||
4 | * Driver for Palm T|X PCMCIA | ||
5 | * | ||
6 | * Copyright (C) 2007-2008 Marek Vasut <marek.vasut@gmail.com> | ||
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 | |||
14 | #include <linux/module.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | |||
17 | #include <asm/mach-types.h> | ||
18 | |||
19 | #include <asm/arch/gpio.h> | ||
20 | #include <asm/arch/palmtx.h> | ||
21 | |||
22 | #include "soc_common.h" | ||
23 | |||
24 | static int palmtx_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
25 | { | ||
26 | skt->irq = IRQ_GPIO(GPIO_NR_PALMTX_PCMCIA_READY); | ||
27 | return 0; | ||
28 | } | ||
29 | |||
30 | static void palmtx_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | static void palmtx_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
35 | struct pcmcia_state *state) | ||
36 | { | ||
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; | ||
44 | } | ||
45 | |||
46 | static int | ||
47 | palmtx_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
48 | const socket_state_t *state) | ||
49 | { | ||
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)); | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | static void palmtx_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
59 | { | ||
60 | } | ||
61 | |||
62 | static void palmtx_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
63 | { | ||
64 | } | ||
65 | |||
66 | static struct pcmcia_low_level palmtx_pcmcia_ops = { | ||
67 | .owner = THIS_MODULE, | ||
68 | |||
69 | .first = 0, | ||
70 | .nr = 1, | ||
71 | |||
72 | .hw_init = palmtx_pcmcia_hw_init, | ||
73 | .hw_shutdown = palmtx_pcmcia_hw_shutdown, | ||
74 | |||
75 | .socket_state = palmtx_pcmcia_socket_state, | ||
76 | .configure_socket = palmtx_pcmcia_configure_socket, | ||
77 | |||
78 | .socket_init = palmtx_pcmcia_socket_init, | ||
79 | .socket_suspend = palmtx_pcmcia_socket_suspend, | ||
80 | }; | ||
81 | |||
82 | static struct platform_device *palmtx_pcmcia_device; | ||
83 | |||
84 | static int __init palmtx_pcmcia_init(void) | ||
85 | { | ||
86 | int ret; | ||
87 | |||
88 | if (!machine_is_palmtx()) | ||
89 | return -ENODEV; | ||
90 | |||
91 | palmtx_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
92 | if (!palmtx_pcmcia_device) | ||
93 | return -ENOMEM; | ||
94 | |||
95 | ret = platform_device_add_data(palmtx_pcmcia_device, &palmtx_pcmcia_ops, | ||
96 | sizeof(palmtx_pcmcia_ops)); | ||
97 | |||
98 | if (!ret) | ||
99 | ret = platform_device_add(palmtx_pcmcia_device); | ||
100 | |||
101 | if (ret) | ||
102 | platform_device_put(palmtx_pcmcia_device); | ||
103 | |||
104 | return ret; | ||
105 | } | ||
106 | |||
107 | static void __exit palmtx_pcmcia_exit(void) | ||
108 | { | ||
109 | platform_device_unregister(palmtx_pcmcia_device); | ||
110 | } | ||
111 | |||
112 | fs_initcall(palmtx_pcmcia_init); | ||
113 | module_exit(palmtx_pcmcia_exit); | ||
114 | |||
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"); | ||
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 | ||
225 | static struct pcmcia_low_level sharpsl_pcmcia_ops = { | 225 | static 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/power/Kconfig b/drivers/power/Kconfig index 58c806e9c58a..4d17d384578d 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
@@ -49,4 +49,10 @@ config BATTERY_OLPC | |||
49 | help | 49 | help |
50 | Say Y to enable support for the battery on the OLPC laptop. | 50 | Say Y to enable support for the battery on the OLPC laptop. |
51 | 51 | ||
52 | config BATTERY_PALMTX | ||
53 | tristate "Palm T|X battery" | ||
54 | depends on MACH_PALMTX | ||
55 | help | ||
56 | Say Y to enable support for the battery in Palm T|X. | ||
57 | |||
52 | endif # POWER_SUPPLY | 58 | endif # POWER_SUPPLY |
diff --git a/drivers/power/Makefile b/drivers/power/Makefile index 6413ded5fe5f..6f43a54ee420 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile | |||
@@ -20,3 +20,4 @@ obj-$(CONFIG_APM_POWER) += apm_power.o | |||
20 | obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o | 20 | obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o |
21 | obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o | 21 | obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o |
22 | obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o | 22 | obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o |
23 | obj-$(CONFIG_BATTERY_PALMTX) += palmtx_battery.o | ||
diff --git a/drivers/power/palmtx_battery.c b/drivers/power/palmtx_battery.c new file mode 100644 index 000000000000..244bb273a637 --- /dev/null +++ b/drivers/power/palmtx_battery.c | |||
@@ -0,0 +1,198 @@ | |||
1 | /* | ||
2 | * linux/drivers/power/palmtx_battery.c | ||
3 | * | ||
4 | * Battery measurement code for Palm T|X Handheld computer | ||
5 | * | ||
6 | * based on tosa_battery.c | ||
7 | * | ||
8 | * Copyright (C) 2008 Marek Vasut <marek.vasut@gmail.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | */ | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/power_supply.h> | ||
18 | #include <linux/wm97xx.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/spinlock.h> | ||
21 | #include <linux/interrupt.h> | ||
22 | #include <linux/gpio.h> | ||
23 | |||
24 | #include <asm/mach-types.h> | ||
25 | #include <asm/arch/palmtx.h> | ||
26 | |||
27 | static DEFINE_MUTEX(bat_lock); | ||
28 | static struct work_struct bat_work; | ||
29 | struct mutex work_lock; | ||
30 | int bat_status = POWER_SUPPLY_STATUS_DISCHARGING; | ||
31 | |||
32 | static unsigned long palmtx_read_bat(struct power_supply *bat_ps) | ||
33 | { | ||
34 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | ||
35 | WM97XX_AUX_ID3) * 1000 / 414; | ||
36 | } | ||
37 | |||
38 | static unsigned long palmtx_read_temp(struct power_supply *bat_ps) | ||
39 | { | ||
40 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | ||
41 | WM97XX_AUX_ID2); | ||
42 | } | ||
43 | |||
44 | static int palmtx_bat_get_property(struct power_supply *bat_ps, | ||
45 | enum power_supply_property psp, | ||
46 | union power_supply_propval *val) | ||
47 | { | ||
48 | switch (psp) { | ||
49 | case POWER_SUPPLY_PROP_STATUS: | ||
50 | val->intval = bat_status; | ||
51 | break; | ||
52 | case POWER_SUPPLY_PROP_TECHNOLOGY: | ||
53 | val->intval = POWER_SUPPLY_TECHNOLOGY_LIPO; | ||
54 | break; | ||
55 | case POWER_SUPPLY_PROP_VOLTAGE_NOW: | ||
56 | val->intval = palmtx_read_bat(bat_ps); | ||
57 | break; | ||
58 | case POWER_SUPPLY_PROP_VOLTAGE_MAX: | ||
59 | case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: | ||
60 | val->intval = PALMTX_BAT_MAX_VOLTAGE; | ||
61 | break; | ||
62 | case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: | ||
63 | val->intval = PALMTX_BAT_MIN_VOLTAGE; | ||
64 | break; | ||
65 | case POWER_SUPPLY_PROP_TEMP: | ||
66 | val->intval = palmtx_read_temp(bat_ps); | ||
67 | break; | ||
68 | case POWER_SUPPLY_PROP_PRESENT: | ||
69 | val->intval = 1; | ||
70 | break; | ||
71 | default: | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | static void palmtx_bat_external_power_changed(struct power_supply *bat_ps) | ||
78 | { | ||
79 | schedule_work(&bat_work); | ||
80 | } | ||
81 | |||
82 | static char *status_text[] = { | ||
83 | [POWER_SUPPLY_STATUS_UNKNOWN] = "Unknown", | ||
84 | [POWER_SUPPLY_STATUS_CHARGING] = "Charging", | ||
85 | [POWER_SUPPLY_STATUS_DISCHARGING] = "Discharging", | ||
86 | }; | ||
87 | |||
88 | static void palmtx_bat_update(struct power_supply *bat_ps) | ||
89 | { | ||
90 | int old_status = bat_status; | ||
91 | |||
92 | mutex_lock(&work_lock); | ||
93 | |||
94 | bat_status = gpio_get_value(GPIO_NR_PALMTX_POWER_DETECT) ? | ||
95 | POWER_SUPPLY_STATUS_CHARGING : | ||
96 | POWER_SUPPLY_STATUS_DISCHARGING; | ||
97 | |||
98 | if (old_status != bat_status) { | ||
99 | pr_debug("%s %s -> %s\n", bat_ps->name, | ||
100 | status_text[old_status], | ||
101 | status_text[bat_status]); | ||
102 | power_supply_changed(bat_ps); | ||
103 | } | ||
104 | |||
105 | mutex_unlock(&work_lock); | ||
106 | } | ||
107 | |||
108 | static enum power_supply_property palmtx_bat_main_props[] = { | ||
109 | POWER_SUPPLY_PROP_STATUS, | ||
110 | POWER_SUPPLY_PROP_TECHNOLOGY, | ||
111 | POWER_SUPPLY_PROP_VOLTAGE_NOW, | ||
112 | POWER_SUPPLY_PROP_VOLTAGE_MAX, | ||
113 | POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, | ||
114 | POWER_SUPPLY_PROP_TEMP, | ||
115 | POWER_SUPPLY_PROP_PRESENT, | ||
116 | }; | ||
117 | |||
118 | struct power_supply bat_ps = { | ||
119 | .name = "main-battery", | ||
120 | .type = POWER_SUPPLY_TYPE_BATTERY, | ||
121 | .properties = palmtx_bat_main_props, | ||
122 | .num_properties = ARRAY_SIZE(palmtx_bat_main_props), | ||
123 | .get_property = palmtx_bat_get_property, | ||
124 | .external_power_changed = palmtx_bat_external_power_changed, | ||
125 | .use_for_apm = 1, | ||
126 | }; | ||
127 | |||
128 | static void palmtx_bat_work(struct work_struct *work) | ||
129 | { | ||
130 | palmtx_bat_update(&bat_ps); | ||
131 | } | ||
132 | |||
133 | #ifdef CONFIG_PM | ||
134 | static int palmtx_bat_suspend(struct platform_device *dev, pm_message_t state) | ||
135 | { | ||
136 | flush_scheduled_work(); | ||
137 | return 0; | ||
138 | } | ||
139 | |||
140 | static int palmtx_bat_resume(struct platform_device *dev) | ||
141 | { | ||
142 | schedule_work(&bat_work); | ||
143 | return 0; | ||
144 | } | ||
145 | #else | ||
146 | #define palmtx_bat_suspend NULL | ||
147 | #define palmtx_bat_resume NULL | ||
148 | #endif | ||
149 | |||
150 | static int __devinit palmtx_bat_probe(struct platform_device *dev) | ||
151 | { | ||
152 | int ret = 0; | ||
153 | |||
154 | if (!machine_is_palmtx()) | ||
155 | return -ENODEV; | ||
156 | |||
157 | mutex_init(&work_lock); | ||
158 | |||
159 | INIT_WORK(&bat_work, palmtx_bat_work); | ||
160 | |||
161 | ret = power_supply_register(&dev->dev, &bat_ps); | ||
162 | if (!ret) | ||
163 | schedule_work(&bat_work); | ||
164 | |||
165 | return ret; | ||
166 | } | ||
167 | |||
168 | static int __devexit palmtx_bat_remove(struct platform_device *dev) | ||
169 | { | ||
170 | power_supply_unregister(&bat_ps); | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static struct platform_driver palmtx_bat_driver = { | ||
175 | .driver.name = "wm97xx-battery", | ||
176 | .driver.owner = THIS_MODULE, | ||
177 | .probe = palmtx_bat_probe, | ||
178 | .remove = __devexit_p(palmtx_bat_remove), | ||
179 | .suspend = palmtx_bat_suspend, | ||
180 | .resume = palmtx_bat_resume, | ||
181 | }; | ||
182 | |||
183 | static int __init palmtx_bat_init(void) | ||
184 | { | ||
185 | return platform_driver_register(&palmtx_bat_driver); | ||
186 | } | ||
187 | |||
188 | static void __exit palmtx_bat_exit(void) | ||
189 | { | ||
190 | platform_driver_unregister(&palmtx_bat_driver); | ||
191 | } | ||
192 | |||
193 | module_init(palmtx_bat_init); | ||
194 | module_exit(palmtx_bat_exit); | ||
195 | |||
196 | MODULE_LICENSE("GPL"); | ||
197 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | ||
198 | MODULE_DESCRIPTION("Palm T|X battery driver"); | ||
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 | ||
175 | config USB_GADGET_PXA2XX | 175 | config 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 | ||
190 | config USB_PXA2XX | 190 | config 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 |
198 | config USB_PXA2XX_SMALL | 198 | config 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 | |||
8 | obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o | 8 | obj-$(CONFIG_USB_DUMMY_HCD) += dummy_hcd.o |
9 | obj-$(CONFIG_USB_NET2280) += net2280.o | 9 | obj-$(CONFIG_USB_NET2280) += net2280.o |
10 | obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o | 10 | obj-$(CONFIG_USB_AMD5536UDC) += amd5536udc.o |
11 | obj-$(CONFIG_USB_PXA2XX) += pxa2xx_udc.o | 11 | obj-$(CONFIG_USB_PXA25X) += pxa25x_udc.o |
12 | obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o | 12 | obj-$(CONFIG_USB_PXA27X) += pxa27x_udc.o |
13 | obj-$(CONFIG_USB_GOKU) += goku_udc.o | 13 | obj-$(CONFIG_USB_GOKU) += goku_udc.o |
14 | obj-$(CONFIG_USB_OMAP) += omap_udc.o | 14 | obj-$(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..5d50031938ab 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 | ||
94 | static const char driver_name [] = "pxa2xx_udc"; | 99 | static const char driver_name [] = "pxa25x_udc"; |
95 | 100 | ||
96 | static const char ep0name [] = "ep0"; | 101 | static 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 | ||
129 | static void pxa2xx_ep_fifo_flush (struct usb_ep *ep); | 134 | static void pxa25x_ep_fifo_flush (struct usb_ep *ep); |
130 | static void nuke (struct pxa2xx_ep *, int status); | 135 | static 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 */ |
133 | static int is_vbus_present(void) | 138 | static int is_vbus_present(void) |
@@ -147,9 +152,10 @@ static int is_vbus_present(void) | |||
147 | static void pullup_off(void) | 152 | static void pullup_off(void) |
148 | { | 153 | { |
149 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 154 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
155 | int off_level = mach->gpio_pullup_inverted; | ||
150 | 156 | ||
151 | if (mach->gpio_pullup) | 157 | if (mach->gpio_pullup) |
152 | gpio_set_value(mach->gpio_pullup, 0); | 158 | gpio_set_value(mach->gpio_pullup, off_level); |
153 | else if (mach->udc_command) | 159 | else if (mach->udc_command) |
154 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 160 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); |
155 | } | 161 | } |
@@ -157,9 +163,10 @@ static void pullup_off(void) | |||
157 | static void pullup_on(void) | 163 | static void pullup_on(void) |
158 | { | 164 | { |
159 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 165 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
166 | int on_level = !mach->gpio_pullup_inverted; | ||
160 | 167 | ||
161 | if (mach->gpio_pullup) | 168 | if (mach->gpio_pullup) |
162 | gpio_set_value(mach->gpio_pullup, 1); | 169 | gpio_set_value(mach->gpio_pullup, on_level); |
163 | else if (mach->udc_command) | 170 | else if (mach->udc_command) |
164 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); | 171 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); |
165 | } | 172 | } |
@@ -212,24 +219,24 @@ static inline void udc_ack_int_UDCCR(int mask) | |||
212 | /* | 219 | /* |
213 | * endpoint enable/disable | 220 | * endpoint enable/disable |
214 | * | 221 | * |
215 | * we need to verify the descriptors used to enable endpoints. since pxa2xx | 222 | * we need to verify the descriptors used to enable endpoints. since pxa25x |
216 | * endpoint configurations are fixed, and are pretty much always enabled, | 223 | * endpoint configurations are fixed, and are pretty much always enabled, |
217 | * there's not a lot to manage here. | 224 | * there's not a lot to manage here. |
218 | * | 225 | * |
219 | * because pxa2xx can't selectively initialize bulk (or interrupt) endpoints, | 226 | * because pxa25x can't selectively initialize bulk (or interrupt) endpoints, |
220 | * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except | 227 | * (resetting endpoint halt and toggle), SET_INTERFACE is unusable except |
221 | * for a single interface (with only the default altsetting) and for gadget | 228 | * 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 | 229 | * 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 | 230 | * means that if you use ISO, you must violate the USB spec rule that all |
224 | * iso endpoints must be in non-default altsettings. | 231 | * iso endpoints must be in non-default altsettings. |
225 | */ | 232 | */ |
226 | static int pxa2xx_ep_enable (struct usb_ep *_ep, | 233 | static int pxa25x_ep_enable (struct usb_ep *_ep, |
227 | const struct usb_endpoint_descriptor *desc) | 234 | const struct usb_endpoint_descriptor *desc) |
228 | { | 235 | { |
229 | struct pxa2xx_ep *ep; | 236 | struct pxa25x_ep *ep; |
230 | struct pxa2xx_udc *dev; | 237 | struct pxa25x_udc *dev; |
231 | 238 | ||
232 | ep = container_of (_ep, struct pxa2xx_ep, ep); | 239 | ep = container_of (_ep, struct pxa25x_ep, ep); |
233 | if (!_ep || !desc || ep->desc || _ep->name == ep0name | 240 | if (!_ep || !desc || ep->desc || _ep->name == ep0name |
234 | || desc->bDescriptorType != USB_DT_ENDPOINT | 241 | || desc->bDescriptorType != USB_DT_ENDPOINT |
235 | || ep->bEndpointAddress != desc->bEndpointAddress | 242 | || ep->bEndpointAddress != desc->bEndpointAddress |
@@ -268,7 +275,7 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, | |||
268 | ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); | 275 | ep->ep.maxpacket = le16_to_cpu (desc->wMaxPacketSize); |
269 | 276 | ||
270 | /* flush fifo (mostly for OUT buffers) */ | 277 | /* flush fifo (mostly for OUT buffers) */ |
271 | pxa2xx_ep_fifo_flush (_ep); | 278 | pxa25x_ep_fifo_flush (_ep); |
272 | 279 | ||
273 | /* ... reset halt state too, if we could ... */ | 280 | /* ... reset halt state too, if we could ... */ |
274 | 281 | ||
@@ -276,12 +283,12 @@ static int pxa2xx_ep_enable (struct usb_ep *_ep, | |||
276 | return 0; | 283 | return 0; |
277 | } | 284 | } |
278 | 285 | ||
279 | static int pxa2xx_ep_disable (struct usb_ep *_ep) | 286 | static int pxa25x_ep_disable (struct usb_ep *_ep) |
280 | { | 287 | { |
281 | struct pxa2xx_ep *ep; | 288 | struct pxa25x_ep *ep; |
282 | unsigned long flags; | 289 | unsigned long flags; |
283 | 290 | ||
284 | ep = container_of (_ep, struct pxa2xx_ep, ep); | 291 | ep = container_of (_ep, struct pxa25x_ep, ep); |
285 | if (!_ep || !ep->desc) { | 292 | if (!_ep || !ep->desc) { |
286 | DMSG("%s, %s not enabled\n", __func__, | 293 | DMSG("%s, %s not enabled\n", __func__, |
287 | _ep ? ep->ep.name : NULL); | 294 | _ep ? ep->ep.name : NULL); |
@@ -292,7 +299,7 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
292 | nuke (ep, -ESHUTDOWN); | 299 | nuke (ep, -ESHUTDOWN); |
293 | 300 | ||
294 | /* flush fifo (mostly for IN buffers) */ | 301 | /* flush fifo (mostly for IN buffers) */ |
295 | pxa2xx_ep_fifo_flush (_ep); | 302 | pxa25x_ep_fifo_flush (_ep); |
296 | 303 | ||
297 | ep->desc = NULL; | 304 | ep->desc = NULL; |
298 | ep->stopped = 1; | 305 | ep->stopped = 1; |
@@ -304,18 +311,18 @@ static int pxa2xx_ep_disable (struct usb_ep *_ep) | |||
304 | 311 | ||
305 | /*-------------------------------------------------------------------------*/ | 312 | /*-------------------------------------------------------------------------*/ |
306 | 313 | ||
307 | /* for the pxa2xx, these can just wrap kmalloc/kfree. gadget drivers | 314 | /* for the pxa25x, these can just wrap kmalloc/kfree. gadget drivers |
308 | * must still pass correctly initialized endpoints, since other controller | 315 | * must still pass correctly initialized endpoints, since other controller |
309 | * drivers may care about how it's currently set up (dma issues etc). | 316 | * drivers may care about how it's currently set up (dma issues etc). |
310 | */ | 317 | */ |
311 | 318 | ||
312 | /* | 319 | /* |
313 | * pxa2xx_ep_alloc_request - allocate a request data structure | 320 | * pxa25x_ep_alloc_request - allocate a request data structure |
314 | */ | 321 | */ |
315 | static struct usb_request * | 322 | static struct usb_request * |
316 | pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) | 323 | pxa25x_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) |
317 | { | 324 | { |
318 | struct pxa2xx_request *req; | 325 | struct pxa25x_request *req; |
319 | 326 | ||
320 | req = kzalloc(sizeof(*req), gfp_flags); | 327 | req = kzalloc(sizeof(*req), gfp_flags); |
321 | if (!req) | 328 | if (!req) |
@@ -327,14 +334,14 @@ pxa2xx_ep_alloc_request (struct usb_ep *_ep, gfp_t gfp_flags) | |||
327 | 334 | ||
328 | 335 | ||
329 | /* | 336 | /* |
330 | * pxa2xx_ep_free_request - deallocate a request data structure | 337 | * pxa25x_ep_free_request - deallocate a request data structure |
331 | */ | 338 | */ |
332 | static void | 339 | static void |
333 | pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | 340 | pxa25x_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) |
334 | { | 341 | { |
335 | struct pxa2xx_request *req; | 342 | struct pxa25x_request *req; |
336 | 343 | ||
337 | req = container_of (_req, struct pxa2xx_request, req); | 344 | req = container_of (_req, struct pxa25x_request, req); |
338 | WARN_ON (!list_empty (&req->queue)); | 345 | WARN_ON (!list_empty (&req->queue)); |
339 | kfree(req); | 346 | kfree(req); |
340 | } | 347 | } |
@@ -344,7 +351,7 @@ pxa2xx_ep_free_request (struct usb_ep *_ep, struct usb_request *_req) | |||
344 | /* | 351 | /* |
345 | * done - retire a request; caller blocked irqs | 352 | * done - retire a request; caller blocked irqs |
346 | */ | 353 | */ |
347 | static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status) | 354 | static void done(struct pxa25x_ep *ep, struct pxa25x_request *req, int status) |
348 | { | 355 | { |
349 | unsigned stopped = ep->stopped; | 356 | unsigned stopped = ep->stopped; |
350 | 357 | ||
@@ -367,13 +374,13 @@ static void done(struct pxa2xx_ep *ep, struct pxa2xx_request *req, int status) | |||
367 | } | 374 | } |
368 | 375 | ||
369 | 376 | ||
370 | static inline void ep0_idle (struct pxa2xx_udc *dev) | 377 | static inline void ep0_idle (struct pxa25x_udc *dev) |
371 | { | 378 | { |
372 | dev->ep0state = EP0_IDLE; | 379 | dev->ep0state = EP0_IDLE; |
373 | } | 380 | } |
374 | 381 | ||
375 | static int | 382 | static int |
376 | write_packet(volatile u32 *uddr, struct pxa2xx_request *req, unsigned max) | 383 | write_packet(volatile u32 *uddr, struct pxa25x_request *req, unsigned max) |
377 | { | 384 | { |
378 | u8 *buf; | 385 | u8 *buf; |
379 | unsigned length, count; | 386 | unsigned length, count; |
@@ -398,7 +405,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). | 405 | * caller guarantees at least one packet buffer is ready (or a zlp). |
399 | */ | 406 | */ |
400 | static int | 407 | static int |
401 | write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | 408 | write_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) |
402 | { | 409 | { |
403 | unsigned max; | 410 | unsigned max; |
404 | 411 | ||
@@ -455,7 +462,7 @@ write_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
455 | * ep0 data stage. these chips want very simple state transitions. | 462 | * ep0 data stage. these chips want very simple state transitions. |
456 | */ | 463 | */ |
457 | static inline | 464 | static inline |
458 | void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) | 465 | void ep0start(struct pxa25x_udc *dev, u32 flags, const char *tag) |
459 | { | 466 | { |
460 | UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR; | 467 | UDCCS0 = flags|UDCCS0_SA|UDCCS0_OPR; |
461 | USIR0 = USIR0_IR0; | 468 | USIR0 = USIR0_IR0; |
@@ -465,7 +472,7 @@ void ep0start(struct pxa2xx_udc *dev, u32 flags, const char *tag) | |||
465 | } | 472 | } |
466 | 473 | ||
467 | static int | 474 | static int |
468 | write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | 475 | write_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) |
469 | { | 476 | { |
470 | unsigned count; | 477 | unsigned count; |
471 | int is_short; | 478 | int is_short; |
@@ -525,7 +532,7 @@ write_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
525 | * request buffer having filled (and maybe overran till end-of-packet). | 532 | * request buffer having filled (and maybe overran till end-of-packet). |
526 | */ | 533 | */ |
527 | static int | 534 | static int |
528 | read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | 535 | read_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) |
529 | { | 536 | { |
530 | for (;;) { | 537 | for (;;) { |
531 | u32 udccs; | 538 | u32 udccs; |
@@ -602,7 +609,7 @@ read_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
602 | * protocols do use them. | 609 | * protocols do use them. |
603 | */ | 610 | */ |
604 | static int | 611 | static int |
605 | read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | 612 | read_ep0_fifo (struct pxa25x_ep *ep, struct pxa25x_request *req) |
606 | { | 613 | { |
607 | u8 *buf, byte; | 614 | u8 *buf, byte; |
608 | unsigned bufferspace; | 615 | unsigned bufferspace; |
@@ -641,21 +648,21 @@ read_ep0_fifo (struct pxa2xx_ep *ep, struct pxa2xx_request *req) | |||
641 | /*-------------------------------------------------------------------------*/ | 648 | /*-------------------------------------------------------------------------*/ |
642 | 649 | ||
643 | static int | 650 | static int |
644 | pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | 651 | pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) |
645 | { | 652 | { |
646 | struct pxa2xx_request *req; | 653 | struct pxa25x_request *req; |
647 | struct pxa2xx_ep *ep; | 654 | struct pxa25x_ep *ep; |
648 | struct pxa2xx_udc *dev; | 655 | struct pxa25x_udc *dev; |
649 | unsigned long flags; | 656 | unsigned long flags; |
650 | 657 | ||
651 | req = container_of(_req, struct pxa2xx_request, req); | 658 | req = container_of(_req, struct pxa25x_request, req); |
652 | if (unlikely (!_req || !_req->complete || !_req->buf | 659 | if (unlikely (!_req || !_req->complete || !_req->buf |
653 | || !list_empty(&req->queue))) { | 660 | || !list_empty(&req->queue))) { |
654 | DMSG("%s, bad params\n", __func__); | 661 | DMSG("%s, bad params\n", __func__); |
655 | return -EINVAL; | 662 | return -EINVAL; |
656 | } | 663 | } |
657 | 664 | ||
658 | ep = container_of(_ep, struct pxa2xx_ep, ep); | 665 | ep = container_of(_ep, struct pxa25x_ep, ep); |
659 | if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) { | 666 | if (unlikely (!_ep || (!ep->desc && ep->ep.name != ep0name))) { |
660 | DMSG("%s, bad ep\n", __func__); | 667 | DMSG("%s, bad ep\n", __func__); |
661 | return -EINVAL; | 668 | return -EINVAL; |
@@ -751,14 +758,14 @@ pxa2xx_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) | |||
751 | /* | 758 | /* |
752 | * nuke - dequeue ALL requests | 759 | * nuke - dequeue ALL requests |
753 | */ | 760 | */ |
754 | static void nuke(struct pxa2xx_ep *ep, int status) | 761 | static void nuke(struct pxa25x_ep *ep, int status) |
755 | { | 762 | { |
756 | struct pxa2xx_request *req; | 763 | struct pxa25x_request *req; |
757 | 764 | ||
758 | /* called with irqs blocked */ | 765 | /* called with irqs blocked */ |
759 | while (!list_empty(&ep->queue)) { | 766 | while (!list_empty(&ep->queue)) { |
760 | req = list_entry(ep->queue.next, | 767 | req = list_entry(ep->queue.next, |
761 | struct pxa2xx_request, | 768 | struct pxa25x_request, |
762 | queue); | 769 | queue); |
763 | done(ep, req, status); | 770 | done(ep, req, status); |
764 | } | 771 | } |
@@ -768,13 +775,13 @@ static void nuke(struct pxa2xx_ep *ep, int status) | |||
768 | 775 | ||
769 | 776 | ||
770 | /* dequeue JUST ONE request */ | 777 | /* dequeue JUST ONE request */ |
771 | static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | 778 | static int pxa25x_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) |
772 | { | 779 | { |
773 | struct pxa2xx_ep *ep; | 780 | struct pxa25x_ep *ep; |
774 | struct pxa2xx_request *req; | 781 | struct pxa25x_request *req; |
775 | unsigned long flags; | 782 | unsigned long flags; |
776 | 783 | ||
777 | ep = container_of(_ep, struct pxa2xx_ep, ep); | 784 | ep = container_of(_ep, struct pxa25x_ep, ep); |
778 | if (!_ep || ep->ep.name == ep0name) | 785 | if (!_ep || ep->ep.name == ep0name) |
779 | return -EINVAL; | 786 | return -EINVAL; |
780 | 787 | ||
@@ -798,12 +805,12 @@ static int pxa2xx_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) | |||
798 | 805 | ||
799 | /*-------------------------------------------------------------------------*/ | 806 | /*-------------------------------------------------------------------------*/ |
800 | 807 | ||
801 | static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) | 808 | static int pxa25x_ep_set_halt(struct usb_ep *_ep, int value) |
802 | { | 809 | { |
803 | struct pxa2xx_ep *ep; | 810 | struct pxa25x_ep *ep; |
804 | unsigned long flags; | 811 | unsigned long flags; |
805 | 812 | ||
806 | ep = container_of(_ep, struct pxa2xx_ep, ep); | 813 | ep = container_of(_ep, struct pxa25x_ep, ep); |
807 | if (unlikely (!_ep | 814 | if (unlikely (!_ep |
808 | || (!ep->desc && ep->ep.name != ep0name)) | 815 | || (!ep->desc && ep->ep.name != ep0name)) |
809 | || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { | 816 | || ep->bmAttributes == USB_ENDPOINT_XFER_ISOC) { |
@@ -853,11 +860,11 @@ static int pxa2xx_ep_set_halt(struct usb_ep *_ep, int value) | |||
853 | return 0; | 860 | return 0; |
854 | } | 861 | } |
855 | 862 | ||
856 | static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) | 863 | static int pxa25x_ep_fifo_status(struct usb_ep *_ep) |
857 | { | 864 | { |
858 | struct pxa2xx_ep *ep; | 865 | struct pxa25x_ep *ep; |
859 | 866 | ||
860 | ep = container_of(_ep, struct pxa2xx_ep, ep); | 867 | ep = container_of(_ep, struct pxa25x_ep, ep); |
861 | if (!_ep) { | 868 | if (!_ep) { |
862 | DMSG("%s, bad ep\n", __func__); | 869 | DMSG("%s, bad ep\n", __func__); |
863 | return -ENODEV; | 870 | return -ENODEV; |
@@ -872,11 +879,11 @@ static int pxa2xx_ep_fifo_status(struct usb_ep *_ep) | |||
872 | return (*ep->reg_ubcr & 0xfff) + 1; | 879 | return (*ep->reg_ubcr & 0xfff) + 1; |
873 | } | 880 | } |
874 | 881 | ||
875 | static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) | 882 | static void pxa25x_ep_fifo_flush(struct usb_ep *_ep) |
876 | { | 883 | { |
877 | struct pxa2xx_ep *ep; | 884 | struct pxa25x_ep *ep; |
878 | 885 | ||
879 | ep = container_of(_ep, struct pxa2xx_ep, ep); | 886 | ep = container_of(_ep, struct pxa25x_ep, ep); |
880 | if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { | 887 | if (!_ep || ep->ep.name == ep0name || !list_empty(&ep->queue)) { |
881 | DMSG("%s, bad ep\n", __func__); | 888 | DMSG("%s, bad ep\n", __func__); |
882 | return; | 889 | return; |
@@ -898,19 +905,19 @@ static void pxa2xx_ep_fifo_flush(struct usb_ep *_ep) | |||
898 | } | 905 | } |
899 | 906 | ||
900 | 907 | ||
901 | static struct usb_ep_ops pxa2xx_ep_ops = { | 908 | static struct usb_ep_ops pxa25x_ep_ops = { |
902 | .enable = pxa2xx_ep_enable, | 909 | .enable = pxa25x_ep_enable, |
903 | .disable = pxa2xx_ep_disable, | 910 | .disable = pxa25x_ep_disable, |
904 | 911 | ||
905 | .alloc_request = pxa2xx_ep_alloc_request, | 912 | .alloc_request = pxa25x_ep_alloc_request, |
906 | .free_request = pxa2xx_ep_free_request, | 913 | .free_request = pxa25x_ep_free_request, |
907 | 914 | ||
908 | .queue = pxa2xx_ep_queue, | 915 | .queue = pxa25x_ep_queue, |
909 | .dequeue = pxa2xx_ep_dequeue, | 916 | .dequeue = pxa25x_ep_dequeue, |
910 | 917 | ||
911 | .set_halt = pxa2xx_ep_set_halt, | 918 | .set_halt = pxa25x_ep_set_halt, |
912 | .fifo_status = pxa2xx_ep_fifo_status, | 919 | .fifo_status = pxa25x_ep_fifo_status, |
913 | .fifo_flush = pxa2xx_ep_fifo_flush, | 920 | .fifo_flush = pxa25x_ep_fifo_flush, |
914 | }; | 921 | }; |
915 | 922 | ||
916 | 923 | ||
@@ -919,12 +926,12 @@ static struct usb_ep_ops pxa2xx_ep_ops = { | |||
919 | * --------------------------------------------------------------------------- | 926 | * --------------------------------------------------------------------------- |
920 | */ | 927 | */ |
921 | 928 | ||
922 | static int pxa2xx_udc_get_frame(struct usb_gadget *_gadget) | 929 | static int pxa25x_udc_get_frame(struct usb_gadget *_gadget) |
923 | { | 930 | { |
924 | return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff); | 931 | return ((UFNRH & 0x07) << 8) | (UFNRL & 0xff); |
925 | } | 932 | } |
926 | 933 | ||
927 | static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget) | 934 | static int pxa25x_udc_wakeup(struct usb_gadget *_gadget) |
928 | { | 935 | { |
929 | /* host may not have enabled remote wakeup */ | 936 | /* host may not have enabled remote wakeup */ |
930 | if ((UDCCS0 & UDCCS0_DRWF) == 0) | 937 | if ((UDCCS0 & UDCCS0_DRWF) == 0) |
@@ -933,14 +940,14 @@ static int pxa2xx_udc_wakeup(struct usb_gadget *_gadget) | |||
933 | return 0; | 940 | return 0; |
934 | } | 941 | } |
935 | 942 | ||
936 | static void stop_activity(struct pxa2xx_udc *, struct usb_gadget_driver *); | 943 | static void stop_activity(struct pxa25x_udc *, struct usb_gadget_driver *); |
937 | static void udc_enable (struct pxa2xx_udc *); | 944 | static void udc_enable (struct pxa25x_udc *); |
938 | static void udc_disable(struct pxa2xx_udc *); | 945 | static void udc_disable(struct pxa25x_udc *); |
939 | 946 | ||
940 | /* We disable the UDC -- and its 48 MHz clock -- whenever it's not | 947 | /* We disable the UDC -- and its 48 MHz clock -- whenever it's not |
941 | * in active use. | 948 | * in active use. |
942 | */ | 949 | */ |
943 | static int pullup(struct pxa2xx_udc *udc) | 950 | static int pullup(struct pxa25x_udc *udc) |
944 | { | 951 | { |
945 | int is_active = udc->vbus && udc->pullup && !udc->suspended; | 952 | int is_active = udc->vbus && udc->pullup && !udc->suspended; |
946 | DMSG("%s\n", is_active ? "active" : "inactive"); | 953 | DMSG("%s\n", is_active ? "active" : "inactive"); |
@@ -970,11 +977,11 @@ static int pullup(struct pxa2xx_udc *udc) | |||
970 | } | 977 | } |
971 | 978 | ||
972 | /* VBUS reporting logically comes from a transceiver */ | 979 | /* VBUS reporting logically comes from a transceiver */ |
973 | static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) | 980 | static int pxa25x_udc_vbus_session(struct usb_gadget *_gadget, int is_active) |
974 | { | 981 | { |
975 | struct pxa2xx_udc *udc; | 982 | struct pxa25x_udc *udc; |
976 | 983 | ||
977 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); | 984 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
978 | udc->vbus = (is_active != 0); | 985 | udc->vbus = (is_active != 0); |
979 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); | 986 | DMSG("vbus %s\n", is_active ? "supplied" : "inactive"); |
980 | pullup(udc); | 987 | pullup(udc); |
@@ -982,11 +989,11 @@ static int pxa2xx_udc_vbus_session(struct usb_gadget *_gadget, int is_active) | |||
982 | } | 989 | } |
983 | 990 | ||
984 | /* drivers may have software control over D+ pullup */ | 991 | /* drivers may have software control over D+ pullup */ |
985 | static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) | 992 | static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active) |
986 | { | 993 | { |
987 | struct pxa2xx_udc *udc; | 994 | struct pxa25x_udc *udc; |
988 | 995 | ||
989 | udc = container_of(_gadget, struct pxa2xx_udc, gadget); | 996 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
990 | 997 | ||
991 | /* not all boards support pullup control */ | 998 | /* not all boards support pullup control */ |
992 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 999 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
@@ -997,11 +1004,11 @@ static int pxa2xx_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
997 | return 0; | 1004 | return 0; |
998 | } | 1005 | } |
999 | 1006 | ||
1000 | static const struct usb_gadget_ops pxa2xx_udc_ops = { | 1007 | static const struct usb_gadget_ops pxa25x_udc_ops = { |
1001 | .get_frame = pxa2xx_udc_get_frame, | 1008 | .get_frame = pxa25x_udc_get_frame, |
1002 | .wakeup = pxa2xx_udc_wakeup, | 1009 | .wakeup = pxa25x_udc_wakeup, |
1003 | .vbus_session = pxa2xx_udc_vbus_session, | 1010 | .vbus_session = pxa25x_udc_vbus_session, |
1004 | .pullup = pxa2xx_udc_pullup, | 1011 | .pullup = pxa25x_udc_pullup, |
1005 | 1012 | ||
1006 | // .vbus_draw ... boards may consume current from VBUS, up to | 1013 | // .vbus_draw ... boards may consume current from VBUS, up to |
1007 | // 100-500mA based on config. the 500uA suspend ceiling means | 1014 | // 100-500mA based on config. the 500uA suspend ceiling means |
@@ -1015,7 +1022,7 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = { | |||
1015 | static int | 1022 | static int |
1016 | udc_seq_show(struct seq_file *m, void *_d) | 1023 | udc_seq_show(struct seq_file *m, void *_d) |
1017 | { | 1024 | { |
1018 | struct pxa2xx_udc *dev = m->private; | 1025 | struct pxa25x_udc *dev = m->private; |
1019 | unsigned long flags; | 1026 | unsigned long flags; |
1020 | int i; | 1027 | int i; |
1021 | u32 tmp; | 1028 | u32 tmp; |
@@ -1076,8 +1083,8 @@ udc_seq_show(struct seq_file *m, void *_d) | |||
1076 | 1083 | ||
1077 | /* dump endpoint queues */ | 1084 | /* dump endpoint queues */ |
1078 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { | 1085 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { |
1079 | struct pxa2xx_ep *ep = &dev->ep [i]; | 1086 | struct pxa25x_ep *ep = &dev->ep [i]; |
1080 | struct pxa2xx_request *req; | 1087 | struct pxa25x_request *req; |
1081 | 1088 | ||
1082 | if (i != 0) { | 1089 | if (i != 0) { |
1083 | const struct usb_endpoint_descriptor *desc; | 1090 | const struct usb_endpoint_descriptor *desc; |
@@ -1150,7 +1157,7 @@ static const struct file_operations debug_fops = { | |||
1150 | /* | 1157 | /* |
1151 | * udc_disable - disable USB device controller | 1158 | * udc_disable - disable USB device controller |
1152 | */ | 1159 | */ |
1153 | static void udc_disable(struct pxa2xx_udc *dev) | 1160 | static void udc_disable(struct pxa25x_udc *dev) |
1154 | { | 1161 | { |
1155 | /* block all irqs */ | 1162 | /* block all irqs */ |
1156 | udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM); | 1163 | udc_set_mask_UDCCR(UDCCR_SRM|UDCCR_REM); |
@@ -1170,7 +1177,7 @@ static void udc_disable(struct pxa2xx_udc *dev) | |||
1170 | /* | 1177 | /* |
1171 | * udc_reinit - initialize software state | 1178 | * udc_reinit - initialize software state |
1172 | */ | 1179 | */ |
1173 | static void udc_reinit(struct pxa2xx_udc *dev) | 1180 | static void udc_reinit(struct pxa25x_udc *dev) |
1174 | { | 1181 | { |
1175 | u32 i; | 1182 | u32 i; |
1176 | 1183 | ||
@@ -1181,7 +1188,7 @@ static void udc_reinit(struct pxa2xx_udc *dev) | |||
1181 | 1188 | ||
1182 | /* basic endpoint records init */ | 1189 | /* basic endpoint records init */ |
1183 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { | 1190 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { |
1184 | struct pxa2xx_ep *ep = &dev->ep[i]; | 1191 | struct pxa25x_ep *ep = &dev->ep[i]; |
1185 | 1192 | ||
1186 | if (i != 0) | 1193 | if (i != 0) |
1187 | list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); | 1194 | list_add_tail (&ep->ep.ep_list, &dev->gadget.ep_list); |
@@ -1198,7 +1205,7 @@ static void udc_reinit(struct pxa2xx_udc *dev) | |||
1198 | /* until it's enabled, this UDC should be completely invisible | 1205 | /* until it's enabled, this UDC should be completely invisible |
1199 | * to any USB host. | 1206 | * to any USB host. |
1200 | */ | 1207 | */ |
1201 | static void udc_enable (struct pxa2xx_udc *dev) | 1208 | static void udc_enable (struct pxa25x_udc *dev) |
1202 | { | 1209 | { |
1203 | udc_clear_mask_UDCCR(UDCCR_UDE); | 1210 | udc_clear_mask_UDCCR(UDCCR_UDE); |
1204 | 1211 | ||
@@ -1254,7 +1261,7 @@ static void udc_enable (struct pxa2xx_udc *dev) | |||
1254 | */ | 1261 | */ |
1255 | int usb_gadget_register_driver(struct usb_gadget_driver *driver) | 1262 | int usb_gadget_register_driver(struct usb_gadget_driver *driver) |
1256 | { | 1263 | { |
1257 | struct pxa2xx_udc *dev = the_controller; | 1264 | struct pxa25x_udc *dev = the_controller; |
1258 | int retval; | 1265 | int retval; |
1259 | 1266 | ||
1260 | if (!driver | 1267 | if (!driver |
@@ -1299,7 +1306,7 @@ fail: | |||
1299 | EXPORT_SYMBOL(usb_gadget_register_driver); | 1306 | EXPORT_SYMBOL(usb_gadget_register_driver); |
1300 | 1307 | ||
1301 | static void | 1308 | static void |
1302 | stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) | 1309 | stop_activity(struct pxa25x_udc *dev, struct usb_gadget_driver *driver) |
1303 | { | 1310 | { |
1304 | int i; | 1311 | int i; |
1305 | 1312 | ||
@@ -1310,7 +1317,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) | |||
1310 | 1317 | ||
1311 | /* prevent new request submissions, kill any outstanding requests */ | 1318 | /* prevent new request submissions, kill any outstanding requests */ |
1312 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { | 1319 | for (i = 0; i < PXA_UDC_NUM_ENDPOINTS; i++) { |
1313 | struct pxa2xx_ep *ep = &dev->ep[i]; | 1320 | struct pxa25x_ep *ep = &dev->ep[i]; |
1314 | 1321 | ||
1315 | ep->stopped = 1; | 1322 | ep->stopped = 1; |
1316 | nuke(ep, -ESHUTDOWN); | 1323 | nuke(ep, -ESHUTDOWN); |
@@ -1327,7 +1334,7 @@ stop_activity(struct pxa2xx_udc *dev, struct usb_gadget_driver *driver) | |||
1327 | 1334 | ||
1328 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) | 1335 | int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) |
1329 | { | 1336 | { |
1330 | struct pxa2xx_udc *dev = the_controller; | 1337 | struct pxa25x_udc *dev = the_controller; |
1331 | 1338 | ||
1332 | if (!dev) | 1339 | if (!dev) |
1333 | return -ENODEV; | 1340 | return -ENODEV; |
@@ -1364,7 +1371,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver); | |||
1364 | static irqreturn_t | 1371 | static irqreturn_t |
1365 | lubbock_vbus_irq(int irq, void *_dev) | 1372 | lubbock_vbus_irq(int irq, void *_dev) |
1366 | { | 1373 | { |
1367 | struct pxa2xx_udc *dev = _dev; | 1374 | struct pxa25x_udc *dev = _dev; |
1368 | int vbus; | 1375 | int vbus; |
1369 | 1376 | ||
1370 | dev->stats.irqs++; | 1377 | dev->stats.irqs++; |
@@ -1383,7 +1390,7 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1383 | return IRQ_NONE; | 1390 | return IRQ_NONE; |
1384 | } | 1391 | } |
1385 | 1392 | ||
1386 | pxa2xx_udc_vbus_session(&dev->gadget, vbus); | 1393 | pxa25x_udc_vbus_session(&dev->gadget, vbus); |
1387 | return IRQ_HANDLED; | 1394 | return IRQ_HANDLED; |
1388 | } | 1395 | } |
1389 | 1396 | ||
@@ -1391,20 +1398,20 @@ lubbock_vbus_irq(int irq, void *_dev) | |||
1391 | 1398 | ||
1392 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) | 1399 | static irqreturn_t udc_vbus_irq(int irq, void *_dev) |
1393 | { | 1400 | { |
1394 | struct pxa2xx_udc *dev = _dev; | 1401 | struct pxa25x_udc *dev = _dev; |
1395 | int vbus = gpio_get_value(dev->mach->gpio_vbus); | 1402 | int vbus = gpio_get_value(dev->mach->gpio_vbus); |
1396 | 1403 | ||
1397 | if (dev->mach->gpio_vbus_inverted) | 1404 | if (dev->mach->gpio_vbus_inverted) |
1398 | vbus = !vbus; | 1405 | vbus = !vbus; |
1399 | 1406 | ||
1400 | pxa2xx_udc_vbus_session(&dev->gadget, vbus); | 1407 | pxa25x_udc_vbus_session(&dev->gadget, vbus); |
1401 | return IRQ_HANDLED; | 1408 | return IRQ_HANDLED; |
1402 | } | 1409 | } |
1403 | 1410 | ||
1404 | 1411 | ||
1405 | /*-------------------------------------------------------------------------*/ | 1412 | /*-------------------------------------------------------------------------*/ |
1406 | 1413 | ||
1407 | static inline void clear_ep_state (struct pxa2xx_udc *dev) | 1414 | static inline void clear_ep_state (struct pxa25x_udc *dev) |
1408 | { | 1415 | { |
1409 | unsigned i; | 1416 | unsigned i; |
1410 | 1417 | ||
@@ -1417,7 +1424,7 @@ static inline void clear_ep_state (struct pxa2xx_udc *dev) | |||
1417 | 1424 | ||
1418 | static void udc_watchdog(unsigned long _dev) | 1425 | static void udc_watchdog(unsigned long _dev) |
1419 | { | 1426 | { |
1420 | struct pxa2xx_udc *dev = (void *)_dev; | 1427 | struct pxa25x_udc *dev = (void *)_dev; |
1421 | 1428 | ||
1422 | local_irq_disable(); | 1429 | local_irq_disable(); |
1423 | if (dev->ep0state == EP0_STALL | 1430 | if (dev->ep0state == EP0_STALL |
@@ -1430,11 +1437,11 @@ static void udc_watchdog(unsigned long _dev) | |||
1430 | local_irq_enable(); | 1437 | local_irq_enable(); |
1431 | } | 1438 | } |
1432 | 1439 | ||
1433 | static void handle_ep0 (struct pxa2xx_udc *dev) | 1440 | static void handle_ep0 (struct pxa25x_udc *dev) |
1434 | { | 1441 | { |
1435 | u32 udccs0 = UDCCS0; | 1442 | u32 udccs0 = UDCCS0; |
1436 | struct pxa2xx_ep *ep = &dev->ep [0]; | 1443 | struct pxa25x_ep *ep = &dev->ep [0]; |
1437 | struct pxa2xx_request *req; | 1444 | struct pxa25x_request *req; |
1438 | union { | 1445 | union { |
1439 | struct usb_ctrlrequest r; | 1446 | struct usb_ctrlrequest r; |
1440 | u8 raw [8]; | 1447 | u8 raw [8]; |
@@ -1444,7 +1451,7 @@ static void handle_ep0 (struct pxa2xx_udc *dev) | |||
1444 | if (list_empty(&ep->queue)) | 1451 | if (list_empty(&ep->queue)) |
1445 | req = NULL; | 1452 | req = NULL; |
1446 | else | 1453 | else |
1447 | req = list_entry(ep->queue.next, struct pxa2xx_request, queue); | 1454 | req = list_entry(ep->queue.next, struct pxa25x_request, queue); |
1448 | 1455 | ||
1449 | /* clear stall status */ | 1456 | /* clear stall status */ |
1450 | if (udccs0 & UDCCS0_SST) { | 1457 | if (udccs0 & UDCCS0_SST) { |
@@ -1654,9 +1661,9 @@ stall: | |||
1654 | USIR0 = USIR0_IR0; | 1661 | USIR0 = USIR0_IR0; |
1655 | } | 1662 | } |
1656 | 1663 | ||
1657 | static void handle_ep(struct pxa2xx_ep *ep) | 1664 | static void handle_ep(struct pxa25x_ep *ep) |
1658 | { | 1665 | { |
1659 | struct pxa2xx_request *req; | 1666 | struct pxa25x_request *req; |
1660 | int is_in = ep->bEndpointAddress & USB_DIR_IN; | 1667 | int is_in = ep->bEndpointAddress & USB_DIR_IN; |
1661 | int completed; | 1668 | int completed; |
1662 | u32 udccs, tmp; | 1669 | u32 udccs, tmp; |
@@ -1665,7 +1672,7 @@ static void handle_ep(struct pxa2xx_ep *ep) | |||
1665 | completed = 0; | 1672 | completed = 0; |
1666 | if (likely (!list_empty(&ep->queue))) | 1673 | if (likely (!list_empty(&ep->queue))) |
1667 | req = list_entry(ep->queue.next, | 1674 | req = list_entry(ep->queue.next, |
1668 | struct pxa2xx_request, queue); | 1675 | struct pxa25x_request, queue); |
1669 | else | 1676 | else |
1670 | req = NULL; | 1677 | req = NULL; |
1671 | 1678 | ||
@@ -1702,16 +1709,16 @@ static void handle_ep(struct pxa2xx_ep *ep) | |||
1702 | } | 1709 | } |
1703 | 1710 | ||
1704 | /* | 1711 | /* |
1705 | * pxa2xx_udc_irq - interrupt handler | 1712 | * pxa25x_udc_irq - interrupt handler |
1706 | * | 1713 | * |
1707 | * avoid delays in ep0 processing. the control handshaking isn't always | 1714 | * avoid delays in ep0 processing. the control handshaking isn't always |
1708 | * under software control (pxa250c0 and the pxa255 are better), and delays | 1715 | * under software control (pxa250c0 and the pxa255 are better), and delays |
1709 | * could cause usb protocol errors. | 1716 | * could cause usb protocol errors. |
1710 | */ | 1717 | */ |
1711 | static irqreturn_t | 1718 | static irqreturn_t |
1712 | pxa2xx_udc_irq(int irq, void *_dev) | 1719 | pxa25x_udc_irq(int irq, void *_dev) |
1713 | { | 1720 | { |
1714 | struct pxa2xx_udc *dev = _dev; | 1721 | struct pxa25x_udc *dev = _dev; |
1715 | int handled; | 1722 | int handled; |
1716 | 1723 | ||
1717 | dev->stats.irqs++; | 1724 | dev->stats.irqs++; |
@@ -1820,9 +1827,9 @@ static void nop_release (struct device *dev) | |||
1820 | * doing it at run-time) to save code, eliminate fault paths, and | 1827 | * doing it at run-time) to save code, eliminate fault paths, and |
1821 | * be more obviously correct. | 1828 | * be more obviously correct. |
1822 | */ | 1829 | */ |
1823 | static struct pxa2xx_udc memory = { | 1830 | static struct pxa25x_udc memory = { |
1824 | .gadget = { | 1831 | .gadget = { |
1825 | .ops = &pxa2xx_udc_ops, | 1832 | .ops = &pxa25x_udc_ops, |
1826 | .ep0 = &memory.ep[0].ep, | 1833 | .ep0 = &memory.ep[0].ep, |
1827 | .name = driver_name, | 1834 | .name = driver_name, |
1828 | .dev = { | 1835 | .dev = { |
@@ -1835,7 +1842,7 @@ static struct pxa2xx_udc memory = { | |||
1835 | .ep[0] = { | 1842 | .ep[0] = { |
1836 | .ep = { | 1843 | .ep = { |
1837 | .name = ep0name, | 1844 | .name = ep0name, |
1838 | .ops = &pxa2xx_ep_ops, | 1845 | .ops = &pxa25x_ep_ops, |
1839 | .maxpacket = EP0_FIFO_SIZE, | 1846 | .maxpacket = EP0_FIFO_SIZE, |
1840 | }, | 1847 | }, |
1841 | .dev = &memory, | 1848 | .dev = &memory, |
@@ -1847,7 +1854,7 @@ static struct pxa2xx_udc memory = { | |||
1847 | .ep[1] = { | 1854 | .ep[1] = { |
1848 | .ep = { | 1855 | .ep = { |
1849 | .name = "ep1in-bulk", | 1856 | .name = "ep1in-bulk", |
1850 | .ops = &pxa2xx_ep_ops, | 1857 | .ops = &pxa25x_ep_ops, |
1851 | .maxpacket = BULK_FIFO_SIZE, | 1858 | .maxpacket = BULK_FIFO_SIZE, |
1852 | }, | 1859 | }, |
1853 | .dev = &memory, | 1860 | .dev = &memory, |
@@ -1860,7 +1867,7 @@ static struct pxa2xx_udc memory = { | |||
1860 | .ep[2] = { | 1867 | .ep[2] = { |
1861 | .ep = { | 1868 | .ep = { |
1862 | .name = "ep2out-bulk", | 1869 | .name = "ep2out-bulk", |
1863 | .ops = &pxa2xx_ep_ops, | 1870 | .ops = &pxa25x_ep_ops, |
1864 | .maxpacket = BULK_FIFO_SIZE, | 1871 | .maxpacket = BULK_FIFO_SIZE, |
1865 | }, | 1872 | }, |
1866 | .dev = &memory, | 1873 | .dev = &memory, |
@@ -1871,11 +1878,11 @@ static struct pxa2xx_udc memory = { | |||
1871 | .reg_ubcr = &UBCR2, | 1878 | .reg_ubcr = &UBCR2, |
1872 | .reg_uddr = &UDDR2, | 1879 | .reg_uddr = &UDDR2, |
1873 | }, | 1880 | }, |
1874 | #ifndef CONFIG_USB_PXA2XX_SMALL | 1881 | #ifndef CONFIG_USB_PXA25X_SMALL |
1875 | .ep[3] = { | 1882 | .ep[3] = { |
1876 | .ep = { | 1883 | .ep = { |
1877 | .name = "ep3in-iso", | 1884 | .name = "ep3in-iso", |
1878 | .ops = &pxa2xx_ep_ops, | 1885 | .ops = &pxa25x_ep_ops, |
1879 | .maxpacket = ISO_FIFO_SIZE, | 1886 | .maxpacket = ISO_FIFO_SIZE, |
1880 | }, | 1887 | }, |
1881 | .dev = &memory, | 1888 | .dev = &memory, |
@@ -1888,7 +1895,7 @@ static struct pxa2xx_udc memory = { | |||
1888 | .ep[4] = { | 1895 | .ep[4] = { |
1889 | .ep = { | 1896 | .ep = { |
1890 | .name = "ep4out-iso", | 1897 | .name = "ep4out-iso", |
1891 | .ops = &pxa2xx_ep_ops, | 1898 | .ops = &pxa25x_ep_ops, |
1892 | .maxpacket = ISO_FIFO_SIZE, | 1899 | .maxpacket = ISO_FIFO_SIZE, |
1893 | }, | 1900 | }, |
1894 | .dev = &memory, | 1901 | .dev = &memory, |
@@ -1902,7 +1909,7 @@ static struct pxa2xx_udc memory = { | |||
1902 | .ep[5] = { | 1909 | .ep[5] = { |
1903 | .ep = { | 1910 | .ep = { |
1904 | .name = "ep5in-int", | 1911 | .name = "ep5in-int", |
1905 | .ops = &pxa2xx_ep_ops, | 1912 | .ops = &pxa25x_ep_ops, |
1906 | .maxpacket = INT_FIFO_SIZE, | 1913 | .maxpacket = INT_FIFO_SIZE, |
1907 | }, | 1914 | }, |
1908 | .dev = &memory, | 1915 | .dev = &memory, |
@@ -1917,7 +1924,7 @@ static struct pxa2xx_udc memory = { | |||
1917 | .ep[6] = { | 1924 | .ep[6] = { |
1918 | .ep = { | 1925 | .ep = { |
1919 | .name = "ep6in-bulk", | 1926 | .name = "ep6in-bulk", |
1920 | .ops = &pxa2xx_ep_ops, | 1927 | .ops = &pxa25x_ep_ops, |
1921 | .maxpacket = BULK_FIFO_SIZE, | 1928 | .maxpacket = BULK_FIFO_SIZE, |
1922 | }, | 1929 | }, |
1923 | .dev = &memory, | 1930 | .dev = &memory, |
@@ -1930,7 +1937,7 @@ static struct pxa2xx_udc memory = { | |||
1930 | .ep[7] = { | 1937 | .ep[7] = { |
1931 | .ep = { | 1938 | .ep = { |
1932 | .name = "ep7out-bulk", | 1939 | .name = "ep7out-bulk", |
1933 | .ops = &pxa2xx_ep_ops, | 1940 | .ops = &pxa25x_ep_ops, |
1934 | .maxpacket = BULK_FIFO_SIZE, | 1941 | .maxpacket = BULK_FIFO_SIZE, |
1935 | }, | 1942 | }, |
1936 | .dev = &memory, | 1943 | .dev = &memory, |
@@ -1944,7 +1951,7 @@ static struct pxa2xx_udc memory = { | |||
1944 | .ep[8] = { | 1951 | .ep[8] = { |
1945 | .ep = { | 1952 | .ep = { |
1946 | .name = "ep8in-iso", | 1953 | .name = "ep8in-iso", |
1947 | .ops = &pxa2xx_ep_ops, | 1954 | .ops = &pxa25x_ep_ops, |
1948 | .maxpacket = ISO_FIFO_SIZE, | 1955 | .maxpacket = ISO_FIFO_SIZE, |
1949 | }, | 1956 | }, |
1950 | .dev = &memory, | 1957 | .dev = &memory, |
@@ -1957,7 +1964,7 @@ static struct pxa2xx_udc memory = { | |||
1957 | .ep[9] = { | 1964 | .ep[9] = { |
1958 | .ep = { | 1965 | .ep = { |
1959 | .name = "ep9out-iso", | 1966 | .name = "ep9out-iso", |
1960 | .ops = &pxa2xx_ep_ops, | 1967 | .ops = &pxa25x_ep_ops, |
1961 | .maxpacket = ISO_FIFO_SIZE, | 1968 | .maxpacket = ISO_FIFO_SIZE, |
1962 | }, | 1969 | }, |
1963 | .dev = &memory, | 1970 | .dev = &memory, |
@@ -1971,7 +1978,7 @@ static struct pxa2xx_udc memory = { | |||
1971 | .ep[10] = { | 1978 | .ep[10] = { |
1972 | .ep = { | 1979 | .ep = { |
1973 | .name = "ep10in-int", | 1980 | .name = "ep10in-int", |
1974 | .ops = &pxa2xx_ep_ops, | 1981 | .ops = &pxa25x_ep_ops, |
1975 | .maxpacket = INT_FIFO_SIZE, | 1982 | .maxpacket = INT_FIFO_SIZE, |
1976 | }, | 1983 | }, |
1977 | .dev = &memory, | 1984 | .dev = &memory, |
@@ -1986,7 +1993,7 @@ static struct pxa2xx_udc memory = { | |||
1986 | .ep[11] = { | 1993 | .ep[11] = { |
1987 | .ep = { | 1994 | .ep = { |
1988 | .name = "ep11in-bulk", | 1995 | .name = "ep11in-bulk", |
1989 | .ops = &pxa2xx_ep_ops, | 1996 | .ops = &pxa25x_ep_ops, |
1990 | .maxpacket = BULK_FIFO_SIZE, | 1997 | .maxpacket = BULK_FIFO_SIZE, |
1991 | }, | 1998 | }, |
1992 | .dev = &memory, | 1999 | .dev = &memory, |
@@ -1999,7 +2006,7 @@ static struct pxa2xx_udc memory = { | |||
1999 | .ep[12] = { | 2006 | .ep[12] = { |
2000 | .ep = { | 2007 | .ep = { |
2001 | .name = "ep12out-bulk", | 2008 | .name = "ep12out-bulk", |
2002 | .ops = &pxa2xx_ep_ops, | 2009 | .ops = &pxa25x_ep_ops, |
2003 | .maxpacket = BULK_FIFO_SIZE, | 2010 | .maxpacket = BULK_FIFO_SIZE, |
2004 | }, | 2011 | }, |
2005 | .dev = &memory, | 2012 | .dev = &memory, |
@@ -2013,7 +2020,7 @@ static struct pxa2xx_udc memory = { | |||
2013 | .ep[13] = { | 2020 | .ep[13] = { |
2014 | .ep = { | 2021 | .ep = { |
2015 | .name = "ep13in-iso", | 2022 | .name = "ep13in-iso", |
2016 | .ops = &pxa2xx_ep_ops, | 2023 | .ops = &pxa25x_ep_ops, |
2017 | .maxpacket = ISO_FIFO_SIZE, | 2024 | .maxpacket = ISO_FIFO_SIZE, |
2018 | }, | 2025 | }, |
2019 | .dev = &memory, | 2026 | .dev = &memory, |
@@ -2026,7 +2033,7 @@ static struct pxa2xx_udc memory = { | |||
2026 | .ep[14] = { | 2033 | .ep[14] = { |
2027 | .ep = { | 2034 | .ep = { |
2028 | .name = "ep14out-iso", | 2035 | .name = "ep14out-iso", |
2029 | .ops = &pxa2xx_ep_ops, | 2036 | .ops = &pxa25x_ep_ops, |
2030 | .maxpacket = ISO_FIFO_SIZE, | 2037 | .maxpacket = ISO_FIFO_SIZE, |
2031 | }, | 2038 | }, |
2032 | .dev = &memory, | 2039 | .dev = &memory, |
@@ -2040,7 +2047,7 @@ static struct pxa2xx_udc memory = { | |||
2040 | .ep[15] = { | 2047 | .ep[15] = { |
2041 | .ep = { | 2048 | .ep = { |
2042 | .name = "ep15in-int", | 2049 | .name = "ep15in-int", |
2043 | .ops = &pxa2xx_ep_ops, | 2050 | .ops = &pxa25x_ep_ops, |
2044 | .maxpacket = INT_FIFO_SIZE, | 2051 | .maxpacket = INT_FIFO_SIZE, |
2045 | }, | 2052 | }, |
2046 | .dev = &memory, | 2053 | .dev = &memory, |
@@ -2050,7 +2057,7 @@ static struct pxa2xx_udc memory = { | |||
2050 | .reg_udccs = &UDCCS15, | 2057 | .reg_udccs = &UDCCS15, |
2051 | .reg_uddr = &UDDR15, | 2058 | .reg_uddr = &UDDR15, |
2052 | }, | 2059 | }, |
2053 | #endif /* !CONFIG_USB_PXA2XX_SMALL */ | 2060 | #endif /* !CONFIG_USB_PXA25X_SMALL */ |
2054 | }; | 2061 | }; |
2055 | 2062 | ||
2056 | #define CP15R0_VENDOR_MASK 0xffffe000 | 2063 | #define CP15R0_VENDOR_MASK 0xffffe000 |
@@ -2090,9 +2097,9 @@ static struct pxa2xx_udc memory = { | |||
2090 | /* | 2097 | /* |
2091 | * probe - binds to the platform device | 2098 | * probe - binds to the platform device |
2092 | */ | 2099 | */ |
2093 | static int __init pxa2xx_udc_probe(struct platform_device *pdev) | 2100 | static int __init pxa25x_udc_probe(struct platform_device *pdev) |
2094 | { | 2101 | { |
2095 | struct pxa2xx_udc *dev = &memory; | 2102 | struct pxa25x_udc *dev = &memory; |
2096 | int retval, vbus_irq, irq; | 2103 | int retval, vbus_irq, irq; |
2097 | u32 chiprev; | 2104 | u32 chiprev; |
2098 | 2105 | ||
@@ -2155,7 +2162,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2155 | 2162 | ||
2156 | if (dev->mach->gpio_vbus) { | 2163 | if (dev->mach->gpio_vbus) { |
2157 | if ((retval = gpio_request(dev->mach->gpio_vbus, | 2164 | if ((retval = gpio_request(dev->mach->gpio_vbus, |
2158 | "pxa2xx_udc GPIO VBUS"))) { | 2165 | "pxa25x_udc GPIO VBUS"))) { |
2159 | dev_dbg(&pdev->dev, | 2166 | dev_dbg(&pdev->dev, |
2160 | "can't get vbus gpio %d, err: %d\n", | 2167 | "can't get vbus gpio %d, err: %d\n", |
2161 | dev->mach->gpio_vbus, retval); | 2168 | dev->mach->gpio_vbus, retval); |
@@ -2168,7 +2175,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2168 | 2175 | ||
2169 | if (dev->mach->gpio_pullup) { | 2176 | if (dev->mach->gpio_pullup) { |
2170 | if ((retval = gpio_request(dev->mach->gpio_pullup, | 2177 | if ((retval = gpio_request(dev->mach->gpio_pullup, |
2171 | "pca2xx_udc GPIO PULLUP"))) { | 2178 | "pca25x_udc GPIO PULLUP"))) { |
2172 | dev_dbg(&pdev->dev, | 2179 | dev_dbg(&pdev->dev, |
2173 | "can't get pullup gpio %d, err: %d\n", | 2180 | "can't get pullup gpio %d, err: %d\n", |
2174 | dev->mach->gpio_pullup, retval); | 2181 | dev->mach->gpio_pullup, retval); |
@@ -2194,7 +2201,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2194 | dev->vbus = is_vbus_present(); | 2201 | dev->vbus = is_vbus_present(); |
2195 | 2202 | ||
2196 | /* irq setup after old hardware state is cleaned up */ | 2203 | /* irq setup after old hardware state is cleaned up */ |
2197 | retval = request_irq(irq, pxa2xx_udc_irq, | 2204 | retval = request_irq(irq, pxa25x_udc_irq, |
2198 | IRQF_DISABLED, driver_name, dev); | 2205 | IRQF_DISABLED, driver_name, dev); |
2199 | if (retval != 0) { | 2206 | if (retval != 0) { |
2200 | pr_err("%s: can't get irq %d, err %d\n", | 2207 | pr_err("%s: can't get irq %d, err %d\n", |
@@ -2260,14 +2267,14 @@ lubbock_fail0: | |||
2260 | return retval; | 2267 | return retval; |
2261 | } | 2268 | } |
2262 | 2269 | ||
2263 | static void pxa2xx_udc_shutdown(struct platform_device *_dev) | 2270 | static void pxa25x_udc_shutdown(struct platform_device *_dev) |
2264 | { | 2271 | { |
2265 | pullup_off(); | 2272 | pullup_off(); |
2266 | } | 2273 | } |
2267 | 2274 | ||
2268 | static int __exit pxa2xx_udc_remove(struct platform_device *pdev) | 2275 | static int __exit pxa25x_udc_remove(struct platform_device *pdev) |
2269 | { | 2276 | { |
2270 | struct pxa2xx_udc *dev = platform_get_drvdata(pdev); | 2277 | struct pxa25x_udc *dev = platform_get_drvdata(pdev); |
2271 | 2278 | ||
2272 | if (dev->driver) | 2279 | if (dev->driver) |
2273 | return -EBUSY; | 2280 | return -EBUSY; |
@@ -2317,9 +2324,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 | 2324 | * VBUS IRQs should probably be ignored so that the PXA device just acts |
2318 | * "dead" to USB hosts until system resume. | 2325 | * "dead" to USB hosts until system resume. |
2319 | */ | 2326 | */ |
2320 | static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) | 2327 | static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state) |
2321 | { | 2328 | { |
2322 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); | 2329 | struct pxa25x_udc *udc = platform_get_drvdata(dev); |
2323 | unsigned long flags; | 2330 | unsigned long flags; |
2324 | 2331 | ||
2325 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 2332 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) |
@@ -2333,9 +2340,9 @@ static int pxa2xx_udc_suspend(struct platform_device *dev, pm_message_t state) | |||
2333 | return 0; | 2340 | return 0; |
2334 | } | 2341 | } |
2335 | 2342 | ||
2336 | static int pxa2xx_udc_resume(struct platform_device *dev) | 2343 | static int pxa25x_udc_resume(struct platform_device *dev) |
2337 | { | 2344 | { |
2338 | struct pxa2xx_udc *udc = platform_get_drvdata(dev); | 2345 | struct pxa25x_udc *udc = platform_get_drvdata(dev); |
2339 | unsigned long flags; | 2346 | unsigned long flags; |
2340 | 2347 | ||
2341 | udc->suspended = 0; | 2348 | udc->suspended = 0; |
@@ -2347,27 +2354,27 @@ static int pxa2xx_udc_resume(struct platform_device *dev) | |||
2347 | } | 2354 | } |
2348 | 2355 | ||
2349 | #else | 2356 | #else |
2350 | #define pxa2xx_udc_suspend NULL | 2357 | #define pxa25x_udc_suspend NULL |
2351 | #define pxa2xx_udc_resume NULL | 2358 | #define pxa25x_udc_resume NULL |
2352 | #endif | 2359 | #endif |
2353 | 2360 | ||
2354 | /*-------------------------------------------------------------------------*/ | 2361 | /*-------------------------------------------------------------------------*/ |
2355 | 2362 | ||
2356 | static struct platform_driver udc_driver = { | 2363 | static struct platform_driver udc_driver = { |
2357 | .shutdown = pxa2xx_udc_shutdown, | 2364 | .shutdown = pxa25x_udc_shutdown, |
2358 | .remove = __exit_p(pxa2xx_udc_remove), | 2365 | .remove = __exit_p(pxa25x_udc_remove), |
2359 | .suspend = pxa2xx_udc_suspend, | 2366 | .suspend = pxa25x_udc_suspend, |
2360 | .resume = pxa2xx_udc_resume, | 2367 | .resume = pxa25x_udc_resume, |
2361 | .driver = { | 2368 | .driver = { |
2362 | .owner = THIS_MODULE, | 2369 | .owner = THIS_MODULE, |
2363 | .name = "pxa2xx-udc", | 2370 | .name = "pxa25x-udc", |
2364 | }, | 2371 | }, |
2365 | }; | 2372 | }; |
2366 | 2373 | ||
2367 | static int __init udc_init(void) | 2374 | static int __init udc_init(void) |
2368 | { | 2375 | { |
2369 | pr_info("%s: version %s\n", driver_name, DRIVER_VERSION); | 2376 | pr_info("%s: version %s\n", driver_name, DRIVER_VERSION); |
2370 | return platform_driver_probe(&udc_driver, pxa2xx_udc_probe); | 2377 | return platform_driver_probe(&udc_driver, pxa25x_udc_probe); |
2371 | } | 2378 | } |
2372 | module_init(udc_init); | 2379 | module_init(udc_init); |
2373 | 2380 | ||
@@ -2380,4 +2387,4 @@ module_exit(udc_exit); | |||
2380 | MODULE_DESCRIPTION(DRIVER_DESC); | 2387 | MODULE_DESCRIPTION(DRIVER_DESC); |
2381 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); | 2388 | MODULE_AUTHOR("Frank Becker, Robert Schwebel, David Brownell"); |
2382 | MODULE_LICENSE("GPL"); | 2389 | MODULE_LICENSE("GPL"); |
2383 | MODULE_ALIAS("platform:pxa2xx-udc"); | 2390 | MODULE_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 | ||
48 | struct pxa2xx_udc; | 47 | struct pxa25x_udc; |
49 | 48 | ||
50 | struct pxa2xx_ep { | 49 | struct 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 | ||
75 | struct pxa2xx_request { | 74 | struct 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 | ||
110 | struct pxa2xx_udc { | 109 | struct 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 | ||
147 | static struct pxa2xx_udc *the_controller; | 146 | static struct pxa25x_udc *the_controller; |
148 | 147 | ||
149 | /*-------------------------------------------------------------------------*/ | 148 | /*-------------------------------------------------------------------------*/ |
150 | 149 | ||
@@ -209,7 +208,7 @@ dump_udccs0(const char *label) | |||
209 | } | 208 | } |
210 | 209 | ||
211 | static void __maybe_unused | 210 | static void __maybe_unused |
212 | dump_state(struct pxa2xx_udc *dev) | 211 | dump_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 */ |
2370 | MODULE_ALIAS("platform:pxa2xx-udc"); | 2371 | MODULE_ALIAS("platform:pxa27x-udc"); |
2371 | 2372 | ||
2372 | static struct platform_driver udc_driver = { | 2373 | static 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 | |||
116 | config 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 | |||
10 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o | 10 | obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o |
11 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o | 11 | obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o |
12 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o | 12 | obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o |
13 | obj-$(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 | |||
23 | struct pwm_bl_data { | ||
24 | struct pwm_device *pwm; | ||
25 | unsigned int period; | ||
26 | int (*notify)(int brightness); | ||
27 | }; | ||
28 | |||
29 | static 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 | |||
54 | static int pwm_backlight_get_brightness(struct backlight_device *bl) | ||
55 | { | ||
56 | return bl->props.brightness; | ||
57 | } | ||
58 | |||
59 | static struct backlight_ops pwm_backlight_ops = { | ||
60 | .update_status = pwm_backlight_update_status, | ||
61 | .get_brightness = pwm_backlight_get_brightness, | ||
62 | }; | ||
63 | |||
64 | static 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 | |||
111 | err_bl: | ||
112 | pwm_free(pb->pwm); | ||
113 | err_pwm: | ||
114 | kfree(pb); | ||
115 | err_alloc: | ||
116 | if (data->exit) | ||
117 | data->exit(&pdev->dev); | ||
118 | return ret; | ||
119 | } | ||
120 | |||
121 | static 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 | ||
138 | static 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 | |||
149 | static 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 | |||
161 | static 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 | |||
172 | static int __init pwm_backlight_init(void) | ||
173 | { | ||
174 | return platform_driver_register(&pwm_backlight_driver); | ||
175 | } | ||
176 | module_init(pwm_backlight_init); | ||
177 | |||
178 | static void __exit pwm_backlight_exit(void) | ||
179 | { | ||
180 | platform_driver_unregister(&pwm_backlight_driver); | ||
181 | } | ||
182 | module_exit(pwm_backlight_exit); | ||
183 | |||
184 | MODULE_DESCRIPTION("PWM based Backlight Driver"); | ||
185 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index fafe7db20d6d..bb2514369507 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -227,6 +227,22 @@ static int pxafb_bpp_to_lccr3(struct fb_var_screeninfo *var) | |||
227 | case 4: ret = LCCR3_4BPP; break; | 227 | case 4: ret = LCCR3_4BPP; break; |
228 | case 8: ret = LCCR3_8BPP; break; | 228 | case 8: ret = LCCR3_8BPP; break; |
229 | case 16: ret = LCCR3_16BPP; break; | 229 | case 16: ret = LCCR3_16BPP; break; |
230 | case 24: | ||
231 | switch (var->red.length + var->green.length + | ||
232 | var->blue.length + var->transp.length) { | ||
233 | case 18: ret = LCCR3_18BPP_P | LCCR3_PDFOR_3; break; | ||
234 | case 19: ret = LCCR3_19BPP_P; break; | ||
235 | } | ||
236 | break; | ||
237 | case 32: | ||
238 | switch (var->red.length + var->green.length + | ||
239 | var->blue.length + var->transp.length) { | ||
240 | case 18: ret = LCCR3_18BPP | LCCR3_PDFOR_3; break; | ||
241 | case 19: ret = LCCR3_19BPP; break; | ||
242 | case 24: ret = LCCR3_24BPP | LCCR3_PDFOR_3; break; | ||
243 | case 25: ret = LCCR3_25BPP; break; | ||
244 | } | ||
245 | break; | ||
230 | } | 246 | } |
231 | return ret; | 247 | return ret; |
232 | } | 248 | } |
@@ -345,6 +361,41 @@ static int pxafb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) | |||
345 | var->green.offset = 5; var->green.length = 6; | 361 | var->green.offset = 5; var->green.length = 6; |
346 | var->blue.offset = 0; var->blue.length = 5; | 362 | var->blue.offset = 0; var->blue.length = 5; |
347 | var->transp.offset = var->transp.length = 0; | 363 | var->transp.offset = var->transp.length = 0; |
364 | } else if (var->bits_per_pixel > 16) { | ||
365 | struct pxafb_mode_info *mode; | ||
366 | |||
367 | mode = pxafb_getmode(inf, var); | ||
368 | if (!mode) | ||
369 | return -EINVAL; | ||
370 | |||
371 | switch (mode->depth) { | ||
372 | case 18: /* RGB666 */ | ||
373 | var->transp.offset = var->transp.length = 0; | ||
374 | var->red.offset = 12; var->red.length = 6; | ||
375 | var->green.offset = 6; var->green.length = 6; | ||
376 | var->blue.offset = 0; var->blue.length = 6; | ||
377 | break; | ||
378 | case 19: /* RGBT666 */ | ||
379 | var->transp.offset = 18; var->transp.length = 1; | ||
380 | var->red.offset = 12; var->red.length = 6; | ||
381 | var->green.offset = 6; var->green.length = 6; | ||
382 | var->blue.offset = 0; var->blue.length = 6; | ||
383 | break; | ||
384 | case 24: /* RGB888 */ | ||
385 | var->transp.offset = var->transp.length = 0; | ||
386 | var->red.offset = 16; var->red.length = 8; | ||
387 | var->green.offset = 8; var->green.length = 8; | ||
388 | var->blue.offset = 0; var->blue.length = 8; | ||
389 | break; | ||
390 | case 25: /* RGBT888 */ | ||
391 | var->transp.offset = 24; var->transp.length = 1; | ||
392 | var->red.offset = 16; var->red.length = 8; | ||
393 | var->green.offset = 8; var->green.length = 8; | ||
394 | var->blue.offset = 0; var->blue.length = 8; | ||
395 | break; | ||
396 | default: | ||
397 | return -EINVAL; | ||
398 | } | ||
348 | } else { | 399 | } else { |
349 | var->red.offset = var->green.offset = 0; | 400 | var->red.offset = var->green.offset = 0; |
350 | var->blue.offset = var->transp.offset = 0; | 401 | var->blue.offset = var->transp.offset = 0; |
@@ -376,7 +427,7 @@ static int pxafb_set_par(struct fb_info *info) | |||
376 | struct pxafb_info *fbi = (struct pxafb_info *)info; | 427 | struct pxafb_info *fbi = (struct pxafb_info *)info; |
377 | struct fb_var_screeninfo *var = &info->var; | 428 | struct fb_var_screeninfo *var = &info->var; |
378 | 429 | ||
379 | if (var->bits_per_pixel == 16) | 430 | if (var->bits_per_pixel >= 16) |
380 | fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; | 431 | fbi->fb.fix.visual = FB_VISUAL_TRUECOLOR; |
381 | else if (!fbi->cmap_static) | 432 | else if (!fbi->cmap_static) |
382 | fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; | 433 | fbi->fb.fix.visual = FB_VISUAL_PSEUDOCOLOR; |
@@ -391,7 +442,7 @@ static int pxafb_set_par(struct fb_info *info) | |||
391 | 442 | ||
392 | fbi->fb.fix.line_length = var->xres_virtual * | 443 | fbi->fb.fix.line_length = var->xres_virtual * |
393 | var->bits_per_pixel / 8; | 444 | var->bits_per_pixel / 8; |
394 | if (var->bits_per_pixel == 16) | 445 | if (var->bits_per_pixel >= 16) |
395 | fbi->palette_size = 0; | 446 | fbi->palette_size = 0; |
396 | else | 447 | else |
397 | fbi->palette_size = var->bits_per_pixel == 1 ? | 448 | fbi->palette_size = var->bits_per_pixel == 1 ? |
@@ -404,7 +455,7 @@ static int pxafb_set_par(struct fb_info *info) | |||
404 | */ | 455 | */ |
405 | pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); | 456 | pxafb_set_truecolor(fbi->fb.fix.visual == FB_VISUAL_TRUECOLOR); |
406 | 457 | ||
407 | if (fbi->fb.var.bits_per_pixel == 16) | 458 | if (fbi->fb.var.bits_per_pixel >= 16) |
408 | fb_dealloc_cmap(&fbi->fb.cmap); | 459 | fb_dealloc_cmap(&fbi->fb.cmap); |
409 | else | 460 | else |
410 | fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0); | 461 | fb_alloc_cmap(&fbi->fb.cmap, 1<<fbi->fb.var.bits_per_pixel, 0); |
@@ -831,6 +882,8 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, | |||
831 | case 4: | 882 | case 4: |
832 | case 8: | 883 | case 8: |
833 | case 16: | 884 | case 16: |
885 | case 24: | ||
886 | case 32: | ||
834 | break; | 887 | break; |
835 | default: | 888 | default: |
836 | printk(KERN_ERR "%s: invalid bit depth %d\n", | 889 | printk(KERN_ERR "%s: invalid bit depth %d\n", |
@@ -968,6 +1021,11 @@ static void pxafb_setup_gpio(struct pxafb_info *fbi) | |||
968 | 1021 | ||
969 | for (gpio = 58; ldd_bits; gpio++, ldd_bits--) | 1022 | for (gpio = 58; ldd_bits; gpio++, ldd_bits--) |
970 | pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT); | 1023 | pxa_gpio_mode(gpio | GPIO_ALT_FN_2_OUT); |
1024 | /* 18 bit interface */ | ||
1025 | if (fbi->fb.var.bits_per_pixel > 16) { | ||
1026 | pxa_gpio_mode(86 | GPIO_ALT_FN_2_OUT); | ||
1027 | pxa_gpio_mode(87 | GPIO_ALT_FN_2_OUT); | ||
1028 | } | ||
971 | pxa_gpio_mode(GPIO74_LCD_FCLK_MD); | 1029 | pxa_gpio_mode(GPIO74_LCD_FCLK_MD); |
972 | pxa_gpio_mode(GPIO75_LCD_LCLK_MD); | 1030 | pxa_gpio_mode(GPIO75_LCD_LCLK_MD); |
973 | pxa_gpio_mode(GPIO76_LCD_PCLK_MD); | 1031 | pxa_gpio_mode(GPIO76_LCD_PCLK_MD); |
@@ -1792,11 +1850,49 @@ failed: | |||
1792 | return ret; | 1850 | return ret; |
1793 | } | 1851 | } |
1794 | 1852 | ||
1853 | static int __devexit pxafb_remove(struct platform_device *dev) | ||
1854 | { | ||
1855 | struct pxafb_info *fbi = platform_get_drvdata(dev); | ||
1856 | struct resource *r; | ||
1857 | int irq; | ||
1858 | struct fb_info *info; | ||
1859 | |||
1860 | if (!fbi) | ||
1861 | return 0; | ||
1862 | |||
1863 | info = &fbi->fb; | ||
1864 | |||
1865 | unregister_framebuffer(info); | ||
1866 | |||
1867 | pxafb_disable_controller(fbi); | ||
1868 | |||
1869 | if (fbi->fb.cmap.len) | ||
1870 | fb_dealloc_cmap(&fbi->fb.cmap); | ||
1871 | |||
1872 | irq = platform_get_irq(dev, 0); | ||
1873 | free_irq(irq, fbi); | ||
1874 | |||
1875 | dma_free_writecombine(&dev->dev, fbi->map_size, | ||
1876 | fbi->map_cpu, fbi->map_dma); | ||
1877 | |||
1878 | iounmap(fbi->mmio_base); | ||
1879 | |||
1880 | r = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
1881 | release_mem_region(r->start, r->end - r->start + 1); | ||
1882 | |||
1883 | clk_put(fbi->clk); | ||
1884 | kfree(fbi); | ||
1885 | |||
1886 | return 0; | ||
1887 | } | ||
1888 | |||
1795 | static struct platform_driver pxafb_driver = { | 1889 | static struct platform_driver pxafb_driver = { |
1796 | .probe = pxafb_probe, | 1890 | .probe = pxafb_probe, |
1891 | .remove = pxafb_remove, | ||
1797 | .suspend = pxafb_suspend, | 1892 | .suspend = pxafb_suspend, |
1798 | .resume = pxafb_resume, | 1893 | .resume = pxafb_resume, |
1799 | .driver = { | 1894 | .driver = { |
1895 | .owner = THIS_MODULE, | ||
1800 | .name = "pxa2xx-fb", | 1896 | .name = "pxa2xx-fb", |
1801 | }, | 1897 | }, |
1802 | }; | 1898 | }; |
@@ -1809,7 +1905,13 @@ static int __init pxafb_init(void) | |||
1809 | return platform_driver_register(&pxafb_driver); | 1905 | return platform_driver_register(&pxafb_driver); |
1810 | } | 1906 | } |
1811 | 1907 | ||
1908 | static void __exit pxafb_exit(void) | ||
1909 | { | ||
1910 | platform_driver_unregister(&pxafb_driver); | ||
1911 | } | ||
1912 | |||
1812 | module_init(pxafb_init); | 1913 | module_init(pxafb_init); |
1914 | module_exit(pxafb_exit); | ||
1813 | 1915 | ||
1814 | MODULE_DESCRIPTION("loadable framebuffer driver for PXA"); | 1916 | MODULE_DESCRIPTION("loadable framebuffer driver for PXA"); |
1815 | MODULE_LICENSE("GPL"); | 1917 | MODULE_LICENSE("GPL"); |