2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
6 * Copyright (C) 2011 Thomas Langer <thomas.langer@lantiq.com>
7 * Copyright (C) 2011 John Crispin <blogic@openwrt.org>
10 #include <linux/platform_device.h>
11 #include <linux/mtd/partitions.h>
12 #include <linux/spi/spi.h>
13 #include <linux/spi/spi_gpio.h>
14 #include <linux/spi/eeprom.h>
16 #include "../machtypes.h"
20 static struct mtd_partition easy98000_nor_partitions[] = {
29 .size = 0x40000, /* 2 sectors for redundant env. */
34 .size = 0xF80000, /* map only 16 MiB */
38 struct physmap_flash_data easy98000_nor_flash_data = {
39 .nr_parts = ARRAY_SIZE(easy98000_nor_partitions),
40 .parts = easy98000_nor_partitions,
43 static struct flash_platform_data easy98000_spi_flash_platform_data = {
45 .parts = easy98000_nor_partitions,
46 .nr_parts = ARRAY_SIZE(easy98000_nor_partitions)
49 static struct spi_board_info easy98000_spi_flash_data __initdata = {
53 .max_speed_hz = 10 * 1000 * 1000,
55 .platform_data = &easy98000_spi_flash_platform_data
58 /* setup gpio based spi bus/device for access to the eeprom on the board */
59 #define SPI_GPIO_MRST 102
60 #define SPI_GPIO_MTSR 103
61 #define SPI_GPIO_CLK 104
62 #define SPI_GPIO_CS0 105
63 #define SPI_GPIO_CS1 106
64 #define SPI_GPIO_BUS_NUM 1
66 static struct spi_gpio_platform_data easy98000_spi_gpio_data = {
68 .mosi = SPI_GPIO_MTSR,
69 .miso = SPI_GPIO_MRST,
73 static struct platform_device easy98000_spi_gpio_device = {
75 .id = SPI_GPIO_BUS_NUM,
76 .dev.platform_data = &easy98000_spi_gpio_data,
79 static struct spi_eeprom at25160n = {
80 .byte_len = 16 * 1024 / 8,
86 static struct spi_board_info easy98000_spi_gpio_devices __initdata = {
88 .bus_num = SPI_GPIO_BUS_NUM,
89 .max_speed_hz = 1000 * 1000,
92 .controller_data = (void *) SPI_GPIO_CS1,
93 .platform_data = &at25160n,
97 easy98000_init_common(void)
99 spi_register_board_info(&easy98000_spi_gpio_devices, 1);
100 platform_device_register(&easy98000_spi_gpio_device);
101 falcon_register_i2c();
107 easy98000_init_common();
108 ltq_register_nor(&easy98000_nor_flash_data);
112 easy98000sf_init(void)
114 easy98000_init_common();
115 falcon_register_spi_flash(&easy98000_spi_flash_data);
119 easy98000nand_init(void)
121 easy98000_init_common();
122 falcon_register_nand();
125 MIPS_MACHINE(LANTIQ_MACH_EASY98000,
127 "EASY98000 Eval Board",
130 MIPS_MACHINE(LANTIQ_MACH_EASY98000SF,
132 "EASY98000 Eval Board (Serial Flash)",
135 MIPS_MACHINE(LANTIQ_MACH_EASY98000NAND,
137 "EASY98000 Eval Board (NAND Flash)",