2019-06-04 16:11:33 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2009-03-13 23:37:09 +08:00
|
|
|
/*
|
|
|
|
* arch/arm/mach-pxa/colibri-pxa300.c
|
|
|
|
*
|
2009-03-23 09:04:17 +08:00
|
|
|
* Support for Toradex PXA300/310 based Colibri module
|
|
|
|
*
|
2009-03-13 23:37:09 +08:00
|
|
|
* Daniel Mack <daniel@caiaq.de>
|
2009-03-23 09:04:17 +08:00
|
|
|
* Matthias Meier <matthias.j.meier@gmx.net>
|
2009-03-13 23:37:09 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/gpio.h>
|
2009-04-02 14:33:15 +08:00
|
|
|
#include <linux/interrupt.h>
|
2019-09-02 04:26:10 +08:00
|
|
|
#include <linux/soc/pxa/cpu.h>
|
2009-03-13 23:37:09 +08:00
|
|
|
|
|
|
|
#include <asm/mach-types.h>
|
2019-05-15 06:46:51 +08:00
|
|
|
#include <linux/sizes.h>
|
2009-03-13 23:37:09 +08:00
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
2015-01-30 17:45:33 +08:00
|
|
|
#include "pxa300.h"
|
|
|
|
#include "colibri.h"
|
2012-08-24 21:16:48 +08:00
|
|
|
#include <linux/platform_data/usb-ohci-pxa27x.h>
|
|
|
|
#include <linux/platform_data/video-pxafb.h>
|
2019-09-02 06:02:08 +08:00
|
|
|
#include <linux/platform_data/asoc-pxa.h>
|
2009-03-13 23:37:09 +08:00
|
|
|
|
|
|
|
#include "generic.h"
|
|
|
|
#include "devices.h"
|
|
|
|
|
2010-08-12 07:18:38 +08:00
|
|
|
|
2010-08-12 07:45:05 +08:00
|
|
|
#ifdef CONFIG_MACH_COLIBRI_EVALBOARD
|
2010-08-12 07:18:38 +08:00
|
|
|
static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
|
|
|
|
/* MMC */
|
|
|
|
GPIO7_MMC1_CLK,
|
|
|
|
GPIO14_MMC1_CMD,
|
|
|
|
GPIO3_MMC1_DAT0,
|
|
|
|
GPIO4_MMC1_DAT1,
|
|
|
|
GPIO5_MMC1_DAT2,
|
|
|
|
GPIO6_MMC1_DAT3,
|
2010-12-23 23:01:02 +08:00
|
|
|
GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
|
2010-08-12 07:18:38 +08:00
|
|
|
|
|
|
|
/* UHC */
|
|
|
|
GPIO0_2_USBH_PEN,
|
|
|
|
GPIO1_2_USBH_PWR,
|
2010-11-03 07:46:04 +08:00
|
|
|
GPIO77_USB_P3_1,
|
|
|
|
GPIO78_USB_P3_2,
|
|
|
|
GPIO79_USB_P3_3,
|
|
|
|
GPIO80_USB_P3_4,
|
|
|
|
GPIO81_USB_P3_5,
|
|
|
|
GPIO82_USB_P3_6,
|
2010-08-12 07:30:39 +08:00
|
|
|
|
|
|
|
/* I2C */
|
|
|
|
GPIO21_I2C_SCL,
|
|
|
|
GPIO22_I2C_SDA,
|
2010-08-12 07:18:38 +08:00
|
|
|
};
|
|
|
|
#else
|
|
|
|
static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
|
|
|
|
#endif
|
|
|
|
|
2009-03-13 23:37:09 +08:00
|
|
|
#if defined(CONFIG_AX88796)
|
2009-03-23 09:04:17 +08:00
|
|
|
#define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
|
2009-03-13 23:37:09 +08:00
|
|
|
/*
|
|
|
|
* Asix AX88796 Ethernet
|
|
|
|
*/
|
|
|
|
static struct ax_plat_data colibri_asix_platdata = {
|
2009-04-02 14:33:14 +08:00
|
|
|
.flags = 0, /* defined later */
|
|
|
|
.wordlength = 2,
|
2009-03-13 23:37:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct resource colibri_asix_resource[] = {
|
|
|
|
[0] = {
|
|
|
|
.start = PXA3xx_CS2_PHYS,
|
2009-03-23 09:04:16 +08:00
|
|
|
.end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
|
2009-03-13 23:37:09 +08:00
|
|
|
.flags = IORESOURCE_MEM,
|
|
|
|
},
|
|
|
|
[1] = {
|
2011-10-10 16:03:51 +08:00
|
|
|
.start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
|
|
|
|
.end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
|
2009-04-02 14:33:15 +08:00
|
|
|
.flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
|
2009-03-13 23:37:09 +08: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
|
|
|
|
}
|
|
|
|
};
|
2009-03-13 23:37:10 +08:00
|
|
|
|
2009-03-23 09:04:17 +08:00
|
|
|
static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
|
|
|
|
GPIO1_nCS2, /* AX88796 chip select */
|
|
|
|
GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
|
2009-03-13 23:37:10 +08:00
|
|
|
};
|
|
|
|
|
2009-03-23 09:04:17 +08:00
|
|
|
static void __init colibri_pxa300_init_eth(void)
|
2009-03-13 23:37:10 +08:00
|
|
|
{
|
2009-04-02 14:33:14 +08:00
|
|
|
colibri_pxa3xx_init_eth(&colibri_asix_platdata);
|
2009-03-23 09:04:17 +08:00
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
|
|
|
|
platform_device_register(&asix_device);
|
2009-03-13 23:37:10 +08:00
|
|
|
}
|
|
|
|
#else
|
2009-03-23 09:04:17 +08:00
|
|
|
static inline void __init colibri_pxa300_init_eth(void) {}
|
|
|
|
#endif /* CONFIG_AX88796 */
|
2009-03-13 23:37:10 +08:00
|
|
|
|
2009-03-23 09:04:19 +08:00
|
|
|
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
|
|
|
|
static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
|
|
|
|
GPIO54_LCD_LDD_0,
|
|
|
|
GPIO55_LCD_LDD_1,
|
|
|
|
GPIO56_LCD_LDD_2,
|
|
|
|
GPIO57_LCD_LDD_3,
|
|
|
|
GPIO58_LCD_LDD_4,
|
|
|
|
GPIO59_LCD_LDD_5,
|
|
|
|
GPIO60_LCD_LDD_6,
|
|
|
|
GPIO61_LCD_LDD_7,
|
|
|
|
GPIO62_LCD_LDD_8,
|
|
|
|
GPIO63_LCD_LDD_9,
|
|
|
|
GPIO64_LCD_LDD_10,
|
|
|
|
GPIO65_LCD_LDD_11,
|
|
|
|
GPIO66_LCD_LDD_12,
|
|
|
|
GPIO67_LCD_LDD_13,
|
|
|
|
GPIO68_LCD_LDD_14,
|
|
|
|
GPIO69_LCD_LDD_15,
|
|
|
|
GPIO70_LCD_LDD_16,
|
|
|
|
GPIO71_LCD_LDD_17,
|
|
|
|
GPIO62_LCD_CS_N,
|
|
|
|
GPIO72_LCD_FCLK,
|
|
|
|
GPIO73_LCD_LCLK,
|
|
|
|
GPIO74_LCD_PCLK,
|
|
|
|
GPIO75_LCD_BIAS,
|
|
|
|
GPIO76_LCD_VSYNC,
|
|
|
|
};
|
|
|
|
|
|
|
|
static void __init colibri_pxa300_init_lcd(void)
|
|
|
|
{
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline void colibri_pxa300_init_lcd(void) {}
|
|
|
|
#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
|
|
|
|
|
2010-07-09 01:04:05 +08:00
|
|
|
#if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
|
2009-03-23 09:04:20 +08:00
|
|
|
static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
|
|
|
|
GPIO24_AC97_SYSCLK,
|
|
|
|
GPIO23_AC97_nACRESET,
|
|
|
|
GPIO25_AC97_SDATA_IN_0,
|
|
|
|
GPIO27_AC97_SDATA_OUT,
|
|
|
|
GPIO28_AC97_SYNC,
|
|
|
|
GPIO29_AC97_BITCLK
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void __init colibri_pxa310_init_ac97(void)
|
|
|
|
{
|
|
|
|
/* no AC97 codec on Colibri PXA300 */
|
|
|
|
if (!cpu_is_pxa310())
|
|
|
|
return;
|
|
|
|
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
|
|
|
|
pxa_set_ac97_info(NULL);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void colibri_pxa310_init_ac97(void) {}
|
|
|
|
#endif
|
|
|
|
|
2009-03-23 09:04:17 +08:00
|
|
|
void __init colibri_pxa300_init(void)
|
2009-03-13 23:37:09 +08:00
|
|
|
{
|
2009-03-23 09:04:17 +08:00
|
|
|
colibri_pxa300_init_eth();
|
2009-06-17 16:32:54 +08:00
|
|
|
colibri_pxa3xx_init_nand();
|
2009-03-23 09:04:19 +08:00
|
|
|
colibri_pxa300_init_lcd();
|
2009-03-28 05:00:09 +08:00
|
|
|
colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
|
2009-03-23 09:04:20 +08:00
|
|
|
colibri_pxa310_init_ac97();
|
2010-08-12 07:18:38 +08:00
|
|
|
|
|
|
|
/* Evalboard init */
|
|
|
|
pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
|
2010-08-12 07:45:05 +08:00
|
|
|
colibri_evalboard_init();
|
2009-03-13 23:37:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
|
2011-07-06 10:38:15 +08:00
|
|
|
.atag_offset = 0x100,
|
2009-03-13 23:37:09 +08:00
|
|
|
.init_machine = colibri_pxa300_init,
|
2010-10-11 08:20:19 +08:00
|
|
|
.map_io = pxa3xx_map_io,
|
2012-01-04 06:53:48 +08:00
|
|
|
.nr_irqs = PXA_NR_IRQS,
|
2009-03-13 23:37:09 +08:00
|
|
|
.init_irq = pxa3xx_init_irq,
|
2011-05-18 21:30:04 +08:00
|
|
|
.handle_irq = pxa3xx_handle_irq,
|
2012-11-09 03:40:59 +08:00
|
|
|
.init_time = pxa_timer_init,
|
2011-11-04 22:15:53 +08:00
|
|
|
.restart = pxa_restart,
|
2009-03-13 23:37:09 +08:00
|
|
|
MACHINE_END
|
|
|
|
|