^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * arch/arm/mach-pxa/colibri-pxa300.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Support for Toradex PXA300/310 based Colibri module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Daniel Mack <daniel@caiaq.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Matthias Meier <matthias.j.meier@gmx.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/gpio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <linux/sizes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/mach/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <asm/mach/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "pxa300.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "colibri.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/platform_data/usb-ohci-pxa27x.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/platform_data/video-pxafb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <mach/audio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "generic.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #include "devices.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #ifdef CONFIG_MACH_COLIBRI_EVALBOARD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) /* MMC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) GPIO7_MMC1_CLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) GPIO14_MMC1_CMD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) GPIO3_MMC1_DAT0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) GPIO4_MMC1_DAT1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) GPIO5_MMC1_DAT2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) GPIO6_MMC1_DAT3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) GPIO13_GPIO, /* GPIO13_COLIBRI_PXA300_SD_DETECT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) /* UHC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) GPIO0_2_USBH_PEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) GPIO1_2_USBH_PWR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) GPIO77_USB_P3_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) GPIO78_USB_P3_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) GPIO79_USB_P3_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) GPIO80_USB_P3_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) GPIO81_USB_P3_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) GPIO82_USB_P3_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) GPIO21_I2C_SCL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) GPIO22_I2C_SDA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) static mfp_cfg_t colibri_pxa300_evalboard_pin_config[] __initdata = {};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #if defined(CONFIG_AX88796)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define COLIBRI_ETH_IRQ_GPIO mfp_to_gpio(GPIO26_GPIO)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) * Asix AX88796 Ethernet
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) static struct ax_plat_data colibri_asix_platdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) .flags = 0, /* defined later */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) .wordlength = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static struct resource colibri_asix_resource[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) [0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) .start = PXA3xx_CS2_PHYS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) .end = PXA3xx_CS2_PHYS + (0x20 * 2) - 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) .flags = IORESOURCE_MEM,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) [1] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) .start = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) .end = PXA_GPIO_TO_IRQ(COLIBRI_ETH_IRQ_GPIO),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) .flags = IORESOURCE_IRQ | IRQF_TRIGGER_FALLING,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static struct platform_device asix_device = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) .name = "ax88796",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) .id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) .num_resources = ARRAY_SIZE(colibri_asix_resource),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) .resource = colibri_asix_resource,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) .dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) .platform_data = &colibri_asix_platdata
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static mfp_cfg_t colibri_pxa300_eth_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) GPIO1_nCS2, /* AX88796 chip select */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) GPIO26_GPIO | MFP_PULL_HIGH /* AX88796 IRQ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) static void __init colibri_pxa300_init_eth(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) colibri_pxa3xx_init_eth(&colibri_asix_platdata);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_eth_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) platform_device_register(&asix_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static inline void __init colibri_pxa300_init_eth(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) #endif /* CONFIG_AX88796 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) static mfp_cfg_t colibri_pxa300_lcd_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) GPIO54_LCD_LDD_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) GPIO55_LCD_LDD_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) GPIO56_LCD_LDD_2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) GPIO57_LCD_LDD_3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) GPIO58_LCD_LDD_4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) GPIO59_LCD_LDD_5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) GPIO60_LCD_LDD_6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) GPIO61_LCD_LDD_7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) GPIO62_LCD_LDD_8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) GPIO63_LCD_LDD_9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) GPIO64_LCD_LDD_10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) GPIO65_LCD_LDD_11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) GPIO66_LCD_LDD_12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) GPIO67_LCD_LDD_13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) GPIO68_LCD_LDD_14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) GPIO69_LCD_LDD_15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) GPIO70_LCD_LDD_16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) GPIO71_LCD_LDD_17,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) GPIO62_LCD_CS_N,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) GPIO72_LCD_FCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) GPIO73_LCD_LCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) GPIO74_LCD_PCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) GPIO75_LCD_BIAS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) GPIO76_LCD_VSYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) static void __init colibri_pxa300_init_lcd(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_lcd_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static inline void colibri_pxa300_init_lcd(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) #if defined(CONFIG_SND_AC97_CODEC) || defined(CONFIG_SND_AC97_CODEC_MODULE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static mfp_cfg_t colibri_pxa310_ac97_pin_config[] __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) GPIO24_AC97_SYSCLK,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) GPIO23_AC97_nACRESET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) GPIO25_AC97_SDATA_IN_0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) GPIO27_AC97_SDATA_OUT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) GPIO28_AC97_SYNC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) GPIO29_AC97_BITCLK
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static inline void __init colibri_pxa310_init_ac97(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* no AC97 codec on Colibri PXA300 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) if (!cpu_is_pxa310())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa310_ac97_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) pxa_set_ac97_info(NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) static inline void colibri_pxa310_init_ac97(void) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) void __init colibri_pxa300_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) colibri_pxa300_init_eth();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) colibri_pxa3xx_init_nand();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) colibri_pxa300_init_lcd();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) colibri_pxa3xx_init_lcd(mfp_to_gpio(GPIO39_GPIO));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) colibri_pxa310_init_ac97();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) /* Evalboard init */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) pxa3xx_mfp_config(ARRAY_AND_SIZE(colibri_pxa300_evalboard_pin_config));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) colibri_evalboard_init();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) MACHINE_START(COLIBRI300, "Toradex Colibri PXA300")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) .atag_offset = 0x100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) .init_machine = colibri_pxa300_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) .map_io = pxa3xx_map_io,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) .nr_irqs = PXA_NR_IRQS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) .init_irq = pxa3xx_init_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) .handle_irq = pxa3xx_handle_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) .init_time = pxa_timer_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) .restart = pxa_restart,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) MACHINE_END
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)