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/bootinfo.h>
20 #include <asm/mach-adm5120/adm5120_defs.h>
21 #include <asm/mach-adm5120/adm5120_board.h>
22 #include <asm/mach-adm5120/adm5120_platform.h>
23 #include <asm/mach-adm5120/adm5120_info.h>
25 #include <prom/admboot.h>
27 #define PMUGW_CONFIG_OFFSET 0x10000
28 #define PMUGW_CONFIG_SIZE 0x1000
30 #ifdef CONFIG_MTD_PARTITIONS
31 static struct mtd_partition pmugw_partitions[] = {
36 .mask_flags = MTD_WRITEABLE,
39 .offset = MTDPART_OFS_APPEND,
43 .offset = MTDPART_OFS_APPEND,
44 .size = MTDPART_SIZ_FULL,
47 #endif /* CONFIG_MTD_PARTITIONS */
49 static u8 pmugw_vlans[6] __initdata = {
50 0x41, 0x42, 0x44, 0x48, 0x50, 0x00
53 static __init void pmugw_setup_mac(void)
58 err = admboot_get_mac_base(PMUGW_CONFIG_OFFSET,
59 PMUGW_CONFIG_SIZE, mac_base);
61 if ((err) || !is_valid_ether_addr(mac_base))
62 random_ether_addr(mac_base);
64 adm5120_setup_eth_macs(mac_base);
67 static void switch_bank_gpio5(unsigned bank)
71 gpio_set_value(ADM5120_GPIO_PIN5, 0);
74 gpio_set_value(ADM5120_GPIO_PIN5, 1);
79 void __init pmugw_setup(void)
81 /* setup flash A20 line */
82 gpio_request(ADM5120_GPIO_PIN5, NULL);
83 gpio_direction_output(ADM5120_GPIO_PIN5, 0);
84 adm5120_flash0_data.switch_bank = switch_bank_gpio5;
86 #ifdef CONFIG_MTD_PARTITIONS
87 adm5120_flash0_data.nr_parts = ARRAY_SIZE(pmugw_partitions);
88 adm5120_flash0_data.parts = pmugw_partitions;
89 #endif /* CONFIG_MTD_PARTITIONS */
91 adm5120_add_device_uart(1); /* ttyS0 */
92 adm5120_add_device_uart(0); /* ttyS1 */
94 adm5120_add_device_flash(0);
97 adm5120_add_device_switch(5, pmugw_vlans);
100 ADM5120_BOARD(MACH_ADM5120_PMUGW,
101 "Motorola Powerline MU Gateway",