From: Friedrich Oslage <bluebird@gentoo.org>
To: sparclinux@vger.kernel.org
Subject: Re: Ultra1 ESP detection problem
Date: Sat, 14 Mar 2009 14:43:07 +0000 [thread overview]
Message-ID: <49BBC27B.4050200@gentoo.org> (raw)
In-Reply-To: <Pine.SOC.4.64.0903132344220.21922@math.ut.ee>
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
Meelis Roos schrieb:
> [ 60.565134] esp: probe of f0062a74 failed with error -12
I can reproduce this on my Ultra 2. I didn't notice it until now because
the boot disk is attached to an hme esp(which still works).
In esp_sbus_map_regs the of_ioremap call failes because res->start is 0
for non hme cards.
Basicly your tree looks like this:
SUNW,Ultra-1
sbus
SUNW,fas
espdma
esp
Of_bus_sbus_match works for "SUNW,fas" but not for "esp" because it only
checks the direct parent and not the parent's parent for name == "sbus".
This makes the kernel use of_bus_default_count_cells to calculate the
resources for "esp" instead of of_bus_sbus_count_cells.
And since of_bus_default_count_cells doesn't work for sbus systems the
resources of "esp" aren't detected.
I attached a patch, let me know if it works for you.
Cheers,
Friedrich
[-- Attachment #2: of_bus_sbus_match.patch --]
[-- Type: text/x-patch, Size: 2281 bytes --]
sparc: of_bus_sbus_match must also check the parent's parents.
To determine wheter the bus is sbus not only the direct parent but all the
parents of the parent must be checked, too.
In a tree like this
SUNW,Ultra-2
sbus
SUNW,hme
SUNW,fas
dma/espdma
esp
only checking the direct parent would make of_match_bus use
of_bus_default_count_cells for "esp", instead of the desired
of_bus_sbus_count_cells, and return an incorrect cell count. Which, in this
case, would make allocating resources for "esp" fail.
Reported-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: Friedrich Oslage <bluebird@gentoo.org>
---
arch/sparc/kernel/of_device_32.c | 13 +++++++++++--
arch/sparc/kernel/of_device_64.c | 13 +++++++++++--
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 0a83bd7..bee16a5 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -246,8 +246,17 @@ static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
static int of_bus_sbus_match(struct device_node *np)
{
- return !strcmp(np->name, "sbus") ||
- !strcmp(np->name, "sbi");
+ /* return true if the direct parent or any of the parent's parents is
+ * "sbus" or "sbi"
+ */
+ struct device_node *dp = np;
+
+ do {
+ if (!strcmp(dp->name, "sbus") || !strcmp(dp->name, "sbi"))
+ return 1;
+ } while ((dp = dp->parent));
+
+ return 0;
}
static void of_bus_sbus_count_cells(struct device_node *child,
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index b4a12c9..7a27cfd 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -301,8 +301,17 @@ static unsigned long of_bus_pci_get_flags(const u32 *addr, unsigned long flags)
static int of_bus_sbus_match(struct device_node *np)
{
- return !strcmp(np->name, "sbus") ||
- !strcmp(np->name, "sbi");
+ /* return true if the direct parent or any of the parent's parents is
+ * "sbus" or "sbi"
+ */
+ struct device_node *dp = np;
+
+ do {
+ if (!strcmp(dp->name, "sbus") || !strcmp(dp->name, "sbi"))
+ return 1;
+ } while ((dp = dp->parent));
+
+ return 0;
}
static void of_bus_sbus_count_cells(struct device_node *child,
next prev parent reply other threads:[~2009-03-14 14:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-13 22:24 Ultra1 ESP detection problem Meelis Roos
2009-03-13 22:35 ` David Miller
2009-03-13 22:40 ` Meelis Roos
2009-03-14 14:43 ` Friedrich Oslage [this message]
2009-03-14 21:14 ` David Miller
2009-03-14 21:42 ` Friedrich Oslage
2009-03-15 13:23 ` Meelis Roos
2009-03-16 3:32 ` David Miller
2009-04-17 11:10 ` David Miller
2009-04-19 9:16 ` Meelis Roos
2009-04-19 10:18 ` David Miller
2009-04-21 9:16 ` David Miller
2009-04-22 9:25 ` David Miller
2009-04-22 9:59 ` Meelis Roos
2009-04-22 10:37 ` Meelis Roos
2009-04-22 10:44 ` David Miller
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=49BBC27B.4050200@gentoo.org \
--to=bluebird@gentoo.org \
--cc=sparclinux@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 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.