Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1529582imu; Tue, 11 Dec 2018 22:58:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/WMX4FFUXqHWH+mqR7sV8fcuBWoNWQOA+AecwRXeNlc3DzCwbRieLatykz68pojPcxhBUxg X-Received: by 2002:a17:902:b093:: with SMTP id p19mr18739178plr.135.1544597891342; Tue, 11 Dec 2018 22:58:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544597891; cv=none; d=google.com; s=arc-20160816; b=u6HtHfI7TCEz3enPOOKysT/tCHIWDRFkuEf9wbJhf6bFk6NKk2SgOHjagtfu4f/qiC KyprgAg/bga2jgMOpkA0tulh5zpRSaU639KKlGssoyPFR9cbvXZfDTfx2lo2cGvJxia5 L/4AcMX8tWbKd9uFkaaQ6dkwrV5mLem9luKbtM8kx5xy2sCsbuwkqb8RiUDlfj8rzcnM SSGrk5fRnxWe+/e1jK/x74urZ6iOnl29K4E3KuaHR9p8KEQt1pG6ulPsm95NYOGkGAjv QD5520taxTWrlplFOPC6lVcb/s2GH1ogEVxAsi4tPhsBMHUe/NVhSSEczcxKPTjes8Az jFNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=9T2BD8+Qu/8dIYwEHHGpqA4ywvup2PYtqfSv2h+Lg1w=; b=uebFBWSLxckyvvtjSPVPilWRik2uu2eWBC79qeXXZyKn2wN0uZI7704K0zjuc9mzZx 1hcqX1201Ylww+EzrVlMxLXNxae6Qyu01qmRYc28oClkGhoxo3D2bZ5iOKN1qZ2W36FB xl/Her1XE/zhEDQuiqmzCurkY/JF3a4WEFOdKmGrXhqRqHvhr6X52H6SOx9JZG23PI2Q XeXDoUrKk51btL5JOt9ozL3mI3jlr+AT+4TQ2botsi33LpHVQCR1/79m7Qz3h/lQ2Fby mEECWx+xEO2xJG4mPnLWRnarYR4nWR6BOLa/ocxrUBXxwAnh+c8t216Z+x8C5qQ/BLL5 qFMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b7si14722530plb.234.2018.12.11.22.57.56; Tue, 11 Dec 2018 22:58:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726535AbeLLG4B (ORCPT + 99 others); Wed, 12 Dec 2018 01:56:01 -0500 Received: from mga05.intel.com ([192.55.52.43]:10734 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726253AbeLLG4A (ORCPT ); Wed, 12 Dec 2018 01:56:00 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2018 22:55:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,343,1539673200"; d="asc'?scan'208";a="303126965" Received: from pipin.fi.intel.com (HELO localhost) ([10.237.72.175]) by fmsmga005.fm.intel.com with ESMTP; 11 Dec 2018 22:55:55 -0800 From: Felipe Balbi To: Peter Chen , pawell@cadence.com Cc: devicetree@vger.kernel.org, Greg Kroah-Hartman , linux-usb@vger.kernel.org, rogerq@ti.com, lkml , adouglas@cadence.com, jbergsagel@ti.com, nsekhar@ti.com, nm@ti.com, sureshp@cadence.com, peter.chen@nxp.com, pjez@cadence.com, kurahul@cadence.com Subject: Re: [PATCH v1 2/2] usb:cdns3 Add Cadence USB3 DRD Driver In-Reply-To: References: <1544445555-17325-1-git-send-email-pawell@cadence.com> <1544445555-17325-3-git-send-email-pawell@cadence.com> <87h8fkmfar.fsf@linux.intel.com> Date: Wed, 12 Dec 2018 08:55:51 +0200 Message-ID: <877egfmdxk.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Peter Chen writes: >> >> + tmode =3D le16_to_cpu(ctrl->wIndex); >> >> + >> >> + if (!set || (tmode & 0xff) !=3D 0) >> >> + return -EINVAL; >> >> + >> >> + switch (tmode >> 8) { >> >> + case TEST_J: >> >> + case TEST_K: >> >> + case TEST_SE0_NAK: >> >> + case TEST_PACKET: >> >> + cdns3_set_register_bit(&priv_dev->regs->usb_cmd, >> >> + USB_CMD_STMODE | >> >> + USB_STS_TMODE_SEL(tmode -= 1)); >> > >> >I'm 90% sure this won't work. There's a reason why we only enter the >> >requested test mode from status stage. How have you tested this? >> > > What's the reason? > It can work although the code is a little different with above, I > tested it using USBxHSETT tool at Windows. put a sniffer. Status stage won't complete >> >> + irqreturn_t ret =3D IRQ_NONE; >> >> + unsigned long flags; >> >> + u32 reg; >> >> + >> >> + priv_dev =3D cdns->gadget_dev; >> >> + spin_lock_irqsave(&priv_dev->lock, flags); >> > >> >you're already running in hardirq context. Why do you need this lock at >> >all? I would be better to use the hardirq handler to mask your >> >interrupts, so they don't fire again, then used the top-half (softirq) >> >handler to actually handle the interrupts. >> > > This controller may be ran at SMP environment, register and flag access > needs to be protected among CPUs running. in hardirq context? When interrupts are already disabled? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEElLzh7wn96CXwjh2IzL64meEamQYFAlwQsPcACgkQzL64meEa mQaFMhAAivaFXmE5zk1145Lxf0qGZfICtUAOftRLhjxoE8QiyVaONzDrWmSfVZOV BFxf5p2YunTi5DEk2o/YVvDnmqmg5ctc5MASUeyuvBskEK8xAj5pcJ3zC4fGc10F roSp3Lh8VPvTy9p9Plzj6wqtCf6cGQGdmFhZU9m8uOBH+5venL7+l2Nr/i+YwFyN iq8s6YxT/qVNr311BZFokIH3ddfUNWRrizVfgfYORHU4NrSw5XV8185YvpRmZgbf Ji8F6PNxtwkdVDhYlBcdApxMTpwsz8ZksPuJ8g8NhRoyksxL4J02qQUykMcSEkDS h4H4+kMJWF+lC6a9Aj6KbaECK6IglZrkn7XLZURUmV6GxduvuiRWQ/FjAMbvrsYa DjSPCyrIH1SODNw26ij0N/EYtGMQqkM5voRYN1fDb+u1dTT8ZTYZAYbHMAUDX+Kv Fd3CZjeG7mQGWq7ctGWTKZAOA539rBczTN12YquxGneXa7xMjh4PuUfi6hqA9nxP 4S/+yyu51P1qrdCFjKcbiSd/SrPnOLLtKmb2tppokczi2H51XubfZcSNLha2OCfs edcJQnY1XSbB+fHuZ3mKtwP+5RzhTnSEvAor96/hz6WPGh2W2xgySWieoRR2jauO oOawN3NoHxsj8MTILERYcMKE3mfTZclHEv7Q58KjZTlssnudmDo= =kGLu -----END PGP SIGNATURE----- --=-=-=--