* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
@ 2010-06-23 19:18 Marek Vasut
2010-06-23 20:51 ` Wolfgang Denk
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2010-06-23 19:18 UTC (permalink / raw)
To: u-boot
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
---
common/cmd_ide.c | 22 +++++++++++++---------
1 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index 093ca9f..9c4b250 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -161,8 +161,8 @@ static uchar ide_wait (int dev, ulong t);
#define IDE_SPIN_UP_TIME_OUT 5000 /* 5 sec spin-up timeout */
-static void input_data(int dev, ulong *sect_buf, int words);
-static void output_data(int dev, ulong *sect_buf, int words);
+static void input_data(int dev, uint16_t *sect_buf, int words);
+static void output_data(int dev, uint16_t *sect_buf, int words);
static void ident_cpy (unsigned char *dest, unsigned char *src, unsigned int len);
#ifndef CONFIG_SYS_ATA_PORT_ADDR
@@ -526,7 +526,7 @@ __ide_outb(int dev, int port, unsigned char val)
{
debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
dev, port, val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
- outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
+ writeb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
}
void ide_outb (int dev, int port, unsigned char val)
__attribute__((weak, alias("__ide_outb")));
@@ -535,7 +535,7 @@ unsigned char inline
__ide_inb(int dev, int port)
{
uchar val;
- val = inb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
+ val = readb((ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
debug ("ide_inb (dev= %d, port= 0x%x) : @ 0x%08lx -> 0x%02x\n",
dev, port, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)), val);
return val;
@@ -937,9 +937,11 @@ output_data(int dev, ulong *sect_buf, int words)
}
#else /* ! __PPC__ */
static void
-output_data(int dev, ulong *sect_buf, int words)
+output_data(int dev, uint16_t *sect_buf, int words)
{
- outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
+ int i;
+ for (i = 0; i < (words << 1); i++)
+ writew(sect_buf[i], ATA_CURR_BASE(dev)+ATA_DATA_REG);
}
#endif /* __PPC__ */
@@ -995,9 +997,11 @@ input_data(int dev, ulong *sect_buf, int words)
}
#else /* ! __PPC__ */
static void
-input_data(int dev, ulong *sect_buf, int words)
+input_data(int dev, uint16_t *sect_buf, int words)
{
- insw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words << 1);
+ int i;
+ for (i = 0; i < (words << 1); i++)
+ sect_buf[i] = readw(ATA_CURR_BASE(dev)+ATA_DATA_REG);
}
#endif /* __PPC__ */
@@ -1115,7 +1119,7 @@ static void ide_ident (block_dev_desc_t *dev_desc)
return;
#endif
- input_swap_data (device, iobuf, ATA_SECTORWORDS);
+ input_swap_data (device, (uint16_t *)iobuf, ATA_SECTORWORDS);
ident_cpy ((unsigned char*)dev_desc->revision, iop->fw_rev, sizeof(dev_desc->revision));
ident_cpy ((unsigned char*)dev_desc->vendor, iop->model, sizeof(dev_desc->vendor));
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-06-23 19:18 [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w] Marek Vasut
@ 2010-06-23 20:51 ` Wolfgang Denk
2010-06-24 0:36 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Wolfgang Denk @ 2010-06-23 20:51 UTC (permalink / raw)
To: u-boot
Dear Marek Vasut,
In message <1277320683-2057-1-git-send-email-marek.vasut@gmail.com> you wrote:
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> ---
> common/cmd_ide.c | 22 +++++++++++++---------
> 1 files changed, 13 insertions(+), 9 deletions(-)
I don't see the big advantage of this patch yet.
> #ifndef CONFIG_SYS_ATA_PORT_ADDR
> @@ -526,7 +526,7 @@ __ide_outb(int dev, int port, unsigned char val)
> {
> debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
> dev, port, val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> - outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> + writeb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
So we replace outb() => writeb(), but the function where this is used
is still __ide_outb() ?
The __ide_outb() => outb() mapping looks more logical to me.
> -output_data(int dev, ulong *sect_buf, int words)
> +output_data(int dev, uint16_t *sect_buf, int words)
> {
> - outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
> + int i;
> + for (i = 0; i < (words << 1); i++)
> + writew(sect_buf[i], ATA_CURR_BASE(dev)+ATA_DATA_REG);
And here the code size is growing, too.
What are the exact advantages of your version?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
We are all agreed that your theory is crazy. The question which
divides us is whether it is crazy enough to have a chance of being
correct. My own feeling is that it is not crazy enough. - Niels Bohr
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-06-23 20:51 ` Wolfgang Denk
@ 2010-06-24 0:36 ` Marek Vasut
2010-07-01 0:09 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2010-06-24 0:36 UTC (permalink / raw)
To: u-boot
Dne St 23. ?ervna 2010 22:51:28 Wolfgang Denk napsal(a):
> Dear Marek Vasut,
>
> In message <1277320683-2057-1-git-send-email-marek.vasut@gmail.com> you wrote:
> > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > ---
> >
> > common/cmd_ide.c | 22 +++++++++++++---------
> > 1 files changed, 13 insertions(+), 9 deletions(-)
>
> I don't see the big advantage of this patch yet.
It won't compile at least on ARM. Same case as with the dm9000 ethernet adapter.
>
> > #ifndef CONFIG_SYS_ATA_PORT_ADDR
> >
> > @@ -526,7 +526,7 @@ __ide_outb(int dev, int port, unsigned char val)
> >
> > {
> >
> > debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
> >
> > dev, port, val,
(ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> >
> > - outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> > + writeb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
>
> So we replace outb() => writeb(), but the function where this is used
> is still __ide_outb() ?
>
> The __ide_outb() => outb() mapping looks more logical to me.
See above.
>
> > -output_data(int dev, ulong *sect_buf, int words)
> > +output_data(int dev, uint16_t *sect_buf, int words)
> >
> > {
> >
> > - outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
> > + int i;
> > + for (i = 0; i < (words << 1); i++)
> > + writew(sect_buf[i], ATA_CURR_BASE(dev)+ATA_DATA_REG);
>
> And here the code size is growing, too.
Possibly, I was unsure if there is some implementation of writesw/readsw
elsewhere then on PPC.
>
> What are the exact advantages of your version?
That it actually compiles and works on other architectures than ppc.
>
> Best regards,
>
> Wolfgang Denk
Cheers
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-06-24 0:36 ` Marek Vasut
@ 2010-07-01 0:09 ` Marek Vasut
2010-07-01 0:44 ` Albert ARIBAUD
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2010-07-01 0:09 UTC (permalink / raw)
To: u-boot
Dne ?t 24. ?ervna 2010 02:36:00 Marek Vasut napsal(a):
> Dne St 23. ?ervna 2010 22:51:28 Wolfgang Denk napsal(a):
> > Dear Marek Vasut,
> >
> > In message <1277320683-2057-1-git-send-email-marek.vasut@gmail.com> you
wrote:
> > > Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
> > > ---
> > >
> > > common/cmd_ide.c | 22 +++++++++++++---------
> > > 1 files changed, 13 insertions(+), 9 deletions(-)
> >
> > I don't see the big advantage of this patch yet.
>
> It won't compile at least on ARM. Same case as with the dm9000 ethernet
> adapter.
>
> > > #ifndef CONFIG_SYS_ATA_PORT_ADDR
> > >
> > > @@ -526,7 +526,7 @@ __ide_outb(int dev, int port, unsigned char val)
> > >
> > > {
> > >
> > > debug ("ide_outb (dev= %d, port= 0x%x, val= 0x%02x) : @ 0x%08lx\n",
> > >
> > > dev, port, val,
>
> (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
>
> > > - outb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> > > + writeb(val, (ATA_CURR_BASE(dev)+CONFIG_SYS_ATA_PORT_ADDR(port)));
> >
> > So we replace outb() => writeb(), but the function where this is used
> > is still __ide_outb() ?
> >
> > The __ide_outb() => outb() mapping looks more logical to me.
>
> See above.
>
> > > -output_data(int dev, ulong *sect_buf, int words)
> > > +output_data(int dev, uint16_t *sect_buf, int words)
> > >
> > > {
> > >
> > > - outsw(ATA_CURR_BASE(dev)+ATA_DATA_REG, sect_buf, words<<1);
> > > + int i;
> > > + for (i = 0; i < (words << 1); i++)
> > > + writew(sect_buf[i], ATA_CURR_BASE(dev)+ATA_DATA_REG);
> >
> > And here the code size is growing, too.
>
> Possibly, I was unsure if there is some implementation of writesw/readsw
> elsewhere then on PPC.
>
> > What are the exact advantages of your version?
>
> That it actually compiles and works on other architectures than ppc.
>
> > Best regards,
> >
> > Wolfgang Denk
>
> Cheers
Any updates ?
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-07-01 0:09 ` Marek Vasut
@ 2010-07-01 0:44 ` Albert ARIBAUD
2010-07-01 3:33 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Albert ARIBAUD @ 2010-07-01 0:44 UTC (permalink / raw)
To: u-boot
Le 01/07/2010 02:09, Marek Vasut a ?crit :
>>>> common/cmd_ide.c | 22 +++++++++++++---------
>>>> 1 files changed, 13 insertions(+), 9 deletions(-)
>>>
>>> I don't see the big advantage of this patch yet.
>>
>> It won't compile at least on ARM. Same case as with the dm9000 ethernet
>> adapter.
>>> What are the exact advantages of your version?
>>
>> That it actually compiles and works on other architectures than ppc.
> Any updates ?
Actually I've compiled cmd_ide.c for ARM -- I just sent a patchset for
this. Required me to #define __io in my board's config, and also to
#define CONFIG_IDE_SWAP_IO, a new configuration option which replaces
the complex conditionals on __PPC__ et al.
Amicalement,
--
Albert.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-07-01 0:44 ` Albert ARIBAUD
@ 2010-07-01 3:33 ` Marek Vasut
2010-07-21 14:42 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2010-07-01 3:33 UTC (permalink / raw)
To: u-boot
Dne ?t 1. ?ervence 2010 02:44:01 Albert ARIBAUD napsal(a):
> Le 01/07/2010 02:09, Marek Vasut a ?crit :
> >>>> common/cmd_ide.c | 22 +++++++++++++---------
> >>>> 1 files changed, 13 insertions(+), 9 deletions(-)
> >>>
> >>> I don't see the big advantage of this patch yet.
> >>
> >> It won't compile at least on ARM. Same case as with the dm9000 ethernet
> >> adapter.
> >>
> >>> What are the exact advantages of your version?
> >>
> >> That it actually compiles and works on other architectures than ppc.
> >
> > Any updates ?
>
> Actually I've compiled cmd_ide.c for ARM -- I just sent a patchset for
> this. Required me to #define __io in my board's config,
Are you really supposed to #define __io in your config ?! I doubt that.
> and also to
> #define CONFIG_IDE_SWAP_IO, a new configuration option which replaces
> the complex conditionals on __PPC__ et al.
>
> Amicalement,
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w]
2010-07-01 3:33 ` Marek Vasut
@ 2010-07-21 14:42 ` Marek Vasut
0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2010-07-21 14:42 UTC (permalink / raw)
To: u-boot
Dne ?t 1. ?ervence 2010 05:33:46 Marek Vasut napsal(a):
> Dne ?t 1. ?ervence 2010 02:44:01 Albert ARIBAUD napsal(a):
> > Le 01/07/2010 02:09, Marek Vasut a ?crit :
> > >>>> common/cmd_ide.c | 22 +++++++++++++---------
> > >>>> 1 files changed, 13 insertions(+), 9 deletions(-)
> > >>>
> > >>> I don't see the big advantage of this patch yet.
> > >>
> > >> It won't compile at least on ARM. Same case as with the dm9000
> > >> ethernet adapter.
> > >>
> > >>> What are the exact advantages of your version?
> > >>
> > >> That it actually compiles and works on other architectures than ppc.
> > >
> > > Any updates ?
> >
> > Actually I've compiled cmd_ide.c for ARM -- I just sent a patchset for
> > this. Required me to #define __io in my board's config,
>
> Are you really supposed to #define __io in your config ?! I doubt that.
Bump? After some discussion with Wolfgang, we figured that'd be the easiest
temporary solution actually. But after I tried this approach, I git this
problem:
u-boot-pxa/arch/arm/lib/eabi_compat.o -L /usr/lib/gcc/arm-linux-gnueabi/4.4.4 -
lgcc -Map u-boot.map -o u-boot
common/libcommon.a(cmd_ide.o): In function `output_data':
/home/marex/PalmLD/u-boot-pxa/common/cmd_ide.c:904: undefined reference to
`__raw_writesw'
common/libcommon.a(cmd_ide.o): In function `input_data':
/home/marex/PalmLD/u-boot-pxa/common/cmd_ide.c:962: undefined reference to
`__raw_readsw'
/home/marex/PalmLD/u-boot-pxa/common/cmd_ide.c:962: undefined reference to
`__raw_readsw'
make: *** [u-boot] Error 1
So arm is missing the implementation of __raw_reads[bwl] etc.
>
> > and also to
> > #define CONFIG_IDE_SWAP_IO, a new configuration option which replaces
> > the complex conditionals on __PPC__ et al.
> >
> > Amicalement,
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-07-21 14:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-23 19:18 [U-Boot] [PATCH] cmd_ide: Convert to [read,write][b,w] Marek Vasut
2010-06-23 20:51 ` Wolfgang Denk
2010-06-24 0:36 ` Marek Vasut
2010-07-01 0:09 ` Marek Vasut
2010-07-01 0:44 ` Albert ARIBAUD
2010-07-01 3:33 ` Marek Vasut
2010-07-21 14:42 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox