18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/arch/arm/mach-mmp/flint.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Support for the Marvell Flint Development Platform.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *  Copyright (C) 2009 Marvell International Ltd.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include <linux/init.h>
118c2ecf20Sopenharmony_ci#include <linux/kernel.h>
128c2ecf20Sopenharmony_ci#include <linux/platform_device.h>
138c2ecf20Sopenharmony_ci#include <linux/smc91x.h>
148c2ecf20Sopenharmony_ci#include <linux/io.h>
158c2ecf20Sopenharmony_ci#include <linux/gpio.h>
168c2ecf20Sopenharmony_ci#include <linux/gpio-pxa.h>
178c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#include <asm/mach-types.h>
208c2ecf20Sopenharmony_ci#include <asm/mach/arch.h>
218c2ecf20Sopenharmony_ci#include "addr-map.h"
228c2ecf20Sopenharmony_ci#include "mfp-mmp2.h"
238c2ecf20Sopenharmony_ci#include "mmp2.h"
248c2ecf20Sopenharmony_ci#include "irqs.h"
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#include "common.h"
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define FLINT_NR_IRQS	(MMP_NR_IRQS + 48)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_cistatic unsigned long flint_pin_config[] __initdata = {
318c2ecf20Sopenharmony_ci	/* UART1 */
328c2ecf20Sopenharmony_ci	GPIO45_UART1_RXD,
338c2ecf20Sopenharmony_ci	GPIO46_UART1_TXD,
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	/* UART2 */
368c2ecf20Sopenharmony_ci	GPIO47_UART2_RXD,
378c2ecf20Sopenharmony_ci	GPIO48_UART2_TXD,
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci	/* SMC */
408c2ecf20Sopenharmony_ci	GPIO151_SMC_SCLK,
418c2ecf20Sopenharmony_ci	GPIO145_SMC_nCS0,
428c2ecf20Sopenharmony_ci	GPIO146_SMC_nCS1,
438c2ecf20Sopenharmony_ci	GPIO152_SMC_BE0,
448c2ecf20Sopenharmony_ci	GPIO153_SMC_BE1,
458c2ecf20Sopenharmony_ci	GPIO154_SMC_IRQ,
468c2ecf20Sopenharmony_ci	GPIO113_SMC_RDY,
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci	/*Ethernet*/
498c2ecf20Sopenharmony_ci	GPIO155_GPIO,
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci	/* DFI */
528c2ecf20Sopenharmony_ci	GPIO168_DFI_D0,
538c2ecf20Sopenharmony_ci	GPIO167_DFI_D1,
548c2ecf20Sopenharmony_ci	GPIO166_DFI_D2,
558c2ecf20Sopenharmony_ci	GPIO165_DFI_D3,
568c2ecf20Sopenharmony_ci	GPIO107_DFI_D4,
578c2ecf20Sopenharmony_ci	GPIO106_DFI_D5,
588c2ecf20Sopenharmony_ci	GPIO105_DFI_D6,
598c2ecf20Sopenharmony_ci	GPIO104_DFI_D7,
608c2ecf20Sopenharmony_ci	GPIO111_DFI_D8,
618c2ecf20Sopenharmony_ci	GPIO164_DFI_D9,
628c2ecf20Sopenharmony_ci	GPIO163_DFI_D10,
638c2ecf20Sopenharmony_ci	GPIO162_DFI_D11,
648c2ecf20Sopenharmony_ci	GPIO161_DFI_D12,
658c2ecf20Sopenharmony_ci	GPIO110_DFI_D13,
668c2ecf20Sopenharmony_ci	GPIO109_DFI_D14,
678c2ecf20Sopenharmony_ci	GPIO108_DFI_D15,
688c2ecf20Sopenharmony_ci	GPIO143_ND_nCS0,
698c2ecf20Sopenharmony_ci	GPIO144_ND_nCS1,
708c2ecf20Sopenharmony_ci	GPIO147_ND_nWE,
718c2ecf20Sopenharmony_ci	GPIO148_ND_nRE,
728c2ecf20Sopenharmony_ci	GPIO150_ND_ALE,
738c2ecf20Sopenharmony_ci	GPIO149_ND_CLE,
748c2ecf20Sopenharmony_ci	GPIO112_ND_RDY0,
758c2ecf20Sopenharmony_ci	GPIO160_ND_RDY1,
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_cistatic struct pxa_gpio_platform_data mmp2_gpio_pdata = {
798c2ecf20Sopenharmony_ci	.irq_base	= MMP_GPIO_TO_IRQ(0),
808c2ecf20Sopenharmony_ci};
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_cistatic struct smc91x_platdata flint_smc91x_info = {
838c2ecf20Sopenharmony_ci	.flags  = SMC91X_USE_16BIT | SMC91X_NOWAIT,
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_cistatic struct resource smc91x_resources[] = {
878c2ecf20Sopenharmony_ci	[0] = {
888c2ecf20Sopenharmony_ci		.start  = SMC_CS1_PHYS_BASE + 0x300,
898c2ecf20Sopenharmony_ci		.end    = SMC_CS1_PHYS_BASE + 0xfffff,
908c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_MEM,
918c2ecf20Sopenharmony_ci	},
928c2ecf20Sopenharmony_ci	[1] = {
938c2ecf20Sopenharmony_ci		.start  = MMP_GPIO_TO_IRQ(155),
948c2ecf20Sopenharmony_ci		.end    = MMP_GPIO_TO_IRQ(155),
958c2ecf20Sopenharmony_ci		.flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
968c2ecf20Sopenharmony_ci	}
978c2ecf20Sopenharmony_ci};
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cistatic struct platform_device smc91x_device = {
1008c2ecf20Sopenharmony_ci	.name           = "smc91x",
1018c2ecf20Sopenharmony_ci	.id             = 0,
1028c2ecf20Sopenharmony_ci	.dev            = {
1038c2ecf20Sopenharmony_ci		.platform_data = &flint_smc91x_info,
1048c2ecf20Sopenharmony_ci	},
1058c2ecf20Sopenharmony_ci	.num_resources  = ARRAY_SIZE(smc91x_resources),
1068c2ecf20Sopenharmony_ci	.resource       = smc91x_resources,
1078c2ecf20Sopenharmony_ci};
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_cistatic void __init flint_init(void)
1108c2ecf20Sopenharmony_ci{
1118c2ecf20Sopenharmony_ci	mfp_config(ARRAY_AND_SIZE(flint_pin_config));
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci	/* on-chip devices */
1148c2ecf20Sopenharmony_ci	mmp2_add_uart(1);
1158c2ecf20Sopenharmony_ci	mmp2_add_uart(2);
1168c2ecf20Sopenharmony_ci	platform_device_add_data(&mmp2_device_gpio, &mmp2_gpio_pdata,
1178c2ecf20Sopenharmony_ci				 sizeof(struct pxa_gpio_platform_data));
1188c2ecf20Sopenharmony_ci	platform_device_register(&mmp2_device_gpio);
1198c2ecf20Sopenharmony_ci
1208c2ecf20Sopenharmony_ci	/* off-chip devices */
1218c2ecf20Sopenharmony_ci	platform_device_register(&smc91x_device);
1228c2ecf20Sopenharmony_ci}
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ciMACHINE_START(FLINT, "Flint Development Platform")
1258c2ecf20Sopenharmony_ci	.map_io		= mmp_map_io,
1268c2ecf20Sopenharmony_ci	.nr_irqs	= FLINT_NR_IRQS,
1278c2ecf20Sopenharmony_ci	.init_irq       = mmp2_init_irq,
1288c2ecf20Sopenharmony_ci	.init_time	= mmp2_timer_init,
1298c2ecf20Sopenharmony_ci	.init_machine   = flint_init,
1308c2ecf20Sopenharmony_ci	.restart	= mmp_restart,
1318c2ecf20Sopenharmony_ciMACHINE_END
132