mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Pawel Laszczak" <pawell@cadence.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Daisy.Barrera@siriusxm.com, Cliff.Holden@siriusxm.com,
	"Tony Lindgren" <tony@atomide.com>,
	"Jean Delvare" <jdelvare@suse.de>,
	neal_liu@aspeedtech.com,
	"Linus Walleij" <linus.walleij@linaro.org>,
	egtvedt@samfundet.no, "Biju Das" <biju.das.jz@bp.renesas.com>,
	herve.codina@bootlin.com
Subject: Re: [PATCH v2 1/4] usb: cdns2: Device side header file for CDNS2 driver
Date: Thu, 20 Apr 2023 11:17:43 +0200	[thread overview]
Message-ID: <acf525da-9a22-472f-abbb-6d1519be8d2a@app.fastmail.com> (raw)
In-Reply-To: <20230420090101.80812-2-pawell@cadence.com>

On Thu, Apr 20, 2023, at 11:00, Pawel Laszczak wrote:
> Patch defines macros, registers and structures used by
> Device side driver.
>
> Signed-off-by: Pawel Laszczak <pawell@cadence.com>

> +struct cdns2_ep0_regs {
> +	__u8 rxbc;
> +	__u8 txbc;
> +	__u8 cs;
> +	__u8 reserved1[4];
> +	__u8 fifo;
> +	__le32 reserved2[94];
> +	__u8 setupdat[8];
> +	__u8 reserved4[88];
> +	__u8 maxpack;
> +} __packed;

> +struct cdns2_epx_base {
> +	__le16 rxbc;
> +	__u8 rxcon;
> +	__u8 rxcs;
> +	__le16 txbc;
> +	__u8 txcon;
> +	__u8 txcs;
> +} __packed;

> +struct cdns2_epx_regs {
> +	__le32 reserved[2];
> +	struct cdns2_epx_base ep[15];
> +	__u8 reserved2[290];
> +	__u8 endprst;
> +	__u8 reserved3[41];
> +	__le16 isoautoarm;
> +	__u8 reserved4[10];
> +	__le16 isodctrl;
> +	__le16 reserved5;
> +	__le16 isoautodump;
> +	__le32 reserved6;
> +	__le16 rxmaxpack[15];
> +	__le32 reserved7[65];
> +	__le32 rxstaddr[15];
> +	__u8 reserved8[4];
> +	__le32 txstaddr[15];
> +	__u8 reserved9[98];
> +	__le16 txmaxpack[15];
> +} __packed;

Register structures should generally not be __packed, otherwise
any multi-byte registers will be accessed as individual bytes
on architectures that have no unaligned load/store.

If you are worried about struct packing on OABI arm, you can
mark it as both __packed and __aligned(4). Most drivers just
avoid the problem by not defining these as structures but instead
use macros with register offsets.

      Arnd

  reply	other threads:[~2023-04-20  9:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20  9:00 [PATCH v2 0/4] Introduced new Cadence USBHS Driver Pawel Laszczak
2023-04-20  9:00 ` [PATCH v2 1/4] usb: cdns2: Device side header file for CDNS2 driver Pawel Laszczak
2023-04-20  9:17   ` Arnd Bergmann [this message]
2023-04-20  9:50     ` Pawel Laszczak
2023-04-20  9:00 ` [PATCH v2 2/4] usb: cdns2: Add main part of Cadence USBHS driver Pawel Laszczak
2023-04-20  9:43   ` Arnd Bergmann
2023-04-20 10:03     ` Pawel Laszczak
2023-04-20  9:01 ` [PATCH v2 3/4] usb: cdns2: Add tracepoints for CDNS2 driver Pawel Laszczak
2023-04-20  9:01 ` [PATCH v2 4/4] MAINTAINERS: add Cadence USBHS driver entry Pawel Laszczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acf525da-9a22-472f-abbb-6d1519be8d2a@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=Cliff.Holden@siriusxm.com \
    --cc=Daisy.Barrera@siriusxm.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=egtvedt@samfundet.no \
    --cc=gregkh@linuxfoundation.org \
    --cc=herve.codina@bootlin.com \
    --cc=jdelvare@suse.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=neal_liu@aspeedtech.com \
    --cc=pawell@cadence.com \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®