[U-Boot] IDE_BUS unconditionally expects 2 devices per bus

Albert ARIBAUD
2010-08-14T11:45:26Z

Le 14/08/2010 12:46, Rogan Dawes a ?crit :
> On 2010/08/14 12:41 PM, Rogan Dawes wrote:
>> -#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 an idiot! The reason was staring me in the face!
> ATA_CURR_BASE(dev) relies on IDE_BUS, which is why the same disk was
> being enumerated twice.
>
> It seems that the above patch is indeed correct.

Good findings, Rogan. :)

However, you should submit patches using git format-patch and git
send-email, both properly configured -- make sure format-patch has the
-s option and send-email has the proper e-mail address settings for
sender and recipient(s).

And before submitting, think of checking the patch with linux's
script/checkpatch.pl. --no-tree. At least it'll let you know about the
long line. Mind you, ide.h itself has several long lines, that
checkpatch won't tell you about since this is outside your patch. :)

I applied the change manually, With 2 busse and 2 devices on the ED Mini
(which has only one disk), I don't get the duplicate drive. With 1 bus
and 2 devices, I do see the disk twice. :(

Amicalement,
--
Albert.