From: Rogan Dawes <rogan@dawes.za.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] IDE_BUS unconditionally expects 2 devices per bus
Date: Sat, 14 Aug 2010 12:41:07 +0200 [thread overview]
Message-ID: <4C6672C3.202@dawes.za.net> (raw)
Hi folks
Since include/ide.h defines IDE_BUS(dev) as (dev >> 1), it ignores the
values of CONFIG_SYS_IDE_MAXBUS and CONFIG_SYS_MAXDEVICE, and
unconditionally expects an IDE bus to have two devices.
This expectation falls down with the Orion5x SATA support, which uses
that SATA controller in IDE compatability mode, but can obviously only
have one device per bus.
I'm not 100% sure whether the problem is with the IDE code, or with the
Orion5x code which identifies a drive at both "positions" on the IDE
bus. i.e. if I define CONFIG_SYS_IDE_MAXDEVICE as
(CONFIG_SYS_IDE_MAXBUS*2), I get the first drive shown twice, and the
second drive shown twice.
The following RFC patch works for me, but may well break other boards
that do not define CONFIG_SYS_IDE_MAXDEVICE and CONFIG_SYS_IDE_MAXBUS
properly:
diff --git a/include/ide.h b/include/ide.h
index 6a1b7ae..3f81fb1 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -24,7 +24,7 @@
#ifndef _IDE_H
#define _IDE_H
-#define IDE_BUS(dev) (dev >> 1)
+#define IDE_BUS(dev) (dev >> (CONFIG_SYS_IDE_MAXDEVICE /
CONFIG_SYS_IDE_MAXBUS - 1))
#define ATA_CURR_BASE(dev)
(CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
Ok, I'm sure it is line wrapped, tab-damaged, etc, and the line itself
is too long, but conceptually, would that be acceptable?
Thanks
Rogan
next reply other threads:[~2010-08-14 10:41 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-14 10:41 Rogan Dawes [this message]
2010-08-14 10:46 ` [U-Boot] IDE_BUS unconditionally expects 2 devices per bus Rogan Dawes
2010-08-14 11:45 ` Albert ARIBAUD
2010-08-15 20:35 ` [U-Boot] [PATCH] IDE: Don't assume there are always two " Rogan Dawes
2010-08-15 21:30 ` Wolfgang Denk
2010-08-16 5:47 ` [U-Boot] [PATCH v2] " Rogan Dawes
2010-08-16 5:47 ` [U-Boot] [PATCH] " Rogan Dawes
2010-08-26 13:16 ` Rogan Dawes
2010-09-04 8:22 ` Albert ARIBAUD
2010-09-04 9:07 ` Albert ARIBAUD
2010-09-05 21:23 ` Rogan Dawes
2010-09-05 22:19 ` Wolfgang Denk
2010-09-06 5:54 ` Albert ARIBAUD
2010-09-06 6:03 ` Rogan Dawes
2010-09-06 6:05 ` Wolfgang Denk
2010-09-06 6:45 ` Albert ARIBAUD
2010-09-06 8:18 ` Wolfgang Denk
2010-09-06 11:32 ` Albert ARIBAUD
2010-09-06 12:50 ` Wolfgang Denk
2010-09-06 17:15 ` Albert ARIBAUD
2010-09-06 19:35 ` Wolfgang Denk
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=4C6672C3.202@dawes.za.net \
--to=rogan@dawes.za.net \
--cc=u-boot@lists.denx.de \
/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