public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@googlemail.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@vger.kernel.org
Subject: Re: [PATCH 6/5] m68k/atari: set up timer D and register dummy handler if either EtherNEC or EtherNAT found
Date: Sun, 01 Apr 2012 17:57:45 +1200	[thread overview]
Message-ID: <4F77EE59.9040408@gmail.com> (raw)
In-Reply-To: <4F77E029.1090605@gmail.com>

Hi Geert,

this may clash somewhat with the patch you sent a few days ago (return 
-ENODEV if not running on Atari), the last hunk probably needs manual 
merging.

Probe for EtherNEC as well by checking the base register is accessible. 
If either EtherNEC or EtherNAT are found, set up MFP timer D as 200 Hz 
timer, and register a dummy interrupt handler to ensure the unhandled 
interrupt watchdog does not kick in.

Without the dummy handler, your only chance of keeping the ethernet 
device alive is keeping traffic up (ping your router) or rely on 
CONFIG_NETPOLL being active (that operates off the 100 Hz jiffies timer 
so it's going to be slower).

Also, enable the EtherNAT 91C111 interrupt so we could switch to 
interrupt driven operation there (will happen on one of the next patches 
converting EtherNAT to use smc91x.c). Also enabling the ISP1160 
interrupt will hang the system, alas.

I'd love to defer setting up the timer until the first timer D interrupt 
handler is registered, same with the EtherNAT interrupts. What's the 
best way to go about that?

Cheers,

  Michael

Signed-off-by: Michael Schmitz <schmitz@debian.org>

--
 arch/m68k/atari/config.c |   49 
+++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index aceebc2..22375e0 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -663,6 +663,8 @@ static void atari_get_hardware_list(struct seq_file *m)
  * MSch: initial platform device support for Atari, required for EtherNAT
  */
 
+#define ATARI_ETHERNEC_PHYS_ADDR    0xfffa0000
+
 #define ATARI_ETHERNAT_PHYS_ADDR    0x80000000
 #define ATARI_ETHERNAT_IRQ        196
 
@@ -746,24 +748,61 @@ static struct platform_device isp1160_device = {
 
 };
 
-static struct platform_device *atari_platform_devices[] __initdata = {
+static struct platform_device *atari_ethernat_devices[] __initdata = {
     &smc91x_device,
     &isp1160_device
 };
 
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC) || IS_ENABLED(CONFIG_ATARI_ETHERNAT)
+irqreturn_t atari_timerd_interrupt(int irq, void *dev_id)
+{
+    return IRQ_HANDLED;
+}
+#endif
+
 int __init atari_platform_init(void)
 {
-    int rv = -ENODEV;
-    unsigned char *enatc_virt;
+    int rv = -ENODEV, ret, need_timer = 0;
+    unsigned char *enatc_virt, *enec_virt;
 
     if (!MACH_IS_ATARI)
         return -ENODEV;
 
+#if IS_ENABLED(CONFIG_ATARI_ETHERNEC)
+    enec_virt = (unsigned char *)ioremap((ATARI_ETHERNEC_PHYS_ADDR), 0xf);
+    if (hwreg_present(enec_virt)) {
+        need_timer = 1;
+    }
+    iounmap(enec_virt);
+#endif
+
+#if IS_ENABLED(CONFIG_ATARI_ETHERNAT)
     enatc_virt = (unsigned char 
*)ioremap((ATARI_ETHERNAT_PHYS_ADDR+0x23), 0xf);
-    if (hwreg_present(enatc_virt))
-        rv = platform_add_devices(atari_platform_devices, 
ARRAY_SIZE(atari_platform_devices));
+    if (hwreg_present(enatc_virt)) {
+        need_timer = 1;        /* for now */
+        /* possibly defer until interrupt is registered ? */
+        *enatc_virt |= 0x2;    /* 91C111 int only, use 0x6 to enable 
both interrupts */
+        rv = platform_add_devices(atari_ethernat_devices, 
ARRAY_SIZE(atari_ethernat_devices));
+    }
     iounmap(enatc_virt);
+#endif
+
+    if (need_timer) {
+        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 (ret) return ret;
     return rv;   
 }
 

  reply	other threads:[~2012-04-01  5:57 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 18:57 [PATCH] m68k/atari: EtherNEC - Convert ETHER_ADDR_LEN uses to ETH_ALEN Geert Uytterhoeven
2012-02-27  7:07 ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Michael Schmitz
2012-03-07 10:09   ` Geert Uytterhoeven
2012-03-07 18:42     ` Michael Schmitz
2012-04-01  3:02     ` [PATCH 3/5] m68k/atari: EtherNAT - register EtherNAT platform devices only when probed Michael Schmitz
2012-04-01  3:05     ` [PATCH 4/5] m68k/atari: EtherNAT - fix dumb compile error Michael Schmitz
2012-04-01  3:10     ` [PATCH 5/5] m68k/atari: EtherNAT - enable USB HCD config option on Atari Michael Schmitz
2012-04-01  4:57       ` [PATCH 6/5] m68k/atari: EtherNAT - use correct irq flag in atari_91C111 Michael Schmitz
2012-04-01  5:57         ` Michael Schmitz [this message]
2012-03-09  3:11   ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c Paul Gortmaker
2012-03-09  4:58     ` Michael Schmitz
2012-03-09  6:35     ` Geert Uytterhoeven
2012-03-09 13:32       ` Paul Gortmaker
2012-03-11  6:31         ` Michael Schmitz
2012-04-01  8:49         ` [PATCH] m68k/atari: EtherNEC - rewrite to use mainstream ne.c, take two Michael Schmitz
2012-04-03 22:52           ` David Miller
2012-04-04 20:46           ` Paul Gortmaker
2012-04-05  9:28             ` Geert Uytterhoeven
2012-04-05 13:24               ` Paul Gortmaker
2012-04-05 14:21                 ` Geert Uytterhoeven
2012-04-05 22:10               ` Michael Schmitz
2012-04-06  8:28                 ` Geert Uytterhoeven
2012-04-05  9:44             ` Michael Schmitz
2012-04-01  2:49   ` [PATCH 1/5] m68k/atari: EtherNAT - change number of Atari interrupts to make room for EtherNAT interrupts Michael Schmitz
2012-04-01 20:39     ` Geert Uytterhoeven
2012-04-01 22:44       ` Michael Schmitz
2012-04-02  7:35         ` Geert Uytterhoeven
2012-04-02 22:29           ` Michael Schmitz
2012-04-03 21:15             ` Michael Schmitz
2012-04-03 21:54               ` Thorsten Glaser
2012-04-03 22:21                 ` Michael Schmitz
2012-04-03 22:31                   ` Thorsten Glaser
2012-04-03 23:16                     ` Michael Schmitz
2012-04-06 21:43               ` Michael Schmitz
2012-04-01 21:00     ` Andreas Schwab
2012-04-01 21:46       ` Thorsten Glaser
2012-04-01 22:27         ` Michael Schmitz
2012-04-02  1:15     ` [PATCH] m68k/atari: EtherNAT patch series - resent as attachments Michael Schmitz
2012-04-01  2:58   ` [PATCH 2/5] m68k/atari: EtherNAT - add ISP1160 platform data Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F77EE59.9040408@gmail.com \
    --to=schmitzmic@googlemail.com \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox