aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdx/controller/mcdi_functions.c
diff options
context:
space:
mode:
authorAbhijit Gangurde <[email protected]>2023-10-17 16:05:03 +0000
committerGreg Kroah-Hartman <[email protected]>2023-10-27 11:23:24 +0000
commite3cfd49cb9491ac1cc233a4b9e098688b4ab281d (patch)
tree15029eab27a1d6205226fa16d723222bb7363d84 /drivers/cdx/controller/mcdi_functions.c
parentcdx: Register cdx bus as a device on cdx subsystem (diff)
downloadkernel-e3cfd49cb9491ac1cc233a4b9e098688b4ab281d.tar.gz
kernel-e3cfd49cb9491ac1cc233a4b9e098688b4ab281d.zip
cdx: add support for bus enable and disable
CDX bus needs to be disabled before updating/writing devices in the FPGA. Once the devices are written, the bus shall be rescanned. This change provides sysfs entry to enable/disable the CDX bus. Co-developed-by: Nipun Gupta <[email protected]> Signed-off-by: Nipun Gupta <[email protected]> Signed-off-by: Abhijit Gangurde <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/cdx/controller/mcdi_functions.c')
-rw-r--r--drivers/cdx/controller/mcdi_functions.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/cdx/controller/mcdi_functions.c b/drivers/cdx/controller/mcdi_functions.c
index 0158f26533dd..0e1e35d91242 100644
--- a/drivers/cdx/controller/mcdi_functions.c
+++ b/drivers/cdx/controller/mcdi_functions.c
@@ -124,6 +124,30 @@ int cdx_mcdi_get_dev_config(struct cdx_mcdi *cdx,
return 0;
}
+int cdx_mcdi_bus_enable(struct cdx_mcdi *cdx, u8 bus_num)
+{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_BUS_UP_IN_LEN);
+ int ret;
+
+ MCDI_SET_DWORD(inbuf, CDX_BUS_UP_IN_BUS, bus_num);
+ ret = cdx_mcdi_rpc(cdx, MC_CMD_CDX_BUS_UP, inbuf, sizeof(inbuf),
+ NULL, 0, NULL);
+
+ return ret;
+}
+
+int cdx_mcdi_bus_disable(struct cdx_mcdi *cdx, u8 bus_num)
+{
+ MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_BUS_DOWN_IN_LEN);
+ int ret;
+
+ MCDI_SET_DWORD(inbuf, CDX_BUS_DOWN_IN_BUS, bus_num);
+ ret = cdx_mcdi_rpc(cdx, MC_CMD_CDX_BUS_DOWN, inbuf, sizeof(inbuf),
+ NULL, 0, NULL);
+
+ return ret;
+}
+
int cdx_mcdi_reset_device(struct cdx_mcdi *cdx, u8 bus_num, u8 dev_num)
{
MCDI_DECLARE_BUF(inbuf, MC_CMD_CDX_DEVICE_RESET_IN_LEN);