2 * Motorola Powerline MU Gateway board
4 * Copyright (C) 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.
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/gpio.h>
15 #include <linux/irq.h>
16 #include <linux/etherdevice.h>
18 #include <asm/mips_machine.h>
20 #include <asm/mach-adm5120/adm5120_defs.h>
21 #include <asm/mach-adm5120/adm5120_platform.h>
22 #include <asm/mach-adm5120/adm5120_info.h>
24 #include <prom/admboot.h>
26 #define PMUGW_CONFIG_OFFSET 0x10000
27 #define PMUGW_CONFIG_SIZE 0x1000
29 static struct mtd_partition pmugw_partitions[] = {
34 .mask_flags = MTD_WRITEABLE,
37 .offset = MTDPART_OFS_APPEND,
41 .offset = MTDPART_OFS_APPEND,
42 .size = MTDPART_SIZ_FULL,
46 static u8 pmugw_vlans[6] __initdata = {
47 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
50 static __init void pmugw_setup_mac(void)
55 err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
56 PMUGW_CONFIG_SIZE, mac_base);
58 if ((err) || !is_valid_ether_addr(mac_base))
59 random_ether_addr(mac_base);
61 adm5120_setup_eth_macs(mac_base);
64 static void switch_bank_gpio5(unsigned bank)
68 gpio_set_value(ADM5120_GPIO_PIN5, 0);
71 gpio_set_value(ADM5120_GPIO_PIN5, 1);
76 void __init pmugw_setup(void)
78 /* setup flash A20 line */
79 gpio_request(ADM5120_GPIO_PIN5, NULL);
80 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
81 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
83 adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
84 adm5120_flash0_data.parts = pmugw_partitions;
86 adm5120_add_device_uart(1); /* ttyAM0 */
87 adm5120_add_device_uart(0); /* ttyAM1 */
89 adm5120_add_device_flash(0);
92 adm5120_add_device_switch(5, pmugw_vlans);
95 MIPS_MACHINE(MACH_ADM5120_PMUGW, "PMUGW", "Motorola Powerline MU Gateway",