From: Pete Popov <ppopov@mvista.com>
To: joeg@clearcore.com
Cc: Linux MIPS mailing list <linux-mips@linux-mips.org>
Subject: Re: [RFC] Au1x00 Ethernet driver
Date: 09 Jun 2003 10:20:50 -0700 [thread overview]
Message-ID: <1055179250.9976.24.camel@zeus.mvista.com> (raw)
In-Reply-To: <20030606180102.17899.qmail@clearcore.com>
Joe,
> The patch below detects if the interface is enabled and
> ignores it if it is disabled. It is part of what I need.
Seems reasonable, thanks. I'll test it later and apply it.
> I would like to use the same kernel for all cases and use phy
> detection to configure the interfaces. So I'm really asking if
> phy detection is acceptable for inclusion in the kernel? If so,
> I'll try to come up with acceptable patches.
>
> More generally, I'm wondering whether using autodetection for
> configuration is desirable as there are a number of other areas
> where I'd like to see it used.
The autodetection is nice, I think, as long as there's not too many
exception cases in how you do the detection. I recently added support
for a BCM dual phy and that code really didn't fit well in the current
scheme of things. If we start running into more and more of these cases,
we'll have to revisit the autodectection strategy.
It would also be nice to completely separate the phy layer from the MAC
so other drivers can use the same phy support routines.
Pete
> Joe
>
>
> --- linux-mips-cvs24/drivers/net/au1000_eth.c Mon Jun 2 21:35:28 2003
> +++ tst_mips24/drivers/net/au1000_eth.c Wed Jun 4 17:51:46 2003
> @@ -54,6 +54,7 @@
> #include <asm/io.h>
>
> #include <asm/au1000.h>
> +#include <asm/cpu.h>
> #include "au1000_eth.h"
>
> #ifdef AU1000_ETH_DEBUG
> @@ -109,27 +110,6 @@ extern char * __init prom_getcmdline(voi
> */
>
>
> -/*
> - * Base address and interupt of the Au1xxx ethernet macs
> - */
> -static struct au1if {
> - unsigned int port;
> - int irq;
> -} au1x00_iflist[] = {
> -#if defined(CONFIG_SOC_AU1000)
> - {AU1000_ETH0_BASE, AU1000_ETH0_IRQ},
> - {AU1000_ETH1_BASE, AU1000_ETH1_IRQ}
> -#elif defined(CONFIG_SOC_AU1500)
> - {AU1500_ETH0_BASE, AU1000_ETH0_IRQ},
> - {AU1500_ETH1_BASE, AU1000_ETH1_IRQ}
> -#elif defined(CONFIG_SOC_AU1100)
> - {AU1000_ETH0_BASE, AU1000_ETH0_IRQ},
> -#else
> -#error "Unsupported Au1x00 CPU"
> -#endif
> - };
> -#define NUM_INTERFACES (sizeof(au1x00_iflist) / sizeof(struct au1if))
> -
> static char version[] __devinitdata =
> "au1000eth.c:1.1 ppopov@mvista.com\n";
>
> @@ -1003,17 +983,40 @@ setup_hw_rings(struct au1000_private *au
> }
> }
>
> +/*
> + * Setup the base address and interupt of the Au1xxx ethernet macs
> + * based on cpu type and whether the interface is enabled in sys_pinfunc
> + * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
> + */
> static int __init au1000_init_module(void)
> {
> - int i;
> - int base_addr, irq;
> -
> - for (i=0; i<NUM_INTERFACES; i++) {
> - base_addr = au1x00_iflist[i].port;
> - irq = au1x00_iflist[i].irq;
> - if (au1000_probe1(NULL, base_addr, irq, i) != 0) {
> + struct cpuinfo_mips *c = ¤t_cpu_data;
> + int base_addr[2], irq[2], num_ifs, i;
> + int ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4);
> +
> + irq[0] = AU1000_ETH0_IRQ;
> + irq[1] = AU1000_ETH1_IRQ;
> + switch (c->cputype) {
> + case CPU_AU1000:
> + num_ifs = 2 - ni;
> + base_addr[0] = AU1000_ETH0_BASE;
> + base_addr[1] = AU1000_ETH1_BASE;
> + break;
> + case CPU_AU1100:
> + num_ifs = 1 - ni;
> + base_addr[0] = AU1000_ETH0_BASE;
> + break;
> + case CPU_AU1500:
> + num_ifs = 2 - ni;
> + base_addr[0] = AU1500_ETH0_BASE;
> + base_addr[1] = AU1500_ETH1_BASE;
> + break;
> + default:
> + num_ifs = 0;
> + }
> + for(i = 0; i < num_ifs; i++) {
> + if (au1000_probe1(NULL, base_addr[i], irq[i], i) != 0)
> return -ENODEV;
> - }
> }
> return 0;
> }
>
>
next prev parent reply other threads:[~2003-06-09 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-06 18:01 [RFC] Au1x00 Ethernet driver Joe George
2003-06-09 17:20 ` Pete Popov [this message]
2003-06-14 0:36 ` Pete Popov
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=1055179250.9976.24.camel@zeus.mvista.com \
--to=ppopov@mvista.com \
--cc=joeg@clearcore.com \
--cc=linux-mips@linux-mips.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