* [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