Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp461463pxb; Thu, 9 Sep 2021 05:07:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2IcyR6JM2G7HmDHlQTSphVZpzVX6ufpAshCmjuCe3WCq18QI4YY+ZZGTNRpW3/g0tYx3B X-Received: by 2002:a17:906:478d:: with SMTP id cw13mr2941229ejc.227.1631189254353; Thu, 09 Sep 2021 05:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631189254; cv=none; d=google.com; s=arc-20160816; b=JmcEGsfzDpedgoB2Kjd+SbPExEdt4hsxIuPChoX+jQa3pdZrKTLdCzOQ/UWbtAK4DA RBrPXo7ol1vb6OIVEGM9W1EBE5KasxP6ozgweGSL/nIKkRLhi5LlWjhoZFAt2i3HcxPN tb24PMJaXDB/MqiEbxhXMtl9Um4OzfVqf8Rnew2cB4qS5FixlVWw5vfuH51v6REGy4hP qUmmUFPjS55Q3XfUK/M+I3WKoDIsdhaYoHGqEoOeO+ndc0BlVZb0eumrlKoRqzIffovz H9QQ0+LNJKJOocMPN8kapfbqARQXv6JC3IRFXXDvikxpg47Y8dbs04zn9/eL2Y8LBAbU 1ceg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hADXbxkH20gzmaiMmYPjn2k8/tPl6IWl5X2qVG6Bov0=; b=oxE7ZITGbDwjTsndU8ISkOyxkB+gUNodcsT0v2CMwDGg4WOu1MWtlHiO39rnFBM5i7 Z7gq6q3PlhkwTdWo6AjUtWQSSvq0yGxLaHhNPR7NVltw4S5x9GQJmt7f1o+s6EqtYwM8 qlOcG2MN8U2xc49m3+thb/qH5nI5Oh7o3MV49YPUOI/bkppWGydkYV17e4+I5XGM9/Im y8RE1k4xbKJI8d+JOFNwzTz14LY3wiFaIuy9dBXl3pObXboMspq+vW/TKB4rlg0VHSiP V+OIew6Ss7LPJ6O5xRHCEwdNDYK9fOVni/aWi7kvuCWhRmZa3W6cOQw/h4OwcsxZY2GW upyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DRJN3K8u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b25si1608586edr.544.2021.09.09.05.07.01; Thu, 09 Sep 2021 05:07:34 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DRJN3K8u; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243139AbhIIMGC (ORCPT + 99 others); Thu, 9 Sep 2021 08:06:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:40846 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244557AbhIIMBF (ORCPT ); Thu, 9 Sep 2021 08:01:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B89B661440; Thu, 9 Sep 2021 11:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187979; bh=TazWVnaXvlgPzxziINEoLaxVj7c0EuAsDDIxn6rASDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRJN3K8uYpDqqQBN4FzNeXY23aM/YtAOwnErEF52SGRduDM7ZyqfR/+GDqziAehHD AuAaElbE1Ewmuh7kt42PirIfRa6+1b2GkhkyBneCxDhdLUFlOA2NceHo6Y5EGsqYKt 2EG8nTQ4bUBdFx4r1QZhenPWX/IUsSInAtjgfeRUJtdfYuLL1Ne9WoriPNda8Py4oi MCrKp/iCtwwRILEj2P9lhKXExupAEdT+bXv0S0nmDVAqrYl/A52BVDrgz5hvbiaoGk laDyNGCoL6U7gHVdaVNvBrZm22t68O3qDD7MNtp963aM4Hh9liUb8sekdXJSwl16tB uXxEzDTieBGeA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Rui Miguel Silva , Dietmar Eggemann , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.14 241/252] usb: isp1760: write to status and address register Date: Thu, 9 Sep 2021 07:40:55 -0400 Message-Id: <20210909114106.141462-241-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rui Miguel Silva [ Upstream commit 36815a4a0763bb405ebd776c45553005c1ef7a15 ] We were already writing directly the port status register to trigger changes in isp1763. The same is needed in other IP from the family, including also to setup the read address before reading from device. Reported-by: Dietmar Eggemann Tested-by: Dietmar Eggemann Signed-off-by: Rui Miguel Silva Link: https://lore.kernel.org/r/20210827131154.4151862-4-rui.silva@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/isp1760/isp1760-hcd.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c index d2d19548241e..e517376c3291 100644 --- a/drivers/usb/isp1760/isp1760-hcd.c +++ b/drivers/usb/isp1760/isp1760-hcd.c @@ -182,7 +182,7 @@ struct urb_listitem { struct urb *urb; }; -static const u32 isp1763_hc_portsc1_fields[] = { +static const u32 isp176x_hc_portsc1_fields[] = { [PORT_OWNER] = BIT(13), [PORT_POWER] = BIT(12), [PORT_LSTATUS] = BIT(10), @@ -205,27 +205,28 @@ static u32 isp1760_hcd_read(struct usb_hcd *hcd, u32 field) } /* - * We need, in isp1763, to write directly the values to the portsc1 + * We need, in isp176x, to write directly the values to the portsc1 * register so it will make the other values to trigger. */ static void isp1760_hcd_portsc1_set_clear(struct isp1760_hcd *priv, u32 field, u32 val) { - u32 bit = isp1763_hc_portsc1_fields[field]; - u32 port_status = readl(priv->base + ISP1763_HC_PORTSC1); + u32 bit = isp176x_hc_portsc1_fields[field]; + u16 portsc1_reg = priv->is_isp1763 ? ISP1763_HC_PORTSC1 : + ISP176x_HC_PORTSC1; + u32 port_status = readl(priv->base + portsc1_reg); if (val) - writel(port_status | bit, priv->base + ISP1763_HC_PORTSC1); + writel(port_status | bit, priv->base + portsc1_reg); else - writel(port_status & ~bit, priv->base + ISP1763_HC_PORTSC1); + writel(port_status & ~bit, priv->base + portsc1_reg); } static void isp1760_hcd_write(struct usb_hcd *hcd, u32 field, u32 val) { struct isp1760_hcd *priv = hcd_to_priv(hcd); - if (unlikely(priv->is_isp1763 && - (field >= PORT_OWNER && field <= PORT_CONNECT))) + if (unlikely((field >= PORT_OWNER && field <= PORT_CONNECT))) return isp1760_hcd_portsc1_set_clear(priv, field, val); isp1760_field_write(priv->fields, field, val); @@ -367,8 +368,7 @@ static void isp1760_mem_read(struct usb_hcd *hcd, u32 src_offset, void *dst, { struct isp1760_hcd *priv = hcd_to_priv(hcd); - isp1760_hcd_write(hcd, MEM_BANK_SEL, ISP_BANK_0); - isp1760_hcd_write(hcd, MEM_START_ADDR, src_offset); + isp1760_reg_write(priv->regs, ISP176x_HC_MEMORY, src_offset); ndelay(100); bank_reads8(priv->base, src_offset, ISP_BANK_0, dst, bytes); @@ -496,8 +496,7 @@ static void isp1760_ptd_read(struct usb_hcd *hcd, u32 ptd_offset, u32 slot, u16 src_offset = ptd_offset + slot * sizeof(*ptd); struct isp1760_hcd *priv = hcd_to_priv(hcd); - isp1760_hcd_write(hcd, MEM_BANK_SEL, ISP_BANK_0); - isp1760_hcd_write(hcd, MEM_START_ADDR, src_offset); + isp1760_reg_write(priv->regs, ISP176x_HC_MEMORY, src_offset); ndelay(90); bank_reads8(priv->base, src_offset, ISP_BANK_0, (void *)ptd, -- 2.30.2