1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * linux/arch/arm/mach-mmp/tavorevb.c
4 *
5 * Support for the Marvell PXA910-based TavorEVB Development Platform.
6 */
7 #include <linux/gpio.h>
8 #include <linux/gpio-pxa.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/platform_device.h>
12 #include <linux/smc91x.h>
13
14 #include <asm/mach-types.h>
15 #include <asm/mach/arch.h>
16 #include "addr-map.h"
17 #include "mfp-pxa910.h"
18 #include "pxa910.h"
19 #include "irqs.h"
20
21 #include "common.h"
22
23 static unsigned long tavorevb_pin_config[] __initdata = {
24 /* UART2 */
25 GPIO47_UART2_RXD,
26 GPIO48_UART2_TXD,
27
28 /* SMC */
29 SM_nCS0_nCS0,
30 SM_ADV_SM_ADV,
31 SM_SCLK_SM_SCLK,
32 SM_SCLK_SM_SCLK,
33 SM_BE0_SM_BE0,
34 SM_BE1_SM_BE1,
35
36 /* DFI */
37 DF_IO0_ND_IO0,
38 DF_IO1_ND_IO1,
39 DF_IO2_ND_IO2,
40 DF_IO3_ND_IO3,
41 DF_IO4_ND_IO4,
42 DF_IO5_ND_IO5,
43 DF_IO6_ND_IO6,
44 DF_IO7_ND_IO7,
45 DF_IO8_ND_IO8,
46 DF_IO9_ND_IO9,
47 DF_IO10_ND_IO10,
48 DF_IO11_ND_IO11,
49 DF_IO12_ND_IO12,
50 DF_IO13_ND_IO13,
51 DF_IO14_ND_IO14,
52 DF_IO15_ND_IO15,
53 DF_nCS0_SM_nCS2_nCS0,
54 DF_ALE_SM_WEn_ND_ALE,
55 DF_CLE_SM_OEn_ND_CLE,
56 DF_WEn_DF_WEn,
57 DF_REn_DF_REn,
58 DF_RDY0_DF_RDY0,
59 };
60
61 static struct pxa_gpio_platform_data pxa910_gpio_pdata = {
62 .irq_base = MMP_GPIO_TO_IRQ(0),
63 };
64
65 static struct smc91x_platdata tavorevb_smc91x_info = {
66 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
67 };
68
69 static struct resource smc91x_resources[] = {
70 [0] = {
71 .start = SMC_CS1_PHYS_BASE + 0x300,
72 .end = SMC_CS1_PHYS_BASE + 0xfffff,
73 .flags = IORESOURCE_MEM,
74 },
75 [1] = {
76 .start = MMP_GPIO_TO_IRQ(80),
77 .end = MMP_GPIO_TO_IRQ(80),
78 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
79 }
80 };
81
82 static struct platform_device smc91x_device = {
83 .name = "smc91x",
84 .id = 0,
85 .dev = {
86 .platform_data = &tavorevb_smc91x_info,
87 },
88 .num_resources = ARRAY_SIZE(smc91x_resources),
89 .resource = smc91x_resources,
90 };
91
tavorevb_init(void)92 static void __init tavorevb_init(void)
93 {
94 mfp_config(ARRAY_AND_SIZE(tavorevb_pin_config));
95
96 /* on-chip devices */
97 pxa910_add_uart(1);
98 platform_device_add_data(&pxa910_device_gpio, &pxa910_gpio_pdata,
99 sizeof(struct pxa_gpio_platform_data));
100 platform_device_register(&pxa910_device_gpio);
101
102 /* off-chip devices */
103 platform_device_register(&smc91x_device);
104 }
105
106 MACHINE_START(TAVOREVB, "PXA910 Evaluation Board (aka TavorEVB)")
107 .map_io = mmp_map_io,
108 .nr_irqs = MMP_NR_IRQS,
109 .init_irq = pxa910_init_irq,
110 .init_time = pxa910_timer_init,
111 .init_machine = tavorevb_init,
112 .restart = mmp_restart,
113 MACHINE_END
114