0001
0002
0003
0004
0005
0006
0007 #include <linux/kernel.h>
0008 #include <linux/init.h>
0009 #include <linux/io.h>
0010 #include <linux/gpio/machine.h>
0011 #include <linux/platform_device.h>
0012 #include <linux/mtd/physmap.h>
0013 #include <linux/mtd/partitions.h>
0014 #include <linux/sm501.h>
0015 #include <linux/smsc911x.h>
0016 #include <linux/platform_data/i2c-pxa.h>
0017
0018 #include <asm/mach-types.h>
0019 #include <asm/mach/arch.h>
0020
0021 #include "csb726.h"
0022 #include "pxa27x.h"
0023 #include <linux/platform_data/mmc-pxamci.h>
0024 #include <linux/platform_data/usb-ohci-pxa27x.h>
0025 #include <linux/platform_data/asoc-pxa.h>
0026 #include "smemc.h"
0027
0028 #include "generic.h"
0029 #include "devices.h"
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039 static unsigned long csb726_pin_config[] = {
0040 GPIO78_nCS_2,
0041 GPIO79_nCS_3,
0042 GPIO80_nCS_4,
0043
0044 GPIO52_GPIO,
0045 GPIO53_GPIO,
0046
0047 GPIO1_GPIO,
0048 GPIO11_GPIO,
0049 GPIO9_GPIO,
0050 GPIO10_GPIO,
0051 GPIO16_PWM0_OUT,
0052 GPIO17_PWM1_OUT,
0053 GPIO94_GPIO,
0054 GPIO95_GPIO,
0055 GPIO96_GPIO,
0056 GPIO97_GPIO,
0057 GPIO15_GPIO,
0058 GPIO18_RDY,
0059
0060 GPIO0_GPIO,
0061 GPIO104_GPIO,
0062
0063 GPIO12_GPIO,
0064
0065 GPIO13_SSP2_TXD,
0066 GPIO14_SSP2_SFRM,
0067 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),
0068 GPIO22_SSP2_SCLK,
0069
0070 GPIO81_SSP3_TXD,
0071 GPIO82_SSP3_RXD,
0072 GPIO83_SSP3_SFRM,
0073 GPIO84_SSP3_SCLK,
0074
0075 GPIO20_GPIO,
0076 GPIO32_MMC_CLK,
0077 GPIO92_MMC_DAT_0,
0078 GPIO109_MMC_DAT_1,
0079 GPIO110_MMC_DAT_2,
0080 GPIO111_MMC_DAT_3,
0081 GPIO112_MMC_CMD,
0082 GPIO100_GPIO,
0083 GPIO101_GPIO,
0084
0085 GPIO28_AC97_BITCLK,
0086 GPIO29_AC97_SDATA_IN_0,
0087 GPIO30_AC97_SDATA_OUT,
0088 GPIO31_AC97_SYNC,
0089 GPIO113_AC97_nRESET,
0090
0091 GPIO34_FFUART_RXD,
0092 GPIO35_FFUART_CTS,
0093 GPIO36_FFUART_DCD,
0094 GPIO37_FFUART_DSR,
0095 GPIO38_FFUART_RI,
0096 GPIO39_FFUART_TXD,
0097 GPIO40_FFUART_DTR,
0098 GPIO41_FFUART_RTS,
0099
0100 GPIO42_BTUART_RXD,
0101 GPIO43_BTUART_TXD,
0102 GPIO44_BTUART_CTS,
0103 GPIO45_BTUART_RTS,
0104
0105 GPIO46_STUART_RXD,
0106 GPIO47_STUART_TXD,
0107
0108 GPIO48_nPOE,
0109 GPIO49_nPWE,
0110 GPIO50_nPIOR,
0111 GPIO51_nPIOW,
0112 GPIO54_nPCE_2,
0113 GPIO55_nPREG,
0114 GPIO56_nPWAIT,
0115 GPIO57_nIOIS16,
0116 GPIO85_nPCE_1,
0117 GPIO98_GPIO,
0118 GPIO99_GPIO,
0119 GPIO103_GPIO,
0120
0121 GPIO117_I2C_SCL,
0122 GPIO118_I2C_SDA,
0123 };
0124
0125 static struct pxamci_platform_data csb726_mci = {
0126 .detect_delay_ms = 500,
0127 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
0128
0129 };
0130
0131 static struct gpiod_lookup_table csb726_mci_gpio_table = {
0132 .dev_id = "pxa2xx-mci.0",
0133 .table = {
0134
0135 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_DETECT,
0136 "cd", GPIO_ACTIVE_LOW),
0137
0138 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_RO,
0139 "wp", GPIO_ACTIVE_LOW),
0140 { },
0141 },
0142 };
0143
0144 static struct pxaohci_platform_data csb726_ohci_platform_data = {
0145 .port_mode = PMM_NPS_MODE,
0146 .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
0147 };
0148
0149 static struct mtd_partition csb726_flash_partitions[] = {
0150 {
0151 .name = "Bootloader",
0152 .offset = 0,
0153 .size = CSB726_FLASH_uMON,
0154 .mask_flags = MTD_WRITEABLE
0155 },
0156 {
0157 .name = "root",
0158 .offset = MTDPART_OFS_APPEND,
0159 .size = MTDPART_SIZ_FULL,
0160 }
0161 };
0162
0163 static struct physmap_flash_data csb726_flash_data = {
0164 .width = 2,
0165 .parts = csb726_flash_partitions,
0166 .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
0167 };
0168
0169 static struct resource csb726_flash_resources[] = {
0170 {
0171 .start = PXA_CS0_PHYS,
0172 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
0173 .flags = IORESOURCE_MEM,
0174 }
0175 };
0176
0177 static struct platform_device csb726_flash = {
0178 .name = "physmap-flash",
0179 .dev = {
0180 .platform_data = &csb726_flash_data,
0181 },
0182 .resource = csb726_flash_resources,
0183 .num_resources = ARRAY_SIZE(csb726_flash_resources),
0184 };
0185
0186 static struct resource csb726_sm501_resources[] = {
0187 {
0188 .start = PXA_CS4_PHYS,
0189 .end = PXA_CS4_PHYS + SZ_8M - 1,
0190 .flags = IORESOURCE_MEM,
0191 .name = "sm501-localmem",
0192 },
0193 {
0194 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
0195 .end = PXA_CS4_PHYS + SZ_64M - 1,
0196 .flags = IORESOURCE_MEM,
0197 .name = "sm501-regs",
0198 },
0199 {
0200 .start = CSB726_IRQ_SM501,
0201 .end = CSB726_IRQ_SM501,
0202 .flags = IORESOURCE_IRQ,
0203 },
0204 };
0205
0206 static struct sm501_initdata csb726_sm501_initdata = {
0207
0208 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
0209 };
0210
0211 static struct sm501_platdata csb726_sm501_platdata = {
0212 .init = &csb726_sm501_initdata,
0213 };
0214
0215 static struct platform_device csb726_sm501 = {
0216 .name = "sm501",
0217 .id = 0,
0218 .num_resources = ARRAY_SIZE(csb726_sm501_resources),
0219 .resource = csb726_sm501_resources,
0220 .dev = {
0221 .platform_data = &csb726_sm501_platdata,
0222 },
0223 };
0224
0225 static struct resource csb726_lan_resources[] = {
0226 {
0227 .start = PXA_CS3_PHYS,
0228 .end = PXA_CS3_PHYS + SZ_64K - 1,
0229 .flags = IORESOURCE_MEM,
0230 },
0231 {
0232 .start = CSB726_IRQ_LAN,
0233 .end = CSB726_IRQ_LAN,
0234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
0235 },
0236 };
0237
0238 struct smsc911x_platform_config csb726_lan_config = {
0239 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
0240 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
0241 .flags = SMSC911X_USE_32BIT,
0242 .phy_interface = PHY_INTERFACE_MODE_MII,
0243 };
0244
0245
0246 static struct platform_device csb726_lan = {
0247 .name = "smsc911x",
0248 .id = -1,
0249 .num_resources = ARRAY_SIZE(csb726_lan_resources),
0250 .resource = csb726_lan_resources,
0251 .dev = {
0252 .platform_data = &csb726_lan_config,
0253 },
0254 };
0255
0256 static struct platform_device *devices[] __initdata = {
0257 &csb726_flash,
0258 &csb726_sm501,
0259 &csb726_lan,
0260 };
0261
0262 static void __init csb726_init(void)
0263 {
0264 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
0265
0266
0267 __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2);
0268
0269 pxa_set_ffuart_info(NULL);
0270 pxa_set_btuart_info(NULL);
0271 pxa_set_stuart_info(NULL);
0272 pxa_set_i2c_info(NULL);
0273 pxa27x_set_i2c_power_info(NULL);
0274 gpiod_add_lookup_table(&csb726_mci_gpio_table);
0275 pxa_set_mci_info(&csb726_mci);
0276 pxa_set_ohci_info(&csb726_ohci_platform_data);
0277 pxa_set_ac97_info(NULL);
0278
0279 platform_add_devices(devices, ARRAY_SIZE(devices));
0280 }
0281
0282 MACHINE_START(CSB726, "Cogent CSB726")
0283 .atag_offset = 0x100,
0284 .map_io = pxa27x_map_io,
0285 .nr_irqs = PXA_NR_IRQS,
0286 .init_irq = pxa27x_init_irq,
0287 .handle_irq = pxa27x_handle_irq,
0288 .init_machine = csb726_init,
0289 .init_time = pxa_timer_init,
0290 .restart = pxa_restart,
0291 MACHINE_END