linux/arch/arm/mach-pxa/littleton.c
<<
>>
Prefs
   1/*
   2 *  linux/arch/arm/mach-pxa/littleton.c
   3 *
   4 *  Support for the Marvell Littleton Development Platform.
   5 *
   6 *  Author:     Jason Chagas (largely modified code)
   7 *  Created:    Nov 20, 2006
   8 *  Copyright:  (C) Copyright 2006 Marvell International Ltd.
   9 *
  10 *  2007-11-22  modified to align with latest kernel
  11 *              eric miao <eric.miao@marvell.com>
  12 *
  13 *  This program is free software; you can redistribute it and/or modify
  14 *  it under the terms of the GNU General Public License version 2 as
  15 *  publishhed by the Free Software Foundation.
  16 */
  17
  18#include <linux/init.h>
  19#include <linux/interrupt.h>
  20#include <linux/delay.h>
  21#include <linux/platform_device.h>
  22#include <linux/clk.h>
  23#include <linux/gpio.h>
  24#include <linux/spi/spi.h>
  25#include <linux/spi/pxa2xx_spi.h>
  26#include <linux/smc91x.h>
  27#include <linux/i2c.h>
  28#include <linux/leds.h>
  29#include <linux/mfd/da903x.h>
  30#include <linux/platform_data/max732x.h>
  31#include <linux/platform_data/i2c-pxa.h>
  32
  33#include <asm/types.h>
  34#include <asm/setup.h>
  35#include <asm/memory.h>
  36#include <asm/mach-types.h>
  37#include <mach/hardware.h>
  38#include <asm/irq.h>
  39
  40#include <asm/mach/arch.h>
  41#include <asm/mach/map.h>
  42#include <asm/mach/irq.h>
  43
  44#include "pxa300.h"
  45#include "devices.h"
  46#include <linux/platform_data/video-pxafb.h>
  47#include <linux/platform_data/mmc-pxamci.h>
  48#include <linux/platform_data/keypad-pxa27x.h>
  49#include "littleton.h"
  50#include <linux/platform_data/mtd-nand-pxa3xx.h>
  51
  52#include "generic.h"
  53
  54#define GPIO_MMC1_CARD_DETECT   mfp_to_gpio(MFP_PIN_GPIO15)
  55
  56/* Littleton MFP configurations */
  57static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
  58        /* LCD */
  59        GPIO54_LCD_LDD_0,
  60        GPIO55_LCD_LDD_1,
  61        GPIO56_LCD_LDD_2,
  62        GPIO57_LCD_LDD_3,
  63        GPIO58_LCD_LDD_4,
  64        GPIO59_LCD_LDD_5,
  65        GPIO60_LCD_LDD_6,
  66        GPIO61_LCD_LDD_7,
  67        GPIO62_LCD_LDD_8,
  68        GPIO63_LCD_LDD_9,
  69        GPIO64_LCD_LDD_10,
  70        GPIO65_LCD_LDD_11,
  71        GPIO66_LCD_LDD_12,
  72        GPIO67_LCD_LDD_13,
  73        GPIO68_LCD_LDD_14,
  74        GPIO69_LCD_LDD_15,
  75        GPIO70_LCD_LDD_16,
  76        GPIO71_LCD_LDD_17,
  77        GPIO72_LCD_FCLK,
  78        GPIO73_LCD_LCLK,
  79        GPIO74_LCD_PCLK,
  80        GPIO75_LCD_BIAS,
  81
  82        /* SSP2 */
  83        GPIO25_SSP2_SCLK,
  84        GPIO27_SSP2_TXD,
  85        GPIO17_GPIO,    /* SFRM as chip-select */
  86
  87        /* Debug Ethernet */
  88        GPIO90_GPIO,
  89
  90        /* Keypad */
  91        GPIO107_KP_DKIN_0,
  92        GPIO108_KP_DKIN_1,
  93        GPIO115_KP_MKIN_0,
  94        GPIO116_KP_MKIN_1,
  95        GPIO117_KP_MKIN_2,
  96        GPIO118_KP_MKIN_3,
  97        GPIO119_KP_MKIN_4,
  98        GPIO120_KP_MKIN_5,
  99        GPIO121_KP_MKOUT_0,
 100        GPIO122_KP_MKOUT_1,
 101        GPIO123_KP_MKOUT_2,
 102        GPIO124_KP_MKOUT_3,
 103        GPIO125_KP_MKOUT_4,
 104
 105        /* MMC1 */
 106        GPIO3_MMC1_DAT0,
 107        GPIO4_MMC1_DAT1,
 108        GPIO5_MMC1_DAT2,
 109        GPIO6_MMC1_DAT3,
 110        GPIO7_MMC1_CLK,
 111        GPIO8_MMC1_CMD,
 112        GPIO15_GPIO, /* card detect */
 113
 114        /* UART3 */
 115        GPIO107_UART3_CTS,
 116        GPIO108_UART3_RTS,
 117        GPIO109_UART3_TXD,
 118        GPIO110_UART3_RXD,
 119};
 120
 121static struct resource smc91x_resources[] = {
 122        [0] = {
 123                .start  = (LITTLETON_ETH_PHYS + 0x300),
 124                .end    = (LITTLETON_ETH_PHYS + 0xfffff),
 125                .flags  = IORESOURCE_MEM,
 126        },
 127        [1] = {
 128                .start  = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
 129                .end    = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
 130                .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
 131        }
 132};
 133
 134static struct smc91x_platdata littleton_smc91x_info = {
 135        .flags  = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
 136                  SMC91X_NOWAIT | SMC91X_USE_DMA,
 137};
 138
 139static struct platform_device smc91x_device = {
 140        .name           = "smc91x",
 141        .id             = 0,
 142        .num_resources  = ARRAY_SIZE(smc91x_resources),
 143        .resource       = smc91x_resources,
 144        .dev            = {
 145                .platform_data = &littleton_smc91x_info,
 146        },
 147};
 148
 149#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 150static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
 151        [0] = {
 152                /* VGA */
 153                .pixclock       = 38250,
 154                .xres           = 480,
 155                .yres           = 640,
 156                .bpp            = 16,
 157                .hsync_len      = 8,
 158                .left_margin    = 8,
 159                .right_margin   = 24,
 160                .vsync_len      = 2,
 161                .upper_margin   = 2,
 162                .lower_margin   = 4,
 163                .sync           = 0,
 164        },
 165        [1] = {
 166                /* QVGA */
 167                .pixclock       = 153000,
 168                .xres           = 240,
 169                .yres           = 320,
 170                .bpp            = 16,
 171                .hsync_len      = 8,
 172                .left_margin    = 8,
 173                .right_margin   = 88,
 174                .vsync_len      = 2,
 175                .upper_margin   = 2,
 176                .lower_margin   = 2,
 177                .sync           = 0,
 178        },
 179};
 180
 181static struct pxafb_mach_info littleton_lcd_info = {
 182        .modes                  = tpo_tdo24mtea1_modes,
 183        .num_modes              = 2,
 184        .lcd_conn               = LCD_COLOR_TFT_16BPP,
 185};
 186
 187static void littleton_init_lcd(void)
 188{
 189        pxa_set_fb_info(NULL, &littleton_lcd_info);
 190}
 191#else
 192static inline void littleton_init_lcd(void) {};
 193#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
 194
 195#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
 196static struct pxa2xx_spi_master littleton_spi_info = {
 197        .num_chipselect         = 1,
 198};
 199
 200static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
 201        .rx_threshold   = 1,
 202        .tx_threshold   = 1,
 203        .gpio_cs        = LITTLETON_GPIO_LCD_CS,
 204};
 205
 206static struct spi_board_info littleton_spi_devices[] __initdata = {
 207        {
 208                .modalias       = "tdo24m",
 209                .max_speed_hz   = 1000000,
 210                .bus_num        = 2,
 211                .chip_select    = 0,
 212                .controller_data= &littleton_tdo24m_chip,
 213        },
 214};
 215
 216static void __init littleton_init_spi(void)
 217{
 218        pxa2xx_set_spi_info(2, &littleton_spi_info);
 219        spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
 220}
 221#else
 222static inline void littleton_init_spi(void) {}
 223#endif
 224
 225#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
 226static const unsigned int littleton_matrix_key_map[] = {
 227        /* KEY(row, col, key_code) */
 228        KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
 229        KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
 230        KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
 231
 232        KEY(0, 3, KEY_KPASTERISK),      /* * */
 233        KEY(2, 3, KEY_KPDOT),           /* # */
 234
 235        KEY(5, 4, KEY_ENTER),
 236
 237        KEY(5, 0, KEY_UP),
 238        KEY(5, 1, KEY_DOWN),
 239        KEY(5, 2, KEY_LEFT),
 240        KEY(5, 3, KEY_RIGHT),
 241        KEY(3, 2, KEY_HOME),
 242        KEY(4, 1, KEY_END),
 243        KEY(3, 3, KEY_BACK),
 244
 245        KEY(4, 0, KEY_SEND),
 246        KEY(4, 2, KEY_VOLUMEUP),
 247        KEY(4, 3, KEY_VOLUMEDOWN),
 248
 249        KEY(3, 0, KEY_F22),     /* soft1 */
 250        KEY(3, 1, KEY_F23),     /* soft2 */
 251};
 252
 253static struct matrix_keymap_data littleton_matrix_keymap_data = {
 254        .keymap                 = littleton_matrix_key_map,
 255        .keymap_size            = ARRAY_SIZE(littleton_matrix_key_map),
 256};
 257
 258static struct pxa27x_keypad_platform_data littleton_keypad_info = {
 259        .matrix_key_rows        = 6,
 260        .matrix_key_cols        = 5,
 261        .matrix_keymap_data     = &littleton_matrix_keymap_data,
 262
 263        .enable_rotary0         = 1,
 264        .rotary0_up_key         = KEY_UP,
 265        .rotary0_down_key       = KEY_DOWN,
 266
 267        .debounce_interval      = 30,
 268};
 269static void __init littleton_init_keypad(void)
 270{
 271        pxa_set_keypad_info(&littleton_keypad_info);
 272}
 273#else
 274static inline void littleton_init_keypad(void) {}
 275#endif
 276
 277#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
 278static struct pxamci_platform_data littleton_mci_platform_data = {
 279        .detect_delay_ms        = 200,
 280        .ocr_mask               = MMC_VDD_32_33 | MMC_VDD_33_34,
 281        .gpio_card_detect       = GPIO_MMC1_CARD_DETECT,
 282        .gpio_card_ro           = -1,
 283        .gpio_power             = -1,
 284};
 285
 286static void __init littleton_init_mmc(void)
 287{
 288        pxa_set_mci_info(&littleton_mci_platform_data);
 289}
 290#else
 291static inline void littleton_init_mmc(void) {}
 292#endif
 293
 294#if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
 295static struct mtd_partition littleton_nand_partitions[] = {
 296        [0] = {
 297                .name        = "Bootloader",
 298                .offset      = 0,
 299                .size        = 0x060000,
 300                .mask_flags  = MTD_WRITEABLE, /* force read-only */
 301        },
 302        [1] = {
 303                .name        = "Kernel",
 304                .offset      = 0x060000,
 305                .size        = 0x200000,
 306                .mask_flags  = MTD_WRITEABLE, /* force read-only */
 307        },
 308        [2] = {
 309                .name        = "Filesystem",
 310                .offset      = 0x0260000,
 311                .size        = 0x3000000,     /* 48M - rootfs */
 312        },
 313        [3] = {
 314                .name        = "MassStorage",
 315                .offset      = 0x3260000,
 316                .size        = 0x3d40000,
 317        },
 318        [4] = {
 319                .name        = "BBT",
 320                .offset      = 0x6FA0000,
 321                .size        = 0x80000,
 322                .mask_flags  = MTD_WRITEABLE,  /* force read-only */
 323        },
 324        /* NOTE: we reserve some blocks at the end of the NAND flash for
 325         * bad block management, and the max number of relocation blocks
 326         * differs on different platforms. Please take care with it when
 327         * defining the partition table.
 328         */
 329};
 330
 331static struct pxa3xx_nand_platform_data littleton_nand_info = {
 332        .parts          = littleton_nand_partitions,
 333        .nr_parts       = ARRAY_SIZE(littleton_nand_partitions),
 334};
 335
 336static void __init littleton_init_nand(void)
 337{
 338        pxa3xx_set_nand_info(&littleton_nand_info);
 339}
 340#else
 341static inline void littleton_init_nand(void) {}
 342#endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
 343
 344#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
 345static struct led_info littleton_da9034_leds[] = {
 346        [0] = {
 347                .name   = "littleton:keypad1",
 348                .flags  = DA9034_LED_RAMP,
 349        },
 350        [1] = {
 351                .name   = "littleton:keypad2",
 352                .flags  = DA9034_LED_RAMP,
 353        },
 354        [2] = {
 355                .name   = "littleton:vibra",
 356                .flags  = 0,
 357        },
 358};
 359
 360static struct da9034_touch_pdata littleton_da9034_touch = {
 361        .x_inverted     = 1,
 362        .interval_ms    = 20,
 363};
 364
 365static struct da903x_subdev_info littleton_da9034_subdevs[] = {
 366        {
 367                .name           = "da903x-led",
 368                .id             = DA9034_ID_LED_1,
 369                .platform_data  = &littleton_da9034_leds[0],
 370        }, {
 371                .name           = "da903x-led",
 372                .id             = DA9034_ID_LED_2,
 373                .platform_data  = &littleton_da9034_leds[1],
 374        }, {
 375                .name           = "da903x-led",
 376                .id             = DA9034_ID_VIBRA,
 377                .platform_data  = &littleton_da9034_leds[2],
 378        }, {
 379                .name           = "da903x-backlight",
 380                .id             = DA9034_ID_WLED,
 381        }, {
 382                .name           = "da9034-touch",
 383                .id             = DA9034_ID_TOUCH,
 384                .platform_data  = &littleton_da9034_touch,
 385        },
 386};
 387
 388static struct da903x_platform_data littleton_da9034_info = {
 389        .num_subdevs    = ARRAY_SIZE(littleton_da9034_subdevs),
 390        .subdevs        = littleton_da9034_subdevs,
 391};
 392
 393static struct max732x_platform_data littleton_max7320_info = {
 394        .gpio_base      = EXT0_GPIO_BASE,
 395};
 396
 397static struct i2c_board_info littleton_i2c_info[] = {
 398        [0] = {
 399                .type           = "da9034",
 400                .addr           = 0x34,
 401                .platform_data  = &littleton_da9034_info,
 402                .irq            = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
 403        },
 404        [1] = {
 405                .type           = "max7320",
 406                .addr           = 0x50,
 407                .platform_data  = &littleton_max7320_info,
 408        },
 409};
 410
 411static void __init littleton_init_i2c(void)
 412{
 413        pxa_set_i2c_info(NULL);
 414        i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
 415}
 416#else
 417static inline void littleton_init_i2c(void) {}
 418#endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
 419
 420static void __init littleton_init(void)
 421{
 422        /* initialize MFP configurations */
 423        pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
 424
 425        pxa_set_ffuart_info(NULL);
 426        pxa_set_btuart_info(NULL);
 427        pxa_set_stuart_info(NULL);
 428
 429        /*
 430         * Note: we depend bootloader set the correct
 431         * value to MSC register for SMC91x.
 432         */
 433        platform_device_register(&smc91x_device);
 434
 435        littleton_init_spi();
 436        littleton_init_i2c();
 437        littleton_init_mmc();
 438        littleton_init_lcd();
 439        littleton_init_keypad();
 440        littleton_init_nand();
 441}
 442
 443MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
 444        .atag_offset    = 0x100,
 445        .map_io         = pxa3xx_map_io,
 446        .nr_irqs        = LITTLETON_NR_IRQS,
 447        .init_irq       = pxa3xx_init_irq,
 448        .handle_irq     = pxa3xx_handle_irq,
 449        .init_time      = pxa_timer_init,
 450        .init_machine   = littleton_init,
 451        .restart        = pxa_restart,
 452MACHINE_END
 453