blob: 2167294fecb6f17c10d36b5dc66f09b9fe9a48e0 [file] [log] [blame]
Edwin Peer1f3b5362010-02-05 18:31:48 +02001/*
2 * linux/arch/arm/mach-pxa/mxm8x10.c
3 *
4 * Support for the Embedian MXM-8x10 Computer on Module
5 *
6 * Copyright (C) 2006 Marvell International Ltd.
7 * Copyright (C) 2009 Embedian Inc.
8 * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
9 *
10 * 2007-09-04: eric miao <eric.y.miao@gmail.com>
11 * rewrite to align with latest kernel
12 *
13 * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za>
14 * Hennie van der Merwe <hvdmerwe@tmtservices.co.za>
15 * rework for upstream merge
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#include <linux/serial_8250.h>
23#include <linux/dm9000.h>
Linus Walleij32d15442018-12-02 09:43:22 +010024#include <linux/gpio/machine.h>
Wolfram Sangf15fc9b2017-11-13 18:27:39 +010025#include <linux/platform_data/i2c-pxa.h>
Edwin Peer1f3b5362010-02-05 18:31:48 +020026
Arnd Bergmann293b2da2012-08-24 15:16:48 +020027#include <linux/platform_data/mtd-nand-pxa3xx.h>
Edwin Peer1f3b5362010-02-05 18:31:48 +020028
Arnd Bergmann293b2da2012-08-24 15:16:48 +020029#include <linux/platform_data/video-pxafb.h>
30#include <linux/platform_data/mmc-pxamci.h>
31#include <linux/platform_data/usb-ohci-pxa27x.h>
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010032#include "pxa320.h"
Edwin Peer1f3b5362010-02-05 18:31:48 +020033
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010034#include "mxm8x10.h"
Edwin Peer1f3b5362010-02-05 18:31:48 +020035
36#include "devices.h"
37#include "generic.h"
38
39/* GPIO pin definition
40
41External device stuff - Leave unconfigured for now...
42---------------------
43GPIO0 - DREQ (External DMA Request)
44GPIO3 - nGCS2 (External Chip Select) Where is nGCS0; nGCS1; nGCS4; nGCS5 ?
45GPIO4 - nGCS3
46GPIO15 - EXT_GPIO1
47GPIO16 - EXT_GPIO2
48GPIO17 - EXT_GPIO3
49GPIO24 - EXT_GPIO4
50GPIO25 - EXT_GPIO5
51GPIO26 - EXT_GPIO6
52GPIO27 - EXT_GPIO7
53GPIO28 - EXT_GPIO8
54GPIO29 - EXT_GPIO9
55GPIO30 - EXT_GPIO10
56GPIO31 - EXT_GPIO11
57GPIO57 - EXT_GPIO12
58GPIO74 - EXT_IRQ1
59GPIO75 - EXT_IRQ2
60GPIO76 - EXT_IRQ3
61GPIO77 - EXT_IRQ4
62GPIO78 - EXT_IRQ5
63GPIO79 - EXT_IRQ6
64GPIO80 - EXT_IRQ7
65GPIO81 - EXT_IRQ8
66GPIO87 - VCCIO_PWREN (External Device PWREN)
67
68Dallas 1-Wire - Leave unconfigured for now...
69-------------
70GPIO0_2 - DS - 1Wire
71
72Ethernet
73--------
74GPIO1 - DM9000 PWR
75GPIO9 - DM9K_nIRQ
76GPIO36 - DM9K_RESET
77
78Keypad - Leave unconfigured by for now...
79------
80GPIO1_2 - KP_DKIN0
81GPIO5_2 - KP_MKOUT7
82GPIO82 - KP_DKIN1
83GPIO85 - KP_DKIN2
84GPIO86 - KP_DKIN3
85GPIO113 - KP_MKIN0
86GPIO114 - KP_MKIN1
87GPIO115 - KP_MKIN2
88GPIO116 - KP_MKIN3
89GPIO117 - KP_MKIN4
90GPIO118 - KP_MKIN5
91GPIO119 - KP_MKIN6
92GPIO120 - KP_MKIN7
93GPIO121 - KP_MKOUT0
94GPIO122 - KP_MKOUT1
95GPIO122 - KP_MKOUT2
96GPIO123 - KP_MKOUT3
97GPIO124 - KP_MKOUT4
98GPIO125 - KP_MKOUT5
99GPIO127 - KP_MKOUT6
100
101Data Bus - Leave unconfigured for now...
102--------
103GPIO2 - nWait (Data Bus)
104
105USB Device
106----------
107GPIO4_2 - USBD_PULLUP
108GPIO10 - UTM_CLK (USB Device UTM Clk)
109GPIO49 - USB 2.0 Device UTM_DATA0
110GPIO50 - USB 2.0 Device UTM_DATA1
111GPIO51 - USB 2.0 Device UTM_DATA2
112GPIO52 - USB 2.0 Device UTM_DATA3
113GPIO53 - USB 2.0 Device UTM_DATA4
114GPIO54 - USB 2.0 Device UTM_DATA5
115GPIO55 - USB 2.0 Device UTM_DATA6
116GPIO56 - USB 2.0 Device UTM_DATA7
117GPIO58 - UTM_RXVALID (USB 2.0 Device)
118GPIO59 - UTM_RXACTIVE (USB 2.0 Device)
119GPIO60 - UTM_RXERROR
120GPIO61 - UTM_OPMODE0
121GPIO62 - UTM_OPMODE1
122GPIO71 - USBD_INT (USB Device?)
123GPIO73 - UTM_TXREADY (USB 2.0 Device)
124GPIO83 - UTM_TXVALID (USB 2.0 Device)
125GPIO98 - UTM_RESET (USB 2.0 device)
126GPIO99 - UTM_XCVR_SELECT
127GPIO100 - UTM_TERM_SELECT
128GPIO101 - UTM_SUSPENDM_X
129GPIO102 - UTM_LINESTATE0
130GPIO103 - UTM_LINESTATE1
131
132Card-Bus Interface - Leave unconfigured for now...
133------------------
134GPIO5 - nPIOR (I/O space output enable)
135GPIO6 - nPIOW (I/O space write enable)
136GPIO7 - nIOS16 (Input from I/O space telling size of data bus)
137GPIO8 - nPWAIT (Input for inserting wait states)
138
139LCD
140---
141GPIO6_2 - LDD0
142GPIO7_2 - LDD1
143GPIO8_2 - LDD2
144GPIO9_2 - LDD3
145GPIO11_2 - LDD5
146GPIO12_2 - LDD6
147GPIO13_2 - LDD7
148GPIO14_2 - VSYNC
149GPIO15_2 - HSYNC
150GPIO16_2 - VCLK
151GPIO17_2 - HCLK
152GPIO18_2 - VDEN
153GPIO63 - LDD8 (CPU LCD)
154GPIO64 - LDD9 (CPU LCD)
155GPIO65 - LDD10 (CPU LCD)
156GPIO66 - LDD11 (CPU LCD)
157GPIO67 - LDD12 (CPU LCD)
158GPIO68 - LDD13 (CPU LCD)
159GPIO69 - LDD14 (CPU LCD)
160GPIO70 - LDD15 (CPU LCD)
161GPIO88 - VCCLCD_PWREN (LCD Panel PWREN)
162GPIO97 - BACKLIGHT_EN
163GPIO104 - LCD_PWREN
164
165PWM - Leave unconfigured for now...
166---
167GPIO11 - PWM0
168GPIO12 - PWM1
169GPIO13 - PWM2
170GPIO14 - PWM3
171
172SD-CARD
173-------
174GPIO18 - SDDATA0
175GPIO19 - SDDATA1
176GPIO20 - SDDATA2
177GPIO21 - SDDATA3
178GPIO22 - SDCLK
179GPIO23 - SDCMD
180GPIO72 - SD_WP
181GPIO84 - SD_nIRQ_CD (SD-Card)
182
183I2C
184---
185GPIO32 - I2CSCL
186GPIO33 - I2CSDA
187
188AC97
189----
190GPIO35 - AC97_SDATA_IN
191GPIO37 - AC97_SDATA_OUT
192GPIO38 - AC97_SYNC
193GPIO39 - AC97_BITCLK
194GPIO40 - AC97_nRESET
195
196UART1
197-----
198GPIO41 - UART_RXD1
199GPIO42 - UART_TXD1
200GPIO43 - UART_CTS1
201GPIO44 - UART_DCD1
202GPIO45 - UART_DSR1
203GPIO46 - UART_nRI1
204GPIO47 - UART_DTR1
205GPIO48 - UART_RTS1
206
207UART2
208-----
209GPIO109 - RTS2
210GPIO110 - RXD2
211GPIO111 - TXD2
212GPIO112 - nCTS2
213
214UART3
215-----
216GPIO105 - nCTS3
217GPIO106 - nRTS3
218GPIO107 - TXD3
219GPIO108 - RXD3
220
221SSP3 - Leave unconfigured for now...
222----
223GPIO89 - SSP3_CLK
224GPIO90 - SSP3_SFRM
225GPIO91 - SSP3_TXD
226GPIO92 - SSP3_RXD
227
228SSP4
229GPIO93 - SSP4_CLK
230GPIO94 - SSP4_SFRM
231GPIO95 - SSP4_TXD
232GPIO96 - SSP4_RXD
233*/
234
235static mfp_cfg_t mfp_cfg[] __initdata = {
236 /* USB */
237 GPIO10_UTM_CLK,
238 GPIO49_U2D_PHYDATA_0,
239 GPIO50_U2D_PHYDATA_1,
240 GPIO51_U2D_PHYDATA_2,
241 GPIO52_U2D_PHYDATA_3,
242 GPIO53_U2D_PHYDATA_4,
243 GPIO54_U2D_PHYDATA_5,
244 GPIO55_U2D_PHYDATA_6,
245 GPIO56_U2D_PHYDATA_7,
246 GPIO58_UTM_RXVALID,
247 GPIO59_UTM_RXACTIVE,
248 GPIO60_U2D_RXERROR,
249 GPIO61_U2D_OPMODE0,
250 GPIO62_U2D_OPMODE1,
251 GPIO71_GPIO, /* USBD_INT */
252 GPIO73_UTM_TXREADY,
253 GPIO83_U2D_TXVALID,
254 GPIO98_U2D_RESET,
255 GPIO99_U2D_XCVR_SEL,
256 GPIO100_U2D_TERM_SEL,
257 GPIO101_U2D_SUSPEND,
258 GPIO102_UTM_LINESTATE_0,
259 GPIO103_UTM_LINESTATE_1,
260 GPIO4_2_GPIO | MFP_PULL_HIGH, /* UTM_PULLUP */
261
262 /* DM9000 */
263 GPIO1_GPIO,
264 GPIO9_GPIO,
265 GPIO36_GPIO,
266
267 /* AC97 */
268 GPIO35_AC97_SDATA_IN_0,
269 GPIO37_AC97_SDATA_OUT,
270 GPIO38_AC97_SYNC,
271 GPIO39_AC97_BITCLK,
272 GPIO40_AC97_nACRESET,
273
274 /* UARTS */
275 GPIO41_UART1_RXD,
276 GPIO42_UART1_TXD,
277 GPIO43_UART1_CTS,
278 GPIO44_UART1_DCD,
279 GPIO45_UART1_DSR,
280 GPIO46_UART1_RI,
281 GPIO47_UART1_DTR,
282 GPIO48_UART1_RTS,
283
284 GPIO109_UART2_RTS,
285 GPIO110_UART2_RXD,
286 GPIO111_UART2_TXD,
287 GPIO112_UART2_CTS,
288
289 GPIO105_UART3_CTS,
290 GPIO106_UART3_RTS,
291 GPIO107_UART3_TXD,
292 GPIO108_UART3_RXD,
293
294 GPIO78_GPIO,
295 GPIO79_GPIO,
296 GPIO80_GPIO,
297 GPIO81_GPIO,
298
299 /* I2C */
300 GPIO32_I2C_SCL,
301 GPIO33_I2C_SDA,
302
303 /* MMC */
304 GPIO18_MMC1_DAT0,
305 GPIO19_MMC1_DAT1,
306 GPIO20_MMC1_DAT2,
307 GPIO21_MMC1_DAT3,
308 GPIO22_MMC1_CLK,
309 GPIO23_MMC1_CMD,
310 GPIO72_GPIO | MFP_PULL_HIGH, /* Card Detect */
311 GPIO84_GPIO | MFP_PULL_LOW, /* Write Protect */
312
313 /* IRQ */
314 GPIO74_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ1 */
315 GPIO75_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ2 */
316 GPIO76_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ3 */
317 GPIO77_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ4 */
318 GPIO78_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ5 */
319 GPIO79_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ6 */
320 GPIO80_GPIO | MFP_LPM_EDGE_RISE, /* EXT_IRQ7 */
321 GPIO81_GPIO | MFP_LPM_EDGE_RISE /* EXT_IRQ8 */
322};
323
324/* MMC/MCI Support */
325#if defined(CONFIG_MMC)
326static struct pxamci_platform_data mxm_8x10_mci_platform_data = {
327 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
Eric Miaof97cab22010-04-14 07:00:42 +0800328 .detect_delay_ms = 10,
Edwin Peer1f3b5362010-02-05 18:31:48 +0200329 .gpio_card_detect = MXM_8X10_SD_nCD,
330 .gpio_card_ro = MXM_8X10_SD_WP,
331 .gpio_power = -1
332};
333
Linus Walleij32d15442018-12-02 09:43:22 +0100334static struct gpiod_lookup_table mxm_8x10_mci_gpio_table = {
335 .dev_id = "pxa2xx-mci.0",
336 .table = {
337 /* Card detect on GPIO 72 */
338 GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_nCD,
339 "cd", GPIO_ACTIVE_LOW),
340 /* Write protect on GPIO 84 */
341 GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_WP,
342 "wp", GPIO_ACTIVE_LOW),
343 { },
344 },
345};
346
Edwin Peer1f3b5362010-02-05 18:31:48 +0200347void __init mxm_8x10_mmc_init(void)
348{
Linus Walleij32d15442018-12-02 09:43:22 +0100349 gpiod_add_lookup_table(&mxm_8x10_mci_gpio_table);
Edwin Peer1f3b5362010-02-05 18:31:48 +0200350 pxa_set_mci_info(&mxm_8x10_mci_platform_data);
351}
352#endif
353
Uwe Kleine-Königb5950762010-11-01 15:38:34 -0400354/* USB Open Host Controller Interface */
Edwin Peer1f3b5362010-02-05 18:31:48 +0200355static struct pxaohci_platform_data mxm_8x10_ohci_platform_data = {
356 .port_mode = PMM_NPS_MODE,
357 .flags = ENABLE_PORT_ALL
358};
359
360void __init mxm_8x10_usb_host_init(void)
361{
362 pxa_set_ohci_info(&mxm_8x10_ohci_platform_data);
363}
364
365/* AC97 Sound Support */
366static struct platform_device mxm_8x10_ac97_device = {
367 .name = "pxa2xx-ac97"
368};
369
370void __init mxm_8x10_ac97_init(void)
371{
372 platform_device_register(&mxm_8x10_ac97_device);
373}
374
375/* NAND flash Support */
Miquel Raynal349dfe62018-02-19 23:35:52 +0100376#if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
Edwin Peer1f3b5362010-02-05 18:31:48 +0200377#define NAND_BLOCK_SIZE SZ_128K
378#define NB(x) (NAND_BLOCK_SIZE * (x))
379static struct mtd_partition mxm_8x10_nand_partitions[] = {
380 [0] = {
381 .name = "boot",
382 .size = NB(0x002),
383 .offset = NB(0x000),
384 .mask_flags = MTD_WRITEABLE
385 },
386 [1] = {
387 .name = "kernel",
388 .size = NB(0x010),
389 .offset = NB(0x002),
390 .mask_flags = MTD_WRITEABLE
391 },
392 [2] = {
393 .name = "root",
394 .size = NB(0x36c),
395 .offset = NB(0x012)
396 },
397 [3] = {
398 .name = "bbt",
399 .size = NB(0x082),
400 .offset = NB(0x37e),
401 .mask_flags = MTD_WRITEABLE
402 }
403};
404
405static struct pxa3xx_nand_platform_data mxm_8x10_nand_info = {
Lei Wenf3c8cfc2011-07-14 20:44:33 -0700406 .keep_config = 1,
Miquel Raynal75765942018-02-19 23:35:54 +0100407 .parts = mxm_8x10_nand_partitions,
408 .nr_parts = ARRAY_SIZE(mxm_8x10_nand_partitions)
Edwin Peer1f3b5362010-02-05 18:31:48 +0200409};
410
411static void __init mxm_8x10_nand_init(void)
412{
413 pxa3xx_set_nand_info(&mxm_8x10_nand_info);
414}
415#else
416static inline void mxm_8x10_nand_init(void) {}
Miquel Raynal349dfe62018-02-19 23:35:52 +0100417#endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
Edwin Peer1f3b5362010-02-05 18:31:48 +0200418
419/* Ethernet support: Davicom DM9000 */
420static struct resource dm9k_resources[] = {
421 [0] = {
422 .start = MXM_8X10_ETH_PHYS + 0x300,
423 .end = MXM_8X10_ETH_PHYS + 0x300,
424 .flags = IORESOURCE_MEM
425 },
426 [1] = {
427 .start = MXM_8X10_ETH_PHYS + 0x308,
428 .end = MXM_8X10_ETH_PHYS + 0x308,
429 .flags = IORESOURCE_MEM
430 },
431 [2] = {
Haojian Zhuang4929f5a2011-10-10 16:03:51 +0800432 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
433 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9)),
Edwin Peer1f3b5362010-02-05 18:31:48 +0200434 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE
435 }
436};
437
438static struct dm9000_plat_data dm9k_plat_data = {
439 .flags = DM9000_PLATF_16BITONLY
440};
441
442static struct platform_device dm9k_device = {
443 .name = "dm9000",
444 .id = 0,
445 .num_resources = ARRAY_SIZE(dm9k_resources),
446 .resource = dm9k_resources,
447 .dev = {
448 .platform_data = &dm9k_plat_data
449 }
450};
451
452static void __init mxm_8x10_ethernet_init(void)
453{
454 platform_device_register(&dm9k_device);
455}
456
457/* PXA UARTs */
458static void __init mxm_8x10_uarts_init(void)
459{
460 pxa_set_ffuart_info(NULL);
461 pxa_set_btuart_info(NULL);
462 pxa_set_stuart_info(NULL);
463}
464
465/* I2C and Real Time Clock */
466static struct i2c_board_info __initdata mxm_8x10_i2c_devices[] = {
467 {
468 I2C_BOARD_INFO("ds1337", 0x68)
469 }
470};
471
472static void __init mxm_8x10_i2c_init(void)
473{
474 i2c_register_board_info(0, mxm_8x10_i2c_devices,
475 ARRAY_SIZE(mxm_8x10_i2c_devices));
476 pxa_set_i2c_info(NULL);
477}
478
479void __init mxm_8x10_barebones_init(void)
480{
481 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg));
482
483 mxm_8x10_uarts_init();
484 mxm_8x10_nand_init();
485 mxm_8x10_i2c_init();
486 mxm_8x10_ethernet_init();
487}