diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-02 14:52:39 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-08-02 14:52:39 -0400 |
| commit | fc6bdb59a501740b28ed3b616641a22c8dc5dd31 (patch) | |
| tree | 00ddba349c7e96b03af0913da1a74eae8a94a2db | |
| parent | 44d82e2963551eafa378a3fc7a923df7853af4e2 (diff) | |
| parent | 1fcfd08bd0704e1888bd73153e8d2ca3640e22f2 (diff) | |
Merge branch 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc
Pull OLPC platform updates from Andres Salomon:
"These move the OLPC Embedded Controller driver out of
arch/x86/platform and into drivers/platform/olpc.
OLPC machines are now ARM-based (which means lots of x86 and ARM
changes), but are typically pretty self-contained.. so it makes more
sense to go through a separate OLPC tree after getting the appropriate
review/ACKs."
* 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc:
x86: OLPC: move s/r-related EC cmds to EC driver
Platform: OLPC: move global variables into priv struct
Platform: OLPC: move debugfs support from x86 EC driver
x86: OLPC: switch over to using new EC driver on x86
Platform: OLPC: add a suspended flag to the EC driver
Platform: OLPC: turn EC driver into a platform_driver
Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to call it
drivers: OLPC: update various drivers to include olpc-ec.h
Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver
| -rw-r--r-- | arch/x86/include/asm/olpc.h | 19 | ||||
| -rw-r--r-- | arch/x86/platform/olpc/olpc-xo1-pm.c | 16 | ||||
| -rw-r--r-- | arch/x86/platform/olpc/olpc-xo1-sci.c | 1 | ||||
| -rw-r--r-- | arch/x86/platform/olpc/olpc-xo15-sci.c | 1 | ||||
| -rw-r--r-- | arch/x86/platform/olpc/olpc.c | 190 | ||||
| -rw-r--r-- | drivers/net/wireless/libertas/if_usb.c | 1 | ||||
| -rw-r--r-- | drivers/platform/Makefile | 1 | ||||
| -rw-r--r-- | drivers/platform/olpc/Makefile | 4 | ||||
| -rw-r--r-- | drivers/platform/olpc/olpc-ec.c | 336 | ||||
| -rw-r--r-- | drivers/platform/x86/xo1-rfkill.c | 3 | ||||
| -rw-r--r-- | drivers/power/olpc_battery.c | 1 | ||||
| -rw-r--r-- | drivers/staging/olpc_dcon/olpc_dcon.c | 1 | ||||
| -rw-r--r-- | include/linux/olpc-ec.h | 41 |
13 files changed, 451 insertions, 164 deletions
diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h index 87bdbca72f94..72f9adf6eca4 100644 --- a/arch/x86/include/asm/olpc.h +++ b/arch/x86/include/asm/olpc.h | |||
| @@ -100,25 +100,6 @@ extern void olpc_xo1_pm_wakeup_clear(u16 value); | |||
| 100 | 100 | ||
| 101 | extern int pci_olpc_init(void); | 101 | extern int pci_olpc_init(void); |
| 102 | 102 | ||
| 103 | /* EC related functions */ | ||
| 104 | |||
| 105 | extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, | ||
| 106 | unsigned char *outbuf, size_t outlen); | ||
| 107 | |||
| 108 | /* EC commands */ | ||
| 109 | |||
| 110 | #define EC_FIRMWARE_REV 0x08 | ||
| 111 | #define EC_WRITE_SCI_MASK 0x1b | ||
| 112 | #define EC_WAKE_UP_WLAN 0x24 | ||
| 113 | #define EC_WLAN_LEAVE_RESET 0x25 | ||
| 114 | #define EC_READ_EB_MODE 0x2a | ||
| 115 | #define EC_SET_SCI_INHIBIT 0x32 | ||
| 116 | #define EC_SET_SCI_INHIBIT_RELEASE 0x34 | ||
| 117 | #define EC_WLAN_ENTER_RESET 0x35 | ||
| 118 | #define EC_WRITE_EXT_SCI_MASK 0x38 | ||
| 119 | #define EC_SCI_QUERY 0x84 | ||
| 120 | #define EC_EXT_SCI_QUERY 0x85 | ||
| 121 | |||
| 122 | /* SCI source values */ | 103 | /* SCI source values */ |
| 123 | 104 | ||
| 124 | #define EC_SCI_SRC_EMPTY 0x00 | 105 | #define EC_SCI_SRC_EMPTY 0x00 |
diff --git a/arch/x86/platform/olpc/olpc-xo1-pm.c b/arch/x86/platform/olpc/olpc-xo1-pm.c index 0ce8616c88ae..d75582d1aa55 100644 --- a/arch/x86/platform/olpc/olpc-xo1-pm.c +++ b/arch/x86/platform/olpc/olpc-xo1-pm.c | |||
| @@ -18,6 +18,7 @@ | |||
| 18 | #include <linux/pm.h> | 18 | #include <linux/pm.h> |
| 19 | #include <linux/mfd/core.h> | 19 | #include <linux/mfd/core.h> |
| 20 | #include <linux/suspend.h> | 20 | #include <linux/suspend.h> |
| 21 | #include <linux/olpc-ec.h> | ||
| 21 | 22 | ||
| 22 | #include <asm/io.h> | 23 | #include <asm/io.h> |
| 23 | #include <asm/olpc.h> | 24 | #include <asm/olpc.h> |
| @@ -51,16 +52,11 @@ EXPORT_SYMBOL_GPL(olpc_xo1_pm_wakeup_clear); | |||
| 51 | static int xo1_power_state_enter(suspend_state_t pm_state) | 52 | static int xo1_power_state_enter(suspend_state_t pm_state) |
| 52 | { | 53 | { |
| 53 | unsigned long saved_sci_mask; | 54 | unsigned long saved_sci_mask; |
| 54 | int r; | ||
| 55 | 55 | ||
| 56 | /* Only STR is supported */ | 56 | /* Only STR is supported */ |
| 57 | if (pm_state != PM_SUSPEND_MEM) | 57 | if (pm_state != PM_SUSPEND_MEM) |
| 58 | return -EINVAL; | 58 | return -EINVAL; |
| 59 | 59 | ||
| 60 | r = olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0); | ||
| 61 | if (r) | ||
| 62 | return r; | ||
| 63 | |||
| 64 | /* | 60 | /* |
| 65 | * Save SCI mask (this gets lost since PM1_EN is used as a mask for | 61 | * Save SCI mask (this gets lost since PM1_EN is used as a mask for |
| 66 | * wakeup events, which is not necessarily the same event set) | 62 | * wakeup events, which is not necessarily the same event set) |
| @@ -76,16 +72,6 @@ static int xo1_power_state_enter(suspend_state_t pm_state) | |||
| 76 | /* Restore SCI mask (using dword access to CS5536_PM1_EN) */ | 72 | /* Restore SCI mask (using dword access to CS5536_PM1_EN) */ |
| 77 | outl(saved_sci_mask, acpi_base + CS5536_PM1_STS); | 73 | outl(saved_sci_mask, acpi_base + CS5536_PM1_STS); |
| 78 | 74 | ||
| 79 | /* Tell the EC to stop inhibiting SCIs */ | ||
| 80 | olpc_ec_cmd(EC_SET_SCI_INHIBIT_RELEASE, NULL, 0, NULL, 0); | ||
| 81 | |||
| 82 | /* | ||
| 83 | * Tell the wireless module to restart USB communication. | ||
| 84 | * Must be done twice. | ||
| 85 | */ | ||
| 86 | olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0); | ||
| 87 | olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0); | ||
| 88 | |||
| 89 | return 0; | 75 | return 0; |
| 90 | } | 76 | } |
| 91 | 77 | ||
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c b/arch/x86/platform/olpc/olpc-xo1-sci.c index 04b8c73659c5..63d4aa40956e 100644 --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <linux/power_supply.h> | 23 | #include <linux/power_supply.h> |
| 24 | #include <linux/suspend.h> | 24 | #include <linux/suspend.h> |
| 25 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
| 26 | #include <linux/olpc-ec.h> | ||
| 26 | 27 | ||
| 27 | #include <asm/io.h> | 28 | #include <asm/io.h> |
| 28 | #include <asm/msr.h> | 29 | #include <asm/msr.h> |
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c b/arch/x86/platform/olpc/olpc-xo15-sci.c index 599be499fdf7..2fdca25905ae 100644 --- a/arch/x86/platform/olpc/olpc-xo15-sci.c +++ b/arch/x86/platform/olpc/olpc-xo15-sci.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
| 14 | #include <linux/workqueue.h> | 14 | #include <linux/workqueue.h> |
| 15 | #include <linux/power_supply.h> | 15 | #include <linux/power_supply.h> |
| 16 | #include <linux/olpc-ec.h> | ||
| 16 | 17 | ||
| 17 | #include <acpi/acpi_bus.h> | 18 | #include <acpi/acpi_bus.h> |
| 18 | #include <acpi/acpi_drivers.h> | 19 | #include <acpi/acpi_drivers.h> |
diff --git a/arch/x86/platform/olpc/olpc.c b/arch/x86/platform/olpc/olpc.c index a4bee53c2e54..27376081ddec 100644 --- a/arch/x86/platform/olpc/olpc.c +++ b/arch/x86/platform/olpc/olpc.c | |||
| @@ -14,14 +14,13 @@ | |||
| 14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
| 15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| 16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 17 | #include <linux/spinlock.h> | ||
| 18 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 19 | #include <linux/string.h> | 18 | #include <linux/string.h> |
| 20 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
| 21 | #include <linux/of.h> | 20 | #include <linux/of.h> |
| 22 | #include <linux/syscore_ops.h> | 21 | #include <linux/syscore_ops.h> |
| 23 | #include <linux/debugfs.h> | ||
| 24 | #include <linux/mutex.h> | 22 | #include <linux/mutex.h> |
| 23 | #include <linux/olpc-ec.h> | ||
| 25 | 24 | ||
| 26 | #include <asm/geode.h> | 25 | #include <asm/geode.h> |
| 27 | #include <asm/setup.h> | 26 | #include <asm/setup.h> |
| @@ -31,17 +30,6 @@ | |||
| 31 | struct olpc_platform_t olpc_platform_info; | 30 | struct olpc_platform_t olpc_platform_info; |
| 32 | EXPORT_SYMBOL_GPL(olpc_platform_info); | 31 | EXPORT_SYMBOL_GPL(olpc_platform_info); |
| 33 | 32 | ||
| 34 | static DEFINE_SPINLOCK(ec_lock); | ||
| 35 | |||
| 36 | /* debugfs interface to EC commands */ | ||
| 37 | #define EC_MAX_CMD_ARGS (5 + 1) /* cmd byte + 5 args */ | ||
| 38 | #define EC_MAX_CMD_REPLY (8) | ||
| 39 | |||
| 40 | static struct dentry *ec_debugfs_dir; | ||
| 41 | static DEFINE_MUTEX(ec_debugfs_cmd_lock); | ||
| 42 | static unsigned char ec_debugfs_resp[EC_MAX_CMD_REPLY]; | ||
| 43 | static unsigned int ec_debugfs_resp_bytes; | ||
| 44 | |||
| 45 | /* EC event mask to be applied during suspend (defining wakeup sources). */ | 33 | /* EC event mask to be applied during suspend (defining wakeup sources). */ |
| 46 | static u16 ec_wakeup_mask; | 34 | static u16 ec_wakeup_mask; |
| 47 | 35 | ||
| @@ -125,16 +113,13 @@ static int __wait_on_obf(unsigned int line, unsigned int port, int desired) | |||
| 125 | * <http://wiki.laptop.org/go/Ec_specification>. Unfortunately, while | 113 | * <http://wiki.laptop.org/go/Ec_specification>. Unfortunately, while |
| 126 | * OpenFirmware's source is available, the EC's is not. | 114 | * OpenFirmware's source is available, the EC's is not. |
| 127 | */ | 115 | */ |
| 128 | int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen, | 116 | static int olpc_xo1_ec_cmd(u8 cmd, u8 *inbuf, size_t inlen, u8 *outbuf, |
| 129 | unsigned char *outbuf, size_t outlen) | 117 | size_t outlen, void *arg) |
| 130 | { | 118 | { |
| 131 | unsigned long flags; | ||
| 132 | int ret = -EIO; | 119 | int ret = -EIO; |
| 133 | int i; | 120 | int i; |
| 134 | int restarts = 0; | ||
