From patchwork Mon Mar 3 17:04:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 25618 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f197.google.com (mail-ve0-f197.google.com [209.85.128.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3ADCB206F3 for ; Mon, 3 Mar 2014 17:06:26 +0000 (UTC) Received: by mail-ve0-f197.google.com with SMTP id pa12sf11083005veb.0 for ; Mon, 03 Mar 2014 09:06:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=DI/hPMyTPOBPQddpZr5/+N//y3ahXaYy3jmNdV7WE2c=; b=hptJ47s+C9/KfSSRauJXYjBQC7RR5RrQMnANQ14zTnmXW9K7oc/av8LNN4rWm7Alm1 up+yfuIuXRHZYtNfAEMO8315zDdcwJdm/i+GiuHLEINOle/Y5FGFQORehGRa0hh1mvW4 eYatKJSi8WtQ2lfNGgfSmTc7sN532+D+jXUgKHe+ruGO8Azx+20usb3F65ymZtMXtuR/ dZCXKYUMQxUyT6g7vdeyb1RL33RDtn6iwvnb8UySvGlschM+dLlaMaTiNhq/L+UdcEGL AcQLkw7KIN0ULhN+/yyzqKvGgu++KTHYo7nyUNUqdelS2gUmP+BIbx4TJCC5ADvRf5sW 4gkQ== X-Gm-Message-State: ALoCoQnEtti8avwTJuKtuoyUMikDYsypr7pbrG8LY91cQpD4Cg3d5Tl76vXVOoJD+HLWQe/GrzUf X-Received: by 10.236.125.6 with SMTP id y6mr7989611yhh.3.1393866385977; Mon, 03 Mar 2014 09:06:25 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.70 with SMTP id l64ls2244318qge.16.gmail; Mon, 03 Mar 2014 09:06:25 -0800 (PST) X-Received: by 10.52.142.10 with SMTP id rs10mr354573vdb.3.1393866385811; Mon, 03 Mar 2014 09:06:25 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id fi2si3643459vdb.127.2014.03.03.09.06.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Mar 2014 09:06:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.176; Received: by mail-ve0-f176.google.com with SMTP id cz12so3829075veb.7 for ; Mon, 03 Mar 2014 09:06:25 -0800 (PST) X-Received: by 10.220.92.135 with SMTP id r7mr18049238vcm.11.1393866385518; Mon, 03 Mar 2014 09:06:25 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.130.193 with SMTP id u1csp67945vcs; Mon, 3 Mar 2014 09:06:25 -0800 (PST) X-Received: by 10.68.134.198 with SMTP id pm6mr19380989pbb.9.1393866384706; Mon, 03 Mar 2014 09:06:24 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si11268772pav.277.2014.03.03.09.06.24; Mon, 03 Mar 2014 09:06:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753720AbaCCRGN (ORCPT + 3 others); Mon, 3 Mar 2014 12:06:13 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:38679 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbaCCRGL (ORCPT ); Mon, 3 Mar 2014 12:06:11 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s23H6ASE029696 for ; Mon, 3 Mar 2014 11:06:10 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s23H6Aed013725 for ; Mon, 3 Mar 2014 11:06:10 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.174.1; Mon, 3 Mar 2014 11:06:10 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s23H69vO023231; Mon, 3 Mar 2014 11:06:10 -0600 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH] usb: gadget: add temporary __uses_feature_flags Date: Mon, 3 Mar 2014 11:04:02 -0600 Message-ID: <1393866242-14132-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.0 MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , during the conversion to a new method of finding proper endpoints, we need to give our users a grace period until full conversion is finished. This patch adds a new internal and temporary __uses_feature_flags flag which will tell gadget framework that this UDC has been converted to the new feature flag-based endpoint scheme. Once all gadget drivers are converted, this flag will be removed. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 1 + drivers/usb/gadget/epautoconf.c | 48 +++++++++++++++++++++-------------------- drivers/usb/gadget/s3c-hsotg.c | 1 + include/linux/usb/gadget.h | 2 ++ 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index eaf8537..54b40ce 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2733,6 +2733,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc->gadget.speed = USB_SPEED_UNKNOWN; dwc->gadget.sg_supported = true; dwc->gadget.name = "dwc3-gadget"; + dwc->gadget.__uses_feature_flags = true; /* * Per databook, DWC3 needs buffer size to be aligned to MaxPacketSize diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index d82ec71..1a71a14 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -61,31 +61,33 @@ ep_matches ( if (USB_ENDPOINT_XFER_CONTROL == type) return 0; - /* first check feature flags */ - if (usb_endpoint_dir_in(desc)) - if (!ep->has_dir_in) - return 0; + if (gadget->__uses_feature_flags) { + /* first check feature flags */ + if (usb_endpoint_dir_in(desc)) + if (!ep->has_dir_in) + return 0; - if (usb_endpoint_dir_out(desc)) - if (!ep->has_dir_out) - return 0; + if (usb_endpoint_dir_out(desc)) + if (!ep->has_dir_out) + return 0; - switch (type) { - case USB_ENDPOINT_XFER_CONTROL: - /* only ep0 */ - return 0; - case USB_ENDPOINT_XFER_BULK: - if (ep->has_bulk) - goto match; - break; - case USB_ENDPOINT_XFER_INT: - if (ep->has_interrupt) - goto match; - break; - case USB_ENDPOINT_XFER_ISOC: - if (ep->has_isochronous) - goto match; - break; + switch (type) { + case USB_ENDPOINT_XFER_CONTROL: + /* only ep0 */ + return 0; + case USB_ENDPOINT_XFER_BULK: + if (ep->has_bulk) + goto match; + break; + case USB_ENDPOINT_XFER_INT: + if (ep->has_interrupt) + goto match; + break; + case USB_ENDPOINT_XFER_ISOC: + if (ep->has_isochronous) + goto match; + break; + } } /* some other naming convention */ diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 9f9e2ce..c75576a 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c @@ -3641,6 +3641,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) hsotg->gadget.max_speed = USB_SPEED_HIGH; hsotg->gadget.ops = &s3c_hsotg_gadget_ops; hsotg->gadget.name = dev_name(dev); + hsotg->gadget.__uses_feature_flags = true; /* reset the system */ diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index abd836e..f52b191 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -536,6 +536,7 @@ struct usb_gadget_ops { * enabled HNP support. * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to * MaxPacketSize. + * @__uses_feature_flags: true when UDC uses new feature flags (temporary) * * Gadgets have a mostly-portable "gadget driver" implementing device * functions, handling all usb configurations and interfaces. Gadget @@ -576,6 +577,7 @@ struct usb_gadget { unsigned a_hnp_support:1; unsigned a_alt_hnp_support:1; unsigned quirk_ep_out_aligned_size:1; + unsigned __uses_feature_flags:1; }; #define work_to_gadget(w) (container_of((w), struct usb_gadget, work))