1 // SPDX-License-Identifier: GPL-2.0-only
3 * Support for Cogent CSB726
5 * Copyright (c) 2008 Dmitry Eremin-Solenikov
7 #include <linux/kernel.h>
8 #include <linux/init.h>
10 #include <linux/gpio/machine.h>
11 #include <linux/platform_device.h>
12 #include <linux/mtd/physmap.h>
13 #include <linux/mtd/partitions.h>
14 #include <linux/sm501.h>
15 #include <linux/smsc911x.h>
16 #include <linux/platform_data/i2c-pxa.h>
18 #include <asm/mach-types.h>
19 #include <asm/mach/arch.h>
22 #include <linux/platform_data/mmc-pxamci.h>
23 #include <linux/platform_data/usb-ohci-pxa27x.h>
24 #include <mach/audio.h>
25 #include <mach/smemc.h>
31 * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89,
32 * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116,
34 * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
35 * XXX: 33 CS_5 for LAN9215 on R1
38 static unsigned long csb726_pin_config[] = {
39 GPIO78_nCS_2, /* EXP_CS */
40 GPIO79_nCS_3, /* SMSC9215 */
41 GPIO80_nCS_4, /* SM501 */
43 GPIO52_GPIO, /* #SMSC9251 int */
44 GPIO53_GPIO, /* SM501 int */
46 GPIO1_GPIO, /* GPIO0 */
47 GPIO11_GPIO, /* GPIO1 */
48 GPIO9_GPIO, /* GPIO2 */
49 GPIO10_GPIO, /* GPIO3 */
50 GPIO16_PWM0_OUT, /* or GPIO4 */
51 GPIO17_PWM1_OUT, /* or GPIO5 */
52 GPIO94_GPIO, /* GPIO6 */
53 GPIO95_GPIO, /* GPIO7 */
54 GPIO96_GPIO, /* GPIO8 */
55 GPIO97_GPIO, /* GPIO9 */
56 GPIO15_GPIO, /* EXP_IRQ */
57 GPIO18_RDY, /* EXP_WAIT */
59 GPIO0_GPIO, /* PWR_INT */
60 GPIO104_GPIO, /* PWR_OFF */
62 GPIO12_GPIO, /* touch irq */
66 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
74 GPIO20_GPIO, /* SDIO int */
81 GPIO100_GPIO, /* SD CD */
82 GPIO101_GPIO, /* SD WP */
85 GPIO29_AC97_SDATA_IN_0,
86 GPIO30_AC97_SDATA_OUT,
114 GPIO57_nIOIS16, /* maybe unused */
116 GPIO98_GPIO, /* CF IRQ */
117 GPIO99_GPIO, /* CF CD */
118 GPIO103_GPIO, /* Reset */
124 static struct pxamci_platform_data csb726_mci = {
125 .detect_delay_ms = 500,
126 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
130 static struct gpiod_lookup_table csb726_mci_gpio_table = {
131 .dev_id = "pxa2xx-mci.0",
133 /* Card detect on GPIO 100 */
134 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_DETECT,
135 "cd", GPIO_ACTIVE_LOW),
136 /* Write protect on GPIO 101 */
137 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_RO,
138 "wp", GPIO_ACTIVE_LOW),
143 static struct pxaohci_platform_data csb726_ohci_platform_data = {
144 .port_mode = PMM_NPS_MODE,
145 .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
148 static struct mtd_partition csb726_flash_partitions[] = {
150 .name = "Bootloader",
152 .size = CSB726_FLASH_uMON,
153 .mask_flags = MTD_WRITEABLE /* force read-only */
157 .offset = MTDPART_OFS_APPEND,
158 .size = MTDPART_SIZ_FULL,
162 static struct physmap_flash_data csb726_flash_data = {
164 .parts = csb726_flash_partitions,
165 .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
168 static struct resource csb726_flash_resources[] = {
170 .start = PXA_CS0_PHYS,
171 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
172 .flags = IORESOURCE_MEM,
176 static struct platform_device csb726_flash = {
177 .name = "physmap-flash",
179 .platform_data = &csb726_flash_data,
181 .resource = csb726_flash_resources,
182 .num_resources = ARRAY_SIZE(csb726_flash_resources),
185 static struct resource csb726_sm501_resources[] = {
187 .start = PXA_CS4_PHYS,
188 .end = PXA_CS4_PHYS + SZ_8M - 1,
189 .flags = IORESOURCE_MEM,
190 .name = "sm501-localmem",
193 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
194 .end = PXA_CS4_PHYS + SZ_64M - 1,
195 .flags = IORESOURCE_MEM,
196 .name = "sm501-regs",
199 .start = CSB726_IRQ_SM501,
200 .end = CSB726_IRQ_SM501,
201 .flags = IORESOURCE_IRQ,
205 static struct sm501_initdata csb726_sm501_initdata = {
206 /* .devices = SM501_USE_USB_HOST, */
207 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
210 static struct sm501_platdata csb726_sm501_platdata = {
211 .init = &csb726_sm501_initdata,
214 static struct platform_device csb726_sm501 = {
217 .num_resources = ARRAY_SIZE(csb726_sm501_resources),
218 .resource = csb726_sm501_resources,
220 .platform_data = &csb726_sm501_platdata,
224 static struct resource csb726_lan_resources[] = {
226 .start = PXA_CS3_PHYS,
227 .end = PXA_CS3_PHYS + SZ_64K - 1,
228 .flags = IORESOURCE_MEM,
231 .start = CSB726_IRQ_LAN,
232 .end = CSB726_IRQ_LAN,
233 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
237 struct smsc911x_platform_config csb726_lan_config = {
238 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
239 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
240 .flags = SMSC911X_USE_32BIT,
241 .phy_interface = PHY_INTERFACE_MODE_MII,
245 static struct platform_device csb726_lan = {
248 .num_resources = ARRAY_SIZE(csb726_lan_resources),
249 .resource = csb726_lan_resources,
251 .platform_data = &csb726_lan_config,
255 static struct platform_device *devices[] __initdata = {
261 static void __init csb726_init(void)
263 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
264 /* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */
265 /* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */
266 __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */
268 pxa_set_ffuart_info(NULL);
269 pxa_set_btuart_info(NULL);
270 pxa_set_stuart_info(NULL);
271 pxa_set_i2c_info(NULL);
272 pxa27x_set_i2c_power_info(NULL);
273 gpiod_add_lookup_table(&csb726_mci_gpio_table);
274 pxa_set_mci_info(&csb726_mci);
275 pxa_set_ohci_info(&csb726_ohci_platform_data);
276 pxa_set_ac97_info(NULL);
278 platform_add_devices(devices, ARRAY_SIZE(devices));
281 MACHINE_START(CSB726, "Cogent CSB726")
282 .atag_offset = 0x100,
283 .map_io = pxa27x_map_io,
284 .nr_irqs = PXA_NR_IRQS,
285 .init_irq = pxa27x_init_irq,
286 .handle_irq = pxa27x_handle_irq,
287 .init_machine = csb726_init,
288 .init_time = pxa_timer_init,
289 .restart = pxa_restart,