5fc45e9ffebdd776a21931b173df86274275cffa
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.2 / 0010-MIPS-lantiq-add-support-for-the-EASY98000-evaluation.patch
1 From ce27aac6ea9503ae4be0f65423424d92a714d9da Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 11 Aug 2011 14:09:35 +0200
4 Subject: [PATCH 10/73] MIPS: lantiq: add support for the EASY98000 evaluation
5 board
6
7 This patch adds the machine code for the EASY9800 evaluation board.
8
9 Signed-off-by: Thomas Langer <thomas.langer@lantiq.com>
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 ---
12 arch/mips/lantiq/falcon/Kconfig | 11 +++
13 arch/mips/lantiq/falcon/Makefile | 1 +
14 arch/mips/lantiq/falcon/mach-easy98000.c | 110 ++++++++++++++++++++++++++++++
15 arch/mips/lantiq/machtypes.h | 5 ++
16 4 files changed, 127 insertions(+), 0 deletions(-)
17 create mode 100644 arch/mips/lantiq/falcon/Kconfig
18 create mode 100644 arch/mips/lantiq/falcon/mach-easy98000.c
19
20 diff --git a/arch/mips/lantiq/falcon/Kconfig b/arch/mips/lantiq/falcon/Kconfig
21 new file mode 100644
22 index 0000000..03e999d
23 --- /dev/null
24 +++ b/arch/mips/lantiq/falcon/Kconfig
25 @@ -0,0 +1,11 @@
26 +if SOC_FALCON
27 +
28 +menu "MIPS Machine"
29 +
30 +config LANTIQ_MACH_EASY98000
31 + bool "Easy98000"
32 + default y
33 +
34 +endmenu
35 +
36 +endif
37 diff --git a/arch/mips/lantiq/falcon/Makefile b/arch/mips/lantiq/falcon/Makefile
38 index de72209..56b22eb 100644
39 --- a/arch/mips/lantiq/falcon/Makefile
40 +++ b/arch/mips/lantiq/falcon/Makefile
41 @@ -1 +1,2 @@
42 obj-y := clk.o prom.o reset.o sysctrl.o devices.o gpio.o
43 +obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
44 diff --git a/arch/mips/lantiq/falcon/mach-easy98000.c b/arch/mips/lantiq/falcon/mach-easy98000.c
45 new file mode 100644
46 index 0000000..361b8f0
47 --- /dev/null
48 +++ b/arch/mips/lantiq/falcon/mach-easy98000.c
49 @@ -0,0 +1,110 @@
50 +/*
51 + * This program is free software; you can redistribute it and/or modify it
52 + * under the terms of the GNU General Public License version 2 as published
53 + * by the Free Software Foundation.
54 + *
55 + * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
56 + * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
57 + */
58 +
59 +#include <linux/platform_device.h>
60 +#include <linux/mtd/partitions.h>
61 +#include <linux/spi/spi.h>
62 +#include <linux/spi/spi_gpio.h>
63 +#include <linux/spi/eeprom.h>
64 +
65 +#include "../machtypes.h"
66 +
67 +#include "devices.h"
68 +
69 +static struct mtd_partition easy98000_nor_partitions[] = {
70 + {
71 + .name = "uboot",
72 + .offset = 0x0,
73 + .size = 0x40000,
74 + },
75 + {
76 + .name = "uboot_env",
77 + .offset = 0x40000,
78 + .size = 0x40000, /* 2 sectors for redundant env. */
79 + },
80 + {
81 + .name = "linux",
82 + .offset = 0x80000,
83 + .size = 0xF80000, /* map only 16 MiB */
84 + },
85 +};
86 +
87 +struct physmap_flash_data easy98000_nor_flash_data = {
88 + .nr_parts = ARRAY_SIZE(easy98000_nor_partitions),
89 + .parts = easy98000_nor_partitions,
90 +};
91 +
92 +/* setup gpio based spi bus/device for access to the eeprom on the board */
93 +#define SPI_GPIO_MRST 102
94 +#define SPI_GPIO_MTSR 103
95 +#define SPI_GPIO_CLK 104
96 +#define SPI_GPIO_CS0 105
97 +#define SPI_GPIO_CS1 106
98 +#define SPI_GPIO_BUS_NUM 1
99 +
100 +static struct spi_gpio_platform_data easy98000_spi_gpio_data = {
101 + .sck = SPI_GPIO_CLK,
102 + .mosi = SPI_GPIO_MTSR,
103 + .miso = SPI_GPIO_MRST,
104 + .num_chipselect = 2,
105 +};
106 +
107 +static struct platform_device easy98000_spi_gpio_device = {
108 + .name = "spi_gpio",
109 + .id = SPI_GPIO_BUS_NUM,
110 + .dev.platform_data = &easy98000_spi_gpio_data,
111 +};
112 +
113 +static struct spi_eeprom at25160n = {
114 + .byte_len = 16 * 1024 / 8,
115 + .name = "at25160n",
116 + .page_size = 32,
117 + .flags = EE_ADDR2,
118 +};
119 +
120 +static struct spi_board_info easy98000_spi_gpio_devices __initdata = {
121 + .modalias = "at25",
122 + .bus_num = SPI_GPIO_BUS_NUM,
123 + .max_speed_hz = 1000 * 1000,
124 + .mode = SPI_MODE_3,
125 + .chip_select = 1,
126 + .controller_data = (void *) SPI_GPIO_CS1,
127 + .platform_data = &at25160n,
128 +};
129 +
130 +static void __init
131 +easy98000_init_common(void)
132 +{
133 + spi_register_board_info(&easy98000_spi_gpio_devices, 1);
134 + platform_device_register(&easy98000_spi_gpio_device);
135 +}
136 +
137 +static void __init
138 +easy98000_init(void)
139 +{
140 + easy98000_init_common();
141 + ltq_register_nor(&easy98000_nor_flash_data);
142 +}
143 +
144 +static void __init
145 +easy98000nand_init(void)
146 +{
147 + easy98000_init_common();
148 + falcon_register_nand();
149 +}
150 +
151 +MIPS_MACHINE(LANTIQ_MACH_EASY98000,
152 + "EASY98000",
153 + "EASY98000 Eval Board",
154 + easy98000_init);
155 +
156 +MIPS_MACHINE(LANTIQ_MACH_EASY98000NAND,
157 + "EASY98000NAND",
158 + "EASY98000 Eval Board (NAND Flash)",
159 + easy98000nand_init);
160 diff --git a/arch/mips/lantiq/machtypes.h b/arch/mips/lantiq/machtypes.h
161 index 7e01b8c..dfc6af7 100644
162 --- a/arch/mips/lantiq/machtypes.h
163 +++ b/arch/mips/lantiq/machtypes.h
164 @@ -15,6 +15,11 @@ enum lantiq_mach_type {
165 LTQ_MACH_GENERIC = 0,
166 LTQ_MACH_EASY50712, /* Danube evaluation board */
167 LTQ_MACH_EASY50601, /* Amazon SE evaluation board */
168 +
169 + /* FALCON */
170 + LANTIQ_MACH_EASY98000, /* Falcon Eval Board, NOR Flash */
171 + LANTIQ_MACH_EASY98000SF, /* Falcon Eval Board, Serial Flash */
172 + LANTIQ_MACH_EASY98000NAND, /* Falcon Eval Board, NAND Flash */
173 };
174
175 #endif
176 --
177 1.7.9.1
178