18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * arch/arm/mach-orion5x/net2big-setup.c 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * LaCie 2Big Network NAS setup 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2009 Simon Guinot <sguinot@lacie.com> 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * This file is licensed under the terms of the GNU General Public 98c2ecf20Sopenharmony_ci * License version 2. This program is licensed "as is" without any 108c2ecf20Sopenharmony_ci * warranty of any kind, whether express or implied. 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/kernel.h> 148c2ecf20Sopenharmony_ci#include <linux/init.h> 158c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 168c2ecf20Sopenharmony_ci#include <linux/mtd/physmap.h> 178c2ecf20Sopenharmony_ci#include <linux/mv643xx_eth.h> 188c2ecf20Sopenharmony_ci#include <linux/leds.h> 198c2ecf20Sopenharmony_ci#include <linux/gpio_keys.h> 208c2ecf20Sopenharmony_ci#include <linux/input.h> 218c2ecf20Sopenharmony_ci#include <linux/i2c.h> 228c2ecf20Sopenharmony_ci#include <linux/ata_platform.h> 238c2ecf20Sopenharmony_ci#include <linux/gpio.h> 248c2ecf20Sopenharmony_ci#include <linux/delay.h> 258c2ecf20Sopenharmony_ci#include <asm/mach-types.h> 268c2ecf20Sopenharmony_ci#include <asm/mach/arch.h> 278c2ecf20Sopenharmony_ci#include <plat/orion-gpio.h> 288c2ecf20Sopenharmony_ci#include "common.h" 298c2ecf20Sopenharmony_ci#include "mpp.h" 308c2ecf20Sopenharmony_ci#include "orion5x.h" 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/***************************************************************************** 338c2ecf20Sopenharmony_ci * LaCie 2Big Network Info 348c2ecf20Sopenharmony_ci ****************************************************************************/ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/* 378c2ecf20Sopenharmony_ci * 512KB NOR flash Device bus boot chip select 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#define NET2BIG_NOR_BOOT_BASE 0xfff80000 418c2ecf20Sopenharmony_ci#define NET2BIG_NOR_BOOT_SIZE SZ_512K 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci/***************************************************************************** 448c2ecf20Sopenharmony_ci * 512KB NOR Flash on Boot Device 458c2ecf20Sopenharmony_ci ****************************************************************************/ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci/* 488c2ecf20Sopenharmony_ci * TODO: Check write support on flash MX29LV400CBTC-70G 498c2ecf20Sopenharmony_ci */ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistatic struct mtd_partition net2big_partitions[] = { 528c2ecf20Sopenharmony_ci { 538c2ecf20Sopenharmony_ci .name = "Full512kb", 548c2ecf20Sopenharmony_ci .size = MTDPART_SIZ_FULL, 558c2ecf20Sopenharmony_ci .offset = 0x00000000, 568c2ecf20Sopenharmony_ci .mask_flags = MTD_WRITEABLE, 578c2ecf20Sopenharmony_ci }, 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistatic struct physmap_flash_data net2big_nor_flash_data = { 618c2ecf20Sopenharmony_ci .width = 1, 628c2ecf20Sopenharmony_ci .parts = net2big_partitions, 638c2ecf20Sopenharmony_ci .nr_parts = ARRAY_SIZE(net2big_partitions), 648c2ecf20Sopenharmony_ci}; 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_cistatic struct resource net2big_nor_flash_resource = { 678c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 688c2ecf20Sopenharmony_ci .start = NET2BIG_NOR_BOOT_BASE, 698c2ecf20Sopenharmony_ci .end = NET2BIG_NOR_BOOT_BASE 708c2ecf20Sopenharmony_ci + NET2BIG_NOR_BOOT_SIZE - 1, 718c2ecf20Sopenharmony_ci}; 728c2ecf20Sopenharmony_ci 738c2ecf20Sopenharmony_cistatic struct platform_device net2big_nor_flash = { 748c2ecf20Sopenharmony_ci .name = "physmap-flash", 758c2ecf20Sopenharmony_ci .id = 0, 768c2ecf20Sopenharmony_ci .dev = { 778c2ecf20Sopenharmony_ci .platform_data = &net2big_nor_flash_data, 788c2ecf20Sopenharmony_ci }, 798c2ecf20Sopenharmony_ci .num_resources = 1, 808c2ecf20Sopenharmony_ci .resource = &net2big_nor_flash_resource, 818c2ecf20Sopenharmony_ci}; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/***************************************************************************** 848c2ecf20Sopenharmony_ci * Ethernet 858c2ecf20Sopenharmony_ci ****************************************************************************/ 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic struct mv643xx_eth_platform_data net2big_eth_data = { 888c2ecf20Sopenharmony_ci .phy_addr = MV643XX_ETH_PHY_ADDR(8), 898c2ecf20Sopenharmony_ci}; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci/***************************************************************************** 928c2ecf20Sopenharmony_ci * I2C devices 938c2ecf20Sopenharmony_ci ****************************************************************************/ 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* 968c2ecf20Sopenharmony_ci * i2c addr | chip | description 978c2ecf20Sopenharmony_ci * 0x32 | Ricoh 5C372b | RTC 988c2ecf20Sopenharmony_ci * 0x50 | HT24LC08 | eeprom (1kB) 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_cistatic struct i2c_board_info __initdata net2big_i2c_devices[] = { 1018c2ecf20Sopenharmony_ci { 1028c2ecf20Sopenharmony_ci I2C_BOARD_INFO("rs5c372b", 0x32), 1038c2ecf20Sopenharmony_ci }, { 1048c2ecf20Sopenharmony_ci I2C_BOARD_INFO("24c08", 0x50), 1058c2ecf20Sopenharmony_ci }, 1068c2ecf20Sopenharmony_ci}; 1078c2ecf20Sopenharmony_ci 1088c2ecf20Sopenharmony_ci/***************************************************************************** 1098c2ecf20Sopenharmony_ci * SATA 1108c2ecf20Sopenharmony_ci ****************************************************************************/ 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_cistatic struct mv_sata_platform_data net2big_sata_data = { 1138c2ecf20Sopenharmony_ci .n_ports = 2, 1148c2ecf20Sopenharmony_ci}; 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA_POWER_REQ 19 1178c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA0_POWER 23 1188c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA1_POWER 25 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_cistatic void __init net2big_sata_power_init(void) 1218c2ecf20Sopenharmony_ci{ 1228c2ecf20Sopenharmony_ci int err; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_ci /* Configure GPIOs over MPP max number. */ 1258c2ecf20Sopenharmony_ci orion_gpio_set_valid(NET2BIG_GPIO_SATA0_POWER, 1); 1268c2ecf20Sopenharmony_ci orion_gpio_set_valid(NET2BIG_GPIO_SATA1_POWER, 1); 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_SATA0_POWER, "SATA0 power status"); 1298c2ecf20Sopenharmony_ci if (err == 0) { 1308c2ecf20Sopenharmony_ci err = gpio_direction_input(NET2BIG_GPIO_SATA0_POWER); 1318c2ecf20Sopenharmony_ci if (err) 1328c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA0_POWER); 1338c2ecf20Sopenharmony_ci } 1348c2ecf20Sopenharmony_ci if (err) { 1358c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup SATA0 power GPIO\n"); 1368c2ecf20Sopenharmony_ci return; 1378c2ecf20Sopenharmony_ci } 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_SATA1_POWER, "SATA1 power status"); 1408c2ecf20Sopenharmony_ci if (err == 0) { 1418c2ecf20Sopenharmony_ci err = gpio_direction_input(NET2BIG_GPIO_SATA1_POWER); 1428c2ecf20Sopenharmony_ci if (err) 1438c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA1_POWER); 1448c2ecf20Sopenharmony_ci } 1458c2ecf20Sopenharmony_ci if (err) { 1468c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup SATA1 power GPIO\n"); 1478c2ecf20Sopenharmony_ci goto err_free_1; 1488c2ecf20Sopenharmony_ci } 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_SATA_POWER_REQ, "SATA power request"); 1518c2ecf20Sopenharmony_ci if (err == 0) { 1528c2ecf20Sopenharmony_ci err = gpio_direction_output(NET2BIG_GPIO_SATA_POWER_REQ, 0); 1538c2ecf20Sopenharmony_ci if (err) 1548c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA_POWER_REQ); 1558c2ecf20Sopenharmony_ci } 1568c2ecf20Sopenharmony_ci if (err) { 1578c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup SATA power request GPIO\n"); 1588c2ecf20Sopenharmony_ci goto err_free_2; 1598c2ecf20Sopenharmony_ci } 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci if (gpio_get_value(NET2BIG_GPIO_SATA0_POWER) && 1628c2ecf20Sopenharmony_ci gpio_get_value(NET2BIG_GPIO_SATA1_POWER)) { 1638c2ecf20Sopenharmony_ci return; 1648c2ecf20Sopenharmony_ci } 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci /* 1678c2ecf20Sopenharmony_ci * SATA power up on both disk is done by pulling high the CPLD power 1688c2ecf20Sopenharmony_ci * request line. The 300ms delay is related to the CPLD clock and is 1698c2ecf20Sopenharmony_ci * needed to be sure that the CPLD has take into account the low line 1708c2ecf20Sopenharmony_ci * status. 1718c2ecf20Sopenharmony_ci */ 1728c2ecf20Sopenharmony_ci msleep(300); 1738c2ecf20Sopenharmony_ci gpio_set_value(NET2BIG_GPIO_SATA_POWER_REQ, 1); 1748c2ecf20Sopenharmony_ci pr_info("net2big: power up SATA hard disks\n"); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci return; 1778c2ecf20Sopenharmony_ci 1788c2ecf20Sopenharmony_cierr_free_2: 1798c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA1_POWER); 1808c2ecf20Sopenharmony_cierr_free_1: 1818c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA0_POWER); 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci return; 1848c2ecf20Sopenharmony_ci} 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/***************************************************************************** 1878c2ecf20Sopenharmony_ci * GPIO LEDs 1888c2ecf20Sopenharmony_ci ****************************************************************************/ 1898c2ecf20Sopenharmony_ci 1908c2ecf20Sopenharmony_ci/* 1918c2ecf20Sopenharmony_ci * The power front LEDs (blue and red) and SATA red LEDs are controlled via a 1928c2ecf20Sopenharmony_ci * single GPIO line and are compatible with the leds-gpio driver. 1938c2ecf20Sopenharmony_ci * 1948c2ecf20Sopenharmony_ci * The SATA blue LEDs have some hardware blink capabilities which are detailed 1958c2ecf20Sopenharmony_ci * in the following array: 1968c2ecf20Sopenharmony_ci * 1978c2ecf20Sopenharmony_ci * SATAx blue LED | SATAx activity | LED state 1988c2ecf20Sopenharmony_ci * | | 1998c2ecf20Sopenharmony_ci * 0 | 0 | blink (rate 300ms) 2008c2ecf20Sopenharmony_ci * 1 | 0 | off 2018c2ecf20Sopenharmony_ci * ? | 1 | on 2028c2ecf20Sopenharmony_ci * 2038c2ecf20Sopenharmony_ci * Notes: The blue and the red front LED's can't be on at the same time. 2048c2ecf20Sopenharmony_ci * Blue LED have priority. 2058c2ecf20Sopenharmony_ci */ 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_PWR_RED_LED 6 2088c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_PWR_BLUE_LED 16 2098c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_PWR_LED_BLINK_STOP 7 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA0_RED_LED 11 2128c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA1_RED_LED 10 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA0_BLUE_LED 17 2158c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_SATA1_BLUE_LED 13 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_cistatic struct gpio_led net2big_leds[] = { 2188c2ecf20Sopenharmony_ci { 2198c2ecf20Sopenharmony_ci .name = "net2big:red:power", 2208c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_PWR_RED_LED, 2218c2ecf20Sopenharmony_ci }, 2228c2ecf20Sopenharmony_ci { 2238c2ecf20Sopenharmony_ci .name = "net2big:blue:power", 2248c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_PWR_BLUE_LED, 2258c2ecf20Sopenharmony_ci }, 2268c2ecf20Sopenharmony_ci { 2278c2ecf20Sopenharmony_ci .name = "net2big:red:sata0", 2288c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_SATA0_RED_LED, 2298c2ecf20Sopenharmony_ci }, 2308c2ecf20Sopenharmony_ci { 2318c2ecf20Sopenharmony_ci .name = "net2big:red:sata1", 2328c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_SATA1_RED_LED, 2338c2ecf20Sopenharmony_ci }, 2348c2ecf20Sopenharmony_ci}; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistatic struct gpio_led_platform_data net2big_led_data = { 2378c2ecf20Sopenharmony_ci .num_leds = ARRAY_SIZE(net2big_leds), 2388c2ecf20Sopenharmony_ci .leds = net2big_leds, 2398c2ecf20Sopenharmony_ci}; 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_cistatic struct platform_device net2big_gpio_leds = { 2428c2ecf20Sopenharmony_ci .name = "leds-gpio", 2438c2ecf20Sopenharmony_ci .id = -1, 2448c2ecf20Sopenharmony_ci .dev = { 2458c2ecf20Sopenharmony_ci .platform_data = &net2big_led_data, 2468c2ecf20Sopenharmony_ci }, 2478c2ecf20Sopenharmony_ci}; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_cistatic void __init net2big_gpio_leds_init(void) 2508c2ecf20Sopenharmony_ci{ 2518c2ecf20Sopenharmony_ci int err; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci /* Stop initial CPLD slow red/blue blinking on power LED. */ 2548c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_PWR_LED_BLINK_STOP, 2558c2ecf20Sopenharmony_ci "Power LED blink stop"); 2568c2ecf20Sopenharmony_ci if (err == 0) { 2578c2ecf20Sopenharmony_ci err = gpio_direction_output(NET2BIG_GPIO_PWR_LED_BLINK_STOP, 1); 2588c2ecf20Sopenharmony_ci if (err) 2598c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_PWR_LED_BLINK_STOP); 2608c2ecf20Sopenharmony_ci } 2618c2ecf20Sopenharmony_ci if (err) 2628c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup power LED blink GPIO\n"); 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci /* 2658c2ecf20Sopenharmony_ci * Configure SATA0 and SATA1 blue LEDs to blink in relation with the 2668c2ecf20Sopenharmony_ci * hard disk activity. 2678c2ecf20Sopenharmony_ci */ 2688c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_SATA0_BLUE_LED, 2698c2ecf20Sopenharmony_ci "SATA0 blue LED control"); 2708c2ecf20Sopenharmony_ci if (err == 0) { 2718c2ecf20Sopenharmony_ci err = gpio_direction_output(NET2BIG_GPIO_SATA0_BLUE_LED, 1); 2728c2ecf20Sopenharmony_ci if (err) 2738c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA0_BLUE_LED); 2748c2ecf20Sopenharmony_ci } 2758c2ecf20Sopenharmony_ci if (err) 2768c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup SATA0 blue LED GPIO\n"); 2778c2ecf20Sopenharmony_ci 2788c2ecf20Sopenharmony_ci err = gpio_request(NET2BIG_GPIO_SATA1_BLUE_LED, 2798c2ecf20Sopenharmony_ci "SATA1 blue LED control"); 2808c2ecf20Sopenharmony_ci if (err == 0) { 2818c2ecf20Sopenharmony_ci err = gpio_direction_output(NET2BIG_GPIO_SATA1_BLUE_LED, 1); 2828c2ecf20Sopenharmony_ci if (err) 2838c2ecf20Sopenharmony_ci gpio_free(NET2BIG_GPIO_SATA1_BLUE_LED); 2848c2ecf20Sopenharmony_ci } 2858c2ecf20Sopenharmony_ci if (err) 2868c2ecf20Sopenharmony_ci pr_err("net2big: failed to setup SATA1 blue LED GPIO\n"); 2878c2ecf20Sopenharmony_ci 2888c2ecf20Sopenharmony_ci platform_device_register(&net2big_gpio_leds); 2898c2ecf20Sopenharmony_ci} 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci/**************************************************************************** 2928c2ecf20Sopenharmony_ci * GPIO keys 2938c2ecf20Sopenharmony_ci ****************************************************************************/ 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_PUSH_BUTTON 18 2968c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_POWER_SWITCH_ON 8 2978c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_POWER_SWITCH_OFF 9 2988c2ecf20Sopenharmony_ci 2998c2ecf20Sopenharmony_ci#define NET2BIG_SWITCH_POWER_ON 0x1 3008c2ecf20Sopenharmony_ci#define NET2BIG_SWITCH_POWER_OFF 0x2 3018c2ecf20Sopenharmony_ci 3028c2ecf20Sopenharmony_cistatic struct gpio_keys_button net2big_buttons[] = { 3038c2ecf20Sopenharmony_ci { 3048c2ecf20Sopenharmony_ci .type = EV_SW, 3058c2ecf20Sopenharmony_ci .code = NET2BIG_SWITCH_POWER_OFF, 3068c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_POWER_SWITCH_OFF, 3078c2ecf20Sopenharmony_ci .desc = "Power rocker switch (auto|off)", 3088c2ecf20Sopenharmony_ci .active_low = 0, 3098c2ecf20Sopenharmony_ci }, 3108c2ecf20Sopenharmony_ci { 3118c2ecf20Sopenharmony_ci .type = EV_SW, 3128c2ecf20Sopenharmony_ci .code = NET2BIG_SWITCH_POWER_ON, 3138c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_POWER_SWITCH_ON, 3148c2ecf20Sopenharmony_ci .desc = "Power rocker switch (on|auto)", 3158c2ecf20Sopenharmony_ci .active_low = 0, 3168c2ecf20Sopenharmony_ci }, 3178c2ecf20Sopenharmony_ci { 3188c2ecf20Sopenharmony_ci .type = EV_KEY, 3198c2ecf20Sopenharmony_ci .code = KEY_POWER, 3208c2ecf20Sopenharmony_ci .gpio = NET2BIG_GPIO_PUSH_BUTTON, 3218c2ecf20Sopenharmony_ci .desc = "Front Push Button", 3228c2ecf20Sopenharmony_ci .active_low = 0, 3238c2ecf20Sopenharmony_ci }, 3248c2ecf20Sopenharmony_ci}; 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_cistatic struct gpio_keys_platform_data net2big_button_data = { 3278c2ecf20Sopenharmony_ci .buttons = net2big_buttons, 3288c2ecf20Sopenharmony_ci .nbuttons = ARRAY_SIZE(net2big_buttons), 3298c2ecf20Sopenharmony_ci}; 3308c2ecf20Sopenharmony_ci 3318c2ecf20Sopenharmony_cistatic struct platform_device net2big_gpio_buttons = { 3328c2ecf20Sopenharmony_ci .name = "gpio-keys", 3338c2ecf20Sopenharmony_ci .id = -1, 3348c2ecf20Sopenharmony_ci .dev = { 3358c2ecf20Sopenharmony_ci .platform_data = &net2big_button_data, 3368c2ecf20Sopenharmony_ci }, 3378c2ecf20Sopenharmony_ci}; 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci/***************************************************************************** 3408c2ecf20Sopenharmony_ci * General Setup 3418c2ecf20Sopenharmony_ci ****************************************************************************/ 3428c2ecf20Sopenharmony_ci 3438c2ecf20Sopenharmony_cistatic unsigned int net2big_mpp_modes[] __initdata = { 3448c2ecf20Sopenharmony_ci MPP0_GPIO, /* Raid mode (bit 0) */ 3458c2ecf20Sopenharmony_ci MPP1_GPIO, /* USB port 2 fuse (0 = Fail, 1 = Ok) */ 3468c2ecf20Sopenharmony_ci MPP2_GPIO, /* Raid mode (bit 1) */ 3478c2ecf20Sopenharmony_ci MPP3_GPIO, /* Board ID (bit 0) */ 3488c2ecf20Sopenharmony_ci MPP4_GPIO, /* Fan activity (0 = Off, 1 = On) */ 3498c2ecf20Sopenharmony_ci MPP5_GPIO, /* Fan fail detection */ 3508c2ecf20Sopenharmony_ci MPP6_GPIO, /* Red front LED (0 = Off, 1 = On) */ 3518c2ecf20Sopenharmony_ci MPP7_GPIO, /* Disable initial blinking on front LED */ 3528c2ecf20Sopenharmony_ci MPP8_GPIO, /* Rear power switch (on|auto) */ 3538c2ecf20Sopenharmony_ci MPP9_GPIO, /* Rear power switch (auto|off) */ 3548c2ecf20Sopenharmony_ci MPP10_GPIO, /* SATA 1 red LED (0 = Off, 1 = On) */ 3558c2ecf20Sopenharmony_ci MPP11_GPIO, /* SATA 0 red LED (0 = Off, 1 = On) */ 3568c2ecf20Sopenharmony_ci MPP12_GPIO, /* Board ID (bit 1) */ 3578c2ecf20Sopenharmony_ci MPP13_GPIO, /* SATA 1 blue LED blink control */ 3588c2ecf20Sopenharmony_ci MPP14_SATA_LED, 3598c2ecf20Sopenharmony_ci MPP15_SATA_LED, 3608c2ecf20Sopenharmony_ci MPP16_GPIO, /* Blue front LED control */ 3618c2ecf20Sopenharmony_ci MPP17_GPIO, /* SATA 0 blue LED blink control */ 3628c2ecf20Sopenharmony_ci MPP18_GPIO, /* Front button (0 = Released, 1 = Pushed ) */ 3638c2ecf20Sopenharmony_ci MPP19_GPIO, /* SATA{0,1} power On/Off request */ 3648c2ecf20Sopenharmony_ci 0, 3658c2ecf20Sopenharmony_ci /* 22: USB port 1 fuse (0 = Fail, 1 = Ok) */ 3668c2ecf20Sopenharmony_ci /* 23: SATA 0 power status */ 3678c2ecf20Sopenharmony_ci /* 24: Board power off */ 3688c2ecf20Sopenharmony_ci /* 25: SATA 1 power status */ 3698c2ecf20Sopenharmony_ci}; 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci#define NET2BIG_GPIO_POWER_OFF 24 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_cistatic void net2big_power_off(void) 3748c2ecf20Sopenharmony_ci{ 3758c2ecf20Sopenharmony_ci gpio_set_value(NET2BIG_GPIO_POWER_OFF, 1); 3768c2ecf20Sopenharmony_ci} 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_cistatic void __init net2big_init(void) 3798c2ecf20Sopenharmony_ci{ 3808c2ecf20Sopenharmony_ci /* 3818c2ecf20Sopenharmony_ci * Setup basic Orion functions. Need to be called early. 3828c2ecf20Sopenharmony_ci */ 3838c2ecf20Sopenharmony_ci orion5x_init(); 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci orion5x_mpp_conf(net2big_mpp_modes); 3868c2ecf20Sopenharmony_ci 3878c2ecf20Sopenharmony_ci /* 3888c2ecf20Sopenharmony_ci * Configure peripherals. 3898c2ecf20Sopenharmony_ci */ 3908c2ecf20Sopenharmony_ci orion5x_ehci0_init(); 3918c2ecf20Sopenharmony_ci orion5x_ehci1_init(); 3928c2ecf20Sopenharmony_ci orion5x_eth_init(&net2big_eth_data); 3938c2ecf20Sopenharmony_ci orion5x_i2c_init(); 3948c2ecf20Sopenharmony_ci orion5x_uart0_init(); 3958c2ecf20Sopenharmony_ci orion5x_xor_init(); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci net2big_sata_power_init(); 3988c2ecf20Sopenharmony_ci orion5x_sata_init(&net2big_sata_data); 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci mvebu_mbus_add_window_by_id(ORION_MBUS_DEVBUS_BOOT_TARGET, 4018c2ecf20Sopenharmony_ci ORION_MBUS_DEVBUS_BOOT_ATTR, 4028c2ecf20Sopenharmony_ci NET2BIG_NOR_BOOT_BASE, 4038c2ecf20Sopenharmony_ci NET2BIG_NOR_BOOT_SIZE); 4048c2ecf20Sopenharmony_ci platform_device_register(&net2big_nor_flash); 4058c2ecf20Sopenharmony_ci 4068c2ecf20Sopenharmony_ci platform_device_register(&net2big_gpio_buttons); 4078c2ecf20Sopenharmony_ci net2big_gpio_leds_init(); 4088c2ecf20Sopenharmony_ci 4098c2ecf20Sopenharmony_ci i2c_register_board_info(0, net2big_i2c_devices, 4108c2ecf20Sopenharmony_ci ARRAY_SIZE(net2big_i2c_devices)); 4118c2ecf20Sopenharmony_ci 4128c2ecf20Sopenharmony_ci orion_gpio_set_valid(NET2BIG_GPIO_POWER_OFF, 1); 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ci if (gpio_request(NET2BIG_GPIO_POWER_OFF, "power-off") == 0 && 4158c2ecf20Sopenharmony_ci gpio_direction_output(NET2BIG_GPIO_POWER_OFF, 0) == 0) 4168c2ecf20Sopenharmony_ci pm_power_off = net2big_power_off; 4178c2ecf20Sopenharmony_ci else 4188c2ecf20Sopenharmony_ci pr_err("net2big: failed to configure power-off GPIO\n"); 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci pr_notice("net2big: Flash writing is not yet supported.\n"); 4218c2ecf20Sopenharmony_ci} 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */ 4248c2ecf20Sopenharmony_ciMACHINE_START(NET2BIG, "LaCie 2Big Network") 4258c2ecf20Sopenharmony_ci .atag_offset = 0x100, 4268c2ecf20Sopenharmony_ci .nr_irqs = ORION5X_NR_IRQS, 4278c2ecf20Sopenharmony_ci .init_machine = net2big_init, 4288c2ecf20Sopenharmony_ci .map_io = orion5x_map_io, 4298c2ecf20Sopenharmony_ci .init_early = orion5x_init_early, 4308c2ecf20Sopenharmony_ci .init_irq = orion5x_init_irq, 4318c2ecf20Sopenharmony_ci .init_time = orion5x_timer_init, 4328c2ecf20Sopenharmony_ci .fixup = tag_fixup_mem32, 4338c2ecf20Sopenharmony_ci .restart = orion5x_restart, 4348c2ecf20Sopenharmony_ciMACHINE_END 4358c2ecf20Sopenharmony_ci 436