summaryrefslogtreecommitdiffstats
path: root/target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h
diff options
context:
space:
mode:
authorryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-02-19 04:03:49 +0000
committerryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-02-19 04:03:49 +0000
commite4a3634c00818e77664da2c3592a95e8c8fad5d6 (patch)
tree5aec8287ecd3034c53cbbeb5a6408389b1d34507 /target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h
parentac24192a897d17c7416cfc1a58ad5432404662de (diff)
Adding .24 support for olpc
kernel compiles fine, but graphic support is broken to test new kernel version, change target/linux/olpc/Makefile from .23.16 to .24 git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10493 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h')
-rw-r--r--target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h b/target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h
new file mode 100644
index 000000000..26bc1a8d3
--- /dev/null
+++ b/target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h
@@ -0,0 +1,116 @@
+/* OLPC machine specific definitions */
+
+#ifndef ASM_OLPC_H_
+#define ASM_OLPC_H_
+
+#include <asm/geode.h>
+
+struct olpc_platform_t {
+ int flags;
+ int boardrev;
+ int ecver;
+};
+
+#define OLPC_F_PRESENT 0x01
+#define OLPC_F_DCON 0x02
+#define OLPC_F_VSA 0x04
+
+enum
+{
+ OLPC_REV_A = 0,
+
+ OLPC_REV_PRE_B1,
+ OLPC_REV_B1,
+ OLPC_REV_PRE_B2,
+ OLPC_REV_B2,
+ OLPC_REV_PRE_B3,
+ OLPC_REV_B3,
+ OLPC_REV_B4,
+ OLPC_REV_C1,
+ OLPC_REV_R1,
+ OLPC_REV_UNKNOWN /* this should always come last */
+};
+
+#ifndef CONFIG_OLPC
+
+static inline int machine_is_olpc(void) { return 0; }
+static inline int olpc_has_dcon(void) { return 0; }
+static inline int olpc_has_vsa(void) { return 0; }
+static inline int olpc_get_rev(void) { return OLPC_REV_UNKNOWN; }
+
+#else
+
+extern struct olpc_platform_t olpc_platform_info;
+
+static inline int
+machine_is_olpc(void)
+{
+ return (olpc_platform_info.flags & OLPC_F_PRESENT) ? 1 : 0;
+}
+
+static inline int
+olpc_has_dcon(void)
+{
+ return (olpc_platform_info.flags & OLPC_F_DCON) ? 1 : 0;
+}
+
+static inline int
+olpc_has_vsa(void)
+{
+ return (olpc_platform_info.flags & OLPC_F_VSA) ? 1 : 0;
+}
+
+static inline int
+olpc_get_rev(void)
+{
+ return olpc_platform_info.boardrev;
+}
+
+static inline int
+olpc_rev_after(int rev)
+{
+ return olpc_platform_info.boardrev > rev &&
+ olpc_platform_info.boardrev != OLPC_REV_UNKNOWN;
+}
+
+static inline int
+olpc_rev_before(int rev)
+{
+ return olpc_platform_info.boardrev < rev ||
+ olpc_platform_info.boardrev == OLPC_REV_UNKNOWN;
+}
+
+#endif
+
+/* EC functions */
+
+int olpc_ec_cmd(unsigned char cmd, unsigned char *inbuf, size_t inlen,
+ unsigned char *outbuf, size_t outlen);
+
+void olpc_register_battery_callback(void (*f)(unsigned long));
+void olpc_deregister_battery_callback(void);
+
+/* EC commands and responses */
+
+/* SCI source values */
+
+#define EC_SCI_SRC_EMPTY 0x00
+#define EC_SCI_SRC_GAME 0x01
+#define EC_SCI_SRC_BATTERY 0x02
+#define EC_SCI_SRC_BATSOC 0x04
+#define EC_SCI_SRC_BATERR 0x08
+#define EC_SCI_SRC_EBOOK 0x10
+#define EC_SCI_SRC_WLAN 0x20
+#define EC_SCI_SRC_ACPWR 0x40
+
+/* GPIO assignments */
+
+#define OLPC_GPIO_MIC_AC 1
+#define OLPC_GPIO_DCON_IRQ 7
+#define OLPC_GPIO_THRM_ALRM 10
+#define OLPC_GPIO_WORKAUX 24
+#define OLPC_GPIO_LID 26
+#define OLPC_GPIO_ECSCI 27
+
+#endif
+