All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] USB Type-C fixes for usb-next
@ 2020-09-16  9:10 Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 1/3] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Heikki Krogerus @ 2020-09-16  9:10 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Mani, Rajmohan, linux-usb

Hi,

So these Intel PMC mux driver fixes out of my original series [1] are
all for your usb-next.

[1] https://lore.kernel.org/linux-usb/20200916081617.17146-1-heikki.krogerus@linux.intel.com/

Azhar Shaikh (1):
  usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC

Heikki Krogerus (1):
  usb: typec: intel_pmc_mux: Add dependency on ACPI

Madhusudanarao Amara (1):
  usb: typec: intel_pmc_mux: Handle SCU IPC error conditions

 drivers/usb/typec/mux/Kconfig         |  1 +
 drivers/usb/typec/mux/intel_pmc_mux.c | 19 +++++++++++++++----
 2 files changed, 16 insertions(+), 4 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] usb: typec: intel_pmc_mux: Add dependency on ACPI
  2020-09-16  9:10 [PATCH v2 0/3] USB Type-C fixes for usb-next Heikki Krogerus
@ 2020-09-16  9:11 ` Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 2/3] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
  2 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2020-09-16  9:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Mani, Rajmohan, linux-usb, Randy Dunlap

Since the driver now needs to find the IOM ACPI node, the
driver depends on ACPI. Without the dependency set, the
driver will only fail to compile when ACPI is not enabled.

Fixes: 43d596e32276 ("usb: typec: intel_pmc_mux: Check the port status before connect")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/mux/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/mux/Kconfig b/drivers/usb/typec/mux/Kconfig
index a4dbd11f8ee26..edead555835e2 100644
--- a/drivers/usb/typec/mux/Kconfig
+++ b/drivers/usb/typec/mux/Kconfig
@@ -11,6 +11,7 @@ config TYPEC_MUX_PI3USB30532
 
 config TYPEC_MUX_INTEL_PMC
 	tristate "Intel PMC mux control"
+	depends on ACPI
 	depends on INTEL_SCU_IPC
 	select USB_ROLE_SWITCH
 	help
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC
  2020-09-16  9:10 [PATCH v2 0/3] USB Type-C fixes for usb-next Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 1/3] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
@ 2020-09-16  9:11 ` Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
  2 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2020-09-16  9:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Mani, Rajmohan, linux-usb, Azhar Shaikh, Utkarsh Patel

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions
  2020-09-16  9:10 [PATCH v2 0/3] USB Type-C fixes for usb-next Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 1/3] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
  2020-09-16  9:11 ` [PATCH 2/3] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC Heikki Krogerus
@ 2020-09-16  9:11 ` Heikki Krogerus
  2020-09-16  9:42   ` Greg Kroah-Hartman
  2 siblings, 1 reply; 6+ messages in thread
From: Heikki Krogerus @ 2020-09-16  9:11 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Mani, Rajmohan, linux-usb, Madhusudanarao Amara

From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>

Check and return if there are errors. The response bits are valid
only on no errors.

Fixes: b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")
Signed-off-by: Madhusudanarao Amara <madhusudanarao.amara@intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/mux/intel_pmc_mux.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/typec/mux/intel_pmc_mux.c b/drivers/usb/typec/mux/intel_pmc_mux.c
index 109c1a796e844..d7f63b74c6b14 100644
--- a/drivers/usb/typec/mux/intel_pmc_mux.c
+++ b/drivers/usb/typec/mux/intel_pmc_mux.c
@@ -176,13 +176,19 @@ static int hsl_orientation(struct pmc_usb_port *port)
 static int pmc_usb_command(struct pmc_usb_port *port, u8 *msg, u32 len)
 {
 	u8 response[4];
+	int ret;
 
 	/*
 	 * Error bit will always be 0 with the USBC command.
-	 * Status can be checked from the response message.
+	 * Status can be checked from the response message if the
+	 * function intel_scu_ipc_dev_command succeeds.
 	 */
-	intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg, len,
-				  response, sizeof(response));
+	ret = intel_scu_ipc_dev_command(port->pmc->ipc, PMC_USBC_CMD, 0, msg,
+					len, response, sizeof(response));
+
+	if (ret)
+		return ret;
+
 	if (response[2] & PMC_USB_RESP_STATUS_FAILURE) {
 		if (response[2] & PMC_USB_RESP_STATUS_FATAL)
 			return -EIO;
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions
  2020-09-16  9:11 ` [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
@ 2020-09-16  9:42   ` Greg Kroah-Hartman
       [not found]     ` <20200916105845.GE1358028@kuha.fi.intel.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-09-16  9:42 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Mani, Rajmohan, linux-usb, Madhusudanarao Amara

On Wed, Sep 16, 2020 at 12:11:02PM +0300, Heikki Krogerus wrote:
> From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>
> 
> Check and return if there are errors. The response bits are valid
> only on no errors.
> 
> Fixes: b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")

This is in 5.9-rc4, so shouldn't it go in for 5.9-final?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions
       [not found]     ` <20200916105845.GE1358028@kuha.fi.intel.com>
@ 2020-09-16 11:09       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-09-16 11:09 UTC (permalink / raw)
  To: Heikki Krogerus; +Cc: Mani, Rajmohan, linux-usb, Madhusudanarao Amara

On Wed, Sep 16, 2020 at 01:58:45PM +0300, Heikki Krogerus wrote:
> On Wed, Sep 16, 2020 at 11:42:48AM +0200, Greg Kroah-Hartman wrote:
> > On Wed, Sep 16, 2020 at 12:11:02PM +0300, Heikki Krogerus wrote:
> > > From: Madhusudanarao Amara <madhusudanarao.amara@intel.com>
> > > 
> > > Check and return if there are errors. The response bits are valid
> > > only on no errors.
> > > 
> > > Fixes: b7404a29cd3d ("usb: typec: intel_pmc_mux: Definitions for response status bits")
> > 
> > This is in 5.9-rc4, so shouldn't it go in for 5.9-final?
> 
> You are correct. I'm sorry about that. Do you want me to resend?

No worries, I'll take it in the correct branch now, thanks!

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-16 19:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16  9:10 [PATCH v2 0/3] USB Type-C fixes for usb-next Heikki Krogerus
2020-09-16  9:11 ` [PATCH 1/3] usb: typec: intel_pmc_mux: Add dependency on ACPI Heikki Krogerus
2020-09-16  9:11 ` [PATCH 2/3] usb: typec: intel_pmc_mux: Pass correct USB Type-C port number to SoC Heikki Krogerus
2020-09-16  9:11 ` [PATCH 3/3] usb: typec: intel_pmc_mux: Handle SCU IPC error conditions Heikki Krogerus
2020-09-16  9:42   ` Greg Kroah-Hartman
     [not found]     ` <20200916105845.GE1358028@kuha.fi.intel.com>
2020-09-16 11:09       ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.