* Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
* The original Mikrotik code seems not to have a license.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
*
*/
#include <adm5120_nand.h>
#include <adm5120_board.h>
#include <adm5120_platform.h>
+#include <adm5120_info.h>
+
+#include <prom/routerboot.h>
#define RB1XX_NAND_CHIP_DELAY 25
},
};
+static struct resource rb153_cf_resources[] = {
+ {
+ .name = "cf_membase",
+ .start = ADM5120_EXTIO1_BASE,
+ .end = ADM5120_EXTIO1_BASE + ADM5120_EXTIO1_SIZE-1 ,
+ .flags = IORESOURCE_MEM
+ }, {
+ .name = "cf_irq",
+ .start = ADM5120_IRQ_GPIO4,
+ .end = ADM5120_IRQ_GPIO4,
+ .flags = IORESOURCE_IRQ
+ }
+};
+
+static struct platform_device rb153_cf_device = {
+ .name = "pata-rb153-cf",
+ .id = -1,
+ .resource = rb153_cf_resources,
+ .num_resources = ARRAY_SIZE(rb153_cf_resources),
+};
+
+static struct platform_device *rb153_devices[] __initdata = {
+ &adm5120_flash0_device,
+ &adm5120_nand_device,
+ &rb153_cf_device,
+};
+
#if 0
/*
* RB1xx boards have bad network performance with the default VLAN matrixes.
static unsigned char rb15x_vlans[6] __initdata = {
/* FIXME: untested */
0x41, 0x42, 0x44, 0x48, 0x50, 0x00
+};
static unsigned char rb192_vlans[6] __initdata = {
/* FIXME: untested */
static void __init rb1xx_mac_setup(void)
{
- /* TODO */
+ int i, j;
+
+ if (!rb_hs.mac_base)
+ return;
+
+ for (i = 0; i < 6; i++) {
+ for (j = 0; j < 5; j++)
+ adm5120_eth_macs[i][j] = rb_hs.mac_base[j];
+ adm5120_eth_macs[i][5] = rb_hs.mac_base[5]+i;
+ }
}
static void __init rb1xx_flash_setup(void)
adm5120_nand_data.ctrl.cmd_ctrl = rb150_nand_cmd_ctrl;
adm5120_nand_data.ctrl.dev_ready = rb150_nand_ready;
+ adm5120_flash0_data.window_size = 512*1024;
+
rb1xx_flash_setup();
rb1xx_mac_setup();
}
+static void __init rb153_setup(void)
+{
+ /* enable CSX1:INTX1 on GPIO[3:4] for the CF slot */
+ adm5120_gpio_csx1_enable();
+ /* enable the wait state pin GPIO[0] for external I/O control */
+ adm5120_gpio_ew_enable();
+
+ rb1xx_setup();
+}
+
/*--------------------------------------------------------------------------*/
-static struct adm5120_board rb111_board __initdata = {
- .mach_type = MACH_ADM5120_RB_111,
- .name = "Mikrotik RouterBOARD 111",
+ADM5120_BOARD_START(RB_111, "Mikrotik RouterBOARD 111")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb11x_vlans,
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb112_board __initdata = {
- .mach_type = MACH_ADM5120_RB_112,
- .name = "Mikrotik RouterBOARD 112",
+ADM5120_BOARD_START(RB_112, "Mikrotik RouterBOARD 112")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb11x_vlans,
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb133_board __initdata = {
- .mach_type = MACH_ADM5120_RB_133,
- .name = "Mikrotik RouterBOARD 133",
+ADM5120_BOARD_START(RB_133, "Mikrotik RouterBOARD 133")
.board_setup = rb1xx_setup,
.eth_num_ports = 3,
.eth_vlans = rb133_vlans,
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb133c_board __initdata = {
- .mach_type = MACH_ADM5120_RB_133C,
- .name = "Mikrotik RouterBOARD 133C",
+ADM5120_BOARD_START(RB_133C, "Mikrotik RouterBOARD 133C")
.board_setup = rb1xx_setup,
.eth_num_ports = 1,
.eth_vlans = rb133c_vlans,
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb150_board __initdata = {
- .mach_type = MACH_ADM5120_RB_150,
- .name = "Mikrotik RouterBOARD 150",
+ADM5120_BOARD_START(RB_150, "Mikrotik RouterBOARD 150")
.board_setup = rb150_setup,
.eth_num_ports = 5,
.eth_vlans = rb15x_vlans,
.num_devices = ARRAY_SIZE(rb1xx_devices),
.devices = rb1xx_devices,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb153_board __initdata = {
- .mach_type = MACH_ADM5120_RB_153,
- .name = "Mikrotik RouterBOARD 153",
- .board_setup = rb1xx_setup,
+ADM5120_BOARD_START(RB_153, "Mikrotik RouterBOARD 153")
+ .board_setup = rb153_setup,
.eth_num_ports = 5,
.eth_vlans = rb15x_vlans,
- .num_devices = ARRAY_SIZE(rb1xx_devices),
- .devices = rb1xx_devices,
+ .num_devices = ARRAY_SIZE(rb153_devices),
+ .devices = rb153_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
+ADM5120_BOARD_END
-static struct adm5120_board rb192_board __initdata = {
- .mach_type = MACH_ADM5120_RB_192,
- .name = "Mikrotik RouterBOARD 192",
+ADM5120_BOARD_START(RB_192, "Mikrotik RouterBOARD 192")
.board_setup = rb1xx_setup,
.eth_num_ports = 5,
.eth_vlans = rb192_vlans,
.devices = rb1xx_devices,
.pci_nr_irqs = ARRAY_SIZE(rb1xx_pci_irqs),
.pci_irq_map = rb1xx_pci_irqs,
-};
-
-static int __init register_boards(void)
-{
- adm5120_board_register(&rb111_board);
- adm5120_board_register(&rb112_board);
- adm5120_board_register(&rb133_board);
- adm5120_board_register(&rb133c_board);
- adm5120_board_register(&rb150_board);
- adm5120_board_register(&rb153_board);
- adm5120_board_register(&rb192_board);
- return 0;
-}
-
-pure_initcall(register_boards);
+ADM5120_BOARD_END