linux/arch/arm/mach-pxa/colibri-pxa320.c
<<
>>
Prefs
   1/*
   2 *  arch/arm/mach-pxa/colibri-pxa320.c
   3 *
   4 *  Support for Toradex PXA320/310 based Colibri module
   5 *
   6 *  Daniel Mack <daniel@caiaq.de>
   7 *  Matthias Meier <matthias.j.meier@gmx.net>
   8 *
   9 *  This program is free software; you can redistribute it and/or modify
  10 *  it under the terms of the GNU General Public License version 2 as
  11 *  published by the Free Software Foundation.
  12 */
  13
  14#include <linux/init.h>
  15#include <linux/kernel.h>
  16#include <linux/platform_device.h>
  17#include <linux/gpio.h>
  18#include <linux/interrupt.h>
  19
  20#include <asm/mach-types.h>
  21#include <asm/sizes.h>
  22#include <asm/mach/arch.h>
  23#include <asm/mach/irq.h>
  24
  25#include <mach/pxa3xx-regs.h>
  26#include <mach/mfp-pxa320.h>
  27#include <mach/colibri.h>
  28#include <mach/pxafb.h>
  29#include <mach/ohci.h>
  30#include <mach/audio.h>
  31
  32#include "generic.h"
  33#include "devices.h"
  34
  35#if defined(CONFIG_AX88796)
  36#define COLIBRI_ETH_IRQ_GPIO    mfp_to_gpio(GPIO36_GPIO)
  37
  38/*
  39 * Asix AX88796 Ethernet
  40 */
  41static struct ax_plat_data colibri_asix_platdata = {
  42        .flags          = 0, /* defined later */
  43        .wordlength     = 2,
  44};
  45
  46static struct resource colibri_asix_resource[] = {
  47        [0] = {
  48                .start = PXA3xx_CS2_PHYS,
  49                .end   = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
  50                .flags = IORESOURCE_MEM,
  51        },
  52        [1] = {
  53                .start = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  54                .end   = gpio_to_irq(COLIBRI_ETH_IRQ_GPIO),
  55                .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
  56        }
  57};
  58
  59static struct platform_device asix_device = {
  60        .name           = "ax88796",
  61        .id             = 0,
  62        .num_resources  = ARRAY_SIZE(colibri_asix_resource),
  63        .resource       = colibri_asix_resource,
  64        .dev            = {
  65                .platform_data = &colibri_asix_platdata
  66        }
  67};
  68
  69static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
  70        GPIO3_nCS2,                     /* AX88796 chip select */
  71        GPIO36_GPIO | MFP_PULL_HIGH     /* AX88796 IRQ */
  72};
  73
  74static void __init colibri_pxa320_init_eth(void)
  75{
  76        colibri_pxa3xx_init_eth(&colibri_asix_platdata);
  77        pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
  78        platform_device_register(&asix_device);
  79}
  80#else
  81static inline void __init colibri_pxa320_init_eth(void) {}
  82#endif /* CONFIG_AX88796 */
  83
  84#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  85static mfp_cfg_t colibri_pxa320_usb_pin_config[] __initdata = {
  86        GPIO2_2_USBH_PEN,
  87        GPIO3_2_USBH_PWR,
  88};
  89
  90static struct pxaohci_platform_data colibri_pxa320_ohci_info = {
  91        .port_mode      = PMM_GLOBAL_MODE,
  92        .flags          = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  93};
  94
  95void __init colibri_pxa320_init_ohci(void)
  96{
  97        pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_usb_pin_config));
  98        pxa_set_ohci_info(&colibri_pxa320_ohci_info);
  99}
 100#else
 101static inline void colibri_pxa320_init_ohci(void) {}
 102#endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
 103
 104static mfp_cfg_t colibri_pxa320_mmc_pin_config[] __initdata = {
 105        GPIO22_MMC1_CLK,
 106        GPIO23_MMC1_CMD,
 107        GPIO18_MMC1_DAT0,
 108        GPIO19_MMC1_DAT1,
 109        GPIO20_MMC1_DAT2,
 110        GPIO21_MMC1_DAT3
 111};
 112
 113#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
 114static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
 115        GPIO6_2_LCD_LDD_0,
 116        GPIO7_2_LCD_LDD_1,
 117        GPIO8_2_LCD_LDD_2,
 118        GPIO9_2_LCD_LDD_3,
 119        GPIO10_2_LCD_LDD_4,
 120        GPIO11_2_LCD_LDD_5,
 121        GPIO12_2_LCD_LDD_6,
 122        GPIO13_2_LCD_LDD_7,
 123        GPIO63_LCD_LDD_8,
 124        GPIO64_LCD_LDD_9,
 125        GPIO65_LCD_LDD_10,
 126        GPIO66_LCD_LDD_11,
 127        GPIO67_LCD_LDD_12,
 128        GPIO68_LCD_LDD_13,
 129        GPIO69_LCD_LDD_14,
 130        GPIO70_LCD_LDD_15,
 131        GPIO71_LCD_LDD_16,
 132        GPIO72_LCD_LDD_17,
 133        GPIO73_LCD_CS_N,
 134        GPIO74_LCD_VSYNC,
 135        GPIO14_2_LCD_FCLK,
 136        GPIO15_2_LCD_LCLK,
 137        GPIO16_2_LCD_PCLK,
 138        GPIO17_2_LCD_BIAS,
 139};
 140
 141static void __init colibri_pxa320_init_lcd(void)
 142{
 143        pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
 144}
 145#else
 146static inline void colibri_pxa320_init_lcd(void) {}
 147#endif
 148
 149#if     defined(CONFIG_SND_AC97_CODEC) || \
 150        defined(CONFIG_SND_AC97_CODEC_MODULE)
 151static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
 152        GPIO34_AC97_SYSCLK,
 153        GPIO35_AC97_SDATA_IN_0,
 154        GPIO37_AC97_SDATA_OUT,
 155        GPIO38_AC97_SYNC,
 156        GPIO39_AC97_BITCLK,
 157        GPIO40_AC97_nACRESET
 158};
 159
 160static inline void __init colibri_pxa320_init_ac97(void)
 161{
 162        pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
 163        pxa_set_ac97_info(NULL);
 164}
 165#else
 166static inline void colibri_pxa320_init_ac97(void) {}
 167#endif
 168
 169/*
 170 * The following configuration is verified to work with the Toradex Orchid
 171 * carrier board
 172 */
 173static mfp_cfg_t colibri_pxa320_uart_pin_config[] __initdata = {
 174        /* UART 1 configuration (may be set by bootloader) */
 175        GPIO99_UART1_CTS,
 176        GPIO104_UART1_RTS,
 177        GPIO97_UART1_RXD,
 178        GPIO98_UART1_TXD,
 179        GPIO101_UART1_DTR,
 180        GPIO103_UART1_DSR,
 181        GPIO100_UART1_DCD,
 182        GPIO102_UART1_RI,
 183
 184        /* UART 2 configuration */
 185        GPIO109_UART2_CTS,
 186        GPIO112_UART2_RTS,
 187        GPIO110_UART2_RXD,
 188        GPIO111_UART2_TXD,
 189
 190        /* UART 3 configuration */
 191        GPIO30_UART3_RXD,
 192        GPIO31_UART3_TXD,
 193};
 194
 195static void __init colibri_pxa320_init_uart(void)
 196{
 197        pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_uart_pin_config));
 198}
 199
 200void __init colibri_pxa320_init(void)
 201{
 202        colibri_pxa320_init_eth();
 203        colibri_pxa320_init_ohci();
 204        colibri_pxa3xx_init_nand();
 205        colibri_pxa320_init_lcd();
 206        colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
 207        colibri_pxa320_init_ac97();
 208        colibri_pxa3xx_init_mmc(ARRAY_AND_SIZE(colibri_pxa320_mmc_pin_config),
 209                                mfp_to_gpio(MFP_PIN_GPIO28));
 210        colibri_pxa320_init_uart();
 211}
 212
 213MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
 214        .phys_io        = 0x40000000,
 215        .io_pg_offst    = (io_p2v(0x40000000) >> 18) & 0xfffc,
 216        .boot_params    = COLIBRI_SDRAM_BASE + 0x100,
 217        .init_machine   = colibri_pxa320_init,
 218        .map_io         = pxa_map_io,
 219        .init_irq       = pxa3xx_init_irq,
 220        .timer          = &pxa_timer,
 221MACHINE_END
 222
 223