Thomas Gleixner | 1d0ea06 | 2019-05-29 16:57:46 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 2 | /* |
| 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 Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 8 | */ |
| 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 Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 16 | #include <linux/gpio-pxa.h> |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 17 | #include <linux/interrupt.h> |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 18 | |
| 19 | #include <asm/mach-types.h> |
| 20 | #include <asm/mach/arch.h> |
Arnd Bergmann | b501fd7 | 2014-04-15 20:38:32 +0200 | [diff] [blame] | 21 | #include "addr-map.h" |
| 22 | #include "mfp-mmp2.h" |
| 23 | #include "mmp2.h" |
| 24 | #include "irqs.h" |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 25 | |
| 26 | #include "common.h" |
| 27 | |
Rob Herring | 8661fb9 | 2012-01-03 16:50:40 -0600 | [diff] [blame] | 28 | #define FLINT_NR_IRQS (MMP_NR_IRQS + 48) |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 29 | |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 30 | static 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 Miao | a8fb0b5 | 2010-12-18 21:57:07 +0800 | [diff] [blame] | 49 | GPIO155_GPIO, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 50 | |
| 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 Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 78 | static struct pxa_gpio_platform_data mmp2_gpio_pdata = { |
| 79 | .irq_base = MMP_GPIO_TO_IRQ(0), |
| 80 | }; |
| 81 | |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 82 | static struct smc91x_platdata flint_smc91x_info = { |
| 83 | .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT, |
| 84 | }; |
| 85 | |
| 86 | static 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 Zhuang | 4929f5a | 2011-10-10 16:03:51 +0800 | [diff] [blame] | 93 | .start = MMP_GPIO_TO_IRQ(155), |
| 94 | .end = MMP_GPIO_TO_IRQ(155), |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 95 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | static 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 | |
| 109 | static 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 Zhuang | b8f649f | 2013-04-09 18:12:04 +0800 | [diff] [blame] | 116 | platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata, |
| 117 | sizeof(struct pxa_gpio_platform_data)); |
Haojian Zhuang | 157d264 | 2011-10-17 20:37:52 +0800 | [diff] [blame] | 118 | platform_device_register(&mmp2_device_gpio); |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 119 | |
| 120 | /* off-chip devices */ |
| 121 | platform_device_register(&smc91x_device); |
| 122 | } |
| 123 | |
| 124 | MACHINE_START(FLINT, "Flint Development Platform") |
Eric Miao | 8022887 | 2010-07-15 17:50:13 +0800 | [diff] [blame] | 125 | .map_io = mmp_map_io, |
Haojian Zhuang | 0bd8696 | 2010-09-08 09:42:42 -0400 | [diff] [blame] | 126 | .nr_irqs = FLINT_NR_IRQS, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 127 | .init_irq = mmp2_init_irq, |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 128 | .init_time = mmp2_timer_init, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 129 | .init_machine = flint_init, |
Russell King | 9854a38 | 2011-11-05 15:40:09 +0000 | [diff] [blame] | 130 | .restart = mmp_restart, |
Haojian Zhuang | 2f7e8fa | 2009-12-04 09:41:28 -0500 | [diff] [blame] | 131 | MACHINE_END |