[PATCH 07/12] imx-usb-loader: Add i.MX8MP support
Sascha Hauer
s.hauer at pengutronix.de
Mon Aug 8 05:20:09 PDT 2022
On Fri, Jul 29, 2022 at 11:33:36AM +0200, Marco Felsch wrote:
> 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 at 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?
Should be send_buf(). I renamed this function at some point during
rebasing.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list