All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sunlance probing problem
@ 2006-08-11 22:03 Krzysztof Helt
  2006-08-11 23:11 ` Eric Brower
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-11 22:03 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 660 bytes --]

From: Krzysztof Helt (krzysztof.h1@wp.pl)

The patch removes the "le" device from matching list of probed
devices.

Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)
---
The sunlance driver allows probing of three devices: le, ledma
and lebuffer. The "le" device is a child entry for either ledma
or lebuffer devices. Thus, each Ethernet adapter is probed twice
and registered as two Ethernet adapters.

I tested it on SS20 and 2.6.18-rc4 kernel.



----------------------------------------------------
Czy 10 minut rozmowy = ponad 11 zł oszczędności ?
Sprawdź: http://klik.wp.pl/?adr=http%3A%2F%2Ftelefon.wp.pl%2Foszczednosci.html&sid=842

[-- Attachment #2: lance-id.patch --]
[-- Type: application/octet-stream, Size: 705 bytes --]

diff -ur linux-2.6.17/drivers/net/sunlance.c linux-new/drivers/net/sunlance.c
--- linux-2.6.17/drivers/net/sunlance.c	2006-08-10 08:58:34.000000000 +0200
+++ linux-new/drivers/net/sunlance.c	2006-08-11 23:33:11.000000000 +0200
@@ -1569,9 +1569,7 @@
 	struct device_node *dp = dev->node;
 	int err;
 
-	if (!strcmp(dp->name, "le")) {
-		err = sparc_lance_probe_one(sdev, NULL, NULL);
-	} else if (!strcmp(dp->name, "ledma")) {
+	if (!strcmp(dp->name, "ledma")) {
 		struct sbus_dma *ledma = find_ledma(sdev);
 
 		err = sparc_lance_probe_one(sdev->child, ledma, NULL);
@@ -1602,9 +1600,6 @@
 
 static struct of_device_id sunlance_sbus_match[] = {
 	{
-		.name = "le",
-	},
-	{
 		.name = "ledma",
 	},
 	{

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sunlance probing problem
  2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
@ 2006-08-11 23:11 ` Eric Brower
  2006-08-11 23:27 ` David Miller
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Eric Brower @ 2006-08-11 23:11 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]

The "le" is not always a child of lebuffer or ledma.  Attached is
output from an SS2, where le hangs directly off sbus.  Granted, this
is an older "le" implementation.

This data was obtained from the old vger prtconf/examples repo.  I'm
not sure if this is still hosted somewhere, but I found it to be a
very good reference.

Thanks,
E

On 8/11/06, Krzysztof Helt <krzysztof.h1@wp.pl> wrote:
> From: Krzysztof Helt (krzysztof.h1@wp.pl)
>
> The patch removes the "le" device from matching list of probed
> devices.
>
> Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)
> ---
> The sunlance driver allows probing of three devices: le, ledma
> and lebuffer. The "le" device is a child entry for either ledma
> or lebuffer devices. Thus, each Ethernet adapter is probed twice
> and registered as two Ethernet adapters.
>
> I tested it on SS20 and 2.6.18-rc4 kernel.
>
>
>
> ----------------------------------------------------
> Czy 10 minut rozmowy = ponad 11 zł oszczędności ?
> Sprawdź: http://klik.wp.pl/?adr=http%3A%2F%2Ftelefon.wp.pl%2Foszczednosci.html&sid=842
>
>
>


-- 
E

[-- Attachment #2: ss2 --]
[-- Type: application/octet-stream, Size: 6367 bytes --]

System Configuration:  Sun Microsystems  sun4c
Memory size: 64 Megabytes
System Peripherals (PROM Nodes):

Node 0xffea19d8
    fb:  ffeb9440
    idprom:  01550800.20116dc5.2a097348.429fc3c3.00000000.00000000.00000000.00000000
    stdout-path:  '/zs@1,f1000000:a'
    stdin-path:  '/zs@1,f1000000:a'
    parity-calculated:  
    slave-only:  00000000
    mips-on:  00000028
    mmu-nctx:  00000010
    vac_hwflush:  00000001
    vac-linesize:  00000020
    buserr-type:  00000001
    clock-frequency:  02625a00
    name:  'SUNW,Sun 4/75'
    get-unum:  ffe8ecf0
    device_type:  'cpu'
    busmaster-regval:  00000007
    mips-off:  00000003
    mmu-npmg:  00000100
    vac-size:  00010000

    Node 0xffea4a74
        name:  'packages'

        Node 0xffeac508
            name:  'disk-label'

        Node 0xffeada40
            name:  'deblocker'

        Node 0xffeadc08
            name:  'obp-tftp'

    Node 0xffea59ac
        relative-addressing:  
        name:  'openprom'

    Node 0xffea59fc
        port-b-ignore-cd:  
        address:  ffeeb000
        device_type:  'serial'
        slave:  00000000
        intr:  0000000c.00000000
        reg:  00000001.f1000000.00000008
        name:  'zs'

    Node 0xffea5aa0
        address:  ffee9000
        port-b-ignore-cd:  
        port-a-ignore-cd:  
        keyboard:  
        device_type:  'serial'
        slave:  00000001
        intr:  0000000c.00000000
        reg:  00000001.f0000000.00000008
        name:  'zs'

    Node 0xffea5b90
        intr:  0000000d.00000000
        reg:  00000001.f7201000.00000008
        name:  'audio'

    Node 0xffea5c04
        address:  ffeea000
        reg:  00000001.f2000000.00000800
        model:  'mk48t02'
        name:  'eeprom'

    Node 0xffea5c78
        address:  ffeef000
        intr:  0000000a.00000000.0000000e.00000000
        reg:  00000001.f3000000.00000010
        name:  'counter-timer'

    Node 0xffea5cfc
        address:  ffeee000
        reg:  00000001.f4000000.00000004
        name:  'memory-error'

    Node 0xffea5d60
        address:  ffeed000
        reg:  00000001.f5000000.00000001
        name:  'interrupt-enable'

    Node 0xffea5dc8
        address:  ffeec003
        reg:  00000001.f7400003.00000001
        name:  'auxiliary-io'

    Node 0xffea5e2c
        scsi-initiator-id:  00000007
        burst-sizes:  0000007f
        clock-frequency:  01312d00
        ranges:  00000000.00000000.00000001.f8000000.02000000.00000001.00000000.00000001.fa000000.02000000.00000002.00000000.00000001.fc000000.02000000.00000003.00000000.00000001.fe000000.02000000
        slot-address-bits:  00000019
        reg:  00000001.f8000000.08000000
        device_type:  'hierarchical'
        name:  'sbus'

        Node 0xffeb5ae4
            reg:  00000000.00400000.00000010
            name:  'dma'

        Node 0xffeb5b28
            device_type:  'hierarchical'
            intr:  00000003.00000000
            reg:  00000000.00800000.00000040
            name:  'esp'

            Node 0xffeb6ee8
                device_type:  'block'
                name:  'sd'

            Node 0xffeb76f8
                device_type:  'byte'
                name:  'st'

        Node 0xffeb82e0
            device_type:  'network'
            busmaster-regval:  00000007
            intr:  00000005.00000000
            reg:  00000000.00c00000.00000004
            alias:  'le'
            name:  'le'

        Node 0xffeb9440
            intr:  00000007.00000000
            reg:  00000003.00000000.01000000
            dblbuf:  00000000
            vmsize:  00000001
            depth:  00000008
            height:  00000384
            awidth:  00000480
            linebytes:  00000480
            width:  00000480
            emulation:  'cgsix'
            montype:  00000000
            boardrev:  00000008
            pixfreq:  058a28d4
            hfreq:  0000f163
            vfreq:  00000042
            hbporch:  000000c0
            hsync:  00000080
            hfporch:  00000020
            vbporch:  0000001f
            vsync:  00000004
            vfporch:  00000002
            oscillators:  '92940500 105561000'
            chiprev:  00000006
            device_type:  'display'
            model:  'SUNW,501-1672'
            manufacturer:  'SUNW'
            name:  'cgsix'

    Node 0xffea76e8
        reg:  00000000.00000000.01000000.00000000.01000000.01000000.00000000.02000000.01000000.00000000.03000000.01000000
        available:  00000000.03ff4000.0000c000.00000000.01000000.02b77000.00000000.00000000.00fef000
        name:  'memory'

    Node 0xffea78f4
        available:  00000000.fff00000.00100000.00000000.ff290000.00a70000.00000000.ff000000.00001000.00000000.fc005000.01ffb000.00000000.f032e000.0bcd3000.00000000.f00b9000.00147000.00000000.e0000000.10004000.00000000.00000000.20000000.00000000.ffee5000.00004000.00000000.ffed5000.0000f000.00000000.ffd00000.00180000.00000000.fe000000.01000000
        reg:  00000000.00000000.20000000.00000000.e0000000.20000000
        name:  'virtual-memory'

    Node 0xffeb2aa8
        device_type:  'block'
        intr:  0000000b.00000000
        reg:  00000001.f7200000.00000008
        name:  'fd'

    Node 0xffeb4c3c
        name:  'options'
        selftest-#megs:  '1'
        oem-logo:  
        oem-logo?:  'false'
        oem-banner:  
        oem-banner?:  'false'
        output-device:  'screen'
        input-device:  'keyboard'
        sbus-probe-list:  '0123'
        keyboard-click?:  'false'
        keymap:  
        ttyb-rts-dtr-off:  'false'
        ttyb-ignore-cd:  'true'
        ttya-rts-dtr-off:  'false'
        ttya-ignore-cd:  'false'
        ttyb-mode:  '9600,8,n,1,-'
        ttya-mode:  '9600,8,n,1,-'
        fcode-debug?:  'false'
        diag-file:  
        diag-device:  'net'
        boot-file:  
        boot-device:  'disk'
        auto-boot?:  'true'
        watchdog-reboot?:  'false'
        local-mac-address?:  'false'
        use-nvramrc?:  'false'
        nvramrc:  
        screen-#columns:  '80'
        screen-#rows:  '34'
        sunmon-compat?:  'true'
        security-mode:  'none'
        security-password:  
        security-#badlogins:  '0'
        scsi-initiator-id:  '7'
        hardware-revision:  
        last-hardware-update:  
        testarea:  '85'
        mfg-switch?:  'false'
        diag-switch?:  'false'


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sunlance probing problem
  2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
  2006-08-11 23:11 ` Eric Brower
@ 2006-08-11 23:27 ` David Miller
  2006-08-12 13:20 ` Krzysztof Helt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2006-08-11 23:27 UTC (permalink / raw)
  To: sparclinux

From: "Eric Brower" <ebrower@gmail.com>
Date: Fri, 11 Aug 2006 16:11:49 -0700

> This data was obtained from the old vger prtconf/examples repo.  I'm
> not sure if this is still hosted somewhere, but I found it to be a
> very good reference.

It's present in the sources of the sparc-utils package that
most sparc dists ship.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sunlance probing problem
  2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
  2006-08-11 23:11 ` Eric Brower
  2006-08-11 23:27 ` David Miller
@ 2006-08-12 13:20 ` Krzysztof Helt
  2006-08-18  1:10 ` David Miller
  2006-08-18 17:32 ` Krzysztof Helt
  4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-12 13:20 UTC (permalink / raw)
  To: sparclinux

[-- Attachment #1: Type: text/plain, Size: 781 bytes --]

Dnia 12-08-2006 o godz. 1:11 Eric Brower napisał(a):
> The "le" is not always a child of lebuffer or ledma.  Attached is
> output from an SS2, where le hangs directly off sbus.  Granted,
this
> is an older "le" implementation.
> 

Thank you for the hint. This is a corrected patch which checks if
the "le" is child of ledma or lebuffer.

From: Krzysztof Helt (krzysztof.h1@wp.pl)

The patch skips probing of the "le" device if it is a child of
"ledma" or "lebuffer".

Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)
---
I tested it on SS20 and 2.6.18-rc4 kernel.


----------------------------------------------------
Czy 10 minut rozmowy = ponad 11 zł oszczędności ?
Sprawdź: http://klik.wp.pl/?adr=http%3A%2F%2Ftelefon.wp.pl%2Foszczednosci.html&sid=842

[-- Attachment #2: lance-id.patch --]
[-- Type: application/octet-stream, Size: 860 bytes --]

diff -upr linux-2.6.17/drivers/net/sunlance.c linux-new/drivers/net/sunlance.c
--- linux-2.6.17/drivers/net/sunlance.c	2006-08-10 08:58:34.000000000 +0200
+++ linux-new/drivers/net/sunlance.c	2006-08-12 15:02:20.000000000 +0200
@@ -1570,7 +1570,17 @@ static int __devinit sunlance_sbus_probe
 	int err;
 
 	if (!strcmp(dp->name, "le")) {
-		err = sparc_lance_probe_one(sdev, NULL, NULL);
+		if (sdev->parent) {
+			struct of_device *parent = &sdev->parent->ofdev;
+
+			if (!strcmp(parent->node->name, "ledma") ||
+			    !strcmp(parent->node->name, "lebuffer")) {
+				/* this is a child of already probed device */
+				err = 0;
+			} else
+				err = sparc_lance_probe_one(sdev->child, NULL, NULL);
+		} else
+			err = sparc_lance_probe_one(sdev->child, NULL, NULL);
 	} else if (!strcmp(dp->name, "ledma")) {
 		struct sbus_dma *ledma = find_ledma(sdev);
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sunlance probing problem
  2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
                   ` (2 preceding siblings ...)
  2006-08-12 13:20 ` Krzysztof Helt
@ 2006-08-18  1:10 ` David Miller
  2006-08-18 17:32 ` Krzysztof Helt
  4 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2006-08-18  1:10 UTC (permalink / raw)
  To: sparclinux

From: "Krzysztof Helt" <krzysztof.h1@wp.pl>
Date: Sat, 12 Aug 2006 15:20:55 +0200

> The patch skips probing of the "le" device if it is a child of
> "ledma" or "lebuffer".
> 
> Signed-off-by: Krzysztof Helt (krzysztof.h1@wp.pl)

If you return "0" as the error, the caller in the device probing layer
grabs a reference to the device which will be a leak of the undelying
of_device object.

A better way to fix this is probably to only match "le" and have
the probe code check the device parent for "ledma" or "lebuffer".
You should be able to confine all of your changes to the probe
match table and sunlance_sbus_probe().

Could you implement it like that and give it a test?

Thanks.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] sunlance probing problem
  2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
                   ` (3 preceding siblings ...)
  2006-08-18  1:10 ` David Miller
@ 2006-08-18 17:32 ` Krzysztof Helt
  4 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2006-08-18 17:32 UTC (permalink / raw)
  To: sparclinux

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="part44e5f9c6711d9", Size: 45 bytes --]

This is a multi-part message in MIME format.

[-- Attachment #2: Type: text/plain, Size: 1057 bytes --]



Dnia 18-08-2006 o godz. 3:10 David Miller napisał(a):
> If you return "0" as the error, the caller in the device
probing layer
> grabs a reference to the device which will be a leak of the
undelying
> of_device object.
> 
> A better way to fix this is probably to only match "le" and have
> the probe code check the device parent for "ledma" or "lebuffer".
> You should be able to confine all of your changes to the probe
> match table and sunlance_sbus_probe().
> 
> Could you implement it like that and give it a test?
> 
> Thanks.
> 

This is a tested patch according to your sugestions  (as far as 
I understood them).

Regards,
Krzysztof
PS. Forget the previous patch. It is incorrect if "le" is standalone.

----------------------------------------------------
Najnowsze odkrycie światowej muzyki- smacznej i snobistycznej.
Wschodząca gwiazda, wybitnie utalentowana Sophie Solomon
wraz z zespołem w Warszawie!!
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Fsophie_solomon_w_fabryce_trzciny.html&sid=846

[-- Attachment #3: lance-id.patch --]
[-- Type: application/octet-stream, Size: 1449 bytes --]

--- linux-2.6.17/drivers/net/sunlance.c	2006-08-10 08:23:30.000000000 +0200
+++ linux-2.6.17a/drivers/net/sunlance.c	2006-08-18 19:03:10.000000000 +0200
@@ -1566,20 +1566,21 @@ static int __exit sunlance_sun4_remove(v
 static int __devinit sunlance_sbus_probe(struct of_device *dev, const struct of_device_id *match)
 {
 	struct sbus_dev *sdev = to_sbus_device(&dev->dev);
-	struct device_node *dp = dev->node;
 	int err;
 
-	if (!strcmp(dp->name, "le")) {
-		err = sparc_lance_probe_one(sdev, NULL, NULL);
-	} else if (!strcmp(dp->name, "ledma")) {
-		struct sbus_dma *ledma = find_ledma(sdev);
+	if (sdev->parent) {
+		struct of_device *parent = &sdev->parent->ofdev;
 
-		err = sparc_lance_probe_one(sdev->child, ledma, NULL);
-	} else {
-		BUG_ON(strcmp(dp->name, "lebuffer"));
+		if (!strcmp(parent->node->name, "ledma")) {
+			struct sbus_dma *ledma = find_ledma(to_sbus_device(&parent->dev));
 
-		err = sparc_lance_probe_one(sdev->child, NULL, sdev);
-	}
+			err = sparc_lance_probe_one(sdev, ledma, NULL);
+		} else if (!strcmp(parent->node->name, "lebuffer")) {
+			err = sparc_lance_probe_one(sdev, NULL, to_sbus_device(&parent->dev));
+		} else
+			err = sparc_lance_probe_one(sdev, NULL, NULL);
+	} else
+		err = sparc_lance_probe_one(sdev, NULL, NULL);
 
 	return err;
 }
@@ -1604,12 +1605,6 @@ static struct of_device_id sunlance_sbus
 	{
 		.name = "le",
 	},
-	{
-		.name = "ledma",
-	},
-	{
-		.name = "lebuffer",
-	},
 	{},
 };
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-18 17:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-11 22:03 [PATCH] sunlance probing problem Krzysztof Helt
2006-08-11 23:11 ` Eric Brower
2006-08-11 23:27 ` David Miller
2006-08-12 13:20 ` Krzysztof Helt
2006-08-18  1:10 ` David Miller
2006-08-18 17:32 ` Krzysztof Helt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.