[{"id":1764717,"web_url":"http://patchwork.ozlabs.org/comment/1764717/","msgid":"<8a26b378-0ad4-d03f-a069-3505d54d51e4@denx.de>","list_archive_url":null,"date":"2017-09-07T13:21:33","subject":"Re: [U-Boot] [PATCH 1/5] dm: usb: Add a new USB controller\n\toperation 'get_max_xfer_size'","submitter":{"id":13,"url":"http://patchwork.ozlabs.org/api/people/13/","name":"Stefan Roese","email":"sr@denx.de"},"content":"Hi Bin,\n\nthanks for working on this. Without these 5 patches applied, loading\nfiles via \"load\" command from USB sticks results in U-Boot crashes.\nWith all these 5 patches applied, loading via FS now works as\nexpected. :)\n\nSo:\n\nTested-by: Stefan Roese <sr@denx.de>\n\nThank,\nStefan\n\nOn 07.09.2017 15:13, Bin Meng wrote:\n> The HCD may have limitation on the maximum bytes to be transferred\n> in a USB transfer. USB class driver needs to be aware of this.\n> \n> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>\n> ---\n> \n>   drivers/usb/host/usb-uclass.c | 11 +++++++++++\n>   include/usb.h                 | 22 +++++++++++++++++++++-\n>   2 files changed, 32 insertions(+), 1 deletion(-)\n> \n> diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c\n> index 0b8a501..bc44fc3 100644\n> --- a/drivers/usb/host/usb-uclass.c\n> +++ b/drivers/usb/host/usb-uclass.c\n> @@ -150,6 +150,17 @@ int usb_update_hub_device(struct usb_device *udev)\n>   \treturn ops->update_hub_device(bus, udev);\n>   }\n>   \n> +int usb_get_max_xfer_size(struct usb_device *udev, size_t *size)\n> +{\n> +\tstruct udevice *bus = udev->controller_dev;\n> +\tstruct dm_usb_ops *ops = usb_get_ops(bus);\n> +\n> +\tif (!ops->get_max_xfer_size)\n> +\t\treturn -ENOSYS;\n> +\n> +\treturn ops->get_max_xfer_size(bus, size);\n> +}\n> +\n>   int usb_stop(void)\n>   {\n>   \tstruct udevice *bus;\n> diff --git a/include/usb.h b/include/usb.h\n> index fad0401..0ddc082 100644\n> --- a/include/usb.h\n> +++ b/include/usb.h\n> @@ -766,6 +766,14 @@ struct dm_usb_ops {\n>   \t * representation of this hub can be updated (xHCI)\n>   \t */\n>   \tint (*update_hub_device)(struct udevice *bus, struct usb_device *udev);\n> +\n> +\t/**\n> +\t * get_max_xfer_size() - Get HCD's maximum transfer bytes\n> +\t *\n> +\t * The HCD may have limitation on the maximum bytes to be transferred\n> +\t * in a USB transfer. USB class driver needs to be aware of this.\n> +\t */\n> +\tint (*get_max_xfer_size)(struct udevice *bus, size_t *size);\n>   };\n>   \n>   #define usb_get_ops(dev)\t((struct dm_usb_ops *)(dev)->driver->ops)\n> @@ -939,7 +947,7 @@ int usb_new_device(struct usb_device *dev);\n>   int usb_alloc_device(struct usb_device *dev);\n>   \n>   /**\n> - * update_hub_device() - Update HCD's internal representation of hub\n> + * usb_update_hub_device() - Update HCD's internal representation of hub\n>    *\n>    * After a hub descriptor is fetched, notify HCD so that its internal\n>    * representation of this hub can be updated.\n> @@ -950,6 +958,18 @@ int usb_alloc_device(struct usb_device *dev);\n>   int usb_update_hub_device(struct usb_device *dev);\n>   \n>   /**\n> + * usb_get_max_xfer_size() - Get HCD's maximum transfer bytes\n> + *\n> + * The HCD may have limitation on the maximum bytes to be transferred\n> + * in a USB transfer. USB class driver needs to be aware of this.\n> + *\n> + * @dev:\t\tUSB device\n> + * @size:\t\tmaximum transfer bytes\n> + * @return 0 if OK, -ve on error\n> + */\n> +int usb_get_max_xfer_size(struct usb_device *dev, size_t *size);\n> +\n> +/**\n>    * usb_emul_setup_device() - Set up a new USB device emulation\n>    *\n>    * This is normally called when a new emulation device is bound. It tells\n>","headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xp1M23fL7z9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu,  7 Sep 2017 23:21:50 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 2A549C21DBE; Thu,  7 Sep 2017 13:21:45 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 94A0AC21D70;\n\tThu,  7 Sep 2017 13:21:43 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 3F19DC21D70; Thu,  7 Sep 2017 13:21:42 +0000 (UTC)","from mx1.mailbox.org (mx1.mailbox.org [80.241.60.212])\n\tby lists.denx.de (Postfix) with ESMTPS id F1C0DC21D5B\n\tfor <u-boot@lists.denx.de>; Thu,  7 Sep 2017 13:21:41 +0000 (UTC)","from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby mx1.mailbox.org (Postfix) with ESMTPS id B87D143896;\n\tThu,  7 Sep 2017 15:21:41 +0200 (CEST)","from smtp1.mailbox.org ([80.241.60.240])\n\tby hefe.heinlein-support.de (hefe.heinlein-support.de\n\t[91.198.250.172]) (amavisd-new, port 10030)\n\twith ESMTP id EzAxTT3zSJDy; Thu,  7 Sep 2017 15:21:34 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW\n\tautolearn=unavailable autolearn_force=no version=3.4.0","X-Virus-Scanned":"amavisd-new at heinlein-support.de","To":"Bin Meng <bmeng.cn@gmail.com>, Marek Vasut <marex@denx.de>,\n\tMasahiro Yamada <yamada.masahiro@socionext.com>,\n\tSimon Glass <sjg@chromium.org>,\n\tU-Boot Mailing List <u-boot@lists.denx.de>","References":"<1504790001-24715-1-git-send-email-bmeng.cn@gmail.com>","From":"Stefan Roese <sr@denx.de>","Message-ID":"<8a26b378-0ad4-d03f-a069-3505d54d51e4@denx.de>","Date":"Thu, 7 Sep 2017 15:21:33 +0200","MIME-Version":"1.0","In-Reply-To":"<1504790001-24715-1-git-send-email-bmeng.cn@gmail.com>","Content-Language":"en-US","Subject":"Re: [U-Boot] [PATCH 1/5] dm: usb: Add a new USB controller\n\toperation 'get_max_xfer_size'","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","Content-Transfer-Encoding":"base64","Content-Type":"text/plain; charset=\"utf-8\"; Format=\"flowed\"","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"}}]