diff options
44 files changed, 2016 insertions, 190 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index c3b215970f7b..1f02d96a5dbf 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -636,7 +636,7 @@ P: Dirk Opfer | |||
636 | M: dirk@opfer-online.de | 636 | M: dirk@opfer-online.de |
637 | S: Maintained | 637 | S: Maintained |
638 | 638 | ||
639 | ARM/PALMTX,PALMT5,PALMLD SUPPORT | 639 | ARM/PALMTX,PALMT5,PALMLD,PALMTE2 SUPPORT |
640 | P: Marek Vasut | 640 | P: Marek Vasut |
641 | M: marek.vasut@gmail.com | 641 | M: marek.vasut@gmail.com |
642 | W: http://hackndev.com | 642 | W: http://hackndev.com |
@@ -3057,7 +3057,7 @@ S: Supported | |||
3057 | 3057 | ||
3058 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM | 3058 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM |
3059 | P: Pierre Ossman | 3059 | P: Pierre Ossman |
3060 | M: drzeus-mmc@drzeus.cx | 3060 | M: pierre@ossman.eu |
3061 | L: linux-kernel@vger.kernel.org | 3061 | L: linux-kernel@vger.kernel.org |
3062 | S: Maintained | 3062 | S: Maintained |
3063 | 3063 | ||
@@ -3939,7 +3939,7 @@ S: Maintained | |||
3939 | 3939 | ||
3940 | SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER | 3940 | SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) DRIVER |
3941 | P: Pierre Ossman | 3941 | P: Pierre Ossman |
3942 | M: drzeus-sdhci@drzeus.cx | 3942 | M: pierre@ossman.eu |
3943 | L: sdhci-devel@lists.ossman.eu | 3943 | L: sdhci-devel@lists.ossman.eu |
3944 | S: Maintained | 3944 | S: Maintained |
3945 | 3945 | ||
@@ -4926,7 +4926,7 @@ S: Maintained | |||
4926 | 4926 | ||
4927 | W83L51xD SD/MMC CARD INTERFACE DRIVER | 4927 | W83L51xD SD/MMC CARD INTERFACE DRIVER |
4928 | P: Pierre Ossman | 4928 | P: Pierre Ossman |
4929 | M: drzeus-wbsd@drzeus.cx | 4929 | M: pierre@ossman.eu |
4930 | L: linux-kernel@vger.kernel.org | 4930 | L: linux-kernel@vger.kernel.org |
4931 | S: Maintained | 4931 | S: Maintained |
4932 | 4932 | ||
diff --git a/arch/arm/configs/magician_defconfig b/arch/arm/configs/magician_defconfig index 82428c2f234c..f56837f69ca7 100644 --- a/arch/arm/configs/magician_defconfig +++ b/arch/arm/configs/magician_defconfig | |||
@@ -1183,7 +1183,11 @@ CONFIG_RTC_INTF_DEV=y | |||
1183 | CONFIG_RTC_DRV_SA1100=y | 1183 | CONFIG_RTC_DRV_SA1100=y |
1184 | # CONFIG_RTC_DRV_PXA is not set | 1184 | # CONFIG_RTC_DRV_PXA is not set |
1185 | # CONFIG_DMADEVICES is not set | 1185 | # CONFIG_DMADEVICES is not set |
1186 | # CONFIG_REGULATOR is not set | 1186 | CONFIG_REGULATOR=y |
1187 | # CONFIG_REGULATOR_DEBUG is not set | ||
1188 | # CONFIG_REGULATOR_FIXED_VOLTAGE is not set | ||
1189 | # CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set | ||
1190 | CONFIG_REGULATOR_BQ24022=y | ||
1187 | # CONFIG_UIO is not set | 1191 | # CONFIG_UIO is not set |
1188 | # CONFIG_STAGING is not set | 1192 | # CONFIG_STAGING is not set |
1189 | 1193 | ||
diff --git a/arch/arm/include/asm/sizes.h b/arch/arm/include/asm/sizes.h index c10d1aa4b487..ada93a8fc2ef 100644 --- a/arch/arm/include/asm/sizes.h +++ b/arch/arm/include/asm/sizes.h | |||
@@ -32,6 +32,7 @@ | |||
32 | #define SZ_4K 0x00001000 | 32 | #define SZ_4K 0x00001000 |
33 | #define SZ_8K 0x00002000 | 33 | #define SZ_8K 0x00002000 |
34 | #define SZ_16K 0x00004000 | 34 | #define SZ_16K 0x00004000 |
35 | #define SZ_32K 0x00008000 | ||
35 | #define SZ_64K 0x00010000 | 36 | #define SZ_64K 0x00010000 |
36 | #define SZ_128K 0x00020000 | 37 | #define SZ_128K 0x00020000 |
37 | #define SZ_256K 0x00040000 | 38 | #define SZ_256K 0x00040000 |
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h index 793fe7b25f36..e6afff849b85 100644 --- a/arch/arm/mach-at91/include/mach/board.h +++ b/arch/arm/mach-at91/include/mach/board.h | |||
@@ -87,7 +87,7 @@ extern void __init at91_add_device_eth(struct at91_eth_data *data); | |||
87 | /* USB Host */ | 87 | /* USB Host */ |
88 | struct at91_usbh_data { | 88 | struct at91_usbh_data { |
89 | u8 ports; /* number of ports on root hub */ | 89 | u8 ports; /* number of ports on root hub */ |
90 | u8 vbus_pin[]; /* port power-control pin */ | 90 | u8 vbus_pin[2]; /* port power-control pin */ |
91 | }; | 91 | }; |
92 | extern void __init at91_add_device_usbh(struct at91_usbh_data *data); | 92 | extern void __init at91_add_device_usbh(struct at91_usbh_data *data); |
93 | 93 | ||
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index dafe4f71d15f..336e51dc6127 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -590,27 +590,28 @@ static void omap1_init_ext_clk(struct clk * clk) | |||
590 | static int omap1_clk_enable(struct clk *clk) | 590 | static int omap1_clk_enable(struct clk *clk) |
591 | { | 591 | { |
592 | int ret = 0; | 592 | int ret = 0; |
593 | |||
593 | if (clk->usecount++ == 0) { | 594 | if (clk->usecount++ == 0) { |
594 | if (likely(clk->parent)) { | 595 | if (clk->parent) { |
595 | ret = omap1_clk_enable(clk->parent); | 596 | ret = omap1_clk_enable(clk->parent); |
596 | 597 | if (ret) | |
597 | if (unlikely(ret != 0)) { | 598 | goto err; |
598 | clk->usecount--; | ||
599 | return ret; | ||
600 | } | ||
601 | 599 | ||
602 | if (clk->flags & CLOCK_NO_IDLE_PARENT) | 600 | if (clk->flags & CLOCK_NO_IDLE_PARENT) |
603 | omap1_clk_deny_idle(clk->parent); | 601 | omap1_clk_deny_idle(clk->parent); |
604 | } | 602 | } |
605 | 603 | ||
606 | ret = clk->ops->enable(clk); | 604 | ret = clk->ops->enable(clk); |
607 | 605 | if (ret) { | |
608 | if (unlikely(ret != 0) && clk->parent) { | 606 | if (clk->parent) |
609 | omap1_clk_disable(clk->parent); | 607 | omap1_clk_disable(clk->parent); |
610 | clk->usecount--; | 608 | goto err; |
611 | } | 609 | } |
612 | } | 610 | } |
611 | return ret; | ||
613 | 612 | ||
613 | err: | ||
614 | clk->usecount--; | ||
614 | return ret; | 615 | return ret; |
615 | } | 616 | } |
616 | 617 | ||
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig index 96a2006cb597..3e66d9099eab 100644 --- a/arch/arm/mach-pxa/Kconfig +++ b/arch/arm/mach-pxa/Kconfig | |||
@@ -343,6 +343,15 @@ config ARCH_PXA_PALM | |||
343 | bool "PXA based Palm PDAs" | 343 | bool "PXA based Palm PDAs" |
344 | select HAVE_PWM | 344 | select HAVE_PWM |
345 | 345 | ||
346 | config MACH_PALMTE2 | ||
347 | bool "Palm Tungsten|E2" | ||
348 | default y | ||
349 | depends on ARCH_PXA_PALM | ||
350 | select PXA25x | ||
351 | help | ||
352 | Say Y here if you intend to run this kernel on a Palm Tungsten|E2 | ||
353 | handheld computer. | ||
354 | |||
346 | config MACH_PALMT5 | 355 | config MACH_PALMT5 |
347 | bool "Palm Tungsten|T5" | 356 | bool "Palm Tungsten|T5" |
348 | default y | 357 | default y |
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile index c80e1bac4945..682dbf4e14b0 100644 --- a/arch/arm/mach-pxa/Makefile +++ b/arch/arm/mach-pxa/Makefile | |||
@@ -57,6 +57,7 @@ obj-$(CONFIG_MACH_E740) += e740.o | |||
57 | obj-$(CONFIG_MACH_E750) += e750.o | 57 | obj-$(CONFIG_MACH_E750) += e750.o |
58 | obj-$(CONFIG_MACH_E400) += e400.o | 58 | obj-$(CONFIG_MACH_E400) += e400.o |
59 | obj-$(CONFIG_MACH_E800) += e800.o | 59 | obj-$(CONFIG_MACH_E800) += e800.o |
60 | obj-$(CONFIG_MACH_PALMTE2) += palmte2.o | ||
60 | obj-$(CONFIG_MACH_PALMT5) += palmt5.o | 61 | obj-$(CONFIG_MACH_PALMT5) += palmt5.o |
61 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o | 62 | obj-$(CONFIG_MACH_PALMTX) += palmtx.o |
62 | obj-$(CONFIG_MACH_PALMLD) += palmld.o | 63 | obj-$(CONFIG_MACH_PALMLD) += palmld.o |
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c index 117b5435f8d5..b50ef39eabfc 100644 --- a/arch/arm/mach-pxa/cm-x2xx.c +++ b/arch/arm/mach-pxa/cm-x2xx.c | |||
@@ -121,7 +121,7 @@ static inline void cmx2xx_init_dm9000(void) {} | |||
121 | /* UCB1400 touchscreen controller */ | 121 | /* UCB1400 touchscreen controller */ |
122 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) | 122 | #if defined(CONFIG_TOUCHSCREEN_UCB1400) || defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE) |
123 | static struct platform_device cmx2xx_ts_device = { | 123 | static struct platform_device cmx2xx_ts_device = { |
124 | .name = "ucb1400_ts", | 124 | .name = "ucb1400_core", |
125 | .id = -1, | 125 | .id = -1, |
126 | }; | 126 | }; |
127 | 127 | ||
diff --git a/arch/arm/mach-pxa/colibri-pxa300.c b/arch/arm/mach-pxa/colibri-pxa300.c index 10c2eaf93230..7c9c34c19ae2 100644 --- a/arch/arm/mach-pxa/colibri-pxa300.c +++ b/arch/arm/mach-pxa/colibri-pxa300.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <net/ax88796.h> | 18 | #include <linux/interrupt.h> |
19 | 19 | ||
20 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
21 | #include <asm/sizes.h> | 21 | #include <asm/sizes.h> |
@@ -32,12 +32,13 @@ | |||
32 | 32 | ||
33 | #if defined(CONFIG_AX88796) | 33 | #if defined(CONFIG_AX88796) |
34 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) | 34 | #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO) |
35 | |||
35 | /* | 36 | /* |
36 | * Asix AX88796 Ethernet | 37 | * Asix AX88796 Ethernet |
37 | */ | 38 | */ |
38 | static struct ax_plat_data colibri_asix_platdata = { | 39 | static struct ax_plat_data colibri_asix_platdata = { |
39 | .flags = AXFLG_MAC_FROMDEV, | 40 | .flags = 0, /* defined later */ |
40 | .wordlength = 2 | 41 | .wordlength = 2, |
41 | }; | 42 | }; |
42 | 43 | ||
43 | static struct resource colibri_asix_resource[] = { | 44 | static struct resource colibri_asix_resource[] = { |
@@ -49,7 +50,7 @@ static struct resource colibri_asix_resource[] = { | |||
49 | [1] = { | 50 | [1] = { |
50 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | 51 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
51 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | 52 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
52 | .flags = IORESOURCE_IRQ | 53 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
53 | } | 54 | } |
54 | }; | 55 | }; |
55 | 56 | ||
@@ -70,8 +71,8 @@ static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = { | |||
70 | 71 | ||
71 | static void __init colibri_pxa300_init_eth(void) | 72 | static void __init colibri_pxa300_init_eth(void) |
72 | { | 73 | { |
74 | colibri_pxa3xx_init_eth(&colibri_asix_platdata); | ||
73 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); | 75 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config)); |
74 | set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); | ||
75 | platform_device_register(&asix_device); | 76 | platform_device_register(&asix_device); |
76 | } | 77 | } |
77 | #else | 78 | #else |
diff --git a/arch/arm/mach-pxa/colibri-pxa320.c b/arch/arm/mach-pxa/colibri-pxa320.c index 55b74a7a6151..a18d37b3c5e6 100644 --- a/arch/arm/mach-pxa/colibri-pxa320.c +++ b/arch/arm/mach-pxa/colibri-pxa320.c | |||
@@ -15,7 +15,7 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/gpio.h> | 17 | #include <linux/gpio.h> |
18 | #include <net/ax88796.h> | 18 | #include <linux/interrupt.h> |
19 | 19 | ||
20 | #include <asm/mach-types.h> | 20 | #include <asm/mach-types.h> |
21 | #include <asm/sizes.h> | 21 | #include <asm/sizes.h> |
@@ -38,8 +38,8 @@ | |||
38 | * Asix AX88796 Ethernet | 38 | * Asix AX88796 Ethernet |
39 | */ | 39 | */ |
40 | static struct ax_plat_data colibri_asix_platdata = { | 40 | static struct ax_plat_data colibri_asix_platdata = { |
41 | .flags = AXFLG_MAC_FROMDEV, | 41 | .flags = 0, /* defined later */ |
42 | .wordlength = 2 | 42 | .wordlength = 2, |
43 | }; | 43 | }; |
44 | 44 | ||
45 | static struct resource colibri_asix_resource[] = { | 45 | static struct resource colibri_asix_resource[] = { |
@@ -51,7 +51,7 @@ static struct resource colibri_asix_resource[] = { | |||
51 | [1] = { | 51 | [1] = { |
52 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | 52 | .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
53 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), | 53 | .end = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), |
54 | .flags = IORESOURCE_IRQ | 54 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING, |
55 | } | 55 | } |
56 | }; | 56 | }; |
57 | 57 | ||
@@ -72,8 +72,8 @@ static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = { | |||
72 | 72 | ||
73 | static void __init colibri_pxa320_init_eth(void) | 73 | static void __init colibri_pxa320_init_eth(void) |
74 | { | 74 | { |
75 | colibri_pxa3xx_init_eth(&colibri_asix_platdata); | ||
75 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config)); | 76 | pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config)); |
76 | set_irq_type(gpio_to_irq(COLIBRI_ETH_IRQ_GPIO), IRQ_TYPE_EDGE_FALLING); | ||
77 | platform_device_register(&asix_device); | 77 | platform_device_register(&asix_device); |
78 | } | 78 | } |
79 | #else | 79 | #else |
diff --git a/arch/arm/mach-pxa/colibri-pxa3xx.c b/arch/arm/mach-pxa/colibri-pxa3xx.c index 12d0afc54aa5..ea34e34f8cd8 100644 --- a/arch/arm/mach-pxa/colibri-pxa3xx.c +++ b/arch/arm/mach-pxa/colibri-pxa3xx.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
17 | #include <linux/etherdevice.h> | ||
17 | #include <asm/mach-types.h> | 18 | #include <asm/mach-types.h> |
18 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
19 | #include <asm/sizes.h> | 20 | #include <asm/sizes.h> |
@@ -28,6 +29,40 @@ | |||
28 | #include "generic.h" | 29 | #include "generic.h" |
29 | #include "devices.h" | 30 | #include "devices.h" |
30 | 31 | ||
32 | #if defined(CONFIG_AX88796) | ||
33 | #define ETHER_ADDR_LEN 6 | ||
34 | static u8 ether_mac_addr[ETHER_ADDR_LEN]; | ||
35 | |||
36 | void __init colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data) | ||
37 | { | ||
38 | int i; | ||
39 | u64 serial = ((u64) system_serial_high << 32) | system_serial_low; | ||
40 | |||
41 | /* | ||
42 | * If the bootloader passed in a serial boot tag, which contains a | ||
43 | * valid ethernet MAC, pass it to the interface. Toradex ships the | ||
44 | * modules with their own bootloader which provides a valid MAC | ||
45 | * this way. | ||
46 | */ | ||
47 | |||
48 | for (i = 0; i < ETHER_ADDR_LEN; i++) { | ||
49 | ether_mac_addr[i] = serial & 0xff; | ||
50 | serial >>= 8; | ||
51 | } | ||
52 | |||
53 | if (is_valid_ether_addr(ether_mac_addr)) { | ||
54 | plat_data->flags |= AXFLG_MAC_FROMPLATFORM; | ||
55 | plat_data->mac_addr = ether_mac_addr; | ||
56 | printk(KERN_INFO "%s(): taking MAC from serial boot tag\n", | ||
57 | __func__); | ||
58 | } else { | ||
59 | plat_data->flags |= AXFLG_MAC_FROMDEV; | ||
60 | printk(KERN_INFO "%s(): no valid serial boot tag found, " | ||
61 | "taking MAC from device\n", __func__); | ||
62 | } | ||
63 | } | ||
64 | #endif | ||
65 | |||
31 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | 66 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
32 | static int mmc_detect_pin; | 67 | static int mmc_detect_pin; |
33 | 68 | ||
diff --git a/arch/arm/mach-pxa/csb701.c b/arch/arm/mach-pxa/csb701.c index 4a2a2952c374..5a221a49ea4d 100644 --- a/arch/arm/mach-pxa/csb701.c +++ b/arch/arm/mach-pxa/csb701.c | |||
@@ -5,6 +5,8 @@ | |||
5 | #include <linux/input.h> | 5 | #include <linux/input.h> |
6 | #include <linux/leds.h> | 6 | #include <linux/leds.h> |
7 | 7 | ||
8 | #include <asm/mach-types.h> | ||
9 | |||
8 | static struct gpio_keys_button csb701_buttons[] = { | 10 | static struct gpio_keys_button csb701_buttons[] = { |
9 | { | 11 | { |
10 | .code = 0x7, | 12 | .code = 0x7, |
@@ -54,6 +56,9 @@ static struct platform_device *devices[] __initdata = { | |||
54 | 56 | ||
55 | static int __init csb701_init(void) | 57 | static int __init csb701_init(void) |
56 | { | 58 | { |
59 | if (!machine_is_csb726()) | ||
60 | return -ENODEV; | ||
61 | |||
57 | return platform_add_devices(devices, ARRAY_SIZE(devices)); | 62 | return platform_add_devices(devices, ARRAY_SIZE(devices)); |
58 | } | 63 | } |
59 | 64 | ||
diff --git a/arch/arm/mach-pxa/e740.c b/arch/arm/mach-pxa/e740.c index 07500a04fd8c..a36fc17f671d 100644 --- a/arch/arm/mach-pxa/e740.c +++ b/arch/arm/mach-pxa/e740.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <mach/udc.h> | 29 | #include <mach/udc.h> |
30 | #include <mach/irda.h> | 30 | #include <mach/irda.h> |
31 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
32 | #include <mach/audio.h> | ||
32 | 33 | ||
33 | #include "generic.h" | 34 | #include "generic.h" |
34 | #include "eseries.h" | 35 | #include "eseries.h" |
@@ -197,6 +198,7 @@ static void __init e740_init(void) | |||
197 | eseries_get_tmio_gpios(); | 198 | eseries_get_tmio_gpios(); |
198 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 199 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
199 | pxa_set_udc_info(&e7xx_udc_mach_info); | 200 | pxa_set_udc_info(&e7xx_udc_mach_info); |
201 | pxa_set_ac97_info(NULL); | ||
200 | e7xx_irda_init(); | 202 | e7xx_irda_init(); |
201 | pxa_set_ficp_info(&e7xx_ficp_platform_data); | 203 | pxa_set_ficp_info(&e7xx_ficp_platform_data); |
202 | } | 204 | } |
diff --git a/arch/arm/mach-pxa/e750.c b/arch/arm/mach-pxa/e750.c index 6126c04e02bc..1d00110590e5 100644 --- a/arch/arm/mach-pxa/e750.c +++ b/arch/arm/mach-pxa/e750.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <mach/udc.h> | 28 | #include <mach/udc.h> |
29 | #include <mach/irda.h> | 29 | #include <mach/irda.h> |
30 | #include <mach/irqs.h> | 30 | #include <mach/irqs.h> |
31 | #include <mach/audio.h> | ||
31 | 32 | ||
32 | #include "generic.h" | 33 | #include "generic.h" |
33 | #include "eseries.h" | 34 | #include "eseries.h" |
@@ -198,6 +199,7 @@ static void __init e750_init(void) | |||
198 | eseries_get_tmio_gpios(); | 199 | eseries_get_tmio_gpios(); |
199 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 200 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
200 | pxa_set_udc_info(&e7xx_udc_mach_info); | 201 | pxa_set_udc_info(&e7xx_udc_mach_info); |
202 | pxa_set_ac97_info(NULL); | ||
201 | e7xx_irda_init(); | 203 | e7xx_irda_init(); |
202 | pxa_set_ficp_info(&e7xx_ficp_platform_data); | 204 | pxa_set_ficp_info(&e7xx_ficp_platform_data); |
203 | } | 205 | } |
diff --git a/arch/arm/mach-pxa/e800.c b/arch/arm/mach-pxa/e800.c index 74ab09812a72..9866c7b9e784 100644 --- a/arch/arm/mach-pxa/e800.c +++ b/arch/arm/mach-pxa/e800.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <mach/eseries-gpio.h> | 27 | #include <mach/eseries-gpio.h> |
28 | #include <mach/udc.h> | 28 | #include <mach/udc.h> |
29 | #include <mach/irqs.h> | 29 | #include <mach/irqs.h> |
30 | #include <mach/audio.h> | ||
30 | 31 | ||
31 | #include "generic.h" | 32 | #include "generic.h" |
32 | #include "eseries.h" | 33 | #include "eseries.h" |
@@ -199,6 +200,7 @@ static void __init e800_init(void) | |||
199 | eseries_get_tmio_gpios(); | 200 | eseries_get_tmio_gpios(); |
200 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 201 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
201 | pxa_set_udc_info(&e800_udc_mach_info); | 202 | pxa_set_udc_info(&e800_udc_mach_info); |
203 | pxa_set_ac97_info(NULL); | ||
202 | } | 204 | } |
203 | 205 | ||
204 | MACHINE_START(E800, "Toshiba e800") | 206 | MACHINE_START(E800, "Toshiba e800") |
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c index 920dfb8d36da..67611dadb44e 100644 --- a/arch/arm/mach-pxa/em-x270.c +++ b/arch/arm/mach-pxa/em-x270.c | |||
@@ -25,8 +25,10 @@ | |||
25 | #include <linux/regulator/machine.h> | 25 | #include <linux/regulator/machine.h> |
26 | #include <linux/spi/spi.h> | 26 | #include <linux/spi/spi.h> |
27 | #include <linux/spi/tdo24m.h> | 27 | #include <linux/spi/tdo24m.h> |
28 | #include <linux/spi/libertas_spi.h> | ||
28 | #include <linux/power_supply.h> | 29 | #include <linux/power_supply.h> |
29 | #include <linux/apm-emulation.h> | 30 | #include <linux/apm-emulation.h> |
31 | #include <linux/delay.h> | ||
30 | 32 | ||
31 | #include <media/soc_camera.h> | 33 | #include <media/soc_camera.h> |
32 | 34 | ||
@@ -62,6 +64,8 @@ | |||
62 | #define GPIO93_CAM_RESET (93) | 64 | #define GPIO93_CAM_RESET (93) |
63 | #define GPIO41_ETHIRQ (41) | 65 | #define GPIO41_ETHIRQ (41) |
64 | #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) | 66 | #define EM_X270_ETHIRQ IRQ_GPIO(GPIO41_ETHIRQ) |
67 | #define GPIO115_WLAN_PWEN (115) | ||
68 | #define GPIO19_WLAN_STRAP (19) | ||
65 | 69 | ||
66 | static int mmc_cd; | 70 | static int mmc_cd; |
67 | static int nand_rb; | 71 | static int nand_rb; |
@@ -159,8 +163,8 @@ static unsigned long common_pin_config[] = { | |||
159 | GPIO57_SSP1_TXD, | 163 | GPIO57_SSP1_TXD, |
160 | 164 | ||
161 | /* SSP2 */ | 165 | /* SSP2 */ |
162 | GPIO19_SSP2_SCLK, | 166 | GPIO19_GPIO, /* SSP2 clock is used as GPIO for Libertas pin-strap */ |
163 | GPIO14_SSP2_SFRM, | 167 | GPIO14_GPIO, |
164 | GPIO89_SSP2_TXD, | 168 | GPIO89_SSP2_TXD, |
165 | GPIO88_SSP2_RXD, | 169 | GPIO88_SSP2_RXD, |
166 | 170 | ||
@@ -648,20 +652,86 @@ static struct tdo24m_platform_data em_x270_tdo24m_pdata = { | |||
648 | .model = TDO35S, | 652 | .model = TDO35S, |
649 | }; | 653 | }; |
650 | 654 | ||
655 | static struct pxa2xx_spi_master em_x270_spi_2_info = { | ||
656 | .num_chipselect = 1, | ||
657 | .enable_dma = 1, | ||
658 | }; | ||
659 | |||
660 | static struct pxa2xx_spi_chip em_x270_libertas_chip = { | ||
661 | .rx_threshold = 1, | ||
662 | .tx_threshold = 1, | ||
663 | .timeout = 1000, | ||
664 | }; | ||
665 | |||
666 | static unsigned long em_x270_libertas_pin_config[] = { | ||
667 | /* SSP2 */ | ||
668 | GPIO19_SSP2_SCLK, | ||
669 | GPIO14_GPIO, | ||
670 | GPIO89_SSP2_TXD, | ||
671 | GPIO88_SSP2_RXD, | ||
672 | }; | ||
673 | |||
674 | static int em_x270_libertas_setup(struct spi_device *spi) | ||
675 | { | ||
676 | int err = gpio_request(GPIO115_WLAN_PWEN, "WLAN PWEN"); | ||
677 | if (err) | ||
678 | return err; | ||
679 | |||
680 | gpio_direction_output(GPIO19_WLAN_STRAP, 1); | ||
681 | mdelay(100); | ||
682 | |||
683 | pxa2xx_mfp_config(ARRAY_AND_SIZE(em_x270_libertas_pin_config)); | ||
684 | |||
685 | gpio_direction_output(GPIO115_WLAN_PWEN, 0); | ||
686 | mdelay(100); | ||
687 | gpio_set_value(GPIO115_WLAN_PWEN, 1); | ||
688 | mdelay(100); | ||
689 | |||
690 | spi->bits_per_word = 16; | ||
691 | spi_setup(spi); | ||
692 | |||
693 | return 0; | ||
694 | } | ||
695 | |||
696 | static int em_x270_libertas_teardown(struct spi_device *spi) | ||
697 | { | ||
698 | gpio_set_value(GPIO115_WLAN_PWEN, 0); | ||
699 | gpio_free(GPIO115_WLAN_PWEN); | ||
700 | |||
701 | return 0; | ||
702 | } | ||
703 | |||
704 | struct libertas_spi_platform_data em_x270_libertas_pdata = { | ||
705 | .use_dummy_writes = 1, | ||
706 | .gpio_cs = 14, | ||
707 | .setup = em_x270_libertas_setup, | ||
708 | .teardown = em_x270_libertas_teardown, | ||
709 | }; | ||
710 | |||
651 | static struct spi_board_info em_x270_spi_devices[] __initdata = { | 711 | static struct spi_board_info em_x270_spi_devices[] __initdata = { |
652 | { | 712 | { |
653 | .modalias = "tdo24m", | 713 | .modalias = "tdo24m", |
654 | .max_speed_hz = 1000000, | 714 | .max_speed_hz = 1000000, |
655 | .bus_num = 1, | 715 | .bus_num = 1, |
656 | .chip_select = 0, | 716 | .chip_select = 0, |
657 | .controller_data = &em_x270_tdo24m_chip, | 717 | .controller_data = &em_x270_tdo24m_chip, |
658 | .platform_data = &em_x270_tdo24m_pdata, | 718 | .platform_data = &em_x270_tdo24m_pdata, |
719 | }, | ||
720 | { | ||
721 | .modalias = "libertas_spi", | ||
722 | .max_speed_hz = 13000000, | ||
723 | .bus_num = 2, | ||
724 | .irq = IRQ_GPIO(116), | ||
725 | .chip_select = 0, | ||
726 | .controller_data = &em_x270_libertas_chip, | ||
727 | .platform_data = &em_x270_libertas_pdata, | ||
659 | }, | 728 | }, |
660 | }; | 729 | }; |
661 | 730 | ||
662 | static void __init em_x270_init_spi(void) | 731 | static void __init em_x270_init_spi(void) |
663 | { | 732 | { |
664 | pxa2xx_set_spi_info(1, &em_x270_spi_info); | 733 | pxa2xx_set_spi_info(1, &em_x270_spi_info); |
734 | pxa2xx_set_spi_info(2, &em_x270_spi_2_info); | ||
665 | spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices)); | 735 | spi_register_board_info(ARRAY_AND_SIZE(em_x270_spi_devices)); |
666 | } | 736 | } |
667 | #else | 737 | #else |
diff --git a/arch/arm/mach-pxa/include/mach/colibri.h b/arch/arm/mach-pxa/include/mach/colibri.h index 3f2a01d6a03c..90230c6f9925 100644 --- a/arch/arm/mach-pxa/include/mach/colibri.h +++ b/arch/arm/mach-pxa/include/mach/colibri.h | |||
@@ -1,5 +1,8 @@ | |||
1 | #ifndef _COLIBRI_H_ | 1 | #ifndef _COLIBRI_H_ |
2 | #define _COLIBRI_H_ | 2 | #define _COLIBRI_H_ |
3 | |||
4 | #include <net/ax88796.h> | ||
5 | |||
3 | /* | 6 | /* |
4 | * common settings for all modules | 7 | * common settings for all modules |
5 | */ | 8 | */ |
@@ -16,6 +19,10 @@ extern void colibri_pxa3xx_init_lcd(int bl_pin); | |||
16 | static inline void colibri_pxa3xx_init_lcd(int) {} | 19 | static inline void colibri_pxa3xx_init_lcd(int) {} |
17 | #endif | 20 | #endif |
18 | 21 | ||
22 | #if defined(CONFIG_AX88796) | ||
23 | extern void colibri_pxa3xx_init_eth(struct ax_plat_data *plat_data); | ||
24 | #endif | ||
25 | |||
19 | /* physical memory regions */ | 26 | /* physical memory regions */ |
20 | #define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */ | 27 | #define COLIBRI_SDRAM_BASE 0xa0000000 /* SDRAM region */ |
21 | 28 | ||
diff --git a/arch/arm/mach-pxa/include/mach/magician.h b/arch/arm/mach-pxa/include/mach/magician.h index 82a399f3f9f2..20ef37d4a9a7 100644 --- a/arch/arm/mach-pxa/include/mach/magician.h +++ b/arch/arm/mach-pxa/include/mach/magician.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #define GPIO22_MAGICIAN_VIBRA_EN 22 | 27 | #define GPIO22_MAGICIAN_VIBRA_EN 22 |
28 | #define GPIO26_MAGICIAN_GSM_POWER 26 | 28 | #define GPIO26_MAGICIAN_GSM_POWER 26 |
29 | #define GPIO27_MAGICIAN_USBC_PUEN 27 | 29 | #define GPIO27_MAGICIAN_USBC_PUEN 27 |
30 | #define GPIO30_MAGICIAN_nCHARGE_EN 30 | 30 | #define GPIO30_MAGICIAN_BQ24022_nCHARGE_EN 30 |
31 | #define GPIO37_MAGICIAN_KEY_HANGUP 37 | 31 | #define GPIO37_MAGICIAN_KEY_HANGUP 37 |
32 | #define GPIO38_MAGICIAN_KEY_CONTACTS 38 | 32 | #define GPIO38_MAGICIAN_KEY_CONTACTS 38 |
33 | #define GPIO40_MAGICIAN_GSM_OUT2 40 | 33 | #define GPIO40_MAGICIAN_GSM_OUT2 40 |
@@ -98,7 +98,7 @@ | |||
98 | #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2) | 98 | #define EGPIO_MAGICIAN_UNKNOWN_WAVEDEV_DLL MAGICIAN_EGPIO(2, 2) |
99 | #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) | 99 | #define EGPIO_MAGICIAN_FLASH_VPP MAGICIAN_EGPIO(2, 3) |
100 | #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) | 100 | #define EGPIO_MAGICIAN_BL_POWER2 MAGICIAN_EGPIO(2, 4) |
101 | #define EGPIO_MAGICIAN_CHARGE_EN MAGICIAN_EGPIO(2, 5) | 101 | #define EGPIO_MAGICIAN_BQ24022_ISET2 MAGICIAN_EGPIO(2, 5) |
102 | #define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) | 102 | #define EGPIO_MAGICIAN_GSM_POWER MAGICIAN_EGPIO(2, 7) |
103 | 103 | ||
104 | /* input */ | 104 | /* input */ |
diff --git a/arch/arm/mach-pxa/include/mach/palmld.h b/arch/arm/mach-pxa/include/mach/palmld.h index 7c295a48d784..fb13c82ad6dc 100644 --- a/arch/arm/mach-pxa/include/mach/palmld.h +++ b/arch/arm/mach-pxa/include/mach/palmld.h | |||
@@ -87,6 +87,7 @@ | |||
87 | #define PALMLD_IDE_SIZE 0x00100000 | 87 | #define PALMLD_IDE_SIZE 0x00100000 |
88 | 88 | ||
89 | #define PALMLD_PHYS_IO_START 0x40000000 | 89 | #define PALMLD_PHYS_IO_START 0x40000000 |
90 | #define PALMLD_STR_BASE 0xa0200000 | ||
90 | 91 | ||
91 | /* BATTERY */ | 92 | /* BATTERY */ |
92 | #define PALMLD_BAT_MAX_VOLTAGE 4000 /* 4.00V maximum voltage */ | 93 | #define PALMLD_BAT_MAX_VOLTAGE 4000 /* 4.00V maximum voltage */ |
diff --git a/arch/arm/mach-pxa/include/mach/palmt5.h b/arch/arm/mach-pxa/include/mach/palmt5.h index 94db2881f048..052bfe788ada 100644 --- a/arch/arm/mach-pxa/include/mach/palmt5.h +++ b/arch/arm/mach-pxa/include/mach/palmt5.h | |||
@@ -59,6 +59,7 @@ | |||
59 | /* Various addresses */ | 59 | /* Various addresses */ |
60 | #define PALMT5_PHYS_RAM_START 0xa0000000 | 60 | #define PALMT5_PHYS_RAM_START 0xa0000000 |
61 | #define PALMT5_PHYS_IO_START 0x40000000 | 61 | #define PALMT5_PHYS_IO_START 0x40000000 |
62 | #define PALMT5_STR_BASE 0xa0200000 | ||
62 | 63 | ||
63 | /* TOUCHSCREEN */ | 64 | /* TOUCHSCREEN */ |
64 | #define AC97_LINK_FRAME 21 | 65 | #define AC97_LINK_FRAME 21 |
diff --git a/arch/arm/mach-pxa/include/mach/palmte2.h b/arch/arm/mach-pxa/include/mach/palmte2.h new file mode 100644 index 000000000000..12361341f9d8 --- /dev/null +++ b/arch/arm/mach-pxa/include/mach/palmte2.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * GPIOs and interrupts for Palm Tungsten|E2 Handheld Computer | ||
3 | * | ||
4 | * Author: | ||
5 | * Carlos Eduardo Medaglia Dyonisio <cadu@nerdfeliz.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #ifndef _INCLUDE_PALMTE2_H_ | ||
14 | #define _INCLUDE_PALMTE2_H_ | ||
15 | |||
16 | /** HERE ARE GPIOs **/ | ||
17 | |||
18 | /* GPIOs */ | ||
19 | #define GPIO_NR_PALMTE2_POWER_DETECT 9 | ||
20 | #define GPIO_NR_PALMTE2_HOTSYNC_BUTTON_N 4 | ||
21 | #define GPIO_NR_PALMTE2_EARPHONE_DETECT 15 | ||
22 | |||
23 | /* SD/MMC */ | ||
24 | #define GPIO_NR_PALMTE2_SD_DETECT_N 10 | ||
25 | #define GPIO_NR_PALMTE2_SD_POWER 55 | ||
26 | #define GPIO_NR_PALMTE2_SD_READONLY 51 | ||
27 | |||
28 | /* IRDA - disable GPIO connected to SD pin of tranceiver (TFBS4710?) ? */ | ||
29 | #define GPIO_NR_PALMTE2_IR_DISABLE 48 | ||
30 | |||
31 | /* USB */ | ||
32 | #define GPIO_NR_PALMTE2_USB_DETECT_N 35 | ||
33 | #define GPIO_NR_PALMTE2_USB_PULLUP 53 | ||
34 | |||
35 | /* LCD/BACKLIGHT */ | ||
36 | #define GPIO_NR_PALMTE2_BL_POWER 56 | ||
37 | #define GPIO_NR_PALMTE2_LCD_POWER 37 | ||
38 | |||
39 | /* KEYS */ | ||
40 | #define GPIO_NR_PALMTE2_KEY_NOTES 5 | ||
41 | #define GPIO_NR_PALMTE2_KEY_TASKS 7 | ||
42 | #define GPIO_NR_PALMTE2_KEY_CALENDAR 11 | ||
43 | #define GPIO_NR_PALMTE2_KEY_CONTACTS 13 | ||
44 | #define GPIO_NR_PALMTE2_KEY_CENTER 14 | ||
45 | #define GPIO_NR_PALMTE2_KEY_LEFT 19 | ||
46 | #define GPIO_NR_PALMTE2_KEY_RIGHT 20 | ||
47 | #define GPIO_NR_PALMTE2_KEY_DOWN 21 | ||
48 | #define GPIO_NR_PALMTE2_KEY_UP 22 | ||
49 | |||
50 | /** HERE ARE INIT VALUES **/ | ||
51 | |||
52 | /* BACKLIGHT */ | ||
53 | #define PALMTE2_MAX_INTENSITY 0xFE | ||
54 | #define PALMTE2_DEFAULT_INTENSITY 0x7E | ||
55 | #define PALMTE2_LIMIT_MASK 0x7F | ||
56 | #define PALMTE2_PRESCALER 0x3F | ||
57 | #define PALMTE2_PERIOD_NS 3500 | ||
58 | |||
59 | /* BATTERY */ | ||
60 | #define PALMTE2_BAT_MAX_VOLTAGE 4000 /* 4.00v current voltage */ | ||
61 | #define PALMTE2_BAT_MIN_VOLTAGE 3550 /* 3.55v critical voltage */ | ||
62 | #define PALMTE2_BAT_MAX_CURRENT 0 /* unknokn */ | ||
63 | #define PALMTE2_BAT_MIN_CURRENT 0 /* unknown */ | ||
64 | #define PALMTE2_BAT_MAX_CHARGE 1 /* unknown */ | ||
65 | #define PALMTE2_BAT_MIN_CHARGE 1 /* unknown */ | ||
66 | #define PALMTE2_MAX_LIFE_MINS 360 /* on-life in minutes */ | ||
67 | |||
68 | #endif | ||
diff --git a/arch/arm/mach-pxa/include/mach/palmtx.h b/arch/arm/mach-pxa/include/mach/palmtx.h index 1e8bccbda510..9f7d62fb4cbb 100644 --- a/arch/arm/mach-pxa/include/mach/palmtx.h +++ b/arch/arm/mach-pxa/include/mach/palmtx.h | |||
@@ -78,6 +78,8 @@ | |||
78 | #define PALMTX_PHYS_RAM_START 0xa0000000 | 78 | #define PALMTX_PHYS_RAM_START 0xa0000000 |
79 | #define PALMTX_PHYS_IO_START 0x40000000 | 79 | #define PALMTX_PHYS_IO_START 0x40000000 |
80 | 80 | ||
81 | #define PALMTX_STR_BASE 0xa0200000 | ||
82 | |||
81 | #define PALMTX_PHYS_FLASH_START PXA_CS0_PHYS /* ChipSelect 0 */ | 83 | #define PALMTX_PHYS_FLASH_START PXA_CS0_PHYS /* ChipSelect 0 */ |
82 | #define PALMTX_PHYS_NAND_START PXA_CS1_PHYS /* ChipSelect 1 */ | 84 | #define PALMTX_PHYS_NAND_START PXA_CS1_PHYS /* ChipSelect 1 */ |
83 | 85 | ||
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index deeea1c2782b..c899bbd94dc0 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/mtd/physmap.h> | 25 | #include <linux/mtd/physmap.h> |
26 | #include <linux/pda_power.h> | 26 | #include <linux/pda_power.h> |
27 | #include <linux/pwm_backlight.h> | 27 | #include <linux/pwm_backlight.h> |
28 | #include <linux/regulator/bq24022.h> | ||
29 | #include <linux/regulator/machine.h> | ||
28 | #include <linux/usb/gpio_vbus.h> | 30 | #include <linux/usb/gpio_vbus.h> |
29 | 31 | ||
30 | #include <mach/hardware.h> | 32 | #include <mach/hardware.h> |
@@ -552,33 +554,7 @@ static struct platform_device gpio_vbus = { | |||
552 | 554 | ||
553 | static int power_supply_init(struct device *dev) | 555 | static int power_supply_init(struct device *dev) |
554 | { | 556 | { |
555 | int ret; | 557 | return gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); |
556 | |||
557 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_AC, "CABLE_STATE_AC"); | ||
558 | if (ret) | ||
559 | goto err_cs_ac; | ||
560 | ret = gpio_request(EGPIO_MAGICIAN_CABLE_STATE_USB, "CABLE_STATE_USB"); | ||
561 | if (ret) | ||
562 | goto err_cs_usb; | ||
563 | ret = gpio_request(EGPIO_MAGICIAN_CHARGE_EN, "CHARGE_EN"); | ||
564 | if (ret) | ||
565 | goto err_chg_en; | ||
566 | ret = gpio_request(GPIO30_MAGICIAN_nCHARGE_EN, "nCHARGE_EN"); | ||
567 | if (!ret) | ||
568 | ret = gpio_direction_output(GPIO30_MAGICIAN_nCHARGE_EN, 0); | ||
569 | if (ret) | ||
570 | goto err_nchg_en; | ||
571 | |||
572 | return 0; | ||
573 | |||
574 | err_nchg_en: | ||
575 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); | ||
576 | err_chg_en: | ||
577 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
578 | err_cs_usb: | ||
579 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); | ||
580 | err_cs_ac: | ||
581 | return ret; | ||
582 | } | 558 | } |
583 | 559 | ||
584 | static int magician_is_ac_online(void) | 560 | static int magician_is_ac_online(void) |
@@ -586,22 +562,8 @@ static int magician_is_ac_online(void) | |||
586 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); | 562 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_AC); |
587 | } | 563 | } |
588 | 564 | ||
589 | static int magician_is_usb_online(void) | ||
590 | { | ||
591 | return gpio_get_value(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
592 | } | ||
593 | |||
594 | static void magician_set_charge(int flags) | ||
595 | { | ||
596 | gpio_set_value(GPIO30_MAGICIAN_nCHARGE_EN, !flags); | ||
597 | gpio_set_value(EGPIO_MAGICIAN_CHARGE_EN, flags); | ||
598 | } | ||
599 | |||
600 | static void power_supply_exit(struct device *dev) | 565 | static void power_supply_exit(struct device *dev) |
601 | { | 566 | { |
602 | gpio_free(GPIO30_MAGICIAN_nCHARGE_EN); | ||
603 | gpio_free(EGPIO_MAGICIAN_CHARGE_EN); | ||
604 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_USB); | ||
605 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); | 567 | gpio_free(EGPIO_MAGICIAN_CABLE_STATE_AC); |
606 | } | 568 | } |
607 | 569 | ||
@@ -612,8 +574,6 @@ static char *magician_supplicants[] = { | |||
612 | static struct pda_power_pdata power_supply_info = { | 574 | static struct pda_power_pdata power_supply_info = { |
613 | .init = power_supply_init, | 575 | .init = power_supply_init, |
614 | .is_ac_online = magician_is_ac_online, | 576 | .is_ac_online = magician_is_ac_online, |
615 | .is_usb_online = magician_is_usb_online, | ||
616 | .set_charge = magician_set_charge, | ||
617 | .exit = power_supply_exit, | 577 | .exit = power_supply_exit, |
618 | .supplied_to = magician_supplicants, | 578 | .supplied_to = magician_supplicants, |
619 | .num_supplicants = ARRAY_SIZE(magician_supplicants), | 579 | .num_supplicants = ARRAY_SIZE(magician_supplicants), |
@@ -646,6 +606,43 @@ static struct platform_device power_supply = { | |||
646 | .num_resources = ARRAY_SIZE(power_supply_resources), | 606 | .num_resources = ARRAY_SIZE(power_supply_resources), |
647 | }; | 607 | }; |
648 | 608 | ||
609 | /* | ||
610 | * Battery charger | ||
611 | */ | ||
612 | |||
613 | static struct regulator_consumer_supply bq24022_consumers[] = { | ||
614 | { | ||
615 | .dev = &gpio_vbus.dev, | ||
616 | .supply = "vbus_draw", | ||
617 | }, | ||
618 | { | ||
619 | .dev = &power_supply.dev, | ||
620 | .supply = "ac_draw", | ||
621 | }, | ||
622 | }; | ||
623 | |||
624 | static struct regulator_init_data bq24022_init_data = { | ||
625 | .constraints = { | ||
626 | .max_uA = 500000, | ||
627 | .valid_ops_mask = REGULATOR_CHANGE_CURRENT, | ||
628 | }, | ||
629 | .num_consumer_supplies = ARRAY_SIZE(bq24022_consumers), | ||
630 | .consumer_supplies = bq24022_consumers, | ||
631 | }; | ||
632 | |||
633 | static struct bq24022_mach_info bq24022_info = { | ||
634 | .gpio_nce = GPIO30_MAGICIAN_BQ24022_nCHARGE_EN, | ||
635 | .gpio_iset2 = EGPIO_MAGICIAN_BQ24022_ISET2, | ||
636 | .init_data = &bq24022_init_data, | ||
637 | }; | ||
638 | |||
639 | static struct platform_device bq24022 = { | ||
640 | .name = "bq24022", | ||
641 | .id = -1, | ||
642 | .dev = { | ||
643 | .platform_data = &bq24022_info, | ||
644 | }, | ||
645 | }; | ||
649 | 646 | ||
650 | /* | 647 | /* |
651 | * MMC/SD | 648 | * MMC/SD |
@@ -756,6 +753,7 @@ static struct platform_device *devices[] __initdata = { | |||
756 | &egpio, | 753 | &egpio, |
757 | &backlight, | 754 | &backlight, |
758 | &pasic3, | 755 | &pasic3, |
756 | &bq24022, | ||
759 | &gpio_vbus, | 757 | &gpio_vbus, |
760 | &power_supply, | 758 | &power_supply, |
761 | &strataflash, | 759 | &strataflash, |
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c index 97c93a7a285c..9203b069b35c 100644 --- a/arch/arm/mach-pxa/mioa701.c +++ b/arch/arm/mach-pxa/mioa701.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <mach/pxa27x-udc.h> | 50 | #include <mach/pxa27x-udc.h> |
51 | #include <mach/i2c.h> | 51 | #include <mach/i2c.h> |
52 | #include <mach/camera.h> | 52 | #include <mach/camera.h> |
53 | #include <mach/audio.h> | ||
53 | #include <media/soc_camera.h> | 54 | #include <media/soc_camera.h> |
54 | 55 | ||
55 | #include <mach/mioa701.h> | 56 | #include <mach/mioa701.h> |
@@ -763,8 +764,6 @@ MIO_PARENT_DEV(mioa701_backlight, "pwm-backlight", &pxa27x_device_pwm0.dev, | |||
763 | &mioa701_backlight_data); | 764 | &mioa701_backlight_data); |
764 | MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info) | 765 | MIO_SIMPLE_DEV(mioa701_led, "leds-gpio", &gpio_led_info) |
765 | MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) | 766 | MIO_SIMPLE_DEV(pxa2xx_pcm, "pxa2xx-pcm", NULL) |
766 | MIO_SIMPLE_DEV(pxa2xx_ac97, "pxa2xx-ac97", NULL) | ||
767 | MIO_PARENT_DEV(mio_wm9713_codec, "wm9713-codec", &pxa2xx_ac97.dev, NULL) | ||
768 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) | 767 | MIO_SIMPLE_DEV(mioa701_sound, "mioa701-wm9713", NULL) |
769 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) | 768 | MIO_SIMPLE_DEV(mioa701_board, "mioa701-board", NULL) |
770 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); | 769 | MIO_SIMPLE_DEV(gpio_vbus, "gpio-vbus", &gpio_vbus_data); |
@@ -774,8 +773,6 @@ static struct platform_device *devices[] __initdata = { | |||
774 | &mioa701_backlight, | 773 | &mioa701_backlight, |
775 | &mioa701_led, | 774 | &mioa701_led, |
776 | &pxa2xx_pcm, | 775 | &pxa2xx_pcm, |
777 | &pxa2xx_ac97, | ||
778 | &mio_wm9713_codec, | ||
779 | &mioa701_sound, | 776 | &mioa701_sound, |
780 | &power_dev, | 777 | &power_dev, |
781 | &strataflash, | 778 | &strataflash, |
@@ -818,6 +815,7 @@ static void __init mioa701_machine_init(void) | |||
818 | pxa_set_keypad_info(&mioa701_keypad_info); | 815 | pxa_set_keypad_info(&mioa701_keypad_info); |
819 | wm97xx_bat_set_pdata(&mioa701_battery_data); | 816 | wm97xx_bat_set_pdata(&mioa701_battery_data); |
820 | pxa_set_udc_info(&mioa701_udc_info); | 817 | pxa_set_udc_info(&mioa701_udc_info); |
818 | pxa_set_ac97_info(NULL); | ||
821 | pm_power_off = mioa701_poweroff; | 819 | pm_power_off = mioa701_poweroff; |
822 | arm_pm_restart = mioa701_restart; | 820 | arm_pm_restart = mioa701_restart; |
823 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 821 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 8587477a9bb7..ecf5910e39d7 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/wm97xx_batt.h> | 25 | #include <linux/wm97xx_batt.h> |
26 | #include <linux/power_supply.h> | 26 | #include <linux/power_supply.h> |
27 | #include <linux/sysdev.h> | ||
27 | 28 | ||
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
29 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
@@ -68,10 +69,10 @@ static unsigned long palmld_pin_config[] __initdata = { | |||
68 | GPIO47_FICP_TXD, | 69 | GPIO47_FICP_TXD, |
69 | 70 | ||
70 | /* MATRIX KEYPAD */ | 71 | /* MATRIX KEYPAD */ |
71 | GPIO100_KP_MKIN_0, | 72 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
72 | GPIO101_KP_MKIN_1, | 73 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
73 | GPIO102_KP_MKIN_2, | 74 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
74 | GPIO97_KP_MKIN_3, | 75 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
75 | GPIO103_KP_MKOUT_0, | 76 | GPIO103_KP_MKOUT_0, |
76 | GPIO104_KP_MKOUT_1, | 77 | GPIO104_KP_MKOUT_1, |
77 | GPIO105_KP_MKOUT_2, | 78 | GPIO105_KP_MKOUT_2, |
@@ -507,6 +508,33 @@ static struct pxafb_mach_info palmld_lcd_screen = { | |||
507 | }; | 508 | }; |
508 | 509 | ||
509 | /****************************************************************************** | 510 | /****************************************************************************** |
511 | * Power management - standby | ||
512 | ******************************************************************************/ | ||
513 | #ifdef CONFIG_PM | ||
514 | static u32 *addr __initdata; | ||
515 | static u32 resume[3] __initdata = { | ||
516 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
517 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
518 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
519 | }; | ||
520 | |||
521 | static int __init palmld_pm_init(void) | ||
522 | { | ||
523 | int i; | ||
524 | |||
525 | /* this is where the bootloader jumps */ | ||
526 | addr = phys_to_virt(PALMLD_STR_BASE); | ||
527 | |||
528 | for (i = 0; i < 3; i++) | ||
529 | addr[i] = resume[i]; | ||
530 | |||
531 | return 0; | ||
532 | } | ||
533 | |||
534 | device_initcall(palmld_pm_init); | ||
535 | #endif | ||
536 | |||
537 | /****************************************************************************** | ||
510 | * Machine init | 538 | * Machine init |
511 | ******************************************************************************/ | 539 | ******************************************************************************/ |
512 | static struct platform_device *devices[] __initdata = { | 540 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 9521c7b33492..0680f1a575a3 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c | |||
@@ -75,10 +75,10 @@ static unsigned long palmt5_pin_config[] __initdata = { | |||
75 | GPIO95_GPIO, /* usb power */ | 75 | GPIO95_GPIO, /* usb power */ |
76 | 76 | ||
77 | /* MATRIX KEYPAD */ | 77 | /* MATRIX KEYPAD */ |
78 | GPIO100_KP_MKIN_0, | 78 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
79 | GPIO101_KP_MKIN_1, | 79 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
80 | GPIO102_KP_MKIN_2, | 80 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
81 | GPIO97_KP_MKIN_3, | 81 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
82 | GPIO103_KP_MKOUT_0, | 82 | GPIO103_KP_MKOUT_0, |
83 | GPIO104_KP_MKOUT_1, | 83 | GPIO104_KP_MKOUT_1, |
84 | GPIO105_KP_MKOUT_2, | 84 | GPIO105_KP_MKOUT_2, |
@@ -450,6 +450,33 @@ static struct pxafb_mach_info palmt5_lcd_screen = { | |||
450 | }; | 450 | }; |
451 | 451 | ||
452 | /****************************************************************************** | 452 | /****************************************************************************** |
453 | * Power management - standby | ||
454 | ******************************************************************************/ | ||
455 | #ifdef CONFIG_PM | ||
456 | static u32 *addr __initdata; | ||
457 | static u32 resume[3] __initdata = { | ||
458 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
459 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
460 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
461 | }; | ||
462 | |||
463 | static int __init palmt5_pm_init(void) | ||
464 | { | ||
465 | int i; | ||
466 | |||
467 | /* this is where the bootloader jumps */ | ||
468 | addr = phys_to_virt(PALMT5_STR_BASE); | ||
469 | |||
470 | for (i = 0; i < 3; i++) | ||
471 | addr[i] = resume[i]; | ||
472 | |||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | device_initcall(palmt5_pm_init); | ||
477 | #endif | ||
478 | |||
479 | /****************************************************************************** | ||
453 | * Machine init | 480 | * Machine init |
454 | ******************************************************************************/ | 481 | ******************************************************************************/ |
455 | static struct platform_device *devices[] __initdata = { | 482 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm/mach-pxa/palmte2.c b/arch/arm/mach-pxa/palmte2.c new file mode 100644 index 000000000000..43fcf2e86887 --- /dev/null +++ b/arch/arm/mach-pxa/palmte2.c | |||
@@ -0,0 +1,466 @@ | |||
1 | /* | ||
2 | * Hardware definitions for Palm Tungsten|E2 | ||
3 | * | ||
4 | * Author: | ||
5 | * Carlos Eduardo Medaglia Dyonisio <cadu@nerdfeliz.com> | ||
6 | * | ||
7 | * Rewrite for mainline: | ||
8 | * 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 | * (find more info at www.hackndev.com) | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/gpio_keys.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/pda_power.h> | ||
24 | #include <linux/pwm_backlight.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/wm97xx_batt.h> | ||
27 | #include <linux/power_supply.h> | ||
28 | |||
29 | #include <asm/mach-types.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | |||
33 | #include <mach/audio.h> | ||
34 | #include <mach/palmte2.h> | ||
35 | #include <mach/mmc.h> | ||
36 | #include <mach/pxafb.h> | ||
37 | #include <mach/mfp-pxa25x.h> | ||
38 | #include <mach/irda.h> | ||
39 | #include <mach/udc.h> | ||
40 | |||
41 | #include "generic.h" | ||
42 | #include "devices.h" | ||
43 | |||
44 | /****************************************************************************** | ||
45 | * Pin configuration | ||
46 | ******************************************************************************/ | ||
47 | static unsigned long palmte2_pin_config[] __initdata = { | ||
48 | /* MMC */ | ||
49 | GPIO6_MMC_CLK, | ||
50 | GPIO8_MMC_CS0, | ||
51 | GPIO10_GPIO, /* SD detect */ | ||
52 | GPIO55_GPIO, /* SD power */ | ||
53 | GPIO51_GPIO, /* SD r/o switch */ | ||
54 | |||
55 | /* AC97 */ | ||
56 | GPIO28_AC97_BITCLK, | ||
57 | GPIO29_AC97_SDATA_IN_0, | ||
58 | GPIO30_AC97_SDATA_OUT, | ||
59 | GPIO31_AC97_SYNC, | ||
60 | |||
61 | /* PWM */ | ||
62 | GPIO16_PWM0_OUT, | ||
63 | |||
64 | /* USB */ | ||
65 | GPIO15_GPIO, /* usb detect */ | ||
66 | GPIO53_GPIO, /* usb power */ | ||
67 | |||
68 | /* IrDA */ | ||
69 | GPIO48_GPIO, /* ir disable */ | ||
70 | GPIO46_FICP_RXD, | ||
71 | GPIO47_FICP_TXD, | ||
72 | |||
73 | /* LCD */ | ||
74 | GPIO58_LCD_LDD_0, | ||
75 | GPIO59_LCD_LDD_1, | ||
76 | GPIO60_LCD_LDD_2, | ||
77 | GPIO61_LCD_LDD_3, | ||
78 | GPIO62_LCD_LDD_4, | ||
79 | GPIO63_LCD_LDD_5, | ||
80 | GPIO64_LCD_LDD_6, | ||
81 | GPIO65_LCD_LDD_7, | ||
82 | GPIO66_LCD_LDD_8, | ||
83 | GPIO67_LCD_LDD_9, | ||
84 | GPIO68_LCD_LDD_10, | ||
85 | GPIO69_LCD_LDD_11, | ||
86 | GPIO70_LCD_LDD_12, | ||
87 | GPIO71_LCD_LDD_13, | ||
88 | GPIO72_LCD_LDD_14, | ||
89 | GPIO73_LCD_LDD_15, | ||
90 | GPIO74_LCD_FCLK, | ||
91 | GPIO75_LCD_LCLK, | ||
92 | GPIO76_LCD_PCLK, | ||
93 | GPIO77_LCD_BIAS, | ||
94 | |||
95 | /* GPIO KEYS */ | ||
96 | GPIO5_GPIO, /* notes */ | ||
97 | GPIO7_GPIO, /* tasks */ | ||
98 | GPIO11_GPIO, /* calendar */ | ||
99 | GPIO13_GPIO, /* contacts */ | ||
100 | GPIO14_GPIO, /* center */ | ||
101 | GPIO19_GPIO, /* left */ | ||
102 | GPIO20_GPIO, /* right */ | ||
103 | GPIO21_GPIO, /* down */ | ||
104 | GPIO22_GPIO, /* up */ | ||
105 | |||
106 | /* MISC */ | ||
107 | GPIO1_RST, /* reset */ | ||
108 | GPIO4_GPIO, /* Hotsync button */ | ||
109 | GPIO9_GPIO, /* power detect */ | ||
110 | GPIO37_GPIO, /* LCD power */ | ||
111 | GPIO56_GPIO, /* Backlight power */ | ||
112 | }; | ||
113 | |||
114 | /****************************************************************************** | ||
115 | * SD/MMC card controller | ||
116 | ******************************************************************************/ | ||
117 | static int palmte2_mci_init(struct device *dev, | ||
118 | irq_handler_t palmte2_detect_int, void *data) | ||
119 | { | ||
120 | int err = 0; | ||
121 | |||
122 | /* Setup an interrupt for detecting card insert/remove events */ | ||
123 | err = gpio_request(GPIO_NR_PALMTE2_SD_DETECT_N, "SD IRQ"); | ||
124 | if (err) | ||
125 | goto err; | ||
126 | err = gpio_direction_input(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
127 | if (err) | ||
128 | goto err2; | ||
129 | err = request_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), | ||
130 | palmte2_detect_int, IRQF_DISABLED | IRQF_SAMPLE_RANDOM | | ||
131 | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, | ||
132 | "SD/MMC card detect", data); | ||
133 | if (err) { | ||
134 | printk(KERN_ERR "%s: cannot request SD/MMC card detect IRQ\n", | ||
135 | __func__); | ||
136 | goto err2; | ||
137 | } | ||
138 | |||
139 | err = gpio_request(GPIO_NR_PALMTE2_SD_POWER, "SD_POWER"); | ||
140 | if (err) | ||
141 | goto err3; | ||
142 | err = gpio_direction_output(GPIO_NR_PALMTE2_SD_POWER, 0); | ||
143 | if (err) | ||
144 | goto err4; | ||
145 | |||
146 | err = gpio_request(GPIO_NR_PALMTE2_SD_READONLY, "SD_READONLY"); | ||
147 | if (err) | ||
148 | goto err4; | ||
149 | err = gpio_direction_input(GPIO_NR_PALMTE2_SD_READONLY); | ||
150 | if (err) | ||
151 | goto err5; | ||
152 | |||
153 | printk(KERN_DEBUG "%s: irq registered\n", __func__); | ||
154 | |||
155 | return 0; | ||
156 | |||
157 | err5: | ||
158 | gpio_free(GPIO_NR_PALMTE2_SD_READONLY); | ||
159 | err4: | ||
160 | gpio_free(GPIO_NR_PALMTE2_SD_POWER); | ||
161 | err3: | ||
162 | free_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), data); | ||
163 | err2: | ||
164 | gpio_free(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
165 | err: | ||
166 | return err; | ||
167 | } | ||
168 | |||
169 | static void palmte2_mci_exit(struct device *dev, void *data) | ||
170 | { | ||
171 | gpio_free(GPIO_NR_PALMTE2_SD_READONLY); | ||
172 | gpio_free(GPIO_NR_PALMTE2_SD_POWER); | ||
173 | free_irq(gpio_to_irq(GPIO_NR_PALMTE2_SD_DETECT_N), data); | ||
174 | gpio_free(GPIO_NR_PALMTE2_SD_DETECT_N); | ||
175 | } | ||
176 | |||
177 | static void palmte2_mci_power(struct device *dev, unsigned int vdd) | ||
178 | { | ||
179 | struct pxamci_platform_data *p_d = dev->platform_data; | ||
180 | gpio_set_value(GPIO_NR_PALMTE2_SD_POWER, p_d->ocr_mask & (1 << vdd)); | ||
181 | } | ||
182 | |||
183 | static int palmte2_mci_get_ro(struct device *dev) | ||
184 | { | ||
185 | return gpio_get_value(GPIO_NR_PALMTE2_SD_READONLY); | ||
186 | } | ||
187 | |||
188 | static struct pxamci_platform_data palmte2_mci_platform_data = { | ||
189 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
190 | .setpower = palmte2_mci_power, | ||
191 | .get_ro = palmte2_mci_get_ro, | ||
192 | .init = palmte2_mci_init, | ||
193 | .exit = palmte2_mci_exit, | ||
194 | }; | ||
195 | |||
196 | /****************************************************************************** | ||
197 | * GPIO keys | ||
198 | ******************************************************************************/ | ||
199 | static struct gpio_keys_button palmte2_pxa_buttons[] = { | ||
200 | {KEY_F1, GPIO_NR_PALMTE2_KEY_CONTACTS, 1, "Contacts" }, | ||
201 | {KEY_F2, GPIO_NR_PALMTE2_KEY_CALENDAR, 1, "Calendar" }, | ||
202 | {KEY_F3, GPIO_NR_PALMTE2_KEY_TASKS, 1, "Tasks" }, | ||
203 | {KEY_F4, GPIO_NR_PALMTE2_KEY_NOTES, 1, "Notes" }, | ||
204 | {KEY_ENTER, GPIO_NR_PALMTE2_KEY_CENTER, 1, "Center" }, | ||
205 | {KEY_LEFT, GPIO_NR_PALMTE2_KEY_LEFT, 1, "Left" }, | ||
206 | {KEY_RIGHT, GPIO_NR_PALMTE2_KEY_RIGHT, 1, "Right" }, | ||
207 | {KEY_DOWN, GPIO_NR_PALMTE2_KEY_DOWN, 1, "Down" }, | ||
208 | {KEY_UP, GPIO_NR_PALMTE2_KEY_UP, 1, "Up" }, | ||
209 | }; | ||
210 | |||
211 | static struct gpio_keys_platform_data palmte2_pxa_keys_data = { | ||
212 | .buttons = palmte2_pxa_buttons, | ||
213 | .nbuttons = ARRAY_SIZE(palmte2_pxa_buttons), | ||
214 | }; | ||
215 | |||
216 | static struct platform_device palmte2_pxa_keys = { | ||
217 | .name = "gpio-keys", | ||
218 | .id = -1, | ||
219 | .dev = { | ||
220 | .platform_data = &palmte2_pxa_keys_data, | ||
221 | }, | ||
222 | }; | ||
223 | |||
224 | /****************************************************************************** | ||
225 | * Backlight | ||
226 | ******************************************************************************/ | ||
227 | static int palmte2_backlight_init(struct device *dev) | ||
228 | { | ||
229 | int ret; | ||
230 | |||
231 | ret = gpio_request(GPIO_NR_PALMTE2_BL_POWER, "BL POWER"); | ||
232 | if (ret) | ||
233 | goto err; | ||
234 | ret = gpio_direction_output(GPIO_NR_PALMTE2_BL_POWER, 0); | ||
235 | if (ret) | ||
236 | goto err2; | ||
237 | ret = gpio_request(GPIO_NR_PALMTE2_LCD_POWER, "LCD POWER"); | ||
238 | if (ret) | ||
239 | goto err2; | ||
240 | ret = gpio_direction_output(GPIO_NR_PALMTE2_LCD_POWER, 0); | ||
241 | if (ret) | ||
242 | goto err3; | ||
243 | |||
244 | return 0; | ||
245 | err3: | ||
246 | gpio_free(GPIO_NR_PALMTE2_LCD_POWER); | ||
247 | err2: | ||
248 | gpio_free(GPIO_NR_PALMTE2_BL_POWER); | ||
249 | err: | ||
250 | return ret; | ||
251 | } | ||
252 | |||
253 | static int palmte2_backlight_notify(int brightness) | ||
254 | { | ||
255 | gpio_set_value(GPIO_NR_PALMTE2_BL_POWER, brightness); | ||
256 | gpio_set_value(GPIO_NR_PALMTE2_LCD_POWER, brightness); | ||
257 | return brightness; | ||
258 | } | ||
259 | |||
260 | static void palmte2_backlight_exit(struct device *dev) | ||
261 | { | ||
262 | gpio_free(GPIO_NR_PALMTE2_BL_POWER); | ||
263 | gpio_free(GPIO_NR_PALMTE2_LCD_POWER); | ||
264 | } | ||
265 | |||
266 | static struct platform_pwm_backlight_data palmte2_backlight_data = { | ||
267 | .pwm_id = 0, | ||
268 | .max_brightness = PALMTE2_MAX_INTENSITY, | ||
269 | .dft_brightness = PALMTE2_MAX_INTENSITY, | ||
270 | .pwm_period_ns = PALMTE2_PERIOD_NS, | ||
271 | .init = palmte2_backlight_init, | ||
272 | .notify = palmte2_backlight_notify, | ||
273 | .exit = palmte2_backlight_exit, | ||
274 | }; | ||
275 | |||
276 | static struct platform_device palmte2_backlight = { | ||
277 | .name = "pwm-backlight", | ||
278 | .dev = { | ||
279 | .parent = &pxa25x_device_pwm0.dev, | ||
280 | .platform_data = &palmte2_backlight_data, | ||
281 | }, | ||
282 | }; | ||
283 | |||
284 | /****************************************************************************** | ||
285 | * IrDA | ||
286 | ******************************************************************************/ | ||
287 | static int palmte2_irda_startup(struct device *dev) | ||
288 | { | ||
289 | int err; | ||
290 | err = gpio_request(GPIO_NR_PALMTE2_IR_DISABLE, "IR DISABLE"); | ||
291 | if (err) | ||
292 | goto err; | ||
293 | err = gpio_direction_output(GPIO_NR_PALMTE2_IR_DISABLE, 1); | ||
294 | if (err) | ||
295 | gpio_free(GPIO_NR_PALMTE2_IR_DISABLE); | ||
296 | err: | ||
297 | return err; | ||
298 | } | ||
299 | |||
300 | static void palmte2_irda_shutdown(struct device *dev) | ||
301 | { | ||
302 | gpio_free(GPIO_NR_PALMTE2_IR_DISABLE); | ||
303 | } | ||
304 | |||
305 | static void palmte2_irda_transceiver_mode(struct device *dev, int mode) | ||
306 | { | ||
307 | gpio_set_value(GPIO_NR_PALMTE2_IR_DISABLE, mode & IR_OFF); | ||
308 | pxa2xx_transceiver_mode(dev, mode); | ||
309 | } | ||
310 | |||
311 | static struct pxaficp_platform_data palmte2_ficp_platform_data = { | ||
312 | .startup = palmte2_irda_startup, | ||
313 | .shutdown = palmte2_irda_shutdown, | ||
314 | .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, | ||
315 | .transceiver_mode = palmte2_irda_transceiver_mode, | ||
316 | }; | ||
317 | |||
318 | /****************************************************************************** | ||
319 | * UDC | ||
320 | ******************************************************************************/ | ||
321 | static struct pxa2xx_udc_mach_info palmte2_udc_info __initdata = { | ||
322 | .gpio_vbus = GPIO_NR_PALMTE2_USB_DETECT_N, | ||
323 | .gpio_vbus_inverted = 1, | ||
324 | .gpio_pullup = GPIO_NR_PALMTE2_USB_PULLUP, | ||
325 | .gpio_pullup_inverted = 0, | ||
326 | }; | ||
327 | |||
328 | /****************************************************************************** | ||
329 | * Power supply | ||
330 | ******************************************************************************/ | ||
331 | static int power_supply_init(struct device *dev) | ||
332 | { | ||
333 | int ret; | ||
334 | |||
335 | ret = gpio_request(GPIO_NR_PALMTE2_POWER_DETECT, "CABLE_STATE_AC"); | ||
336 | if (ret) | ||
337 | goto err1; | ||
338 | ret = gpio_direction_input(GPIO_NR_PALMTE2_POWER_DETECT); | ||
339 | if (ret) | ||
340 | goto err2; | ||
341 | |||
342 | return 0; | ||
343 | |||
344 | err2: | ||
345 | gpio_free(GPIO_NR_PALMTE2_POWER_DETECT); | ||
346 | err1: | ||
347 | return ret; | ||
348 | } | ||
349 | |||
350 | static int palmte2_is_ac_online(void) | ||
351 | { | ||
352 | return gpio_get_value(GPIO_NR_PALMTE2_POWER_DETECT); | ||
353 | } | ||
354 | |||
355 | static void power_supply_exit(struct device *dev) | ||
356 | { | ||
357 | gpio_free(GPIO_NR_PALMTE2_POWER_DETECT); | ||
358 | } | ||
359 | |||
360 | static char *palmte2_supplicants[] = { | ||
361 | "main-battery", | ||
362 | }; | ||
363 | |||
364 | static struct pda_power_pdata power_supply_info = { | ||
365 | .init = power_supply_init, | ||
366 | .is_ac_online = palmte2_is_ac_online, | ||
367 | .exit = power_supply_exit, | ||
368 | .supplied_to = palmte2_supplicants, | ||
369 | .num_supplicants = ARRAY_SIZE(palmte2_supplicants), | ||
370 | }; | ||
371 | |||
372 | static struct platform_device power_supply = { | ||
373 | .name = "pda-power", | ||
374 | .id = -1, | ||
375 | .dev = { | ||
376 | .platform_data = &power_supply_info, | ||
377 | }, | ||
378 | }; | ||
379 | |||
380 | /****************************************************************************** | ||
381 | * WM97xx battery | ||
382 | ******************************************************************************/ | ||
383 | static struct wm97xx_batt_info wm97xx_batt_pdata = { | ||
384 | .batt_aux = WM97XX_AUX_ID3, | ||
385 | .temp_aux = WM97XX_AUX_ID2, | ||
386 | .charge_gpio = -1, | ||
387 | .max_voltage = PALMTE2_BAT_MAX_VOLTAGE, | ||
388 | .min_voltage = PALMTE2_BAT_MIN_VOLTAGE, | ||
389 | .batt_mult = 1000, | ||
390 | .batt_div = 414, | ||
391 | .temp_mult = 1, | ||
392 | .temp_div = 1, | ||
393 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LIPO, | ||
394 | .batt_name = "main-batt", | ||
395 | }; | ||
396 | |||
397 | /****************************************************************************** | ||
398 | * Framebuffer | ||
399 | ******************************************************************************/ | ||
400 | static struct pxafb_mode_info palmte2_lcd_modes[] = { | ||
401 | { | ||
402 | .pixclock = 77757, | ||
403 | .xres = 320, | ||
404 | .yres = 320, | ||
405 | .bpp = 16, | ||
406 | |||
407 | .left_margin = 28, | ||
408 | .right_margin = 7, | ||
409 | .upper_margin = 7, | ||
410 | .lower_margin = 5, | ||
411 | |||
412 | .hsync_len = 4, | ||
413 | .vsync_len = 1, | ||
414 | }, | ||
415 | }; | ||
416 | |||
417 | static struct pxafb_mach_info palmte2_lcd_screen = { | ||
418 | .modes = palmte2_lcd_modes, | ||
419 | .num_modes = ARRAY_SIZE(palmte2_lcd_modes), | ||
420 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | ||
421 | }; | ||
422 | |||
423 | /****************************************************************************** | ||
424 | * Machine init | ||
425 | ******************************************************************************/ | ||
426 | static struct platform_device *devices[] __initdata = { | ||
427 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
428 | &palmte2_pxa_keys, | ||
429 | #endif | ||
430 | &palmte2_backlight, | ||
431 | &power_supply, | ||
432 | }; | ||
433 | |||
434 | /* setup udc GPIOs initial state */ | ||
435 | static void __init palmte2_udc_init(void) | ||
436 | { | ||
437 | if (!gpio_request(GPIO_NR_PALMTE2_USB_PULLUP, "UDC Vbus")) { | ||
438 | gpio_direction_output(GPIO_NR_PALMTE2_USB_PULLUP, 1); | ||
439 | gpio_free(GPIO_NR_PALMTE2_USB_PULLUP); | ||
440 | } | ||
441 | } | ||
442 | |||
443 | static void __init palmte2_init(void) | ||
444 | { | ||
445 | pxa2xx_mfp_config(ARRAY_AND_SIZE(palmte2_pin_config)); | ||
446 | |||
447 | set_pxa_fb_info(&palmte2_lcd_screen); | ||
448 | pxa_set_mci_info(&palmte2_mci_platform_data); | ||
449 | palmte2_udc_init(); | ||
450 | pxa_set_udc_info(&palmte2_udc_info); | ||
451 | pxa_set_ac97_info(NULL); | ||
452 | pxa_set_ficp_info(&palmte2_ficp_platform_data); | ||
453 | wm97xx_bat_set_pdata(&wm97xx_batt_pdata); | ||
454 | |||
455 | platform_add_devices(devices, ARRAY_SIZE(devices)); | ||
456 | } | ||
457 | |||
458 | MACHINE_START(PALMTE2, "Palm Tungsten|E2") | ||
459 | .phys_io = 0x40000000, | ||
460 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
461 | .boot_params = 0xa0000100, | ||
462 | .map_io = pxa_map_io, | ||
463 | .init_irq = pxa25x_init_irq, | ||
464 | .timer = &pxa_timer, | ||
465 | .init_machine = palmte2_init | ||
466 | MACHINE_END | ||
diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index b490c0924619..59d0c1cba556 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c | |||
@@ -93,10 +93,10 @@ static unsigned long palmtx_pin_config[] __initdata = { | |||
93 | GPIO116_GPIO, /* wifi ready */ | 93 | GPIO116_GPIO, /* wifi ready */ |
94 | 94 | ||
95 | /* MATRIX KEYPAD */ | 95 | /* MATRIX KEYPAD */ |
96 | GPIO100_KP_MKIN_0, | 96 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, |
97 | GPIO101_KP_MKIN_1, | 97 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, |
98 | GPIO102_KP_MKIN_2, | 98 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, |
99 | GPIO97_KP_MKIN_3, | 99 | GPIO97_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, |
100 | GPIO103_KP_MKOUT_0, | 100 | GPIO103_KP_MKOUT_0, |
101 | GPIO104_KP_MKOUT_1, | 101 | GPIO104_KP_MKOUT_1, |
102 | GPIO105_KP_MKOUT_2, | 102 | GPIO105_KP_MKOUT_2, |
@@ -459,6 +459,33 @@ static struct pxafb_mach_info palmtx_lcd_screen = { | |||
459 | }; | 459 | }; |
460 | 460 | ||
461 | /****************************************************************************** | 461 | /****************************************************************************** |
462 | * Power management - standby | ||
463 | ******************************************************************************/ | ||
464 | #ifdef CONFIG_PM | ||
465 | static u32 *addr __initdata; | ||
466 | static u32 resume[3] __initdata = { | ||
467 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
468 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
469 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
470 | }; | ||
471 | |||
472 | static int __init palmtx_pm_init(void) | ||
473 | { | ||
474 | int i; | ||
475 | |||
476 | /* this is where the bootloader jumps */ | ||
477 | addr = phys_to_virt(PALMTX_STR_BASE); | ||
478 | |||
479 | for (i = 0; i < 3; i++) | ||
480 | addr[i] = resume[i]; | ||
481 | |||
482 | return 0; | ||
483 | } | ||
484 | |||
485 | device_initcall(palmtx_pm_init); | ||
486 | #endif | ||
487 | |||
488 | /****************************************************************************** | ||
462 | * Machine init | 489 | * Machine init |
463 | ******************************************************************************/ | 490 | ******************************************************************************/ |
464 | static struct platform_device *devices[] __initdata = { | 491 | static struct platform_device *devices[] __initdata = { |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 6e8ade6ae339..afac5b6d3d78 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <mach/udc.h> | 45 | #include <mach/udc.h> |
46 | #include <mach/tosa_bt.h> | 46 | #include <mach/tosa_bt.h> |
47 | #include <mach/pxa2xx_spi.h> | 47 | #include <mach/pxa2xx_spi.h> |
48 | #include <mach/audio.h> | ||
48 | 49 | ||
49 | #include <asm/mach/arch.h> | 50 | #include <asm/mach/arch.h> |
50 | #include <mach/tosa.h> | 51 | #include <mach/tosa.h> |
@@ -914,6 +915,7 @@ static void __init tosa_init(void) | |||
914 | pxa_set_udc_info(&udc_info); | 915 | pxa_set_udc_info(&udc_info); |
915 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 916 | pxa_set_ficp_info(&tosa_ficp_platform_data); |
916 | pxa_set_i2c_info(NULL); | 917 | pxa_set_i2c_info(NULL); |
918 | pxa_set_ac97_info(NULL); | ||
917 | platform_scoop_config = &tosa_pcmcia_config; | 919 | platform_scoop_config = &tosa_pcmcia_config; |
918 | 920 | ||
919 | pxa2xx_set_spi_info(2, &pxa_ssp_master_info); | 921 | pxa2xx_set_spi_info(2, &pxa_ssp_master_info); |
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index b438fc4fb77b..e6344ece00ce 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c | |||
@@ -828,6 +828,17 @@ void __init reserve_node_zero(pg_data_t *pgdat) | |||
828 | BOOTMEM_DEFAULT); | 828 | BOOTMEM_DEFAULT); |
829 | } | 829 | } |
830 | 830 | ||
831 | if (machine_is_palmld() || machine_is_palmtx()) { | ||
832 | reserve_bootmem_node(pgdat, 0xa0000000, 0x1000, | ||
833 | BOOTMEM_EXCLUSIVE); | ||
834 | reserve_bootmem_node(pgdat, 0xa0200000, 0x1000, | ||
835 | BOOTMEM_EXCLUSIVE); | ||
836 | } | ||
837 | |||
838 | if (machine_is_palmt5()) | ||
839 | reserve_bootmem_node(pgdat, 0xa0200000, 0x1000, | ||
840 | BOOTMEM_EXCLUSIVE); | ||
841 | |||
831 | #ifdef CONFIG_SA1111 | 842 | #ifdef CONFIG_SA1111 |
832 | /* | 843 | /* |
833 | * Because of the SA1111 DMA bug, we want to preserve our | 844 | * Because of the SA1111 DMA bug, we want to preserve our |
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index c232d11a7ed4..06084dbf1277 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c | |||
@@ -208,7 +208,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) | |||
208 | } | 208 | } |
209 | 209 | ||
210 | ext_csd_struct = ext_csd[EXT_CSD_REV]; | 210 | ext_csd_struct = ext_csd[EXT_CSD_REV]; |
211 | if (ext_csd_struct > 2) { | 211 | if (ext_csd_struct > 3) { |
212 | printk(KERN_ERR "%s: unrecognised EXT_CSD structure " | 212 | printk(KERN_ERR "%s: unrecognised EXT_CSD structure " |
213 | "version %d\n", mmc_hostname(card->host), | 213 | "version %d\n", mmc_hostname(card->host), |
214 | ext_csd_struct); | 214 | ext_csd_struct); |
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 26fc098d77cd..cd81c395e164 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c | |||
@@ -363,15 +363,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
363 | goto err; | 363 | goto err; |
364 | 364 | ||
365 | /* | 365 | /* |
366 | * For SPI, enable CRC as appropriate. | ||
367 | */ | ||
368 | if (mmc_host_is_spi(host)) { | ||
369 | err = mmc_spi_set_crc(host, use_spi_crc); | ||
370 | if (err) | ||
371 | goto err; | ||
372 | } | ||
373 | |||
374 | /* | ||
375 | * Fetch CID from card. | 366 | * Fetch CID from card. |
376 | */ | 367 | */ |
377 | if (mmc_host_is_spi(host)) | 368 | if (mmc_host_is_spi(host)) |
@@ -458,6 +449,18 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, | |||
458 | } | 449 | } |
459 | 450 | ||
460 | /* | 451 | /* |
452 | * For SPI, enable CRC as appropriate. | ||
453 | * This CRC enable is located AFTER the reading of the | ||
454 | * card registers because some SDHC cards are not able | ||
455 | * to provide valid CRCs for non-512-byte blocks. | ||
456 | */ | ||
457 | if (mmc_host_is_spi(host)) { | ||
458 | err = mmc_spi_set_crc(host, use_spi_crc); | ||
459 | if (err) | ||
460 | goto free_card; | ||
461 | } | ||
462 | |||
463 | /* | ||
461 | * Attempt to change to high-speed (if supported) | 464 | * Attempt to change to high-speed (if supported) |
462 | */ | 465 | */ |
463 | err = mmc_switch_hs(card); | 466 | err = mmc_switch_hs(card); |
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index eb29b1d933ac..e0be21a4a696 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
@@ -307,13 +307,6 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data) | |||
307 | 307 | ||
308 | wmb(); | 308 | wmb(); |
309 | 309 | ||
310 | if (host->actual_bus_width == MMC_BUS_WIDTH_4) | ||
311 | BLR(host->dma) = 0; /* burst 64 byte read / 64 bytes write */ | ||
312 | else | ||
313 | BLR(host->dma) = 16; /* burst 16 byte read / 16 bytes write */ | ||
314 | |||
315 | RSSR(host->dma) = DMA_REQ_SDHC; | ||
316 | |||
317 | set_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); | 310 | set_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); |
318 | clear_bit(IMXMCI_PEND_CPU_DATA_b, &host->pending_events); | 311 | clear_bit(IMXMCI_PEND_CPU_DATA_b, &host->pending_events); |
319 | 312 | ||
@@ -818,9 +811,11 @@ static void imxmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) | |||
818 | if (ios->bus_width == MMC_BUS_WIDTH_4) { | 811 | if (ios->bus_width == MMC_BUS_WIDTH_4) { |
819 | host->actual_bus_width = MMC_BUS_WIDTH_4; | 812 | host->actual_bus_width = MMC_BUS_WIDTH_4; |
820 | imx_gpio_mode(PB11_PF_SD_DAT3); | 813 | imx_gpio_mode(PB11_PF_SD_DAT3); |
814 | BLR(host->dma) = 0; /* burst 64 byte read/write */ | ||
821 | } else { | 815 | } else { |
822 | host->actual_bus_width = MMC_BUS_WIDTH_1; | 816 | host->actual_bus_width = MMC_BUS_WIDTH_1; |
823 | imx_gpio_mode(GPIO_PORTB | GPIO_IN | GPIO_PUEN | 11); | 817 | imx_gpio_mode(GPIO_PORTB | GPIO_IN | GPIO_PUEN | 11); |
818 | BLR(host->dma) = 16; /* burst 16 byte read/write */ | ||
824 | } | 819 | } |
825 | 820 | ||
826 | if (host->power_mode != ios->power_mode) { | 821 | if (host->power_mode != ios->power_mode) { |
@@ -938,7 +933,7 @@ static void imxmci_check_status(unsigned long data) | |||
938 | mod_timer(&host->timer, jiffies + (HZ>>1)); | 933 | mod_timer(&host->timer, jiffies + (HZ>>1)); |
939 | } | 934 | } |
940 | 935 | ||
941 | static int imxmci_probe(struct platform_device *pdev) | 936 | static int __init imxmci_probe(struct platform_device *pdev) |
942 | { | 937 | { |
943 | struct mmc_host *mmc; | 938 | struct mmc_host *mmc; |
944 | struct imxmci_host *host = NULL; | 939 | struct imxmci_host *host = NULL; |
@@ -1034,6 +1029,7 @@ static int imxmci_probe(struct platform_device *pdev) | |||
1034 | } | 1029 | } |
1035 | host->dma_allocated = 1; | 1030 | host->dma_allocated = 1; |
1036 | imx_dma_setup_handlers(host->dma, imxmci_dma_irq, NULL, host); | 1031 | imx_dma_setup_handlers(host->dma, imxmci_dma_irq, NULL, host); |
1032 | RSSR(host->dma) = DMA_REQ_SDHC; | ||
1037 | 1033 | ||
1038 | tasklet_init(&host->tasklet, imxmci_tasklet_fnc, (unsigned long)host); | 1034 | tasklet_init(&host->tasklet, imxmci_tasklet_fnc, (unsigned long)host); |
1039 | host->status_reg=0; | 1035 | host->status_reg=0; |
@@ -1079,7 +1075,7 @@ out: | |||
1079 | return ret; | 1075 | return ret; |
1080 | } | 1076 | } |
1081 | 1077 | ||
1082 | static int imxmci_remove(struct platform_device *pdev) | 1078 | static int __exit imxmci_remove(struct platform_device *pdev) |
1083 | { | 1079 | { |
1084 | struct mmc_host *mmc = platform_get_drvdata(pdev); | 1080 | struct mmc_host *mmc = platform_get_drvdata(pdev); |
1085 | 1081 | ||
@@ -1145,8 +1141,7 @@ static int imxmci_resume(struct platform_device *dev) | |||
1145 | #endif /* CONFIG_PM */ | 1141 | #endif /* CONFIG_PM */ |
1146 | 1142 | ||
1147 | static struct platform_driver imxmci_driver = { | 1143 | static struct platform_driver imxmci_driver = { |
1148 | .probe = imxmci_probe, | 1144 | .remove = __exit_p(imxmci_remove), |
1149 | .remove = imxmci_remove, | ||
1150 | .suspend = imxmci_suspend, | 1145 | .suspend = imxmci_suspend, |
1151 | .resume = imxmci_resume, | 1146 | .resume = imxmci_resume, |
1152 | .driver = { | 1147 | .driver = { |
@@ -1157,7 +1152,7 @@ static struct platform_driver imxmci_driver = { | |||
1157 | 1152 | ||
1158 | static int __init imxmci_init(void) | 1153 | static int __init imxmci_init(void) |
1159 | { | 1154 | { |
1160 | return platform_driver_register(&imxmci_driver); | 1155 | return platform_driver_probe(&imxmci_driver, imxmci_probe); |
1161 | } | 1156 | } |
1162 | 1157 | ||
1163 | static void __exit imxmci_exit(void) | 1158 | static void __exit imxmci_exit(void) |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 72f8bde4877a..f48349d18c92 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * along with this program; if not, write to the Free Software | 24 | * along with this program; if not, write to the Free Software |
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | #include <linux/hrtimer.h> | 27 | #include <linux/sched.h> |
28 | #include <linux/delay.h> | 28 | #include <linux/delay.h> |
29 | #include <linux/bio.h> | 29 | #include <linux/bio.h> |
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
@@ -95,7 +95,7 @@ | |||
95 | * reads which takes nowhere near that long. Older cards may be able to use | 95 | * reads which takes nowhere near that long. Older cards may be able to use |
96 | * shorter timeouts ... but why bother? | 96 | * shorter timeouts ... but why bother? |
97 | */ | 97 | */ |
98 | #define r1b_timeout ktime_set(3, 0) | 98 | #define r1b_timeout (HZ * 3) |
99 | 99 | ||
100 | 100 | ||
101 | /****************************************************************************/ | 101 | /****************************************************************************/ |
@@ -183,12 +183,11 @@ mmc_spi_readbytes(struct mmc_spi_host *host, unsigned len) | |||
183 | return status; | 183 | return status; |
184 | } | 184 | } |
185 | 185 | ||
186 | static int | 186 | static int mmc_spi_skip(struct mmc_spi_host *host, unsigned long timeout, |
187 | mmc_spi_skip(struct mmc_spi_host *host, ktime_t timeout, unsigned n, u8 byte) | 187 | unsigned n, u8 byte) |
188 | { | 188 | { |
189 | u8 *cp = host->data->status; | 189 | u8 *cp = host->data->status; |
190 | 190 | unsigned long start = jiffies; | |
191 | timeout = ktime_add(timeout, ktime_get()); | ||
192 | 191 | ||
193 | while (1) { | 192 | while (1) { |
194 | int status; | 193 | int status; |
@@ -203,22 +202,26 @@ mmc_spi_skip(struct mmc_spi_host *host, ktime_t timeout, unsigned n, u8 byte) | |||
203 | return cp[i]; | 202 | return cp[i]; |
204 | } | 203 | } |
205 | 204 | ||
206 | /* REVISIT investigate msleep() to avoid busy-wait I/O | 205 | if (time_is_before_jiffies(start + timeout)) |
207 | * in at least some cases. | ||
208 | */ | ||
209 | if (ktime_to_ns(ktime_sub(ktime_get(), timeout)) > 0) | ||
210 | break; | 206 | break; |
207 | |||
208 | /* If we need long timeouts, we may release the CPU. | ||
209 | * We use jiffies here because we want to have a relation | ||
210 | * between elapsed time and the blocking of the scheduler. | ||
211 | */ | ||
212 | if (time_is_before_jiffies(start+1)) | ||
213 | schedule(); | ||
211 | } | 214 | } |
212 | return -ETIMEDOUT; | 215 | return -ETIMEDOUT; |
213 | } | 216 | } |
214 | 217 | ||
215 | static inline int | 218 | static inline int |
216 | mmc_spi_wait_unbusy(struct mmc_spi_host *host, ktime_t timeout) | 219 | mmc_spi_wait_unbusy(struct mmc_spi_host *host, unsigned long timeout) |
217 | { | 220 | { |
218 | return mmc_spi_skip(host, timeout, sizeof(host->data->status), 0); | 221 | return mmc_spi_skip(host, timeout, sizeof(host->data->status), 0); |
219 | } | 222 | } |
220 | 223 | ||
221 | static int mmc_spi_readtoken(struct mmc_spi_host *host, ktime_t timeout) | 224 | static int mmc_spi_readtoken(struct mmc_spi_host *host, unsigned long timeout) |
222 | { | 225 | { |
223 | return mmc_spi_skip(host, timeout, 1, 0xff); | 226 | return mmc_spi_skip(host, timeout, 1, 0xff); |
224 | } | 227 | } |
@@ -251,6 +254,10 @@ static int mmc_spi_response_get(struct mmc_spi_host *host, | |||
251 | u8 *cp = host->data->status; | 254 | u8 *cp = host->data->status; |
252 | u8 *end = cp + host->t.len; | 255 | u8 *end = cp + host->t.len; |
253 | int value = 0; | 256 | int value = 0; |
257 | int bitshift; | ||
258 | u8 leftover = 0; | ||
259 | unsigned short rotator; | ||
260 | int i; | ||
254 | char tag[32]; | 261 | char tag[32]; |
255 | 262 | ||
256 | snprintf(tag, sizeof(tag), " ... CMD%d response SPI_%s", | 263 | snprintf(tag, sizeof(tag), " ... CMD%d response SPI_%s", |
@@ -268,9 +275,8 @@ static int mmc_spi_response_get(struct mmc_spi_host *host, | |||
268 | 275 | ||
269 | /* Data block reads (R1 response types) may need more data... */ | 276 | /* Data block reads (R1 response types) may need more data... */ |
270 | if (cp == end) { | 277 | if (cp == end) { |
271 | unsigned i; | ||
272 | |||
273 | cp = host->data->status; | 278 | cp = host->data->status; |
279 | end = cp+1; | ||
274 | 280 | ||
275 | /* Card sends N(CR) (== 1..8) bytes of all-ones then one | 281 | /* Card sends N(CR) (== 1..8) bytes of all-ones then one |
276 | * status byte ... and we already scanned 2 bytes. | 282 | * status byte ... and we already scanned 2 bytes. |
@@ -295,20 +301,34 @@ static int mmc_spi_response_get(struct mmc_spi_host *host, | |||
295 | } | 301 | } |
296 | 302 | ||
297 | checkstatus: | 303 | checkstatus: |
298 | if (*cp & 0x80) { | 304 | bitshift = 0; |
299 | dev_dbg(&host->spi->dev, "%s: INVALID RESPONSE, %02x\n", | 305 | if (*cp & 0x80) { |
300 | tag, *cp); | 306 | /* Houston, we have an ugly card with a bit-shifted response */ |
301 | value = -EBADR; | 307 | rotator = *cp++ << 8; |
302 | goto done; | 308 | /* read the next byte */ |
309 | if (cp == end) { | ||
310 | value = mmc_spi_readbytes(host, 1); | ||
311 | if (value < 0) | ||
312 | goto done; | ||
313 | cp = host->data->status; | ||
314 | end = cp+1; | ||
315 | } | ||
316 | rotator |= *cp++; | ||
317 | while (rotator & 0x8000) { | ||
318 | bitshift++; | ||
319 | rotator <<= 1; | ||
320 | } | ||
321 | cmd->resp[0] = rotator >> 8; | ||
322 | leftover = rotator; | ||
323 | } else { | ||
324 | cmd->resp[0] = *cp++; | ||
303 | } | 325 | } |
304 | |||
305 | cmd->resp[0] = *cp++; | ||
306 | cmd->error = 0; | 326 | cmd->error = 0; |
307 | 327 | ||
308 | /* Status byte: the entire seven-bit R1 response. */ | 328 | /* Status byte: the entire seven-bit R1 response. */ |
309 | if (cmd->resp[0] != 0) { | 329 | if (cmd->resp[0] != 0) { |
310 | if ((R1_SPI_PARAMETER | R1_SPI_ADDRESS | 330 | if ((R1_SPI_PARAMETER | R1_SPI_ADDRESS |
311 | | R1_SPI_ILLEGAL_COMMAND) | 331 | | R1_SPI_ILLEGAL_COMMAND) |
312 | & cmd->resp[0]) | 332 | & cmd->resp[0]) |
313 | value = -EINVAL; | 333 | value = -EINVAL; |
314 | else if (R1_SPI_COM_CRC & cmd->resp[0]) | 334 | else if (R1_SPI_COM_CRC & cmd->resp[0]) |
@@ -336,12 +356,45 @@ checkstatus: | |||
336 | * SPI R5 == R1 + data byte; IO_RW_DIRECT | 356 | * SPI R5 == R1 + data byte; IO_RW_DIRECT |
337 | */ | 357 | */ |
338 | case MMC_RSP_SPI_R2: | 358 | case MMC_RSP_SPI_R2: |
339 | cmd->resp[0] |= *cp << 8; | 359 | /* read the next byte */ |
360 | if (cp == end) { | ||
361 | value = mmc_spi_readbytes(host, 1); | ||
362 | if (value < 0) | ||
363 | goto done; | ||
364 | cp = host->data->status; | ||
365 | end = cp+1; | ||
366 | } | ||
367 | if (bitshift) { | ||
368 | rotator = leftover << 8; | ||
369 | rotator |= *cp << bitshift; | ||
370 | cmd->resp[0] |= (rotator & 0xFF00); | ||
371 | } else { | ||
372 | cmd->resp[0] |= *cp << 8; | ||
373 | } | ||
340 | break; | 374 | break; |
341 | 375 | ||
342 | /* SPI R3, R4, or R7 == R1 + 4 bytes */ | 376 | /* SPI R3, R4, or R7 == R1 + 4 bytes */ |
343 | case MMC_RSP_SPI_R3: | 377 | case MMC_RSP_SPI_R3: |
344 | cmd->resp[1] = get_unaligned_be32(cp); | 378 | rotator = leftover << 8; |
379 | cmd->resp[1] = 0; | ||
380 | for (i = 0; i < 4; i++) { | ||
381 | cmd->resp[1] <<= 8; | ||
382 | /* read the next byte */ | ||
383 | if (cp == end) { | ||
384 | value = mmc_spi_readbytes(host, 1); | ||
385 | if (value < 0) | ||
386 | goto done; | ||
387 | cp = host->data->status; | ||
388 | end = cp+1; | ||
389 | } | ||
390 | if (bitshift) { | ||
391 | rotator |= *cp++ << bitshift; | ||
392 | cmd->resp[1] |= (rotator >> 8); | ||
393 | rotator <<= 8; | ||
394 | } else { | ||
395 | cmd->resp[1] |= *cp++; | ||
396 | } | ||
397 | } | ||
345 | break; | 398 | break; |
346 | 399 | ||
347 | /* SPI R1 == just one status byte */ | 400 | /* SPI R1 == just one status byte */ |
@@ -607,7 +660,7 @@ mmc_spi_setup_data_message( | |||
607 | */ | 660 | */ |
608 | static int | 661 | static int |
609 | mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t, | 662 | mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t, |
610 | ktime_t timeout) | 663 | unsigned long timeout) |
611 | { | 664 | { |
612 | struct spi_device *spi = host->spi; | 665 | struct spi_device *spi = host->spi; |
613 | int status, i; | 666 | int status, i; |
@@ -717,11 +770,13 @@ mmc_spi_writeblock(struct mmc_spi_host *host, struct spi_transfer *t, | |||
717 | */ | 770 | */ |
718 | static int | 771 | static int |
719 | mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, | 772 | mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, |
720 | ktime_t timeout) | 773 | unsigned long timeout) |
721 | { | 774 | { |
722 | struct spi_device *spi = host->spi; | 775 | struct spi_device *spi = host->spi; |
723 | int status; | 776 | int status; |
724 | struct scratch *scratch = host->data; | 777 | struct scratch *scratch = host->data; |
778 | unsigned int bitshift; | ||
779 | u8 leftover; | ||
725 | 780 | ||
726 | /* At least one SD card sends an all-zeroes byte when N(CX) | 781 | /* At least one SD card sends an all-zeroes byte when N(CX) |
727 | * applies, before the all-ones bytes ... just cope with that. | 782 | * applies, before the all-ones bytes ... just cope with that. |
@@ -733,38 +788,60 @@ mmc_spi_readblock(struct mmc_spi_host *host, struct spi_transfer *t, | |||
733 | if (status == 0xff || status == 0) | 788 | if (status == 0xff || status == 0) |
734 | status = mmc_spi_readtoken(host, timeout); | 789 | status = mmc_spi_readtoken(host, timeout); |
735 | 790 | ||
736 | if (status == SPI_TOKEN_SINGLE) { | 791 | if (status < 0) { |
737 | if (host->dma_dev) { | 792 | dev_dbg(&spi->dev, "read error %02x (%d)\n", status, status); |
738 | dma_sync_single_for_device(host->dma_dev, | 793 | return status; |
739 | host->data_dma, sizeof(*scratch), | 794 | } |
740 | DMA_BIDIRECTIONAL); | ||
741 | dma_sync_single_for_device(host->dma_dev, | ||
742 | t->rx_dma, t->len, | ||
743 | DMA_FROM_DEVICE); | ||
744 | } | ||
745 | 795 | ||
746 | status = spi_sync(spi, &host->m); | 796 | /* The token may be bit-shifted... |
797 | * the first 0-bit precedes the data stream. | ||
798 | */ | ||
799 | bitshift = 7; | ||
800 | while (status & 0x80) { | ||
801 | status <<= 1; | ||
802 | bitshift--; | ||
803 | } | ||
804 | leftover = status << 1; | ||
747 | 805 | ||
748 | if (host->dma_dev) { | 806 | if (host->dma_dev) { |
749 | dma_sync_single_for_cpu(host->dma_dev, | 807 | dma_sync_single_for_device(host->dma_dev, |
750 | host->data_dma, sizeof(*scratch), | 808 | host->data_dma, sizeof(*scratch), |
751 | DMA_BIDIRECTIONAL); | 809 | DMA_BIDIRECTIONAL); |
752 | dma_sync_single_for_cpu(host->dma_dev, | 810 | dma_sync_single_for_device(host->dma_dev, |
753 | t->rx_dma, t->len, | 811 | t->rx_dma, t->len, |
754 | DMA_FROM_DEVICE); | 812 | DMA_FROM_DEVICE); |
755 | } | 813 | } |
756 | 814 | ||
757 | } else { | 815 | status = spi_sync(spi, &host->m); |
758 | dev_dbg(&spi->dev, "read error %02x (%d)\n", status, status); | ||
759 | 816 | ||
760 | /* we've read extra garbage, timed out, etc */ | 817 | if (host->dma_dev) { |
761 | if (status < 0) | 818 | dma_sync_single_for_cpu(host->dma_dev, |
762 | return status; | 819 | host->data_dma, sizeof(*scratch), |
820 | DMA_BIDIRECTIONAL); | ||
821 | dma_sync_single_for_cpu(host->dma_dev, | ||
822 | t->rx_dma, t->len, | ||
823 | DMA_FROM_DEVICE); | ||
824 | } | ||
763 | 825 | ||
764 | /* low four bits are an R2 subset, fifth seems to be | 826 | if (bitshift) { |
765 | * vendor specific ... map them all to generic error.. | 827 | /* Walk through the data and the crc and do |
828 | * all the magic to get byte-aligned data. | ||
766 | */ | 829 | */ |
767 | return -EIO; | 830 | u8 *cp = t->rx_buf; |
831 | unsigned int len; | ||
832 | unsigned int bitright = 8 - bitshift; | ||
833 | u8 temp; | ||
834 | for (len = t->len; len; len--) { | ||
835 | temp = *cp; | ||
836 | *cp++ = leftover | (temp >> bitshift); | ||
837 | leftover = temp << bitright; | ||
838 | } | ||
839 | cp = (u8 *) &scratch->crc_val; | ||
840 | temp = *cp; | ||
841 | *cp++ = leftover | (temp >> bitshift); | ||
842 | leftover = temp << bitright; | ||
843 | temp = *cp; | ||
844 | *cp = leftover | (temp >> bitshift); | ||
768 | } | 845 | } |
769 | 846 | ||
770 | if (host->mmc->use_spi_crc) { | 847 | if (host->mmc->use_spi_crc) { |
@@ -803,7 +880,7 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, | |||
803 | unsigned n_sg; | 880 | unsigned n_sg; |
804 | int multiple = (data->blocks > 1); | 881 | int multiple = (data->blocks > 1); |
805 | u32 clock_rate; | 882 | u32 clock_rate; |
806 | ktime_t timeout; | 883 | unsigned long timeout; |
807 | 884 | ||
808 | if (data->flags & MMC_DATA_READ) | 885 | if (data->flags & MMC_DATA_READ) |
809 | direction = DMA_FROM_DEVICE; | 886 | direction = DMA_FROM_DEVICE; |
@@ -817,8 +894,9 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, | |||
817 | else | 894 | else |
818 | clock_rate = spi->max_speed_hz; | 895 | clock_rate = spi->max_speed_hz; |
819 | 896 | ||
820 | timeout = ktime_add_ns(ktime_set(0, 0), data->timeout_ns + | 897 | timeout = data->timeout_ns + |
821 | data->timeout_clks * 1000000 / clock_rate); | 898 | data->timeout_clks * 1000000 / clock_rate; |
899 | timeout = usecs_to_jiffies((unsigned int)(timeout / 1000)) + 1; | ||
822 | 900 | ||
823 | /* Handle scatterlist segments one at a time, with synch for | 901 | /* Handle scatterlist segments one at a time, with synch for |
824 | * each 512-byte block | 902 | * each 512-byte block |
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index d183be6f2a5f..e62a22a7f00c 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c | |||
@@ -298,7 +298,6 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data) | |||
298 | struct mmc_request *mrq = host->mrq; | 298 | struct mmc_request *mrq = host->mrq; |
299 | 299 | ||
300 | host->mrq = NULL; | 300 | host->mrq = NULL; |
301 | mmc_omap_fclk_lazy_disable(host); | ||
302 | mmc_request_done(host->mmc, mrq); | 301 | mmc_request_done(host->mmc, mrq); |
303 | return; | 302 | return; |
304 | } | 303 | } |
@@ -434,6 +433,8 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
434 | if (host->mrq == NULL) { | 433 | if (host->mrq == NULL) { |
435 | OMAP_HSMMC_WRITE(host->base, STAT, | 434 | OMAP_HSMMC_WRITE(host->base, STAT, |
436 | OMAP_HSMMC_READ(host->base, STAT)); | 435 | OMAP_HSMMC_READ(host->base, STAT)); |
436 | /* Flush posted write */ | ||
437 | OMAP_HSMMC_READ(host->base, STAT); | ||
437 | return IRQ_HANDLED; | 438 | return IRQ_HANDLED; |
438 | } | 439 | } |
439 | 440 | ||
@@ -489,8 +490,10 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id) | |||
489 | } | 490 | } |
490 | 491 | ||
491 | OMAP_HSMMC_WRITE(host->base, STAT, status); | 492 | OMAP_HSMMC_WRITE(host->base, STAT, status); |
493 | /* Flush posted write */ | ||
494 | OMAP_HSMMC_READ(host->base, STAT); | ||
492 | 495 | ||
493 | if (end_cmd || (status & CC)) | 496 | if (end_cmd || ((status & CC) && host->cmd)) |
494 | mmc_omap_cmd_done(host, host->cmd); | 497 | mmc_omap_cmd_done(host, host->cmd); |
495 | if (end_trans || (status & TC)) | 498 | if (end_trans || (status & TC)) |
496 | mmc_omap_xfer_done(host, data); | 499 | mmc_omap_xfer_done(host, data); |
diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c index c5b316e22371..cd37962ec44f 100644 --- a/drivers/mmc/host/sdhci-pci.c +++ b/drivers/mmc/host/sdhci-pci.c | |||
@@ -729,6 +729,6 @@ static void __exit sdhci_drv_exit(void) | |||
729 | module_init(sdhci_drv_init); | 729 | module_init(sdhci_drv_init); |
730 | module_exit(sdhci_drv_exit); | 730 | module_exit(sdhci_drv_exit); |
731 | 731 | ||
732 | MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); | 732 | MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>"); |
733 | MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver"); | 733 | MODULE_DESCRIPTION("Secure Digital Host Controller Interface PCI driver"); |
734 | MODULE_LICENSE("GPL"); | 734 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 30d8e3d4e6fd..9234be2226e7 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -1935,7 +1935,7 @@ module_exit(sdhci_drv_exit); | |||
1935 | 1935 | ||
1936 | module_param(debug_quirks, uint, 0444); | 1936 | module_param(debug_quirks, uint, 0444); |
1937 | 1937 | ||
1938 | MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); | 1938 | MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>"); |
1939 | MODULE_DESCRIPTION("Secure Digital Host Controller Interface core driver"); | 1939 | MODULE_DESCRIPTION("Secure Digital Host Controller Interface core driver"); |
1940 | MODULE_LICENSE("GPL"); | 1940 | MODULE_LICENSE("GPL"); |
1941 | 1941 | ||
diff --git a/drivers/mmc/host/wbsd.c b/drivers/mmc/host/wbsd.c index adda37952032..89bf8cd25cac 100644 --- a/drivers/mmc/host/wbsd.c +++ b/drivers/mmc/host/wbsd.c | |||
@@ -2036,7 +2036,7 @@ module_param_named(irq, param_irq, uint, 0444); | |||
2036 | module_param_named(dma, param_dma, int, 0444); | 2036 | module_param_named(dma, param_dma, int, 0444); |
2037 | 2037 | ||
2038 | MODULE_LICENSE("GPL"); | 2038 | MODULE_LICENSE("GPL"); |
2039 | MODULE_AUTHOR("Pierre Ossman <drzeus@drzeus.cx>"); | 2039 | MODULE_AUTHOR("Pierre Ossman <pierre@ossman.eu>"); |
2040 | MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); | 2040 | MODULE_DESCRIPTION("Winbond W83L51xD SD/MMC card interface driver"); |
2041 | 2041 | ||
2042 | #ifdef CONFIG_PNP | 2042 | #ifdef CONFIG_PNP |
diff --git a/drivers/serial/max3100.c b/drivers/serial/max3100.c new file mode 100644 index 000000000000..9fd33e5622bd --- /dev/null +++ b/drivers/serial/max3100.c | |||
@@ -0,0 +1,927 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2008 Christian Pellegrin <chripell@evolware.org> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | * | ||
10 | * | ||
11 | * Notes: the MAX3100 doesn't provide an interrupt on CTS so we have | ||
12 | * to use polling for flow control. TX empty IRQ is unusable, since | ||
13 | * writing conf clears FIFO buffer and we cannot have this interrupt | ||
14 | * always asking us for attention. | ||
15 | * | ||
16 | * Example platform data: | ||
17 | |||
18 | static struct plat_max3100 max3100_plat_data = { | ||
19 | .loopback = 0, | ||
20 | .crystal = 0, | ||
21 | .poll_time = 100, | ||
22 | }; | ||
23 | |||
24 | static struct spi_board_info spi_board_info[] = { | ||
25 | { | ||
26 | .modalias = "max3100", | ||
27 | .platform_data = &max3100_plat_data, | ||
28 | .irq = IRQ_EINT12, | ||
29 | .max_speed_hz = 5*1000*1000, | ||
30 | .chip_select = 0, | ||
31 | }, | ||
32 | }; | ||
33 | |||
34 | * The initial minor number is 209 in the low-density serial port: | ||
35 | * mknod /dev/ttyMAX0 c 204 209 | ||
36 | */ | ||
37 | |||
38 | #define MAX3100_MAJOR 204 | ||
39 | #define MAX3100_MINOR 209 | ||
40 | /* 4 MAX3100s should be enough for everyone */ | ||
41 | #define MAX_MAX3100 4 | ||
42 | |||
43 | #include <linux/delay.h> | ||
44 | #include <linux/device.h> | ||
45 | #include <linux/serial_core.h> | ||
46 | #include <linux/serial.h> | ||
47 | #include <linux/spi/spi.h> | ||
48 | #include <linux/freezer.h> | ||
49 | |||
50 | #include <linux/serial_max3100.h> | ||
51 | |||
52 | #define MAX3100_C (1<<14) | ||
53 | #define MAX3100_D (0<<14) | ||
54 | #define MAX3100_W (1<<15) | ||
55 | #define MAX3100_RX (0<<15) | ||
56 | |||
57 | #define MAX3100_WC (MAX3100_W | MAX3100_C) | ||
58 | #define MAX3100_RC (MAX3100_RX | MAX3100_C) | ||
59 | #define MAX3100_WD (MAX3100_W | MAX3100_D) | ||
60 | #define MAX3100_RD (MAX3100_RX | MAX3100_D) | ||
61 | #define MAX3100_CMD (3 << 14) | ||
62 | |||
63 | #define MAX3100_T (1<<14) | ||
64 | #define MAX3100_R (1<<15) | ||
65 | |||
66 | #define MAX3100_FEN (1<<13) | ||
67 | #define MAX3100_SHDN (1<<12) | ||
68 | #define MAX3100_TM (1<<11) | ||
69 | #define MAX3100_RM (1<<10) | ||
70 | #define MAX3100_PM (1<<9) | ||
71 | #define MAX3100_RAM (1<<8) | ||
72 | #define MAX3100_IR (1<<7) | ||
73 | #define MAX3100_ST (1<<6) | ||
74 | #define MAX3100_PE (1<<5) | ||
75 | #define MAX3100_L (1<<4) | ||
76 | #define MAX3100_BAUD (0xf) | ||
77 | |||
78 | #define MAX3100_TE (1<<10) | ||
79 | #define MAX3100_RAFE (1<<10) | ||
80 | #define MAX3100_RTS (1<<9) | ||
81 | #define MAX3100_CTS (1<<9) | ||
82 | #define MAX3100_PT (1<<8) | ||
83 | #define MAX3100_DATA (0xff) | ||
84 | |||
85 | #define MAX3100_RT (MAX3100_R | MAX3100_T) | ||
86 | #define MAX3100_RTC (MAX3100_RT | MAX3100_CTS | MAX3100_RAFE) | ||
87 | |||
88 | /* the following simulate a status reg for ignore_status_mask */ | ||
89 | #define MAX3100_STATUS_PE 1 | ||
90 | #define MAX3100_STATUS_FE 2 | ||
91 | #define MAX3100_STATUS_OE 4 | ||
92 | |||
93 | struct max3100_port { | ||
94 | struct uart_port port; | ||
95 | struct spi_device *spi; | ||
96 | |||
97 | int cts; /* last CTS received for flow ctrl */ | ||
98 | int tx_empty; /* last TX empty bit */ | ||
99 | |||
100 | spinlock_t conf_lock; /* shared data */ | ||
101 | int conf_commit; /* need to make changes */ | ||
102 | int conf; /* configuration for the MAX31000 | ||
103 | * (bits 0-7, bits 8-11 are irqs) */ | ||
104 | int rts_commit; /* need to change rts */ | ||
105 | int rts; /* rts status */ | ||
106 | int baud; /* current baud rate */ | ||
107 | |||
108 | int parity; /* keeps track if we should send parity */ | ||
109 | #define MAX3100_PARITY_ON 1 | ||
110 | #define MAX3100_PARITY_ODD 2 | ||
111 | #define MAX3100_7BIT 4 | ||
112 | int rx_enabled; /* if we should rx chars */ | ||
113 | |||
114 | int irq; /* irq assigned to the max3100 */ | ||
115 | |||
116 | int minor; /* minor number */ | ||
117 | int crystal; /* 1 if 3.6864Mhz crystal 0 for 1.8432 */ | ||
118 | int loopback; /* 1 if we are in loopback mode */ | ||
119 | |||
120 | /* for handling irqs: need workqueue since we do spi_sync */ | ||
121 | struct workqueue_struct *workqueue; | ||
122 | struct work_struct work; | ||
123 | /* set to 1 to make the workhandler exit as soon as possible */ | ||
124 | int force_end_work; | ||
125 | /* need to know we are suspending to avoid deadlock on workqueue */ | ||
126 | int suspending; | ||
127 | |||
128 | /* hook for suspending MAX3100 via dedicated pin */ | ||
129 | void (*max3100_hw_suspend) (int suspend); | ||
130 | |||
131 | /* poll time (in ms) for ctrl lines */ | ||
132 | int poll_time; | ||
133 | /* and its timer */ | ||
134 | struct timer_list timer; | ||
135 | }; | ||
136 | |||
137 | static struct max3100_port *max3100s[MAX_MAX3100]; /* the chips */ | ||
138 | static DEFINE_MUTEX(max3100s_lock); /* race on probe */ | ||
139 | |||
140 | static int max3100_do_parity(struct max3100_port *s, u16 c) | ||
141 | { | ||
142 | int parity; | ||
143 | |||
144 | if (s->parity & MAX3100_PARITY_ODD) | ||
145 | parity = 1; | ||
146 | else | ||
147 | parity = 0; | ||
148 | |||
149 | if (s->parity & MAX3100_7BIT) | ||
150 | c &= 0x7f; | ||
151 | else | ||
152 | c &= 0xff; | ||
153 | |||
154 | parity = parity ^ (hweight8(c) & 1); | ||
155 | return parity; | ||
156 | } | ||
157 | |||
158 | static int max3100_check_parity(struct max3100_port *s, u16 c) | ||
159 | { | ||
160 | return max3100_do_parity(s, c) == ((c >> 8) & 1); | ||
161 | } | ||
162 | |||
163 | static void max3100_calc_parity(struct max3100_port *s, u16 *c) | ||
164 | { | ||
165 | if (s->parity & MAX3100_7BIT) | ||
166 | *c &= 0x7f; | ||
167 | else | ||
168 | *c &= 0xff; | ||
169 | |||
170 | if (s->parity & MAX3100_PARITY_ON) | ||
171 | *c |= max3100_do_parity(s, *c) << 8; | ||
172 | } | ||
173 | |||
174 | static void max3100_work(struct work_struct *w); | ||
175 | |||
176 | static void max3100_dowork(struct max3100_port *s) | ||
177 | { | ||
178 | if (!s->force_end_work && !work_pending(&s->work) && | ||
179 | !freezing(current) && !s->suspending) | ||
180 | queue_work(s->workqueue, &s->work); | ||
181 | } | ||
182 | |||
183 | static void max3100_timeout(unsigned long data) | ||
184 | { | ||
185 | struct max3100_port *s = (struct max3100_port *)data; | ||
186 | |||
187 | if (s->port.info) { | ||
188 | max3100_dowork(s); | ||
189 | mod_timer(&s->timer, jiffies + s->poll_time); | ||
190 | } | ||
191 | } | ||
192 | |||
193 | static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx) | ||
194 | { | ||
195 | struct spi_message message; | ||
196 | u16 etx, erx; | ||
197 | int status; | ||
198 | struct spi_transfer tran = { | ||
199 | .tx_buf = &etx, | ||
200 | .rx_buf = &erx, | ||
201 | .len = 2, | ||
202 | }; | ||
203 | |||
204 | etx = cpu_to_be16(tx); | ||
205 | spi_message_init(&message); | ||
206 | spi_message_add_tail(&tran, &message); | ||
207 | status = spi_sync(s->spi, &message); | ||
208 | if (status) { | ||
209 | dev_warn(&s->spi->dev, "error while calling spi_sync\n"); | ||
210 | return -EIO; | ||
211 | } | ||
212 | *rx = be16_to_cpu(erx); | ||
213 | s->tx_empty = (*rx & MAX3100_T) > 0; | ||
214 | dev_dbg(&s->spi->dev, "%04x - %04x\n", tx, *rx); | ||
215 | return 0; | ||
216 | } | ||
217 | |||
218 | static int max3100_handlerx(struct max3100_port *s, u16 rx) | ||
219 | { | ||
220 | unsigned int ch, flg, status = 0; | ||
221 | int ret = 0, cts; | ||
222 | |||
223 | if (rx & MAX3100_R && s->rx_enabled) { | ||
224 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
225 | ch = rx & (s->parity & MAX3100_7BIT ? 0x7f : 0xff); | ||
226 | if (rx & MAX3100_RAFE) { | ||
227 | s->port.icount.frame++; | ||
228 | flg = TTY_FRAME; | ||
229 | status |= MAX3100_STATUS_FE; | ||
230 | } else { | ||
231 | if (s->parity & MAX3100_PARITY_ON) { | ||
232 | if (max3100_check_parity(s, rx)) { | ||
233 | s->port.icount.rx++; | ||
234 | flg = TTY_NORMAL; | ||
235 | } else { | ||
236 | s->port.icount.parity++; | ||
237 | flg = TTY_PARITY; | ||
238 | status |= MAX3100_STATUS_PE; | ||
239 | } | ||
240 | } else { | ||
241 | s->port.icount.rx++; | ||
242 | flg = TTY_NORMAL; | ||
243 | } | ||
244 | } | ||
245 | uart_insert_char(&s->port, status, MAX3100_STATUS_OE, ch, flg); | ||
246 | ret = 1; | ||
247 | } | ||
248 | |||
249 | cts = (rx & MAX3100_CTS) > 0; | ||
250 | if (s->cts != cts) { | ||
251 | s->cts = cts; | ||
252 | uart_handle_cts_change(&s->port, cts ? TIOCM_CTS : 0); | ||
253 | } | ||
254 | |||
255 | return ret; | ||
256 | } | ||
257 | |||
258 | static void max3100_work(struct work_struct *w) | ||
259 | { | ||
260 | struct max3100_port *s = container_of(w, struct max3100_port, work); | ||
261 | int rxchars; | ||
262 | u16 tx, rx; | ||
263 | int conf, cconf, rts, crts; | ||
264 | struct circ_buf *xmit = &s->port.info->xmit; | ||
265 | |||
266 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
267 | |||
268 | rxchars = 0; | ||
269 | do { | ||
270 | spin_lock(&s->conf_lock); | ||
271 | conf = s->conf; | ||
272 | cconf = s->conf_commit; | ||
273 | s->conf_commit = 0; | ||
274 | rts = s->rts; | ||
275 | crts = s->rts_commit; | ||
276 | s->rts_commit = 0; | ||
277 | spin_unlock(&s->conf_lock); | ||
278 | if (cconf) | ||
279 | max3100_sr(s, MAX3100_WC | conf, &rx); | ||
280 | if (crts) { | ||
281 | max3100_sr(s, MAX3100_WD | MAX3100_TE | | ||
282 | (s->rts ? MAX3100_RTS : 0), &rx); | ||
283 | rxchars += max3100_handlerx(s, rx); | ||
284 | } | ||
285 | |||
286 | max3100_sr(s, MAX3100_RD, &rx); | ||
287 | rxchars += max3100_handlerx(s, rx); | ||
288 | |||
289 | if (rx & MAX3100_T) { | ||
290 | tx = 0xffff; | ||
291 | if (s->port.x_char) { | ||
292 | tx = s->port.x_char; | ||
293 | s->port.icount.tx++; | ||
294 | s->port.x_char = 0; | ||
295 | } else if (!uart_circ_empty(xmit) && | ||
296 | !uart_tx_stopped(&s->port)) { | ||
297 | tx = xmit->buf[xmit->tail]; | ||
298 | xmit->tail = (xmit->tail + 1) & | ||
299 | (UART_XMIT_SIZE - 1); | ||
300 | s->port.icount.tx++; | ||
301 | } | ||
302 | if (tx != 0xffff) { | ||
303 | max3100_calc_parity(s, &tx); | ||
304 | tx |= MAX3100_WD | (s->rts ? MAX3100_RTS : 0); | ||
305 | max3100_sr(s, tx, &rx); | ||
306 | rxchars += max3100_handlerx(s, rx); | ||
307 | } | ||
308 | } | ||
309 | |||
310 | if (rxchars > 16 && s->port.info->port.tty != NULL) { | ||
311 | tty_flip_buffer_push(s->port.info->port.tty); | ||
312 | rxchars = 0; | ||
313 | } | ||
314 | if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) | ||
315 | uart_write_wakeup(&s->port); | ||
316 | |||
317 | } while (!s->force_end_work && | ||
318 | !freezing(current) && | ||
319 | ((rx & MAX3100_R) || | ||
320 | (!uart_circ_empty(xmit) && | ||
321 | !uart_tx_stopped(&s->port)))); | ||
322 | |||
323 | if (rxchars > 0 && s->port.info->port.tty != NULL) | ||
324 | tty_flip_buffer_push(s->port.info->port.tty); | ||
325 | } | ||
326 | |||
327 | static irqreturn_t max3100_irq(int irqno, void *dev_id) | ||
328 | { | ||
329 | struct max3100_port *s = dev_id; | ||
330 | |||
331 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
332 | |||
333 | max3100_dowork(s); | ||
334 | return IRQ_HANDLED; | ||
335 | } | ||
336 | |||
337 | static void max3100_enable_ms(struct uart_port *port) | ||
338 | { | ||
339 | struct max3100_port *s = container_of(port, | ||
340 | struct max3100_port, | ||
341 | port); | ||
342 | |||
343 | if (s->poll_time > 0) | ||
344 | mod_timer(&s->timer, jiffies); | ||
345 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
346 | } | ||
347 | |||
348 | static void max3100_start_tx(struct uart_port *port) | ||
349 | { | ||
350 | struct max3100_port *s = container_of(port, | ||
351 | struct max3100_port, | ||
352 | port); | ||
353 | |||
354 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
355 | |||
356 | max3100_dowork(s); | ||
357 | } | ||
358 | |||
359 | static void max3100_stop_rx(struct uart_port *port) | ||
360 | { | ||
361 | struct max3100_port *s = container_of(port, | ||
362 | struct max3100_port, | ||
363 | port); | ||
364 | |||
365 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
366 | |||
367 | s->rx_enabled = 0; | ||
368 | spin_lock(&s->conf_lock); | ||
369 | s->conf &= ~MAX3100_RM; | ||
370 | s->conf_commit = 1; | ||
371 | spin_unlock(&s->conf_lock); | ||
372 | max3100_dowork(s); | ||
373 | } | ||
374 | |||
375 | static unsigned int max3100_tx_empty(struct uart_port *port) | ||
376 | { | ||
377 | struct max3100_port *s = container_of(port, | ||
378 | struct max3100_port, | ||
379 | port); | ||
380 | |||
381 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
382 | |||
383 | /* may not be truly up-to-date */ | ||
384 | max3100_dowork(s); | ||
385 | return s->tx_empty; | ||
386 | } | ||
387 | |||
388 | static unsigned int max3100_get_mctrl(struct uart_port *port) | ||
389 | { | ||
390 | struct max3100_port *s = container_of(port, | ||
391 | struct max3100_port, | ||
392 | port); | ||
393 | |||
394 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
395 | |||
396 | /* may not be truly up-to-date */ | ||
397 | max3100_dowork(s); | ||
398 | /* always assert DCD and DSR since these lines are not wired */ | ||
399 | return (s->cts ? TIOCM_CTS : 0) | TIOCM_DSR | TIOCM_CAR; | ||
400 | } | ||
401 | |||
402 | static void max3100_set_mctrl(struct uart_port *port, unsigned int mctrl) | ||
403 | { | ||
404 | struct max3100_port *s = container_of(port, | ||
405 | struct max3100_port, | ||
406 | port); | ||
407 | int rts; | ||
408 | |||
409 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
410 | |||
411 | rts = (mctrl & TIOCM_RTS) > 0; | ||
412 | |||
413 | spin_lock(&s->conf_lock); | ||
414 | if (s->rts != rts) { | ||
415 | s->rts = rts; | ||
416 | s->rts_commit = 1; | ||
417 | max3100_dowork(s); | ||
418 | } | ||
419 | spin_unlock(&s->conf_lock); | ||
420 | } | ||
421 | |||
422 | static void | ||
423 | max3100_set_termios(struct uart_port *port, struct ktermios *termios, | ||
424 | struct ktermios *old) | ||
425 | { | ||
426 | struct max3100_port *s = container_of(port, | ||
427 | struct max3100_port, | ||
428 | port); | ||
429 | int baud = 0; | ||
430 | unsigned cflag; | ||
431 | u32 param_new, param_mask, parity = 0; | ||
432 | struct tty_struct *tty = s->port.info->port.tty; | ||
433 | |||
434 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
435 | if (!tty) | ||
436 | return; | ||
437 | |||
438 | cflag = termios->c_cflag; | ||
439 | param_new = 0; | ||
440 | param_mask = 0; | ||
441 | |||
442 | baud = tty_get_baud_rate(tty); | ||
443 | param_new = s->conf & MAX3100_BAUD; | ||
444 | switch (baud) { | ||
445 | case 300: | ||
446 | if (s->crystal) | ||
447 | baud = s->baud; | ||
448 | else | ||
449 | param_new = 15; | ||
450 | break; | ||
451 | case 600: | ||
452 | param_new = 14 + s->crystal; | ||
453 | break; | ||
454 | case 1200: | ||
455 | param_new = 13 + s->crystal; | ||
456 | break; | ||
457 | case 2400: | ||
458 | param_new = 12 + s->crystal; | ||
459 | break; | ||
460 | case 4800: | ||
461 | param_new = 11 + s->crystal; | ||
462 | break; | ||
463 | case 9600: | ||
464 | param_new = 10 + s->crystal; | ||
465 | break; | ||
466 | case 19200: | ||
467 | param_new = 9 + s->crystal; | ||
468 | break; | ||
469 | case 38400: | ||
470 | param_new = 8 + s->crystal; | ||
471 | break; | ||
472 | case 57600: | ||
473 | param_new = 1 + s->crystal; | ||
474 | break; | ||
475 | case 115200: | ||
476 | param_new = 0 + s->crystal; | ||
477 | break; | ||
478 | case 230400: | ||
479 | if (s->crystal) | ||
480 | param_new = 0; | ||
481 | else | ||
482 | baud = s->baud; | ||
483 | break; | ||
484 | default: | ||
485 | baud = s->baud; | ||
486 | } | ||
487 | tty_encode_baud_rate(tty, baud, baud); | ||
488 | s->baud = baud; | ||
489 | param_mask |= MAX3100_BAUD; | ||
490 | |||
491 | if ((cflag & CSIZE) == CS8) { | ||
492 | param_new &= ~MAX3100_L; | ||
493 | parity &= ~MAX3100_7BIT; | ||
494 | } else { | ||
495 | param_new |= MAX3100_L; | ||
496 | parity |= MAX3100_7BIT; | ||
497 | cflag = (cflag & ~CSIZE) | CS7; | ||
498 | } | ||
499 | param_mask |= MAX3100_L; | ||
500 | |||
501 | if (cflag & CSTOPB) | ||
502 | param_new |= MAX3100_ST; | ||
503 | else | ||
504 | param_new &= ~MAX3100_ST; | ||
505 | param_mask |= MAX3100_ST; | ||
506 | |||
507 | if (cflag & PARENB) { | ||
508 | param_new |= MAX3100_PE; | ||
509 | parity |= MAX3100_PARITY_ON; | ||
510 | } else { | ||
511 | param_new &= ~MAX3100_PE; | ||
512 | parity &= ~MAX3100_PARITY_ON; | ||
513 | } | ||
514 | param_mask |= MAX3100_PE; | ||
515 | |||
516 | if (cflag & PARODD) | ||
517 | parity |= MAX3100_PARITY_ODD; | ||
518 | else | ||
519 | parity &= ~MAX3100_PARITY_ODD; | ||
520 | |||
521 | /* mask termios capabilities we don't support */ | ||
522 | cflag &= ~CMSPAR; | ||
523 | termios->c_cflag = cflag; | ||
524 | |||
525 | s->port.ignore_status_mask = 0; | ||
526 | if (termios->c_iflag & IGNPAR) | ||
527 | s->port.ignore_status_mask |= | ||
528 | MAX3100_STATUS_PE | MAX3100_STATUS_FE | | ||
529 | MAX3100_STATUS_OE; | ||
530 | |||
531 | /* we are sending char from a workqueue so enable */ | ||
532 | s->port.info->port.tty->low_latency = 1; | ||
533 | |||
534 | if (s->poll_time > 0) | ||
535 | del_timer_sync(&s->timer); | ||
536 | |||
537 | uart_update_timeout(port, termios->c_cflag, baud); | ||
538 | |||
539 | spin_lock(&s->conf_lock); | ||
540 | s->conf = (s->conf & ~param_mask) | (param_new & param_mask); | ||
541 | s->conf_commit = 1; | ||
542 | s->parity = parity; | ||
543 | spin_unlock(&s->conf_lock); | ||
544 | max3100_dowork(s); | ||
545 | |||
546 | if (UART_ENABLE_MS(&s->port, termios->c_cflag)) | ||
547 | max3100_enable_ms(&s->port); | ||
548 | } | ||
549 | |||
550 | static void max3100_shutdown(struct uart_port *port) | ||
551 | { | ||
552 | struct max3100_port *s = container_of(port, | ||
553 | struct max3100_port, | ||
554 | port); | ||
555 | |||
556 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
557 | |||
558 | if (s->suspending) | ||
559 | return; | ||
560 | |||
561 | s->force_end_work = 1; | ||
562 | |||
563 | if (s->poll_time > 0) | ||
564 | del_timer_sync(&s->timer); | ||
565 | |||
566 | if (s->workqueue) { | ||
567 | flush_workqueue(s->workqueue); | ||
568 | destroy_workqueue(s->workqueue); | ||
569 | s->workqueue = NULL; | ||
570 | } | ||
571 | if (s->irq) | ||
572 | free_irq(s->irq, s); | ||
573 | |||
574 | /* set shutdown mode to save power */ | ||
575 | if (s->max3100_hw_suspend) | ||
576 | s->max3100_hw_suspend(1); | ||
577 | else { | ||
578 | u16 tx, rx; | ||
579 | |||
580 | tx = MAX3100_WC | MAX3100_SHDN; | ||
581 | max3100_sr(s, tx, &rx); | ||
582 | } | ||
583 | } | ||
584 | |||
585 | static int max3100_startup(struct uart_port *port) | ||
586 | { | ||
587 | struct max3100_port *s = container_of(port, | ||
588 | struct max3100_port, | ||
589 | port); | ||
590 | char b[12]; | ||
591 | |||
592 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
593 | |||
594 | s->conf = MAX3100_RM; | ||
595 | s->baud = s->crystal ? 230400 : 115200; | ||
596 | s->rx_enabled = 1; | ||
597 | |||
598 | if (s->suspending) | ||
599 | return 0; | ||
600 | |||
601 | s->force_end_work = 0; | ||
602 | s->parity = 0; | ||
603 | s->rts = 0; | ||
604 | |||
605 | sprintf(b, "max3100-%d", s->minor); | ||
606 | s->workqueue = create_freezeable_workqueue(b); | ||
607 | if (!s->workqueue) { | ||
608 | dev_warn(&s->spi->dev, "cannot create workqueue\n"); | ||
609 | return -EBUSY; | ||
610 | } | ||
611 | INIT_WORK(&s->work, max3100_work); | ||
612 | |||
613 | if (request_irq(s->irq, max3100_irq, | ||
614 | IRQF_TRIGGER_FALLING, "max3100", s) < 0) { | ||
615 | dev_warn(&s->spi->dev, "cannot allocate irq %d\n", s->irq); | ||
616 | s->irq = 0; | ||
617 | destroy_workqueue(s->workqueue); | ||
618 | s->workqueue = NULL; | ||
619 | return -EBUSY; | ||
620 | } | ||
621 | |||
622 | if (s->loopback) { | ||
623 | u16 tx, rx; | ||
624 | tx = 0x4001; | ||
625 | max3100_sr(s, tx, &rx); | ||
626 | } | ||
627 | |||
628 | if (s->max3100_hw_suspend) | ||
629 | s->max3100_hw_suspend(0); | ||
630 | s->conf_commit = 1; | ||
631 | max3100_dowork(s); | ||
632 | /* wait for clock to settle */ | ||
633 | msleep(50); | ||
634 | |||
635 | max3100_enable_ms(&s->port); | ||
636 | |||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | static const char *max3100_type(struct uart_port *port) | ||
641 | { | ||
642 | struct max3100_port *s = container_of(port, | ||
643 | struct max3100_port, | ||
644 | port); | ||
645 | |||
646 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
647 | |||
648 | return s->port.type == PORT_MAX3100 ? "MAX3100" : NULL; | ||
649 | } | ||
650 | |||
651 | static void max3100_release_port(struct uart_port *port) | ||
652 | { | ||
653 | struct max3100_port *s = container_of(port, | ||
654 | struct max3100_port, | ||
655 | port); | ||
656 | |||
657 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
658 | } | ||
659 | |||
660 | static void max3100_config_port(struct uart_port *port, int flags) | ||
661 | { | ||
662 | struct max3100_port *s = container_of(port, | ||
663 | struct max3100_port, | ||
664 | port); | ||
665 | |||
666 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
667 | |||
668 | if (flags & UART_CONFIG_TYPE) | ||
669 | s->port.type = PORT_MAX3100; | ||
670 | } | ||
671 | |||
672 | static int max3100_verify_port(struct uart_port *port, | ||
673 | struct serial_struct *ser) | ||
674 | { | ||
675 | struct max3100_port *s = container_of(port, | ||
676 | struct max3100_port, | ||
677 | port); | ||
678 | int ret = -EINVAL; | ||
679 | |||
680 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
681 | |||
682 | if (ser->type == PORT_UNKNOWN || ser->type == PORT_MAX3100) | ||
683 | ret = 0; | ||
684 | return ret; | ||
685 | } | ||
686 | |||
687 | static void max3100_stop_tx(struct uart_port *port) | ||
688 | { | ||
689 | struct max3100_port *s = container_of(port, | ||
690 | struct max3100_port, | ||
691 | port); | ||
692 | |||
693 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
694 | } | ||
695 | |||
696 | static int max3100_request_port(struct uart_port *port) | ||
697 | { | ||
698 | struct max3100_port *s = container_of(port, | ||
699 | struct max3100_port, | ||
700 | port); | ||
701 | |||
702 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
703 | return 0; | ||
704 | } | ||
705 | |||
706 | static void max3100_break_ctl(struct uart_port *port, int break_state) | ||
707 | { | ||
708 | struct max3100_port *s = container_of(port, | ||
709 | struct max3100_port, | ||
710 | port); | ||
711 | |||
712 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
713 | } | ||
714 | |||
715 | static struct uart_ops max3100_ops = { | ||
716 | .tx_empty = max3100_tx_empty, | ||
717 | .set_mctrl = max3100_set_mctrl, | ||
718 | .get_mctrl = max3100_get_mctrl, | ||
719 | .stop_tx = max3100_stop_tx, | ||
720 | .start_tx = max3100_start_tx, | ||
721 | .stop_rx = max3100_stop_rx, | ||
722 | .enable_ms = max3100_enable_ms, | ||
723 | .break_ctl = max3100_break_ctl, | ||
724 | .startup = max3100_startup, | ||
725 | .shutdown = max3100_shutdown, | ||
726 | .set_termios = max3100_set_termios, | ||
727 | .type = max3100_type, | ||
728 | .release_port = max3100_release_port, | ||
729 | .request_port = max3100_request_port, | ||
730 | .config_port = max3100_config_port, | ||
731 | .verify_port = max3100_verify_port, | ||
732 | }; | ||
733 | |||
734 | static struct uart_driver max3100_uart_driver = { | ||
735 | .owner = THIS_MODULE, | ||
736 | .driver_name = "ttyMAX", | ||
737 | .dev_name = "ttyMAX", | ||
738 | .major = MAX3100_MAJOR, | ||
739 | .minor = MAX3100_MINOR, | ||
740 | .nr = MAX_MAX3100, | ||
741 | }; | ||
742 | static int uart_driver_registered; | ||
743 | |||
744 | static int __devinit max3100_probe(struct spi_device *spi) | ||
745 | { | ||
746 | int i, retval; | ||
747 | struct plat_max3100 *pdata; | ||
748 | u16 tx, rx; | ||
749 | |||
750 | mutex_lock(&max3100s_lock); | ||
751 | |||
752 | if (!uart_driver_registered) { | ||
753 | uart_driver_registered = 1; | ||
754 | retval = uart_register_driver(&max3100_uart_driver); | ||
755 | if (retval) { | ||
756 | printk(KERN_ERR "Couldn't register max3100 uart driver\n"); | ||
757 | mutex_unlock(&max3100s_lock); | ||
758 | return retval; | ||
759 | } | ||
760 | } | ||
761 | |||
762 | for (i = 0; i < MAX_MAX3100; i++) | ||
763 | if (!max3100s[i]) | ||
764 | break; | ||
765 | if (i == MAX_MAX3100) { | ||
766 | dev_warn(&spi->dev, "too many MAX3100 chips\n"); | ||
767 | mutex_unlock(&max3100s_lock); | ||
768 | return -ENOMEM; | ||
769 | } | ||
770 | |||
771 | max3100s[i] = kzalloc(sizeof(struct max3100_port), GFP_KERNEL); | ||
772 | if (!max3100s[i]) { | ||
773 | dev_warn(&spi->dev, | ||
774 | "kmalloc for max3100 structure %d failed!\n", i); | ||
775 | mutex_unlock(&max3100s_lock); | ||
776 | return -ENOMEM; | ||
777 | } | ||
778 | max3100s[i]->spi = spi; | ||
779 | max3100s[i]->irq = spi->irq; | ||
780 | spin_lock_init(&max3100s[i]->conf_lock); | ||
781 | dev_set_drvdata(&spi->dev, max3100s[i]); | ||
782 | pdata = spi->dev.platform_data; | ||
783 | max3100s[i]->crystal = pdata->crystal; | ||
784 | max3100s[i]->loopback = pdata->loopback; | ||
785 | max3100s[i]->poll_time = pdata->poll_time * HZ / 1000; | ||
786 | if (pdata->poll_time > 0 && max3100s[i]->poll_time == 0) | ||
787 | max3100s[i]->poll_time = 1; | ||
788 | max3100s[i]->max3100_hw_suspend = pdata->max3100_hw_suspend; | ||
789 | max3100s[i]->minor = i; | ||
790 | init_timer(&max3100s[i]->timer); | ||
791 | max3100s[i]->timer.function = max3100_timeout; | ||
792 | max3100s[i]->timer.data = (unsigned long) max3100s[i]; | ||
793 | |||
794 | dev_dbg(&spi->dev, "%s: adding port %d\n", __func__, i); | ||
795 | max3100s[i]->port.irq = max3100s[i]->irq; | ||
796 | max3100s[i]->port.uartclk = max3100s[i]->crystal ? 3686400 : 1843200; | ||
797 | max3100s[i]->port.fifosize = 16; | ||
798 | max3100s[i]->port.ops = &max3100_ops; | ||
799 | max3100s[i]->port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; | ||
800 | max3100s[i]->port.line = i; | ||
801 | max3100s[i]->port.type = PORT_MAX3100; | ||
802 | max3100s[i]->port.dev = &spi->dev; | ||
803 | retval = uart_add_one_port(&max3100_uart_driver, &max3100s[i]->port); | ||
804 | if (retval < 0) | ||
805 | dev_warn(&spi->dev, | ||
806 | "uart_add_one_port failed for line %d with error %d\n", | ||
807 | i, retval); | ||
808 | |||
809 | /* set shutdown mode to save power. Will be woken-up on open */ | ||
810 | if (max3100s[i]->max3100_hw_suspend) | ||
811 | max3100s[i]->max3100_hw_suspend(1); | ||
812 | else { | ||
813 | tx = MAX3100_WC | MAX3100_SHDN; | ||
814 | max3100_sr(max3100s[i], tx, &rx); | ||
815 | } | ||
816 | mutex_unlock(&max3100s_lock); | ||
817 | return 0; | ||
818 | } | ||
819 | |||
820 | static int __devexit max3100_remove(struct spi_device *spi) | ||
821 | { | ||
822 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
823 | int i; | ||
824 | |||
825 | mutex_lock(&max3100s_lock); | ||
826 | |||
827 | /* find out the index for the chip we are removing */ | ||
828 | for (i = 0; i < MAX_MAX3100; i++) | ||
829 | if (max3100s[i] == s) | ||
830 | break; | ||
831 | |||
832 | dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i); | ||
833 | uart_remove_one_port(&max3100_uart_driver, &max3100s[i]->port); | ||
834 | kfree(max3100s[i]); | ||
835 | max3100s[i] = NULL; | ||
836 | |||
837 | /* check if this is the last chip we have */ | ||
838 | for (i = 0; i < MAX_MAX3100; i++) | ||
839 | if (max3100s[i]) { | ||
840 | mutex_unlock(&max3100s_lock); | ||
841 | return 0; | ||
842 | } | ||
843 | pr_debug("removing max3100 driver\n"); | ||
844 | uart_unregister_driver(&max3100_uart_driver); | ||
845 | |||
846 | mutex_unlock(&max3100s_lock); | ||
847 | return 0; | ||
848 | } | ||
849 | |||
850 | #ifdef CONFIG_PM | ||
851 | |||
852 | static int max3100_suspend(struct spi_device *spi, pm_message_t state) | ||
853 | { | ||
854 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
855 | |||
856 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
857 | |||
858 | disable_irq(s->irq); | ||
859 | |||
860 | s->suspending = 1; | ||
861 | uart_suspend_port(&max3100_uart_driver, &s->port); | ||
862 | |||
863 | if (s->max3100_hw_suspend) | ||
864 | s->max3100_hw_suspend(1); | ||
865 | else { | ||
866 | /* no HW suspend, so do SW one */ | ||
867 | u16 tx, rx; | ||
868 | |||
869 | tx = MAX3100_WC | MAX3100_SHDN; | ||
870 | max3100_sr(s, tx, &rx); | ||
871 | } | ||
872 | return 0; | ||
873 | } | ||
874 | |||
875 | static int max3100_resume(struct spi_device *spi) | ||
876 | { | ||
877 | struct max3100_port *s = dev_get_drvdata(&spi->dev); | ||
878 | |||
879 | dev_dbg(&s->spi->dev, "%s\n", __func__); | ||
880 | |||
881 | if (s->max3100_hw_suspend) | ||
882 | s->max3100_hw_suspend(0); | ||
883 | uart_resume_port(&max3100_uart_driver, &s->port); | ||
884 | s->suspending = 0; | ||
885 | |||
886 | enable_irq(s->irq); | ||
887 | |||
888 | s->conf_commit = 1; | ||
889 | if (s->workqueue) | ||
890 | max3100_dowork(s); | ||
891 | |||
892 | return 0; | ||
893 | } | ||
894 | |||
895 | #else | ||
896 | #define max3100_suspend NULL | ||
897 | #define max3100_resume NULL | ||
898 | #endif | ||
899 | |||
900 | static struct spi_driver max3100_driver = { | ||
901 | .driver = { | ||
902 | .name = "max3100", | ||
903 | .bus = &spi_bus_type, | ||
904 | .owner = THIS_MODULE, | ||
905 | }, | ||
906 | |||
907 | .probe = max3100_probe, | ||
908 | .remove = __devexit_p(max3100_remove), | ||
909 | .suspend = max3100_suspend, | ||
910 | .resume = max3100_resume, | ||
911 | }; | ||
912 | |||
913 | static int __init max3100_init(void) | ||
914 | { | ||
915 | return spi_register_driver(&max3100_driver); | ||
916 | } | ||
917 | module_init(max3100_init); | ||
918 | |||
919 | static void __exit max3100_exit(void) | ||
920 | { | ||
921 | spi_unregister_driver(&max3100_driver); | ||
922 | } | ||
923 | module_exit(max3100_exit); | ||
924 | |||
925 | MODULE_DESCRIPTION("MAX3100 driver"); | ||
926 | MODULE_AUTHOR("Christian Pellegrin <chripell@evolware.org>"); | ||
927 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c index 4ed228a89943..bb5e6f671578 100644 --- a/drivers/usb/host/ohci-at91.c +++ b/drivers/usb/host/ohci-at91.c | |||
@@ -280,7 +280,7 @@ static int ohci_hcd_at91_drv_probe(struct platform_device *pdev) | |||
280 | * are always powered while this driver is active, and use | 280 | * are always powered while this driver is active, and use |
281 | * active-low power switches. | 281 | * active-low power switches. |
282 | */ | 282 | */ |
283 | for (i = 0; i < pdata->ports; i++) { | 283 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { |
284 | if (pdata->vbus_pin[i] <= 0) | 284 | if (pdata->vbus_pin[i] <= 0) |
285 | continue; | 285 | continue; |
286 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); | 286 | gpio_request(pdata->vbus_pin[i], "ohci_vbus"); |
@@ -298,7 +298,7 @@ static int ohci_hcd_at91_drv_remove(struct platform_device *pdev) | |||
298 | int i; | 298 | int i; |
299 | 299 | ||
300 | if (pdata) { | 300 | if (pdata) { |
301 | for (i = 0; i < pdata->ports; i++) { | 301 | for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) { |
302 | if (pdata->vbus_pin[i] <= 0) | 302 | if (pdata->vbus_pin[i] <= 0) |
303 | continue; | 303 | continue; |
304 | gpio_direction_output(pdata->vbus_pin[i], 1); | 304 | gpio_direction_output(pdata->vbus_pin[i], 1); |
diff --git a/fs/befs/super.c b/fs/befs/super.c index 41f2b4d0093e..ca40f828f64d 100644 --- a/fs/befs/super.c +++ b/fs/befs/super.c | |||
@@ -8,6 +8,7 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <asm/page.h> /* for PAGE_SIZE */ | ||
11 | 12 | ||
12 | #include "befs.h" | 13 | #include "befs.h" |
13 | #include "super.h" | 14 | #include "super.h" |
diff --git a/fs/proc/task_nommu.c b/fs/proc/task_nommu.c index 12c20377772d..64a72e2e7650 100644 --- a/fs/proc/task_nommu.c +++ b/fs/proc/task_nommu.c | |||
@@ -135,7 +135,7 @@ static int nommu_vma_show(struct seq_file *m, struct vm_area_struct *vma) | |||
135 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; | 135 | struct inode *inode = vma->vm_file->f_path.dentry->d_inode; |
136 | dev = inode->i_sb->s_dev; | 136 | dev = inode->i_sb->s_dev; |
137 | ino = inode->i_ino; | 137 | ino = inode->i_ino; |
138 | pgoff = (loff_t)vma->pg_off << PAGE_SHIFT; | 138 | pgoff = (loff_t)vma->vm_pgoff << PAGE_SHIFT; |
139 | } | 139 | } |
140 | 140 | ||
141 | seq_printf(m, | 141 | seq_printf(m, |
diff --git a/include/linux/serial_max3100.h b/include/linux/serial_max3100.h new file mode 100644 index 000000000000..4976befb6aeb --- /dev/null +++ b/include/linux/serial_max3100.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Copyright (C) 2007 Christian Pellegrin | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | |||
12 | #ifndef _LINUX_SERIAL_MAX3100_H | ||
13 | #define _LINUX_SERIAL_MAX3100_H 1 | ||
14 | |||
15 | |||
16 | /** | ||
17 | * struct plat_max3100 - MAX3100 SPI UART platform data | ||
18 | * @loopback: force MAX3100 in loopback | ||
19 | * @crystal: 1 for 3.6864 Mhz, 0 for 1.8432 | ||
20 | * @max3100_hw_suspend: MAX3100 has a shutdown pin. This is a hook | ||
21 | * called on suspend and resume to activate it. | ||
22 | * @poll_time: poll time for CTS signal in ms, 0 disables (so no hw | ||
23 | * flow ctrl is possible but you have less CPU usage) | ||
24 | * | ||
25 | * You should use this structure in your machine description to specify | ||
26 | * how the MAX3100 is connected. Example: | ||
27 | * | ||
28 | * static struct plat_max3100 max3100_plat_data = { | ||
29 | * .loopback = 0, | ||
30 | * .crystal = 0, | ||
31 | * .poll_time = 100, | ||
32 | * }; | ||
33 | * | ||
34 | * static struct spi_board_info spi_board_info[] = { | ||
35 | * { | ||
36 | * .modalias = "max3100", | ||
37 | * .platform_data = &max3100_plat_data, | ||
38 | * .irq = IRQ_EINT12, | ||
39 | * .max_speed_hz = 5*1000*1000, | ||
40 | * .chip_select = 0, | ||
41 | * }, | ||
42 | * }; | ||
43 | * | ||
44 | **/ | ||
45 | struct plat_max3100 { | ||
46 | int loopback; | ||
47 | int crystal; | ||
48 | void (*max3100_hw_suspend) (int suspend); | ||
49 | int poll_time; | ||
50 | }; | ||
51 | |||
52 | #endif | ||
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index aaad0ec34194..64191fa09b7e 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -21,9 +21,7 @@ | |||
21 | #include <linux/audit.h> | 21 | #include <linux/audit.h> |
22 | #include <linux/pid_namespace.h> | 22 | #include <linux/pid_namespace.h> |
23 | #include <linux/syscalls.h> | 23 | #include <linux/syscalls.h> |
24 | 24 | #include <linux/uaccess.h> | |
25 | #include <asm/pgtable.h> | ||
26 | #include <asm/uaccess.h> | ||
27 | 25 | ||
28 | 26 | ||
29 | /* | 27 | /* |
@@ -48,7 +46,7 @@ void __ptrace_link(struct task_struct *child, struct task_struct *new_parent) | |||
48 | list_add(&child->ptrace_entry, &new_parent->ptraced); | 46 | list_add(&child->ptrace_entry, &new_parent->ptraced); |
49 | child->parent = new_parent; | 47 | child->parent = new_parent; |
50 | } | 48 | } |
51 | 49 | ||
52 | /* | 50 | /* |
53 | * Turn a tracing stop into a normal stop now, since with no tracer there | 51 | * Turn a tracing stop into a normal stop now, since with no tracer there |
54 | * would be no way to wake it up with SIGCONT or SIGKILL. If there was a | 52 | * would be no way to wake it up with SIGCONT or SIGKILL. If there was a |
@@ -173,7 +171,7 @@ bool ptrace_may_access(struct task_struct *task, unsigned int mode) | |||
173 | task_lock(task); | 171 | task_lock(task); |
174 | err = __ptrace_may_access(task, mode); | 172 | err = __ptrace_may_access(task, mode); |
175 | task_unlock(task); | 173 | task_unlock(task); |
176 | return (!err ? true : false); | 174 | return !err; |
177 | } | 175 | } |
178 | 176 | ||
179 | int ptrace_attach(struct task_struct *task) | 177 | int ptrace_attach(struct task_struct *task) |
@@ -358,7 +356,7 @@ int ptrace_readdata(struct task_struct *tsk, unsigned long src, char __user *dst | |||
358 | copied += retval; | 356 | copied += retval; |
359 | src += retval; | 357 | src += retval; |
360 | dst += retval; | 358 | dst += retval; |
361 | len -= retval; | 359 | len -= retval; |
362 | } | 360 | } |
363 | return copied; | 361 | return copied; |
364 | } | 362 | } |
@@ -383,7 +381,7 @@ int ptrace_writedata(struct task_struct *tsk, char __user *src, unsigned long ds | |||
383 | copied += retval; | 381 | copied += retval; |
384 | src += retval; | 382 | src += retval; |
385 | dst += retval; | 383 | dst += retval; |
386 | len -= retval; | 384 | len -= retval; |
387 | } | 385 | } |
388 | return copied; | 386 | return copied; |
389 | } | 387 | } |
@@ -496,9 +494,9 @@ static int ptrace_resume(struct task_struct *child, long request, long data) | |||
496 | if (unlikely(!arch_has_single_step())) | 494 | if (unlikely(!arch_has_single_step())) |
497 | return -EIO; | 495 | return -EIO; |
498 | user_enable_single_step(child); | 496 | user_enable_single_step(child); |
499 | } | 497 | } else { |
500 | else | ||
501 | user_disable_single_step(child); | 498 | user_disable_single_step(child); |
499 | } | ||
502 | 500 | ||
503 | child->exit_code = data; | 501 | child->exit_code = data; |
504 | wake_up_process(child); | 502 | wake_up_process(child); |