2 * Infineon Reference Boards
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
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.
14 #include <prom/admboot.h>
16 #define EASY_CONFIG_OFFSET 0x10000
17 #define EASY_CONFIG_SIZE 0x1000
19 #ifdef CONFIG_MTD_PARTITIONS
20 static struct mtd_partition easy_partitions[] = {
25 .mask_flags = MTD_WRITEABLE,
28 .offset = MTDPART_OFS_APPEND,
32 .offset = MTDPART_OFS_APPEND,
33 .size = MTDPART_SIZ_FULL,
36 #endif /* CONFIG_MTD_PARTITIONS */
38 static __init void easy_setup_mac(void)
43 err = admboot_get_mac_base(EASY_CONFIG_OFFSET,
44 EASY_CONFIG_SIZE, mac_base);
46 if ((err) || !is_valid_ether_addr(mac_base))
47 random_ether_addr(mac_base);
49 adm5120_setup_eth_macs(mac_base);
52 static void switch_bank_gpio3(unsigned bank)
56 gpio_set_value(ADM5120_GPIO_PIN3, 0);
59 gpio_set_value(ADM5120_GPIO_PIN3, 1);
64 void __init easy_setup_pqfp(void)
66 /* setup flash A20 line */
67 gpio_request(ADM5120_GPIO_PIN3, NULL);
68 gpio_direction_output(ADM5120_GPIO_PIN3, 0);
69 adm5120_flash0_data.switch_bank = switch_bank_gpio3;
71 #ifdef CONFIG_MTD_PARTITIONS
72 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
73 adm5120_flash0_data.parts = easy_partitions;
74 #endif /* CONFIG_MTD_PARTITIONS */
76 adm5120_add_device_uart(0);
77 adm5120_add_device_uart(1);
79 adm5120_add_device_flash(0);
84 static void switch_bank_gpio5(unsigned bank)
88 gpio_set_value(ADM5120_GPIO_PIN5, 0);
91 gpio_set_value(ADM5120_GPIO_PIN5, 1);
96 void __init easy_setup_bga(void)
98 /* setup flash A20 line */
99 gpio_request(ADM5120_GPIO_PIN5, NULL);
100 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
101 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
103 #ifdef CONFIG_MTD_PARTITIONS
104 adm5120_flash0_data.nr_parts = ARRAY_SIZE(easy_partitions);
105 adm5120_flash0_data.parts = easy_partitions;
106 #endif /* CONFIG_MTD_PARTITIONS */
108 adm5120_add_device_uart(0);
109 adm5120_add_device_uart(1);
111 adm5120_add_device_flash(0);