Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * arch/arm/mach-orion5x/rd88f6183-ap-ge-setup.c
0004  *
0005  * Marvell Orion-1-90 AP GE Reference Design Setup
0006  */
0007 #include <linux/gpio.h>
0008 #include <linux/kernel.h>
0009 #include <linux/init.h>
0010 #include <linux/platform_device.h>
0011 #include <linux/pci.h>
0012 #include <linux/irq.h>
0013 #include <linux/mtd/physmap.h>
0014 #include <linux/mv643xx_eth.h>
0015 #include <linux/spi/spi.h>
0016 #include <linux/spi/flash.h>
0017 #include <linux/ethtool.h>
0018 #include <linux/platform_data/dsa.h>
0019 #include <asm/mach-types.h>
0020 #include <asm/mach/arch.h>
0021 #include <asm/mach/pci.h>
0022 #include "common.h"
0023 #include "orion5x.h"
0024 
0025 static struct mv643xx_eth_platform_data rd88f6183ap_ge_eth_data = {
0026     .phy_addr   = -1,
0027     .speed      = SPEED_1000,
0028     .duplex     = DUPLEX_FULL,
0029 };
0030 
0031 static struct dsa_chip_data rd88f6183ap_ge_switch_chip_data = {
0032     .port_names[0]  = "lan1",
0033     .port_names[1]  = "lan2",
0034     .port_names[2]  = "lan3",
0035     .port_names[3]  = "lan4",
0036     .port_names[4]  = "wan",
0037     .port_names[5]  = "cpu",
0038 };
0039 
0040 static struct mtd_partition rd88f6183ap_ge_partitions[] = {
0041     {
0042         .name   = "kernel",
0043         .offset = 0x00000000,
0044         .size   = 0x00200000,
0045     }, {
0046         .name   = "rootfs",
0047         .offset = 0x00200000,
0048         .size   = 0x00500000,
0049     }, {
0050         .name   = "nvram",
0051         .offset = 0x00700000,
0052         .size   = 0x00080000,
0053     },
0054 };
0055 
0056 static struct flash_platform_data rd88f6183ap_ge_spi_slave_data = {
0057     .type       = "m25p64",
0058     .nr_parts   = ARRAY_SIZE(rd88f6183ap_ge_partitions),
0059     .parts      = rd88f6183ap_ge_partitions,
0060 };
0061 
0062 static struct spi_board_info __initdata rd88f6183ap_ge_spi_slave_info[] = {
0063     {
0064         .modalias   = "m25p80",
0065         .platform_data  = &rd88f6183ap_ge_spi_slave_data,
0066         .max_speed_hz   = 20000000,
0067         .bus_num    = 0,
0068         .chip_select    = 0,
0069     },
0070 };
0071 
0072 static void __init rd88f6183ap_ge_init(void)
0073 {
0074     /*
0075      * Setup basic Orion functions. Need to be called early.
0076      */
0077     orion5x_init();
0078 
0079     /*
0080      * Configure peripherals.
0081      */
0082     orion5x_ehci0_init();
0083     orion5x_eth_init(&rd88f6183ap_ge_eth_data);
0084     orion5x_eth_switch_init(&rd88f6183ap_ge_switch_chip_data);
0085     spi_register_board_info(rd88f6183ap_ge_spi_slave_info,
0086                 ARRAY_SIZE(rd88f6183ap_ge_spi_slave_info));
0087     orion5x_spi_init();
0088     orion5x_uart0_init();
0089 }
0090 
0091 static struct hw_pci rd88f6183ap_ge_pci __initdata = {
0092     .nr_controllers = 2,
0093     .setup      = orion5x_pci_sys_setup,
0094     .scan       = orion5x_pci_sys_scan_bus,
0095     .map_irq    = orion5x_pci_map_irq,
0096 };
0097 
0098 static int __init rd88f6183ap_ge_pci_init(void)
0099 {
0100     if (machine_is_rd88f6183ap_ge()) {
0101         orion5x_pci_disable();
0102         pci_common_init(&rd88f6183ap_ge_pci);
0103     }
0104 
0105     return 0;
0106 }
0107 subsys_initcall(rd88f6183ap_ge_pci_init);
0108 
0109 MACHINE_START(RD88F6183AP_GE, "Marvell Orion-1-90 AP GE Reference Design")
0110     /* Maintainer: Lennert Buytenhek <buytenh@marvell.com> */
0111     .atag_offset    = 0x100,
0112     .nr_irqs    = ORION5X_NR_IRQS,
0113     .init_machine   = rd88f6183ap_ge_init,
0114     .map_io     = orion5x_map_io,
0115     .init_early = orion5x_init_early,
0116     .init_irq   = orion5x_init_irq,
0117     .init_time  = orion5x_timer_init,
0118     .fixup      = tag_fixup_mem32,
0119     .restart    = orion5x_restart,
0120 MACHINE_END