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