drop GPIODEV platform code
[openwrt/openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / compex / compex.c
1 /*
2 * Compex 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 "compex.h"
13
14 #include <asm/mach-adm5120/prom/myloader.h>
15
16 static void switch_bank_gpio5(unsigned bank)
17 {
18 switch (bank) {
19 case 0:
20 gpio_set_value(ADM5120_GPIO_PIN5, 0);
21 break;
22 case 1:
23 gpio_set_value(ADM5120_GPIO_PIN5, 1);
24 break;
25 }
26 }
27
28 void __init compex_mac_setup(void)
29 {
30 if (myloader_present()) {
31 int i;
32
33 for (i = 0; i < 6; i++) {
34 if (is_valid_ether_addr(myloader_info.macs[i]))
35 memcpy(adm5120_eth_macs[i],
36 myloader_info.macs[i], ETH_ALEN);
37 else
38 random_ether_addr(adm5120_eth_macs[i]);
39 }
40 } else {
41 u8 mac[ETH_ALEN];
42
43 random_ether_addr(mac);
44 adm5120_setup_eth_macs(mac);
45 }
46 }
47
48 void __init compex_generic_setup(void)
49 {
50 gpio_request(ADM5120_GPIO_PIN5, NULL); /* for flash A20 line */
51 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
52
53 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
54 adm5120_add_device_flash(0);
55
56 adm5120_add_device_uart(0);
57 adm5120_add_device_uart(1);
58
59 compex_mac_setup();
60 }