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