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