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