diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 45 | ||||
-rw-r--r-- | drivers/input/keyboard/pxa27x_keyboard.c | 25 | ||||
-rw-r--r-- | drivers/leds/Kconfig | 6 | ||||
-rw-r--r-- | drivers/leds/Makefile | 1 | ||||
-rw-r--r-- | drivers/leds/leds-cm-x270.c | 122 | ||||
-rw-r--r-- | drivers/mmc/host/pxamci.c | 43 | ||||
-rw-r--r-- | drivers/mmc/host/pxamci.h | 14 | ||||
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 51 | ||||
-rw-r--r-- | drivers/net/smc91x.c | 55 | ||||
-rw-r--r-- | drivers/net/smc91x.h | 64 | ||||
-rw-r--r-- | drivers/pcmcia/Makefile | 1 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_cm_x270.c | 175 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_lubbock.c | 31 | ||||
-rw-r--r-- | drivers/pcmcia/pxa2xx_mainstone.c | 18 | ||||
-rw-r--r-- | drivers/serial/pxa.c | 163 | ||||
-rw-r--r-- | drivers/serial/serial_core.c | 18 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.c | 68 | ||||
-rw-r--r-- | drivers/usb/gadget/pxa2xx_udc.h | 1 | ||||
-rw-r--r-- | drivers/video/pxafb.c | 36 | ||||
-rw-r--r-- | drivers/video/pxafb.h | 1 |
20 files changed, 651 insertions, 287 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index bb5466b27b59..00fad11733ad 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -31,6 +31,8 @@ | |||
31 | #include <linux/interrupt.h> | 31 | #include <linux/interrupt.h> |
32 | #include <linux/i2c-pxa.h> | 32 | #include <linux/i2c-pxa.h> |
33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
34 | #include <linux/err.h> | ||
35 | #include <linux/clk.h> | ||
34 | 36 | ||
35 | #include <asm/hardware.h> | 37 | #include <asm/hardware.h> |
36 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
@@ -48,6 +50,7 @@ struct pxa_i2c { | |||
48 | unsigned int slave_addr; | 50 | unsigned int slave_addr; |
49 | 51 | ||
50 | struct i2c_adapter adap; | 52 | struct i2c_adapter adap; |
53 | struct clk *clk; | ||
51 | #ifdef CONFIG_I2C_PXA_SLAVE | 54 | #ifdef CONFIG_I2C_PXA_SLAVE |
52 | struct i2c_slave_client *slave; | 55 | struct i2c_slave_client *slave; |
53 | #endif | 56 | #endif |
@@ -869,6 +872,12 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
869 | 872 | ||
870 | sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); | 873 | sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id); |
871 | 874 | ||
875 | i2c->clk = clk_get(&dev->dev, "I2CCLK"); | ||
876 | if (IS_ERR(i2c->clk)) { | ||
877 | ret = PTR_ERR(i2c->clk); | ||
878 | goto eclk; | ||
879 | } | ||
880 | |||
872 | i2c->reg_base = ioremap(res->start, res_len(res)); | 881 | i2c->reg_base = ioremap(res->start, res_len(res)); |
873 | if (!i2c->reg_base) { | 882 | if (!i2c->reg_base) { |
874 | ret = -EIO; | 883 | ret = -EIO; |
@@ -889,22 +898,19 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
889 | } | 898 | } |
890 | #endif | 899 | #endif |
891 | 900 | ||
901 | clk_enable(i2c->clk); | ||
902 | #ifdef CONFIG_PXA27x | ||
892 | switch (dev->id) { | 903 | switch (dev->id) { |
893 | case 0: | 904 | case 0: |
894 | #ifdef CONFIG_PXA27x | ||
895 | pxa_gpio_mode(GPIO117_I2CSCL_MD); | 905 | pxa_gpio_mode(GPIO117_I2CSCL_MD); |
896 | pxa_gpio_mode(GPIO118_I2CSDA_MD); | 906 | pxa_gpio_mode(GPIO118_I2CSDA_MD); |
897 | #endif | ||
898 | pxa_set_cken(CKEN_I2C, 1); | ||
899 | break; | 907 | break; |
900 | #ifdef CONFIG_PXA27x | ||
901 | case 1: | 908 | case 1: |
902 | local_irq_disable(); | 909 | local_irq_disable(); |
903 | PCFR |= PCFR_PI2CEN; | 910 | PCFR |= PCFR_PI2CEN; |
904 | local_irq_enable(); | 911 | local_irq_enable(); |
905 | pxa_set_cken(CKEN_PWRI2C, 1); | ||
906 | #endif | ||
907 | } | 912 | } |
913 | #endif | ||
908 | 914 | ||
909 | ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, | 915 | ret = request_irq(irq, i2c_pxa_handler, IRQF_DISABLED, |
910 | i2c->adap.name, i2c); | 916 | i2c->adap.name, i2c); |
@@ -948,19 +954,18 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
948 | eadapt: | 954 | eadapt: |
949 | free_irq(irq, i2c); | 955 | free_irq(irq, i2c); |
950 | ereqirq: | 956 | ereqirq: |
951 | switch (dev->id) { | 957 | clk_disable(i2c->clk); |
952 | case 0: | 958 | |
953 | pxa_set_cken(CKEN_I2C, 0); | ||
954 | break; | ||
955 | #ifdef CONFIG_PXA27x | 959 | #ifdef CONFIG_PXA27x |
956 | case 1: | 960 | if (dev->id == 1) { |
957 | pxa_set_cken(CKEN_PWRI2C, 0); | ||
958 | local_irq_disable(); | 961 | local_irq_disable(); |
959 | PCFR &= ~PCFR_PI2CEN; | 962 | PCFR &= ~PCFR_PI2CEN; |
960 | local_irq_enable(); | 963 | local_irq_enable(); |
961 | #endif | ||
962 | } | 964 | } |
965 | #endif | ||
963 | eremap: | 966 | eremap: |
967 | clk_put(i2c->clk); | ||
968 | eclk: | ||
964 | kfree(i2c); | 969 | kfree(i2c); |
965 | emalloc: | 970 | emalloc: |
966 | release_mem_region(res->start, res_len(res)); | 971 | release_mem_region(res->start, res_len(res)); |
@@ -975,18 +980,18 @@ static int i2c_pxa_remove(struct platform_device *dev) | |||
975 | 980 | ||
976 | i2c_del_adapter(&i2c->adap); | 981 | i2c_del_adapter(&i2c->adap); |
977 | free_irq(i2c->irq, i2c); | 982 | free_irq(i2c->irq, i2c); |
978 | switch (dev->id) { | 983 | |
979 | case 0: | 984 | clk_disable(i2c->clk); |
980 | pxa_set_cken(CKEN_I2C, 0); | 985 | clk_put(i2c->clk); |
981 | break; | 986 | |
982 | #ifdef CONFIG_PXA27x | 987 | #ifdef CONFIG_PXA27x |
983 | case 1: | 988 | if (dev->id == 1) { |
984 | pxa_set_cken(CKEN_PWRI2C, 0); | ||
985 | local_irq_disable(); | 989 | local_irq_disable(); |
986 | PCFR &= ~PCFR_PI2CEN; | 990 | PCFR &= ~PCFR_PI2CEN; |
987 | local_irq_enable(); | 991 | local_irq_enable(); |
988 | #endif | ||
989 | } | 992 | } |
993 | #endif | ||
994 | |||
990 | release_mem_region(i2c->iobase, i2c->iosize); | 995 | release_mem_region(i2c->iobase, i2c->iosize); |
991 | kfree(i2c); | 996 | kfree(i2c); |
992 | 997 | ||
diff --git a/drivers/input/keyboard/pxa27x_keyboard.c b/drivers/input/keyboard/pxa27x_keyboard.c index ebe5eacf2990..b7061aa38816 100644 --- a/drivers/input/keyboard/pxa27x_keyboard.c +++ b/drivers/input/keyboard/pxa27x_keyboard.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/input.h> | 23 | #include <linux/input.h> |
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/platform_device.h> | 25 | #include <linux/platform_device.h> |
26 | #include <linux/clk.h> | ||
27 | #include <linux/err.h> | ||
26 | 28 | ||
27 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
28 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
@@ -40,6 +42,8 @@ | |||
40 | col/2 == 2 ? KPASMKP2 : KPASMKP3) | 42 | col/2 == 2 ? KPASMKP2 : KPASMKP3) |
41 | #define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2))) | 43 | #define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2))) |
42 | 44 | ||
45 | static struct clk *pxakbd_clk; | ||
46 | |||
43 | static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id) | 47 | static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id) |
44 | { | 48 | { |
45 | struct platform_device *pdev = dev_id; | 49 | struct platform_device *pdev = dev_id; |
@@ -104,7 +108,7 @@ static int pxakbd_open(struct input_dev *dev) | |||
104 | KPREC = 0x7F; | 108 | KPREC = 0x7F; |
105 | 109 | ||
106 | /* Enable unit clock */ | 110 | /* Enable unit clock */ |
107 | pxa_set_cken(CKEN_KEYPAD, 1); | 111 | clk_enable(pxakbd_clk); |
108 | 112 | ||
109 | return 0; | 113 | return 0; |
110 | } | 114 | } |
@@ -112,7 +116,7 @@ static int pxakbd_open(struct input_dev *dev) | |||
112 | static void pxakbd_close(struct input_dev *dev) | 116 | static void pxakbd_close(struct input_dev *dev) |
113 | { | 117 | { |
114 | /* Disable clock unit */ | 118 | /* Disable clock unit */ |
115 | pxa_set_cken(CKEN_KEYPAD, 0); | 119 | clk_disable(pxakbd_clk); |
116 | } | 120 | } |
117 | 121 | ||
118 | #ifdef CONFIG_PM | 122 | #ifdef CONFIG_PM |
@@ -140,7 +144,8 @@ static int pxakbd_resume(struct platform_device *pdev) | |||
140 | KPREC = pdata->reg_kprec; | 144 | KPREC = pdata->reg_kprec; |
141 | 145 | ||
142 | /* Enable unit clock */ | 146 | /* Enable unit clock */ |
143 | pxa_set_cken(CKEN_KEYPAD, 1); | 147 | clk_disable(pxakbd_clk); |
148 | clk_enable(pxakbd_clk); | ||
144 | } | 149 | } |
145 | 150 | ||
146 | mutex_unlock(&input_dev->mutex); | 151 | mutex_unlock(&input_dev->mutex); |
@@ -158,11 +163,18 @@ static int __devinit pxakbd_probe(struct platform_device *pdev) | |||
158 | struct input_dev *input_dev; | 163 | struct input_dev *input_dev; |
159 | int i, row, col, error; | 164 | int i, row, col, error; |
160 | 165 | ||
166 | pxakbd_clk = clk_get(&pdev->dev, "KBDCLK"); | ||
167 | if (IS_ERR(pxakbd_clk)) { | ||
168 | error = PTR_ERR(pxakbd_clk); | ||
169 | goto err_clk; | ||
170 | } | ||
171 | |||
161 | /* Create and register the input driver. */ | 172 | /* Create and register the input driver. */ |
162 | input_dev = input_allocate_device(); | 173 | input_dev = input_allocate_device(); |
163 | if (!input_dev) { | 174 | if (!input_dev) { |
164 | printk(KERN_ERR "Cannot request keypad device\n"); | 175 | printk(KERN_ERR "Cannot request keypad device\n"); |
165 | return -ENOMEM; | 176 | error = -ENOMEM; |
177 | goto err_alloc; | ||
166 | } | 178 | } |
167 | 179 | ||
168 | input_dev->name = DRIVER_NAME; | 180 | input_dev->name = DRIVER_NAME; |
@@ -185,7 +197,6 @@ static int __devinit pxakbd_probe(struct platform_device *pdev) | |||
185 | DRIVER_NAME, pdev); | 197 | DRIVER_NAME, pdev); |
186 | if (error) { | 198 | if (error) { |
187 | printk(KERN_ERR "Cannot request keypad IRQ\n"); | 199 | printk(KERN_ERR "Cannot request keypad IRQ\n"); |
188 | pxa_set_cken(CKEN_KEYPAD, 0); | ||
189 | goto err_free_dev; | 200 | goto err_free_dev; |
190 | } | 201 | } |
191 | 202 | ||
@@ -217,6 +228,9 @@ static int __devinit pxakbd_probe(struct platform_device *pdev) | |||
217 | free_irq(IRQ_KEYPAD, pdev); | 228 | free_irq(IRQ_KEYPAD, pdev); |
218 | err_free_dev: | 229 | err_free_dev: |
219 | input_free_device(input_dev); | 230 | input_free_device(input_dev); |
231 | err_alloc: | ||
232 | clk_put(pxakbd_clk); | ||
233 | err_clk: | ||
220 | return error; | 234 | return error; |
221 | } | 235 | } |
222 | 236 | ||
@@ -226,6 +240,7 @@ static int __devexit pxakbd_remove(struct platform_device *pdev) | |||
226 | 240 | ||
227 | input_unregister_device(input_dev); | 241 | input_unregister_device(input_dev); |
228 | free_irq(IRQ_KEYPAD, pdev); | 242 | free_irq(IRQ_KEYPAD, pdev); |
243 | clk_put(pxakbd_clk); | ||
229 | platform_set_drvdata(pdev, NULL); | 244 | platform_set_drvdata(pdev, NULL); |
230 | 245 | ||
231 | return 0; | 246 | return 0; |
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index 3cb23210b912..257b44094e4c 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -108,6 +108,12 @@ config LEDS_GPIO | |||
108 | outputs. To be useful the particular board must have LEDs | 108 | outputs. To be useful the particular board must have LEDs |
109 | and they must be connected to the GPIO lines. | 109 | and they must be connected to the GPIO lines. |
110 | 110 | ||
111 | config LEDS_CM_X270 | ||
112 | tristate "LED Support for the CM-X270 LEDs" | ||
113 | depends on LEDS_CLASS && MACH_ARMCORE | ||
114 | help | ||
115 | This option enables support for the CM-X270 LEDs. | ||
116 | |||
111 | comment "LED Triggers" | 117 | comment "LED Triggers" |
112 | 118 | ||
113 | config LEDS_TRIGGERS | 119 | config LEDS_TRIGGERS |
diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index d2ca1abbc3d2..a60de1b46c2c 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile | |||
@@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_H1940) += leds-h1940.o | |||
18 | obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o | 18 | obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o |
19 | obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o | 19 | obj-$(CONFIG_LEDS_COBALT_RAQ) += leds-cobalt-raq.o |
20 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o | 20 | obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o |
21 | obj-$(CONFIG_LEDS_CM_X270) += leds-cm-x270.o | ||
21 | 22 | ||
22 | # LED Triggers | 23 | # LED Triggers |
23 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o | 24 | obj-$(CONFIG_LEDS_TRIGGER_TIMER) += ledtrig-timer.o |
diff --git a/drivers/leds/leds-cm-x270.c b/drivers/leds/leds-cm-x270.c new file mode 100644 index 000000000000..9aebef02a974 --- /dev/null +++ b/drivers/leds/leds-cm-x270.c | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | * drivers/leds/leds-cm-x270.c | ||
3 | * | ||
4 | * Copyright 2007 CompuLab Ltd. | ||
5 | * Author: Mike Rapoport <mike@compulab.co.il> | ||
6 | * | ||
7 | * Based on leds-corgi.c | ||
8 | * Author: Richard Purdie <rpurdie@openedhand.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 | |||
16 | #include <linux/kernel.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/leds.h> | ||
20 | |||
21 | #include <asm/arch/hardware.h> | ||
22 | #include <asm/arch/pxa-regs.h> | ||
23 | |||
24 | #define GPIO_RED_LED (93) | ||
25 | #define GPIO_GREEN_LED (94) | ||
26 | |||
27 | static void cmx270_red_set(struct led_classdev *led_cdev, | ||
28 | enum led_brightness value) | ||
29 | { | ||
30 | if (value) | ||
31 | GPCR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); | ||
32 | else | ||
33 | GPSR(GPIO_RED_LED) = GPIO_bit(GPIO_RED_LED); | ||
34 | } | ||
35 | |||
36 | static void cmx270_green_set(struct led_classdev *led_cdev, | ||
37 | enum led_brightness value) | ||
38 | { | ||
39 | if (value) | ||
40 | GPCR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); | ||
41 | else | ||
42 | GPSR(GPIO_GREEN_LED) = GPIO_bit(GPIO_GREEN_LED); | ||
43 | } | ||
44 | |||
45 | static struct led_classdev cmx270_red_led = { | ||
46 | .name = "cm-x270:red", | ||
47 | .default_trigger = "nand-disk", | ||
48 | .brightness_set = cmx270_red_set, | ||
49 | }; | ||
50 | |||
51 | static struct led_classdev cmx270_green_led = { | ||
52 | .name = "cm-x270:green", | ||
53 | .default_trigger = "heartbeat", | ||
54 | .brightness_set = cmx270_green_set, | ||
55 | }; | ||
56 | |||
57 | #ifdef CONFIG_PM | ||
58 | static int cmx270led_suspend(struct platform_device *dev, pm_message_t state) | ||
59 | { | ||
60 | led_classdev_suspend(&cmx270_red_led); | ||
61 | led_classdev_suspend(&cmx270_green_led); | ||
62 | return 0; | ||
63 | } | ||
64 | |||
65 | static int cmx270led_resume(struct platform_device *dev) | ||
66 | { | ||
67 | led_classdev_resume(&cmx270_red_led); | ||
68 | led_classdev_resume(&cmx270_green_led); | ||
69 | return 0; | ||
70 | } | ||
71 | #endif | ||
72 | |||
73 | static int cmx270led_probe(struct platform_device *pdev) | ||
74 | { | ||
75 | int ret; | ||
76 | |||
77 | ret = led_classdev_register(&pdev->dev, &cmx270_red_led); | ||
78 | if (ret < 0) | ||
79 | return ret; | ||
80 | |||
81 | ret = led_classdev_register(&pdev->dev, &cmx270_green_led); | ||
82 | if (ret < 0) | ||
83 | led_classdev_unregister(&cmx270_red_led); | ||
84 | |||
85 | return ret; | ||
86 | } | ||
87 | |||
88 | static int cmx270led_remove(struct platform_device *pdev) | ||
89 | { | ||
90 | led_classdev_unregister(&cmx270_red_led); | ||
91 | led_classdev_unregister(&cmx270_green_led); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | static struct platform_driver cmx270led_driver = { | ||
96 | .probe = cmx270led_probe, | ||
97 | .remove = cmx270led_remove, | ||
98 | #ifdef CONFIG_PM | ||
99 | .suspend = cmx270led_suspend, | ||
100 | .resume = cmx270led_resume, | ||
101 | #endif | ||
102 | .driver = { | ||
103 | .name = "cm-x270-led", | ||
104 | }, | ||
105 | }; | ||
106 | |||
107 | static int __init cmx270led_init(void) | ||
108 | { | ||
109 | return platform_driver_register(&cmx270led_driver); | ||
110 | } | ||
111 | |||
112 | static void __exit cmx270led_exit(void) | ||
113 | { | ||
114 | platform_driver_unregister(&cmx270led_driver); | ||
115 | } | ||
116 | |||
117 | module_init(cmx270led_init); | ||
118 | module_exit(cmx270led_exit); | ||
119 | |||
120 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); | ||
121 | MODULE_DESCRIPTION("CM-x270 LED driver"); | ||
122 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mmc/host/pxamci.c b/drivers/mmc/host/pxamci.c index 657901eecfce..0601e01aa2c2 100644 --- a/drivers/mmc/host/pxamci.c +++ b/drivers/mmc/host/pxamci.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <linux/delay.h> | 23 | #include <linux/delay.h> |
24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
25 | #include <linux/dma-mapping.h> | 25 | #include <linux/dma-mapping.h> |
26 | #include <linux/clk.h> | ||
27 | #include <linux/err.h> | ||
26 | #include <linux/mmc/host.h> | 28 | #include <linux/mmc/host.h> |
27 | 29 | ||
28 | #include <asm/dma.h> | 30 | #include <asm/dma.h> |
@@ -44,6 +46,8 @@ struct pxamci_host { | |||
44 | spinlock_t lock; | 46 | spinlock_t lock; |
45 | struct resource *res; | 47 | struct resource *res; |
46 | void __iomem *base; | 48 | void __iomem *base; |
49 | struct clk *clk; | ||
50 | unsigned long clkrate; | ||
47 | int irq; | 51 | int irq; |
48 | int dma; | 52 | int dma; |
49 | unsigned int clkrt; | 53 | unsigned int clkrt; |
@@ -119,7 +123,7 @@ static void pxamci_setup_data(struct pxamci_host *host, struct mmc_data *data) | |||
119 | writel(nob, host->base + MMC_NOB); | 123 | writel(nob, host->base + MMC_NOB); |
120 | writel(data->blksz, host->base + MMC_BLKLEN); | 124 | writel(data->blksz, host->base + MMC_BLKLEN); |
121 | 125 | ||
122 | clks = (unsigned long long)data->timeout_ns * CLOCKRATE; | 126 | clks = (unsigned long long)data->timeout_ns * host->clkrate; |
123 | do_div(clks, 1000000000UL); | 127 | do_div(clks, 1000000000UL); |
124 | timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt); | 128 | timeout = (unsigned int)clks + (data->timeout_clks << host->clkrt); |
125 | writel((timeout + 255) / 256, host->base + MMC_RDTO); | 129 | writel((timeout + 255) / 256, host->base + MMC_RDTO); |
@@ -365,18 +369,25 @@ static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
365 | struct pxamci_host *host = mmc_priv(mmc); | 369 | struct pxamci_host *host = mmc_priv(mmc); |
366 | 370 | ||
367 | if (ios->clock) { | 371 | if (ios->clock) { |
368 | unsigned int clk = CLOCKRATE / ios->clock; | 372 | unsigned long rate = host->clkrate; |
369 | if (CLOCKRATE / clk > ios->clock) | 373 | unsigned int clk = rate / ios->clock; |
374 | |||
375 | /* | ||
376 | * clk might result in a lower divisor than we | ||
377 | * desire. check for that condition and adjust | ||
378 | * as appropriate. | ||
379 | */ | ||
380 | if (rate / clk > ios->clock) | ||
370 | clk <<= 1; | 381 | clk <<= 1; |
371 | host->clkrt = fls(clk) - 1; | 382 | host->clkrt = fls(clk) - 1; |
372 | pxa_set_cken(CKEN_MMC, 1); | 383 | clk_enable(host->clk); |
373 | 384 | ||
374 | /* | 385 | /* |
375 | * we write clkrt on the next command | 386 | * we write clkrt on the next command |
376 | */ | 387 | */ |
377 | } else { | 388 | } else { |
378 | pxamci_stop_clock(host); | 389 | pxamci_stop_clock(host); |
379 | pxa_set_cken(CKEN_MMC, 0); | 390 | clk_disable(host->clk); |
380 | } | 391 | } |
381 | 392 | ||
382 | if (host->power_mode != ios->power_mode) { | 393 | if (host->power_mode != ios->power_mode) { |
@@ -462,8 +473,6 @@ static int pxamci_probe(struct platform_device *pdev) | |||
462 | } | 473 | } |
463 | 474 | ||
464 | mmc->ops = &pxamci_ops; | 475 | mmc->ops = &pxamci_ops; |
465 | mmc->f_min = CLOCKRATE_MIN; | ||
466 | mmc->f_max = CLOCKRATE_MAX; | ||
467 | 476 | ||
468 | /* | 477 | /* |
469 | * We can do SG-DMA, but we don't because we never know how much | 478 | * We can do SG-DMA, but we don't because we never know how much |
@@ -490,6 +499,22 @@ static int pxamci_probe(struct platform_device *pdev) | |||
490 | host->mmc = mmc; | 499 | host->mmc = mmc; |
491 | host->dma = -1; | 500 | host->dma = -1; |
492 | host->pdata = pdev->dev.platform_data; | 501 | host->pdata = pdev->dev.platform_data; |
502 | |||
503 | host->clk = clk_get(&pdev->dev, "MMCCLK"); | ||
504 | if (IS_ERR(host->clk)) { | ||
505 | ret = PTR_ERR(host->clk); | ||
506 | host->clk = NULL; | ||
507 | goto out; | ||
508 | } | ||
509 | |||
510 | host->clkrate = clk_get_rate(host->clk); | ||
511 | |||
512 | /* | ||
513 | * Calculate minimum clock rate, rounding up. | ||
514 | */ | ||
515 | mmc->f_min = (host->clkrate + 63) / 64; | ||
516 | mmc->f_max = host->clkrate; | ||
517 | |||
493 | mmc->ocr_avail = host->pdata ? | 518 | mmc->ocr_avail = host->pdata ? |
494 | host->pdata->ocr_mask : | 519 | host->pdata->ocr_mask : |
495 | MMC_VDD_32_33|MMC_VDD_33_34; | 520 | MMC_VDD_32_33|MMC_VDD_33_34; |
@@ -554,6 +579,8 @@ static int pxamci_probe(struct platform_device *pdev) | |||
554 | iounmap(host->base); | 579 | iounmap(host->base); |
555 | if (host->sg_cpu) | 580 | if (host->sg_cpu) |
556 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); | 581 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); |
582 | if (host->clk) | ||
583 | clk_put(host->clk); | ||
557 | } | 584 | } |
558 | if (mmc) | 585 | if (mmc) |
559 | mmc_free_host(mmc); | 586 | mmc_free_host(mmc); |
@@ -588,6 +615,8 @@ static int pxamci_remove(struct platform_device *pdev) | |||
588 | iounmap(host->base); | 615 | iounmap(host->base); |
589 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); | 616 | dma_free_coherent(&pdev->dev, PAGE_SIZE, host->sg_cpu, host->sg_dma); |
590 | 617 | ||
618 | clk_put(host->clk); | ||
619 | |||
591 | release_resource(host->res); | 620 | release_resource(host->res); |
592 | 621 | ||
593 | mmc_free_host(mmc); | 622 | mmc_free_host(mmc); |
diff --git a/drivers/mmc/host/pxamci.h b/drivers/mmc/host/pxamci.h index 3153e779d46a..748c7706f237 100644 --- a/drivers/mmc/host/pxamci.h +++ b/drivers/mmc/host/pxamci.h | |||
@@ -88,17 +88,3 @@ | |||
88 | #define MMC_RXFIFO 0x0040 /* 8 bit */ | 88 | #define MMC_RXFIFO 0x0040 /* 8 bit */ |
89 | 89 | ||
90 | #define MMC_TXFIFO 0x0044 /* 8 bit */ | 90 | #define MMC_TXFIFO 0x0044 /* 8 bit */ |
91 | |||
92 | /* | ||
93 | * The base MMC clock rate | ||
94 | */ | ||
95 | #ifdef CONFIG_PXA27x | ||
96 | #define CLOCKRATE_MIN 304688 | ||
97 | #define CLOCKRATE_MAX 19500000 | ||
98 | #else | ||
99 | #define CLOCKRATE_MIN 312500 | ||
100 | #define CLOCKRATE_MAX 20000000 | ||
101 | #endif | ||
102 | |||
103 | #define CLOCKRATE CLOCKRATE_MAX | ||
104 | |||
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 55ff0fbe525a..8c09344f58dc 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/dma-mapping.h> | 23 | #include <linux/dma-mapping.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
26 | #include <linux/clk.h> | ||
26 | 27 | ||
27 | #include <net/irda/irda.h> | 28 | #include <net/irda/irda.h> |
28 | #include <net/irda/irmod.h> | 29 | #include <net/irda/irmod.h> |
@@ -87,8 +88,30 @@ struct pxa_irda { | |||
87 | 88 | ||
88 | struct device *dev; | 89 | struct device *dev; |
89 | struct pxaficp_platform_data *pdata; | 90 | struct pxaficp_platform_data *pdata; |
91 | struct clk *fir_clk; | ||
92 | struct clk *sir_clk; | ||
93 | struct clk *cur_clk; | ||
90 | }; | 94 | }; |
91 | 95 | ||
96 | static inline void pxa_irda_disable_clk(struct pxa_irda *si) | ||
97 | { | ||
98 | if (si->cur_clk) | ||
99 | clk_disable(si->cur_clk); | ||
100 | si->cur_clk = NULL; | ||
101 | } | ||
102 | |||
103 | static inline void pxa_irda_enable_firclk(struct pxa_irda *si) | ||
104 | { | ||
105 | si->cur_clk = si->fir_clk; | ||
106 | clk_enable(si->fir_clk); | ||
107 | } | ||
108 | |||
109 | static inline void pxa_irda_enable_sirclk(struct pxa_irda *si) | ||
110 | { | ||
111 | si->cur_clk = si->sir_clk; | ||
112 | clk_enable(si->sir_clk); | ||
113 | } | ||
114 | |||
92 | 115 | ||
93 | #define IS_FIR(si) ((si)->speed >= 4000000) | 116 | #define IS_FIR(si) ((si)->speed >= 4000000) |
94 | #define IRDA_FRAME_SIZE_LIMIT 2047 | 117 | #define IRDA_FRAME_SIZE_LIMIT 2047 |
@@ -134,7 +157,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
134 | DCSR(si->rxdma) &= ~DCSR_RUN; | 157 | DCSR(si->rxdma) &= ~DCSR_RUN; |
135 | /* disable FICP */ | 158 | /* disable FICP */ |
136 | ICCR0 = 0; | 159 | ICCR0 = 0; |
137 | pxa_set_cken(CKEN_FICP, 0); | 160 | pxa_irda_disable_clk(si); |
138 | 161 | ||
139 | /* set board transceiver to SIR mode */ | 162 | /* set board transceiver to SIR mode */ |
140 | si->pdata->transceiver_mode(si->dev, IR_SIRMODE); | 163 | si->pdata->transceiver_mode(si->dev, IR_SIRMODE); |
@@ -144,7 +167,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
144 | pxa_gpio_mode(GPIO47_STTXD_MD); | 167 | pxa_gpio_mode(GPIO47_STTXD_MD); |
145 | 168 | ||
146 | /* enable the STUART clock */ | 169 | /* enable the STUART clock */ |
147 | pxa_set_cken(CKEN_STUART, 1); | 170 | pxa_irda_enable_sirclk(si); |
148 | } | 171 | } |
149 | 172 | ||
150 | /* disable STUART first */ | 173 | /* disable STUART first */ |
@@ -169,7 +192,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
169 | /* disable STUART */ | 192 | /* disable STUART */ |
170 | STIER = 0; | 193 | STIER = 0; |
171 | STISR = 0; | 194 | STISR = 0; |
172 | pxa_set_cken(CKEN_STUART, 0); | 195 | pxa_irda_disable_clk(si); |
173 | 196 | ||
174 | /* disable FICP first */ | 197 | /* disable FICP first */ |
175 | ICCR0 = 0; | 198 | ICCR0 = 0; |
@@ -182,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) | |||
182 | pxa_gpio_mode(GPIO47_ICPTXD_MD); | 205 | pxa_gpio_mode(GPIO47_ICPTXD_MD); |
183 | 206 | ||
184 | /* enable the FICP clock */ | 207 | /* enable the FICP clock */ |
185 | pxa_set_cken(CKEN_FICP, 1); | 208 | pxa_irda_enable_firclk(si); |
186 | 209 | ||
187 | si->speed = speed; | 210 | si->speed = speed; |
188 | pxa_irda_fir_dma_rx_start(si); | 211 | pxa_irda_fir_dma_rx_start(si); |
@@ -592,16 +615,15 @@ static void pxa_irda_shutdown(struct pxa_irda *si) | |||
592 | STIER = 0; | 615 | STIER = 0; |
593 | /* disable STUART SIR mode */ | 616 | /* disable STUART SIR mode */ |
594 | STISR = 0; | 617 | STISR = 0; |
595 | /* disable the STUART clock */ | ||
596 | pxa_set_cken(CKEN_STUART, 0); | ||
597 | 618 | ||
598 | /* disable DMA */ | 619 | /* disable DMA */ |
599 | DCSR(si->txdma) &= ~DCSR_RUN; | 620 | DCSR(si->txdma) &= ~DCSR_RUN; |
600 | DCSR(si->rxdma) &= ~DCSR_RUN; | 621 | DCSR(si->rxdma) &= ~DCSR_RUN; |
601 | /* disable FICP */ | 622 | /* disable FICP */ |
602 | ICCR0 = 0; | 623 | ICCR0 = 0; |
603 | /* disable the FICP clock */ | 624 | |
604 | pxa_set_cken(CKEN_FICP, 0); | 625 | /* disable the STUART or FICP clocks */ |
626 | pxa_irda_disable_clk(si); | ||
605 | 627 | ||
606 | DRCMR17 = 0; | 628 | DRCMR17 = 0; |
607 | DRCMR18 = 0; | 629 | DRCMR18 = 0; |
@@ -792,6 +814,13 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
792 | si->dev = &pdev->dev; | 814 | si->dev = &pdev->dev; |
793 | si->pdata = pdev->dev.platform_data; | 815 | si->pdata = pdev->dev.platform_data; |
794 | 816 | ||
817 | si->sir_clk = clk_get(&pdev->dev, "UARTCLK"); | ||
818 | si->fir_clk = clk_get(&pdev->dev, "FICPCLK"); | ||
819 | if (IS_ERR(si->sir_clk) || IS_ERR(si->fir_clk)) { | ||
820 | err = PTR_ERR(IS_ERR(si->sir_clk) ? si->sir_clk : si->fir_clk); | ||
821 | goto err_mem_4; | ||
822 | } | ||
823 | |||
795 | /* | 824 | /* |
796 | * Initialise the SIR buffers | 825 | * Initialise the SIR buffers |
797 | */ | 826 | */ |
@@ -831,6 +860,10 @@ static int pxa_irda_probe(struct platform_device *pdev) | |||
831 | err_mem_5: | 860 | err_mem_5: |
832 | kfree(si->rx_buff.head); | 861 | kfree(si->rx_buff.head); |
833 | err_mem_4: | 862 | err_mem_4: |
863 | if (si->sir_clk && !IS_ERR(si->sir_clk)) | ||
864 | clk_put(si->sir_clk); | ||
865 | if (si->fir_clk && !IS_ERR(si->fir_clk)) | ||
866 | clk_put(si->fir_clk); | ||
834 | free_netdev(dev); | 867 | free_netdev(dev); |
835 | err_mem_3: | 868 | err_mem_3: |
836 | release_mem_region(__PREG(FICP), 0x1c); | 869 | release_mem_region(__PREG(FICP), 0x1c); |
@@ -850,6 +883,8 @@ static int pxa_irda_remove(struct platform_device *_dev) | |||
850 | unregister_netdev(dev); | 883 | unregister_netdev(dev); |
851 | kfree(si->tx_buff.head); | 884 | kfree(si->tx_buff.head); |
852 | kfree(si->rx_buff.head); | 885 | kfree(si->rx_buff.head); |
886 | clk_put(si->fir_clk); | ||
887 | clk_put(si->sir_clk); | ||
853 | free_netdev(dev); | 888 | free_netdev(dev); |
854 | } | 889 | } |
855 | 890 | ||
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c index 24e610e711e8..7da7589d45dd 100644 --- a/drivers/net/smc91x.c +++ b/drivers/net/smc91x.c | |||
@@ -173,49 +173,6 @@ MODULE_LICENSE("GPL"); | |||
173 | */ | 173 | */ |
174 | #define MII_DELAY 1 | 174 | #define MII_DELAY 1 |
175 | 175 | ||
176 | /* store this information for the driver.. */ | ||
177 | struct smc_local { | ||
178 | /* | ||
179 | * If I have to wait until memory is available to send a | ||
180 | * packet, I will store the skbuff here, until I get the | ||
181 | * desired memory. Then, I'll send it out and free it. | ||
182 | */ | ||
183 | struct sk_buff *pending_tx_skb; | ||
184 | struct tasklet_struct tx_task; | ||
185 | |||
186 | /* version/revision of the SMC91x chip */ | ||
187 | int version; | ||
188 | |||
189 | /* Contains the current active transmission mode */ | ||
190 | int tcr_cur_mode; | ||
191 | |||
192 | /* Contains the current active receive mode */ | ||
193 | int rcr_cur_mode; | ||
194 | |||
195 | /* Contains the current active receive/phy mode */ | ||
196 | int rpc_cur_mode; | ||
197 | int ctl_rfduplx; | ||
198 | int ctl_rspeed; | ||
199 | |||
200 | u32 msg_enable; | ||
201 | u32 phy_type; | ||
202 | struct mii_if_info mii; | ||
203 | |||
204 | /* work queue */ | ||
205 | struct work_struct phy_configure; | ||
206 | struct net_device *dev; | ||
207 | int work_pending; | ||
208 | |||
209 | spinlock_t lock; | ||
210 | |||
211 | #ifdef SMC_USE_PXA_DMA | ||
212 | /* DMA needs the physical address of the chip */ | ||
213 | u_long physaddr; | ||
214 | #endif | ||
215 | void __iomem *base; | ||
216 | void __iomem *datacs; | ||
217 | }; | ||
218 | |||
219 | #if SMC_DEBUG > 0 | 176 | #if SMC_DEBUG > 0 |
220 | #define DBG(n, args...) \ | 177 | #define DBG(n, args...) \ |
221 | do { \ | 178 | do { \ |
@@ -2215,17 +2172,19 @@ static int smc_drv_probe(struct platform_device *pdev) | |||
2215 | goto out_release_attrib; | 2172 | goto out_release_attrib; |
2216 | } | 2173 | } |
2217 | 2174 | ||
2218 | platform_set_drvdata(pdev, ndev); | ||
2219 | ret = smc_probe(ndev, addr); | ||
2220 | if (ret != 0) | ||
2221 | goto out_iounmap; | ||
2222 | #ifdef SMC_USE_PXA_DMA | 2175 | #ifdef SMC_USE_PXA_DMA |
2223 | else { | 2176 | { |
2224 | struct smc_local *lp = netdev_priv(ndev); | 2177 | struct smc_local *lp = netdev_priv(ndev); |
2178 | lp->device = &pdev->dev; | ||
2225 | lp->physaddr = res->start; | 2179 | lp->physaddr = res->start; |
2226 | } | 2180 | } |
2227 | #endif | 2181 | #endif |
2228 | 2182 | ||
2183 | platform_set_drvdata(pdev, ndev); | ||
2184 | ret = smc_probe(ndev, addr); | ||
2185 | if (ret != 0) | ||
2186 | goto out_iounmap; | ||
2187 | |||
2229 | smc_request_datacs(pdev, ndev); | 2188 | smc_request_datacs(pdev, ndev); |
2230 | 2189 | ||
2231 | return 0; | 2190 | return 0; |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index af9e6bf59552..729fd28c08b5 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -462,6 +462,52 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
462 | 462 | ||
463 | #endif | 463 | #endif |
464 | 464 | ||
465 | |||
466 | /* store this information for the driver.. */ | ||
467 | struct smc_local { | ||
468 | /* | ||
469 | * If I have to wait until memory is available to send a | ||
470 | * packet, I will store the skbuff here, until I get the | ||
471 | * desired memory. Then, I'll send it out and free it. | ||
472 | */ | ||
473 | struct sk_buff *pending_tx_skb; | ||
474 | struct tasklet_struct tx_task; | ||
475 | |||
476 | /* version/revision of the SMC91x chip */ | ||
477 | int version; | ||
478 | |||
479 | /* Contains the current active transmission mode */ | ||
480 | int tcr_cur_mode; | ||
481 | |||
482 | /* Contains the current active receive mode */ | ||
483 | int rcr_cur_mode; | ||
484 | |||
485 | /* Contains the current active receive/phy mode */ | ||
486 | int rpc_cur_mode; | ||
487 | int ctl_rfduplx; | ||
488 | int ctl_rspeed; | ||
489 | |||
490 | u32 msg_enable; | ||
491 | u32 phy_type; | ||
492 | struct mii_if_info mii; | ||
493 | |||
494 | /* work queue */ | ||
495 | struct work_struct phy_configure; | ||
496 | struct net_device *dev; | ||
497 | int work_pending; | ||
498 | |||
499 | spinlock_t lock; | ||
500 | |||
501 | #ifdef SMC_USE_PXA_DMA | ||
502 | /* DMA needs the physical address of the chip */ | ||
503 | u_long physaddr; | ||
504 | struct device *device; | ||
505 | #endif | ||
506 | void __iomem *base; | ||
507 | void __iomem *datacs; | ||
508 | }; | ||
509 | |||
510 | |||
465 | #ifdef SMC_USE_PXA_DMA | 511 | #ifdef SMC_USE_PXA_DMA |
466 | /* | 512 | /* |
467 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is | 513 | * Let's use the DMA engine on the XScale PXA2xx for RX packets. This is |
@@ -476,11 +522,12 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r, | |||
476 | #ifdef SMC_insl | 522 | #ifdef SMC_insl |
477 | #undef SMC_insl | 523 | #undef SMC_insl |
478 | #define SMC_insl(a, r, p, l) \ | 524 | #define SMC_insl(a, r, p, l) \ |
479 | smc_pxa_dma_insl(a, lp->physaddr, r, dev->dma, p, l) | 525 | smc_pxa_dma_insl(a, lp, r, dev->dma, p, l) |
480 | static inline void | 526 | static inline void |
481 | smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | 527 | smc_pxa_dma_insl(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma, |
482 | u_char *buf, int len) | 528 | u_char *buf, int len) |
483 | { | 529 | { |
530 | u_long physaddr = lp->physaddr; | ||
484 | dma_addr_t dmabuf; | 531 | dma_addr_t dmabuf; |
485 | 532 | ||
486 | /* fallback if no DMA available */ | 533 | /* fallback if no DMA available */ |
@@ -497,7 +544,7 @@ smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | |||
497 | } | 544 | } |
498 | 545 | ||
499 | len *= 4; | 546 | len *= 4; |
500 | dmabuf = dma_map_single(NULL, buf, len, DMA_FROM_DEVICE); | 547 | dmabuf = dma_map_single(lp->device, buf, len, DMA_FROM_DEVICE); |
501 | DCSR(dma) = DCSR_NODESC; | 548 | DCSR(dma) = DCSR_NODESC; |
502 | DTADR(dma) = dmabuf; | 549 | DTADR(dma) = dmabuf; |
503 | DSADR(dma) = physaddr + reg; | 550 | DSADR(dma) = physaddr + reg; |
@@ -507,18 +554,19 @@ smc_pxa_dma_insl(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | |||
507 | while (!(DCSR(dma) & DCSR_STOPSTATE)) | 554 | while (!(DCSR(dma) & DCSR_STOPSTATE)) |
508 | cpu_relax(); | 555 | cpu_relax(); |
509 | DCSR(dma) = 0; | 556 | DCSR(dma) = 0; |
510 | dma_unmap_single(NULL, dmabuf, len, DMA_FROM_DEVICE); | 557 | dma_unmap_single(lp->device, dmabuf, len, DMA_FROM_DEVICE); |
511 | } | 558 | } |
512 | #endif | 559 | #endif |
513 | 560 | ||
514 | #ifdef SMC_insw | 561 | #ifdef SMC_insw |
515 | #undef SMC_insw | 562 | #undef SMC_insw |
516 | #define SMC_insw(a, r, p, l) \ | 563 | #define SMC_insw(a, r, p, l) \ |
517 | smc_pxa_dma_insw(a, lp->physaddr, r, dev->dma, p, l) | 564 | smc_pxa_dma_insw(a, lp, r, dev->dma, p, l) |
518 | static inline void | 565 | static inline void |
519 | smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | 566 | smc_pxa_dma_insw(void __iomem *ioaddr, struct smc_local *lp, int reg, int dma, |
520 | u_char *buf, int len) | 567 | u_char *buf, int len) |
521 | { | 568 | { |
569 | u_long physaddr = lp->physaddr; | ||
522 | dma_addr_t dmabuf; | 570 | dma_addr_t dmabuf; |
523 | 571 | ||
524 | /* fallback if no DMA available */ | 572 | /* fallback if no DMA available */ |
@@ -535,7 +583,7 @@ smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | |||
535 | } | 583 | } |
536 | 584 | ||
537 | len *= 2; | 585 | len *= 2; |
538 | dmabuf = dma_map_single(NULL, buf, len, DMA_FROM_DEVICE); | 586 | dmabuf = dma_map_single(lp->device, buf, len, DMA_FROM_DEVICE); |
539 | DCSR(dma) = DCSR_NODESC; | 587 | DCSR(dma) = DCSR_NODESC; |
540 | DTADR(dma) = dmabuf; | 588 | DTADR(dma) = dmabuf; |
541 | DSADR(dma) = physaddr + reg; | 589 | DSADR(dma) = physaddr + reg; |
@@ -545,7 +593,7 @@ smc_pxa_dma_insw(void __iomem *ioaddr, u_long physaddr, int reg, int dma, | |||
545 | while (!(DCSR(dma) & DCSR_STOPSTATE)) | 593 | while (!(DCSR(dma) & DCSR_STOPSTATE)) |
546 | cpu_relax(); | 594 | cpu_relax(); |
547 | DCSR(dma) = 0; | 595 | DCSR(dma) = 0; |
548 | dma_unmap_single(NULL, dmabuf, len, DMA_FROM_DEVICE); | 596 | dma_unmap_single(lp->device, dmabuf, len, DMA_FROM_DEVICE); |
549 | } | 597 | } |
550 | #endif | 598 | #endif |
551 | 599 | ||
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 4276965517f2..dc7a4cb5d270 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -69,4 +69,5 @@ sa1100_cs-$(CONFIG_SA1100_SIMPAD) += sa1100_simpad.o | |||
69 | pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o | 69 | pxa2xx_cs-$(CONFIG_ARCH_LUBBOCK) += pxa2xx_lubbock.o sa1111_generic.o |
70 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o | 70 | pxa2xx_cs-$(CONFIG_MACH_MAINSTONE) += pxa2xx_mainstone.o |
71 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o | 71 | pxa2xx_cs-$(CONFIG_PXA_SHARPSL) += pxa2xx_sharpsl.o |
72 | pxa2xx_cs-$(CONFIG_MACH_ARMCORE) += pxa2xx_cm_x270.o | ||
72 | 73 | ||
diff --git a/drivers/pcmcia/pxa2xx_cm_x270.c b/drivers/pcmcia/pxa2xx_cm_x270.c new file mode 100644 index 000000000000..fbf2f3a6984c --- /dev/null +++ b/drivers/pcmcia/pxa2xx_cm_x270.c | |||
@@ -0,0 +1,175 @@ | |||
1 | /* | ||
2 | * linux/drivers/pcmcia/pxa/pxa_cm_x270.c | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Compulab Ltd., 2003, 2007 | ||
9 | * Mike Rapoport <mike@compulab.co.il> | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/sched.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/irq.h> | ||
17 | #include <linux/delay.h> | ||
18 | |||
19 | #include <pcmcia/ss.h> | ||
20 | #include <asm/hardware.h> | ||
21 | |||
22 | #include <asm/arch/pxa-regs.h> | ||
23 | #include <asm/arch/cm-x270.h> | ||
24 | |||
25 | #include "soc_common.h" | ||
26 | |||
27 | static struct pcmcia_irqs irqs[] = { | ||
28 | { 0, PCMCIA_S0_CD_VALID, "PCMCIA0 CD" }, | ||
29 | { 1, PCMCIA_S1_CD_VALID, "PCMCIA1 CD" }, | ||
30 | }; | ||
31 | |||
32 | static int cmx270_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
33 | { | ||
34 | GPSR(GPIO48_nPOE) = GPIO_bit(GPIO48_nPOE) | | ||
35 | GPIO_bit(GPIO49_nPWE) | | ||
36 | GPIO_bit(GPIO50_nPIOR) | | ||
37 | GPIO_bit(GPIO51_nPIOW) | | ||
38 | GPIO_bit(GPIO85_nPCE_1) | | ||
39 | GPIO_bit(GPIO54_nPCE_2); | ||
40 | |||
41 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
42 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
43 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
44 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
45 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
46 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
47 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
48 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
49 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
50 | |||
51 | /* Reset signal */ | ||
52 | pxa_gpio_mode(GPIO53_nPCE_2 | GPIO_OUT); | ||
53 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
54 | |||
55 | set_irq_type(PCMCIA_S0_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
56 | set_irq_type(PCMCIA_S1_CD_VALID, IRQ_TYPE_EDGE_BOTH); | ||
57 | |||
58 | /* irq's for slots: */ | ||
59 | set_irq_type(PCMCIA_S0_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
60 | set_irq_type(PCMCIA_S1_RDYINT, IRQ_TYPE_EDGE_FALLING); | ||
61 | |||
62 | skt->irq = (skt->nr == 0) ? PCMCIA_S0_RDYINT : PCMCIA_S1_RDYINT; | ||
63 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
64 | } | ||
65 | |||
66 | static void cmx270_pcmcia_shutdown(struct soc_pcmcia_socket *skt) | ||
67 | { | ||
68 | soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs)); | ||
69 | |||
70 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_CD_VALID), IRQ_TYPE_NONE); | ||
71 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_CD_VALID), IRQ_TYPE_NONE); | ||
72 | |||
73 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S0_RDYINT), IRQ_TYPE_NONE); | ||
74 | set_irq_type(IRQ_TO_GPIO(PCMCIA_S1_RDYINT), IRQ_TYPE_NONE); | ||
75 | } | ||
76 | |||
77 | |||
78 | static void cmx270_pcmcia_socket_state(struct soc_pcmcia_socket *skt, | ||
79 | struct pcmcia_state *state) | ||
80 | { | ||
81 | state->detect = (PCC_DETECT(skt->nr) == 0) ? 1 : 0; | ||
82 | state->ready = (PCC_READY(skt->nr) == 0) ? 0 : 1; | ||
83 | state->bvd1 = 1; | ||
84 | state->bvd2 = 1; | ||
85 | state->vs_3v = 0; | ||
86 | state->vs_Xv = 0; | ||
87 | state->wrprot = 0; /* not available */ | ||
88 | } | ||
89 | |||
90 | |||
91 | static int cmx270_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | ||
92 | const socket_state_t *state) | ||
93 | { | ||
94 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
95 | pxa_gpio_mode(GPIO49_nPWE | GPIO_OUT); | ||
96 | |||
97 | switch (skt->nr) { | ||
98 | case 0: | ||
99 | if (state->flags & SS_RESET) { | ||
100 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
101 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
102 | udelay(10); | ||
103 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
104 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
105 | } | ||
106 | break; | ||
107 | case 1: | ||
108 | if (state->flags & SS_RESET) { | ||
109 | GPCR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
110 | GPSR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
111 | udelay(10); | ||
112 | GPCR(GPIO53_nPCE_2) = GPIO_bit(GPIO53_nPCE_2); | ||
113 | GPSR(GPIO49_nPWE) = GPIO_bit(GPIO49_nPWE); | ||
114 | } | ||
115 | break; | ||
116 | } | ||
117 | |||
118 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
119 | |||
120 | return 0; | ||
121 | } | ||
122 | |||
123 | static void cmx270_pcmcia_socket_init(struct soc_pcmcia_socket *skt) | ||
124 | { | ||
125 | } | ||
126 | |||
127 | static void cmx270_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) | ||
128 | { | ||
129 | } | ||
130 | |||
131 | |||
132 | static struct pcmcia_low_level cmx270_pcmcia_ops = { | ||
133 | .owner = THIS_MODULE, | ||
134 | .hw_init = cmx270_pcmcia_hw_init, | ||
135 | .hw_shutdown = cmx270_pcmcia_shutdown, | ||
136 | .socket_state = cmx270_pcmcia_socket_state, | ||
137 | .configure_socket = cmx270_pcmcia_configure_socket, | ||
138 | .socket_init = cmx270_pcmcia_socket_init, | ||
139 | .socket_suspend = cmx270_pcmcia_socket_suspend, | ||
140 | .nr = 2, | ||
141 | }; | ||
142 | |||
143 | static struct platform_device *cmx270_pcmcia_device; | ||
144 | |||
145 | static int __init cmx270_pcmcia_init(void) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | cmx270_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1); | ||
150 | |||
151 | if (!cmx270_pcmcia_device) | ||
152 | return -ENOMEM; | ||
153 | |||
154 | cmx270_pcmcia_device->dev.platform_data = &cmx270_pcmcia_ops; | ||
155 | |||
156 | printk(KERN_INFO "Registering cm-x270 PCMCIA interface.\n"); | ||
157 | ret = platform_device_add(cmx270_pcmcia_device); | ||
158 | |||
159 | if (ret) | ||
160 | platform_device_put(cmx270_pcmcia_device); | ||
161 | |||
162 | return ret; | ||
163 | } | ||
164 | |||
165 | static void __exit cmx270_pcmcia_exit(void) | ||
166 | { | ||
167 | platform_device_unregister(cmx270_pcmcia_device); | ||
168 | } | ||
169 | |||
170 | module_init(cmx270_pcmcia_init); | ||
171 | module_exit(cmx270_pcmcia_exit); | ||
172 | |||
173 | MODULE_LICENSE("GPL"); | ||
174 | MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); | ||
175 | MODULE_DESCRIPTION("CM-x270 PCMCIA driver"); | ||
diff --git a/drivers/pcmcia/pxa2xx_lubbock.c b/drivers/pcmcia/pxa2xx_lubbock.c index 5e9b9a3fd027..1510d6cde3e2 100644 --- a/drivers/pcmcia/pxa2xx_lubbock.c +++ b/drivers/pcmcia/pxa2xx_lubbock.c | |||
@@ -30,35 +30,6 @@ | |||
30 | #include "sa1111_generic.h" | 30 | #include "sa1111_generic.h" |
31 | 31 | ||
32 | static int | 32 | static int |
33 | lubbock_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | ||
34 | { | ||
35 | /* | ||
36 | * Setup default state of GPIO outputs | ||
37 | * before we enable them as outputs. | ||
38 | */ | ||
39 | GPSR(GPIO48_nPOE) = | ||
40 | GPIO_bit(GPIO48_nPOE) | | ||
41 | GPIO_bit(GPIO49_nPWE) | | ||
42 | GPIO_bit(GPIO50_nPIOR) | | ||
43 | GPIO_bit(GPIO51_nPIOW) | | ||
44 | GPIO_bit(GPIO52_nPCE_1) | | ||
45 | GPIO_bit(GPIO53_nPCE_2); | ||
46 | |||
47 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
48 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
49 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
50 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
51 | pxa_gpio_mode(GPIO52_nPCE_1_MD); | ||
52 | pxa_gpio_mode(GPIO53_nPCE_2_MD); | ||
53 | pxa_gpio_mode(GPIO54_pSKTSEL_MD); | ||
54 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
55 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
56 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
57 | |||
58 | return sa1111_pcmcia_hw_init(skt); | ||
59 | } | ||
60 | |||
61 | static int | ||
62 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | 33 | lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, |
63 | const socket_state_t *state) | 34 | const socket_state_t *state) |
64 | { | 35 | { |
@@ -230,7 +201,7 @@ lubbock_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, | |||
230 | 201 | ||
231 | static struct pcmcia_low_level lubbock_pcmcia_ops = { | 202 | static struct pcmcia_low_level lubbock_pcmcia_ops = { |
232 | .owner = THIS_MODULE, | 203 | .owner = THIS_MODULE, |
233 | .hw_init = lubbock_pcmcia_hw_init, | 204 | .hw_init = sa1111_pcmcia_hw_init, |
234 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, | 205 | .hw_shutdown = sa1111_pcmcia_hw_shutdown, |
235 | .socket_state = sa1111_pcmcia_socket_state, | 206 | .socket_state = sa1111_pcmcia_socket_state, |
236 | .configure_socket = lubbock_pcmcia_configure_socket, | 207 | .configure_socket = lubbock_pcmcia_configure_socket, |
diff --git a/drivers/pcmcia/pxa2xx_mainstone.c b/drivers/pcmcia/pxa2xx_mainstone.c index 383107ba4bd3..36c671c5fb65 100644 --- a/drivers/pcmcia/pxa2xx_mainstone.c +++ b/drivers/pcmcia/pxa2xx_mainstone.c | |||
@@ -43,24 +43,6 @@ static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt) | |||
43 | * Setup default state of GPIO outputs | 43 | * Setup default state of GPIO outputs |
44 | * before we enable them as outputs. | 44 | * before we enable them as outputs. |
45 | */ | 45 | */ |
46 | GPSR(GPIO48_nPOE) = | ||
47 | GPIO_bit(GPIO48_nPOE) | | ||
48 | GPIO_bit(GPIO49_nPWE) | | ||
49 | GPIO_bit(GPIO50_nPIOR) | | ||
50 | GPIO_bit(GPIO51_nPIOW) | | ||
51 | GPIO_bit(GPIO85_nPCE_1) | | ||
52 | GPIO_bit(GPIO54_nPCE_2); | ||
53 | |||
54 | pxa_gpio_mode(GPIO48_nPOE_MD); | ||
55 | pxa_gpio_mode(GPIO49_nPWE_MD); | ||
56 | pxa_gpio_mode(GPIO50_nPIOR_MD); | ||
57 | pxa_gpio_mode(GPIO51_nPIOW_MD); | ||
58 | pxa_gpio_mode(GPIO85_nPCE_1_MD); | ||
59 | pxa_gpio_mode(GPIO54_nPCE_2_MD); | ||
60 | pxa_gpio_mode(GPIO79_pSKTSEL_MD); | ||
61 | pxa_gpio_mode(GPIO55_nPREG_MD); | ||
62 | pxa_gpio_mode(GPIO56_nPWAIT_MD); | ||
63 | pxa_gpio_mode(GPIO57_nIOIS16_MD); | ||
64 | 46 | ||
65 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; | 47 | skt->irq = (skt->nr == 0) ? MAINSTONE_S0_IRQ : MAINSTONE_S1_IRQ; |
66 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); | 48 | return soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs)); |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index e9c6cb391a23..af3a011b2b24 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/tty.h> | 42 | #include <linux/tty.h> |
43 | #include <linux/tty_flip.h> | 43 | #include <linux/tty_flip.h> |
44 | #include <linux/serial_core.h> | 44 | #include <linux/serial_core.h> |
45 | #include <linux/clk.h> | ||
45 | 46 | ||
46 | #include <asm/io.h> | 47 | #include <asm/io.h> |
47 | #include <asm/hardware.h> | 48 | #include <asm/hardware.h> |
@@ -55,7 +56,7 @@ struct uart_pxa_port { | |||
55 | unsigned char lcr; | 56 | unsigned char lcr; |
56 | unsigned char mcr; | 57 | unsigned char mcr; |
57 | unsigned int lsr_break_flag; | 58 | unsigned int lsr_break_flag; |
58 | unsigned int cken; | 59 | struct clk *clk; |
59 | char *name; | 60 | char *name; |
60 | }; | 61 | }; |
61 | 62 | ||
@@ -351,6 +352,8 @@ static int serial_pxa_startup(struct uart_port *port) | |||
351 | else | 352 | else |
352 | up->mcr = 0; | 353 | up->mcr = 0; |
353 | 354 | ||
355 | up->port.uartclk = clk_get_rate(up->clk); | ||
356 | |||
354 | /* | 357 | /* |
355 | * Allocate the IRQ | 358 | * Allocate the IRQ |
356 | */ | 359 | */ |
@@ -546,9 +549,11 @@ serial_pxa_pm(struct uart_port *port, unsigned int state, | |||
546 | unsigned int oldstate) | 549 | unsigned int oldstate) |
547 | { | 550 | { |
548 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; | 551 | struct uart_pxa_port *up = (struct uart_pxa_port *)port; |
549 | pxa_set_cken(up->cken, !state); | 552 | |
550 | if (!state) | 553 | if (!state) |
551 | udelay(1); | 554 | clk_enable(up->clk); |
555 | else | ||
556 | clk_disable(up->clk); | ||
552 | } | 557 | } |
553 | 558 | ||
554 | static void serial_pxa_release_port(struct uart_port *port) | 559 | static void serial_pxa_release_port(struct uart_port *port) |
@@ -582,7 +587,7 @@ serial_pxa_type(struct uart_port *port) | |||
582 | 587 | ||
583 | #ifdef CONFIG_SERIAL_PXA_CONSOLE | 588 | #ifdef CONFIG_SERIAL_PXA_CONSOLE |
584 | 589 | ||
585 | static struct uart_pxa_port serial_pxa_ports[]; | 590 | static struct uart_pxa_port *serial_pxa_ports[4]; |
586 | static struct uart_driver serial_pxa_reg; | 591 | static struct uart_driver serial_pxa_reg; |
587 | 592 | ||
588 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) | 593 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
@@ -632,9 +637,11 @@ static void serial_pxa_console_putchar(struct uart_port *port, int ch) | |||
632 | static void | 637 | static void |
633 | serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | 638 | serial_pxa_console_write(struct console *co, const char *s, unsigned int count) |
634 | { | 639 | { |
635 | struct uart_pxa_port *up = &serial_pxa_ports[co->index]; | 640 | struct uart_pxa_port *up = serial_pxa_ports[co->index]; |
636 | unsigned int ier; | 641 | unsigned int ier; |
637 | 642 | ||
643 | clk_enable(up->clk); | ||
644 | |||
638 | /* | 645 | /* |
639 | * First save the IER then disable the interrupts | 646 | * First save the IER then disable the interrupts |
640 | */ | 647 | */ |
@@ -649,6 +656,8 @@ serial_pxa_console_write(struct console *co, const char *s, unsigned int count) | |||
649 | */ | 656 | */ |
650 | wait_for_xmitr(up); | 657 | wait_for_xmitr(up); |
651 | serial_out(up, UART_IER, ier); | 658 | serial_out(up, UART_IER, ier); |
659 | |||
660 | clk_disable(up->clk); | ||
652 | } | 661 | } |
653 | 662 | ||
654 | static int __init | 663 | static int __init |
@@ -662,7 +671,9 @@ serial_pxa_console_setup(struct console *co, char *options) | |||
662 | 671 | ||
663 | if (co->index == -1 || co->index >= serial_pxa_reg.nr) | 672 | if (co->index == -1 || co->index >= serial_pxa_reg.nr) |
664 | co->index = 0; | 673 | co->index = 0; |
665 | up = &serial_pxa_ports[co->index]; | 674 | up = serial_pxa_ports[co->index]; |
675 | if (!up) | ||
676 | return -ENODEV; | ||
666 | 677 | ||
667 | if (options) | 678 | if (options) |
668 | uart_parse_options(options, &baud, &parity, &bits, &flow); | 679 | uart_parse_options(options, &baud, &parity, &bits, &flow); |
@@ -680,15 +691,6 @@ static struct console serial_pxa_console = { | |||
680 | .data = &serial_pxa_reg, | 691 | .data = &serial_pxa_reg, |
681 | }; | 692 | }; |
682 | 693 | ||
683 | static int __init | ||
684 | serial_pxa_console_init(void) | ||
685 | { | ||
686 | register_console(&serial_pxa_console); | ||
687 | return 0; | ||
688 | } | ||
689 | |||
690 | console_initcall(serial_pxa_console_init); | ||
691 | |||
692 | #define PXA_CONSOLE &serial_pxa_console | 694 | #define PXA_CONSOLE &serial_pxa_console |
693 | #else | 695 | #else |
694 | #define PXA_CONSOLE NULL | 696 | #define PXA_CONSOLE NULL |
@@ -714,73 +716,13 @@ struct uart_ops serial_pxa_pops = { | |||
714 | .verify_port = serial_pxa_verify_port, | 716 | .verify_port = serial_pxa_verify_port, |
715 | }; | 717 | }; |
716 | 718 | ||
717 | static struct uart_pxa_port serial_pxa_ports[] = { | ||
718 | { /* FFUART */ | ||
719 | .name = "FFUART", | ||
720 | .cken = CKEN_FFUART, | ||
721 | .port = { | ||
722 | .type = PORT_PXA, | ||
723 | .iotype = UPIO_MEM, | ||
724 | .membase = (void *)&FFUART, | ||
725 | .mapbase = __PREG(FFUART), | ||
726 | .irq = IRQ_FFUART, | ||
727 | .uartclk = 921600 * 16, | ||
728 | .fifosize = 64, | ||
729 | .ops = &serial_pxa_pops, | ||
730 | .line = 0, | ||
731 | }, | ||
732 | }, { /* BTUART */ | ||
733 | .name = "BTUART", | ||
734 | .cken = CKEN_BTUART, | ||
735 | .port = { | ||
736 | .type = PORT_PXA, | ||
737 | .iotype = UPIO_MEM, | ||
738 | .membase = (void *)&BTUART, | ||
739 | .mapbase = __PREG(BTUART), | ||
740 | .irq = IRQ_BTUART, | ||
741 | .uartclk = 921600 * 16, | ||
742 | .fifosize = 64, | ||
743 | .ops = &serial_pxa_pops, | ||
744 | .line = 1, | ||
745 | }, | ||
746 | }, { /* STUART */ | ||
747 | .name = "STUART", | ||
748 | .cken = CKEN_STUART, | ||
749 | .port = { | ||
750 | .type = PORT_PXA, | ||
751 | .iotype = UPIO_MEM, | ||
752 | .membase = (void *)&STUART, | ||
753 | .mapbase = __PREG(STUART), | ||
754 | .irq = IRQ_STUART, | ||
755 | .uartclk = 921600 * 16, | ||
756 | .fifosize = 64, | ||
757 | .ops = &serial_pxa_pops, | ||
758 | .line = 2, | ||
759 | }, | ||
760 | }, { /* HWUART */ | ||
761 | .name = "HWUART", | ||
762 | .cken = CKEN_HWUART, | ||
763 | .port = { | ||
764 | .type = PORT_PXA, | ||
765 | .iotype = UPIO_MEM, | ||
766 | .membase = (void *)&HWUART, | ||
767 | .mapbase = __PREG(HWUART), | ||
768 | .irq = IRQ_HWUART, | ||
769 | .uartclk = 921600 * 16, | ||
770 | .fifosize = 64, | ||
771 | .ops = &serial_pxa_pops, | ||
772 | .line = 3, | ||
773 | }, | ||
774 | } | ||
775 | }; | ||
776 | |||
777 | static struct uart_driver serial_pxa_reg = { | 719 | static struct uart_driver serial_pxa_reg = { |
778 | .owner = THIS_MODULE, | 720 | .owner = THIS_MODULE, |
779 | .driver_name = "PXA serial", | 721 | .driver_name = "PXA serial", |
780 | .dev_name = "ttyS", | 722 | .dev_name = "ttyS", |
781 | .major = TTY_MAJOR, | 723 | .major = TTY_MAJOR, |
782 | .minor = 64, | 724 | .minor = 64, |
783 | .nr = ARRAY_SIZE(serial_pxa_ports), | 725 | .nr = 4, |
784 | .cons = PXA_CONSOLE, | 726 | .cons = PXA_CONSOLE, |
785 | }; | 727 | }; |
786 | 728 | ||
@@ -806,10 +748,68 @@ static int serial_pxa_resume(struct platform_device *dev) | |||
806 | 748 | ||
807 | static int serial_pxa_probe(struct platform_device *dev) | 749 | static int serial_pxa_probe(struct platform_device *dev) |
808 | { | 750 | { |
809 | serial_pxa_ports[dev->id].port.dev = &dev->dev; | 751 | struct uart_pxa_port *sport; |
810 | uart_add_one_port(&serial_pxa_reg, &serial_pxa_ports[dev->id].port); | 752 | struct resource *mmres, *irqres; |
811 | platform_set_drvdata(dev, &serial_pxa_ports[dev->id]); | 753 | int ret; |
754 | |||
755 | mmres = platform_get_resource(dev, IORESOURCE_MEM, 0); | ||
756 | irqres = platform_get_resource(dev, IORESOURCE_IRQ, 0); | ||
757 | if (!mmres || !irqres) | ||
758 | return -ENODEV; | ||
759 | |||
760 | sport = kzalloc(sizeof(struct uart_pxa_port), GFP_KERNEL); | ||
761 | if (!sport) | ||
762 | return -ENOMEM; | ||
763 | |||
764 | sport->clk = clk_get(&dev->dev, "UARTCLK"); | ||
765 | if (IS_ERR(sport->clk)) { | ||
766 | ret = PTR_ERR(sport->clk); | ||
767 | goto err_free; | ||
768 | } | ||
769 | |||
770 | sport->port.type = PORT_PXA; | ||
771 | sport->port.iotype = UPIO_MEM; | ||
772 | sport->port.mapbase = mmres->start; | ||
773 | sport->port.irq = irqres->start; | ||
774 | sport->port.fifosize = 64; | ||
775 | sport->port.ops = &serial_pxa_pops; | ||
776 | sport->port.line = dev->id; | ||
777 | sport->port.dev = &dev->dev; | ||
778 | sport->port.flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF; | ||
779 | sport->port.uartclk = clk_get_rate(sport->clk); | ||
780 | |||
781 | /* | ||
782 | * Is it worth keeping this? | ||
783 | */ | ||
784 | if (mmres->start == __PREG(FFUART)) | ||
785 | sport->name = "FFUART"; | ||
786 | else if (mmres->start == __PREG(BTUART)) | ||
787 | sport->name = "BTUART"; | ||
788 | else if (mmres->start == __PREG(STUART)) | ||
789 | sport->name = "STUART"; | ||
790 | else if (mmres->start == __PREG(HWUART)) | ||
791 | sport->name = "HWUART"; | ||
792 | else | ||
793 | sport->name = "???"; | ||
794 | |||
795 | sport->port.membase = ioremap(mmres->start, mmres->end - mmres->start + 1); | ||
796 | if (!sport->port.membase) { | ||
797 | ret = -ENOMEM; | ||
798 | goto err_clk; | ||
799 | } | ||
800 | |||
801 | serial_pxa_ports[dev->id] = sport; | ||
802 | |||
803 | uart_add_one_port(&serial_pxa_reg, &sport->port); | ||
804 | platform_set_drvdata(dev, sport); | ||
805 | |||
812 | return 0; | 806 | return 0; |
807 | |||
808 | err_clk: | ||
809 | clk_put(sport->clk); | ||
810 | err_free: | ||
811 | kfree(sport); | ||
812 | return ret; | ||
813 | } | 813 | } |
814 | 814 | ||
815 | static int serial_pxa_remove(struct platform_device *dev) | 815 | static int serial_pxa_remove(struct platform_device *dev) |
@@ -818,8 +818,9 @@ static int serial_pxa_remove(struct platform_device *dev) | |||
818 | 818 | ||
819 | platform_set_drvdata(dev, NULL); | 819 | platform_set_drvdata(dev, NULL); |
820 | 820 | ||
821 | if (sport) | 821 | uart_remove_one_port(&serial_pxa_reg, &sport->port); |
822 | uart_remove_one_port(&serial_pxa_reg, &sport->port); | 822 | clk_put(sport->clk); |
823 | kfree(sport); | ||
823 | 824 | ||
824 | return 0; | 825 | return 0; |
825 | } | 826 | } |
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index a055f58f342f..a3bd3a3f41f3 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -2127,6 +2127,14 @@ uart_configure_port(struct uart_driver *drv, struct uart_state *state, | |||
2127 | spin_unlock_irqrestore(&port->lock, flags); | 2127 | spin_unlock_irqrestore(&port->lock, flags); |
2128 | 2128 | ||
2129 | /* | 2129 | /* |
2130 | * If this driver supports console, and it hasn't been | ||
2131 | * successfully registered yet, try to re-register it. | ||
2132 | * It may be that the port was not available. | ||
2133 | */ | ||
2134 | if (port->cons && !(port->cons->flags & CON_ENABLED)) | ||
2135 | register_console(port->cons); | ||
2136 | |||
2137 | /* | ||
2130 | * Power down all ports by default, except the | 2138 | * Power down all ports by default, except the |
2131 | * console if we have one. | 2139 | * console if we have one. |
2132 | */ | 2140 | */ |
@@ -2286,6 +2294,7 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2286 | } | 2294 | } |
2287 | 2295 | ||
2288 | state->port = port; | 2296 | state->port = port; |
2297 | state->pm_state = -1; | ||
2289 | 2298 | ||
2290 | port->cons = drv->cons; | 2299 | port->cons = drv->cons; |
2291 | port->info = state->info; | 2300 | port->info = state->info; |
@@ -2308,15 +2317,6 @@ int uart_add_one_port(struct uart_driver *drv, struct uart_port *port) | |||
2308 | tty_register_device(drv->tty_driver, port->line, port->dev); | 2317 | tty_register_device(drv->tty_driver, port->line, port->dev); |
2309 | 2318 | ||
2310 | /* | 2319 | /* |
2311 | * If this driver supports console, and it hasn't been | ||
2312 | * successfully registered yet, try to re-register it. | ||
2313 | * It may be that the port was not available. | ||
2314 | */ | ||
2315 | if (port->type != PORT_UNKNOWN && | ||
2316 | port->cons && !(port->cons->flags & CON_ENABLED)) | ||
2317 | register_console(port->cons); | ||
2318 | |||
2319 | /* | ||
2320 | * Ensure UPF_DEAD is not set. | 2320 | * Ensure UPF_DEAD is not set. |
2321 | */ | 2321 | */ |
2322 | port->flags &= ~UPF_DEAD; | 2322 | port->flags &= ~UPF_DEAD; |
diff --git a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c index 1407ad1c8128..90d0d086b9b8 100644 --- a/drivers/usb/gadget/pxa2xx_udc.c +++ b/drivers/usb/gadget/pxa2xx_udc.c | |||
@@ -43,6 +43,8 @@ | |||
43 | #include <linux/platform_device.h> | 43 | #include <linux/platform_device.h> |
44 | #include <linux/dma-mapping.h> | 44 | #include <linux/dma-mapping.h> |
45 | #include <linux/irq.h> | 45 | #include <linux/irq.h> |
46 | #include <linux/clk.h> | ||
47 | #include <linux/err.h> | ||
46 | 48 | ||
47 | #include <asm/byteorder.h> | 49 | #include <asm/byteorder.h> |
48 | #include <asm/dma.h> | 50 | #include <asm/dma.h> |
@@ -1157,7 +1159,7 @@ static void udc_disable(struct pxa2xx_udc *dev) | |||
1157 | 1159 | ||
1158 | #ifdef CONFIG_ARCH_PXA | 1160 | #ifdef CONFIG_ARCH_PXA |
1159 | /* Disable clock for USB device */ | 1161 | /* Disable clock for USB device */ |
1160 | pxa_set_cken(CKEN_USB, 0); | 1162 | clk_disable(dev->clk); |
1161 | #endif | 1163 | #endif |
1162 | 1164 | ||
1163 | ep0_idle (dev); | 1165 | ep0_idle (dev); |
@@ -1202,8 +1204,7 @@ static void udc_enable (struct pxa2xx_udc *dev) | |||
1202 | 1204 | ||
1203 | #ifdef CONFIG_ARCH_PXA | 1205 | #ifdef CONFIG_ARCH_PXA |
1204 | /* Enable clock for USB device */ | 1206 | /* Enable clock for USB device */ |
1205 | pxa_set_cken(CKEN_USB, 1); | 1207 | clk_enable(dev->clk); |
1206 | udelay(5); | ||
1207 | #endif | 1208 | #endif |
1208 | 1209 | ||
1209 | /* try to clear these bits before we enable the udc */ | 1210 | /* try to clear these bits before we enable the udc */ |
@@ -2137,6 +2138,14 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2137 | if (irq < 0) | 2138 | if (irq < 0) |
2138 | return -ENODEV; | 2139 | return -ENODEV; |
2139 | 2140 | ||
2141 | #ifdef CONFIG_ARCH_PXA | ||
2142 | dev->clk = clk_get(&pdev->dev, "UDCCLK"); | ||
2143 | if (IS_ERR(dev->clk)) { | ||
2144 | retval = PTR_ERR(dev->clk); | ||
2145 | goto err_clk; | ||
2146 | } | ||
2147 | #endif | ||
2148 | |||
2140 | pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, | 2149 | pr_debug("%s: IRQ %d%s%s\n", driver_name, irq, |
2141 | dev->has_cfr ? "" : " (!cfr)", | 2150 | dev->has_cfr ? "" : " (!cfr)", |
2142 | SIZE_STR "(pio)" | 2151 | SIZE_STR "(pio)" |
@@ -2152,11 +2161,10 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2152 | dev_dbg(&pdev->dev, | 2161 | dev_dbg(&pdev->dev, |
2153 | "can't get vbus gpio %d, err: %d\n", | 2162 | "can't get vbus gpio %d, err: %d\n", |
2154 | dev->mach->gpio_vbus, retval); | 2163 | dev->mach->gpio_vbus, retval); |
2155 | return -EBUSY; | 2164 | goto err_gpio_vbus; |
2156 | } | 2165 | } |
2157 | gpio_direction_input(dev->mach->gpio_vbus); | 2166 | gpio_direction_input(dev->mach->gpio_vbus); |
2158 | vbus_irq = gpio_to_irq(dev->mach->gpio_vbus); | 2167 | vbus_irq = gpio_to_irq(dev->mach->gpio_vbus); |
2159 | set_irq_type(vbus_irq, IRQT_BOTHEDGE); | ||
2160 | } else | 2168 | } else |
2161 | vbus_irq = 0; | 2169 | vbus_irq = 0; |
2162 | 2170 | ||
@@ -2166,9 +2174,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2166 | dev_dbg(&pdev->dev, | 2174 | dev_dbg(&pdev->dev, |
2167 | "can't get pullup gpio %d, err: %d\n", | 2175 | "can't get pullup gpio %d, err: %d\n", |
2168 | dev->mach->gpio_pullup, retval); | 2176 | dev->mach->gpio_pullup, retval); |
2169 | if (dev->mach->gpio_vbus) | 2177 | goto err_gpio_pullup; |
2170 | gpio_free(dev->mach->gpio_vbus); | ||
2171 | return -EBUSY; | ||
2172 | } | 2178 | } |
2173 | gpio_direction_output(dev->mach->gpio_pullup, 0); | 2179 | gpio_direction_output(dev->mach->gpio_pullup, 0); |
2174 | } | 2180 | } |
@@ -2195,11 +2201,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2195 | if (retval != 0) { | 2201 | if (retval != 0) { |
2196 | printk(KERN_ERR "%s: can't get irq %d, err %d\n", | 2202 | printk(KERN_ERR "%s: can't get irq %d, err %d\n", |
2197 | driver_name, irq, retval); | 2203 | driver_name, irq, retval); |
2198 | if (dev->mach->gpio_pullup) | 2204 | goto err_irq1; |
2199 | gpio_free(dev->mach->gpio_pullup); | ||
2200 | if (dev->mach->gpio_vbus) | ||
2201 | gpio_free(dev->mach->gpio_vbus); | ||
2202 | return -EBUSY; | ||
2203 | } | 2205 | } |
2204 | dev->got_irq = 1; | 2206 | dev->got_irq = 1; |
2205 | 2207 | ||
@@ -2213,12 +2215,7 @@ static int __init pxa2xx_udc_probe(struct platform_device *pdev) | |||
2213 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", | 2215 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", |
2214 | driver_name, LUBBOCK_USB_DISC_IRQ, retval); | 2216 | driver_name, LUBBOCK_USB_DISC_IRQ, retval); |
2215 | lubbock_fail0: | 2217 | lubbock_fail0: |
2216 | free_irq(irq, dev); | 2218 | goto err_irq_lub; |
2217 | if (dev->mach->gpio_pullup) | ||
2218 | gpio_free(dev->mach->gpio_pullup); | ||
2219 | if (dev->mach->gpio_vbus) | ||
2220 | gpio_free(dev->mach->gpio_vbus); | ||
2221 | return -EBUSY; | ||
2222 | } | 2219 | } |
2223 | retval = request_irq(LUBBOCK_USB_IRQ, | 2220 | retval = request_irq(LUBBOCK_USB_IRQ, |
2224 | lubbock_vbus_irq, | 2221 | lubbock_vbus_irq, |
@@ -2234,22 +2231,37 @@ lubbock_fail0: | |||
2234 | #endif | 2231 | #endif |
2235 | if (vbus_irq) { | 2232 | if (vbus_irq) { |
2236 | retval = request_irq(vbus_irq, udc_vbus_irq, | 2233 | retval = request_irq(vbus_irq, udc_vbus_irq, |
2237 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | 2234 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM | |
2235 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
2238 | driver_name, dev); | 2236 | driver_name, dev); |
2239 | if (retval != 0) { | 2237 | if (retval != 0) { |
2240 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", | 2238 | printk(KERN_ERR "%s: can't get irq %i, err %d\n", |
2241 | driver_name, vbus_irq, retval); | 2239 | driver_name, vbus_irq, retval); |
2242 | free_irq(irq, dev); | 2240 | goto err_vbus_irq; |
2243 | if (dev->mach->gpio_pullup) | ||
2244 | gpio_free(dev->mach->gpio_pullup); | ||
2245 | if (dev->mach->gpio_vbus) | ||
2246 | gpio_free(dev->mach->gpio_vbus); | ||
2247 | return -EBUSY; | ||
2248 | } | 2241 | } |
2249 | } | 2242 | } |
2250 | create_proc_files(); | 2243 | create_proc_files(); |
2251 | 2244 | ||
2252 | return 0; | 2245 | return 0; |
2246 | |||
2247 | err_vbus_irq: | ||
2248 | #ifdef CONFIG_ARCH_LUBBOCK | ||
2249 | free_irq(LUBBOCK_USB_DISC_IRQ, dev); | ||
2250 | err_irq_lub: | ||
2251 | #endif | ||
2252 | free_irq(irq, dev); | ||
2253 | err_irq1: | ||
2254 | if (dev->mach->gpio_pullup) | ||
2255 | gpio_free(dev->mach->gpio_pullup); | ||
2256 | err_gpio_pullup: | ||
2257 | if (dev->mach->gpio_vbus) | ||
2258 | gpio_free(dev->mach->gpio_vbus); | ||
2259 | err_gpio_vbus: | ||
2260 | #ifdef CONFIG_ARCH_PXA | ||
2261 | clk_put(dev->clk); | ||
2262 | err_clk: | ||
2263 | #endif | ||
2264 | return retval; | ||
2253 | } | 2265 | } |
2254 | 2266 | ||
2255 | static void pxa2xx_udc_shutdown(struct platform_device *_dev) | 2267 | static void pxa2xx_udc_shutdown(struct platform_device *_dev) |
@@ -2284,6 +2296,10 @@ static int __exit pxa2xx_udc_remove(struct platform_device *pdev) | |||
2284 | if (dev->mach->gpio_pullup) | 2296 | if (dev->mach->gpio_pullup) |
2285 | gpio_free(dev->mach->gpio_pullup); | 2297 | gpio_free(dev->mach->gpio_pullup); |
2286 | 2298 | ||
2299 | #ifdef CONFIG_ARCH_PXA | ||
2300 | clk_put(dev->clk); | ||
2301 | #endif | ||
2302 | |||
2287 | platform_set_drvdata(pdev, NULL); | 2303 | platform_set_drvdata(pdev, NULL); |
2288 | the_controller = NULL; | 2304 | the_controller = NULL; |
2289 | return 0; | 2305 | return 0; |
diff --git a/drivers/usb/gadget/pxa2xx_udc.h b/drivers/usb/gadget/pxa2xx_udc.h index 0e5d0e6fb0e2..1db46d705777 100644 --- a/drivers/usb/gadget/pxa2xx_udc.h +++ b/drivers/usb/gadget/pxa2xx_udc.h | |||
@@ -125,6 +125,7 @@ struct pxa2xx_udc { | |||
125 | struct timer_list timer; | 125 | struct timer_list timer; |
126 | 126 | ||
127 | struct device *dev; | 127 | struct device *dev; |
128 | struct clk *clk; | ||
128 | struct pxa2xx_udc_mach_info *mach; | 129 | struct pxa2xx_udc_mach_info *mach; |
129 | u64 dma_mask; | 130 | u64 dma_mask; |
130 | struct pxa2xx_ep ep [PXA_UDC_NUM_ENDPOINTS]; | 131 | struct pxa2xx_ep ep [PXA_UDC_NUM_ENDPOINTS]; |
diff --git a/drivers/video/pxafb.c b/drivers/video/pxafb.c index a280a52f8efe..f9b12ab59642 100644 --- a/drivers/video/pxafb.c +++ b/drivers/video/pxafb.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/cpufreq.h> | 37 | #include <linux/cpufreq.h> |
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/dma-mapping.h> | 39 | #include <linux/dma-mapping.h> |
40 | #include <linux/clk.h> | ||
41 | #include <linux/err.h> | ||
40 | 42 | ||
41 | #include <asm/hardware.h> | 43 | #include <asm/hardware.h> |
42 | #include <asm/io.h> | 44 | #include <asm/io.h> |
@@ -506,15 +508,15 @@ static struct fb_ops pxafb_ops = { | |||
506 | * | 508 | * |
507 | * Factoring the 10^4 and 10^-12 out gives 10^-8 == 1 / 100000000 as used below. | 509 | * Factoring the 10^4 and 10^-12 out gives 10^-8 == 1 / 100000000 as used below. |
508 | */ | 510 | */ |
509 | static inline unsigned int get_pcd(unsigned int pixclock) | 511 | static inline unsigned int get_pcd(struct pxafb_info *fbi, unsigned int pixclock) |
510 | { | 512 | { |
511 | unsigned long long pcd; | 513 | unsigned long long pcd; |
512 | 514 | ||
513 | /* FIXME: Need to take into account Double Pixel Clock mode | 515 | /* FIXME: Need to take into account Double Pixel Clock mode |
514 | * (DPC) bit? or perhaps set it based on the various clock | 516 | * (DPC) bit? or perhaps set it based on the various clock |
515 | * speeds */ | 517 | * speeds */ |
516 | 518 | pcd = (unsigned long long)(clk_get_rate(fbi->clk) / 10000); | |
517 | pcd = (unsigned long long)get_lcdclk_frequency_10khz() * pixclock; | 519 | pcd *= pixclock; |
518 | do_div(pcd, 100000000 * 2); | 520 | do_div(pcd, 100000000 * 2); |
519 | /* no need for this, since we should subtract 1 anyway. they cancel */ | 521 | /* no need for this, since we should subtract 1 anyway. they cancel */ |
520 | /* pcd += 1; */ /* make up for integer math truncations */ | 522 | /* pcd += 1; */ /* make up for integer math truncations */ |
@@ -523,19 +525,21 @@ static inline unsigned int get_pcd(unsigned int pixclock) | |||
523 | 525 | ||
524 | /* | 526 | /* |
525 | * Some touchscreens need hsync information from the video driver to | 527 | * Some touchscreens need hsync information from the video driver to |
526 | * function correctly. We export it here. | 528 | * function correctly. We export it here. Note that 'hsync_time' and |
529 | * the value returned from pxafb_get_hsync_time() is the *reciprocal* | ||
530 | * of the hsync period in seconds. | ||
527 | */ | 531 | */ |
528 | static inline void set_hsync_time(struct pxafb_info *fbi, unsigned int pcd) | 532 | static inline void set_hsync_time(struct pxafb_info *fbi, unsigned int pcd) |
529 | { | 533 | { |
530 | unsigned long long htime; | 534 | unsigned long htime; |
531 | 535 | ||
532 | if ((pcd == 0) || (fbi->fb.var.hsync_len == 0)) { | 536 | if ((pcd == 0) || (fbi->fb.var.hsync_len == 0)) { |
533 | fbi->hsync_time=0; | 537 | fbi->hsync_time=0; |
534 | return; | 538 | return; |
535 | } | 539 | } |
536 | 540 | ||
537 | htime = (unsigned long long)get_lcdclk_frequency_10khz() * 10000; | 541 | htime = clk_get_rate(fbi->clk) / (pcd * fbi->fb.var.hsync_len); |
538 | do_div(htime, pcd * fbi->fb.var.hsync_len); | 542 | |
539 | fbi->hsync_time = htime; | 543 | fbi->hsync_time = htime; |
540 | } | 544 | } |
541 | 545 | ||
@@ -560,7 +564,7 @@ static int pxafb_activate_var(struct fb_var_screeninfo *var, struct pxafb_info * | |||
560 | { | 564 | { |
561 | struct pxafb_lcd_reg new_regs; | 565 | struct pxafb_lcd_reg new_regs; |
562 | u_long flags; | 566 | u_long flags; |
563 | u_int lines_per_panel, pcd = get_pcd(var->pixclock); | 567 | u_int lines_per_panel, pcd = get_pcd(fbi, var->pixclock); |
564 | 568 | ||
565 | pr_debug("pxafb: Configuring PXA LCD\n"); | 569 | pr_debug("pxafb: Configuring PXA LCD\n"); |
566 | 570 | ||
@@ -803,7 +807,7 @@ static void pxafb_enable_controller(struct pxafb_info *fbi) | |||
803 | pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); | 807 | pr_debug("reg_lccr3 0x%08x\n", (unsigned int) fbi->reg_lccr3); |
804 | 808 | ||
805 | /* enable LCD controller clock */ | 809 | /* enable LCD controller clock */ |
806 | pxa_set_cken(CKEN_LCD, 1); | 810 | clk_enable(fbi->clk); |
807 | 811 | ||
808 | /* Sequence from 11.7.10 */ | 812 | /* Sequence from 11.7.10 */ |
809 | LCCR3 = fbi->reg_lccr3; | 813 | LCCR3 = fbi->reg_lccr3; |
@@ -840,7 +844,7 @@ static void pxafb_disable_controller(struct pxafb_info *fbi) | |||
840 | remove_wait_queue(&fbi->ctrlr_wait, &wait); | 844 | remove_wait_queue(&fbi->ctrlr_wait, &wait); |
841 | 845 | ||
842 | /* disable LCD controller clock */ | 846 | /* disable LCD controller clock */ |
843 | pxa_set_cken(CKEN_LCD, 0); | 847 | clk_disable(fbi->clk); |
844 | } | 848 | } |
845 | 849 | ||
846 | /* | 850 | /* |
@@ -994,7 +998,7 @@ pxafb_freq_transition(struct notifier_block *nb, unsigned long val, void *data) | |||
994 | break; | 998 | break; |
995 | 999 | ||
996 | case CPUFREQ_POSTCHANGE: | 1000 | case CPUFREQ_POSTCHANGE: |
997 | pcd = get_pcd(fbi->fb.var.pixclock); | 1001 | pcd = get_pcd(fbi, fbi->fb.var.pixclock); |
998 | set_hsync_time(fbi, pcd); | 1002 | set_hsync_time(fbi, pcd); |
999 | fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd); | 1003 | fbi->reg_lccr3 = (fbi->reg_lccr3 & ~0xff) | LCCR3_PixClkDiv(pcd); |
1000 | set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE); | 1004 | set_ctrlr_state(fbi, C_ENABLE_CLKCHANGE); |
@@ -1119,6 +1123,12 @@ static struct pxafb_info * __init pxafb_init_fbinfo(struct device *dev) | |||
1119 | memset(fbi, 0, sizeof(struct pxafb_info)); | 1123 | memset(fbi, 0, sizeof(struct pxafb_info)); |
1120 | fbi->dev = dev; | 1124 | fbi->dev = dev; |
1121 | 1125 | ||
1126 | fbi->clk = clk_get(dev, "LCDCLK"); | ||
1127 | if (IS_ERR(fbi->clk)) { | ||
1128 | kfree(fbi); | ||
1129 | return NULL; | ||
1130 | } | ||
1131 | |||
1122 | strcpy(fbi->fb.fix.id, PXA_NAME); | 1132 | strcpy(fbi->fb.fix.id, PXA_NAME); |
1123 | 1133 | ||
1124 | fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS; | 1134 | fbi->fb.fix.type = FB_TYPE_PACKED_PIXELS; |
diff --git a/drivers/video/pxafb.h b/drivers/video/pxafb.h index 7499a1c4bf79..f8605b807b0a 100644 --- a/drivers/video/pxafb.h +++ b/drivers/video/pxafb.h | |||
@@ -40,6 +40,7 @@ struct pxafb_dma_descriptor { | |||
40 | struct pxafb_info { | 40 | struct pxafb_info { |
41 | struct fb_info fb; | 41 | struct fb_info fb; |
42 | struct device *dev; | 42 | struct device *dev; |
43 | struct clk *clk; | ||
43 | 44 | ||
44 | /* | 45 | /* |
45 | * These are the addresses we mapped | 46 | * These are the addresses we mapped |