Path: blob/master/arch/arm/mach-orion5x/mss2-setup.c
10817 views
/*1* Maxtor Shared Storage II Board Setup2*3* Maintainer: Sylver Bruneau <[email protected]>4*5* This program is free software; you can redistribute it and/or6* modify it under the terms of the GNU General Public License7* as published by the Free Software Foundation; either version8* 2 of the License, or (at your option) any later version.9*/1011#include <linux/kernel.h>12#include <linux/init.h>13#include <linux/platform_device.h>14#include <linux/pci.h>15#include <linux/irq.h>16#include <linux/mtd/physmap.h>17#include <linux/mv643xx_eth.h>18#include <linux/leds.h>19#include <linux/gpio_keys.h>20#include <linux/input.h>21#include <linux/i2c.h>22#include <linux/ata_platform.h>23#include <linux/gpio.h>24#include <asm/mach-types.h>25#include <asm/mach/arch.h>26#include <asm/mach/pci.h>27#include <mach/orion5x.h>28#include <mach/bridge-regs.h>29#include "common.h"30#include "mpp.h"3132#define MSS2_NOR_BOOT_BASE 0xff80000033#define MSS2_NOR_BOOT_SIZE SZ_256K3435/*****************************************************************************36* Maxtor Shared Storage II Info37****************************************************************************/3839/*40* Maxtor Shared Storage II hardware :41* - Marvell 88F5182-A2 C50042* - Marvell 88E1111 Gigabit Ethernet PHY43* - RTC M41T81 (@0x68) on I2C bus44* - 256KB NOR flash45* - 64MB of RAM46*/4748/*****************************************************************************49* 256KB NOR Flash on BOOT Device50****************************************************************************/5152static struct physmap_flash_data mss2_nor_flash_data = {53.width = 1,54};5556static struct resource mss2_nor_flash_resource = {57.flags = IORESOURCE_MEM,58.start = MSS2_NOR_BOOT_BASE,59.end = MSS2_NOR_BOOT_BASE + MSS2_NOR_BOOT_SIZE - 1,60};6162static struct platform_device mss2_nor_flash = {63.name = "physmap-flash",64.id = 0,65.dev = {66.platform_data = &mss2_nor_flash_data,67},68.resource = &mss2_nor_flash_resource,69.num_resources = 1,70};7172/****************************************************************************73* PCI setup74****************************************************************************/75static int __init mss2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)76{77int irq;7879/*80* Check for devices with hard-wired IRQs.81*/82irq = orion5x_pci_map_irq(dev, slot, pin);83if (irq != -1)84return irq;8586return -1;87}8889static struct hw_pci mss2_pci __initdata = {90.nr_controllers = 2,91.swizzle = pci_std_swizzle,92.setup = orion5x_pci_sys_setup,93.scan = orion5x_pci_sys_scan_bus,94.map_irq = mss2_pci_map_irq,95};9697static int __init mss2_pci_init(void)98{99if (machine_is_mss2())100pci_common_init(&mss2_pci);101102return 0;103}104subsys_initcall(mss2_pci_init);105106107/*****************************************************************************108* Ethernet109****************************************************************************/110111static struct mv643xx_eth_platform_data mss2_eth_data = {112.phy_addr = MV643XX_ETH_PHY_ADDR(8),113};114115/*****************************************************************************116* SATA117****************************************************************************/118119static struct mv_sata_platform_data mss2_sata_data = {120.n_ports = 2,121};122123/*****************************************************************************124* GPIO buttons125****************************************************************************/126127#define MSS2_GPIO_KEY_RESET 12128#define MSS2_GPIO_KEY_POWER 11129130static struct gpio_keys_button mss2_buttons[] = {131{132.code = KEY_POWER,133.gpio = MSS2_GPIO_KEY_POWER,134.desc = "Power",135.active_low = 1,136}, {137.code = KEY_RESTART,138.gpio = MSS2_GPIO_KEY_RESET,139.desc = "Reset",140.active_low = 1,141},142};143144static struct gpio_keys_platform_data mss2_button_data = {145.buttons = mss2_buttons,146.nbuttons = ARRAY_SIZE(mss2_buttons),147};148149static struct platform_device mss2_button_device = {150.name = "gpio-keys",151.id = -1,152.dev = {153.platform_data = &mss2_button_data,154},155};156157/*****************************************************************************158* RTC m41t81 on I2C bus159****************************************************************************/160161#define MSS2_GPIO_RTC_IRQ 3162163static struct i2c_board_info __initdata mss2_i2c_rtc = {164I2C_BOARD_INFO("m41t81", 0x68),165};166167/*****************************************************************************168* MSS2 power off method169****************************************************************************/170/*171* On the Maxtor Shared Storage II, the shutdown process is the following :172* - Userland modifies U-boot env to tell U-boot to go idle at next boot173* - The board reboots174* - U-boot starts and go into an idle mode until the user press "power"175*/176static void mss2_power_off(void)177{178u32 reg;179180/*181* Enable and issue soft reset182*/183reg = readl(RSTOUTn_MASK);184reg |= 1 << 2;185writel(reg, RSTOUTn_MASK);186187reg = readl(CPU_SOFT_RESET);188reg |= 1;189writel(reg, CPU_SOFT_RESET);190}191192/****************************************************************************193* General Setup194****************************************************************************/195static unsigned int mss2_mpp_modes[] __initdata = {196MPP0_GPIO, /* Power LED */197MPP1_GPIO, /* Error LED */198MPP2_UNUSED,199MPP3_GPIO, /* RTC interrupt */200MPP4_GPIO, /* HDD ind. (Single/Dual)*/201MPP5_GPIO, /* HD0 5V control */202MPP6_GPIO, /* HD0 12V control */203MPP7_GPIO, /* HD1 5V control */204MPP8_GPIO, /* HD1 12V control */205MPP9_UNUSED,206MPP10_GPIO, /* Fan control */207MPP11_GPIO, /* Power button */208MPP12_GPIO, /* Reset button */209MPP13_UNUSED,210MPP14_SATA_LED, /* SATA 0 active */211MPP15_SATA_LED, /* SATA 1 active */212MPP16_UNUSED,213MPP17_UNUSED,214MPP18_UNUSED,215MPP19_UNUSED,2160,217};218219static void __init mss2_init(void)220{221/* Setup basic Orion functions. Need to be called early. */222orion5x_init();223224orion5x_mpp_conf(mss2_mpp_modes);225226/*227* MPP[20] Unused228* MPP[21] PCI clock229* MPP[22] USB 0 over current230* MPP[23] USB 1 over current231*/232233/*234* Configure peripherals.235*/236orion5x_ehci0_init();237orion5x_ehci1_init();238orion5x_eth_init(&mss2_eth_data);239orion5x_i2c_init();240orion5x_sata_init(&mss2_sata_data);241orion5x_uart0_init();242orion5x_xor_init();243244orion5x_setup_dev_boot_win(MSS2_NOR_BOOT_BASE, MSS2_NOR_BOOT_SIZE);245platform_device_register(&mss2_nor_flash);246247platform_device_register(&mss2_button_device);248249if (gpio_request(MSS2_GPIO_RTC_IRQ, "rtc") == 0) {250if (gpio_direction_input(MSS2_GPIO_RTC_IRQ) == 0)251mss2_i2c_rtc.irq = gpio_to_irq(MSS2_GPIO_RTC_IRQ);252else253gpio_free(MSS2_GPIO_RTC_IRQ);254}255i2c_register_board_info(0, &mss2_i2c_rtc, 1);256257/* register mss2 specific power-off method */258pm_power_off = mss2_power_off;259}260261MACHINE_START(MSS2, "Maxtor Shared Storage II")262/* Maintainer: Sylver Bruneau <[email protected]> */263.boot_params = 0x00000100,264.init_machine = mss2_init,265.map_io = orion5x_map_io,266.init_early = orion5x_init_early,267.init_irq = orion5x_init_irq,268.timer = &orion5x_timer,269.fixup = tag_fixup_mem32270MACHINE_END271272273