diff options
author | Johannes Weiner <jw@emlix.com> | 2009-03-04 10:21:33 -0500 |
---|---|---|
committer | Chris Zankel <chris@zankel.net> | 2009-04-03 02:44:31 -0400 |
commit | f82e939fb75ad01da8f0d3024fc678111ddb4ac7 (patch) | |
tree | 1edc0557251bdde18268dbe759b7e967c9555d3c /arch/xtensa/platforms | |
parent | 6770fa020fe3b63915ab082b4e5fd99d2d368c82 (diff) |
xtensa: platform: s6105
Support for the S6105 IP Camera Reference Design Kit.
Signed-off-by: Johannes Weiner <jw@emlix.com>
Signed-off-by: Oskar Schirmer <os@emlix.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
Diffstat (limited to 'arch/xtensa/platforms')
-rw-r--r-- | arch/xtensa/platforms/s6105/Makefile | 3 | ||||
-rw-r--r-- | arch/xtensa/platforms/s6105/device.c | 67 | ||||
-rw-r--r-- | arch/xtensa/platforms/s6105/include/platform/gpio.h | 27 | ||||
-rw-r--r-- | arch/xtensa/platforms/s6105/include/platform/hardware.h | 11 | ||||
-rw-r--r-- | arch/xtensa/platforms/s6105/include/platform/serial.h | 8 | ||||
-rw-r--r-- | arch/xtensa/platforms/s6105/setup.c | 61 |
6 files changed, 177 insertions, 0 deletions
diff --git a/arch/xtensa/platforms/s6105/Makefile b/arch/xtensa/platforms/s6105/Makefile new file mode 100644 index 000000000000..0be6194bcb72 --- /dev/null +++ b/arch/xtensa/platforms/s6105/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | # Makefile for the Stretch S6105 eval board | ||
2 | |||
3 | obj-y := setup.o device.o | ||
diff --git a/arch/xtensa/platforms/s6105/device.c b/arch/xtensa/platforms/s6105/device.c new file mode 100644 index 000000000000..78b08be5a92d --- /dev/null +++ b/arch/xtensa/platforms/s6105/device.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /* | ||
2 | * s6105 platform devices | ||
3 | * | ||
4 | * Copyright (c) 2009 emlix GmbH | ||
5 | */ | ||
6 | |||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <linux/platform_device.h> | ||
10 | #include <linux/serial.h> | ||
11 | #include <linux/serial_8250.h> | ||
12 | |||
13 | #include <variant/hardware.h> | ||
14 | |||
15 | #define UART_INTNUM 4 | ||
16 | |||
17 | static const signed char uart_irq_mappings[] = { | ||
18 | S6_INTC_UART(0), | ||
19 | S6_INTC_UART(1), | ||
20 | -1, | ||
21 | }; | ||
22 | |||
23 | const signed char *platform_irq_mappings[NR_IRQS] = { | ||
24 | [UART_INTNUM] = uart_irq_mappings, | ||
25 | }; | ||
26 | |||
27 | static struct plat_serial8250_port serial_platform_data[] = { | ||
28 | { | ||
29 | .membase = (void *)S6_REG_UART + 0x0000, | ||
30 | .mapbase = S6_REG_UART + 0x0000, | ||
31 | .irq = UART_INTNUM, | ||
32 | .uartclk = S6_SCLK, | ||
33 | .regshift = 2, | ||
34 | .iotype = SERIAL_IO_MEM, | ||
35 | .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST, | ||
36 | }, | ||
37 | { | ||
38 | .membase = (void *)S6_REG_UART + 0x1000, | ||
39 | .mapbase = S6_REG_UART + 0x1000, | ||
40 | .irq = UART_INTNUM, | ||
41 | .uartclk = S6_SCLK, | ||
42 | .regshift = 2, | ||
43 | .iotype = SERIAL_IO_MEM, | ||
44 | .flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST, | ||
45 | }, | ||
46 | { }, | ||
47 | }; | ||
48 | |||
49 | static struct platform_device platform_devices[] = { | ||
50 | { | ||
51 | .name = "serial8250", | ||
52 | .id = PLAT8250_DEV_PLATFORM, | ||
53 | .dev = { | ||
54 | .platform_data = serial_platform_data, | ||
55 | }, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | static int __init device_init(void) | ||
60 | { | ||
61 | int i; | ||
62 | |||
63 | for (i = 0; i < ARRAY_SIZE(platform_devices); i++) | ||
64 | platform_device_register(&platform_devices[i]); | ||
65 | return 0; | ||
66 | } | ||
67 | arch_initcall_sync(device_init); | ||
diff --git a/arch/xtensa/platforms/s6105/include/platform/gpio.h b/arch/xtensa/platforms/s6105/include/platform/gpio.h new file mode 100644 index 000000000000..fa11aa4b61e9 --- /dev/null +++ b/arch/xtensa/platforms/s6105/include/platform/gpio.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __ASM_XTENSA_S6105_GPIO_H | ||
2 | #define __ASM_XTENSA_S6105_GPIO_H | ||
3 | |||
4 | #define GPIO_BP_TEMP_ALARM 0 | ||
5 | #define GPIO_PB_RESET_IN 1 | ||
6 | #define GPIO_EXP_IRQ 2 | ||
7 | #define GPIO_TRIGGER_IRQ 3 | ||
8 | #define GPIO_RTC_IRQ 4 | ||
9 | #define GPIO_PHY_IRQ 5 | ||
10 | #define GPIO_IMAGER_RESET 6 | ||
11 | #define GPIO_SD_IRQ 7 | ||
12 | #define GPIO_MINI_BOOT_INH 8 | ||
13 | #define GPIO_BOARD_RESET 9 | ||
14 | #define GPIO_EXP_PRESENT 10 | ||
15 | #define GPIO_LED1_NGREEN 12 | ||
16 | #define GPIO_LED1_RED 13 | ||
17 | #define GPIO_LED0_NGREEN 14 | ||
18 | #define GPIO_LED0_NRED 15 | ||
19 | #define GPIO_SPI_CS0 16 | ||
20 | #define GPIO_SPI_CS1 17 | ||
21 | #define GPIO_SPI_CS3 19 | ||
22 | #define GPIO_SPI_CS4 20 | ||
23 | #define GPIO_SD_WP 21 | ||
24 | #define GPIO_BP_RESET 22 | ||
25 | #define GPIO_ALARM_OUT 23 | ||
26 | |||
27 | #endif /* __ASM_XTENSA_S6105_GPIO_H */ | ||
diff --git a/arch/xtensa/platforms/s6105/include/platform/hardware.h b/arch/xtensa/platforms/s6105/include/platform/hardware.h new file mode 100644 index 000000000000..d628efac7089 --- /dev/null +++ b/arch/xtensa/platforms/s6105/include/platform/hardware.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef __XTENSA_S6105_HARDWARE_H | ||
2 | #define __XTENSA_S6105_HARDWARE_H | ||
3 | |||
4 | #define PLATFORM_DEFAULT_MEM_START 0x40000000 | ||
5 | #define PLATFORM_DEFAULT_MEM_SIZE 0x08000000 | ||
6 | |||
7 | #define MAX_DMA_ADDRESS 0 | ||
8 | |||
9 | #define KERNELOFFSET (PLATFORM_DEFAULT_MEM_START + 0x1000) | ||
10 | |||
11 | #endif /* __XTENSA_S6105_HARDWARE_H */ | ||
diff --git a/arch/xtensa/platforms/s6105/include/platform/serial.h b/arch/xtensa/platforms/s6105/include/platform/serial.h new file mode 100644 index 000000000000..c8a771e5981b --- /dev/null +++ b/arch/xtensa/platforms/s6105/include/platform/serial.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #ifndef __ASM_XTENSA_S6105_SERIAL_H | ||
2 | #define __ASM_XTENSA_S6105_SERIAL_H | ||
3 | |||
4 | #include <variant/hardware.h> | ||
5 | |||
6 | #define BASE_BAUD (S6_SCLK / 16) | ||
7 | |||
8 | #endif /* __ASM_XTENSA_S6105_SERIAL_H */ | ||
diff --git a/arch/xtensa/platforms/s6105/setup.c b/arch/xtensa/platforms/s6105/setup.c new file mode 100644 index 000000000000..ae041d5027a2 --- /dev/null +++ b/arch/xtensa/platforms/s6105/setup.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * s6105 control routines | ||
3 | * | ||
4 | * Copyright (c) 2009 emlix GmbH | ||
5 | */ | ||
6 | #include <linux/irq.h> | ||
7 | #include <linux/io.h> | ||
8 | #include <linux/gpio.h> | ||
9 | |||
10 | #include <asm/bootparam.h> | ||
11 | |||
12 | #include <variant/hardware.h> | ||
13 | #include <platform/gpio.h> | ||
14 | |||
15 | void platform_halt(void) | ||
16 | { | ||
17 | local_irq_disable(); | ||
18 | while (1) | ||
19 | ; | ||
20 | } | ||
21 | |||
22 | void platform_power_off(void) | ||
23 | { | ||
24 | platform_halt(); | ||
25 | } | ||
26 | |||
27 | void platform_restart(void) | ||
28 | { | ||
29 | platform_halt(); | ||
30 | } | ||
31 | |||
32 | void __init platform_setup(char **cmdline) | ||
33 | { | ||
34 | unsigned long reg; | ||
35 | |||
36 | reg = readl(S6_REG_GREG1 + S6_GREG1_CLKGATE); | ||
37 | reg &= ~(1 << S6_GREG1_BLOCK_SB); | ||
38 | writel(reg, S6_REG_GREG1 + S6_GREG1_CLKGATE); | ||
39 | |||
40 | reg = readl(S6_REG_GREG1 + S6_GREG1_BLOCKENA); | ||
41 | reg |= 1 << S6_GREG1_BLOCK_SB; | ||
42 | writel(reg, S6_REG_GREG1 + S6_GREG1_BLOCKENA); | ||
43 | |||
44 | printk(KERN_NOTICE "S6105 on Stretch S6000 - " | ||
45 | "Copyright (C) 2009 emlix GmbH <info@emlix.com>\n"); | ||
46 | } | ||
47 | |||
48 | void __init platform_init(bp_tag_t *first) | ||
49 | { | ||
50 | gpio_request(GPIO_LED1_NGREEN, "led1_green"); | ||
51 | gpio_request(GPIO_LED1_RED, "led1_red"); | ||
52 | gpio_direction_output(GPIO_LED1_NGREEN, 1); | ||
53 | } | ||
54 | |||
55 | void platform_heartbeat(void) | ||
56 | { | ||
57 | static unsigned int c; | ||
58 | |||
59 | if (!(++c & 0x4F)) | ||
60 | gpio_direction_output(GPIO_LED1_RED, !(c & 0x10)); | ||
61 | } | ||