[U-Boot-Users] Wrong place to manage endianess for usbdev?

Rodolfo Giometti
2007-05-04T14:39:01Z

Hello,

I suppose is better using this patch:

diff --git a/include/usbdcore.h b/include/usbdcore.h
index cb2be72..72b9af2 100644
--- a/include/usbdcore.h
+++ b/include/usbdcore.h
@@ -56,10 +56,6 @@
#define usbinfo(fmt,args...) do{}while(0)
#endif

-#ifndef le16_to_cpu
-#define le16_to_cpu(x) (x)
-#endif
-
#ifndef inb
#define inb(p) (*(volatile u8*)(p))
#endif

Since defining le16_to_cpu() here is wrong. Each usbdevice driver
should be free of using itsown endianess definition.

In fact for my new driver I added:

diff --git a/drivers/usbtty.h b/drivers/usbtty.h
index 8154e30..051ead7 100644
--- a/drivers/usbtty.h
+++ b/drivers/usbtty.h
@@ -27,6 +27,8 @@
#include "usbdcore.h"
#if defined(CONFIG_PPC)
#include "usbdcore_mpc8xx.h"
+#elif defined(CONFIG_PXA27X)
+#include "usbdcore_pxa27x.h"
#elif defined(CONFIG_ARM)
#include "usbdcore_omap1510.h"
#endif

and inside usbdcore_pxa27x.h I use:

#include <asm/byteorder.h>

Ciao,

Rodolfo

P.S. Please note also that using CONFIG_ARM to include
usbdcore_omap1510.h is not the best... I think it should be replaced
with a proper CONFIG option.

--

GNU/Linux Solutions e-mail: giometti at enneenne.com
Linux Device Driver giometti at gnudd.com
Embedded Systems giometti at linux.it
UNIX programming phone: +39 349 2432127