ISP1760 USB host driver, big endian and 16-bit data bus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

We use the ISP1760 USB host driver on our custom made board. The CPU is
an Atmel AVR32AP7000 processor (Big Endian) which is connected to the
ISP1760 chip with a 16-bit data bus.

Some modification had to be done to the ISP1760 host driver in order to
get it to work on our board.

I'm not sure if these modification are required due to big endian, the
16-bit data bus or due to some design problem on our board.

I would really appreciate some input on this. 

I'm attaching a patch below in order to describe which changes are
required for our system. This patch will need some work after it has
been establish which part are required for big endian and which part are
required for the 16-bit data bus.

I think that the cpu_to_lea32() lea32_to_cpu() might be due to big
endian and that the swahw32() are required for the 16-bit data bus.

I have no other system available with the ISP1760 chip so I cannot
verify this myself.

Any ideas of how these changes can be applied to the real driver?

The lea32 parts seems safe on little endian as well, but the swahw32()
will surely break the driver for other systems.

Best regards
Jonas Larsson
Martinsson Elektronik AB

---
diff --git a/drivers/usb/host/isp1760-hcd.c
b/drivers/usb/host/isp1760-hcd.c
index b899f1a..222710e 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -113,12 +113,12 @@ struct isp1760_qh {
 
 static unsigned int isp1760_readl(__u32 __iomem *regs)
 {
-	return readl(regs);
+	return swahw32(readl(regs));
 }
 
 static void isp1760_writel(const unsigned int val, __u32 __iomem *regs)
 {
-	writel(val, regs);
+	writel(swahw32(val), regs);
 }
 
 /*
@@ -137,7 +137,7 @@ static void priv_read_copy(struct isp1760_hcd *priv,
u32 *src,
 	}
 
 	while (len >= 4) {
-		*src = __raw_readl(dst);
+		*src = le32_to_cpu(isp1760_readl(dst));
 		len -= 4;
 		src++;
 		dst++;
@@ -165,7 +165,7 @@ static void priv_write_copy(const struct isp1760_hcd
*priv, const u32 *src,
 		__u32 __iomem *dst, u32 len)
 {
 	while (len >= 4) {
-		__raw_writel(*src, dst);
+		isp1760_writel(cpu_to_le32(*src), dst);
 		len -= 4;
 		src++;
 		dst++;
@@ -177,7 +177,7 @@ static void priv_write_copy(const struct isp1760_hcd
*priv, const u32 *src,
 	 * extra bytes should not be read by the HW
 	 */
 
-	__raw_writel(*src, dst);
+	isp1760_writel(cpu_to_le32(*src), dst);
 }
 
 /* memory management of the 60kb on the chip from 0x1000 to 0xffff */

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux