[GIT PULL] OLPC platform updates for 3.6

2012-07-31 Thread Andres Salomon
Hi Linus,

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.


The following changes since commit 08843b79fb35d33859e0f8f11a7318341076e4d1:

  Merge branch 'nfsd-next' of git://linux-nfs.org/~bfields/linux (2012-07-31 
14:42:28 -0700)

are available in the git repository at:

  git://dev.laptop.org/users/dilinger/linux-olpc/ for-linus-3.6

Andres Salomon (9):
  Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver
  drivers: OLPC: update various drivers to include olpc-ec.h
  Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to 
call it
  Platform: OLPC: turn EC driver into a platform_driver
  Platform: OLPC: add a suspended flag to the EC driver
  x86: OLPC: switch over to using new EC driver on x86
  Platform: OLPC: move debugfs support from x86 EC driver
  Platform: OLPC: move global variables into priv struct
  x86: OLPC: move s/r-related EC cmds to EC driver

 arch/x86/include/asm/olpc.h|   19 --
 arch/x86/platform/olpc/olpc-xo1-pm.c   |   16 +--
 arch/x86/platform/olpc/olpc-xo1-sci.c  |1 +
 arch/x86/platform/olpc/olpc-xo15-sci.c |1 +
 arch/x86/platform/olpc/olpc.c  |  190 ++
 drivers/net/wireless/libertas/if_usb.c |1 +
 drivers/platform/Makefile  |1 +
 drivers/platform/olpc/Makefile |4 +
 drivers/platform/olpc/olpc-ec.c|  336 
 drivers/platform/x86/xo1-rfkill.c  |3 +-
 drivers/power/olpc_battery.c   |1 +
 drivers/staging/olpc_dcon/olpc_dcon.c  |1 +
 include/linux/olpc-ec.h|   41 
 13 files changed, 451 insertions(+), 164 deletions(-)
 create mode 100644 drivers/platform/olpc/Makefile
 create mode 100644 drivers/platform/olpc/olpc-ec.c
 create mode 100644 include/linux/olpc-ec.h

diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h
index 87bdbca..72f9adf6 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);
 
 extern int pci_olpc_init(void);
 
-/* EC related functions */
-
-extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
-   unsigned char *outbuf, size_t outlen);
-
-/* EC commands */
-
-#define EC_FIRMWARE_REV0x08
-#define EC_WRITE_SCI_MASK  0x1b
-#define EC_WAKE_UP_WLAN0x24
-#define EC_WLAN_LEAVE_RESET0x25
-#define EC_READ_EB_MODE0x2a
-#define EC_SET_SCI_INHIBIT 0x32
-#define EC_SET_SCI_INHIBIT_RELEASE 0x34
-#define EC_WLAN_ENTER_RESET0x35
-#define EC_WRITE_EXT_SCI_MASK  0x38
-#define EC_SCI_QUERY   0x84
-#define EC_EXT_SCI_QUERY   0x85
-
 /* SCI source values */
 
 #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 0ce8616c..d75582d 100644
--- a/arch/x86/platform/olpc/olpc-xo1-pm.c
+++ b/arch/x86/platform/olpc/olpc-xo1-pm.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -51,16 +52,11 @@ EXPORT_SYMBOL_GPL(olpc_xo1_pm_wakeup_clear);
 static int xo1_power_state_enter(suspend_state_t pm_state)
 {
unsigned long saved_sci_mask;
-   int r;
 
/* Only STR is supported */
if (pm_state != PM_SUSPEND_MEM)
return -EINVAL;
 
-   r = olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0);
-   if (r)
-   return r;
-
/*
 * Save SCI mask (this gets lost since PM1_EN is used as a mask for
 * 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)
/* Restore SCI mask (using dword access to CS5536_PM1_EN) */
outl(saved_sci_mask, acpi_base + CS5536_PM1_STS);
 
-   /* Tell the EC to stop inhibiting SCIs */
-   olpc_ec_cmd(EC_SET_SCI_INHIBIT_RELEASE, NULL, 0, NULL, 0);
-
-   /*
-* Tell the wireless module to restart USB communication.
-* Must be done twice.
-*/
-   olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
-   olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
-
return 0;
 }
 
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c 
b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 04b8c73..63d4aa4 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
diff --git a/arch/x86/platform/olpc/olpc-xo15-sci.c 
b/arch/x86/platform/olpc/olpc-xo15-sci.c
index 

[GIT PULL] OLPC platform updates for 3.6

2012-07-31 Thread Andres Salomon
Hi Linus,

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.


The following changes since commit 08843b79fb35d33859e0f8f11a7318341076e4d1:

  Merge branch 'nfsd-next' of git://linux-nfs.org/~bfields/linux (2012-07-31 
14:42:28 -0700)

are available in the git repository at:

  git://dev.laptop.org/users/dilinger/linux-olpc/ for-linus-3.6

Andres Salomon (9):
  Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver
  drivers: OLPC: update various drivers to include olpc-ec.h
  Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to 
call it
  Platform: OLPC: turn EC driver into a platform_driver
  Platform: OLPC: add a suspended flag to the EC driver
  x86: OLPC: switch over to using new EC driver on x86
  Platform: OLPC: move debugfs support from x86 EC driver
  Platform: OLPC: move global variables into priv struct
  x86: OLPC: move s/r-related EC cmds to EC driver

 arch/x86/include/asm/olpc.h|   19 --
 arch/x86/platform/olpc/olpc-xo1-pm.c   |   16 +--
 arch/x86/platform/olpc/olpc-xo1-sci.c  |1 +
 arch/x86/platform/olpc/olpc-xo15-sci.c |1 +
 arch/x86/platform/olpc/olpc.c  |  190 ++
 drivers/net/wireless/libertas/if_usb.c |1 +
 drivers/platform/Makefile  |1 +
 drivers/platform/olpc/Makefile |4 +
 drivers/platform/olpc/olpc-ec.c|  336 
 drivers/platform/x86/xo1-rfkill.c  |3 +-
 drivers/power/olpc_battery.c   |1 +
 drivers/staging/olpc_dcon/olpc_dcon.c  |1 +
 include/linux/olpc-ec.h|   41 
 13 files changed, 451 insertions(+), 164 deletions(-)
 create mode 100644 drivers/platform/olpc/Makefile
 create mode 100644 drivers/platform/olpc/olpc-ec.c
 create mode 100644 include/linux/olpc-ec.h

diff --git a/arch/x86/include/asm/olpc.h b/arch/x86/include/asm/olpc.h
index 87bdbca..72f9adf6 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);
 
 extern int pci_olpc_init(void);
 
-/* EC related functions */
-
-extern int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
-   unsigned char *outbuf, size_t outlen);
-
-/* EC commands */
-
-#define EC_FIRMWARE_REV0x08
-#define EC_WRITE_SCI_MASK  0x1b
-#define EC_WAKE_UP_WLAN0x24
-#define EC_WLAN_LEAVE_RESET0x25
-#define EC_READ_EB_MODE0x2a
-#define EC_SET_SCI_INHIBIT 0x32
-#define EC_SET_SCI_INHIBIT_RELEASE 0x34
-#define EC_WLAN_ENTER_RESET0x35
-#define EC_WRITE_EXT_SCI_MASK  0x38
-#define EC_SCI_QUERY   0x84
-#define EC_EXT_SCI_QUERY   0x85
-
 /* SCI source values */
 
 #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 0ce8616c..d75582d 100644
--- a/arch/x86/platform/olpc/olpc-xo1-pm.c
+++ b/arch/x86/platform/olpc/olpc-xo1-pm.c
@@ -18,6 +18,7 @@
 #include linux/pm.h
 #include linux/mfd/core.h
 #include linux/suspend.h
+#include linux/olpc-ec.h
 
 #include asm/io.h
 #include asm/olpc.h
@@ -51,16 +52,11 @@ EXPORT_SYMBOL_GPL(olpc_xo1_pm_wakeup_clear);
 static int xo1_power_state_enter(suspend_state_t pm_state)
 {
unsigned long saved_sci_mask;
-   int r;
 
/* Only STR is supported */
if (pm_state != PM_SUSPEND_MEM)
return -EINVAL;
 
-   r = olpc_ec_cmd(EC_SET_SCI_INHIBIT, NULL, 0, NULL, 0);
-   if (r)
-   return r;
-
/*
 * Save SCI mask (this gets lost since PM1_EN is used as a mask for
 * 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)
/* Restore SCI mask (using dword access to CS5536_PM1_EN) */
outl(saved_sci_mask, acpi_base + CS5536_PM1_STS);
 
-   /* Tell the EC to stop inhibiting SCIs */
-   olpc_ec_cmd(EC_SET_SCI_INHIBIT_RELEASE, NULL, 0, NULL, 0);
-
-   /*
-* Tell the wireless module to restart USB communication.
-* Must be done twice.
-*/
-   olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
-   olpc_ec_cmd(EC_WAKE_UP_WLAN, NULL, 0, NULL, 0);
-
return 0;
 }
 
diff --git a/arch/x86/platform/olpc/olpc-xo1-sci.c 
b/arch/x86/platform/olpc/olpc-xo1-sci.c
index 04b8c73..63d4aa4 100644
--- a/arch/x86/platform/olpc/olpc-xo1-sci.c
+++ b/arch/x86/platform/olpc/olpc-xo1-sci.c
@@ -23,6 +23,7 @@
 #include linux/power_supply.h
 #include linux/suspend.h
 #include linux/workqueue.h
+#include