diff mbox

[U-Boot,v3] USB: Remove __attribute__ ((packed)) for struct ehci_hccr and ehci_hcor

Message ID 1303343572-19972-28-git-send-email-jkridner@beagleboard.org
State Accepted
Commit 69716c1900274a89bd5cbd1b0bb276ceaaa04f61
Delegated to: Remy Bohmer
Headers show

Commit Message

Jason Kridner April 20, 2011, 11:52 p.m. UTC
Remove __attribute__ ((packed)) to prevent byte access to soc
registers in some gcc versions.

Having patches to enable ehci for the BeagleBoard lying around for
several month, this one was the show-stopper.

Credits have to go to Laine Walker-Avina <lwalkera@ieee.org> for
finding the problem.

Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
Cc: Alexander Holler <holler@ahsoftware.de>
Cc: Sandeep Paulraj <s-paulraj@ti.com>
---
Changes for v2:
* Original and v2 were provided by Alexander Holler.
* v1 was http://patchwork.ozlabs.org/patch/89358/
* v2 was http://patchwork.ozlabs.org/patch/89362/

Changes for v3:
* Switched to align(4), rather than remove the attribute, per suggestion
  from Alexander.
---
 drivers/usb/host/ehci.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Igor Grinberg April 21, 2011, 6:29 a.m. UTC | #1
On 04/21/11 02:52, Jason Kridner wrote:

> Remove __attribute__ ((packed)) to prevent byte access to soc
> registers in some gcc versions.
>
> Having patches to enable ehci for the BeagleBoard lying around for
> several month, this one was the show-stopper.
>
> Credits have to go to Laine Walker-Avina <lwalkera@ieee.org> for
> finding the problem.
>
> Signed-off-by: Jason Kridner <jkridner@beagleboard.org>
> Cc: Alexander Holler <holler@ahsoftware.de>
> Cc: Sandeep Paulraj <s-paulraj@ti.com>
> ---
> Changes for v2:
> * Original and v2 were provided by Alexander Holler.
> * v1 was http://patchwork.ozlabs.org/patch/89358/
> * v2 was http://patchwork.ozlabs.org/patch/89362/
>
> Changes for v3:
> * Switched to align(4), rather than remove the attribute, per suggestion
>   from Alexander.

Also fixing the commit message would help
as the change log won't be available after the patch applied.

> ---
>  drivers/usb/host/ehci.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
> index 945ab64..3d0ad0c 100644
> --- a/drivers/usb/host/ehci.h
> +++ b/drivers/usb/host/ehci.h
> @@ -55,7 +55,7 @@ struct ehci_hccr {
>  #define HCS_N_PORTS(p)		(((p) >> 0) & 0xf)
>  	uint32_t cr_hccparams;
>  	uint8_t cr_hcsp_portrt[8];
> -} __attribute__ ((packed));
> +} __attribute__ ((packed, aligned(4)));
>  
>  struct ehci_hcor {
>  	uint32_t or_usbcmd;
> @@ -85,7 +85,7 @@ struct ehci_hcor {
>  #define FLAG_CF		(1 << 0)	/* true:  we'll support "high speed" */
>  	uint32_t or_portsc[CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS];
>  	uint32_t or_systune;
> -} __attribute__ ((packed));
> +} __attribute__ ((packed, aligned(4)));
>  
>  #define USBMODE		0x68		/* USB Device mode */
>  #define USBMODE_SDIS	(1 << 3)	/* Stream disable */
diff mbox

Patch

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 945ab64..3d0ad0c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -55,7 +55,7 @@  struct ehci_hccr {
 #define HCS_N_PORTS(p)		(((p) >> 0) & 0xf)
 	uint32_t cr_hccparams;
 	uint8_t cr_hcsp_portrt[8];
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 struct ehci_hcor {
 	uint32_t or_usbcmd;
@@ -85,7 +85,7 @@  struct ehci_hcor {
 #define FLAG_CF		(1 << 0)	/* true:  we'll support "high speed" */
 	uint32_t or_portsc[CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS];
 	uint32_t or_systune;
-} __attribute__ ((packed));
+} __attribute__ ((packed, aligned(4)));
 
 #define USBMODE		0x68		/* USB Device mode */
 #define USBMODE_SDIS	(1 << 3)	/* Stream disable */