[lantiq]
[openwrt.git] / target / linux / lantiq / patches-2.6.39 / 160-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 "../machtypes.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 ltq_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 +       ltq_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/lantiq/falcon/Kconfig
108 +++ b/arch/mips/lantiq/falcon/Kconfig
109 @@ -10,6 +10,10 @@ config LANTIQ_MACH_EASY98020
110         bool "Easy98020"
111         default y
112  
113 +config LANTIQ_MACH_95C3AM1
114 +       bool "95C3AM1"
115 +       default y
116 +
117  endmenu
118  
119  endif
120 --- a/arch/mips/lantiq/falcon/Makefile
121 +++ b/arch/mips/lantiq/falcon/Makefile
122 @@ -4,3 +4,4 @@ obj-$(CONFIG_LANTIQ_MACH_EASY98000) += a
123  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += mach-easy98000.o
124  obj-$(CONFIG_LANTIQ_MACH_EASY98000) += dev-leds-easy98000-cpld.o
125  obj-$(CONFIG_LANTIQ_MACH_EASY98020) += mach-easy98020.o
126 +obj-$(CONFIG_LANTIQ_MACH_95C3AM1)   += mach-95C3AM1.o
127 --- a/arch/mips/lantiq/machtypes.h
128 +++ b/arch/mips/lantiq/machtypes.h
129 @@ -21,6 +21,7 @@ enum lantiq_mach_type {
130         LANTIQ_MACH_EASY98000SF,        /* Falcon Eval Board, Serial Flash */
131         LANTIQ_MACH_EASY98000NAND,      /* Falcon Eval Board, NAND Flash */
132         LANTIQ_MACH_EASY98020,          /* Falcon Reference Board */
133 +       LANTIQ_MACH_95C3AM1,            /* Board 95C3AM1 */
134  };
135  
136  #endif