linux/arch/arm/mach-kirkwood/t5325-setup.c
<<
>>
Prefs
   1/*
   2 *
   3 * HP t5325 Thin Client setup
   4 *
   5 * Copyright (C) 2010  Martin Michlmayr <tbm@cyrius.com>
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public License
   9 * as published by the Free Software Foundation; either version
  10 * 2 of the License, or (at your option) any later version.
  11 */
  12
  13#include <linux/kernel.h>
  14#include <linux/init.h>
  15#include <linux/platform_device.h>
  16#include <linux/mtd/physmap.h>
  17#include <linux/spi/flash.h>
  18#include <linux/spi/spi.h>
  19#include <linux/spi/orion_spi.h>
  20#include <linux/i2c.h>
  21#include <linux/mv643xx_eth.h>
  22#include <linux/ata_platform.h>
  23#include <linux/gpio.h>
  24#include <linux/gpio_keys.h>
  25#include <linux/input.h>
  26#include <sound/alc5623.h>
  27#include <asm/mach-types.h>
  28#include <asm/mach/arch.h>
  29#include <mach/kirkwood.h>
  30#include "common.h"
  31#include "mpp.h"
  32
  33struct mtd_partition hp_t5325_partitions[] = {
  34        {
  35                .name           = "u-boot env",
  36                .size           = SZ_64K,
  37                .offset         = SZ_512K + SZ_256K,
  38        },
  39        {
  40                .name           = "permanent u-boot env",
  41                .size           = SZ_64K,
  42                .offset         = MTDPART_OFS_APPEND,
  43                .mask_flags     = MTD_WRITEABLE,
  44        },
  45        {
  46                .name           = "HP env",
  47                .size           = SZ_64K,
  48                .offset         = MTDPART_OFS_APPEND,
  49        },
  50        {
  51                .name           = "u-boot",
  52                .size           = SZ_512K,
  53                .offset         = 0,
  54                .mask_flags     = MTD_WRITEABLE,
  55        },
  56        {
  57                .name           = "SSD firmware",
  58                .size           = SZ_256K,
  59                .offset         = SZ_512K,
  60        },
  61};
  62
  63const struct flash_platform_data hp_t5325_flash = {
  64        .type           = "mx25l8005",
  65        .name           = "spi_flash",
  66        .parts          = hp_t5325_partitions,
  67        .nr_parts       = ARRAY_SIZE(hp_t5325_partitions),
  68};
  69
  70struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
  71        {
  72                .modalias       = "m25p80",
  73                .platform_data  = &hp_t5325_flash,
  74                .irq            = -1,
  75        },
  76};
  77
  78static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {
  79        .phy_addr       = MV643XX_ETH_PHY_ADDR(8),
  80};
  81
  82static struct mv_sata_platform_data hp_t5325_sata_data = {
  83        .n_ports        = 2,
  84};
  85
  86static struct gpio_keys_button hp_t5325_buttons[] = {
  87        {
  88                .code           = KEY_POWER,
  89                .gpio           = 45,
  90                .desc           = "Power",
  91                .active_low     = 1,
  92        },
  93};
  94
  95static struct gpio_keys_platform_data hp_t5325_button_data = {
  96        .buttons        = hp_t5325_buttons,
  97        .nbuttons       = ARRAY_SIZE(hp_t5325_buttons),
  98};
  99
 100static struct platform_device hp_t5325_button_device = {
 101        .name           = "gpio-keys",
 102        .id             = -1,
 103        .num_resources  = 0,
 104        .dev            = {
 105                .platform_data  = &hp_t5325_button_data,
 106        }
 107};
 108
 109static struct platform_device hp_t5325_audio_device = {
 110        .name           = "t5325-audio",
 111        .id             = -1,
 112};
 113
 114static unsigned int hp_t5325_mpp_config[] __initdata = {
 115        MPP0_NF_IO2,
 116        MPP1_SPI_MOSI,
 117        MPP2_SPI_SCK,
 118        MPP3_SPI_MISO,
 119        MPP4_NF_IO6,
 120        MPP5_NF_IO7,
 121        MPP6_SYSRST_OUTn,
 122        MPP7_SPI_SCn,
 123        MPP8_TW0_SDA,
 124        MPP9_TW0_SCK,
 125        MPP10_UART0_TXD,
 126        MPP11_UART0_RXD,
 127        MPP12_SD_CLK,
 128        MPP13_GPIO,
 129        MPP14_GPIO,
 130        MPP15_GPIO,
 131        MPP16_GPIO,
 132        MPP17_GPIO,
 133        MPP18_NF_IO0,
 134        MPP19_NF_IO1,
 135        MPP20_GPIO,
 136        MPP21_GPIO,
 137        MPP22_GPIO,
 138        MPP23_GPIO,
 139        MPP32_GPIO,
 140        MPP33_GE1_TXCTL,
 141        MPP39_AU_I2SBCLK,
 142        MPP40_AU_I2SDO,
 143        MPP43_AU_I2SDI,
 144        MPP41_AU_I2SLRCLK,
 145        MPP42_AU_I2SMCLK,
 146        MPP45_GPIO,             /* Power button */
 147        MPP48_GPIO,             /* Board power off */
 148        0
 149};
 150
 151static struct alc5623_platform_data alc5621_data = {
 152        .add_ctrl = 0x3700,
 153        .jack_det_ctrl = 0x4810,
 154};
 155
 156static struct i2c_board_info i2c_board_info[] __initdata = {
 157        {
 158                I2C_BOARD_INFO("alc5621", 0x1a),
 159                .platform_data = &alc5621_data,
 160        },
 161};
 162
 163#define HP_T5325_GPIO_POWER_OFF         48
 164
 165static void hp_t5325_power_off(void)
 166{
 167        gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);
 168}
 169
 170static void __init hp_t5325_init(void)
 171{
 172        /*
 173         * Basic setup. Needs to be called early.
 174         */
 175        kirkwood_init();
 176        kirkwood_mpp_conf(hp_t5325_mpp_config);
 177
 178        kirkwood_uart0_init();
 179        spi_register_board_info(hp_t5325_spi_slave_info,
 180                                ARRAY_SIZE(hp_t5325_spi_slave_info));
 181        kirkwood_spi_init();
 182        kirkwood_i2c_init();
 183        kirkwood_ge00_init(&hp_t5325_ge00_data);
 184        kirkwood_sata_init(&hp_t5325_sata_data);
 185        kirkwood_ehci_init();
 186        platform_device_register(&hp_t5325_button_device);
 187        platform_device_register(&hp_t5325_audio_device);
 188
 189        i2c_register_board_info(0, i2c_board_info, ARRAY_SIZE(i2c_board_info));
 190        kirkwood_audio_init();
 191
 192        if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
 193            gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
 194                pm_power_off = hp_t5325_power_off;
 195        else
 196                pr_err("t5325: failed to configure power-off GPIO\n");
 197}
 198
 199static int __init hp_t5325_pci_init(void)
 200{
 201        if (machine_is_t5325())
 202                kirkwood_pcie_init(KW_PCIE0);
 203
 204        return 0;
 205}
 206subsys_initcall(hp_t5325_pci_init);
 207
 208MACHINE_START(T5325, "HP t5325 Thin Client")
 209        /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
 210        .atag_offset    = 0x100,
 211        .init_machine   = hp_t5325_init,
 212        .map_io         = kirkwood_map_io,
 213        .init_early     = kirkwood_init_early,
 214        .init_irq       = kirkwood_init_irq,
 215        .timer          = &kirkwood_timer,
 216        .restart        = kirkwood_restart,
 217MACHINE_END
 218