[U-Boot] [PATCH] net: dm9000x: use standard I/O accessors

The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros.
Signed-off-by: Mike Frysinger vapier@gentoo.org --- drivers/net/dm9000x.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index a7fef56..f121286 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value);
/* DM9000 network board routine ---------------------------- */
-#define DM9000_outb(d,r) ( *(volatile u8 *)r = d ) -#define DM9000_outw(d,r) ( *(volatile u16 *)r = d ) -#define DM9000_outl(d,r) ( *(volatile u32 *)r = d ) -#define DM9000_inb(r) (*(volatile u8 *)r) -#define DM9000_inw(r) (*(volatile u16 *)r) -#define DM9000_inl(r) (*(volatile u32 *)r) +#define DM9000_outb(d,r) outb(d, r) +#define DM9000_outw(d,r) outw(d, r) +#define DM9000_outl(d,r) outl(d, r) +#define DM9000_inb(r) inb(r) +#define DM9000_inw(r) inw(r) +#define DM9000_inl(r) inl(r)
#ifdef CONFIG_DM9000_DEBUG static void

Mike,
ApplOn 4/14/2010 1:29 PM, Mike Frysinger wrote:
The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros.
Signed-off-by: Mike Frysingervapier@gentoo.org
drivers/net/dm9000x.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index a7fef56..f121286 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value);
/* DM9000 network board routine ---------------------------- */
-#define DM9000_outb(d,r) ( *(volatile u8 *)r = d ) -#define DM9000_outw(d,r) ( *(volatile u16 *)r = d ) -#define DM9000_outl(d,r) ( *(volatile u32 *)r = d ) -#define DM9000_inb(r) (*(volatile u8 *)r) -#define DM9000_inw(r) (*(volatile u16 *)r) -#define DM9000_inl(r) (*(volatile u32 *)r) +#define DM9000_outb(d,r) outb(d, r) +#define DM9000_outw(d,r) outw(d, r) +#define DM9000_outl(d,r) outl(d, r) +#define DM9000_inb(r) inb(r) +#define DM9000_inw(r) inw(r) +#define DM9000_inl(r) inl(r)
#ifdef CONFIG_DM9000_DEBUG static void
Applied to net repo.
thanks, Ben

On 04/26/10 04:51, Ben Warren wrote:
Mike,
ApplOn 4/14/2010 1:29 PM, Mike Frysinger wrote:
The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros.
Signed-off-by: Mike Frysingervapier@gentoo.org
drivers/net/dm9000x.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index a7fef56..f121286 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value);
/* DM9000 network board routine ---------------------------- */
-#define DM9000_outb(d,r) ( *(volatile u8 *)r = d ) -#define DM9000_outw(d,r) ( *(volatile u16 *)r = d ) -#define DM9000_outl(d,r) ( *(volatile u32 *)r = d ) -#define DM9000_inb(r) (*(volatile u8 *)r) -#define DM9000_inw(r) (*(volatile u16 *)r) -#define DM9000_inl(r) (*(volatile u32 *)r) +#define DM9000_outb(d,r) outb(d, r) +#define DM9000_outw(d,r) outw(d, r) +#define DM9000_outl(d,r) outl(d, r) +#define DM9000_inb(r) inb(r) +#define DM9000_inw(r) inw(r) +#define DM9000_inl(r) inl(r)
#ifdef CONFIG_DM9000_DEBUG static void
Applied to net repo.
thanks, Ben _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Hi,
this patch breaks compilation for devkit8000 (ARM, Cortex-A8)
dm9000x.c: In function 'dm9000_outblk_8bit': dm9000x.c:148: warning: implicit declaration of function 'outb' dm9000x.c: In function 'dm9000_outblk_16bit': dm9000x.c:157: warning: implicit declaration of function 'outw' dm9000x.c: In function 'dm9000_outblk_32bit': dm9000x.c:165: warning: implicit declaration of function 'outl' dm9000x.c: In function 'dm9000_inblk_8bit': dm9000x.c:172: warning: implicit declaration of function 'inb' dm9000x.c: In function 'dm9000_inblk_16bit': dm9000x.c:181: warning: implicit declaration of function 'inw' dm9000x.c: In function 'dm9000_inblk_32bit': dm9000x.c:189: warning: implicit declaration of function 'inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:172: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `DM9000_ior': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:566: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:567: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `DM9000_iow': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:576: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:577: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:213: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:216: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:216: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:219: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:219: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:148: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:476: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_send': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:412: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:196: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:198: undefined reference to `inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:189: undefined reference to `inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:165: undefined reference to `outl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:205: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:207: undefined reference to `inw' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:208: undefined reference to `inw' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:181: undefined reference to `inw' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:157: undefined reference to `outw' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(bpabi.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_divdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' make: *** [u-boot] Error 1
I think the arch/arm/include/asm/io.h needs some rework with the __io definition. Is it the right way?
Thomas

On 07.05.2010 15:37, Thomas Weber wrote:
On 04/26/10 04:51, Ben Warren wrote:
Mike,
ApplOn 4/14/2010 1:29 PM, Mike Frysinger wrote:
The current dm9000x driver accesses its memory mapped registers directly instead of using the standard I/O accessors. This can cause problems on Blackfin systems as the accesses can get out of order. So convert the direct volatile dereferences to use the normal in/out macros.
Signed-off-by: Mike Frysingervapier@gentoo.org
drivers/net/dm9000x.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c index a7fef56..f121286 100644 --- a/drivers/net/dm9000x.c +++ b/drivers/net/dm9000x.c @@ -117,12 +117,12 @@ static void DM9000_iow(int reg, u8 value);
/* DM9000 network board routine ---------------------------- */
-#define DM9000_outb(d,r) ( *(volatile u8 *)r = d ) -#define DM9000_outw(d,r) ( *(volatile u16 *)r = d ) -#define DM9000_outl(d,r) ( *(volatile u32 *)r = d ) -#define DM9000_inb(r) (*(volatile u8 *)r) -#define DM9000_inw(r) (*(volatile u16 *)r) -#define DM9000_inl(r) (*(volatile u32 *)r) +#define DM9000_outb(d,r) outb(d, r) +#define DM9000_outw(d,r) outw(d, r) +#define DM9000_outl(d,r) outl(d, r) +#define DM9000_inb(r) inb(r) +#define DM9000_inw(r) inw(r) +#define DM9000_inl(r) inl(r)
#ifdef CONFIG_DM9000_DEBUG static void
Applied to net repo.
thanks, Ben _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Hi,
this patch breaks compilation for devkit8000 (ARM, Cortex-A8)
dm9000x.c: In function 'dm9000_outblk_8bit': dm9000x.c:148: warning: implicit declaration of function 'outb' dm9000x.c: In function 'dm9000_outblk_16bit': dm9000x.c:157: warning: implicit declaration of function 'outw' dm9000x.c: In function 'dm9000_outblk_32bit': dm9000x.c:165: warning: implicit declaration of function 'outl' dm9000x.c: In function 'dm9000_inblk_8bit': dm9000x.c:172: warning: implicit declaration of function 'inb' dm9000x.c: In function 'dm9000_inblk_16bit': dm9000x.c:181: warning: implicit declaration of function 'inw' dm9000x.c: In function 'dm9000_inblk_32bit': dm9000x.c:189: warning: implicit declaration of function 'inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:172: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `DM9000_ior': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:566: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:567: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `DM9000_iow': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:576: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:577: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:213: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:216: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:216: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:219: undefined reference to `inb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:219: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_8bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:148: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:476: undefined reference to `inb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_send': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:412: undefined reference to `outb' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:196: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:198: undefined reference to `inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:189: undefined reference to `inl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_32bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:165: undefined reference to `outl' drivers/net/libnet.a(dm9000x.o): In function `dm9000_rx_status_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:205: undefined reference to `outb' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:207: undefined reference to `inw' /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:208: undefined reference to `inw' drivers/net/libnet.a(dm9000x.o): In function `dm9000_inblk_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:181: undefined reference to `inw' drivers/net/libnet.a(dm9000x.o): In function `dm9000_outblk_16bit': /home/tweber/work/git/u-boot/drivers/net/dm9000x.c:157: undefined reference to `outw' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(bpabi.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_divdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/tweber/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' make: *** [u-boot] Error 1
I think the arch/arm/include/asm/io.h needs some rework with the __io definition. Is it the right way?
Thomas _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Hi,
#define __io
in devkit8000.h fixes the upper part of the error messages.
/home/thomas/toolchains/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(bpabi.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/thomas/toolchains/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_divdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' /home/thomas/toolchains/arm-2009q3/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0' make: *** [u-boot] Error 1
is still there.
Thomas
participants (4)
-
Ben Warren
-
Mike Frysinger
-
Thomas Weber
-
Thomas Weber