mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Barebox List <barebox@lists.infradead.org>
Subject: Re: [PATCH 07/12] imx-usb-loader: Add i.MX8MP support
Date: Fri, 29 Jul 2022 11:33:36 +0200	[thread overview]
Message-ID: <20220729093336.bndoyouyojwldgow@pengutronix.de> (raw)
In-Reply-To: <20220714072722.2863571-8-s.hauer@pengutronix.de>

Hi Sascha,

please see below.

On 22-07-14, Sascha Hauer wrote:
> For the i.MX8MP NXP dropped the SDP protocol used on other SoCs.
> Instead the image is just sent straight to the device.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  scripts/imx/imx-usb-loader.c | 37 +++++++++++++++++++++++++++---------
>  1 file changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
> index 5f7dc3bc0b..974ff741bf 100644
> --- a/scripts/imx/imx-usb-loader.c
> +++ b/scripts/imx/imx-usb-loader.c
> @@ -74,6 +74,7 @@ struct mach_id {
>  #define DEV_IMX		0
>  #define DEV_MXS		1
>  	unsigned char dev_type;
> +	unsigned char hid_endpoint;
>  };
>  
>  struct usb_work {
> @@ -180,6 +181,14 @@ static const struct mach_id imx_ids[] = {
>  		.header_type = HDR_MX53,
>  		.mode = MODE_HID,
>  		.max_transfer = 1024,
> +	}, {
> +		.vid = 0x1fc9,
> +		.pid = 0x0146,
> +		.name = "i.MX8MP",
> +		.header_type = HDR_MX53,
> +		.max_transfer = 1020,
> +		.mode = MODE_HID,
> +		.hid_endpoint = 1,
>  	}, {
>  		.vid = 0x1fc9,
>  		.pid = 0x012b,
> @@ -470,15 +479,22 @@ static int transfer(int report, unsigned char *p, unsigned cnt, int *last_trans)
>  
>  		if (report < 3) {
>  			memcpy(&tmp[1], p, cnt);
> -			err = libusb_control_transfer(usb_dev_handle,
> -					CTRL_OUT,
> -					HID_SET_REPORT,
> -					(HID_REPORT_TYPE_OUTPUT << 8) | report,
> -					0,
> -					tmp, cnt + 1, 1000);
> -			*last_trans = (err > 0) ? err - 1 : 0;
> -			if (err > 0)
> -				err = 0;
> +			if (mach_id->hid_endpoint) {
> +				int trans;
> +				err = libusb_interrupt_transfer(usb_dev_handle,
> +						mach_id->hid_endpoint, tmp, cnt + 1, &trans, 1000);
> +				*last_trans = trans - 1;
> +			} else {
> +				err = libusb_control_transfer(usb_dev_handle,
> +						CTRL_OUT,
> +						HID_SET_REPORT,
> +						(HID_REPORT_TYPE_OUTPUT << 8) | report,
> +						0,
> +						tmp, cnt + 1, 1000);
> +				*last_trans = (err > 0) ? err - 1 : 0;
> +				if (err > 0)
> +					err = 0;
> +			}
>  		} else {
>  			*last_trans = 0;
>  			memset(&tmp[1], 0, cnt);
> @@ -1353,6 +1369,9 @@ static int do_irom_download(struct usb_work *curr, int verify)
>  
>  	header_offset = ret;
>  
> +	if (mach_id->hid_endpoint)
> +		return send_file(buf + header_offset, fsize - header_offset);
                         ^
This function is defined nowhere and the compiler aborts. Did you forget
to send a patch defining this function?

Regards,
  Marco

> +
>  	if (plugin && (!curr->plug)) {
>  		printf("Only plugin header found\n");
>  		ret = -1;
> -- 
> 2.30.2
> 
> 
> 



  reply	other threads:[~2022-07-29  9:35 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14  7:27 [PATCH 00/12] imx-usb-loader support for i.MX8MP Sascha Hauer
2022-07-14  7:27 ` [PATCH 01/12] ARM: i.MX8MM: Prepare loading only piggydata in imx-usb-loader Sascha Hauer
2022-07-14  7:27 ` [PATCH 02/12] ARM: i.MX8M: Add romapi support Sascha Hauer
2022-07-14  7:27 ` [PATCH 03/12] ARM: i.MX8MP: Add common code to load image and jump to it via TF-A Sascha Hauer
2022-07-14  7:27 ` [PATCH 04/12] ARM: i.MX8MP-EVK: Use imx8mp_load_and_start_image_via_tfa() Sascha Hauer
2022-07-14  7:27 ` [PATCH 05/12] imx-usb-loader: Factor out common code to function Sascha Hauer
2022-07-14  7:27 ` [PATCH 06/12] imx-usb-loader: rename mxs functions Sascha Hauer
2022-07-14  7:27 ` [PATCH 07/12] imx-usb-loader: Add i.MX8MP support Sascha Hauer
2022-07-29  9:33   ` Marco Felsch [this message]
2022-08-08 12:20     ` Sascha Hauer
2022-07-14  7:27 ` [PATCH 08/12] imx-usb-loader: drop some casting Sascha Hauer
2022-07-14  7:27 ` [PATCH 09/12] imx-usb-loader: Fix first stage length Sascha Hauer
2022-07-14  7:27 ` [PATCH 10/12] imx-usb-loader: simplify read_memory() Sascha Hauer
2022-07-14  7:27 ` [PATCH 11/12] imx-usb-loader: verify correct image length Sascha Hauer
2022-07-14  7:27 ` [PATCH 12/12] imx-usb-loader: drop some unnecessary casting Sascha Hauer

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=20220729093336.bndoyouyojwldgow@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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