blob: 9a7054368e5595d7d855b1db014ab6b78c20ba4e [file] [log] [blame]
Thomas Gleixner1d0ea062019-05-29 16:57:46 -07001// SPDX-License-Identifier: GPL-2.0-only
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -05002/*
3 * linux/arch/arm/mach-mmp/flint.c
4 *
5 * Support for the Marvell Flint Development Platform.
6 *
7 * Copyright (C) 2009 Marvell International Ltd.
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -05008 */
9
10#include <linux/init.h>
11#include <linux/kernel.h>
12#include <linux/platform_device.h>
13#include <linux/smc91x.h>
14#include <linux/io.h>
15#include <linux/gpio.h>
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080016#include <linux/gpio-pxa.h>
Haojian Zhuang0bd86962010-09-08 09:42:42 -040017#include <linux/interrupt.h>
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050018
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
Arnd Bergmannb501fd72014-04-15 20:38:32 +020021#include "addr-map.h"
22#include "mfp-mmp2.h"
23#include "mmp2.h"
24#include "irqs.h"
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050025
26#include "common.h"
27
Rob Herring8661fb92012-01-03 16:50:40 -060028#define FLINT_NR_IRQS (MMP_NR_IRQS + 48)
Haojian Zhuang0bd86962010-09-08 09:42:42 -040029
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050030static unsigned long flint_pin_config[] __initdata = {
31 /* UART1 */
32 GPIO45_UART1_RXD,
33 GPIO46_UART1_TXD,
34
35 /* UART2 */
36 GPIO47_UART2_RXD,
37 GPIO48_UART2_TXD,
38
39 /* SMC */
40 GPIO151_SMC_SCLK,
41 GPIO145_SMC_nCS0,
42 GPIO146_SMC_nCS1,
43 GPIO152_SMC_BE0,
44 GPIO153_SMC_BE1,
45 GPIO154_SMC_IRQ,
46 GPIO113_SMC_RDY,
47
48 /*Ethernet*/
Eric Miaoa8fb0b52010-12-18 21:57:07 +080049 GPIO155_GPIO,
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050050
51 /* DFI */
52 GPIO168_DFI_D0,
53 GPIO167_DFI_D1,
54 GPIO166_DFI_D2,
55 GPIO165_DFI_D3,
56 GPIO107_DFI_D4,
57 GPIO106_DFI_D5,
58 GPIO105_DFI_D6,
59 GPIO104_DFI_D7,
60 GPIO111_DFI_D8,
61 GPIO164_DFI_D9,
62 GPIO163_DFI_D10,
63 GPIO162_DFI_D11,
64 GPIO161_DFI_D12,
65 GPIO110_DFI_D13,
66 GPIO109_DFI_D14,
67 GPIO108_DFI_D15,
68 GPIO143_ND_nCS0,
69 GPIO144_ND_nCS1,
70 GPIO147_ND_nWE,
71 GPIO148_ND_nRE,
72 GPIO150_ND_ALE,
73 GPIO149_ND_CLE,
74 GPIO112_ND_RDY0,
75 GPIO160_ND_RDY1,
76};
77
Haojian Zhuangb8f649f2013-04-09 18:12:04 +080078static struct pxa_gpio_platform_data mmp2_gpio_pdata = {
79 .irq_base = MMP_GPIO_TO_IRQ(0),
80};
81
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050082static struct smc91x_platdata flint_smc91x_info = {
83 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
84};
85
86static struct resource smc91x_resources[] = {
87 [0] = {
88 .start = SMC_CS1_PHYS_BASE + 0x300,
89 .end = SMC_CS1_PHYS_BASE + 0xfffff,
90 .flags = IORESOURCE_MEM,
91 },
92 [1] = {
Haojian Zhuang4929f5a2011-10-10 16:03:51 +080093 .start = MMP_GPIO_TO_IRQ(155),
94 .end = MMP_GPIO_TO_IRQ(155),
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -050095 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
96 }
97};
98
99static struct platform_device smc91x_device = {
100 .name = "smc91x",
101 .id = 0,
102 .dev = {
103 .platform_data = &flint_smc91x_info,
104 },
105 .num_resources = ARRAY_SIZE(smc91x_resources),
106 .resource = smc91x_resources,
107};
108
109static void __init flint_init(void)
110{
111 mfp_config(ARRAY_AND_SIZE(flint_pin_config));
112
113 /* on-chip devices */
114 mmp2_add_uart(1);
115 mmp2_add_uart(2);
Haojian Zhuangb8f649f2013-04-09 18:12:04 +0800116 platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
117 sizeof(struct pxa_gpio_platform_data));
Haojian Zhuang157d2642011-10-17 20:37:52 +0800118 platform_device_register(&mmp2_device_gpio);
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500119
120 /* off-chip devices */
121 platform_device_register(&smc91x_device);
122}
123
124MACHINE_START(FLINT, "Flint Development Platform")
Eric Miao80228872010-07-15 17:50:13 +0800125 .map_io = mmp_map_io,
Haojian Zhuang0bd86962010-09-08 09:42:42 -0400126 .nr_irqs = FLINT_NR_IRQS,
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500127 .init_irq = mmp2_init_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700128 .init_time = mmp2_timer_init,
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500129 .init_machine = flint_init,
Russell King9854a382011-11-05 15:40:09 +0000130 .restart = mmp_restart,
Haojian Zhuang2f7e8fa2009-12-04 09:41:28 -0500131MACHINE_END