mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-04-21 12:27:27 +03:00
omap24xx: Add linux 2.6.37 config/patches
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23888 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
355
target/linux/omap24xx/patches-2.6.37/100-optimized-arm-div.patch
Normal file
355
target/linux/omap24xx/patches-2.6.37/100-optimized-arm-div.patch
Normal file
@@ -0,0 +1,355 @@
|
||||
---
|
||||
arch/arm/boot/compressed/lib1funcs.S | 348 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 348 insertions(+)
|
||||
|
||||
--- /dev/null
|
||||
+++ linux-2.6.35/arch/arm/boot/compressed/lib1funcs.S
|
||||
@@ -0,0 +1,348 @@
|
||||
+/*
|
||||
+ * linux/arch/arm/lib/lib1funcs.S: Optimized ARM division routines
|
||||
+ *
|
||||
+ * Author: Nicolas Pitre <nico@fluxnic.net>
|
||||
+ * - contributed to gcc-3.4 on Sep 30, 2003
|
||||
+ * - adapted for the Linux kernel on Oct 2, 2003
|
||||
+ */
|
||||
+
|
||||
+/* Copyright 1995, 1996, 1998, 1999, 2000, 2003 Free Software Foundation, Inc.
|
||||
+
|
||||
+This file 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, or (at your option) any
|
||||
+later version.
|
||||
+
|
||||
+In addition to the permissions in the GNU General Public License, the
|
||||
+Free Software Foundation gives you unlimited permission to link the
|
||||
+compiled version of this file into combinations with other programs,
|
||||
+and to distribute those combinations without any restriction coming
|
||||
+from the use of this file. (The General Public License restrictions
|
||||
+do apply in other respects; for example, they cover modification of
|
||||
+the file, and distribution when not linked into a combine
|
||||
+executable.)
|
||||
+
|
||||
+This file is distributed in the hope that it will be useful, but
|
||||
+WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
+General Public License for more details.
|
||||
+
|
||||
+You should have received a copy of the GNU General Public License
|
||||
+along with this program; see the file COPYING. If not, write to
|
||||
+the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
+Boston, MA 02111-1307, USA. */
|
||||
+
|
||||
+
|
||||
+#include <linux/linkage.h>
|
||||
+#include <asm/assembler.h>
|
||||
+
|
||||
+
|
||||
+.macro ARM_DIV_BODY dividend, divisor, result, curbit
|
||||
+
|
||||
+#if __LINUX_ARM_ARCH__ >= 5
|
||||
+
|
||||
+ clz \curbit, \divisor
|
||||
+ clz \result, \dividend
|
||||
+ sub \result, \curbit, \result
|
||||
+ mov \curbit, #1
|
||||
+ mov \divisor, \divisor, lsl \result
|
||||
+ mov \curbit, \curbit, lsl \result
|
||||
+ mov \result, #0
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+ @ Initially shift the divisor left 3 bits if possible,
|
||||
+ @ set curbit accordingly. This allows for curbit to be located
|
||||
+ @ at the left end of each 4 bit nibbles in the division loop
|
||||
+ @ to save one loop in most cases.
|
||||
+ tst \divisor, #0xe0000000
|
||||
+ moveq \divisor, \divisor, lsl #3
|
||||
+ moveq \curbit, #8
|
||||
+ movne \curbit, #1
|
||||
+
|
||||
+ @ Unless the divisor is very big, shift it up in multiples of
|
||||
+ @ four bits, since this is the amount of unwinding in the main
|
||||
+ @ division loop. Continue shifting until the divisor is
|
||||
+ @ larger than the dividend.
|
||||
+1: cmp \divisor, #0x10000000
|
||||
+ cmplo \divisor, \dividend
|
||||
+ movlo \divisor, \divisor, lsl #4
|
||||
+ movlo \curbit, \curbit, lsl #4
|
||||
+ blo 1b
|
||||
+
|
||||
+ @ For very big divisors, we must shift it a bit at a time, or
|
||||
+ @ we will be in danger of overflowing.
|
||||
+1: cmp \divisor, #0x80000000
|
||||
+ cmplo \divisor, \dividend
|
||||
+ movlo \divisor, \divisor, lsl #1
|
||||
+ movlo \curbit, \curbit, lsl #1
|
||||
+ blo 1b
|
||||
+
|
||||
+ mov \result, #0
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+ @ Division loop
|
||||
+1: cmp \dividend, \divisor
|
||||
+ subhs \dividend, \dividend, \divisor
|
||||
+ orrhs \result, \result, \curbit
|
||||
+ cmp \dividend, \divisor, lsr #1
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #1
|
||||
+ orrhs \result, \result, \curbit, lsr #1
|
||||
+ cmp \dividend, \divisor, lsr #2
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #2
|
||||
+ orrhs \result, \result, \curbit, lsr #2
|
||||
+ cmp \dividend, \divisor, lsr #3
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #3
|
||||
+ orrhs \result, \result, \curbit, lsr #3
|
||||
+ cmp \dividend, #0 @ Early termination?
|
||||
+ movnes \curbit, \curbit, lsr #4 @ No, any more bits to do?
|
||||
+ movne \divisor, \divisor, lsr #4
|
||||
+ bne 1b
|
||||
+
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+.macro ARM_DIV2_ORDER divisor, order
|
||||
+
|
||||
+#if __LINUX_ARM_ARCH__ >= 5
|
||||
+
|
||||
+ clz \order, \divisor
|
||||
+ rsb \order, \order, #31
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+ cmp \divisor, #(1 << 16)
|
||||
+ movhs \divisor, \divisor, lsr #16
|
||||
+ movhs \order, #16
|
||||
+ movlo \order, #0
|
||||
+
|
||||
+ cmp \divisor, #(1 << 8)
|
||||
+ movhs \divisor, \divisor, lsr #8
|
||||
+ addhs \order, \order, #8
|
||||
+
|
||||
+ cmp \divisor, #(1 << 4)
|
||||
+ movhs \divisor, \divisor, lsr #4
|
||||
+ addhs \order, \order, #4
|
||||
+
|
||||
+ cmp \divisor, #(1 << 2)
|
||||
+ addhi \order, \order, #3
|
||||
+ addls \order, \order, \divisor, lsr #1
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+.macro ARM_MOD_BODY dividend, divisor, order, spare
|
||||
+
|
||||
+#if __LINUX_ARM_ARCH__ >= 5
|
||||
+
|
||||
+ clz \order, \divisor
|
||||
+ clz \spare, \dividend
|
||||
+ sub \order, \order, \spare
|
||||
+ mov \divisor, \divisor, lsl \order
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+ mov \order, #0
|
||||
+
|
||||
+ @ Unless the divisor is very big, shift it up in multiples of
|
||||
+ @ four bits, since this is the amount of unwinding in the main
|
||||
+ @ division loop. Continue shifting until the divisor is
|
||||
+ @ larger than the dividend.
|
||||
+1: cmp \divisor, #0x10000000
|
||||
+ cmplo \divisor, \dividend
|
||||
+ movlo \divisor, \divisor, lsl #4
|
||||
+ addlo \order, \order, #4
|
||||
+ blo 1b
|
||||
+
|
||||
+ @ For very big divisors, we must shift it a bit at a time, or
|
||||
+ @ we will be in danger of overflowing.
|
||||
+1: cmp \divisor, #0x80000000
|
||||
+ cmplo \divisor, \dividend
|
||||
+ movlo \divisor, \divisor, lsl #1
|
||||
+ addlo \order, \order, #1
|
||||
+ blo 1b
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+ @ Perform all needed substractions to keep only the reminder.
|
||||
+ @ Do comparisons in batch of 4 first.
|
||||
+ subs \order, \order, #3 @ yes, 3 is intended here
|
||||
+ blt 2f
|
||||
+
|
||||
+1: cmp \dividend, \divisor
|
||||
+ subhs \dividend, \dividend, \divisor
|
||||
+ cmp \dividend, \divisor, lsr #1
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #1
|
||||
+ cmp \dividend, \divisor, lsr #2
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #2
|
||||
+ cmp \dividend, \divisor, lsr #3
|
||||
+ subhs \dividend, \dividend, \divisor, lsr #3
|
||||
+ cmp \dividend, #1
|
||||
+ mov \divisor, \divisor, lsr #4
|
||||
+ subges \order, \order, #4
|
||||
+ bge 1b
|
||||
+
|
||||
+ tst \order, #3
|
||||
+ teqne \dividend, #0
|
||||
+ beq 5f
|
||||
+
|
||||
+ @ Either 1, 2 or 3 comparison/substractions are left.
|
||||
+2: cmn \order, #2
|
||||
+ blt 4f
|
||||
+ beq 3f
|
||||
+ cmp \dividend, \divisor
|
||||
+ subhs \dividend, \dividend, \divisor
|
||||
+ mov \divisor, \divisor, lsr #1
|
||||
+3: cmp \dividend, \divisor
|
||||
+ subhs \dividend, \dividend, \divisor
|
||||
+ mov \divisor, \divisor, lsr #1
|
||||
+4: cmp \dividend, \divisor
|
||||
+ subhs \dividend, \dividend, \divisor
|
||||
+5:
|
||||
+.endm
|
||||
+
|
||||
+
|
||||
+ENTRY(__udivsi3)
|
||||
+ENTRY(__aeabi_uidiv)
|
||||
+
|
||||
+ subs r2, r1, #1
|
||||
+ moveq pc, lr
|
||||
+ bcc Ldiv0
|
||||
+ cmp r0, r1
|
||||
+ bls 11f
|
||||
+ tst r1, r2
|
||||
+ beq 12f
|
||||
+
|
||||
+ ARM_DIV_BODY r0, r1, r2, r3
|
||||
+
|
||||
+ mov r0, r2
|
||||
+ mov pc, lr
|
||||
+
|
||||
+11: moveq r0, #1
|
||||
+ movne r0, #0
|
||||
+ mov pc, lr
|
||||
+
|
||||
+12: ARM_DIV2_ORDER r1, r2
|
||||
+
|
||||
+ mov r0, r0, lsr r2
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__udivsi3)
|
||||
+ENDPROC(__aeabi_uidiv)
|
||||
+
|
||||
+ENTRY(__umodsi3)
|
||||
+
|
||||
+ subs r2, r1, #1 @ compare divisor with 1
|
||||
+ bcc Ldiv0
|
||||
+ cmpne r0, r1 @ compare dividend with divisor
|
||||
+ moveq r0, #0
|
||||
+ tsthi r1, r2 @ see if divisor is power of 2
|
||||
+ andeq r0, r0, r2
|
||||
+ movls pc, lr
|
||||
+
|
||||
+ ARM_MOD_BODY r0, r1, r2, r3
|
||||
+
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__umodsi3)
|
||||
+
|
||||
+ENTRY(__divsi3)
|
||||
+ENTRY(__aeabi_idiv)
|
||||
+
|
||||
+ cmp r1, #0
|
||||
+ eor ip, r0, r1 @ save the sign of the result.
|
||||
+ beq Ldiv0
|
||||
+ rsbmi r1, r1, #0 @ loops below use unsigned.
|
||||
+ subs r2, r1, #1 @ division by 1 or -1 ?
|
||||
+ beq 10f
|
||||
+ movs r3, r0
|
||||
+ rsbmi r3, r0, #0 @ positive dividend value
|
||||
+ cmp r3, r1
|
||||
+ bls 11f
|
||||
+ tst r1, r2 @ divisor is power of 2 ?
|
||||
+ beq 12f
|
||||
+
|
||||
+ ARM_DIV_BODY r3, r1, r0, r2
|
||||
+
|
||||
+ cmp ip, #0
|
||||
+ rsbmi r0, r0, #0
|
||||
+ mov pc, lr
|
||||
+
|
||||
+10: teq ip, r0 @ same sign ?
|
||||
+ rsbmi r0, r0, #0
|
||||
+ mov pc, lr
|
||||
+
|
||||
+11: movlo r0, #0
|
||||
+ moveq r0, ip, asr #31
|
||||
+ orreq r0, r0, #1
|
||||
+ mov pc, lr
|
||||
+
|
||||
+12: ARM_DIV2_ORDER r1, r2
|
||||
+
|
||||
+ cmp ip, #0
|
||||
+ mov r0, r3, lsr r2
|
||||
+ rsbmi r0, r0, #0
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__divsi3)
|
||||
+ENDPROC(__aeabi_idiv)
|
||||
+
|
||||
+ENTRY(__modsi3)
|
||||
+
|
||||
+ cmp r1, #0
|
||||
+ beq Ldiv0
|
||||
+ rsbmi r1, r1, #0 @ loops below use unsigned.
|
||||
+ movs ip, r0 @ preserve sign of dividend
|
||||
+ rsbmi r0, r0, #0 @ if negative make positive
|
||||
+ subs r2, r1, #1 @ compare divisor with 1
|
||||
+ cmpne r0, r1 @ compare dividend with divisor
|
||||
+ moveq r0, #0
|
||||
+ tsthi r1, r2 @ see if divisor is power of 2
|
||||
+ andeq r0, r0, r2
|
||||
+ bls 10f
|
||||
+
|
||||
+ ARM_MOD_BODY r0, r1, r2, r3
|
||||
+
|
||||
+10: cmp ip, #0
|
||||
+ rsbmi r0, r0, #0
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__modsi3)
|
||||
+
|
||||
+#ifdef CONFIG_AEABI
|
||||
+
|
||||
+ENTRY(__aeabi_uidivmod)
|
||||
+
|
||||
+ stmfd sp!, {r0, r1, ip, lr}
|
||||
+ bl __aeabi_uidiv
|
||||
+ ldmfd sp!, {r1, r2, ip, lr}
|
||||
+ mul r3, r0, r2
|
||||
+ sub r1, r1, r3
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__aeabi_uidivmod)
|
||||
+
|
||||
+ENTRY(__aeabi_idivmod)
|
||||
+
|
||||
+ stmfd sp!, {r0, r1, ip, lr}
|
||||
+ bl __aeabi_idiv
|
||||
+ ldmfd sp!, {r1, r2, ip, lr}
|
||||
+ mul r3, r0, r2
|
||||
+ sub r1, r1, r3
|
||||
+ mov pc, lr
|
||||
+
|
||||
+ENDPROC(__aeabi_idivmod)
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
+Ldiv0:
|
||||
+
|
||||
+ str lr, [sp, #-8]!
|
||||
+ bl __div0
|
||||
+ mov r0, #0 @ About as wrong as it could be.
|
||||
+ ldr pc, [sp], #8
|
||||
+
|
||||
+
|
||||
11099
target/linux/omap24xx/patches-2.6.37/200-omap-platform.patch
Normal file
11099
target/linux/omap24xx/patches-2.6.37/200-omap-platform.patch
Normal file
File diff suppressed because it is too large
Load Diff
874
target/linux/omap24xx/patches-2.6.37/300-nokia-board.patch
Normal file
874
target/linux/omap24xx/patches-2.6.37/300-nokia-board.patch
Normal file
@@ -0,0 +1,874 @@
|
||||
---
|
||||
arch/arm/mach-omap1/board-nokia770.c | 16 +
|
||||
arch/arm/mach-omap2/Kconfig | 10
|
||||
arch/arm/mach-omap2/Makefile | 2
|
||||
arch/arm/mach-omap2/board-n8x0-lcd.c | 127 ++++++++++++
|
||||
arch/arm/mach-omap2/board-n8x0-usb.c | 175 +++++++++++++++++
|
||||
arch/arm/mach-omap2/board-n8x0.c | 355 ++++++++++++++++++++++++++---------
|
||||
arch/arm/mach-omap2/control.c | 2
|
||||
arch/arm/mach-omap2/serial.c | 8
|
||||
8 files changed, 608 insertions(+), 87 deletions(-)
|
||||
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap1/board-nokia770.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap1/board-nokia770.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap1/board-nokia770.c 2010-11-05 17:36:26.186000001 +0100
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <plat/lcd_mipid.h>
|
||||
#include <plat/mmc.h>
|
||||
#include <plat/clock.h>
|
||||
+#include <plat/cbus.h>
|
||||
|
||||
#define ADS7846_PENDOWN_GPIO 15
|
||||
|
||||
@@ -95,8 +96,23 @@
|
||||
.resource = nokia770_kp_resources,
|
||||
};
|
||||
|
||||
+static struct cbus_host_platform_data nokia770_cbus_data = {
|
||||
+ .clk_gpio = OMAP_MPUIO(11),
|
||||
+ .dat_gpio = OMAP_MPUIO(10),
|
||||
+ .sel_gpio = OMAP_MPUIO(9),
|
||||
+};
|
||||
+
|
||||
+static struct platform_device nokia770_cbus_device = {
|
||||
+ .name = "cbus",
|
||||
+ .id = -1,
|
||||
+ .dev = {
|
||||
+ .platform_data = &nokia770_cbus_data,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
static struct platform_device *nokia770_devices[] __initdata = {
|
||||
&nokia770_kp_device,
|
||||
+ &nokia770_cbus_device,
|
||||
};
|
||||
|
||||
static void mipid_shutdown(struct mipid_platform_data *pdata)
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/board-n8x0.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c 2010-11-05 17:37:40.169999973 +0100
|
||||
@@ -18,9 +18,13 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/i2c.h>
|
||||
+#include <linux/platform_device.h>
|
||||
#include <linux/spi/spi.h>
|
||||
+#include <linux/spi/tsc2005.h>
|
||||
+#include <linux/input.h>
|
||||
#include <linux/usb/musb.h>
|
||||
#include <sound/tlv320aic3x.h>
|
||||
+#include <linux/i2c/lm8323.h>
|
||||
|
||||
#include <asm/mach/arch.h>
|
||||
#include <asm/mach-types.h>
|
||||
@@ -33,6 +37,8 @@
|
||||
#include <plat/onenand.h>
|
||||
#include <plat/mmc.h>
|
||||
#include <plat/serial.h>
|
||||
+#include <plat/cbus.h>
|
||||
+#include <plat/gpio-switch.h>
|
||||
|
||||
#include "mux.h"
|
||||
|
||||
@@ -40,109 +46,156 @@
|
||||
static int slot2_cover_open;
|
||||
static struct device *mmc_device;
|
||||
|
||||
-#define TUSB6010_ASYNC_CS 1
|
||||
-#define TUSB6010_SYNC_CS 4
|
||||
-#define TUSB6010_GPIO_INT 58
|
||||
-#define TUSB6010_GPIO_ENABLE 0
|
||||
-#define TUSB6010_DMACHAN 0x3f
|
||||
-
|
||||
-#if defined(CONFIG_USB_TUSB6010) || \
|
||||
- defined(CONFIG_USB_TUSB6010_MODULE)
|
||||
-/*
|
||||
- * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
|
||||
- * 1.5 V voltage regulators of PM companion chip. Companion chip will then
|
||||
- * provide then PGOOD signal to TUSB6010 which will release it from reset.
|
||||
- */
|
||||
-static int tusb_set_power(int state)
|
||||
-{
|
||||
- int i, retval = 0;
|
||||
+#define RX51_TSC2005_RESET_GPIO 94
|
||||
+#define RX51_TSC2005_IRQ_GPIO 106
|
||||
+#define OMAP_TAG_NOKIA_BT 0x4e01
|
||||
+
|
||||
+#if 0
|
||||
+static s16 rx44_keymap[LM8323_KEYMAP_SIZE] = {
|
||||
+ [0x01] = KEY_Q,
|
||||
+ [0x02] = KEY_K,
|
||||
+ [0x03] = KEY_O,
|
||||
+ [0x04] = KEY_P,
|
||||
+ [0x05] = KEY_BACKSPACE,
|
||||
+ [0x06] = KEY_A,
|
||||
+ [0x07] = KEY_S,
|
||||
+ [0x08] = KEY_D,
|
||||
+ [0x09] = KEY_F,
|
||||
+ [0x0a] = KEY_G,
|
||||
+ [0x0b] = KEY_H,
|
||||
+ [0x0c] = KEY_J,
|
||||
+
|
||||
+ [0x11] = KEY_W,
|
||||
+ [0x12] = KEY_F4,
|
||||
+ [0x13] = KEY_L,
|
||||
+ [0x14] = KEY_APOSTROPHE,
|
||||
+ [0x16] = KEY_Z,
|
||||
+ [0x17] = KEY_X,
|
||||
+ [0x18] = KEY_C,
|
||||
+ [0x19] = KEY_V,
|
||||
+ [0x1a] = KEY_B,
|
||||
+ [0x1b] = KEY_N,
|
||||
+ [0x1c] = KEY_LEFTSHIFT, /* Actually, this is both shift keys */
|
||||
+ [0x1f] = KEY_F7,
|
||||
+
|
||||
+ [0x21] = KEY_E,
|
||||
+ [0x22] = KEY_SEMICOLON,
|
||||
+ [0x23] = KEY_MINUS,
|
||||
+ [0x24] = KEY_EQUAL,
|
||||
+ [0x2b] = KEY_FN,
|
||||
+ [0x2c] = KEY_M,
|
||||
+ [0x2f] = KEY_F8,
|
||||
+
|
||||
+ [0x31] = KEY_R,
|
||||
+ [0x32] = KEY_RIGHTCTRL,
|
||||
+ [0x34] = KEY_SPACE,
|
||||
+ [0x35] = KEY_COMMA,
|
||||
+ [0x37] = KEY_UP,
|
||||
+ [0x3c] = KEY_COMPOSE,
|
||||
+ [0x3f] = KEY_F6,
|
||||
+
|
||||
+ [0x41] = KEY_T,
|
||||
+ [0x44] = KEY_DOT,
|
||||
+ [0x46] = KEY_RIGHT,
|
||||
+ [0x4f] = KEY_F5,
|
||||
+ [0x51] = KEY_Y,
|
||||
+ [0x53] = KEY_DOWN,
|
||||
+ [0x55] = KEY_ENTER,
|
||||
+ [0x5f] = KEY_ESC,
|
||||
+
|
||||
+ [0x61] = KEY_U,
|
||||
+ [0x64] = KEY_LEFT,
|
||||
+
|
||||
+ [0x71] = KEY_I,
|
||||
+ [0x75] = KEY_KPENTER,
|
||||
+};
|
||||
+
|
||||
+static struct lm8323_platform_data lm8323_pdata = {
|
||||
+ .repeat = 0, /* Repeat is handled in userspace for now. */
|
||||
+ .keymap = rx44_keymap,
|
||||
+ .size_x = 8,
|
||||
+ .size_y = 12,
|
||||
+ .debounce_time = 12,
|
||||
+ .active_time = 500,
|
||||
+
|
||||
+ .name = "Internal keyboard",
|
||||
+ .pwm_names[0] = "n810::keyboard",
|
||||
+ .pwm_names[1] = "n810::cover",
|
||||
+ //.pwm1_name = "n810::keyboard",
|
||||
+ //.pwm2_name = "n810::cover",
|
||||
+};
|
||||
+#endif
|
||||
|
||||
- if (state) {
|
||||
- gpio_set_value(TUSB6010_GPIO_ENABLE, 1);
|
||||
- msleep(1);
|
||||
+struct omap_bluetooth_config {
|
||||
+ u8 chip_type;
|
||||
+ u8 bt_wakeup_gpio;
|
||||
+ u8 host_wakeup_gpio;
|
||||
+ u8 reset_gpio;
|
||||
+ u8 bt_uart;
|
||||
+ u8 bd_addr[6];
|
||||
+ u8 bt_sysclk;
|
||||
+};
|
||||
+
|
||||
+static struct platform_device n8x0_bt_device = {
|
||||
+ .name = "hci_h4p",
|
||||
+ .id = -1,
|
||||
+ .num_resources = 0,
|
||||
+};
|
||||
+
|
||||
+void __init n8x0_bt_init(void)
|
||||
+{
|
||||
+ const struct omap_bluetooth_config *bt_config;
|
||||
+
|
||||
+ bt_config = (void *) omap_get_config(OMAP_TAG_NOKIA_BT,
|
||||
+ struct omap_bluetooth_config);
|
||||
+ n8x0_bt_device.dev.platform_data = (void *) bt_config;
|
||||
+ if (platform_device_register(&n8x0_bt_device) < 0)
|
||||
+ BUG();
|
||||
+}
|
||||
|
||||
- /* Wait until TUSB6010 pulls INT pin down */
|
||||
- i = 100;
|
||||
- while (i && gpio_get_value(TUSB6010_GPIO_INT)) {
|
||||
- msleep(1);
|
||||
- i--;
|
||||
- }
|
||||
+static struct omap2_mcspi_device_config mipid_mcspi_config = {
|
||||
+ .turbo_mode = 0,
|
||||
+ .single_channel = 1,
|
||||
+};
|
||||
|
||||
- if (!i) {
|
||||
- printk(KERN_ERR "tusb: powerup failed\n");
|
||||
- retval = -ENODEV;
|
||||
- }
|
||||
- } else {
|
||||
- gpio_set_value(TUSB6010_GPIO_ENABLE, 0);
|
||||
- msleep(10);
|
||||
- }
|
||||
+static int slot1_cover_open;
|
||||
+static int slot2_cover_open;
|
||||
+static struct device *mmc_device;
|
||||
|
||||
- return retval;
|
||||
-}
|
||||
|
||||
-static struct musb_hdrc_config musb_config = {
|
||||
- .multipoint = 1,
|
||||
- .dyn_fifo = 1,
|
||||
- .num_eps = 16,
|
||||
- .ram_bits = 12,
|
||||
+static struct omap2_mcspi_device_config p54spi_mcspi_config = {
|
||||
+ .turbo_mode = 0,
|
||||
+ .single_channel = 1,
|
||||
};
|
||||
|
||||
-static struct musb_hdrc_platform_data tusb_data = {
|
||||
-#if defined(CONFIG_USB_MUSB_OTG)
|
||||
- .mode = MUSB_OTG,
|
||||
-#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
|
||||
- .mode = MUSB_PERIPHERAL,
|
||||
-#else /* defined(CONFIG_USB_MUSB_HOST) */
|
||||
- .mode = MUSB_HOST,
|
||||
+#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
|
||||
+extern struct mipid_platform_data n8x0_mipid_platform_data;
|
||||
#endif
|
||||
- .set_power = tusb_set_power,
|
||||
- .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
|
||||
- .power = 100, /* Max 100 mA VBUS for host mode */
|
||||
- .config = &musb_config,
|
||||
-};
|
||||
|
||||
-static void __init n8x0_usb_init(void)
|
||||
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
|
||||
+static struct tsc2005_platform_data tsc2005_config;
|
||||
+static void rx51_tsc2005_set_reset(bool enable)
|
||||
{
|
||||
- int ret = 0;
|
||||
- static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
|
||||
-
|
||||
- /* PM companion chip power control pin */
|
||||
- ret = gpio_request(TUSB6010_GPIO_ENABLE, "TUSB6010 enable");
|
||||
- if (ret != 0) {
|
||||
- printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
|
||||
- TUSB6010_GPIO_ENABLE);
|
||||
- return;
|
||||
- }
|
||||
- gpio_direction_output(TUSB6010_GPIO_ENABLE, 0);
|
||||
-
|
||||
- tusb_set_power(0);
|
||||
-
|
||||
- ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
|
||||
- TUSB6010_ASYNC_CS, TUSB6010_SYNC_CS,
|
||||
- TUSB6010_GPIO_INT, TUSB6010_DMACHAN);
|
||||
- if (ret != 0)
|
||||
- goto err;
|
||||
-
|
||||
- printk(announce);
|
||||
-
|
||||
- return;
|
||||
-
|
||||
-err:
|
||||
- gpio_free(TUSB6010_GPIO_ENABLE);
|
||||
+ gpio_set_value(RX51_TSC2005_RESET_GPIO, enable);
|
||||
}
|
||||
-#else
|
||||
|
||||
-static void __init n8x0_usb_init(void) {}
|
||||
-
|
||||
-#endif /*CONFIG_USB_TUSB6010 */
|
||||
-
|
||||
-
|
||||
-static struct omap2_mcspi_device_config p54spi_mcspi_config = {
|
||||
+static struct omap2_mcspi_device_config tsc2005_mcspi_config = {
|
||||
.turbo_mode = 0,
|
||||
.single_channel = 1,
|
||||
};
|
||||
+#endif
|
||||
|
||||
static struct spi_board_info n800_spi_board_info[] __initdata = {
|
||||
+#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
|
||||
+ {
|
||||
+ .modalias = "lcd_mipid",
|
||||
+ .bus_num = 1,
|
||||
+ .chip_select = 1,
|
||||
+ .max_speed_hz = 4000000,
|
||||
+ .controller_data= &mipid_mcspi_config,
|
||||
+ .platform_data = &n8x0_mipid_platform_data,
|
||||
+ },
|
||||
+#endif
|
||||
{
|
||||
.modalias = "p54spi",
|
||||
.bus_num = 2,
|
||||
@@ -150,7 +203,71 @@
|
||||
.max_speed_hz = 48000000,
|
||||
.controller_data = &p54spi_mcspi_config,
|
||||
},
|
||||
+ {
|
||||
+ .modalias = "tsc2005",
|
||||
+ .bus_num = 1,
|
||||
+ .chip_select = 0,
|
||||
+ .irq = OMAP_GPIO_IRQ(RX51_TSC2005_IRQ_GPIO),
|
||||
+ .max_speed_hz = 6000000,
|
||||
+ .controller_data = &tsc2005_mcspi_config,
|
||||
+ .platform_data = &tsc2005_config,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static void __init tsc2005_set_config(void)
|
||||
+{
|
||||
+ const struct omap_lcd_config *conf;
|
||||
+
|
||||
+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
|
||||
+ if (conf != NULL) {
|
||||
+#ifdef CONFIG_TOUCHSCREEN_TSC2005
|
||||
+ if (strcmp(conf->panel_name, "lph8923") == 0) {
|
||||
+ tsc2005_config.ts_x_plate_ohm = 180;
|
||||
+ tsc2005_config.ts_hw_avg = 0;
|
||||
+ tsc2005_config.ts_ignore_last = 0;
|
||||
+ tsc2005_config.ts_touch_pressure = 1500;
|
||||
+ tsc2005_config.ts_stab_time = 100;
|
||||
+ tsc2005_config.ts_pressure_max = 2048;
|
||||
+ tsc2005_config.ts_pressure_fudge = 2;
|
||||
+ tsc2005_config.ts_x_max = 4096;
|
||||
+ tsc2005_config.ts_x_fudge = 4;
|
||||
+ tsc2005_config.ts_y_max = 4096;
|
||||
+ tsc2005_config.ts_y_fudge = 7;
|
||||
+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
|
||||
+ } else if (strcmp(conf->panel_name, "ls041y3") == 0) {
|
||||
+ tsc2005_config.ts_x_plate_ohm = 280;
|
||||
+ tsc2005_config.ts_hw_avg = 0;
|
||||
+ tsc2005_config.ts_ignore_last = 0;
|
||||
+ tsc2005_config.ts_touch_pressure = 1500;
|
||||
+ tsc2005_config.ts_stab_time = 1000;
|
||||
+ tsc2005_config.ts_pressure_max = 2048;
|
||||
+ tsc2005_config.ts_pressure_fudge = 2;
|
||||
+ tsc2005_config.ts_x_max = 4096;
|
||||
+ tsc2005_config.ts_x_fudge = 4;
|
||||
+ tsc2005_config.ts_y_max = 4096;
|
||||
+ tsc2005_config.ts_y_fudge = 7;
|
||||
+ tsc2005_config.set_reset = rx51_tsc2005_set_reset;
|
||||
+ } else {
|
||||
+ printk(KERN_ERR "Unknown panel type, set default "
|
||||
+ "touchscreen configuration\n");
|
||||
+ tsc2005_config.ts_x_plate_ohm = 200;
|
||||
+ tsc2005_config.ts_stab_time = 100;
|
||||
+ }
|
||||
+#endif
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+#if 0
|
||||
+static struct i2c_board_info __initdata_or_module n8x0_i2c_board_info_2[] = {};
|
||||
+
|
||||
+static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = {
|
||||
+ {
|
||||
+ I2C_BOARD_INFO("lm8323", 0x45),
|
||||
+ .irq = OMAP_GPIO_IRQ(109),
|
||||
+ .platform_data = &lm8323_pdata,
|
||||
+ },
|
||||
};
|
||||
+#endif
|
||||
|
||||
#if defined(CONFIG_MTD_ONENAND_OMAP2) || \
|
||||
defined(CONFIG_MTD_ONENAND_OMAP2_MODULE)
|
||||
@@ -184,6 +301,20 @@
|
||||
},
|
||||
};
|
||||
|
||||
+static struct cbus_host_platform_data n8x0_cbus_data = {
|
||||
+ .clk_gpio = 66,
|
||||
+ .dat_gpio = 65,
|
||||
+ .sel_gpio = 64,
|
||||
+};
|
||||
+
|
||||
+static struct platform_device n8x0_cbus_device = {
|
||||
+ .name = "cbus",
|
||||
+ .id = -1,
|
||||
+ .dev = {
|
||||
+ .platform_data = &n8x0_cbus_data,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
static struct omap_onenand_platform_data board_onenand_data = {
|
||||
.cs = 0,
|
||||
.gpio_irq = 26,
|
||||
@@ -657,10 +788,62 @@
|
||||
#define board_mux NULL
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_MACH_NOKIA_N8X0_LCD
|
||||
+extern void n8x0_mipid_init(void);
|
||||
+extern void n8x0_blizzard_init(void);
|
||||
+#else
|
||||
+#define n8x0_mipid_init() 0
|
||||
+#define n8x0_blizzard_init() 0
|
||||
+#endif
|
||||
+
|
||||
+extern void n8x0_usb_init(void);
|
||||
+
|
||||
+static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
|
||||
+ {
|
||||
+ .name = "headphone",
|
||||
+ .gpio = -1,
|
||||
+ .debounce_rising = 200,
|
||||
+ .debounce_falling = 200,
|
||||
+ }, {
|
||||
+ .name = "cam_act",
|
||||
+ .gpio = -1,
|
||||
+ .debounce_rising = 200,
|
||||
+ .debounce_falling = 200,
|
||||
+ }, {
|
||||
+ .name = "cam_turn",
|
||||
+ .gpio = -1,
|
||||
+ .debounce_rising = 100,
|
||||
+ .debounce_falling = 100,
|
||||
+ }, {
|
||||
+ .name = "slide",
|
||||
+ .gpio = -1,
|
||||
+ .debounce_rising = 200,
|
||||
+ .debounce_falling = 200,
|
||||
+ }, {
|
||||
+ .name = "kb_lock",
|
||||
+ .gpio = -1,
|
||||
+ .debounce_rising = 200,
|
||||
+ .debounce_falling = 200,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static void __init n8x0_gpio_switches_init(void)
|
||||
+{
|
||||
+ /* The switches are actually registered through ATAG mechanism.
|
||||
+ * This just updates the parameters (thus .gpio is -1) */
|
||||
+ omap_register_gpio_switches(n8x0_gpio_switches,
|
||||
+ ARRAY_SIZE(n8x0_gpio_switches));
|
||||
+}
|
||||
+
|
||||
static void __init n8x0_init_machine(void)
|
||||
{
|
||||
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
|
||||
+ n8x0_gpio_switches_init();
|
||||
+ platform_device_register(&n8x0_cbus_device);
|
||||
+ n8x0_bt_init();
|
||||
+
|
||||
/* FIXME: add n810 spi devices */
|
||||
+ tsc2005_set_config();
|
||||
spi_register_board_info(n800_spi_board_info,
|
||||
ARRAY_SIZE(n800_spi_board_info));
|
||||
omap_register_i2c_bus(1, 400, n8x0_i2c_board_info_1,
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-lcd.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-lcd.c 2010-11-05 17:36:45.209000001 +0100
|
||||
@@ -0,0 +1,127 @@
|
||||
+/*
|
||||
+ * linux/arch/arm/mach-omap2/board-n8x0.c
|
||||
+ *
|
||||
+ * Copyright (C) 2005-2009 Nokia Corporation
|
||||
+ * Author: Juha Yrjola <juha.yrjola@nokia.com>
|
||||
+ *
|
||||
+ * Modified from mach-omap2/board-generic.c
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/omapfb.h>
|
||||
+
|
||||
+#include <plat/lcd_mipid.h>
|
||||
+#include <plat/blizzard.h>
|
||||
+
|
||||
+#include <../drivers/cbus/tahvo.h>
|
||||
+
|
||||
+#define N8X0_BLIZZARD_POWERDOWN_GPIO 15
|
||||
+
|
||||
+// MIPID LCD Panel
|
||||
+
|
||||
+static void mipid_shutdown(struct mipid_platform_data *pdata)
|
||||
+{
|
||||
+ if (pdata->nreset_gpio != -1) {
|
||||
+ pr_info("shutdown LCD\n");
|
||||
+ gpio_set_value(pdata->nreset_gpio, 0);
|
||||
+ msleep(120);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+struct mipid_platform_data n8x0_mipid_platform_data = {
|
||||
+ .shutdown = mipid_shutdown,
|
||||
+};
|
||||
+
|
||||
+void __init n8x0_mipid_init(void)
|
||||
+{
|
||||
+ const struct omap_lcd_config *conf;
|
||||
+
|
||||
+ conf = omap_get_config(OMAP_TAG_LCD, struct omap_lcd_config);
|
||||
+ if (conf != NULL) {
|
||||
+ n8x0_mipid_platform_data.nreset_gpio = conf->nreset_gpio;
|
||||
+ n8x0_mipid_platform_data.data_lines = conf->data_lines;
|
||||
+ printk(KERN_INFO "N8x0 MIPID config loaded");
|
||||
+ }
|
||||
+ else
|
||||
+ printk(KERN_INFO "N8x0 MIPID config not provided");
|
||||
+}
|
||||
+
|
||||
+
|
||||
+// Epson Blizzard LCD Controller
|
||||
+
|
||||
+static struct {
|
||||
+ struct clk *sys_ck;
|
||||
+} blizzard;
|
||||
+
|
||||
+static int blizzard_get_clocks(void)
|
||||
+{
|
||||
+ blizzard.sys_ck = clk_get(0, "osc_ck");
|
||||
+ if (IS_ERR(blizzard.sys_ck)) {
|
||||
+ printk(KERN_ERR "can't get Blizzard clock\n");
|
||||
+ return PTR_ERR(blizzard.sys_ck);
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static unsigned long blizzard_get_clock_rate(struct device *dev)
|
||||
+{
|
||||
+ return clk_get_rate(blizzard.sys_ck);
|
||||
+}
|
||||
+
|
||||
+static void blizzard_enable_clocks(int enable)
|
||||
+{
|
||||
+ if (enable)
|
||||
+ clk_enable(blizzard.sys_ck);
|
||||
+ else
|
||||
+ clk_disable(blizzard.sys_ck);
|
||||
+}
|
||||
+
|
||||
+static void blizzard_power_up(struct device *dev)
|
||||
+{
|
||||
+ /* Vcore to 1.475V */
|
||||
+ tahvo_set_clear_reg_bits(0x07, 0, 0xf);
|
||||
+ msleep(10);
|
||||
+
|
||||
+ blizzard_enable_clocks(1);
|
||||
+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
|
||||
+}
|
||||
+
|
||||
+static void blizzard_power_down(struct device *dev)
|
||||
+{
|
||||
+ gpio_set_value(N8X0_BLIZZARD_POWERDOWN_GPIO, 0);
|
||||
+ blizzard_enable_clocks(0);
|
||||
+
|
||||
+ /* Vcore to 1.005V */
|
||||
+ tahvo_set_clear_reg_bits(0x07, 0xf, 0);
|
||||
+}
|
||||
+
|
||||
+static struct blizzard_platform_data n8x0_blizzard_data = {
|
||||
+ .power_up = blizzard_power_up,
|
||||
+ .power_down = blizzard_power_down,
|
||||
+ .get_clock_rate = blizzard_get_clock_rate,
|
||||
+ .te_connected = 1,
|
||||
+};
|
||||
+
|
||||
+void __init n8x0_blizzard_init(void)
|
||||
+{
|
||||
+ int r;
|
||||
+
|
||||
+ r = gpio_request(N8X0_BLIZZARD_POWERDOWN_GPIO, "Blizzard pd");
|
||||
+ if (r < 0)
|
||||
+ {
|
||||
+ printk(KERN_ERR "Can't get N8x0 Blizzard powerdown GPIO %d\n", N8X0_BLIZZARD_POWERDOWN_GPIO);
|
||||
+ return;
|
||||
+ }
|
||||
+ gpio_direction_output(N8X0_BLIZZARD_POWERDOWN_GPIO, 1);
|
||||
+
|
||||
+ blizzard_get_clocks();
|
||||
+ omapfb_set_ctrl_platform_data(&n8x0_blizzard_data);
|
||||
+
|
||||
+ printk(KERN_INFO "N8x0 Blizzard initialized");
|
||||
+}
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-usb.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-usb.c 2010-11-05 17:36:26.187000001 +0100
|
||||
@@ -0,0 +1,175 @@
|
||||
+/*
|
||||
+ * linux/arch/arm/mach-omap2/board-n8x0-usb.c
|
||||
+ *
|
||||
+ * Copyright (C) 2006 Nokia Corporation
|
||||
+ * Author: Juha Yrjola
|
||||
+ *
|
||||
+ * 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.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+#include <linux/delay.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/clk.h>
|
||||
+#include <linux/err.h>
|
||||
+#include <linux/gpio.h>
|
||||
+#include <linux/usb/musb.h>
|
||||
+
|
||||
+#include <plat/gpmc.h>
|
||||
+
|
||||
+#define TUSB_ASYNC_CS 1
|
||||
+#define TUSB_SYNC_CS 4
|
||||
+#define GPIO_TUSB_INT 58
|
||||
+#define GPIO_TUSB_ENABLE 0
|
||||
+
|
||||
+static int tusb_set_power(int state);
|
||||
+static int tusb_set_clock(struct clk *osc_ck, int state);
|
||||
+
|
||||
+#if defined(CONFIG_USB_MUSB_OTG)
|
||||
+# define BOARD_MODE MUSB_OTG
|
||||
+#elif defined(CONFIG_USB_MUSB_PERIPHERAL)
|
||||
+# define BOARD_MODE MUSB_PERIPHERAL
|
||||
+#else /* defined(CONFIG_USB_MUSB_HOST) */
|
||||
+# define BOARD_MODE MUSB_HOST
|
||||
+#endif
|
||||
+
|
||||
+static struct musb_hdrc_eps_bits musb_eps[] = {
|
||||
+ { "ep1_tx", 5, },
|
||||
+ { "ep1_rx", 5, },
|
||||
+ { "ep2_tx", 5, },
|
||||
+ { "ep2_rx", 5, },
|
||||
+ { "ep3_tx", 3, },
|
||||
+ { "ep3_rx", 3, },
|
||||
+ { "ep4_tx", 3, },
|
||||
+ { "ep4_rx", 3, },
|
||||
+ { "ep5_tx", 2, },
|
||||
+ { "ep5_rx", 2, },
|
||||
+ { "ep6_tx", 2, },
|
||||
+ { "ep6_rx", 2, },
|
||||
+ { "ep7_tx", 2, },
|
||||
+ { "ep7_rx", 2, },
|
||||
+ { "ep8_tx", 2, },
|
||||
+ { "ep8_rx", 2, },
|
||||
+ { "ep9_tx", 2, },
|
||||
+ { "ep9_rx", 2, },
|
||||
+ { "ep10_tx", 2, },
|
||||
+ { "ep10_rx", 2, },
|
||||
+ { "ep11_tx", 2, },
|
||||
+ { "ep11_rx", 2, },
|
||||
+ { "ep12_tx", 2, },
|
||||
+ { "ep12_rx", 2, },
|
||||
+ { "ep13_tx", 2, },
|
||||
+ { "ep13_rx", 2, },
|
||||
+ { "ep14_tx", 2, },
|
||||
+ { "ep14_rx", 2, },
|
||||
+ { "ep15_tx", 2, },
|
||||
+ { "ep15_rx", 2, },
|
||||
+};
|
||||
+
|
||||
+static struct musb_hdrc_config musb_config = {
|
||||
+ .multipoint = 1,
|
||||
+ .dyn_fifo = 1,
|
||||
+ .soft_con = 1,
|
||||
+ .dma = 1,
|
||||
+ .num_eps = 16,
|
||||
+ .dma_channels = 7,
|
||||
+ .ram_bits = 12,
|
||||
+ .eps_bits = musb_eps,
|
||||
+};
|
||||
+
|
||||
+static struct musb_hdrc_platform_data tusb_data = {
|
||||
+ .mode = BOARD_MODE,
|
||||
+ .set_power = tusb_set_power,
|
||||
+ .set_clock = tusb_set_clock,
|
||||
+ .min_power = 25, /* x2 = 50 mA drawn from VBUS as peripheral */
|
||||
+ .power = 100, /* Max 100 mA VBUS for host mode */
|
||||
+ .clock = "osc_ck",
|
||||
+ .config = &musb_config,
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and
|
||||
+ * 1.5 V voltage regulators of PM companion chip. Companion chip will then
|
||||
+ * provide then PGOOD signal to TUSB6010 which will release it from reset.
|
||||
+ */
|
||||
+static int tusb_set_power(int state)
|
||||
+{
|
||||
+ int i, retval = 0;
|
||||
+
|
||||
+ if (state) {
|
||||
+ gpio_set_value(GPIO_TUSB_ENABLE, 1);
|
||||
+ msleep(1);
|
||||
+
|
||||
+ /* Wait until TUSB6010 pulls INT pin down */
|
||||
+ i = 100;
|
||||
+ while (i && gpio_get_value(GPIO_TUSB_INT)) {
|
||||
+ msleep(1);
|
||||
+ i--;
|
||||
+ }
|
||||
+
|
||||
+ if (!i) {
|
||||
+ printk(KERN_ERR "tusb: powerup failed\n");
|
||||
+ retval = -ENODEV;
|
||||
+ }
|
||||
+ } else {
|
||||
+ gpio_set_value(GPIO_TUSB_ENABLE, 0);
|
||||
+ msleep(10);
|
||||
+ }
|
||||
+
|
||||
+ return retval;
|
||||
+}
|
||||
+
|
||||
+static int osc_ck_on;
|
||||
+
|
||||
+static int tusb_set_clock(struct clk *osc_ck, int state)
|
||||
+{
|
||||
+ if (state) {
|
||||
+ if (osc_ck_on > 0)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ //omap2_block_sleep();
|
||||
+ clk_enable(osc_ck);
|
||||
+ osc_ck_on = 1;
|
||||
+ } else {
|
||||
+ if (osc_ck_on == 0)
|
||||
+ return -ENODEV;
|
||||
+
|
||||
+ clk_disable(osc_ck);
|
||||
+ osc_ck_on = 0;
|
||||
+ //omap2_allow_sleep();
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void __init n8x0_usb_init(void)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+ static char announce[] __initdata = KERN_INFO "TUSB 6010\n";
|
||||
+
|
||||
+ /* PM companion chip power control pin */
|
||||
+ ret = gpio_request(GPIO_TUSB_ENABLE, "TUSB6010 enable");
|
||||
+ if (ret != 0) {
|
||||
+ printk(KERN_ERR "Could not get TUSB power GPIO%i\n",
|
||||
+ GPIO_TUSB_ENABLE);
|
||||
+ return;
|
||||
+ }
|
||||
+ gpio_direction_output(GPIO_TUSB_ENABLE, 0);
|
||||
+
|
||||
+ tusb_set_power(0);
|
||||
+
|
||||
+ ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
|
||||
+ TUSB_ASYNC_CS, TUSB_SYNC_CS,
|
||||
+ GPIO_TUSB_INT, 0x3f);
|
||||
+ if (ret != 0)
|
||||
+ goto err;
|
||||
+
|
||||
+ printk(announce);
|
||||
+
|
||||
+ return;
|
||||
+
|
||||
+err:
|
||||
+ gpio_free(GPIO_TUSB_ENABLE);
|
||||
+}
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/control.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/control.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/control.c 2010-11-05 17:36:26.187000001 +0100
|
||||
@@ -172,6 +172,7 @@
|
||||
return __raw_readw(OMAP_CTRL_REGADDR(offset));
|
||||
}
|
||||
|
||||
+EXPORT_SYMBOL_GPL(omap_ctrl_readl);
|
||||
u32 omap_ctrl_readl(u16 offset)
|
||||
{
|
||||
return __raw_readl(OMAP_CTRL_REGADDR(offset));
|
||||
@@ -187,6 +188,7 @@
|
||||
__raw_writew(val, OMAP_CTRL_REGADDR(offset));
|
||||
}
|
||||
|
||||
+EXPORT_SYMBOL_GPL(omap_ctrl_writel);
|
||||
void omap_ctrl_writel(u32 val, u16 offset)
|
||||
{
|
||||
__raw_writel(val, OMAP_CTRL_REGADDR(offset));
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/Kconfig
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/Kconfig 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/Kconfig 2010-11-05 17:36:26.187000001 +0100
|
||||
@@ -210,6 +210,16 @@
|
||||
select MACH_NOKIA_N810
|
||||
select MACH_NOKIA_N810_WIMAX
|
||||
|
||||
+config MACH_NOKIA_N8X0_LCD
|
||||
+ bool
|
||||
+ depends on MACH_NOKIA_N8X0 && FB_OMAP_LCDC_BLIZZARD && FB_OMAP_LCD_MIPID
|
||||
+ default y
|
||||
+
|
||||
+config MACH_NOKIA_N8X0_USB
|
||||
+ bool
|
||||
+ depends on MACH_NOKIA_N8X0 && MACH_OMAP2_TUSB6010
|
||||
+ default y
|
||||
+
|
||||
config MACH_NOKIA_RX51
|
||||
bool "Nokia RX-51 board"
|
||||
depends on ARCH_OMAP3
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/Makefile
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/Makefile 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/Makefile 2010-11-05 17:36:26.187000001 +0100
|
||||
@@ -139,6 +139,8 @@
|
||||
hsmmc.o \
|
||||
board-flash.o
|
||||
obj-$(CONFIG_MACH_NOKIA_N8X0) += board-n8x0.o
|
||||
+obj-$(CONFIG_MACH_NOKIA_N8X0_LCD) += board-n8x0-lcd.o
|
||||
+obj-$(CONFIG_MACH_NOKIA_N8X0_USB) += board-n8x0-usb.o
|
||||
obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \
|
||||
board-rx51-sdram.o \
|
||||
board-rx51-peripherals.o \
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/serial.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/serial.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/serial.c 2010-11-05 17:36:26.187000001 +0100
|
||||
@@ -545,10 +545,10 @@
|
||||
uart->padconf = 0;
|
||||
}
|
||||
|
||||
- uart->irqflags |= IRQF_SHARED;
|
||||
+/* uart->irqflags |= IRQF_SHARED;
|
||||
ret = request_threaded_irq(uart->irq, NULL, omap_uart_interrupt,
|
||||
IRQF_SHARED, "serial idle", (void *)uart);
|
||||
- WARN_ON(ret);
|
||||
+ WARN_ON(ret); */
|
||||
}
|
||||
|
||||
void omap_uart_enable_irqs(int enable)
|
||||
@@ -556,7 +556,7 @@
|
||||
int ret;
|
||||
struct omap_uart_state *uart;
|
||||
|
||||
- list_for_each_entry(uart, &uart_list, node) {
|
||||
+/* list_for_each_entry(uart, &uart_list, node) {
|
||||
if (enable) {
|
||||
pm_runtime_put_sync(&uart->pdev->dev);
|
||||
ret = request_threaded_irq(uart->irq, NULL,
|
||||
@@ -568,7 +568,7 @@
|
||||
pm_runtime_get_noresume(&uart->pdev->dev);
|
||||
free_irq(uart->irq, (void *)uart);
|
||||
}
|
||||
- }
|
||||
+ } */
|
||||
}
|
||||
|
||||
static ssize_t sleep_timeout_show(struct device *dev,
|
||||
@@ -0,0 +1,100 @@
|
||||
---
|
||||
arch/arm/mach-omap2/board-n8x0.c | 73 +++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 73 insertions(+)
|
||||
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/board-n8x0.c 2010-11-05 17:03:59.354999895 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c 2010-11-05 17:04:41.040001926 +0100
|
||||
@@ -794,6 +794,77 @@
|
||||
|
||||
extern void n8x0_usb_init(void);
|
||||
|
||||
+struct gpio_switch_input_dev {
|
||||
+ struct input_dev *idev;
|
||||
+ unsigned int swcode;
|
||||
+};
|
||||
+
|
||||
+static struct gpio_switch_input_dev *slide_input;
|
||||
+static struct gpio_switch_input_dev *kblock_input;
|
||||
+
|
||||
+static void n8x0_gpio_switch_input_notify(struct gpio_switch_input_dev *gdev,
|
||||
+ int state)
|
||||
+{
|
||||
+ if (gdev) {
|
||||
+ input_report_switch(gdev->idev, gdev->swcode, state);
|
||||
+ input_sync(gdev->idev);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void n8x0_slide_notify(void *data, int state)
|
||||
+{
|
||||
+ n8x0_gpio_switch_input_notify(slide_input, state);
|
||||
+}
|
||||
+
|
||||
+static void n8x0_kb_lock_notify(void *data, int state)
|
||||
+{
|
||||
+ n8x0_gpio_switch_input_notify(kblock_input, state);
|
||||
+}
|
||||
+
|
||||
+static struct gpio_switch_input_dev * __init gpioswitch_input_init(
|
||||
+ const char *name,
|
||||
+ unsigned int swcode)
|
||||
+{
|
||||
+ struct gpio_switch_input_dev *gdev;
|
||||
+ int err;
|
||||
+
|
||||
+ gdev = kzalloc(sizeof(*gdev), GFP_KERNEL);
|
||||
+ if (!gdev)
|
||||
+ goto error;
|
||||
+ gdev->swcode = swcode;
|
||||
+
|
||||
+ gdev->idev = input_allocate_device();
|
||||
+ if (!gdev->idev)
|
||||
+ goto err_free;
|
||||
+
|
||||
+ gdev->idev->evbit[0] = BIT_MASK(EV_SW);
|
||||
+ gdev->idev->swbit[BIT_WORD(swcode)] = BIT_MASK(swcode);
|
||||
+ gdev->idev->name = name;
|
||||
+
|
||||
+ err = input_register_device(gdev->idev);
|
||||
+ if (err)
|
||||
+ goto err_free_idev;
|
||||
+
|
||||
+ return gdev;
|
||||
+
|
||||
+err_free_idev:
|
||||
+ input_free_device(gdev->idev);
|
||||
+err_free:
|
||||
+ kfree(gdev);
|
||||
+error:
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static int __init n8x0_gpio_switches_input_init(void)
|
||||
+{
|
||||
+ slide_input = gpioswitch_input_init("slide", SW_KEYPAD_SLIDE);
|
||||
+ kblock_input = gpioswitch_input_init("kb_lock", SW_LID);
|
||||
+ if (WARN_ON(!slide_input || !kblock_input))
|
||||
+ return -ENODEV;
|
||||
+ return 0;
|
||||
+}
|
||||
+late_initcall(n8x0_gpio_switches_input_init);
|
||||
+
|
||||
static struct omap_gpio_switch n8x0_gpio_switches[] __initdata = {
|
||||
{
|
||||
.name = "headphone",
|
||||
@@ -815,11 +886,13 @@
|
||||
.gpio = -1,
|
||||
.debounce_rising = 200,
|
||||
.debounce_falling = 200,
|
||||
+ .notify = n8x0_slide_notify,
|
||||
}, {
|
||||
.name = "kb_lock",
|
||||
.gpio = -1,
|
||||
.debounce_rising = 200,
|
||||
.debounce_falling = 200,
|
||||
+ .notify = n8x0_kb_lock_notify,
|
||||
},
|
||||
};
|
||||
|
||||
1966
target/linux/omap24xx/patches-2.6.37/400-bluetooth-hci_h4p.patch
Normal file
1966
target/linux/omap24xx/patches-2.6.37/400-bluetooth-hci_h4p.patch
Normal file
File diff suppressed because it is too large
Load Diff
4657
target/linux/omap24xx/patches-2.6.37/500-cbus.patch
Normal file
4657
target/linux/omap24xx/patches-2.6.37/500-cbus.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,330 @@
|
||||
---
|
||||
drivers/cbus/Kconfig | 8 +++
|
||||
drivers/cbus/retu-user.c | 117 +++++++++++++++++++++++++++++++++++++++++++++-
|
||||
drivers/cbus/tahvo-user.c | 75 +++++++++++++++++++++++++++++
|
||||
3 files changed, 198 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/Kconfig
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/Kconfig 2010-11-05 17:04:49.001997921 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/Kconfig 2010-11-05 17:04:52.017998785 +0100
|
||||
@@ -28,6 +28,10 @@
|
||||
If you want support for Tahvo's user space read/write etc. functions,
|
||||
you should say Y here.
|
||||
|
||||
+config CBUS_TAHVO_USER_DEBUG
|
||||
+ depends on CBUS_TAHVO_USER
|
||||
+ bool "Enable Tahvo user space interface debugging"
|
||||
+
|
||||
config CBUS_TAHVO_USB
|
||||
depends on CBUS_TAHVO && USB
|
||||
tristate "Support for Tahvo USB transceiver"
|
||||
@@ -56,6 +60,10 @@
|
||||
If you want support for Retu's user space read/write etc. functions,
|
||||
you should say Y here.
|
||||
|
||||
+config CBUS_RETU_USER_DEBUG
|
||||
+ depends on CBUS_RETU_USER
|
||||
+ bool "Enable Retu user space interface debugging"
|
||||
+
|
||||
config CBUS_RETU_POWERBUTTON
|
||||
depends on CBUS_RETU
|
||||
bool "Support for Retu power button"
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/retu-user.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/retu-user.c 2010-11-05 17:04:49.002997987 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/retu-user.c 2010-11-05 17:04:52.017998785 +0100
|
||||
@@ -46,6 +46,12 @@
|
||||
|
||||
#define PFX "retu-user: "
|
||||
|
||||
+#ifdef CONFIG_CBUS_RETU_USER_DEBUG
|
||||
+# define dprintk(fmt, x...) printk(KERN_DEBUG PFX fmt, x)
|
||||
+#else
|
||||
+# define dprintk(fmt, x...) do { } while (0)
|
||||
+#endif
|
||||
+
|
||||
/* Bitmap for marking the interrupt sources as having the handlers */
|
||||
static u32 retu_irq_bits;
|
||||
|
||||
@@ -105,6 +111,94 @@
|
||||
3
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_CBUS_RETU_USER_DEBUG
|
||||
+static const char * reg_access_text(unsigned int reg)
|
||||
+{
|
||||
+ if (WARN_ON(reg >= ARRAY_SIZE(retu_access_bits)))
|
||||
+ return "X";
|
||||
+ switch (retu_access_bits[reg]) {
|
||||
+ case READ_ONLY:
|
||||
+ return "R";
|
||||
+ case WRITE_ONLY:
|
||||
+ return "W";
|
||||
+ case READ_WRITE:
|
||||
+ return "RW";
|
||||
+ case TOGGLE:
|
||||
+ return "T";
|
||||
+ }
|
||||
+ return "X";
|
||||
+}
|
||||
+
|
||||
+static const char * reg_name(unsigned int reg)
|
||||
+{
|
||||
+ static const char *names[] = {
|
||||
+ [RETU_REG_ASICR] = "ASIC ID & revision",
|
||||
+ [RETU_REG_IDR] = "Interrupt ID",
|
||||
+ [RETU_REG_IMR] = "Interrupt mask",
|
||||
+ [RETU_REG_RTCDSR] = "RTC seconds register",
|
||||
+ [RETU_REG_RTCHMR] = "RTC hours and minutes register",
|
||||
+ [RETU_REG_RTCHMAR] = "hours and minutes alarm and time set register",
|
||||
+ [RETU_REG_RTCCALR] = "RTC calibration register",
|
||||
+ [RETU_REG_ADCR] = "ADC result",
|
||||
+ [RETU_REG_ADCSCR] = "ADC sample ctrl",
|
||||
+ [RETU_REG_CC1] = "Common control register 1",
|
||||
+ [RETU_REG_CC2] = "Common control register 2",
|
||||
+ [RETU_REG_CTRL_CLR] = "Regulator clear register",
|
||||
+ [RETU_REG_CTRL_SET] = "Regulator set register",
|
||||
+ [RETU_REG_STATUS] = "Status register",
|
||||
+ [RETU_REG_WATCHDOG] = "Watchdog register",
|
||||
+ [RETU_REG_AUDTXR] = "Audio Codec Tx register",
|
||||
+ [0x14] = "Charger detect?",
|
||||
+ };
|
||||
+ const char *name;
|
||||
+
|
||||
+ if (reg >= ARRAY_SIZE(names))
|
||||
+ return "";
|
||||
+ name = names[reg];
|
||||
+ if (!name)
|
||||
+ return "";
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+static const char * adc_chan_name(unsigned int chan)
|
||||
+{
|
||||
+ static const char *names[] = {
|
||||
+ [0x05] = "Headset hook detect",
|
||||
+ };
|
||||
+ const char *name;
|
||||
+
|
||||
+ if (chan >= ARRAY_SIZE(names))
|
||||
+ return "";
|
||||
+ name = names[chan];
|
||||
+ if (!name)
|
||||
+ return "";
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+static const char * retu_irq_name(unsigned int id)
|
||||
+{
|
||||
+ static const char *names[] = {
|
||||
+ [RETU_INT_PWR] = "Power",
|
||||
+ [RETU_INT_CHAR] = "Char",
|
||||
+ [RETU_INT_RTCS] = "RTCS",
|
||||
+ [RETU_INT_RTCM] = "RTCM",
|
||||
+ [RETU_INT_RTCD] = "RTCD",
|
||||
+ [RETU_INT_RTCA] = "RTCA",
|
||||
+ [RETU_INT_HOOK] = "Hook",
|
||||
+ [RETU_INT_HEAD] = "Head",
|
||||
+ [RETU_INT_ADCS] = "ADC timer",
|
||||
+ };
|
||||
+ const char *name;
|
||||
+
|
||||
+ if (id >= ARRAY_SIZE(names))
|
||||
+ return "";
|
||||
+ name = names[id];
|
||||
+ if (!name)
|
||||
+ return "";
|
||||
+ return name;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* The handler for all RETU interrupts.
|
||||
*
|
||||
@@ -157,6 +251,8 @@
|
||||
/* Mark that this interrupt has a handler */
|
||||
retu_irq_bits |= 1 << id;
|
||||
|
||||
+ dprintk("Subscribed to IRQ %d (%s)\n", id, retu_irq_name(id));
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -216,6 +312,10 @@
|
||||
|
||||
/* Generate new value */
|
||||
tmp = (tmp & ~MASK(field)) | (value & MASK(field));
|
||||
+
|
||||
+ dprintk("{WRITE %s} 0x%02X(%s) <= msk 0x%04X, val 0x%04X ==> res 0x%04X\n",
|
||||
+ reg_name(reg), reg, reg_access_text(reg), MASK(field), value, tmp);
|
||||
+
|
||||
/* Write data to RETU */
|
||||
retu_write_reg(reg, tmp);
|
||||
spin_unlock_irqrestore(&retu_lock, flags);
|
||||
@@ -244,6 +344,9 @@
|
||||
/* Read the register */
|
||||
value = retu_read_reg(reg) & mask;
|
||||
|
||||
+ dprintk("{READ %s} 0x%02X(%s) <= msk 0x%04X ==> res 0x%04X\n",
|
||||
+ reg_name(reg), reg, reg_access_text(reg), mask, value);
|
||||
+
|
||||
/* Right justify value */
|
||||
while (!(mask & 1)) {
|
||||
value = value >> 1;
|
||||
@@ -273,7 +376,7 @@
|
||||
static long retu_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct retu_tahvo_write_parms par;
|
||||
- int ret;
|
||||
+ int ret, result;
|
||||
|
||||
switch (cmd) {
|
||||
case URT_IOCT_IRQ_SUBSCR:
|
||||
@@ -290,7 +393,15 @@
|
||||
printk(KERN_ERR "copy_to_user failed: %d\n", ret);
|
||||
break;
|
||||
case RETU_IOCH_ADC_READ:
|
||||
- return retu_read_adc(arg);
|
||||
+ result = retu_read_adc(arg);
|
||||
+ if (result >= 0) {
|
||||
+ dprintk("{READ-ADC %s} chan 0x%02lX ==> result 0x%04X\n",
|
||||
+ adc_chan_name(arg), arg, result);
|
||||
+ } else {
|
||||
+ dprintk("{READ-ADC %s} chan 0x%02lX ==> failed %d\n",
|
||||
+ adc_chan_name(arg), arg, result);
|
||||
+ }
|
||||
+ return result;
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
}
|
||||
@@ -332,6 +443,8 @@
|
||||
list_move(&irq->node, &retu_irqs_reserve);
|
||||
spin_unlock_irqrestore(&retu_irqs_lock, flags);
|
||||
|
||||
+ dprintk("{IRQ %s} %d delivered\n", retu_irq_name(irq_id), (int)irq_id);
|
||||
+
|
||||
ret = copy_to_user(buf + i * sizeof(irq_id), &irq_id,
|
||||
sizeof(irq_id));
|
||||
if (ret)
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/tahvo-user.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/tahvo-user.c 2010-11-05 17:04:49.003998052 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/tahvo-user.c 2010-11-05 17:04:52.018998824 +0100
|
||||
@@ -46,6 +46,12 @@
|
||||
|
||||
#define PFX "tahvo-user: "
|
||||
|
||||
+#ifdef CONFIG_CBUS_TAHVO_USER_DEBUG
|
||||
+# define dprintk(fmt, x...) printk(KERN_DEBUG PFX fmt, x)
|
||||
+#else
|
||||
+# define dprintk(fmt, x...) do { } while (0)
|
||||
+#endif
|
||||
+
|
||||
/* Bitmap for marking the interrupt sources as having the handlers */
|
||||
static u32 tahvo_irq_bits;
|
||||
|
||||
@@ -87,6 +93,64 @@
|
||||
1
|
||||
};
|
||||
|
||||
+#ifdef CONFIG_CBUS_TAHVO_USER_DEBUG
|
||||
+static const char * reg_access_text(unsigned int reg)
|
||||
+{
|
||||
+ if (WARN_ON(reg >= ARRAY_SIZE(tahvo_access_bits)))
|
||||
+ return "X";
|
||||
+ switch (tahvo_access_bits[reg]) {
|
||||
+ case READ_ONLY:
|
||||
+ return "R";
|
||||
+ case WRITE_ONLY:
|
||||
+ return "W";
|
||||
+ case READ_WRITE:
|
||||
+ return "RW";
|
||||
+ case TOGGLE:
|
||||
+ return "T";
|
||||
+ }
|
||||
+ return "X";
|
||||
+}
|
||||
+
|
||||
+static const char * reg_name(unsigned int reg)
|
||||
+{
|
||||
+ static const char *names[] = {
|
||||
+ [TAHVO_REG_ASICR] = "ASIC ID & revision",
|
||||
+ [TAHVO_REG_IDR] = "Interrupt ID",
|
||||
+ [TAHVO_REG_IDSR] = "Interrupt status",
|
||||
+ [TAHVO_REG_IMR] = "Interrupt mask",
|
||||
+ [TAHVO_REG_LEDPWMR] = "LED PWM",
|
||||
+ [TAHVO_REG_USBR] = "USB control",
|
||||
+ [0x04] = "Charge current control?",
|
||||
+ [0x08] = "Charge ctl 1?",
|
||||
+ [0x0C] = "Charge ctl 2?",
|
||||
+ [0x0D] = "Battery current ADC?",
|
||||
+ };
|
||||
+ const char *name;
|
||||
+
|
||||
+ if (reg >= ARRAY_SIZE(names))
|
||||
+ return "";
|
||||
+ name = names[reg];
|
||||
+ if (!name)
|
||||
+ return "";
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+static const char * tahvo_irq_name(unsigned int id)
|
||||
+{
|
||||
+ static const char *names[] = {
|
||||
+ [TAHVO_INT_VBUSON] = "VBUSON",
|
||||
+ };
|
||||
+ const char *name;
|
||||
+
|
||||
+ if (id >= ARRAY_SIZE(names))
|
||||
+ return "";
|
||||
+ name = names[id];
|
||||
+ if (!name)
|
||||
+ return "";
|
||||
+ return name;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* The handler for all TAHVO interrupts.
|
||||
*
|
||||
@@ -142,6 +206,8 @@
|
||||
/* Mark that this interrupt has a handler */
|
||||
tahvo_irq_bits |= 1 << id;
|
||||
|
||||
+ dprintk("Subscribed to IRQ %d (%s)\n", id, tahvo_irq_name(id));
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -200,6 +266,10 @@
|
||||
}
|
||||
/* Generate a new value */
|
||||
tmp = (tmp & ~MASK(field)) | (value & MASK(field));
|
||||
+
|
||||
+ dprintk("{WRITE %s} 0x%02X(%s) <= msk 0x%04X, val 0x%04X ==> res 0x%04X\n",
|
||||
+ reg_name(reg), reg, reg_access_text(reg), MASK(field), value, tmp);
|
||||
+
|
||||
/* Write data to TAHVO */
|
||||
tahvo_write_reg(reg, tmp);
|
||||
spin_unlock_irqrestore(&tahvo_lock, flags);
|
||||
@@ -228,6 +298,9 @@
|
||||
/* Read the register */
|
||||
value = tahvo_read_reg(reg) & mask;
|
||||
|
||||
+ dprintk("{READ %s} 0x%02X(%s) <= msk 0x%04X ==> res 0x%04X\n",
|
||||
+ reg_name(reg), reg, reg_access_text(reg), mask, value);
|
||||
+
|
||||
/* Right justify value */
|
||||
while (!(mask & 1)) {
|
||||
value = value >> 1;
|
||||
@@ -314,6 +387,8 @@
|
||||
list_move(&irq->node, &tahvo_irqs_reserve);
|
||||
spin_unlock_irqrestore(&tahvo_irqs_lock, flags);
|
||||
|
||||
+ dprintk("{IRQ %s} %d delivered\n", tahvo_irq_name(irq_id), (int)irq_id);
|
||||
+
|
||||
ret = copy_to_user(buf + i * sizeof(irq_id), &irq_id,
|
||||
sizeof(irq_id));
|
||||
if (ret)
|
||||
1039
target/linux/omap24xx/patches-2.6.37/600-tsc2005.patch
Normal file
1039
target/linux/omap24xx/patches-2.6.37/600-tsc2005.patch
Normal file
File diff suppressed because it is too large
Load Diff
196
target/linux/omap24xx/patches-2.6.37/700-video-omap.patch
Normal file
196
target/linux/omap24xx/patches-2.6.37/700-video-omap.patch
Normal file
@@ -0,0 +1,196 @@
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/dispc.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/dispc.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/dispc.c 2010-11-05 17:04:58.562000054 +0100
|
||||
@@ -190,6 +190,11 @@
|
||||
struct omapfb_color_key color_key;
|
||||
} dispc;
|
||||
|
||||
+struct platform_device omapdss_device = {
|
||||
+ .name = "omapdss",
|
||||
+ .id = -1,
|
||||
+};
|
||||
+
|
||||
static void enable_lcd_clocks(int enable);
|
||||
|
||||
static void inline dispc_write_reg(int idx, u32 val)
|
||||
@@ -916,20 +921,20 @@
|
||||
|
||||
static int get_dss_clocks(void)
|
||||
{
|
||||
- dispc.dss_ick = clk_get(&dispc.fbdev->dssdev->dev, "ick");
|
||||
+ dispc.dss_ick = clk_get(&omapdss_device.dev, "ick");
|
||||
if (IS_ERR(dispc.dss_ick)) {
|
||||
dev_err(dispc.fbdev->dev, "can't get ick\n");
|
||||
return PTR_ERR(dispc.dss_ick);
|
||||
}
|
||||
|
||||
- dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
|
||||
+ dispc.dss1_fck = clk_get(&omapdss_device.dev, "dss1_fck");
|
||||
if (IS_ERR(dispc.dss1_fck)) {
|
||||
dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
|
||||
clk_put(dispc.dss_ick);
|
||||
return PTR_ERR(dispc.dss1_fck);
|
||||
}
|
||||
|
||||
- dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_fck");
|
||||
+ dispc.dss_54m_fck = clk_get(&omapdss_device.dev, "tv_fck");
|
||||
if (IS_ERR(dispc.dss_54m_fck)) {
|
||||
dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
|
||||
clk_put(dispc.dss_ick);
|
||||
@@ -1381,6 +1386,12 @@
|
||||
int skip_init = 0;
|
||||
int i;
|
||||
|
||||
+ r = platform_device_register(&omapdss_device);
|
||||
+ if (r) {
|
||||
+ dev_err(fbdev->dev, "can't register omapdss device\n");
|
||||
+ return r;
|
||||
+ }
|
||||
+
|
||||
memset(&dispc, 0, sizeof(dispc));
|
||||
|
||||
dispc.base = ioremap(DISPC_BASE, SZ_1K);
|
||||
@@ -1524,6 +1535,7 @@
|
||||
free_irq(INT_24XX_DSS_IRQ, dispc.fbdev);
|
||||
put_dss_clocks();
|
||||
iounmap(dispc.base);
|
||||
+ platform_device_unregister(&omapdss_device);
|
||||
}
|
||||
|
||||
const struct lcd_ctrl omap2_int_ctrl = {
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/lcd_htcherald.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/lcd_htcherald.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/lcd_htcherald.c 2010-11-05 17:04:58.562000054 +0100
|
||||
@@ -115,12 +115,12 @@
|
||||
},
|
||||
};
|
||||
|
||||
-static int __init htcherald_panel_drv_init(void)
|
||||
+static int htcherald_panel_drv_init(void)
|
||||
{
|
||||
return platform_driver_register(&htcherald_panel_driver);
|
||||
}
|
||||
|
||||
-static void __exit htcherald_panel_drv_cleanup(void)
|
||||
+static void htcherald_panel_drv_cleanup(void)
|
||||
{
|
||||
platform_driver_unregister(&htcherald_panel_driver);
|
||||
}
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/lcd_mipid.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/lcd_mipid.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/lcd_mipid.c 2010-11-05 17:04:58.563000039 +0100
|
||||
@@ -551,9 +551,9 @@
|
||||
md->esd_check = ls041y3_esd_check;
|
||||
break;
|
||||
default:
|
||||
- md->panel.name = "unknown";
|
||||
- dev_err(&md->spi->dev, "invalid display ID\n");
|
||||
- return -ENODEV;
|
||||
+ dev_err(&md->spi->dev, "FIXME: LCD panel detection failed! ID: %02x%02x%02x\n", display_id[0], display_id[1], display_id[2]);
|
||||
+ md->panel.name = "ls041y3";
|
||||
+ md->esd_check = ls041y3_esd_check;
|
||||
}
|
||||
|
||||
md->revision = display_id[1];
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/omapfb.h
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/omapfb.h 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/omapfb.h 2010-11-05 17:04:58.563000039 +0100
|
||||
@@ -203,8 +203,6 @@
|
||||
|
||||
struct omapfb_mem_desc mem_desc;
|
||||
struct fb_info *fb_info[OMAPFB_PLANE_NUM];
|
||||
-
|
||||
- struct platform_device *dssdev; /* dummy dev for clocks */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_ARCH_OMAP1
|
||||
@@ -226,4 +224,6 @@
|
||||
void (*callback)(void *),
|
||||
void *callback_data);
|
||||
|
||||
+extern struct platform_device omapdss_device;
|
||||
+
|
||||
#endif /* __OMAPFB_H */
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/omapfb_main.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/omapfb_main.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/omapfb_main.c 2010-11-05 17:04:58.563000039 +0100
|
||||
@@ -84,19 +84,6 @@
|
||||
{ 1 << OMAPFB_COLOR_YUY422, "YUY422", },
|
||||
};
|
||||
|
||||
-static void omapdss_release(struct device *dev)
|
||||
-{
|
||||
-}
|
||||
-
|
||||
-/* dummy device for clocks */
|
||||
-static struct platform_device omapdss_device = {
|
||||
- .name = "omapdss",
|
||||
- .id = -1,
|
||||
- .dev = {
|
||||
- .release = omapdss_release,
|
||||
- },
|
||||
-};
|
||||
-
|
||||
/*
|
||||
* ---------------------------------------------------------------------------
|
||||
* LCD panel
|
||||
@@ -1715,7 +1702,6 @@
|
||||
|
||||
fbdev->dev = &pdev->dev;
|
||||
fbdev->panel = panel;
|
||||
- fbdev->dssdev = &omapdss_device;
|
||||
platform_set_drvdata(pdev, fbdev);
|
||||
|
||||
mutex_init(&fbdev->rqueue_mutex);
|
||||
@@ -1830,16 +1816,8 @@
|
||||
|
||||
static int omapfb_probe(struct platform_device *pdev)
|
||||
{
|
||||
- int r;
|
||||
-
|
||||
BUG_ON(fbdev_pdev != NULL);
|
||||
|
||||
- r = platform_device_register(&omapdss_device);
|
||||
- if (r) {
|
||||
- dev_err(&pdev->dev, "can't register omapdss device\n");
|
||||
- return r;
|
||||
- }
|
||||
-
|
||||
/* Delay actual initialization until the LCD is registered */
|
||||
fbdev_pdev = pdev;
|
||||
if (fbdev_panel != NULL)
|
||||
@@ -1867,9 +1845,6 @@
|
||||
fbdev->state = OMAPFB_DISABLED;
|
||||
omapfb_free_resources(fbdev, saved_state);
|
||||
|
||||
- platform_device_unregister(&omapdss_device);
|
||||
- fbdev->dssdev = NULL;
|
||||
-
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: linux-2.6.37-rc1/drivers/video/omap/rfbi.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/video/omap/rfbi.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/video/omap/rfbi.c 2010-11-05 17:04:58.563000039 +0100
|
||||
@@ -84,13 +84,13 @@
|
||||
|
||||
static int rfbi_get_clocks(void)
|
||||
{
|
||||
- rfbi.dss_ick = clk_get(&rfbi.fbdev->dssdev->dev, "ick");
|
||||
+ rfbi.dss_ick = clk_get(&omapdss_device.dev, "ick");
|
||||
if (IS_ERR(rfbi.dss_ick)) {
|
||||
dev_err(rfbi.fbdev->dev, "can't get ick\n");
|
||||
return PTR_ERR(rfbi.dss_ick);
|
||||
}
|
||||
|
||||
- rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck");
|
||||
+ rfbi.dss1_fck = clk_get(&omapdss_device.dev, "dss1_fck");
|
||||
if (IS_ERR(rfbi.dss1_fck)) {
|
||||
dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
|
||||
clk_put(rfbi.dss_ick);
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
drivers/input/evdev.c | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
--- linux-2.6.36-rc4.orig/drivers/input/evdev.c
|
||||
+++ linux-2.6.36-rc4/drivers/input/evdev.c
|
||||
@@ -76,7 +76,7 @@ static void evdev_event(struct input_han
|
||||
unsigned int type, unsigned int code, int value)
|
||||
{
|
||||
struct evdev *evdev = handle->private;
|
||||
- struct evdev_client *client;
|
||||
+ struct evdev_client *client, *c;
|
||||
struct input_event event;
|
||||
|
||||
do_gettimeofday(&event.time);
|
||||
@@ -87,9 +87,13 @@ static void evdev_event(struct input_han
|
||||
rcu_read_lock();
|
||||
|
||||
client = rcu_dereference(evdev->grab);
|
||||
- if (client)
|
||||
+ if (client) {
|
||||
evdev_pass_event(client, &event);
|
||||
- else
|
||||
+ /* Also pass events to clients that did not grab the device. */
|
||||
+ list_for_each_entry_rcu(c, &evdev->client_list, node)
|
||||
+ if (c != client)
|
||||
+ evdev_pass_event(c, &event);
|
||||
+ } else
|
||||
list_for_each_entry_rcu(client, &evdev->client_list, node)
|
||||
evdev_pass_event(client, &event);
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
lib/decompress_unlzo.c | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- linux-2.6.35.orig/lib/decompress_unlzo.c
|
||||
+++ linux-2.6.35/lib/decompress_unlzo.c
|
||||
@@ -50,6 +50,10 @@ static const unsigned char lzop_magic[]
|
||||
#define LZO_BLOCK_SIZE (256*1024l)
|
||||
#define HEADER_HAS_FILTER 0x00000800L
|
||||
|
||||
+#ifndef INIT
|
||||
+#define INIT /* nothing */
|
||||
+#endif
|
||||
+
|
||||
STATIC inline int INIT parse_header(u8 *input, u8 *skip)
|
||||
{
|
||||
int l;
|
||||
70
target/linux/omap24xx/patches-2.6.37/810-mmc-fixes.patch
Normal file
70
target/linux/omap24xx/patches-2.6.37/810-mmc-fixes.patch
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
drivers/mmc/core/core.c | 5 +++--
|
||||
drivers/mmc/host/omap.c | 7 +++++--
|
||||
include/linux/mmc/host.h | 2 ++
|
||||
3 files changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
Index: linux-2.6.37-rc1/drivers/mmc/host/omap.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/mmc/host/omap.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/mmc/host/omap.c 2010-11-05 17:07:25.130000416 +0100
|
||||
@@ -387,7 +387,7 @@
|
||||
|
||||
mod_timer(&host->cmd_abort_timer, jiffies + HZ/2);
|
||||
|
||||
- OMAP_MMC_WRITE(host, CTO, 200);
|
||||
+// OMAP_MMC_WRITE(host, CTO, 200);
|
||||
OMAP_MMC_WRITE(host, ARGL, cmd->arg & 0xffff);
|
||||
OMAP_MMC_WRITE(host, ARGH, cmd->arg >> 16);
|
||||
OMAP_MMC_WRITE(host, IE,
|
||||
@@ -1454,6 +1454,7 @@
|
||||
host->dma_ch = -1;
|
||||
|
||||
host->irq = irq;
|
||||
+ host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
|
||||
host->phys_base = host->mem_res->start;
|
||||
host->virt_base = ioremap(res->start, res->end - res->start + 1);
|
||||
if (!host->virt_base)
|
||||
@@ -1493,7 +1494,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
|
||||
+ /* Make sure the detect workqueue was run at least once. */
|
||||
+ printk(KERN_INFO "OMAP-mmc: waiting for cards...\n");
|
||||
+ mmc_flush_scheduled_work();
|
||||
|
||||
return 0;
|
||||
|
||||
Index: linux-2.6.37-rc1/drivers/mmc/core/core.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/mmc/core/core.c 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/mmc/core/core.c 2010-11-05 17:07:25.131000390 +0100
|
||||
@@ -74,12 +74,13 @@
|
||||
}
|
||||
|
||||
/*
|
||||
- * Internal function. Flush all scheduled work from the MMC work queue.
|
||||
+ * Flush all scheduled work from the MMC work queue.
|
||||
*/
|
||||
-static void mmc_flush_scheduled_work(void)
|
||||
+void mmc_flush_scheduled_work(void)
|
||||
{
|
||||
flush_workqueue(workqueue);
|
||||
}
|
||||
+EXPORT_SYMBOL(mmc_flush_scheduled_work);
|
||||
|
||||
/**
|
||||
* mmc_request_done - finish processing an MMC request
|
||||
Index: linux-2.6.37-rc1/include/linux/mmc/host.h
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/include/linux/mmc/host.h 2010-11-01 12:54:12.000000000 +0100
|
||||
+++ linux-2.6.37-rc1/include/linux/mmc/host.h 2010-11-05 17:07:25.131000390 +0100
|
||||
@@ -306,5 +306,7 @@
|
||||
return !(host->caps & MMC_CAP_NONREMOVABLE) && mmc_assume_removable;
|
||||
}
|
||||
|
||||
+void mmc_flush_scheduled_work(void);
|
||||
+
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
arch/arm/mach-omap2/board-n8x0-lcd.c | 18 ++++++++++++++++++
|
||||
1 file changed, 18 insertions(+)
|
||||
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-lcd.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/board-n8x0-lcd.c 2010-11-05 17:02:04.318000134 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0-lcd.c 2010-11-05 17:07:32.261000002 +0100
|
||||
@@ -34,8 +34,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
+static int n8x0_get_backlight_level(struct mipid_platform_data *pdata)
|
||||
+{
|
||||
+ return tahvo_get_backlight_level();
|
||||
+}
|
||||
+
|
||||
+static int n8x0_get_max_backlight_level(struct mipid_platform_data *pdata)
|
||||
+{
|
||||
+ return tahvo_get_max_backlight_level();
|
||||
+}
|
||||
+
|
||||
+static void n8x0_set_backlight_level(struct mipid_platform_data *pdata, int level)
|
||||
+{
|
||||
+ tahvo_set_backlight_level(level);
|
||||
+}
|
||||
+
|
||||
struct mipid_platform_data n8x0_mipid_platform_data = {
|
||||
.shutdown = mipid_shutdown,
|
||||
+ .get_bklight_level = n8x0_get_backlight_level,
|
||||
+ .set_bklight_level = n8x0_set_backlight_level,
|
||||
+ .get_bklight_max = n8x0_get_max_backlight_level,
|
||||
};
|
||||
|
||||
void __init n8x0_mipid_init(void)
|
||||
@@ -0,0 +1,657 @@
|
||||
---
|
||||
arch/arm/mach-omap2/board-n8x0.c | 13 +
|
||||
drivers/cbus/Kconfig | 12 +
|
||||
drivers/cbus/Makefile | 3
|
||||
drivers/cbus/lipocharge.c | 63 ++++++
|
||||
drivers/cbus/lipocharge.h | 50 ++++
|
||||
drivers/cbus/n810bm_main.c | 397 +++++++++++++++++++++++++++++++++++++++
|
||||
drivers/cbus/retu.c | 4
|
||||
drivers/cbus/retu.h | 3
|
||||
drivers/cbus/tahvo.h | 6
|
||||
9 files changed, 548 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/Kconfig
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/Kconfig 2010-11-05 17:38:14.843000000 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/Kconfig 2010-11-05 17:38:14.894000001 +0100
|
||||
@@ -94,4 +94,16 @@
|
||||
to Retu/Vilma. Detection state and events are exposed through
|
||||
sysfs.
|
||||
|
||||
+config N810BM
|
||||
+ depends on CBUS_RETU && CBUS_TAHVO
|
||||
+ tristate "Nokia n810 battery management"
|
||||
+ ---help---
|
||||
+ Nokia n810 device battery management.
|
||||
+
|
||||
+ WARNING: This driver is based on reverse engineered information.
|
||||
+ It is possibly dangerous to use this software.
|
||||
+ Use this software at your own risk!
|
||||
+
|
||||
+ If unsure, say N.
|
||||
+
|
||||
endmenu
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/Makefile
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/Makefile 2010-11-05 17:38:14.834000050 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/Makefile 2010-11-05 17:38:14.894000001 +0100
|
||||
@@ -12,3 +12,6 @@
|
||||
obj-$(CONFIG_CBUS_TAHVO_USER) += tahvo-user.o
|
||||
obj-$(CONFIG_CBUS_RETU_USER) += retu-user.o
|
||||
obj-$(CONFIG_CBUS_RETU_HEADSET) += retu-headset.o
|
||||
+n810bm-y += n810bm_main.o
|
||||
+n810bm-y += lipocharge.o
|
||||
+obj-$(CONFIG_N810BM) += n810bm.o
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/n810bm_main.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/n810bm_main.c 2010-11-05 17:38:14.894000001 +0100
|
||||
@@ -0,0 +1,397 @@
|
||||
+/*
|
||||
+ * Nokia n810 battery management
|
||||
+ *
|
||||
+ * WARNING: This driver is based on reverse engineered information.
|
||||
+ * It is possibly dangerous to use this software.
|
||||
+ * Use this software at your own risk!
|
||||
+ *
|
||||
+ * Copyright (c) 2010 Michael Buesch <mb@bu3sch.de>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ */
|
||||
+
|
||||
+#include <linux/module.h>
|
||||
+#include <linux/device.h>
|
||||
+#include <linux/platform_device.h>
|
||||
+#include <linux/slab.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+#include <linux/timer.h>
|
||||
+#include <linux/reboot.h>
|
||||
+
|
||||
+#include "retu.h"
|
||||
+#include "tahvo.h"
|
||||
+#include "lipocharge.h"
|
||||
+
|
||||
+
|
||||
+#define N810BM_CHECK_INTERVAL (HZ * 5)
|
||||
+#define N810BM_MIN_VOLTAGE_THRES 3300 /* Absolute minimum voltage threshold */
|
||||
+
|
||||
+
|
||||
+/* Battery related retu ADC channels */
|
||||
+#define RETU_ADC_BSI 0x01 /* Battery Size Indicator */
|
||||
+#define RETU_ADC_BATTVOLT 0x08 /* Battery voltage measurement */
|
||||
+
|
||||
+/* RETU_ADC_BSI
|
||||
+ * The battery size indicator ADC measures the resistance between
|
||||
+ * the battery BSI pin and ground. This is used to detect the battery
|
||||
+ * capacity, as the BSI resistor is related to capacity.
|
||||
+ *
|
||||
+ * Manually measured lookup table.
|
||||
+ * Hard to measure, thus not very accurate.
|
||||
+ *
|
||||
+ * Resistance | ADC value
|
||||
+ * ========================
|
||||
+ * 120k | 0x3AC
|
||||
+ * 110k | 0x37C
|
||||
+ * 100k | 0x351
|
||||
+ * 90k | 0x329
|
||||
+ */
|
||||
+
|
||||
+/* RETU_ADC_BATTVOLT
|
||||
+ * Manually measured lookup table.
|
||||
+ * Hard to measure, thus not very accurate.
|
||||
+ *
|
||||
+ * Voltage | ADC value
|
||||
+ * =====================
|
||||
+ * 2.80V | 0x037
|
||||
+ * 2.90V | 0x05E
|
||||
+ * 3.00V | 0x090
|
||||
+ * 3.10V | 0x0A4
|
||||
+ * 3.20V | 0x0CC
|
||||
+ * 3.30V | 0x0EF
|
||||
+ * 3.40V | 0x115
|
||||
+ * 3.50V | 0x136
|
||||
+ * 3.60V | 0x15C
|
||||
+ * 3.70V | 0x187
|
||||
+ * 3.80V | 0x1A5
|
||||
+ * 3.90V | 0x1C9
|
||||
+ * 4.00V | 0x1ED
|
||||
+ * 4.10V | 0x212
|
||||
+ * 4.20V | 0x236
|
||||
+ */
|
||||
+
|
||||
+
|
||||
+enum n810bm_capacity {
|
||||
+ N810BM_CAP_UNKNOWN = 0,
|
||||
+ N810BM_CAP_1500MAH = 1500, /* 1500 mAh battery */
|
||||
+};
|
||||
+
|
||||
+struct n810bm {
|
||||
+ struct platform_device *pdev;
|
||||
+
|
||||
+ enum n810bm_capacity capacity;
|
||||
+ struct timer_list check_timer;
|
||||
+
|
||||
+ struct lipocharge *charger;
|
||||
+
|
||||
+ spinlock_t lock;
|
||||
+};
|
||||
+
|
||||
+
|
||||
+static NORET_TYPE void n810bm_emergency(struct n810bm *bm, const char *message) ATTRIB_NORET;
|
||||
+static void n810bm_emergency(struct n810bm *bm, const char *message)
|
||||
+{
|
||||
+ printk(KERN_EMERG "n810 battery management fatal fault: %s\n", message);
|
||||
+ /* Force a hard shutdown. */
|
||||
+ machine_power_off();
|
||||
+ panic("n810bm: Failed to halt machine in emergency state\n");
|
||||
+}
|
||||
+
|
||||
+#if 0
|
||||
+static u16 retu_read(struct n810bm *bm, unsigned int reg)
|
||||
+{
|
||||
+ int ret;
|
||||
+ unsigned long flags;
|
||||
+
|
||||
+ spin_lock_irqsave(&retu_lock, flags);
|
||||
+ ret = retu_read_reg(reg);
|
||||
+ spin_unlock_irqrestore(&retu_lock, flags);
|
||||
+ if (ret < 0 || ret > 0xFFFF)
|
||||
+ n810bm_emergency(bm, "retu_read");
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+static void retu_maskset(struct n810bm *bm, unsigned int reg, u16 mask, u16 set)
|
||||
+{
|
||||
+ int ret;
|
||||
+ unsigned long flags;
|
||||
+ u16 value;
|
||||
+
|
||||
+ spin_lock_irqsave(&retu_lock, flags);
|
||||
+ if (~mask) {
|
||||
+ ret = retu_read_reg(reg);
|
||||
+ if (ret < 0 || ret > 0xFFFF)
|
||||
+ goto fatal_unlock;
|
||||
+ value = ret;
|
||||
+ } else
|
||||
+ value = 0;
|
||||
+ value &= ~mask;
|
||||
+ value |= set;
|
||||
+ ret = retu_write_reg(reg, value);
|
||||
+ if (ret)
|
||||
+ goto fatal_unlock;
|
||||
+ spin_unlock_irqrestore(&retu_lock, flags);
|
||||
+
|
||||
+ return;
|
||||
+
|
||||
+fatal_unlock:
|
||||
+ spin_unlock_irqrestore(&retu_lock, flags);
|
||||
+ n810bm_emergency(bm, "retu_maskset");
|
||||
+}
|
||||
+
|
||||
+static inline void retu_write(struct n810bm *bm, unsigned int reg, u16 value)
|
||||
+{
|
||||
+ return retu_maskset(bm, reg, 0xFFFF, value);
|
||||
+}
|
||||
+
|
||||
+static int retu_adc_average(struct n810bm *bm, unsigned int chan,
|
||||
+ unsigned int nr_passes)
|
||||
+{
|
||||
+ unsigned int i, value = 0;
|
||||
+ int ret;
|
||||
+
|
||||
+ if (WARN_ON(!nr_passes))
|
||||
+ return 0;
|
||||
+ for (i = 0; i < nr_passes; i++) {
|
||||
+ ret = retu_read_adc(chan);
|
||||
+ if (ret < 0)
|
||||
+ return ret;
|
||||
+ value += ret;
|
||||
+ }
|
||||
+ value /= nr_passes;
|
||||
+
|
||||
+ return value;
|
||||
+}
|
||||
+
|
||||
+/* Measure the battery voltage. Returns the value in mV (or negative value on error). */
|
||||
+static int n810bm_measure_batt_voltage(struct n810bm *bm)
|
||||
+{
|
||||
+ int adc;
|
||||
+ unsigned int mv;
|
||||
+ const unsigned int scale = 1000;
|
||||
+
|
||||
+ adc = retu_adc_average(bm, RETU_ADC_BATTVOLT, 5);
|
||||
+ if (adc < 0)
|
||||
+ return adc;
|
||||
+ if (adc <= 0x37)
|
||||
+ return 2800;
|
||||
+ mv = 2800 + ((adc - 0x37) * (((4200 - 2800) * scale) / (0x236 - 0x37))) / scale;
|
||||
+
|
||||
+ return mv;
|
||||
+}
|
||||
+
|
||||
+/* Read the battery capacity via BSI pin. */
|
||||
+static enum n810bm_capacity n810bm_read_batt_capacity(struct n810bm *bm)
|
||||
+{
|
||||
+ int adc;
|
||||
+ const unsigned int hyst = 20;
|
||||
+
|
||||
+ adc = retu_adc_average(bm, RETU_ADC_BSI, 5);
|
||||
+ if (adc < 0) {
|
||||
+ dev_err(&bm->pdev->dev, "Failed to read BSI ADC");
|
||||
+ return N810BM_CAP_UNKNOWN;
|
||||
+ }
|
||||
+
|
||||
+ if (adc >= 0x3B5 - hyst && adc <= 0x3B5 + hyst)
|
||||
+ return N810BM_CAP_1500MAH;
|
||||
+
|
||||
+ dev_err(&bm->pdev->dev, "Capacity indicator 0x%X unknown", adc);
|
||||
+
|
||||
+ return N810BM_CAP_UNKNOWN;
|
||||
+}
|
||||
+
|
||||
+/* Convert a battery voltage (in mV) to percentage. */
|
||||
+static unsigned int n810bm_mvolt2percent(unsigned int mv)
|
||||
+{
|
||||
+ const unsigned int minv = 3700;
|
||||
+ const unsigned int maxv = 4150;
|
||||
+ unsigned int percent;
|
||||
+
|
||||
+ mv = clamp(mv, minv, maxv);
|
||||
+ percent = (mv - minv) * 100 / (maxv - minv);
|
||||
+
|
||||
+ return percent;
|
||||
+}
|
||||
+
|
||||
+static void n810bm_check_timer(unsigned long data)
|
||||
+{
|
||||
+ struct n810bm *bm = (struct n810bm *)data;
|
||||
+ unsigned long flags;
|
||||
+ int mv;
|
||||
+
|
||||
+ spin_lock_irqsave(&bm->lock, flags);
|
||||
+
|
||||
+ mv = n810bm_measure_batt_voltage(bm);
|
||||
+ if (mv < 0)
|
||||
+ n810bm_emergency(bm, "check timer: Failed to measure");
|
||||
+ if (mv < N810BM_MIN_VOLTAGE_THRES)
|
||||
+ n810bm_emergency(bm, "check timer: Minimum voltage threshold reached");
|
||||
+
|
||||
+ mod_timer(&bm->check_timer, round_jiffies(jiffies + N810BM_CHECK_INTERVAL));
|
||||
+ spin_unlock_irqrestore(&bm->lock, flags);
|
||||
+
|
||||
+ return;
|
||||
+}
|
||||
+
|
||||
+static void n810bm_adc_irq_handler(unsigned long data)
|
||||
+{
|
||||
+ struct n810bm *bm = (struct n810bm *)data;
|
||||
+
|
||||
+ retu_ack_irq(RETU_INT_ADCS);
|
||||
+ //TODO
|
||||
+printk("n810bm: ADC timer triggered\n");
|
||||
+}
|
||||
+
|
||||
+static ssize_t n810bm_attr_charge_show(struct device *dev,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct platform_device *pdev = to_platform_device(dev);
|
||||
+ struct n810bm *bm = platform_get_drvdata(pdev);
|
||||
+ int err = -ENODEV;
|
||||
+ ssize_t count = 0;
|
||||
+ int millivolt;
|
||||
+
|
||||
+ spin_lock_irq(&bm->lock);
|
||||
+ millivolt = n810bm_measure_batt_voltage(bm);
|
||||
+ if (millivolt >= 0) {
|
||||
+ count = snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
+ n810bm_mvolt2percent(millivolt));
|
||||
+ err = 0;
|
||||
+ }
|
||||
+ spin_unlock_irq(&bm->lock);
|
||||
+
|
||||
+ return err ? err : count;
|
||||
+}
|
||||
+static DEVICE_ATTR(batt_charge, 0444, n810bm_attr_charge_show, NULL);
|
||||
+
|
||||
+static ssize_t n810bm_attr_capacity_show(struct device *dev,
|
||||
+ struct device_attribute *attr,
|
||||
+ char *buf)
|
||||
+{
|
||||
+ struct platform_device *pdev = to_platform_device(dev);
|
||||
+ struct n810bm *bm = platform_get_drvdata(pdev);
|
||||
+ ssize_t count;
|
||||
+
|
||||
+ spin_lock_irq(&bm->lock);
|
||||
+ count = snprintf(buf, PAGE_SIZE, "%u\n",
|
||||
+ (unsigned int)bm->capacity);
|
||||
+ spin_unlock_irq(&bm->lock);
|
||||
+
|
||||
+ return count;
|
||||
+}
|
||||
+static DEVICE_ATTR(batt_capacity, 0444, n810bm_attr_capacity_show, NULL);
|
||||
+
|
||||
+static void n810bm_hw_exit(struct n810bm *bm)
|
||||
+{
|
||||
+ retu_write(bm, RETU_REG_ADCSCR, 0);
|
||||
+}
|
||||
+
|
||||
+static int n810bm_hw_init(struct n810bm *bm)
|
||||
+{
|
||||
+ retu_write(bm, RETU_REG_ADCSCR, 0);
|
||||
+
|
||||
+ bm->capacity = n810bm_read_batt_capacity(bm);
|
||||
+ if (bm->capacity == N810BM_CAP_UNKNOWN) {
|
||||
+ dev_err(&bm->pdev->dev, "Unknown battery detected");
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
+ dev_info(&bm->pdev->dev, "Detected %u mAh battery\n",
|
||||
+ (unsigned int)bm->capacity);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static int __devinit n810bm_probe(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct n810bm *bm;
|
||||
+ int err;
|
||||
+
|
||||
+ bm = kzalloc(sizeof(*bm), GFP_KERNEL);
|
||||
+ if (!bm)
|
||||
+ return -ENOMEM;
|
||||
+ bm->pdev = pdev;
|
||||
+ platform_set_drvdata(pdev, bm);
|
||||
+ spin_lock_init(&bm->lock);
|
||||
+ setup_timer(&bm->check_timer, n810bm_check_timer, (unsigned long)bm);
|
||||
+
|
||||
+ err = n810bm_hw_init(bm);
|
||||
+ if (err)
|
||||
+ goto err_free;
|
||||
+ err = device_create_file(&pdev->dev, &dev_attr_batt_charge);
|
||||
+ if (err)
|
||||
+ goto err_exit;
|
||||
+ err = device_create_file(&pdev->dev, &dev_attr_batt_capacity);
|
||||
+ if (err)
|
||||
+ goto err_rem_charge;
|
||||
+ err = retu_request_irq(RETU_INT_ADCS, n810bm_adc_irq_handler,
|
||||
+ (unsigned long)bm, "n810bm");
|
||||
+ if (err)
|
||||
+ goto err_rem_capa;
|
||||
+
|
||||
+ mod_timer(&bm->check_timer, round_jiffies(jiffies + N810BM_CHECK_INTERVAL));
|
||||
+
|
||||
+ dev_info(&pdev->dev, "Battery management initialized");
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+err_rem_capa:
|
||||
+ device_remove_file(&pdev->dev, &dev_attr_batt_capacity);
|
||||
+err_rem_charge:
|
||||
+ device_remove_file(&pdev->dev, &dev_attr_batt_charge);
|
||||
+err_exit:
|
||||
+ n810bm_hw_exit(bm);
|
||||
+err_free:
|
||||
+ kfree(bm);
|
||||
+ platform_set_drvdata(pdev, NULL);
|
||||
+ return err;
|
||||
+}
|
||||
+
|
||||
+static int __devexit n810bm_remove(struct platform_device *pdev)
|
||||
+{
|
||||
+ struct n810bm *bm = platform_get_drvdata(pdev);
|
||||
+
|
||||
+ retu_free_irq(RETU_INT_ADCS);
|
||||
+ del_timer_sync(&bm->check_timer);
|
||||
+ device_remove_file(&pdev->dev, &dev_attr_batt_capacity);
|
||||
+ device_remove_file(&pdev->dev, &dev_attr_batt_charge);
|
||||
+ n810bm_hw_exit(bm);
|
||||
+
|
||||
+ kfree(bm);
|
||||
+ platform_set_drvdata(pdev, NULL);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct platform_driver n810bm_driver = {
|
||||
+ .remove = __devexit_p(n810bm_remove),
|
||||
+ .driver = {
|
||||
+ .name = "n810bm",
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+static int __init n810bm_modinit(void)
|
||||
+{
|
||||
+ return platform_driver_probe(&n810bm_driver, n810bm_probe);
|
||||
+}
|
||||
+module_init(n810bm_modinit);
|
||||
+
|
||||
+static void __exit n810bm_modexit(void)
|
||||
+{
|
||||
+ platform_driver_unregister(&n810bm_driver);
|
||||
+}
|
||||
+module_exit(n810bm_modexit);
|
||||
+
|
||||
+MODULE_DESCRIPTION("Nokia n810 battery management");
|
||||
+MODULE_LICENSE("GPL");
|
||||
+MODULE_AUTHOR("Michael Buesch");
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/retu.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/retu.c 2010-11-05 17:38:14.834000050 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/retu.c 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -85,10 +85,10 @@
|
||||
*
|
||||
* This function writes a value to the specified register
|
||||
*/
|
||||
-void retu_write_reg(int reg, u16 val)
|
||||
+int retu_write_reg(int reg, u16 val)
|
||||
{
|
||||
BUG_ON(!retu_initialized);
|
||||
- cbus_write_reg(cbus_host, RETU_ID, reg, val);
|
||||
+ return cbus_write_reg(cbus_host, RETU_ID, reg, val);
|
||||
}
|
||||
|
||||
void retu_set_clear_reg_bits(int reg, u16 set, u16 clear)
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/retu.h
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/retu.h 2010-11-05 17:38:14.834000050 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/retu.h 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -39,6 +39,7 @@
|
||||
#define RETU_REG_CC2 0x0e /* Common control register 2 */
|
||||
#define RETU_REG_CTRL_CLR 0x0f /* Regulator clear register */
|
||||
#define RETU_REG_CTRL_SET 0x10 /* Regulator set register */
|
||||
+#define RETU_REG_UNK1 0x14 /* 0x1000 is set when charger is plugged in */
|
||||
#define RETU_REG_STATUS 0x16 /* Status register */
|
||||
#define RETU_REG_WATCHDOG 0x17 /* Watchdog register */
|
||||
#define RETU_REG_AUDTXR 0x18 /* Audio Codec Tx register */
|
||||
@@ -58,7 +59,7 @@
|
||||
#define MAX_RETU_IRQ_HANDLERS 16
|
||||
|
||||
int retu_read_reg(int reg);
|
||||
-void retu_write_reg(int reg, u16 val);
|
||||
+int retu_write_reg(int reg, u16 val);
|
||||
void retu_set_clear_reg_bits(int reg, u16 set, u16 clear);
|
||||
int retu_read_adc(int channel);
|
||||
int retu_request_irq(int id, void *irq_handler, unsigned long arg, char *name);
|
||||
Index: linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/arch/arm/mach-omap2/board-n8x0.c 2010-11-05 17:38:14.819000329 +0100
|
||||
+++ linux-2.6.37-rc1/arch/arm/mach-omap2/board-n8x0.c 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -908,6 +908,17 @@
|
||||
ARRAY_SIZE(n8x0_gpio_switches));
|
||||
}
|
||||
|
||||
+static struct platform_device n810_bm_device = {
|
||||
+ .name = "n810bm",
|
||||
+ .id = -1,
|
||||
+};
|
||||
+
|
||||
+static void __init n810_bm_init(void)
|
||||
+{
|
||||
+ if (platform_device_register(&n810_bm_device))
|
||||
+ BUG();
|
||||
+}
|
||||
+
|
||||
static void __init n8x0_init_machine(void)
|
||||
{
|
||||
omap2420_mux_init(board_mux, OMAP_PACKAGE_ZAC);
|
||||
@@ -930,6 +941,8 @@
|
||||
n8x0_onenand_init();
|
||||
n8x0_mmc_init();
|
||||
n8x0_usb_init();
|
||||
+
|
||||
+ n810_bm_init();
|
||||
}
|
||||
|
||||
MACHINE_START(NOKIA_N800, "Nokia N800")
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/lipocharge.c
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/lipocharge.c 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -0,0 +1,63 @@
|
||||
+/*
|
||||
+ * Generic LIPO battery charger
|
||||
+ *
|
||||
+ * Copyright (c) 2010 Michael Buesch <mb@bu3sch.de>
|
||||
+ *
|
||||
+ * 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.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ */
|
||||
+
|
||||
+#include "lipocharge.h"
|
||||
+
|
||||
+#include <linux/slab.h>
|
||||
+
|
||||
+
|
||||
+static void lipocharge_timer(unsigned long data)
|
||||
+{
|
||||
+ struct lipocharge *c = (struct lipocharge *)data;
|
||||
+
|
||||
+ spin_lock(&c->lock);
|
||||
+ //TODO
|
||||
+ spin_unlock(&c->lock);
|
||||
+}
|
||||
+
|
||||
+struct lipocharge * lipocharge_alloc(gfp_t gfp)
|
||||
+{
|
||||
+ struct lipocharge *c;
|
||||
+
|
||||
+ c = kzalloc(sizeof(*c), gfp);
|
||||
+ if (!c)
|
||||
+ return NULL;
|
||||
+ spin_lock_init(&c->lock);
|
||||
+ setup_timer(&c->timer, lipocharge_timer, (unsigned long)c);
|
||||
+
|
||||
+ return c;
|
||||
+}
|
||||
+
|
||||
+void lipocharge_free(struct lipocharge *c)
|
||||
+{
|
||||
+ kfree(c);
|
||||
+}
|
||||
+
|
||||
+int lipocharge_start(struct lipocharge *c)
|
||||
+{
|
||||
+ if (!c->set_current || !c->get_voltage ||
|
||||
+ !c->finished || !c->emergency)
|
||||
+ return -EINVAL;
|
||||
+ if (!c->top_voltage || c->top_voltage > 4200)
|
||||
+ return -EINVAL;
|
||||
+ //TODO
|
||||
+}
|
||||
+
|
||||
+void lipocharge_stop(struct lipocharge *c)
|
||||
+{
|
||||
+ del_timer_sync(&c->timer);
|
||||
+ //TODO
|
||||
+}
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/lipocharge.h
|
||||
===================================================================
|
||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/lipocharge.h 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -0,0 +1,50 @@
|
||||
+#ifndef LIPOCHARGE_H_
|
||||
+#define LIPOCHARGE_H_
|
||||
+
|
||||
+#include <linux/timer.h>
|
||||
+#include <linux/spinlock.h>
|
||||
+
|
||||
+
|
||||
+#define LIPORATE(a,b) (((a) * 1000) + (b))
|
||||
+#define LIPORATE_1C LIPORATE(1,0) /* 1C */
|
||||
+#define LIPORATE_p8C LIPORATE(0,8) /* 0.8C */
|
||||
+
|
||||
+/** struct lipocharge - A generic LIPO charger
|
||||
+ *
|
||||
+ * @capacity: Battery capacity in mAh.
|
||||
+ * @rate: Charge rate.
|
||||
+ * @top_voltage: Fully charged voltage, in mV.
|
||||
+ *
|
||||
+ * @set_current: Set the charge current, in mA.
|
||||
+ * @get_voltage: Get the battery voltage, in mV.
|
||||
+ *
|
||||
+ * @emergency: Something went wrong. Force shutdown.
|
||||
+ *
|
||||
+ * @priv: opaque pointer.
|
||||
+ */
|
||||
+struct lipocharge
|
||||
+{
|
||||
+ unsigned int capacity;
|
||||
+ unsigned int rate;
|
||||
+ unsigned int top_voltage;
|
||||
+
|
||||
+ int (*set_current)(struct lipocharge *c, unsigned int ma);
|
||||
+ int (*get_voltage)(struct lipocharge *c, unsigned int *mv);
|
||||
+
|
||||
+ void (*finished)(struct lipocharge *c);
|
||||
+ void (*emergency)(struct lipocharge *c);
|
||||
+
|
||||
+ void *priv;
|
||||
+
|
||||
+ /* internal */
|
||||
+ spinlock_t lock;
|
||||
+ struct timer_list timer;
|
||||
+};
|
||||
+
|
||||
+struct lipocharge * lipocharge_alloc(gfp_t gfp);
|
||||
+void lipocharge_free(struct lipocharge *c);
|
||||
+
|
||||
+int lipocharge_start(struct lipocharge *c);
|
||||
+void lipocharge_stop(struct lipocharge *c);
|
||||
+
|
||||
+#endif /* LIPOCHARGE_H_ */
|
||||
Index: linux-2.6.37-rc1/drivers/cbus/tahvo.h
|
||||
===================================================================
|
||||
--- linux-2.6.37-rc1.orig/drivers/cbus/tahvo.h 2010-11-05 17:38:14.835000037 +0100
|
||||
+++ linux-2.6.37-rc1/drivers/cbus/tahvo.h 2010-11-05 17:38:14.895000001 +0100
|
||||
@@ -30,8 +30,14 @@
|
||||
#define TAHVO_REG_IDR 0x01 /* Interrupt ID */
|
||||
#define TAHVO_REG_IDSR 0x02 /* Interrupt status */
|
||||
#define TAHVO_REG_IMR 0x03 /* Interrupt mask */
|
||||
+#define TAHVO_REG_CHGCURR 0x04 /* Charge current control (8-bit) */
|
||||
#define TAHVO_REG_LEDPWMR 0x05 /* LED PWM */
|
||||
#define TAHVO_REG_USBR 0x06 /* USB control */
|
||||
+#define TAHVO_REG_CHGCTL 0x08 /* Charge control register */
|
||||
+#define TAHVO_REG_CHGCTL_EN 0x0001 /* Global charge enable */
|
||||
+#define TAHVO_REG_CHGCTL2 0x0c /* Charge control register 2 */
|
||||
+#define TAHVO_REG_BATCURR 0x0d /* Battery (dis)charge current (signed 16-bit) */
|
||||
+
|
||||
#define TAHVO_REG_MAX 0x0d
|
||||
|
||||
/* Interrupt sources */
|
||||
Reference in New Issue
Block a user