Path: blob/master/arch/arm/mach-orion5x/wnr854t-setup.c
10817 views
/*1* arch/arm/mach-orion5x/wnr854t-setup.c2*3* This file is licensed under the terms of the GNU General Public4* License version 2. This program is licensed "as is" without any5* warranty of any kind, whether express or implied.6*/78#include <linux/kernel.h>9#include <linux/init.h>10#include <linux/platform_device.h>11#include <linux/pci.h>12#include <linux/irq.h>13#include <linux/delay.h>14#include <linux/mtd/physmap.h>15#include <linux/mv643xx_eth.h>16#include <linux/ethtool.h>17#include <net/dsa.h>18#include <asm/mach-types.h>19#include <asm/gpio.h>20#include <asm/mach/arch.h>21#include <asm/mach/pci.h>22#include <mach/orion5x.h>23#include "common.h"24#include "mpp.h"2526static unsigned int wnr854t_mpp_modes[] __initdata = {27MPP0_GPIO, /* Power LED green (0=on) */28MPP1_GPIO, /* Reset Button (0=off) */29MPP2_GPIO, /* Power LED blink (0=off) */30MPP3_GPIO, /* WAN Status LED amber (0=off) */31MPP4_GPIO, /* PCI int */32MPP5_GPIO, /* ??? */33MPP6_GPIO, /* ??? */34MPP7_GPIO, /* ??? */35MPP8_UNUSED, /* ??? */36MPP9_GIGE, /* GE_RXERR */37MPP10_UNUSED, /* ??? */38MPP11_UNUSED, /* ??? */39MPP12_GIGE, /* GE_TXD[4] */40MPP13_GIGE, /* GE_TXD[5] */41MPP14_GIGE, /* GE_TXD[6] */42MPP15_GIGE, /* GE_TXD[7] */43MPP16_GIGE, /* GE_RXD[4] */44MPP17_GIGE, /* GE_RXD[5] */45MPP18_GIGE, /* GE_RXD[6] */46MPP19_GIGE, /* GE_RXD[7] */470,48};4950/*51* 8M NOR flash Device bus boot chip select52*/53#define WNR854T_NOR_BOOT_BASE 0xf400000054#define WNR854T_NOR_BOOT_SIZE SZ_8M5556static struct mtd_partition wnr854t_nor_flash_partitions[] = {57{58.name = "kernel",59.offset = 0x00000000,60.size = 0x00100000,61}, {62.name = "rootfs",63.offset = 0x00100000,64.size = 0x00660000,65}, {66.name = "uboot",67.offset = 0x00760000,68.size = 0x00040000,69},70};7172static struct physmap_flash_data wnr854t_nor_flash_data = {73.width = 2,74.parts = wnr854t_nor_flash_partitions,75.nr_parts = ARRAY_SIZE(wnr854t_nor_flash_partitions),76};7778static struct resource wnr854t_nor_flash_resource = {79.flags = IORESOURCE_MEM,80.start = WNR854T_NOR_BOOT_BASE,81.end = WNR854T_NOR_BOOT_BASE + WNR854T_NOR_BOOT_SIZE - 1,82};8384static struct platform_device wnr854t_nor_flash = {85.name = "physmap-flash",86.id = 0,87.dev = {88.platform_data = &wnr854t_nor_flash_data,89},90.num_resources = 1,91.resource = &wnr854t_nor_flash_resource,92};9394static struct mv643xx_eth_platform_data wnr854t_eth_data = {95.phy_addr = MV643XX_ETH_PHY_NONE,96.speed = SPEED_1000,97.duplex = DUPLEX_FULL,98};99100static struct dsa_chip_data wnr854t_switch_chip_data = {101.port_names[0] = "lan3",102.port_names[1] = "lan4",103.port_names[2] = "wan",104.port_names[3] = "cpu",105.port_names[5] = "lan1",106.port_names[7] = "lan2",107};108109static struct dsa_platform_data wnr854t_switch_plat_data = {110.nr_chips = 1,111.chip = &wnr854t_switch_chip_data,112};113114static void __init wnr854t_init(void)115{116/*117* Setup basic Orion functions. Need to be called early.118*/119orion5x_init();120121orion5x_mpp_conf(wnr854t_mpp_modes);122123/*124* Configure peripherals.125*/126orion5x_eth_init(&wnr854t_eth_data);127orion5x_eth_switch_init(&wnr854t_switch_plat_data, NO_IRQ);128orion5x_uart0_init();129130orion5x_setup_dev_boot_win(WNR854T_NOR_BOOT_BASE,131WNR854T_NOR_BOOT_SIZE);132platform_device_register(&wnr854t_nor_flash);133}134135static int __init wnr854t_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)136{137int irq;138139/*140* Check for devices with hard-wired IRQs.141*/142irq = orion5x_pci_map_irq(dev, slot, pin);143if (irq != -1)144return irq;145146/*147* Mini-PCI slot.148*/149if (slot == 7)150return gpio_to_irq(4);151152return -1;153}154155static struct hw_pci wnr854t_pci __initdata = {156.nr_controllers = 2,157.swizzle = pci_std_swizzle,158.setup = orion5x_pci_sys_setup,159.scan = orion5x_pci_sys_scan_bus,160.map_irq = wnr854t_pci_map_irq,161};162163static int __init wnr854t_pci_init(void)164{165if (machine_is_wnr854t())166pci_common_init(&wnr854t_pci);167168return 0;169}170subsys_initcall(wnr854t_pci_init);171172MACHINE_START(WNR854T, "Netgear WNR854T")173/* Maintainer: Imre Kaloz <[email protected]> */174.boot_params = 0x00000100,175.init_machine = wnr854t_init,176.map_io = orion5x_map_io,177.init_early = orion5x_init_early,178.init_irq = orion5x_init_irq,179.timer = &orion5x_timer,180.fixup = tag_fixup_mem32,181MACHINE_END182183184