[U-Boot] [PATCH 05/10] split CPC45 board-specific IDE functions from cmd_ide.c

Marek Vasut
2012-10-09T17:13:53Z

Dear Pavel Herrmann,

> On Sunday 07 of October 2012 20:20:08 Marek Vasut wrote:
> > Dear Pavel Herrmann,
> >
> > > Move input_data() and friends to board/cpc45/ide.c, as overrides for
> > > weak aliases in cmd_ide.c
> > >
> > > note: checkpatch emits warnings about using volatile
> > >
> > > Signed-off-by: Pavel Herrmann <morpheus.ibis@gmail.com>
> > > ---
> > >
> > > board/cpc45/Makefile | 2 +-
> > > board/cpc45/ide.c | 130
> > >
> > > +++++++++++++++++++++++++++++++++++++++++++++++++++ common/cmd_ide.c
> > > |
> > >
> > > 91 ------------------------------------
> > > 3 files changed, 131 insertions(+), 92 deletions(-)
> > > create mode 100644 board/cpc45/ide.c
> > >
> > > diff --git a/board/cpc45/Makefile b/board/cpc45/Makefile
> > > index 5c6b78f..ac1d174 100644
> > > --- a/board/cpc45/Makefile
> > > +++ b/board/cpc45/Makefile
> > > @@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk
> > >
> > > LIB = $(obj)lib$(BOARD).o
> > >
> > > -COBJS = $(BOARD).o flash.o plx9030.o pd67290.o
> > > +COBJS = $(BOARD).o flash.o plx9030.o pd67290.o ide.o
> > >
> > > SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
> > > OBJS := $(addprefix $(obj),$(COBJS))
> > >
> > > diff --git a/board/cpc45/ide.c b/board/cpc45/ide.c
> > > new file mode 100644
> > > index 0000000..7b7237b
> > > --- /dev/null
> > > +++ b/board/cpc45/ide.c
> > > @@ -0,0 +1,130 @@
> > > +/*
> > > + * (C) Copyright 2001
> > > + * Rob Taylor, Flying Pig Systems. robt at flyingpig.com.
> > > + *
> > > + * (C) Copyright 2000-2011
> > > + * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
> > > + *
> > > + * See file CREDITS for list of people who contributed to this
> > > + * project.
> > > + *
> > > + * This program is free software; you can redistribute it and/or
> > > + * modify it under the terms of the GNU General Public License as
> > > + * published by the Free Software Foundation; either version 2 of
> > > + * the License, or (at your option) any later version.
> > > + *
> > > + * This program is distributed in the hope that it will be useful,
> > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > > + * GNU General Public License for more details.
> > > + *
> > > + * You should have received a copy of the GNU General Public License
> > > + * along with this program; if not, write to the Free Software
> > > + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
> > > + * MA 02111-1307 USA
> > > + */
> > > +
> > > +#include <common.h>
> > > +#include <ide.h>
> > > +#include <ata.h>
> > > +
> > > +#define EIEIO __asm__ volatile ("eieio")
> > > +#define SYNC __asm__ volatile ("sync")
> >
> > Make it asm, not __asm__
> >
> > > +
> > > +void ide_input_swap_data(int dev, ulong *sect_buf, int words)
> > > +{
> > > + uchar i;
> > > + volatile uchar *pbuf_even =
> > > + (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_EVEN);
> > > + volatile uchar *pbuf_odd =
> > > + (uchar *) (ATA_CURR_BASE(dev) + ATA_DATA_ODD);
> > > + ushort *dbuf = (ushort *) sect_buf;
> >
> > What's this, some kind of __swab16() ?
>
> more probably this is a hack for strange wiring on the board

That much I see myself ... but the goo below does the same thing as swab16(),
doesn't it ?

> > > + while (words--) {
> > > + for (i = 0; i < 2; i++) {
> > > + *(((uchar *) (dbuf)) + 1) = *pbuf_even;
> > > + *(uchar *) dbuf = *pbuf_odd;
> > > + dbuf += 1;
> > > + }
> > > + }
> > > +}
> >
> > [...]
> >
> > I'm not reviewing this any further ... this is some ancient code, right?
>
> yes, this series is mostly cut-and-paste cleanup of old code, changes were
> made only when checkpatch didnt approve.
>
> Pavel Herrmann

Best regards,
Marek Vasut