diff options
author | ryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-02-19 04:03:49 +0000 |
---|---|---|
committer | ryd <ryd@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-02-19 04:03:49 +0000 |
commit | e4a3634c00818e77664da2c3592a95e8c8fad5d6 (patch) | |
tree | 5aec8287ecd3034c53cbbeb5a6408389b1d34507 /target/linux/olpc/files-2.6.23/include | |
parent | ac24192a897d17c7416cfc1a58ad5432404662de (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')
-rw-r--r-- | target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h | 16 | ||||
-rw-r--r-- | target/linux/olpc/files-2.6.23/include/asm-i386/olpc.h | 116 | ||||
-rw-r--r-- | target/linux/olpc/files-2.6.23/include/asm-i386/prom.h | 108 | ||||
-rw-r--r-- | target/linux/olpc/files-2.6.23/include/linux/battery.h | 101 |
4 files changed, 341 insertions, 0 deletions
diff --git a/target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h b/target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h new file mode 100644 index 000000000..79b08b164 --- /dev/null +++ b/target/linux/olpc/files-2.6.23/include/asm-i386/ofw.h @@ -0,0 +1,16 @@ +/* + * Definitions for Open Firmware client interface on 32-bit system. + * OF Cell size is 4. Integer properties are encoded big endian, + * as with all OF implementations. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#ifndef _OFW_H +#define _OFW_H + +extern int ofw(char *, int, int, ...); + +#endif 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 + diff --git a/target/linux/olpc/files-2.6.23/include/asm-i386/prom.h b/target/linux/olpc/files-2.6.23/include/asm-i386/prom.h new file mode 100644 index 000000000..59d3bddcc --- /dev/null +++ b/target/linux/olpc/files-2.6.23/include/asm-i386/prom.h @@ -0,0 +1,108 @@ +#ifndef _I386_PROM_H +#define _I386_PROM_H +#ifdef __KERNEL__ + + +/* + * Definitions for talking to the Open Firmware PROM on + * Power Macintosh computers. + * + * Copyright (C) 1996-2005 Paul Mackerras. + * + * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp. + * Updates for SPARC64 by David S. Miller + * Updates for i386/OLPC by Andres Salomon + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ + +#include <linux/types.h> +#include <linux/proc_fs.h> +#include <asm/atomic.h> + +typedef u32 phandle; +typedef u32 ihandle; + +struct property { + char *name; + int length; + void *value; + struct property *next; +}; + +struct device_node { + const char *name; + const char *type; + phandle node; +// phandle linux_phandle; + char *path_component_name; + char *full_name; + + struct property *properties; + struct property *deadprops; /* removed properties */ + struct device_node *parent; + struct device_node *child; + struct device_node *sibling; + struct device_node *next; /* next device of same type */ + struct device_node *allnext; /* next in list of all nodes */ + struct proc_dir_entry *pde; /* this node's proc directory */ + struct kref kref; + unsigned long _flags; + void *data; +}; + +/* flag descriptions */ +#define OF_DYNAMIC 1 /* node and properties were allocated via kmalloc */ + +#define OF_IS_DYNAMIC(x) test_bit(OF_DYNAMIC, &x->_flags) +#define OF_MARK_DYNAMIC(x) set_bit(OF_DYNAMIC, &x->_flags) + +#define OF_BAD_ADDR ((u64)-1) + +static inline void set_node_proc_entry(struct device_node *dn, struct proc_dir_entry *de) +{ + dn->pde = de; +} + +extern struct device_node *of_find_node_by_name(struct device_node *from, + const char *name); +#define for_each_node_by_name(dn, name) \ + for (dn = of_find_node_by_name(NULL, name); dn; \ + dn = of_find_node_by_name(dn, name)) +extern struct device_node *of_find_node_by_type(struct device_node *from, + const char *type); +#define for_each_node_by_type(dn, type) \ + for (dn = of_find_node_by_type(NULL, type); dn; \ + dn = of_find_node_by_type(dn, type)) +extern struct device_node *of_find_compatible_node(struct device_node *from, + const char *type, const char *compat); +extern struct device_node *of_find_node_by_path(const char *path); +extern struct device_node *of_find_node_by_phandle(phandle handle); +extern struct device_node *of_get_parent(const struct device_node *node); +extern struct device_node *of_get_next_child(const struct device_node *node, + struct device_node *prev); +extern struct property *of_find_property(const struct device_node *np, + const char *name, + int *lenp); +//extern struct device_node *of_node_get(struct device_node *node); +//extern void of_node_put(struct device_node *node); +extern int of_device_is_compatible(const struct device_node *device, + const char *); +extern const void *of_get_property(const struct device_node *node, + const char *name, + int *lenp); +#define get_property(node,name,lenp) of_get_property(node,name,lenp) +extern int of_set_property(struct device_node *node, const char *name, void *val, int len); +extern int of_getintprop_default(struct device_node *np, + const char *name, + int def); +extern int of_n_addr_cells(struct device_node *np); +extern int of_n_size_cells(struct device_node *np); + +extern void prom_build_devicetree(void); + +#endif /* __KERNEL__ */ +#endif diff --git a/target/linux/olpc/files-2.6.23/include/linux/battery.h b/target/linux/olpc/files-2.6.23/include/linux/battery.h new file mode 100644 index 000000000..2f856a0d7 --- /dev/null +++ b/target/linux/olpc/files-2.6.23/include/linux/battery.h @@ -0,0 +1,101 @@ +/* + * Driver model for batteries + * + * © 2006 David Woodhouse <dwmw2@infradead.org> + * + * Based on LED Class support, by John Lenz and Richard Purdie: + * + * © 2005 John Lenz <lenz@cs.wisc.edu> + * © 2005-2006 Richard Purdie <rpurdie@openedhand.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#ifndef __LINUX_BATTERY_H__ +#define __LINUX_BATTERY_H__ + +struct device; +struct class_device; + +/* + * Battery Core + */ +#define PWRDEV_TYPE_BATTERY 0 +#define PWRDEV_TYPE_AC 1 + +#define BAT_STAT_PRESENT (1<<0) +#define BAT_STAT_LOW (1<<1) +#define BAT_STAT_FULL (1<<2) +#define BAT_STAT_CHARGING (1<<3) +#define BAT_STAT_DISCHARGING (1<<4) +#define BAT_STAT_OVERTEMP (1<<5) +#define BAT_STAT_CRITICAL (1<<6) +#define BAT_STAT_FIRE (1<<7) +#define BAT_STAT_CHARGE_DONE (1<<8) + +/* Thou shalt not export any attributes in sysfs except these, and + with these units: */ +#define BAT_INFO_STATUS "status" /* Not free-form. Use + provided function */ +#define BAT_INFO_TEMP1 "temp1" /* °C/1000 */ +#define BAT_INFO_TEMP1_NAME "temp1_name" /* string */ + +#define BAT_INFO_TEMP2 "temp2" /* °C/1000 */ +#define BAT_INFO_TEMP2_NAME "temp2_name" /* string */ + +#define BAT_INFO_VOLTAGE "voltage" /* mV */ +#define BAT_INFO_VOLTAGE_DESIGN "voltage_design" /* mV */ + +#define BAT_INFO_CURRENT "current" /* mA */ +#define BAT_INFO_CURRENT_NOW "current_now" /* mA */ + +#define BAT_INFO_POWER "power" /* mW */ +#define BAT_INFO_POWER_NOW "power_now" /* mW */ + +/* The following capacity/charge properties are represented in either + mA or mW. The CAP_UNITS property MUST be provided if any of these are. */ +#define BAT_INFO_RATE "rate" /* CAP_UNITS */ +#define BAT_INFO_CAP_LEFT "capacity_left" /* CAP_UNITS*h */ +#define BAT_INFO_CAP_DESIGN "capacity_design" /* CAP_UNITS*h */ +#define BAT_INFO_CAP_LAST_FULL "capacity_last_full" /* CAP_UNITS*h */ +#define BAT_INFO_CAP_LOW "capacity_low_thresh" /* CAP_UNITS*h */ +#define BAT_INFO_CAP_WARN "capacity_warn_thresh" /* CAP_UNITS*h */ +#define BAT_INFO_CAP_UNITS "capacity_units" /* string: must be + either mA or mW */ + +#define BAT_INFO_CAP_PCT "capacity_percentage" /* integer */ + +#define BAT_INFO_TIME_EMPTY "time_to_empty" /* seconds */ +#define BAT_INFO_TIME_EMPTY_NOW "time_to_empty_now" /* seconds */ +#define BAT_INFO_TIME_FULL "time_to_full" /* seconds */ +#define BAT_INFO_TIME_FULL_NOW "time_to_full_now" /* seconds */ + +#define BAT_INFO_MANUFACTURER "manufacturer" /* string */ +#define BAT_INFO_TECHNOLOGY "technology" /* string */ +#define BAT_INFO_MODEL "model" /* string */ +#define BAT_INFO_SERIAL "serial" /* string */ +#define BAT_INFO_OEM_INFO "oem_info" /* string */ + +#define BAT_INFO_CYCLE_COUNT "cycle_count" /* integer */ +#define BAT_INFO_DATE_MFR "date_manufactured" /* YYYY[-MM[-DD]] */ +#define BAT_INFO_DATE_FIRST_USE "date_first_use" /* YYYY[-MM[-DD]] */ + +struct battery_dev { + int status_cap; + int id; + int type; + const char *name; + + struct device *dev; +}; + +int battery_device_register(struct device *parent, + struct battery_dev *battery_cdev); +void battery_device_unregister(struct battery_dev *battery_cdev); + + +ssize_t battery_attribute_show_status(char *buf, unsigned long status); +ssize_t battery_attribute_show_ac_status(char *buf, unsigned long status); +#endif /* __LINUX_BATTERY_H__ */ |