9d898b7ac094b6da80564a749566ecdd0a8270c6
[openwrt.git] / target / linux / adm5120 / files-2.6.26 / arch / mips / adm5120 / infineon / infineon.c
1 /*
2 * Infineon Reference Boards
3 *
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11
12 #include "infineon.h"
13
14 #ifdef CONFIG_MTD_PARTITIONS
15 static struct mtd_partition easy_partitions[] = {
16 {
17 .name = "admboot",
18 .offset = 0,
19 .size = 64*1024,
20 .mask_flags = MTD_WRITEABLE,
21 } , {
22 .name = "boardcfg",
23 .offset = MTDPART_OFS_APPEND,
24 .size = 64*1024,
25 } , {
26 .name = "firmware",
27 .offset = MTDPART_OFS_APPEND,
28 .size = MTDPART_SIZ_FULL,
29 }
30 };
31 #endif /* CONFIG_MTD_PARTITIONS */
32
33 static void switch_bank_gpio3(unsigned bank)
34 {
35 switch (bank) {
36 case 0:
37 gpio_set_value(ADM5120_GPIO_PIN3, 0);
38 break;
39 case 1:
40 gpio_set_value(ADM5120_GPIO_PIN3, 1);
41 break;
42 }
43 }
44
45 void __init easy_setup_pqfp(void)
46 {
47 /* setup flash A20 line */
48 gpio_request(ADM5120_GPIO_PIN3, NULL);
49 gpio_direction_output(ADM5120_GPIO_PIN3, 0);
50 adm5120_flash0_data.switch_bank = switch_bank_gpio3;
51
52 #ifdef CONFIG_MTD_PARTITIONS
53 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
54 adm5120_flash0_data.parts = easy_partitions;
55 #endif /* CONFIG_MTD_PARTITIONS */
56
57 adm5120_add_device_flash(0);
58 }
59
60 static void switch_bank_gpio5(unsigned bank)
61 {
62 switch (bank) {
63 case 0:
64 gpio_set_value(ADM5120_GPIO_PIN5, 0);
65 break;
66 case 1:
67 gpio_set_value(ADM5120_GPIO_PIN5, 1);
68 break;
69 }
70 }
71
72 void __init easy_setup_bga(void)
73 {
74 /* setup flash A20 line */
75 gpio_request(ADM5120_GPIO_PIN5, NULL);
76 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
77 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
78
79 #ifdef CONFIG_MTD_PARTITIONS
80 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
81 adm5120_flash0_data.parts = easy_partitions;
82 #endif /* CONFIG_MTD_PARTITIONS */
83
84 adm5120_add_device_flash(0);
85 }
This page took 0.043024 seconds and 3 git commands to generate.