Path: blob/master/arch/arm/mach-kirkwood/t5325-setup.c
10817 views
/*1*2* HP t5325 Thin Client setup3*4* Copyright (C) 2010 Martin Michlmayr <[email protected]>5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License8* as published by the Free Software Foundation; either version9* 2 of the License, or (at your option) any later version.10*/1112#include <linux/kernel.h>13#include <linux/init.h>14#include <linux/platform_device.h>15#include <linux/mtd/physmap.h>16#include <linux/spi/flash.h>17#include <linux/spi/spi.h>18#include <linux/spi/orion_spi.h>19#include <linux/i2c.h>20#include <linux/mv643xx_eth.h>21#include <linux/ata_platform.h>22#include <linux/gpio.h>23#include <linux/gpio_keys.h>24#include <linux/input.h>25#include <sound/alc5623.h>26#include <asm/mach-types.h>27#include <asm/mach/arch.h>28#include <mach/kirkwood.h>29#include "common.h"30#include "mpp.h"3132struct mtd_partition hp_t5325_partitions[] = {33{34.name = "u-boot env",35.size = SZ_64K,36.offset = SZ_512K + SZ_256K,37},38{39.name = "permanent u-boot env",40.size = SZ_64K,41.offset = MTDPART_OFS_APPEND,42.mask_flags = MTD_WRITEABLE,43},44{45.name = "HP env",46.size = SZ_64K,47.offset = MTDPART_OFS_APPEND,48},49{50.name = "u-boot",51.size = SZ_512K,52.offset = 0,53.mask_flags = MTD_WRITEABLE,54},55{56.name = "SSD firmware",57.size = SZ_256K,58.offset = SZ_512K,59},60};6162const struct flash_platform_data hp_t5325_flash = {63.type = "mx25l8005",64.name = "spi_flash",65.parts = hp_t5325_partitions,66.nr_parts = ARRAY_SIZE(hp_t5325_partitions),67};6869struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {70{71.modalias = "m25p80",72.platform_data = &hp_t5325_flash,73.irq = -1,74},75};7677static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {78.phy_addr = MV643XX_ETH_PHY_ADDR(8),79};8081static struct mv_sata_platform_data hp_t5325_sata_data = {82.n_ports = 2,83};8485static struct gpio_keys_button hp_t5325_buttons[] = {86{87.code = KEY_POWER,88.gpio = 45,89.desc = "Power",90.active_low = 1,91},92};9394static struct gpio_keys_platform_data hp_t5325_button_data = {95.buttons = hp_t5325_buttons,96.nbuttons = ARRAY_SIZE(hp_t5325_buttons),97};9899static struct platform_device hp_t5325_button_device = {100.name = "gpio-keys",101.id = -1,102.num_resources = 0,103.dev = {104.platform_data = &hp_t5325_button_data,105}106};107108static unsigned int hp_t5325_mpp_config[] __initdata = {109MPP0_NF_IO2,110MPP1_SPI_MOSI,111MPP2_SPI_SCK,112MPP3_SPI_MISO,113MPP4_NF_IO6,114MPP5_NF_IO7,115MPP6_SYSRST_OUTn,116MPP7_SPI_SCn,117MPP8_TW0_SDA,118MPP9_TW0_SCK,119MPP10_UART0_TXD,120MPP11_UART0_RXD,121MPP12_SD_CLK,122MPP13_GPIO,123MPP14_GPIO,124MPP15_GPIO,125MPP16_GPIO,126MPP17_GPIO,127MPP18_NF_IO0,128MPP19_NF_IO1,129MPP20_GPIO,130MPP21_GPIO,131MPP22_GPIO,132MPP23_GPIO,133MPP32_GPIO,134MPP33_GE1_TXCTL,135MPP39_AU_I2SBCLK,136MPP40_AU_I2SDO,137MPP43_AU_I2SDI,138MPP41_AU_I2SLRCLK,139MPP42_AU_I2SMCLK,140MPP45_GPIO, /* Power button */141MPP48_GPIO, /* Board power off */1420143};144145static struct alc5623_platform_data alc5621_data = {146.add_ctrl = 0x3700,147.jack_det_ctrl = 0x4810,148};149150static struct i2c_board_info i2c_board_info[] __initdata = {151{152I2C_BOARD_INFO("alc5621", 0x1a),153.platform_data = &alc5621_data,154},155};156157#define HP_T5325_GPIO_POWER_OFF 48158159static void hp_t5325_power_off(void)160{161gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);162}163164static void __init hp_t5325_init(void)165{166/*167* Basic setup. Needs to be called early.168*/169kirkwood_init();170kirkwood_mpp_conf(hp_t5325_mpp_config);171172kirkwood_uart0_init();173spi_register_board_info(hp_t5325_spi_slave_info,174ARRAY_SIZE(hp_t5325_spi_slave_info));175kirkwood_spi_init();176kirkwood_i2c_init();177kirkwood_ge00_init(&hp_t5325_ge00_data);178kirkwood_sata_init(&hp_t5325_sata_data);179kirkwood_ehci_init();180platform_device_register(&hp_t5325_button_device);181182i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));183kirkwood_audio_init();184185if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&186gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)187pm_power_off = hp_t5325_power_off;188else189pr_err("t5325: failed to configure power-off GPIO\n");190}191192static int __init hp_t5325_pci_init(void)193{194if (machine_is_t5325())195kirkwood_pcie_init(KW_PCIE0);196197return 0;198}199subsys_initcall(hp_t5325_pci_init);200201MACHINE_START(T5325, "HP t5325 Thin Client")202/* Maintainer: Martin Michlmayr <[email protected]> */203.boot_params = 0x00000100,204.init_machine = hp_t5325_init,205.map_io = kirkwood_map_io,206.init_early = kirkwood_init_early,207.init_irq = kirkwood_init_irq,208.timer = &kirkwood_timer,209MACHINE_END210211212