1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/mxm8x10.c
5 * Support for the Embedian MXM-8x10 Computer on Module
7 * Copyright (C) 2006 Marvell International Ltd.
8 * Copyright (C) 2009 Embedian Inc.
9 * Copyright (C) 2009 TMT Services & Supplies (Pty) Ltd.
11 * 2007-09-04: eric miao <eric.y.miao@gmail.com>
12 * rewrite to align with latest kernel
14 * 2010-01-09: Edwin Peer <epeer@tmtservices.co.za>
15 * Hennie van der Merwe <hvdmerwe@tmtservices.co.za>
16 * rework for upstream merge
19 #include <linux/serial_8250.h>
20 #include <linux/dm9000.h>
21 #include <linux/gpio/machine.h>
22 #include <linux/platform_data/i2c-pxa.h>
24 #include <linux/platform_data/mtd-nand-pxa3xx.h>
26 #include <linux/platform_data/video-pxafb.h>
27 #include <linux/platform_data/mmc-pxamci.h>
28 #include <linux/platform_data/usb-ohci-pxa27x.h>
36 /* GPIO pin definition
38 External device stuff - Leave unconfigured for now...
40 GPIO0 - DREQ (External DMA Request)
41 GPIO3 - nGCS2 (External Chip Select) Where is nGCS0; nGCS1; nGCS4; nGCS5 ?
63 GPIO87 - VCCIO_PWREN (External Device PWREN)
65 Dallas 1-Wire - Leave unconfigured for now...
75 Keypad - Leave unconfigured by for now...
98 Data Bus - Leave unconfigured for now...
100 GPIO2 - nWait (Data Bus)
104 GPIO4_2 - USBD_PULLUP
105 GPIO10 - UTM_CLK (USB Device UTM Clk)
106 GPIO49 - USB 2.0 Device UTM_DATA0
107 GPIO50 - USB 2.0 Device UTM_DATA1
108 GPIO51 - USB 2.0 Device UTM_DATA2
109 GPIO52 - USB 2.0 Device UTM_DATA3
110 GPIO53 - USB 2.0 Device UTM_DATA4
111 GPIO54 - USB 2.0 Device UTM_DATA5
112 GPIO55 - USB 2.0 Device UTM_DATA6
113 GPIO56 - USB 2.0 Device UTM_DATA7
114 GPIO58 - UTM_RXVALID (USB 2.0 Device)
115 GPIO59 - UTM_RXACTIVE (USB 2.0 Device)
119 GPIO71 - USBD_INT (USB Device?)
120 GPIO73 - UTM_TXREADY (USB 2.0 Device)
121 GPIO83 - UTM_TXVALID (USB 2.0 Device)
122 GPIO98 - UTM_RESET (USB 2.0 device)
123 GPIO99 - UTM_XCVR_SELECT
124 GPIO100 - UTM_TERM_SELECT
125 GPIO101 - UTM_SUSPENDM_X
126 GPIO102 - UTM_LINESTATE0
127 GPIO103 - UTM_LINESTATE1
129 Card-Bus Interface - Leave unconfigured for now...
131 GPIO5 - nPIOR (I/O space output enable)
132 GPIO6 - nPIOW (I/O space write enable)
133 GPIO7 - nIOS16 (Input from I/O space telling size of data bus)
134 GPIO8 - nPWAIT (Input for inserting wait states)
150 GPIO63 - LDD8 (CPU LCD)
151 GPIO64 - LDD9 (CPU LCD)
152 GPIO65 - LDD10 (CPU LCD)
153 GPIO66 - LDD11 (CPU LCD)
154 GPIO67 - LDD12 (CPU LCD)
155 GPIO68 - LDD13 (CPU LCD)
156 GPIO69 - LDD14 (CPU LCD)
157 GPIO70 - LDD15 (CPU LCD)
158 GPIO88 - VCCLCD_PWREN (LCD Panel PWREN)
159 GPIO97 - BACKLIGHT_EN
162 PWM - Leave unconfigured for now...
178 GPIO84 - SD_nIRQ_CD (SD-Card)
187 GPIO35 - AC97_SDATA_IN
188 GPIO37 - AC97_SDATA_OUT
218 SSP3 - Leave unconfigured for now...
232 static mfp_cfg_t mfp_cfg
[] __initdata
= {
235 GPIO49_U2D_PHYDATA_0
,
236 GPIO50_U2D_PHYDATA_1
,
237 GPIO51_U2D_PHYDATA_2
,
238 GPIO52_U2D_PHYDATA_3
,
239 GPIO53_U2D_PHYDATA_4
,
240 GPIO54_U2D_PHYDATA_5
,
241 GPIO55_U2D_PHYDATA_6
,
242 GPIO56_U2D_PHYDATA_7
,
248 GPIO71_GPIO
, /* USBD_INT */
253 GPIO100_U2D_TERM_SEL
,
255 GPIO102_UTM_LINESTATE_0
,
256 GPIO103_UTM_LINESTATE_1
,
257 GPIO4_2_GPIO
| MFP_PULL_HIGH
, /* UTM_PULLUP */
265 GPIO35_AC97_SDATA_IN_0
,
266 GPIO37_AC97_SDATA_OUT
,
269 GPIO40_AC97_nACRESET
,
307 GPIO72_GPIO
| MFP_PULL_HIGH
, /* Card Detect */
308 GPIO84_GPIO
| MFP_PULL_LOW
, /* Write Protect */
311 GPIO74_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ1 */
312 GPIO75_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ2 */
313 GPIO76_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ3 */
314 GPIO77_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ4 */
315 GPIO78_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ5 */
316 GPIO79_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ6 */
317 GPIO80_GPIO
| MFP_LPM_EDGE_RISE
, /* EXT_IRQ7 */
318 GPIO81_GPIO
| MFP_LPM_EDGE_RISE
/* EXT_IRQ8 */
321 /* MMC/MCI Support */
322 #if defined(CONFIG_MMC)
323 static struct pxamci_platform_data mxm_8x10_mci_platform_data
= {
324 .ocr_mask
= MMC_VDD_32_33
| MMC_VDD_33_34
,
325 .detect_delay_ms
= 10,
328 static struct gpiod_lookup_table mxm_8x10_mci_gpio_table
= {
329 .dev_id
= "pxa2xx-mci.0",
331 /* Card detect on GPIO 72 */
332 GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_nCD
,
333 "cd", GPIO_ACTIVE_LOW
),
334 /* Write protect on GPIO 84 */
335 GPIO_LOOKUP("gpio-pxa", MXM_8X10_SD_WP
,
336 "wp", GPIO_ACTIVE_LOW
),
341 void __init
mxm_8x10_mmc_init(void)
343 gpiod_add_lookup_table(&mxm_8x10_mci_gpio_table
);
344 pxa_set_mci_info(&mxm_8x10_mci_platform_data
);
348 /* USB Open Host Controller Interface */
349 static struct pxaohci_platform_data mxm_8x10_ohci_platform_data
= {
350 .port_mode
= PMM_NPS_MODE
,
351 .flags
= ENABLE_PORT_ALL
354 void __init
mxm_8x10_usb_host_init(void)
356 pxa_set_ohci_info(&mxm_8x10_ohci_platform_data
);
359 /* AC97 Sound Support */
360 static struct platform_device mxm_8x10_ac97_device
= {
361 .name
= "pxa2xx-ac97"
364 void __init
mxm_8x10_ac97_init(void)
366 platform_device_register(&mxm_8x10_ac97_device
);
369 /* NAND flash Support */
370 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
371 #define NAND_BLOCK_SIZE SZ_128K
372 #define NB(x) (NAND_BLOCK_SIZE * (x))
373 static struct mtd_partition mxm_8x10_nand_partitions
[] = {
378 .mask_flags
= MTD_WRITEABLE
384 .mask_flags
= MTD_WRITEABLE
395 .mask_flags
= MTD_WRITEABLE
399 static struct pxa3xx_nand_platform_data mxm_8x10_nand_info
= {
401 .parts
= mxm_8x10_nand_partitions
,
402 .nr_parts
= ARRAY_SIZE(mxm_8x10_nand_partitions
)
405 static void __init
mxm_8x10_nand_init(void)
407 pxa3xx_set_nand_info(&mxm_8x10_nand_info
);
410 static inline void mxm_8x10_nand_init(void) {}
411 #endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
413 /* Ethernet support: Davicom DM9000 */
414 static struct resource dm9k_resources
[] = {
416 .start
= MXM_8X10_ETH_PHYS
+ 0x300,
417 .end
= MXM_8X10_ETH_PHYS
+ 0x300,
418 .flags
= IORESOURCE_MEM
421 .start
= MXM_8X10_ETH_PHYS
+ 0x308,
422 .end
= MXM_8X10_ETH_PHYS
+ 0x308,
423 .flags
= IORESOURCE_MEM
426 .start
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9
)),
427 .end
= PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO9
)),
428 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
432 static struct dm9000_plat_data dm9k_plat_data
= {
433 .flags
= DM9000_PLATF_16BITONLY
436 static struct platform_device dm9k_device
= {
439 .num_resources
= ARRAY_SIZE(dm9k_resources
),
440 .resource
= dm9k_resources
,
442 .platform_data
= &dm9k_plat_data
446 static void __init
mxm_8x10_ethernet_init(void)
448 platform_device_register(&dm9k_device
);
452 static void __init
mxm_8x10_uarts_init(void)
454 pxa_set_ffuart_info(NULL
);
455 pxa_set_btuart_info(NULL
);
456 pxa_set_stuart_info(NULL
);
459 /* I2C and Real Time Clock */
460 static struct i2c_board_info __initdata mxm_8x10_i2c_devices
[] = {
462 I2C_BOARD_INFO("ds1337", 0x68)
466 static void __init
mxm_8x10_i2c_init(void)
468 i2c_register_board_info(0, mxm_8x10_i2c_devices
,
469 ARRAY_SIZE(mxm_8x10_i2c_devices
));
470 pxa_set_i2c_info(NULL
);
473 void __init
mxm_8x10_barebones_init(void)
475 pxa3xx_mfp_config(ARRAY_AND_SIZE(mfp_cfg
));
477 mxm_8x10_uarts_init();
478 mxm_8x10_nand_init();
480 mxm_8x10_ethernet_init();