aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-hub.c
diff options
context:
space:
mode:
authorMatt Evans <matt@ozlabs.org>2011-03-28 22:40:46 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-05-02 19:42:49 -0400
commit28ccd2962c66556d7037b2d9f1c11cdcd3b805d5 (patch)
tree02bf9319e60c43c655a97aedeb76ec5171459508 /drivers/usb/host/xhci-hub.c
parent7fc2a61638ef78cdf8d65d5934782963a6e0fc66 (diff)
xhci: Make xHCI driver endian-safe
This patch changes the struct members defining access to xHCI device-visible memory to use __le32/__le64 where appropriate, and then adds swaps where required. Checked with sparse that all accesses are correct. MMIO accesses use readl/writel so already are performed LE, but prototypes now reflect this with __le*. There were a couple of (debug) instances of DMA pointers being truncated to 32bits which have been fixed too. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci-hub.c')
-rw-r--r--drivers/usb/host/xhci-hub.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a78f2ebd11b7..ae1d24cb9303 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -50,7 +50,7 @@ static void xhci_common_hub_descriptor(struct xhci_hcd *xhci,
50 temp |= 0x0008; 50 temp |= 0x0008;
51 /* Bits 6:5 - no TTs in root ports */ 51 /* Bits 6:5 - no TTs in root ports */
52 /* Bit 7 - no port indicators */ 52 /* Bit 7 - no port indicators */
53 desc->wHubCharacteristics = (__force __u16) cpu_to_le16(temp); 53 desc->wHubCharacteristics = cpu_to_le16(temp);
54} 54}
55 55
56/* Fill in the USB 2.0 roothub descriptor */ 56/* Fill in the USB 2.0 roothub descriptor */
@@ -314,7 +314,7 @@ void xhci_ring_device(struct xhci_hcd *xhci, int slot_id)
314} 314}
315 315
316static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci, 316static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
317 u16 wIndex, u32 __iomem *addr, u32 port_status) 317 u16 wIndex, __le32 __iomem *addr, u32 port_status)
318{ 318{
319 /* Don't allow the USB core to disable SuperSpeed ports. */ 319 /* Don't allow the USB core to disable SuperSpeed ports. */
320 if (hcd->speed == HCD_USB3) { 320 if (hcd->speed == HCD_USB3) {
@@ -331,7 +331,7 @@ static void xhci_disable_port(struct usb_hcd *hcd, struct xhci_hcd *xhci,
331} 331}
332 332
333static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue, 333static void xhci_clear_port_change_bit(struct xhci_hcd *xhci, u16 wValue,
334 u16 wIndex, u32 __iomem *addr, u32 port_status) 334 u16 wIndex, __le32 __iomem *addr, u32 port_status)
335{ 335{
336 char *port_change_bit; 336 char *port_change_bit;
337 u32 status; 337 u32 status;
@@ -376,7 +376,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
376 unsigned long flags; 376 unsigned long flags;
377 u32 temp, temp1, status; 377 u32 temp, temp1, status;
378 int retval = 0; 378 int retval = 0;
379 u32 __iomem **port_array; 379 __le32 __iomem **port_array;
380 int slot_id; 380 int slot_id;
381 struct xhci_bus_state *bus_state; 381 struct xhci_bus_state *bus_state;
382 382
@@ -664,7 +664,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
664 int i, retval; 664 int i, retval;
665 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 665 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
666 int ports; 666 int ports;
667 u32 __iomem **port_array; 667 __le32 __iomem **port_array;
668 struct xhci_bus_state *bus_state; 668 struct xhci_bus_state *bus_state;
669 669
670 if (hcd->speed == HCD_USB3) { 670 if (hcd->speed == HCD_USB3) {
@@ -709,7 +709,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
709{ 709{
710 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 710 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
711 int max_ports, port_index; 711 int max_ports, port_index;
712 u32 __iomem **port_array; 712 __le32 __iomem **port_array;
713 struct xhci_bus_state *bus_state; 713 struct xhci_bus_state *bus_state;
714 unsigned long flags; 714 unsigned long flags;
715 715
@@ -779,7 +779,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd)
779 779
780 if (DEV_HIGHSPEED(t1)) { 780 if (DEV_HIGHSPEED(t1)) {
781 /* enable remote wake up for USB 2.0 */ 781 /* enable remote wake up for USB 2.0 */
782 u32 __iomem *addr; 782 __le32 __iomem *addr;
783 u32 tmp; 783 u32 tmp;
784 784
785 /* Add one to the port status register address to get 785 /* Add one to the port status register address to get
@@ -801,7 +801,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)
801{ 801{
802 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 802 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
803 int max_ports, port_index; 803 int max_ports, port_index;
804 u32 __iomem **port_array; 804 __le32 __iomem **port_array;
805 struct xhci_bus_state *bus_state; 805 struct xhci_bus_state *bus_state;
806 u32 temp; 806 u32 temp;
807 unsigned long flags; 807 unsigned long flags;
@@ -875,7 +875,7 @@ int xhci_bus_resume(struct usb_hcd *hcd)
875 875
876 if (DEV_HIGHSPEED(temp)) { 876 if (DEV_HIGHSPEED(temp)) {
877 /* disable remote wake up for USB 2.0 */ 877 /* disable remote wake up for USB 2.0 */
878 u32 __iomem *addr; 878 __le32 __iomem *addr;
879 u32 tmp; 879 u32 tmp;
880 880
881 /* Add one to the port status register address to get 881 /* Add one to the port status register address to get