Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp767994ybh; Wed, 15 Jul 2020 14:58:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymxIv0TiUx2XDMUPZnTFaYBv3/VSn+W/rr9ylDIPWEpNkbODWTlKhxI18OrmgAKJAGyEZg X-Received: by 2002:a17:906:6d4d:: with SMTP id a13mr938070ejt.146.1594850318345; Wed, 15 Jul 2020 14:58:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594850318; cv=none; d=google.com; s=arc-20160816; b=rZy63lWS+jFnox2hoi9P1sCu/9sau9fV4gxtOq2i4bZljiqRH5zw3TKe9iKhtsLB4C JjB0kH7F2SQ1+eeyO5BlQKevtP3WAOFpoi07aFpw/AT2AjNiwo2Jgc5vpi6IK20l2eaP fiC8Mjwu1wUN1Do5+/ulAmWZJI2R0OzeXt7MsKfrIGHIr9la9VVccC2K9acTzUxdz+co W6Lv/11BnFkq8+60Ssf4eJO3rqRF+Bfdnkb4Lx7SQuJpeYD3QvSP0U0WB1l07fTQHaFc DRZZamWZgTTwJriiVcUAIKBcmctGbikSu7JincVA/Wah5NMS6HL14aJcT0Thm2kz7Zyn haZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3eUiatIt1Fivq/QAEvJHQ8Y1rS7lfhQ3Osi1k1oK4+Y=; b=DmttznhaSNwrGUv0eyAxjphynzinGjrgwETnkvtruT10Mx7WccsVjhZfs6Aezcn5zH dTS3zcX+T5t9+ZokFFyFjHJ6EgBTKKIqywXq1Du58T5JuPqhZBq3AVjzA6NYoImEIakP AcAsIFDzpiBDlEUJXjVmEwZQFa2pXHiXNxxBRH+d3gwmIHIzecBgC2to0q3jg4HXl+B8 tlg+ywhGeRgZHtw+dUrssQzr3G62QI3na8g4xfiOGgfo1ZGbl7/hsYugdsXC2klraXj3 EMY2EsC75uDSaqFMf3pZttG5bqJXQFer89nB2GyZBnkm5/NopQVk0iFnC0MHsx7B8DV+ cIHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f20si2284570edc.396.2020.07.15.14.58.15; Wed, 15 Jul 2020 14:58:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727043AbgGOV6G (ORCPT + 99 others); Wed, 15 Jul 2020 17:58:06 -0400 Received: from relay11.mail.gandi.net ([217.70.178.231]:35375 "EHLO relay11.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbgGOV6G (ORCPT ); Wed, 15 Jul 2020 17:58:06 -0400 Received: from localhost (lfbn-lyo-1-1676-121.w90-65.abo.wanadoo.fr [90.65.108.121]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay11.mail.gandi.net (Postfix) with ESMTPSA id 5973B100008; Wed, 15 Jul 2020 21:58:02 +0000 (UTC) Date: Wed, 15 Jul 2020 23:58:01 +0200 From: Alexandre Belloni To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Cristian Birsan , Felipe Balbi , Greg Kroah-Hartman , Ludovic Desroches , Nicolas Ferre , Songjun Wu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: Re: [PATCH RESEND 3/3] usb: gadget: udc: atmel: implement .pullup callback Message-ID: <20200715215801.GG23553@piout.net> References: <63121e624012996a2f6f5f3763270ad834667a12.1594231056.git.mirq-linux@rere.qmqm.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <63121e624012996a2f6f5f3763270ad834667a12.1594231056.git.mirq-linux@rere.qmqm.pl> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/07/2020 20:04:10+0200, Michał Mirosław wrote: > Implement udc->pullup callback, so that udc_connect/disconnect work. > This is needed for composite gadget, as it assumes udc_disconnect() > actually works and calls its ->disconnect callback. > > Signed-off-by: Michał Mirosław Acked-by: Alexandre Belloni > --- > drivers/usb/gadget/udc/atmel_usba_udc.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c > index 9342a3d24963..c5128c229c52 100644 > --- a/drivers/usb/gadget/udc/atmel_usba_udc.c > +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c > @@ -1028,6 +1028,7 @@ usba_udc_set_selfpowered(struct usb_gadget *gadget, int is_selfpowered) > return 0; > } > > +static int atmel_usba_pullup(struct usb_gadget *gadget, int is_on); > static int atmel_usba_start(struct usb_gadget *gadget, > struct usb_gadget_driver *driver); > static int atmel_usba_stop(struct usb_gadget *gadget); > @@ -1101,6 +1102,7 @@ static const struct usb_gadget_ops usba_udc_ops = { > .get_frame = usba_udc_get_frame, > .wakeup = usba_udc_wakeup, > .set_selfpowered = usba_udc_set_selfpowered, > + .pullup = atmel_usba_pullup, > .udc_start = atmel_usba_start, > .udc_stop = atmel_usba_stop, > .match_ep = atmel_usba_match_ep, > @@ -1957,6 +1959,24 @@ static irqreturn_t usba_vbus_irq_thread(int irq, void *devid) > return IRQ_HANDLED; > } > > +static int atmel_usba_pullup(struct usb_gadget *gadget, int is_on) > +{ > + struct usba_udc *udc = container_of(gadget, struct usba_udc, gadget); > + unsigned long flags; > + u32 ctrl; > + > + spin_lock_irqsave(&udc->lock, flags); > + ctrl = usba_readl(udc, CTRL); > + if (is_on) > + ctrl &= ~USBA_DETACH; > + else > + ctrl |= USBA_DETACH; > + usba_writel(udc, CTRL, ctrl); > + spin_unlock_irqrestore(&udc->lock, flags); > + > + return 0; > +} > + > static int atmel_usba_start(struct usb_gadget *gadget, > struct usb_gadget_driver *driver) > { > -- > 2.20.1 > -- Alexandre Belloni, Bootlin Embedded Linux and Kernel engineering https://bootlin.com