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>
23 #include <linux/platform_data/mmc-pxamci.h>
24 #include <linux/platform_data/usb-ohci-pxa27x.h>
25 #include <linux/platform_data/asoc-pxa.h>
32 * n/a: 2, 5, 6, 7, 8, 23, 24, 25, 26, 27, 87, 88, 89,
33 * nu: 58 -- 77, 90, 91, 93, 102, 105-108, 114-116,
35 * XXX: 79 CS_3 for LAN9215 or PSKTSEL on R2, R3
36 * XXX: 33 CS_5 for LAN9215 on R1
39 static unsigned long csb726_pin_config[] = {
40 GPIO78_nCS_2, /* EXP_CS */
41 GPIO79_nCS_3, /* SMSC9215 */
42 GPIO80_nCS_4, /* SM501 */
44 GPIO52_GPIO, /* #SMSC9251 int */
45 GPIO53_GPIO, /* SM501 int */
47 GPIO1_GPIO, /* GPIO0 */
48 GPIO11_GPIO, /* GPIO1 */
49 GPIO9_GPIO, /* GPIO2 */
50 GPIO10_GPIO, /* GPIO3 */
51 GPIO16_PWM0_OUT, /* or GPIO4 */
52 GPIO17_PWM1_OUT, /* or GPIO5 */
53 GPIO94_GPIO, /* GPIO6 */
54 GPIO95_GPIO, /* GPIO7 */
55 GPIO96_GPIO, /* GPIO8 */
56 GPIO97_GPIO, /* GPIO9 */
57 GPIO15_GPIO, /* EXP_IRQ */
58 GPIO18_RDY, /* EXP_WAIT */
60 GPIO0_GPIO, /* PWR_INT */
61 GPIO104_GPIO, /* PWR_OFF */
63 GPIO12_GPIO, /* touch irq */
67 MFP_CFG_OUT(GPIO19, AF1, DRIVE_LOW),/* SSP2_SYSCLK */
75 GPIO20_GPIO, /* SDIO int */
82 GPIO100_GPIO, /* SD CD */
83 GPIO101_GPIO, /* SD WP */
86 GPIO29_AC97_SDATA_IN_0,
87 GPIO30_AC97_SDATA_OUT,
115 GPIO57_nIOIS16, /* maybe unused */
117 GPIO98_GPIO, /* CF IRQ */
118 GPIO99_GPIO, /* CF CD */
119 GPIO103_GPIO, /* Reset */
125 static struct pxamci_platform_data csb726_mci = {
126 .detect_delay_ms = 500,
127 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
131 static struct gpiod_lookup_table csb726_mci_gpio_table = {
132 .dev_id = "pxa2xx-mci.0",
134 /* Card detect on GPIO 100 */
135 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_DETECT,
136 "cd", GPIO_ACTIVE_LOW),
137 /* Write protect on GPIO 101 */
138 GPIO_LOOKUP("gpio-pxa", CSB726_GPIO_MMC_RO,
139 "wp", GPIO_ACTIVE_LOW),
144 static struct pxaohci_platform_data csb726_ohci_platform_data = {
145 .port_mode = PMM_NPS_MODE,
146 .flags = ENABLE_PORT1 | NO_OC_PROTECTION,
149 static struct mtd_partition csb726_flash_partitions[] = {
151 .name = "Bootloader",
153 .size = CSB726_FLASH_uMON,
154 .mask_flags = MTD_WRITEABLE /* force read-only */
158 .offset = MTDPART_OFS_APPEND,
159 .size = MTDPART_SIZ_FULL,
163 static struct physmap_flash_data csb726_flash_data = {
165 .parts = csb726_flash_partitions,
166 .nr_parts = ARRAY_SIZE(csb726_flash_partitions),
169 static struct resource csb726_flash_resources[] = {
171 .start = PXA_CS0_PHYS,
172 .end = PXA_CS0_PHYS + CSB726_FLASH_SIZE - 1 ,
173 .flags = IORESOURCE_MEM,
177 static struct platform_device csb726_flash = {
178 .name = "physmap-flash",
180 .platform_data = &csb726_flash_data,
182 .resource = csb726_flash_resources,
183 .num_resources = ARRAY_SIZE(csb726_flash_resources),
186 static struct resource csb726_sm501_resources[] = {
188 .start = PXA_CS4_PHYS,
189 .end = PXA_CS4_PHYS + SZ_8M - 1,
190 .flags = IORESOURCE_MEM,
191 .name = "sm501-localmem",
194 .start = PXA_CS4_PHYS + SZ_64M - SZ_2M,
195 .end = PXA_CS4_PHYS + SZ_64M - 1,
196 .flags = IORESOURCE_MEM,
197 .name = "sm501-regs",
200 .start = CSB726_IRQ_SM501,
201 .end = CSB726_IRQ_SM501,
202 .flags = IORESOURCE_IRQ,
206 static struct sm501_initdata csb726_sm501_initdata = {
207 /* .devices = SM501_USE_USB_HOST, */
208 .devices = SM501_USE_USB_HOST | SM501_USE_UART0 | SM501_USE_UART1,
211 static struct sm501_platdata csb726_sm501_platdata = {
212 .init = &csb726_sm501_initdata,
215 static struct platform_device csb726_sm501 = {
218 .num_resources = ARRAY_SIZE(csb726_sm501_resources),
219 .resource = csb726_sm501_resources,
221 .platform_data = &csb726_sm501_platdata,
225 static struct resource csb726_lan_resources[] = {
227 .start = PXA_CS3_PHYS,
228 .end = PXA_CS3_PHYS + SZ_64K - 1,
229 .flags = IORESOURCE_MEM,
232 .start = CSB726_IRQ_LAN,
233 .end = CSB726_IRQ_LAN,
234 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
238 struct smsc911x_platform_config csb726_lan_config = {
239 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
240 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
241 .flags = SMSC911X_USE_32BIT,
242 .phy_interface = PHY_INTERFACE_MODE_MII,
246 static struct platform_device csb726_lan = {
249 .num_resources = ARRAY_SIZE(csb726_lan_resources),
250 .resource = csb726_lan_resources,
252 .platform_data = &csb726_lan_config,
256 static struct platform_device *devices[] __initdata = {
262 static void __init csb726_init(void)
264 pxa2xx_mfp_config(ARRAY_AND_SIZE(csb726_pin_config));
265 /* __raw_writel(0x7ffc3ffc, MSC1); *//* LAN9215/EXP_CS */
266 /* __raw_writel(0x06697ff4, MSC2); *//* none/SM501 */
267 __raw_writel((__raw_readl(MSC2) & ~0xffff) | 0x7ff4, MSC2); /* SM501 */
269 pxa_set_ffuart_info(NULL);
270 pxa_set_btuart_info(NULL);
271 pxa_set_stuart_info(NULL);
272 pxa_set_i2c_info(NULL);
273 pxa27x_set_i2c_power_info(NULL);
274 gpiod_add_lookup_table(&csb726_mci_gpio_table);
275 pxa_set_mci_info(&csb726_mci);
276 pxa_set_ohci_info(&csb726_ohci_platform_data);
277 pxa_set_ac97_info(NULL);
279 platform_add_devices(devices, ARRAY_SIZE(devices));
282 MACHINE_START(CSB726, "Cogent CSB726")
283 .atag_offset = 0x100,
284 .map_io = pxa27x_map_io,
285 .nr_irqs = PXA_NR_IRQS,
286 .init_irq = pxa27x_init_irq,
287 .handle_irq = pxa27x_handle_irq,
288 .init_machine = csb726_init,
289 .init_time = pxa_timer_init,
290 .restart = pxa_restart,