[PATCH 5/11] Atari: conditonal platform device support for EtherNEC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From 6096935dbf755b6f958694f8659d6a021fe968f5 Mon Sep 17 00:00:00 2001
From: Michael Schmitz <schmitz@xxxxxxxxxx>
Date: Mon, 30 Apr 2012 20:10:22 +1200
Subject: [PATCH 05/11] [m68k] Atari: add platform support for EtherNEC (conditionalized)

---
 arch/m68k/atari/config.c |   69 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 67 insertions(+), 2 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 9a83537..87c640b 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -690,10 +690,47 @@ static struct platform_device *atari_ethernat_devices[] __initdata = {
 	&smc91x_device
 };
 
+#define ATARI_ETHERNEC_PHYS_ADDR	0xfffa0000
+#define ATARI_ETHERNEC_BASE		0x300
+#define ATARI_ETHERNEC_IRQ		IRQ_MFP_TIMD
+
+static struct resource rtl8019_resources[] = {
+	[0] = {
+		.name	= "rtl9019-regs",
+		.start	= ATARI_ETHERNEC_BASE,
+		.end	= ATARI_ETHERNEC_BASE + 0x20 - 1,
+		.flags	= IORESOURCE_IO,
+	},
+	[1] = {
+		.name	= "rtl9019-irq",
+		.start	= ATARI_ETHERNEC_IRQ,
+		.end	= ATARI_ETHERNEC_IRQ,
+		.flags	= IORESOURCE_IRQ,
+	},
+};
+
+static struct platform_device rtl8019_device = {
+	.name		= "ne",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(rtl8019_resources),
+	.resource	= rtl8019_resources,
+};
+
+static struct platform_device *atari_ethernec_devices[] __initdata = {
+	&rtl8019_device
+};
+
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD) 
+irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)
+{
+	return IRQ_HANDLED;
+}
+#endif
+
 int __init atari_platform_init(void)
 {
-	unsigned char *enatc_virt;
-	int rv = -ENODEV;
+	unsigned char *enatc_virt, *enec_virt;
+	int rv = -ENODEV, rv2 = -ENODEV, need_timer = 0;
 	
 	if (!MACH_IS_ATARI)
 		return -ENODEV;
@@ -706,6 +743,34 @@ int __init atari_platform_init(void)
 	}
 #endif
 
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNEC_OLD)
+	enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
+	if (hwreg_present(enec_virt)) {
+		need_timer = 1;
+		rv2 = platform_add_devices(atari_ethernec_devices, ARRAY_SIZE(atari_ethernec_devices));
+	}
+	iounmap(enec_virt);
+#endif
+
+	if (need_timer) {
+		int ret;
+		const char *name = "Timer D dummy interrupt";
+
+		/* timer routine set up in atari_ethernec_probe() */
+		/* set Timer D data Register */
+		st_mfp.tim_dt_d = 123;	/* 200 Hz */
+		/* start timer D, div = 1:100 */
+		st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 0xf0) | 0x6;
+		/* Must make this shared in case other timer ints are needed */
+		ret = request_irq(IRQ_MFP_TIMD, atari_timerd_interrupt, IRQF_SHARED, name, atari_timerd_interrupt);
+		if (ret) {
+			printk(KERN_ERR "atari_platform_init: failed to register dummy timer interrupt for EtherNEC/EtherNAT!\n");
+		}
+	}
+
+	if (rv2) 
+		return rv2;
+
 	return rv;
 }
 
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Video for Linux]     [Yosemite News]     [Linux S/390]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux