Patchwork [U-Boot,2/7] IDE: Don't assume there are always two devices per bus

login
register
mail settings
Submitter Rogan Dawes
Date March 18, 2011, 8:09 a.m.
Message ID <1300435803-4940-3-git-send-email-rogan@dawes.za.net>
Download mbox | patch
Permalink /patch/87501/
State Superseded
Headers show

Comments

Rogan Dawes - March 18, 2011, 8:09 a.m.
From: Rogan Dawes <rogan@dawes.za.net>

Some SATA controllers can operate in an IDE compatible mode (e.g. mvsata)
but will only ever have a single device per bus.

This allows the upcoming DNS323 port to properly identify and use
a drive on both SATA interfaces.
---
 include/ide.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Patch

diff --git a/include/ide.h b/include/ide.h
index 6a1b7ae..c812b28 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -24,7 +24,8 @@ 
 #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)])