1/* 2 * Support for Cogent CSB726 3 * 4 * Copyright (c) 2008 Dmitry Eremin-Solenikov 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 as 8 * published by the Free Software Foundation. 9 * 10 */ 11#include <linux/kernel.h> 12#include <linux/init.h> 13#include <linux/io.h> 14#include <linux/gpio.h> 15#include <linux/platform_device.h> 16#include <linux/mtd/physmap.h> 17#include <linux/mtd/partitions.h> 18#include <linux/sm501.h> 19#include <linux/smsc911x.h> 20 21#include <asm/mach-types.h> 22#include <asm/mach/arch.h> 23#include <mach/csb726.h> 24#include <mach/mfp-pxa27x.h> 25#include <plat/i2c.h> 26#include <mach/mmc.h> 27#include <mach/ohci.h> 28#include <mach/pxa2xx-regs.h> 29#include <mach/audio.h> 30 31#include "generic.h" 32#include "devices.h" 33 34 35static unsigned long csb726_pin_config[] = { 36 GPIO78_nCS_2, /* EXP_CS */ 37 GPIO79_nCS_3, /* SMSC9215 */ 38 GPIO80_nCS_4, /* SM501 */ 39 40 GPIO52_GPIO, /* #SMSC9251 int */ 41 GPIO53_GPIO, /* SM501 int */ 42 43 GPIO1_GPIO, /* GPIO0 */ 44 GPIO11_GPIO, /* GPIO1 */ 45 GPIO9_GPIO, /* GPIO2 */ 46 GPIO10_GPIO, /* GPIO3 */ 47 GPIO16_PWM0_OUT, /* or GPIO4 */ 48 GPIO17_PWM1_OUT, /* or GPIO5 */ 49 GPIO94_GPIO, /* GPIO6 */ 50 GPIO95_GPIO, /* GPIO7 */ 51 GPIO96_GPIO, /* GPIO8 */ 52 GPIO97_GPIO, /* GPIO9 */ 53 GPIO15_GPIO, /* EXP_IRQ */ 54 GPIO18_RDY, /* EXP_WAIT */ 55 56 GPIO0_GPIO, /* PWR_INT */ 57 GPIO104_GPIO, /* PWR_OFF */ 58 59 GPIO12_GPIO, /* touch irq */ 60 61 GPIO13_SSP2_TXD, 62 GPIO14_SSP2_SFRM, 63 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */ 64 GPIO22_SSP2_SCLK, 65 66 GPIO81_SSP3_TXD, 67 GPIO82_SSP3_RXD, 68 GPIO83_SSP3_SFRM, 69 GPIO84_SSP3_SCLK, 70 71 GPIO20_GPIO, /* SDIO int */ 72 GPIO32_MMC_CLK, 73 GPIO92_MMC_DAT_0, 74 GPIO109_MMC_DAT_1, 75 GPIO110_MMC_DAT_2, 76 GPIO111_MMC_DAT_3, 77 GPIO112_MMC_CMD, 78 GPIO100_GPIO, /* SD CD */ 79 GPIO101_GPIO, /* SD WP */ 80 81 GPIO28_AC97_BITCLK, 82 GPIO29_AC97_SDATA_IN_0, 83 GPIO30_AC97_SDATA_OUT, 84 GPIO31_AC97_SYNC, 85 GPIO113_AC97_nRESET, 86 87 GPIO34_FFUART_RXD, 88 GPIO35_FFUART_CTS, 89 GPIO36_FFUART_DCD, 90 GPIO37_FFUART_DSR, 91 GPIO38_FFUART_RI, 92 GPIO39_FFUART_TXD, 93 GPIO40_FFUART_DTR, 94 GPIO41_FFUART_RTS, 95 96 GPIO42_BTUART_RXD, 97 GPIO43_BTUART_TXD, 98 GPIO44_BTUART_CTS, 99 GPIO45_BTUART_RTS, 100 101 GPIO46_STUART_RXD, 102 GPIO47_STUART_TXD, 103 104 GPIO48_nPOE, 105 GPIO49_nPWE, 106 GPIO50_nPIOR, 107 GPIO51_nPIOW, 108 GPIO54_nPCE_2, 109 GPIO55_nPREG, 110 GPIO56_nPWAIT, 111 GPIO57_nIOIS16, /* maybe unused */ 112 GPIO85_nPCE_1, 113 GPIO98_GPIO, /* CF IRQ */ 114 GPIO99_GPIO, /* CF CD */ 115 GPIO103_GPIO, /* Reset */ 116 117 GPIO117_I2C_SCL, 118 GPIO118_I2C_SDA, 119}; 120 121static struct pxamci_platform_data csb726_mci = { 122 .detect_delay_ms = 500, 123 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, 124 .gpio_card_detect = CSB726_GPIO_MMC_DETECT, 125 .gpio_card_ro = CSB726_GPIO_MMC_RO, 126 .gpio_power = -1, 127}; 128 129static struct pxaohci_platform_data csb726_ohci_platform_data = { 130 .port_mode = PMM_NPS_MODE, 131 .flags = ENABLE_PORT1 | NO_OC_PROTECTION, 132}; 133 134static struct mtd_partition csb726_flash_partitions[] = { 135 { 136 .name = "Bootloader", 137 .offset = 0, 138 .size = CSB726_FLASH_uMON, 139 .mask_flags = MTD_WRITEABLE /* force read-only */ 140 }, 141 { 142 .name = "root", 143 .offset = MTDPART_OFS_APPEND, 144 .size = MTDPART_SIZ_FULL, 145 } 146}; 147 148static struct physmap_flash_data csb726_flash_data = { 149 .width = 2, 150 .parts = csb726_flash_partitions, 151 .nr_parts = ARRAY_SIZE(csb726_flash_partitions), 152}; 153 154static struct resource csb726_flash_resources[] = { 155 { 156 .start = PXA_CS0_PHYS, 157 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 , 158 .flags = IORESOURCE_MEM, 159 } 160}; 161 162static struct platform_device csb726_flash = { 163 .name = "physmap-flash", 164 .dev = { 165 .platform_data = &csb726_flash_data, 166 }, 167 .resource = csb726_flash_resources, 168 .num_resources = ARRAY_SIZE(csb726_flash_resources), 169}; 170 171static struct resource csb726_sm501_resources[] = { 172 { 173 .start = PXA_CS4_PHYS, 174 .end = PXA_CS4_PHYS + SZ_8M - 1, 175 .flags = IORESOURCE_MEM, 176 .name = "sm501-localmem", 177 }, 178 { 179 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M, 180 .end = PXA_CS4_PHYS + SZ_64M - 1, 181 .flags = IORESOURCE_MEM, 182 .name = "sm501-regs", 183 }, 184 { 185 .start = CSB726_IRQ_SM501, 186 .end = CSB726_IRQ_SM501, 187 .flags = IORESOURCE_IRQ, 188 }, 189}; 190 191static struct sm501_initdata csb726_sm501_initdata = { 192/* .devices = SM501_USE_USB_HOST, */ 193 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1, 194}; 195 196static struct sm501_platdata csb726_sm501_platdata = { 197 .init = &csb726_sm501_initdata, 198}; 199 200static struct platform_device csb726_sm501 = { 201 .name = "sm501", 202 .id = 0, 203 .num_resources = ARRAY_SIZE(csb726_sm501_resources), 204 .resource = csb726_sm501_resources, 205 .dev = { 206 .platform_data = &csb726_sm501_platdata, 207 }, 208}; 209 210static struct resource csb726_lan_resources[] = { 211 { 212 .start = PXA_CS3_PHYS, 213 .end = PXA_CS3_PHYS + SZ_64K - 1, 214 .flags = IORESOURCE_MEM, 215 }, 216 { 217 .start = CSB726_IRQ_LAN, 218 .end = CSB726_IRQ_LAN, 219 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE, 220 }, 221}; 222 223struct smsc911x_platform_config csb726_lan_config = { 224 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, 225 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL, 226 .flags = SMSC911X_USE_32BIT, 227 .phy_interface = PHY_INTERFACE_MODE_MII, 228}; 229 230 231static struct platform_device csb726_lan = { 232 .name = "smsc911x", 233 .id = -1, 234 .num_resources = ARRAY_SIZE(csb726_lan_resources), 235 .resource = csb726_lan_resources, 236 .dev = { 237 .platform_data = &csb726_lan_config, 238 }, 239}; 240 241static struct platform_device *devices[] __initdata = { 242 &csb726_flash, 243 &csb726_sm501, 244 &csb726_lan, 245}; 246 247static void __init csb726_init(void) 248{ 249 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config)); 250/* MSC1 = 0x7ffc3ffc; *//* LAN9215/EXP_CS */ 251/* MSC2 = 0x06697ff4; *//* none/SM501 */ 252 MSC2 = (MSC2 & ~0xffff) | 0x7ff4; /* SM501 */ 253 254 pxa_set_ffuart_info(NULL); 255 pxa_set_btuart_info(NULL); 256 pxa_set_stuart_info(NULL); 257 pxa_set_i2c_info(NULL); 258 pxa27x_set_i2c_power_info(NULL); 259 pxa_set_mci_info(&csb726_mci); 260 pxa_set_ohci_info(&csb726_ohci_platform_data); 261 pxa_set_ac97_info(NULL); 262 263 platform_add_devices(devices, ARRAY_SIZE(devices)); 264} 265 266MACHINE_START(CSB726, "Cogent CSB726") 267 .phys_io = 0x40000000, 268 .boot_params = 0xa0000100, 269 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 270 .map_io = pxa_map_io, 271 .init_irq = pxa27x_init_irq, 272 .init_machine = csb726_init, 273 .timer = &pxa_timer, 274MACHINE_END 275