Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Mani, Rajmohan" <rajmohan.mani@intel.com>,
	linux-usb@vger.kernel.org, Azhar Shaikh <azhar.shaikh@intel.com>,
	Utkarsh Patel <utkarsh.h.patel@intel.com>
Subject: [PATCH 4/5] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC
Date: Wed, 16 Sep 2020 11:16:16 +0300	[thread overview]
Message-ID: <20200916081617.17146-5-heikki.krogerus@linux.intel.com> (raw)
In-Reply-To: <20200916081617.17146-1-heikki.krogerus@linux.intel.com>

From: Azhar Shaikh <azhar.shaikh@intel.com>

The SoC expects the USB Type-C ports numbers to be starting with 0.
If the port number is passed as it is, the IOM status will not be
updated. The IOM port status check fails which will eventually
lead to PMC IPC communication failure.

Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
Suggested-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Signed-off-by: Azhar Shaikh <azhar.shaikh@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 307830b374ec7..109c1a796e844 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -148,8 +148,13 @@ struct pmc_usb {
 
 static void update_port_status(struct pmc_usb_port *port)
 {
+	u8 port_num;
+
+	/* SoC expects the USB Type-C port numbers to start with 0 */
+	port_num = port->usb3_port - 1;
+
 	port->iom_status = readl(port->pmc->iom_base + IOM_PORT_STATUS_OFFSET +
-				 port->usb3_port * sizeof(u32));
+				 port_num * sizeof(u32));
 }
 
 static int sbu_orientation(struct pmc_usb_port *port)
-- 
2.28.0


  parent reply	other threads:[~2020-09-16  8:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16  8:16 [PATCH 0/5] USB Type-C fixes Heikki Krogerus
2020-09-16  8:16 ` [PATCH 1/5] usb: typec: ucsi: acpi: Increase command completion timeout value Heikki Krogerus
2020-09-16  8:16 ` [PATCH 2/5] usb: typec: ucsi: Prevent mode overrun Heikki Krogerus
2020-09-16  8:16 ` [PATCH 3/5] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
2020-09-16  8:16 ` Heikki Krogerus [this message]
2020-09-16  8:16 ` [PATCH 5/5] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
2020-09-16  8:37 ` [PATCH 0/5] USB Type-C fixes Greg Kroah-Hartman
2020-09-16  8:42   ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200916081617.17146-5-heikki.krogerus@linux.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=azhar.shaikh@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rajmohan.mani@intel.com \
    --cc=utkarsh.h.patel@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox