Delete avr32 specific patch and introduced merged at91/avr32 patch

This commit is contained in:
Ulf Samuelsson 2007-08-19 22:43:50 +00:00
parent 8b6462afa5
commit 167c1a6185
3 changed files with 18609 additions and 8862 deletions

View File

@ -1,130 +0,0 @@
>From 9c5fa914202d20756c56e0c4fd76035ed8f8ced8 Mon Sep 17 00:00:00 2001
From: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
Date: Mon, 6 Aug 2007 08:31:14 +0200
Subject: [PATCH 1/1] Add gpio_mouse board setup to atstk1000 board
This patch adds a gpio_mouse_platform_data to the atstk1000 board code and
registers a gpio_mouse platform_device. This will enable a GPIO mouse on header
J1 on GPIO of the ATSTK1000 development kit. The board code is enabled/disabled
in menuconfig.
By connecting J1 (GPIO) to J25 (SWITCH) you can use the following keys to
simulate a mouse:
SW0: right
SW1: down
SW2: up
SW3: left
SW5: right button
SW6: middle button
SW7: left button
Signed-off-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com>
---
arch/avr32/boards/atstk1000/Kconfig | 16 ++++++++++
arch/avr32/boards/atstk1000/atstk1002.c | 48 +++++++++++++++++++++++++++++++
2 files changed, 64 insertions(+), 0 deletions(-)
diff --git a/arch/avr32/boards/atstk1000/Kconfig b/arch/avr32/boards/atstk1000/Kconfig
index 718578f..d99d4bd 100644
--- a/arch/avr32/boards/atstk1000/Kconfig
+++ b/arch/avr32/boards/atstk1000/Kconfig
@@ -50,6 +50,22 @@ config BOARD_ATSTK1002_SPI1
GPIO lines and accessed through the J1 jumper block. Say "y"
here to configure that SPI controller.
+config BOARD_ATSTK1002_GPIO_MOUSE
+ bool "Configure gpio_mouse on GPIO J1 header"
+ depends on !BOARD_ATSTK1002_SW4_CUSTOM
+ help
+ Enable gpio_mouse board configuration on GPIO 0 to 7. Connecting a
+ 10-pin flat cable from J1 (GPIO) to J25 (SWITCH) will let a user give
+ mouse inputs using the the switches SW0 to SW7.
+
+ SW0: right
+ SW1: down
+ SW2: up
+ SW3: left
+ SW5: right button
+ SW6: middle button
+ SW7: left button
+
config BOARD_ATSTK1002_J2_LED
bool
default BOARD_ATSTK1002_J2_LED8 || BOARD_ATSTK1002_J2_RGB
diff --git a/arch/avr32/boards/atstk1000/atstk1002.c b/arch/avr32/boards/atstk1000/atstk1002.c
index c958fd4..c7560e5 100644
--- a/arch/avr32/boards/atstk1000/atstk1002.c
+++ b/arch/avr32/boards/atstk1000/atstk1002.c
@@ -17,6 +17,7 @@
#include <linux/types.h>
#include <linux/spi/spi.h>
#include <linux/spi/at73c213.h>
+#include <linux/gpio_mouse.h>
#include <video/atmel_lcdc.h>
@@ -91,6 +92,49 @@ static struct mci_platform_data __initdata mci0_data = {
.wp_pin = GPIO_PIN_NONE,
};
+#ifdef CONFIG_BOARD_ATSTK1002_GPIO_MOUSE
+static struct gpio_mouse_platform_data gpio_mouse0_data = {
+ .polarity = GPIO_MOUSE_POLARITY_ACT_LOW,
+ {
+ {
+ .up = GPIO_PIN_PB(2),
+ .down = GPIO_PIN_PB(1),
+ .left = GPIO_PIN_PB(3),
+ .right = GPIO_PIN_PB(0),
+ .bleft = GPIO_PIN_PB(7),
+ .bmiddle = GPIO_PIN_PB(6),
+ .bright = GPIO_PIN_PB(5),
+ },
+ },
+ .scan_ms = 10,
+};
+
+static struct platform_device gpio_mouse0_device = {
+ .name = "gpio_mouse",
+ .id = 0,
+ .dev = {
+ .platform_data = &gpio_mouse0_data,
+ },
+};
+
+static void __init add_device_gpio_mouse0(void)
+{
+ struct platform_device *pdev = &gpio_mouse0_device;
+ struct gpio_mouse_platform_data *data = pdev->dev.platform_data;
+
+ at32_select_gpio(data->up, 0);
+ at32_select_gpio(data->down, 0);
+ at32_select_gpio(data->left, 0);
+ at32_select_gpio(data->right, 0);
+
+ at32_select_gpio(data->bleft, 0);
+ at32_select_gpio(data->bmiddle, 0);
+ at32_select_gpio(data->bright, 0);
+
+ platform_device_register(pdev);
+}
+#endif
+
/*
* The next two functions should go away as the boot loader is
* supposed to initialize the macb address registers with a valid
@@ -317,6 +361,10 @@ static int __init atstk1002_init(void)
#endif
#endif
+#ifdef CONFIG_BOARD_ATSTK1002_GPIO_MOUSE
+ add_device_gpio_mouse0();
+#endif
+
return 0;
}
postcore_initcall(atstk1002_init);
--
1.5.2.3

View File

@ -0,0 +1,122 @@
--- linux-2.6.22/arch/arm/kernel/head-common.S 2007-05-16 10:13:04.000000000 -0500
+++ linux-2.6.22-bgat/arch/arm/kernel/head-common.S 2007-05-30 21:54:45.000000000 -0500
@@ -20,7 +20,8 @@
.long _end @ r7
.long processor_id @ r4
.long __machine_arch_type @ r5
- .long cr_alignment @ r6
+ .long __atags_pointer @ r6
+ .long cr_alignment @ r7
.long init_thread_union + THREAD_START_SP @ sp
/*
@@ -29,6 +30,7 @@
*
* r0 = cp#15 control register
* r1 = machine ID
+ * r2 = atags pointer
* r9 = processor ID
*/
.type __mmap_switched, %function
@@ -47,11 +49,12 @@
strcc fp, [r6],#4
bcc 1b
- ldmia r3, {r4, r5, r6, sp}
+ ldmia r3, {r4, r5, r6, r7, sp}
str r9, [r4] @ Save processor ID
str r1, [r5] @ Save machine type
+ str r2, [r6] @ Save atags pointer
bic r4, r0, #CR_A @ Clear 'A' bit
- stmia r6, {r0, r4} @ Save control register values
+ stmia r7, {r0, r4} @ Save control register values
b start_kernel
/*
@@ -215,3 +218,34 @@
bl __lookup_machine_type
mov r0, r5
ldmfd sp!, {r4 - r6, pc}
+
+/* Determine validity of the r2 atags pointer. The heuristic requires
+ * that the pointer be aligned, in the first 16k of physical RAM and
+ * that the ATAG_CORE marker is first and present. Future revisions
+ * of this function may be more lenient with the physical address and
+ * may also be able to move the ATAGS block if necessary.
+ *
+ * r8 = machinfo
+ *
+ * Returns:
+ * r2 either valid atags pointer, or zero
+ * r5, r6 corrupted
+ */
+
+ .type __vet_atags, %function
+__vet_atags:
+ tst r2, #0x3 @ aligned?
+ bne 1f
+
+ ldr r5, [r2, #0] @ is first tag ATAG_CORE?
+ subs r5, r5, #ATAG_CORE_SIZE
+ bne 1f
+ ldr r5, [r2, #4]
+ ldr r6, =ATAG_CORE
+ cmp r5, r6
+ bne 1f
+
+ mov pc, lr @ atag pointer is ok
+
+1: mov r2, #0
+ mov pc, lr
--- linux-2.6.22/arch/arm/kernel/head.S 2007-05-30 08:29:34.000000000 -0500
+++ linux-2.6.22-bgat/arch/arm/kernel/head.S 2007-05-30 22:05:53.000000000 -0500
@@ -29,6 +29,10 @@
#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET)
#define KERNEL_RAM_PADDR (PHYS_OFFSET + TEXT_OFFSET)
+#define ATAG_CORE 0x54410001
+#define ATAG_CORE_SIZE ((2*4 + 3*4) >> 2)
+
+
/*
* swapper_pg_dir is the virtual address of the initial page table.
* We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must
@@ -61,7 +65,7 @@
*
* This is normally called from the decompressor code. The requirements
* are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
- * r1 = machine nr.
+ * r1 = machine nr, r2 = atags pointer.
*
* This code is mostly position independent, so if you link the kernel at
* 0xc0008000, you call this at __pa(0xc0008000).
@@ -85,6 +89,7 @@
bl __lookup_machine_type @ r5=machinfo
movs r8, r5 @ invalid machine (r5=0)?
beq __error_a @ yes, error 'a'
+ bl __vet_atags
bl __create_page_tables
/*
--- linux-2.6.22/arch/arm/kernel/setup.c 2007-05-30 08:29:34.000000000 -0500
+++ linux-2.6.22-bgat/arch/arm/kernel/setup.c 2007-05-30 22:07:08.000000000 -0500
@@ -63,6 +63,8 @@
unsigned int __machine_arch_type;
EXPORT_SYMBOL(__machine_arch_type);
+unsigned int __atags_pointer __initdata;
+
unsigned int system_rev;
EXPORT_SYMBOL(system_rev);
@@ -780,7 +782,9 @@
if (mdesc->soft_reboot)
reboot_setup("s");
- if (mdesc->boot_params)
+ if (__atags_pointer)
+ tags = phys_to_virt(__atags_pointer);
+ else if (mdesc->boot_params)
tags = phys_to_virt(mdesc->boot_params);
/*