618f8fbfd9bcfbd68a6d17e8cbb9178540d19e54
[openwrt.git] / target / linux / lantiq / patches / 930-falcon-95C3AM1.patch
1 --- /dev/null
2 +++ b/arch/mips/lantiq/falcon/mach-95C3AM1.c
3 @@ -0,0 +1,103 @@
4 +#include <linux/init.h>
5 +#include <linux/platform_device.h>
6 +#include <linux/i2c-gpio.h>
7 +#include <machine.h>
8 +
9 +#include "devices.h"
10 +#include "dev-leds-gpio.h"
11 +
12 +#define BOARD_95C3AM1_GPIO_LED_0 10
13 +#define BOARD_95C3AM1_GPIO_LED_1 11
14 +#define BOARD_95C3AM1_GPIO_LED_2 12
15 +#define BOARD_95C3AM1_GPIO_LED_3 13
16 +
17 +extern unsigned char lq_ethaddr[6];
18 +
19 +#ifdef CONFIG_MTD_PARTITIONS
20 +static struct mtd_partition board_95C3AM1_partitions[] =
21 +{
22 +       {
23 +               .name   = "uboot",
24 +               .offset = 0x0,
25 +               .size   = 0x40000,
26 +       },
27 +       {
28 +               .name   = "uboot_env",
29 +               .offset = 0x40000,
30 +               .size   = 0x40000,      /* 2 sectors for redundant env. */
31 +       },
32 +       {
33 +               .name   = "linux",
34 +               .offset = 0x80000,
35 +               .size   = 0xF80000,     /* map only 16 MiB */
36 +       },
37 +};
38 +
39 +static struct flash_platform_data board_95C3AM1_flash_platform_data = {
40 +       .name = "sflash",
41 +       .parts = board_95C3AM1_partitions,
42 +       .nr_parts = ARRAY_SIZE(board_95C3AM1_partitions)
43 +};
44 +#endif
45 +
46 +static struct spi_board_info board_95C3AM1_flash_data __initdata = {
47 +       .modalias               = "m25p80",
48 +       .bus_num                = 0,
49 +       .chip_select            = 0,
50 +       .max_speed_hz           = 10 * 1000 * 1000,
51 +       .mode                   = SPI_MODE_3,
52 +#ifdef CONFIG_MTD_PARTITIONS
53 +       .platform_data          = &board_95C3AM1_flash_platform_data
54 +#endif
55 +};
56 +
57 +static struct gpio_led board_95C3AM1_leds_gpio[] __initdata = {
58 +       {
59 +               .name           = "power",
60 +               .gpio           = BOARD_95C3AM1_GPIO_LED_0,
61 +               .active_low     = 0,
62 +       }, {
63 +               .name           = "optical",
64 +               .gpio           = BOARD_95C3AM1_GPIO_LED_1,
65 +               .active_low     = 0,
66 +       }, {
67 +               .name           = "lan",
68 +               .gpio           = BOARD_95C3AM1_GPIO_LED_2,
69 +               .active_low     = 0,
70 +       }, {
71 +               .name           = "update",
72 +               .gpio           = BOARD_95C3AM1_GPIO_LED_3,
73 +               .active_low     = 0,
74 +       }
75 +};
76 +
77 +static struct i2c_gpio_platform_data board_95C3AM1_i2c_gpio_data = {
78 +       .sda_pin        = 107,
79 +       .scl_pin        = 108,
80 +};
81 +
82 +static struct platform_device board_95C3AM1_i2c_gpio_device = {
83 +       .name           = "i2c-gpio",
84 +       .id             = 0,
85 +       .dev = {
86 +               .platform_data  = &board_95C3AM1_i2c_gpio_data,
87 +       }
88 +};
89 +
90 +static void __init board_95C3AM1_init(void)
91 +{
92 +       falcon_register_asc(0);
93 +       falcon_register_gpio();
94 +       falcon_register_wdt();
95 +       falcon_register_i2c();
96 +       falcon_register_spi_flash(&board_95C3AM1_flash_data);
97 +       platform_device_register(&board_95C3AM1_i2c_gpio_device);
98 +       lq_add_device_leds_gpio(-1, ARRAY_SIZE(board_95C3AM1_leds_gpio),
99 +                                               board_95C3AM1_leds_gpio);
100 +       falcon_register_crypto();
101 +}
102 +
103 +MIPS_MACHINE(LANTIQ_MACH_95C3AM1,
104 +                       "95C3AM1",
105 +                       "95C3AM1 Board",
106 +                       board_95C3AM1_init);
107 --- a/arch/mips/include/asm/mach-lantiq/machine.h
108 +++ b/arch/mips/include/asm/mach-lantiq/machine.h
109 @@ -7,6 +7,7 @@ enum lantiq_mach_type {
110         LANTIQ_MACH_EASY98000,          /* Falcon Eval Board, NOR Flash */
111         LANTIQ_MACH_EASY98000SF,        /* Falcon Eval Board, Serial Flash */
112         LANTIQ_MACH_EASY98020,          /* Falcon Reference Board */
113 +       LANTIQ_MACH_95C3AM1,            /* Board 95C3AM1 */
114  
115         /* XWAY */
116         LANTIQ_MACH_EASY4010,           /* Twinpass evalkit */
117 --- a/arch/mips/lantiq/falcon/Kconfig
118 +++ b/arch/mips/lantiq/falcon/Kconfig
119 @@ -10,6 +10,10 @@ config LANTIQ_MACH_EASY98020
120         bool "Easy98020"
121         default y
122  
123 +config LANTIQ_MACH_95C3AM1
124 +       bool "95C3AM1"
125 +       default y
126 +
127  endmenu
128  
129  endif
130 --- a/arch/mips/lantiq/falcon/Makefile
131 +++ b/arch/mips/lantiq/falcon/Makefile
132 @@ -3,3 +3,4 @@ obj-y += softdog_vpe.o
133  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
134  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
135  obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
136 +obj-$(CONFIG_LANTIQ_MACH_95C3AM1)   += mach-95C3AM1.o