2009-03-23 02:04:18 +01:00
|
|
|
/*
|
|
|
|
* arch/arm/mach-pxa/colibri-pxa320.c
|
|
|
|
*
|
|
|
|
* Support for Toradex PXA320/310 based Colibri module
|
|
|
|
*
|
|
|
|
* Daniel Mack <daniel@caiaq.de>
|
|
|
|
* Matthias Meier <matthias.j.meier@gmx.net>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/gpio.h>
|
2009-04-02 08:33:15 +02:00
|
|
|
#include <linux/interrupt.h>
|
2010-06-24 16:02:10 +02:00
|
|
|
#include <linux/usb/gpio_vbus.h>
|
2009-03-23 02:04:18 +01:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
|
|
|
#include <asm/sizes.h>
|
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
2011-05-18 15:19:04 +02:00
|
|
|
#include <mach/pxa320.h>
|
2009-03-23 02:04:18 +01:00
|
|
|
#include <mach/colibri.h>
|
2012-08-24 15:16:48 +02:00
|
|
|
#include <linux/platform_data/video-pxafb.h>
|
|
|
|
#include <linux/platform_data/usb-ohci-pxa27x.h>
|
2009-11-08 03:05:11 +01:00
|
|
|
#include <mach/audio.h>
|
2010-06-24 16:02:10 +02:00
|
|
|
#include <mach/pxa27x-udc.h>
|
|
|
|
#include <mach/udc.h>
|
2009-03-23 02:04:18 +01:00
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
#include "devices.h"
|
|
|
|
|
2010-08-12 01:45:05 +02:00
|
|
|
#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
|
2010-08-12 01:18:38 +02:00
|
|
|
static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {
|
|
|
|
/* MMC */
|
|
|
|
GPIO22_MMC1_CLK,
|
|
|
|
GPIO23_MMC1_CMD,
|
|
|
|
GPIO18_MMC1_DAT0,
|
|
|
|
GPIO19_MMC1_DAT1,
|
|
|
|
GPIO20_MMC1_DAT2,
|
|
|
|
GPIO21_MMC1_DAT3,
|
|
|
|
GPIO28_GPIO, /* SD detect */
|
|
|
|
|
|
|
|
/* UART 1 configuration (may be set by bootloader) */
|
|
|
|
GPIO99_UART1_CTS,
|
|
|
|
GPIO104_UART1_RTS,
|
|
|
|
GPIO97_UART1_RXD,
|
|
|
|
GPIO98_UART1_TXD,
|
|
|
|
GPIO101_UART1_DTR,
|
|
|
|
GPIO103_UART1_DSR,
|
|
|
|
GPIO100_UART1_DCD,
|
|
|
|
GPIO102_UART1_RI,
|
|
|
|
|
|
|
|
/* UART 2 configuration */
|
|
|
|
GPIO109_UART2_CTS,
|
|
|
|
GPIO112_UART2_RTS,
|
|
|
|
GPIO110_UART2_RXD,
|
|
|
|
GPIO111_UART2_TXD,
|
|
|
|
|
|
|
|
/* UART 3 configuration */
|
|
|
|
GPIO30_UART3_RXD,
|
|
|
|
GPIO31_UART3_TXD,
|
|
|
|
|
|
|
|
/* UHC */
|
|
|
|
GPIO2_2_USBH_PEN,
|
|
|
|
GPIO3_2_USBH_PWR,
|
2010-08-12 01:30:39 +02:00
|
|
|
|
|
|
|
/* I2C */
|
|
|
|
GPIO32_I2C_SCL,
|
|
|
|
GPIO33_I2C_SDA,
|
2010-08-11 05:04:53 +02:00
|
|
|
|
|
|
|
/* PCMCIA */
|
|
|
|
MFP_CFG(GPIO59, AF7), /* PRST ; AF7 to tristate */
|
|
|
|
MFP_CFG(GPIO61, AF7), /* PCE1 ; AF7 to tristate */
|
|
|
|
MFP_CFG(GPIO60, AF7), /* PCE2 ; AF7 to tristate */
|
|
|
|
MFP_CFG(GPIO62, AF7), /* PCD ; AF7 to tristate */
|
|
|
|
MFP_CFG(GPIO56, AF7), /* PSKTSEL ; AF7 to tristate */
|
|
|
|
GPIO27_GPIO, /* RDnWR ; input/tristate */
|
|
|
|
GPIO50_GPIO, /* PREG ; input/tristate */
|
|
|
|
GPIO2_RDY,
|
|
|
|
GPIO5_NPIOR,
|
|
|
|
GPIO6_NPIOW,
|
|
|
|
GPIO7_NPIOS16,
|
|
|
|
GPIO8_NPWAIT,
|
|
|
|
GPIO29_GPIO, /* PRDY (READY GPIO) */
|
|
|
|
GPIO57_GPIO, /* PPEN (POWER GPIO) */
|
|
|
|
GPIO81_GPIO, /* PCD (DETECT GPIO) */
|
|
|
|
GPIO77_GPIO, /* PRST (RESET GPIO) */
|
|
|
|
GPIO53_GPIO, /* PBVD1 */
|
|
|
|
GPIO79_GPIO, /* PBVD2 */
|
|
|
|
GPIO54_GPIO, /* POE */
|
2010-08-12 01:18:38 +02:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
static mfp_cfg_t colibri_pxa320_evalboard_pin_config[] __initdata = {};
|
|
|
|
#endif
|
|
|
|
|
2009-03-23 02:04:18 +01:00
|
|
|
#if defined(CONFIG_AX88796)
|
|
|
|
#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO36_GPIO)
|
|
|
|
/*
|
|
|
|
* Asix AX88796 Ethernet
|
|
|
|
*/
|
|
|
|
static struct ax_plat_data colibri_asix_platdata = {
|
2009-04-02 08:33:14 +02:00
|
|
|
.flags = 0, /* defined later */
|
|
|
|
.wordlength = 2,
|
2009-03-23 02:04:18 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource colibri_asix_resource[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = PXA3xx_CS2_PHYS,
|
|
|
|
.end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
|
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
2011-10-10 10:03:51 +02:00
|
|
|
.start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
|
|
|
|
.end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
|
2009-04-02 08:33:15 +02:00
|
|
|
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
|
2009-03-23 02:04:18 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device asix_device = {
|
|
|
|
.name = "ax88796",
|
|
|
|
.id = 0,
|
|
|
|
.num_resources = ARRAY_SIZE(colibri_asix_resource),
|
|
|
|
.resource = colibri_asix_resource,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &colibri_asix_platdata
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static mfp_cfg_t colibri_pxa320_eth_pin_config[] __initdata = {
|
|
|
|
GPIO3_nCS2, /* AX88796 chip select */
|
|
|
|
GPIO36_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init colibri_pxa320_init_eth(void)
|
|
|
|
{
|
2009-04-02 08:33:14 +02:00
|
|
|
colibri_pxa3xx_init_eth(&colibri_asix_platdata);
|
2009-03-23 02:04:18 +01:00
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_eth_pin_config));
|
|
|
|
platform_device_register(&asix_device);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void __init colibri_pxa320_init_eth(void) {}
|
|
|
|
#endif /* CONFIG_AX88796 */
|
|
|
|
|
2011-11-10 00:13:07 +01:00
|
|
|
#if defined(CONFIG_USB_PXA27X)||defined(CONFIG_USB_PXA27X_MODULE)
|
2010-06-24 16:02:10 +02:00
|
|
|
static struct gpio_vbus_mach_info colibri_pxa320_gpio_vbus_info = {
|
|
|
|
.gpio_vbus = mfp_to_gpio(MFP_PIN_GPIO96),
|
|
|
|
.gpio_pullup = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct platform_device colibri_pxa320_gpio_vbus = {
|
|
|
|
.name = "gpio-vbus",
|
|
|
|
.id = -1,
|
|
|
|
.dev = {
|
|
|
|
.platform_data = &colibri_pxa320_gpio_vbus_info,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
static void colibri_pxa320_udc_command(int cmd)
|
|
|
|
{
|
|
|
|
if (cmd == PXA2XX_UDC_CMD_CONNECT)
|
|
|
|
UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
|
|
|
|
else if (cmd == PXA2XX_UDC_CMD_DISCONNECT)
|
|
|
|
UP2OCR = UP2OCR_HXOE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct pxa2xx_udc_mach_info colibri_pxa320_udc_info __initdata = {
|
|
|
|
.udc_command = colibri_pxa320_udc_command,
|
|
|
|
.gpio_pullup = -1,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init colibri_pxa320_init_udc(void)
|
|
|
|
{
|
|
|
|
pxa_set_udc_info(&colibri_pxa320_udc_info);
|
|
|
|
platform_device_register(&colibri_pxa320_gpio_vbus);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void colibri_pxa320_init_udc(void) {}
|
|
|
|
#endif
|
|
|
|
|
2009-03-23 02:04:19 +01:00
|
|
|
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
|
|
|
static mfp_cfg_t colibri_pxa320_lcd_pin_config[] __initdata = {
|
|
|
|
GPIO6_2_LCD_LDD_0,
|
|
|
|
GPIO7_2_LCD_LDD_1,
|
|
|
|
GPIO8_2_LCD_LDD_2,
|
|
|
|
GPIO9_2_LCD_LDD_3,
|
|
|
|
GPIO10_2_LCD_LDD_4,
|
|
|
|
GPIO11_2_LCD_LDD_5,
|
|
|
|
GPIO12_2_LCD_LDD_6,
|
|
|
|
GPIO13_2_LCD_LDD_7,
|
|
|
|
GPIO63_LCD_LDD_8,
|
|
|
|
GPIO64_LCD_LDD_9,
|
|
|
|
GPIO65_LCD_LDD_10,
|
|
|
|
GPIO66_LCD_LDD_11,
|
|
|
|
GPIO67_LCD_LDD_12,
|
|
|
|
GPIO68_LCD_LDD_13,
|
|
|
|
GPIO69_LCD_LDD_14,
|
|
|
|
GPIO70_LCD_LDD_15,
|
|
|
|
GPIO71_LCD_LDD_16,
|
|
|
|
GPIO72_LCD_LDD_17,
|
|
|
|
GPIO73_LCD_CS_N,
|
|
|
|
GPIO74_LCD_VSYNC,
|
|
|
|
GPIO14_2_LCD_FCLK,
|
|
|
|
GPIO15_2_LCD_LCLK,
|
|
|
|
GPIO16_2_LCD_PCLK,
|
|
|
|
GPIO17_2_LCD_BIAS,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init colibri_pxa320_init_lcd(void)
|
|
|
|
{
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_lcd_pin_config));
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void colibri_pxa320_init_lcd(void) {}
|
|
|
|
#endif
|
|
|
|
|
2009-11-08 03:05:11 +01:00
|
|
|
#if defined(CONFIG_SND_AC97_CODEC) || \
|
|
|
|
defined(CONFIG_SND_AC97_CODEC_MODULE)
|
2009-03-23 02:04:20 +01:00
|
|
|
static mfp_cfg_t colibri_pxa320_ac97_pin_config[] __initdata = {
|
|
|
|
GPIO34_AC97_SYSCLK,
|
|
|
|
GPIO35_AC97_SDATA_IN_0,
|
|
|
|
GPIO37_AC97_SDATA_OUT,
|
|
|
|
GPIO38_AC97_SYNC,
|
|
|
|
GPIO39_AC97_BITCLK,
|
|
|
|
GPIO40_AC97_nACRESET
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void __init colibri_pxa320_init_ac97(void)
|
|
|
|
{
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_ac97_pin_config));
|
|
|
|
pxa_set_ac97_info(NULL);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void colibri_pxa320_init_ac97(void) {}
|
|
|
|
#endif
|
|
|
|
|
2009-03-23 02:04:18 +01:00
|
|
|
void __init colibri_pxa320_init(void)
|
|
|
|
{
|
|
|
|
colibri_pxa320_init_eth();
|
2009-06-17 10:32:54 +02:00
|
|
|
colibri_pxa3xx_init_nand();
|
2009-03-23 02:04:19 +01:00
|
|
|
colibri_pxa320_init_lcd();
|
2009-03-27 22:00:09 +01:00
|
|
|
colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO49_GPIO));
|
2009-03-23 02:04:20 +01:00
|
|
|
colibri_pxa320_init_ac97();
|
2010-06-24 16:02:10 +02:00
|
|
|
colibri_pxa320_init_udc();
|
2010-08-12 01:18:38 +02:00
|
|
|
|
|
|
|
/* Evalboard init */
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa320_evalboard_pin_config));
|
2010-08-12 01:45:05 +02:00
|
|
|
colibri_evalboard_init();
|
2009-03-23 02:04:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(COLIBRI320, "Toradex Colibri PXA320")
|
2011-07-06 04:38:15 +02:00
|
|
|
.atag_offset = 0x100,
|
2009-03-23 02:04:18 +01:00
|
|
|
.init_machine = colibri_pxa320_init,
|
2010-10-11 02:20:19 +02:00
|
|
|
.map_io = pxa3xx_map_io,
|
2012-01-03 23:53:48 +01:00
|
|
|
.nr_irqs = PXA_NR_IRQS,
|
2009-03-23 02:04:18 +01:00
|
|
|
.init_irq = pxa3xx_init_irq,
|
2011-05-18 15:30:04 +02:00
|
|
|
.handle_irq = pxa3xx_handle_irq,
|
2012-11-08 20:40:59 +01:00
|
|
|
.init_time = pxa_timer_init,
|
2011-11-04 15:15:53 +01:00
|
|
|
.restart = pxa_restart,
|
2009-03-23 02:04:18 +01:00
|
|
|
MACHINE_END
|
|
|
|
|