-
Notifications
You must be signed in to change notification settings - Fork 9
/
patch-3.3.6-nsa310.diff
5292 lines (5277 loc) · 193 KB
/
patch-3.3.6-nsa310.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -uNr linux-3.3.6/arch/arm/mach-kirkwood/Kconfig linux-3.3.6-my/arch/arm/mach-kirkwood/Kconfig
--- linux-3.3.6/arch/arm/mach-kirkwood/Kconfig 2012-05-12 19:08:37.000000000 +0200
+++ linux-3.3.6-my/arch/arm/mach-kirkwood/Kconfig 2012-05-17 14:03:39.269421542 +0200
@@ -130,6 +130,18 @@
Say 'Y' here if you want your kernel to support the
HP t5325 Thin Client.
+config MACH_NSA310
+ bool "Zyxel NSA-310"
+ help
+ Say 'Y' here if you want your kernel to support the
+ Zyxel NSA-310 NAS.
+
+config MACH_NSA320
+ bool "Zyxel NSA-320"
+ help
+ Say 'Y' here if you want your kernel to support the
+ Zyxel NSA-320 NAS.
+
endmenu
endif
diff -uNr linux-3.3.6/arch/arm/mach-kirkwood/Makefile linux-3.3.6-my/arch/arm/mach-kirkwood/Makefile
--- linux-3.3.6/arch/arm/mach-kirkwood/Makefile 2012-05-12 19:08:37.000000000 +0200
+++ linux-3.3.6-my/arch/arm/mach-kirkwood/Makefile 2012-05-17 14:03:39.277422004 +0200
@@ -18,5 +18,7 @@
obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o lacie_v2-common.o
obj-$(CONFIG_MACH_T5325) += t5325-setup.o
+obj-$(CONFIG_MACH_NSA320) += nsa320-setup.o mcu.o
+obj-$(CONFIG_MACH_NSA310) += nsa310-setup.o mcu.o
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff -uNr linux-3.3.6/arch/arm/mach-kirkwood/mcu.c linux-3.3.6-my/arch/arm/mach-kirkwood/mcu.c
--- linux-3.3.6/arch/arm/mach-kirkwood/mcu.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-3.3.6-my/arch/arm/mach-kirkwood/mcu.c 2012-05-17 14:03:39.277422004 +0200
@@ -0,0 +1,125 @@
+#include <linux/module.h>
+#include <linux/init.h>
+#include <asm/irq.h>
+#include <asm/delay.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/workqueue.h>
+#include <linux/timer.h>
+#include <linux/syscalls.h>
+#include <linux/kmod.h>
+#include <linux/syscalls.h>
+#include <linux/fs.h>
+#include <asm/fcntl.h>
+#include <asm/hardirq.h>
+#include <linux/ioctl.h>
+#include <linux/cdev.h>
+#include <linux/sched.h>
+#include <linux/mm.h>
+#include <asm/io.h>
+#include <linux/spinlock.h>
+#include <mach/hardware.h>
+#include <asm/uaccess.h>
+#include <linux/syscalls.h>
+#include <asm/atomic.h>
+#include <linux/proc_fs.h>
+#include <asm/uaccess.h>
+#include <linux/kernel.h>
+
+#include <mach/kirkwood.h>
+#include <plat/gpio.h>
+#include <linux/gpio.h>
+#include "common.h"
+#include "mpp.h"
+
+
+
+#define MCU_DATA_PIN 14
+#define MCU_CLK_PIN 16
+#define MCU_ACT_PIN 17
+
+MODULE_LICENSE("GPL v2");
+#define MODULE_NAME "mcu"
+
+unsigned long mcu_data = 0;
+unsigned long mcu_counter = 0;
+
+static struct proc_dir_entry *mcu_proc;
+
+static int mcu_status_read_fn(char *buf, char **start, off_t offset,
+ int count, int *eof, void *data)
+{
+ unsigned long len, i;
+
+ mcu_data = 0;
+
+ gpio_request(14, "MCU_DATA");
+ gpio_request(16, "MCU_CLK");
+ gpio_request(17, "MCU_ACT");
+
+ gpio_direction_output(MCU_ACT_PIN, 0);
+ msleep(100);
+ gpio_direction_input(MCU_DATA_PIN);
+ gpio_direction_output(MCU_CLK_PIN, 0);
+ udelay(100);
+
+ for(i = 0 ; i < 32 ; i++)
+ {
+ mcu_data <<= 1;
+ gpio_set_value(MCU_CLK_PIN,1);
+
+ mcu_data |= gpio_get_value(MCU_DATA_PIN)?0x1:0;
+
+ udelay(100);
+
+ gpio_set_value(MCU_CLK_PIN,0);
+
+ udelay(100);
+ }
+
+
+ gpio_set_value(MCU_CLK_PIN,1);
+ gpio_set_value(MCU_ACT_PIN,1);
+
+
+ gpio_free(14);
+ gpio_free(16);
+ gpio_free(17);
+
+ len = sprintf(buf, "MagicNum:%u\nRpss:%u\nTemperature:%u\n",(unsigned int)((mcu_data & 0xff000000) >> 24),
+ (unsigned int)((mcu_data & 0xff0000) >> 16),
+ (unsigned int)((mcu_data & 0xffff)));
+ *eof = 1;
+
+ return len;
+}
+
+static int mcu_status_write_fn(struct file *file, const char __user *buffer,
+ unsigned long count, void *data)
+{
+ return 0;
+}
+
+
+static int __init mcu_init(void)
+{
+
+ mcu_proc = create_proc_entry("mcu", 0644, NULL);
+ if(mcu_proc != NULL)
+ {
+ mcu_proc->read_proc = mcu_status_read_fn;
+ mcu_proc->write_proc = mcu_status_write_fn;
+ }
+
+ return 0;
+}
+
+static void __exit mcu_exit(void)
+{
+ remove_proc_entry("mcu", NULL);
+
+}
+
+module_init(mcu_init);
+module_exit(mcu_exit);
+
diff -uNr linux-3.3.6/arch/arm/mach-kirkwood/nsa310-setup.c linux-3.3.6-my/arch/arm/mach-kirkwood/nsa310-setup.c
--- linux-3.3.6/arch/arm/mach-kirkwood/nsa310-setup.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-3.3.6-my/arch/arm/mach-kirkwood/nsa310-setup.c 2012-05-17 14:03:39.293421691 +0200
@@ -0,0 +1,343 @@
+ /*
+ * Zyxel NSA-310 Setup, by AA666 and Peeter123
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/irq.h>
+#include <linux/mtd/partitions.h>
+#include <mtd/mtd-abi.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_i2c.h>
+#include <linux/ethtool.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"
+#include <linux/timer.h>
+#include <linux/jiffies.h>
+
+static void nsa310_timerfunc(unsigned long data);
+static DEFINE_TIMER(timer, nsa310_timerfunc, 0, 0);
+
+static struct mtd_partition nsa310_nand_parts[] = {
+ {
+ .name = "uboot",
+ .offset = 0,
+ .size = 0x100000,
+ .mask_flags = MTD_WRITEABLE
+ }, {
+ .name = "uboot_env",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "key_store",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "info",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "etc",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "kernel_1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "rootfs1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x2FC0000
+ }, {
+ .name = "kernel_2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "rootfs2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x2FC0000
+ },
+};
+
+static struct mv_sata_platform_data nsa310_sata_data = {
+ .n_ports = 2,
+};
+
+static unsigned int nsa310_mpp_config[] __initdata = {
+ MPP36_GPIO, // Reset button
+ MPP37_GPIO, // Copy button
+ MPP46_GPIO, // Power button
+
+ MPP48_GPIO, // Power Off
+ MPP21_GPIO, // USB Power Off
+
+ MPP28_GPIO, // Sys LED Green
+ MPP29_GPIO, // Sys LED Yellow
+ MPP41_GPIO, // SATA1 LED Green
+ MPP42_GPIO, // SATA1 LED Red
+ MPP12_GPO, // SATA2 LED Green
+ MPP13_GPIO, // SATA2 LED Red
+ MPP39_GPIO, // Copy LED Green
+ MPP40_GPIO, // Copy LED Red
+ MPP15_GPIO, // USB LED Green
+
+ MPP14_GPIO, // MCU Data
+ MPP16_GPIO, // MCU Clk
+ MPP17_GPIO, // MCU Act
+
+ MPP38_GPIO, // VID B0
+ MPP45_GPIO, // VID B1
+
+ MPP44_GPIO, // Buzzer
+ MPP43_GPIO, // HTP
+
+ MPP47_GPIO, // Power Resume Data
+ MPP49_GPIO, // Power Resume Clock
+
+ 0
+};
+
+static struct gpio_led nsa310_gpio_led[] = {
+ {
+ .name = "nsa310:green:System",
+ .default_trigger = "timer",
+ .gpio = 28,
+ .active_low = 0,
+
+ },
+ {
+ .name = "nsa310:red:System",
+ .default_trigger = "none",
+ .gpio = 29,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:green:SATA1",
+ .default_trigger = "none",
+ .gpio = 41,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:red:SATA1",
+ .default_trigger = "sata-disk",
+ .gpio = 42,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:green:SATA2",
+ .default_trigger = "none",
+ .gpio = 12,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:red:SATA2",
+ .default_trigger = "none",
+ .gpio = 13,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:green:USB",
+ .default_trigger = "none",
+ .gpio = 15,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:green:Copy",
+ .default_trigger = "none",
+ .gpio = 39,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa310:red:Copy",
+ .default_trigger = "none",
+ .gpio = 40,
+ .active_low = 0,
+ },
+};
+
+
+static int nsa310_gpio_blink_set(unsigned gpio, int state,
+ unsigned long *delay_on, unsigned long *delay_off)
+{
+
+// Use hardware acceleration
+// if (delay_on && delay_off && !*delay_on && !*delay_off)
+// *delay_on = *delay_off = 100;
+
+ switch(state) {
+ case GPIO_LED_NO_BLINK_LOW:
+ case GPIO_LED_NO_BLINK_HIGH:
+ orion_gpio_set_blink(gpio, 0);
+ gpio_set_value(gpio, state);
+ break;
+ case GPIO_LED_BLINK:
+ orion_gpio_set_blink(gpio, 1);
+ break;
+ }
+ return 0;
+}
+
+
+static struct gpio_led_platform_data nsa310_led_data = {
+ .leds = nsa310_gpio_led,
+ .num_leds = ARRAY_SIZE(nsa310_gpio_led),
+ .gpio_blink_set = nsa310_gpio_blink_set,
+};
+
+static struct platform_device nsa310_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = { .platform_data = &nsa310_led_data, }
+};
+
+static struct gpio_keys_button nsa310_gpio_keys_button[] = {
+ {
+ .code = KEY_POWER,
+ .type = EV_KEY,
+ .gpio = 46,
+ .desc = "Power Button",
+ .active_low = 0,
+ .debounce_interval = 1000,
+ },
+ {
+ .code = KEY_COPY,
+ .type = EV_KEY,
+ .gpio = 37,
+ .desc = "USB Copy",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ },
+ {
+ .code = KEY_OPTION,
+ .type = EV_KEY,
+ .gpio = 36,
+ .desc = "Reset",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ },
+};
+
+static struct gpio_keys_platform_data nsa310_keys_data = {
+ .buttons = nsa310_gpio_keys_button,
+ .nbuttons = ARRAY_SIZE(nsa310_gpio_keys_button),
+};
+
+
+static struct platform_device nsa310_buttons = {
+ .name = "gpio-keys",
+ .id = -1,
+ .dev = { .platform_data = &nsa310_keys_data, }
+};
+
+static void nsa310_power_off(void)
+{
+//
+//don't work with sysfs
+ printk(KERN_INFO "NSA310: Activating power off GPIO pin...\n");
+ gpio_set_value(48, 1);
+
+// If machine goes to restart, uncomment next lines for infinite loop
+/* printk(KERN_INFO "System halted, please turn off power manually\n");
+ gpio_set_value(28, 0);
+ do {
+ mdelay(1000);
+ } while(1);
+*/
+}
+
+static void nsa310_timerfunc(unsigned long data)
+{
+// Activate USB Power
+ if (gpio_request(21, "USB Power") != 0 || gpio_direction_output(21, 1) != 0)
+ printk(KERN_ERR "NSA310: Failed to setup USB power GPIO\n");
+ else
+ printk(KERN_INFO "NSA310: USB power enabled\n");
+ gpio_free(21);
+}
+
+static void __init nsa310_init(void)
+{
+ u32 dev, rev;
+
+ kirkwood_init();
+
+ kirkwood_mpp_conf(nsa310_mpp_config);
+ kirkwood_nand_init(ARRAY_AND_SIZE(nsa310_nand_parts), 40);
+ kirkwood_pcie_id(&dev, &rev);
+
+ kirkwood_sata_init(&nsa310_sata_data);
+ kirkwood_uart0_init();
+ kirkwood_i2c_init();
+
+ platform_device_register(&nsa310_leds);
+ platform_device_register(&nsa310_buttons);
+
+ kirkwood_ehci_init();
+// USB Power delay for 20 sec
+ timer.function = nsa310_timerfunc;
+ timer.data = 0;
+ timer.expires = jiffies + msecs_to_jiffies(20000);
+ add_timer(&timer);
+
+
+/* Power resume control */
+ gpio_request(49, "Power-clk");
+ gpio_direction_output(49, 1);
+ gpio_request(47, "Power-data");
+// Clear power resume
+// gpio_direction_output(47, 0);
+// Set power resume
+ gpio_direction_output(47, 1);
+ udelay(1000);
+// gpio_direction_output(49, 0);
+ gpio_set_value(49, 0);
+// release GPIO?
+//test
+ gpio_free(47);
+ gpio_free(49);
+ printk(KERN_INFO "NSA310: Power resume enabled\n");
+
+
+// Activate Power-off GPIO
+ if (gpio_request(48, "Power-off") == 0 && gpio_direction_output(48, 0) == 0) {
+// gpio_free(48);
+ pm_power_off = nsa310_power_off;
+ printk(KERN_INFO "NSA310: Power-off GPIO enabled\n");
+ } else
+ printk(KERN_ERR "NSA310: Failed to configure Power-off GPIO\n");
+
+};
+
+static int __init nsa310_pci_init(void)
+{
+ if (machine_is_nsa310())
+ kirkwood_pcie_init(KW_PCIE0);
+ return 0;
+}
+
+subsys_initcall(nsa310_pci_init);
+
+MACHINE_START(NSA310, "Zyxel NSA-310")
+ .atag_offset = 0x100,
+ .init_machine = nsa310_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .timer = &kirkwood_timer,
+MACHINE_END
+
diff -uNr linux-3.3.6/arch/arm/mach-kirkwood/nsa320-setup.c linux-3.3.6-my/arch/arm/mach-kirkwood/nsa320-setup.c
--- linux-3.3.6/arch/arm/mach-kirkwood/nsa320-setup.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-3.3.6-my/arch/arm/mach-kirkwood/nsa320-setup.c 2012-05-17 14:03:39.297421609 +0200
@@ -0,0 +1,356 @@
+/*
+ * arch/arm/mach-kirkwood/nsa320-setup.c
+ *
+ * Zyxel NSA-320 Setup, by AA666
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/input.h>
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/i2c.h>
+#include <linux/irq.h>
+#include <linux/mtd/partitions.h>
+#include <mtd/mtd-abi.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/mv643xx_i2c.h>
+#include <linux/ethtool.h>
+#include <linux/gpio.h>
+#include <linux/gpio_keys.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include <plat/mvsdio.h>
+#include "common.h"
+#include "mpp.h"
+#include <linux/timer.h>
+#include <linux/jiffies.h>
+
+static void nsa320_timerfunc(unsigned long data);
+static DEFINE_TIMER(timer, nsa320_timerfunc, 0, 0);
+
+static struct mtd_partition nsa320_nand_parts[] = {
+ {
+ .name = "uboot",
+ .offset = 0,
+ .size = 0x100000,
+ .mask_flags = MTD_WRITEABLE
+ }, {
+ .name = "uboot_env",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "key_store",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "info",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x80000
+ }, {
+ .name = "etc",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "kernel_1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "rootfs1",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x2FC0000
+ }, {
+ .name = "kernel_2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0xA00000
+ }, {
+ .name = "rootfs2",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 0x2FC0000
+ },
+};
+
+static struct i2c_board_info __initdata nsa320_i2c_rtc = {
+ I2C_BOARD_INFO("pcf8563", 0x51),
+};
+
+static struct mv643xx_eth_platform_data nsa320_ge00_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+ .speed = SPEED_1000,
+ .duplex = DUPLEX_FULL,
+};
+
+static struct mv_sata_platform_data nsa320_sata_data = {
+ .n_ports = 2,
+};
+
+static unsigned int nsa320_mpp_config[] __initdata = {
+ MPP36_GPIO, // Reset button
+ MPP37_GPIO, // Copy button
+ MPP46_GPIO, // Power button
+
+ MPP48_GPIO, // Power Off
+ MPP21_GPIO, // USB Power Off
+
+ MPP28_GPIO, // Sys LED Green
+ MPP29_GPIO, // Sys LED Yellow
+ MPP41_GPIO, // SATA1 LED Green
+ MPP42_GPIO, // SATA1 LED Red
+ MPP12_GPO, // SATA2 LED Green
+ MPP13_GPIO, // SATA2 LED Red
+ MPP39_GPIO, // Copy LED Green
+ MPP40_GPIO, // Copy LED Red
+ MPP15_GPIO, // USB LED Green
+
+ MPP14_GPIO, // MCU Data
+ MPP16_GPIO, // MCU Clk
+ MPP17_GPIO, // MCU Act
+
+ MPP38_GPIO, // VID B0
+ MPP45_GPIO, // VID B1
+
+ MPP44_GPIO, // Buzzer
+ MPP43_GPIO, // HTP
+
+ MPP47_GPIO, // Power Resume Data
+ MPP49_GPIO, // Power Resume Clock
+
+ 0
+};
+
+static struct gpio_led nsa320_gpio_led[] = {
+ {
+ .name = "nsa320:green:System",
+ .default_trigger = "timer",
+ .gpio = 28,
+ .active_low = 0,
+
+ },
+ {
+ .name = "nsa320:red:System",
+ .default_trigger = "none",
+ .gpio = 29,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:green:SATA1",
+ .default_trigger = "none",
+ .gpio = 41,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:red:SATA1",
+ .default_trigger = "sata-disk",
+ .gpio = 42,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:green:SATA2",
+ .default_trigger = "none",
+ .gpio = 12,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:red:SATA2",
+ .default_trigger = "none",
+ .gpio = 13,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:green:USB",
+ .default_trigger = "none",
+ .gpio = 15,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:green:Copy",
+ .default_trigger = "none",
+ .gpio = 39,
+ .active_low = 0,
+ },
+ {
+ .name = "nsa320:red:Copy",
+ .default_trigger = "none",
+ .gpio = 40,
+ .active_low = 0,
+ },
+};
+
+
+static int nsa320_gpio_blink_set(unsigned gpio, int state,
+ unsigned long *delay_on, unsigned long *delay_off)
+{
+
+// Use hardware acceleration
+// if (delay_on && delay_off && !*delay_on && !*delay_off)
+// *delay_on = *delay_off = 100;
+
+ switch(state) {
+ case GPIO_LED_NO_BLINK_LOW:
+ case GPIO_LED_NO_BLINK_HIGH:
+ orion_gpio_set_blink(gpio, 0);
+ gpio_set_value(gpio, state);
+ break;
+ case GPIO_LED_BLINK:
+ orion_gpio_set_blink(gpio, 1);
+ break;
+ }
+ return 0;
+}
+
+
+static struct gpio_led_platform_data nsa320_led_data = {
+ .leds = nsa320_gpio_led,
+ .num_leds = ARRAY_SIZE(nsa320_gpio_led),
+ .gpio_blink_set = nsa320_gpio_blink_set,
+};
+
+static struct platform_device nsa320_leds = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = { .platform_data = &nsa320_led_data, }
+};
+
+static struct gpio_keys_button nsa320_gpio_keys_button[] = {
+ {
+ .code = KEY_POWER,
+ .type = EV_KEY,
+ .gpio = 46,
+ .desc = "Power Button",
+ .active_low = 0,
+ .debounce_interval = 1000,
+ },
+ {
+ .code = KEY_COPY,
+ .type = EV_KEY,
+ .gpio = 37,
+ .desc = "USB Copy",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ },
+ {
+ .code = KEY_OPTION,
+ .type = EV_KEY,
+ .gpio = 36,
+ .desc = "Reset",
+ .active_low = 1,
+ .debounce_interval = 1000,
+ },
+};
+
+static struct gpio_keys_platform_data nsa320_keys_data = {
+ .buttons = nsa320_gpio_keys_button,
+ .nbuttons = ARRAY_SIZE(nsa320_gpio_keys_button),
+};
+
+static struct platform_device nsa320_buttons = {
+ .name = "gpio-keys",
+ .id = -1,
+ .dev = { .platform_data = &nsa320_keys_data, }
+};
+
+static void nsa320_power_off(void)
+{
+//
+//don't work with sysfs
+ printk(KERN_INFO "NSA320: Activating power off GPIO pin...\n");
+ gpio_set_value(48, 1);
+
+// If machine goes to restart, uncomment next lines for infinite loop
+/* printk(KERN_INFO "System halted, please turn off power manually\n");
+ gpio_set_value(28, 0);
+ do {
+ mdelay(1000);
+ } while(1);
+*/
+}
+
+static void nsa320_timerfunc(unsigned long data)
+{
+// Activate USB Power
+ if (gpio_request(21, "USB Power") != 0 || gpio_direction_output(21, 1) != 0)
+ printk(KERN_ERR "NSA320: Failed to setup USB power GPIO\n");
+ else
+ printk(KERN_INFO "NSA320: USB power enabled\n");
+ gpio_free(21);
+}
+
+static void __init nsa320_init(void)
+{
+ u32 dev, rev;
+
+ kirkwood_init();
+
+ kirkwood_mpp_conf(nsa320_mpp_config);
+ kirkwood_nand_init(ARRAY_AND_SIZE(nsa320_nand_parts), 40);
+ kirkwood_ge00_init(&nsa320_ge00_data);
+ kirkwood_pcie_id(&dev, &rev);
+
+ kirkwood_sata_init(&nsa320_sata_data);
+ kirkwood_uart0_init();
+ kirkwood_i2c_init();
+ i2c_register_board_info(0, &nsa320_i2c_rtc, 1);
+
+ platform_device_register(&nsa320_leds);
+ platform_device_register(&nsa320_buttons);
+
+ kirkwood_ehci_init();
+// USB Power delay for 20 sec
+ timer.function = nsa320_timerfunc;
+ timer.data = 0;
+ timer.expires = jiffies + msecs_to_jiffies(20000);
+ add_timer(&timer);
+
+
+/* Power resume control */
+ gpio_request(49, "Power-clk");
+ gpio_direction_output(49, 1);
+ gpio_request(47, "Power-data");
+// Clear power resume
+// gpio_direction_output(47, 0);
+// Set power resume
+ gpio_direction_output(47, 1);
+ udelay(1000);
+// gpio_direction_output(49, 0);
+ gpio_set_value(49, 0);
+// release GPIO?
+//test
+ gpio_free(47);
+ gpio_free(49);
+ printk(KERN_INFO "NSA320: Power resume enabled\n");
+
+
+// Activate Power-off GPIO
+ if (gpio_request(48, "Power-off") == 0 && gpio_direction_output(48, 0) == 0) {
+// gpio_free(48);
+ pm_power_off = nsa320_power_off;
+ printk(KERN_INFO "NSA320: Power-off GPIO enabled\n");
+ } else
+ printk(KERN_ERR "failed to configure Power-off GPIO\n");
+
+};
+
+static int __init nsa320_pci_init(void)
+{
+ if (machine_is_nsa320())
+ kirkwood_pcie_init(KW_PCIE0);
+ return 0;
+}
+
+subsys_initcall(nsa320_pci_init);
+
+MACHINE_START(NSA320, "Zyxel NSA-320")
+ .atag_offset = 0x100,
+ .init_machine = nsa320_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .timer = &kirkwood_timer,
+MACHINE_END
diff -uNr linux-3.3.6/arch/arm/tools/mach-types linux-3.3.6-my/arch/arm/tools/mach-types
--- linux-3.3.6/arch/arm/tools/mach-types 2012-05-12 19:08:37.000000000 +0200
+++ linux-3.3.6-my/arch/arm/tools/mach-types 2012-05-17 14:03:14.185425517 +0200
@@ -12,531 +12,3179 @@
#
# http://www.arm.linux.org.uk/developer/machines/?action=new
#
-# This is a cut-down version of the file; it contains only machines that
-# are merged into mainline or have been edited in the machine database
-# within the last 12 months. References to machine_is_NAME() do not count!
-#
-# Last update: Tue Dec 6 11:07:38 2011
+# Last update: Thu May 17 13:02:23 2012
#
# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
#
ebsa110 ARCH_EBSA110 EBSA110 0
riscpc ARCH_RPC RISCPC 1
+nexuspci ARCH_NEXUSPCI NEXUSPCI 3
ebsa285 ARCH_EBSA285 EBSA285 4
netwinder ARCH_NETWINDER NETWINDER 5
cats ARCH_CATS CATS 6
+tbox ARCH_TBOX TBOX 7
+co285 ARCH_CO285 CO285 8
+clps7110 ARCH_CLPS7110 CLPS7110 9
+archimedes ARCH_ARC ARCHIMEDES 10
+a5k ARCH_A5K A5K 11
+etoile ARCH_ETOILE ETOILE 12
+lacie_nas ARCH_LACIE_NAS LACIE_NAS 13
+clps7500 ARCH_CLPS7500 CLPS7500 14
shark ARCH_SHARK SHARK 15
brutus SA1100_BRUTUS BRUTUS 16
personal_server ARCH_PERSONAL_SERVER PERSONAL_SERVER 17
+itsy SA1100_ITSY ITSY 18
l7200 ARCH_L7200 L7200 19
pleb SA1100_PLEB PLEB 20
integrator ARCH_INTEGRATOR INTEGRATOR 21
h3600 SA1100_H3600 H3600 22
+ixp1200 ARCH_IXP1200 IXP1200 23
p720t ARCH_P720T P720T 24
assabet SA1100_ASSABET ASSABET 25
+victor SA1100_VICTOR VICTOR 26
lart SA1100_LART LART 27
+ranger SA1100_RANGER RANGER 28
graphicsclient SA1100_GRAPHICSCLIENT GRAPHICSCLIENT 29
xp860 SA1100_XP860 XP860 30
cerf SA1100_CERF CERF 31
nanoengine SA1100_NANOENGINE NANOENGINE 32
+fpic SA1100_FPIC FPIC 33
+extenex1 SA1100_EXTENEX1 EXTENEX1 34
+sherman SA1100_SHERMAN SHERMAN 35
+accelent_sa SA1100_ACCELENT ACCELENT_SA 36
+accelent_l7200 ARCH_L7200_ACCELENT ACCELENT_L7200 37
+netport SA1100_NETPORT NETPORT 38
+pangolin SA1100_PANGOLIN PANGOLIN 39
+yopy SA1100_YOPY YOPY 40
+coolidge SA1100_COOLIDGE COOLIDGE 41
+huw_webpanel SA1100_HUW_WEBPANEL HUW_WEBPANEL 42
+spotme ARCH_SPOTME SPOTME 43
+freebird ARCH_FREEBIRD FREEBIRD 44
+ti925 ARCH_TI925 TI925 45
+riscstation ARCH_RISCSTATION RISCSTATION 46
+cavy SA1100_CAVY CAVY 47
jornada720 SA1100_JORNADA720 JORNADA720 48
+omnimeter SA1100_OMNIMETER OMNIMETER 49
edb7211 ARCH_EDB7211 EDB7211 50
+citygo SA1100_CITYGO CITYGO 51
pfs168 SA1100_PFS168 PFS168 52
+spot SA1100_SPOT SPOT 53
flexanet SA1100_FLEXANET FLEXANET 54
+webpal ARCH_WEBPAL WEBPAL 55
+linpda SA1100_LINPDA LINPDA 56
+anakin ARCH_ANAKIN ANAKIN 57
+mvi SA1100_MVI MVI 58
+jupiter SA1100_JUPITER JUPITER 59
+psionw ARCH_PSIONW PSIONW 60
+aln SA1100_ALN ALN 61
+epxa ARCH_CAMELOT CAMELOT 62
+gds2200 SA1100_GDS2200 GDS2200 63
+netbook SA1100_PSION_SERIES7 PSION_SERIES7 64
+xfile SA1100_XFILE XFILE 65
+accelent_ep9312 ARCH_ACCELENT_EP9312 ACCELENT_EP9312 66
+ic200 ARCH_IC200 IC200 67
+creditlart SA1100_CREDITLART CREDITLART 68
+htm SA1100_HTM HTM 69
+iq80310 ARCH_IQ80310 IQ80310 70
+freebot SA1100_FREEBOT FREEBOT 71
+entel ARCH_ENTEL ENTEL 72
+enp3510 ARCH_ENP3510 ENP3510 73
+trizeps SA1100_TRIZEPS TRIZEPS 74
+nesa SA1100_NESA NESA 75
+venus ARCH_VENUS VENUS 76
+tardis ARCH_TARDIS TARDIS 77
+mercury ARCH_MERCURY MERCURY 78
+empeg SA1100_EMPEG EMPEG 79
+adi_evb ARCH_I80200FCC I80200FCC 80
+itt_cpb SA1100_ITT_CPB ITT_CPB 81
+svc SA1100_SVC SVC 82
+alpha2 SA1100_ALPHA2 ALPHA2 84
+alpha1 SA1100_ALPHA1 ALPHA1 85
+netarm ARCH_NETARM NETARM 86
simpad SA1100_SIMPAD SIMPAD 87
+pda1 ARCH_PDA1 PDA1 88
lubbock ARCH_LUBBOCK LUBBOCK 89
+aniko ARCH_ANIKO ANIKO 90
clep7212 ARCH_CLEP7212 CLEP7212 91
+cs89712 ARCH_CS89712 CS89712 92
+weararm SA1100_WEARARM WEARARM 93
+possio_px SA1100_POSSIO_PX POSSIO_PX 94
+sidearm SA1100_SIDEARM SIDEARM 95
+stork SA1100_STORK STORK 96
shannon SA1100_SHANNON SHANNON 97
+ace ARCH_ACE ACE 98
+ballyarm SA1100_BALLYARM BALLYARM 99
+simputer SA1100_SIMPUTER SIMPUTER 100
+nexterm SA1100_NEXTERM NEXTERM 101
+sa1100_elf SA1100_SA1100_ELF SA1100_ELF 102
+gator SA1100_GATOR GATOR 103
+granite ARCH_GRANITE GRANITE 104
consus SA1100_CONSUS CONSUS 105
aaed2000 ARCH_AAED2000 AAED2000 106
cdb89712 ARCH_CDB89712 CDB89712 107
graphicsmaster SA1100_GRAPHICSMASTER GRAPHICSMASTER 108
adsbitsy SA1100_ADSBITSY ADSBITSY 109
pxa_idp ARCH_PXA_IDP PXA_IDP 110
+plce ARCH_PLCE PLCE 111
pt_system3 SA1100_PT_SYSTEM3 PT_SYSTEM3 112
+murphy ARCH_MEDALB MEDALB 113
+eagle ARCH_EAGLE EAGLE 114
+dsc21 ARCH_DSC21 DSC21 115
+dsc24 ARCH_DSC24 DSC24 116