soc: qcom: Update ipc router sdio transport plugin

Update ipc router sdio plugin initial snapshot to support peripheral
device over sdio transport.

Change-Id: I097ad755b3bd2270cda74738bed409e88dee343c
Signed-off-by: Amandeep Singh <amansing@codeaurora.org>
This commit is contained in:
Amandeep Singh 2019-07-03 11:47:52 +05:30
parent 3451ee0a58
commit c83973e117
2 changed files with 284 additions and 258 deletions

View file

@ -0,0 +1,19 @@
IPC Router SDIO Transport
Required properties:
-compatible: should be "qcom,ipc_router_sdio_xprt"
-qcom,ch-name: the SDIO channel name used by the SDIO transport
-qcom,xprt-remote: string that defines the edge of the transport (PIL Name)
-qcom,xprt-linkid: unique integer to identify the tier to which the link
belongs to in the network and is used to avoid the
routing loops while forwarding the broadcast messages
-qcom,xprt-version: unique version ID used by SDIO transport header
Example:
qcom,ipc_router_external_modem_xprt {
compatible = "qcom,ipc_router_sdio_xprt";
qcom,ch-name = "ipc_bridge_sdio";
qcom,xprt-remote = "external-modem";
qcom,xprt-linkid = <1>;
qcom,xprt-version = <3>;
};

View file

@ -11,7 +11,7 @@
*/ */
/* /*
* IPC ROUTER HSIC XPRT module. * IPC ROUTER SDIO XPRT module.
*/ */
#define DEBUG #define DEBUG
@ -25,34 +25,32 @@
#include <linux/sched.h> #include <linux/sched.h>
#include <soc/qcom/subsystem_restart.h> #include <soc/qcom/subsystem_restart.h>
#include <mach/ipc_bridge.h> static int msm_ipc_router_sdio_xprt_debug_mask = 1;
module_param_named(debug_mask, msm_ipc_router_sdio_xprt_debug_mask,
static int msm_ipc_router_hsic_xprt_debug_mask;
module_param_named(debug_mask, msm_ipc_router_hsic_xprt_debug_mask,
int, S_IRUGO | S_IWUSR | S_IWGRP); int, S_IRUGO | S_IWUSR | S_IWGRP);
#if defined(DEBUG) #if defined(DEBUG)
#define D(x...) do { \ #define D(x...) do { \
if (msm_ipc_router_hsic_xprt_debug_mask) \ if (msm_ipc_router_sdio_xprt_debug_mask) \
pr_info(x); \ pr_err(x); \
} while (0) } while (0)
#else #else
#define D(x...) do { } while (0) #define D(x...) do { } while (0)
#endif #endif
#define NUM_HSIC_XPRTS 1 #define NUM_SDIO_XPRTS 1
#define XPRT_NAME_LEN 32 #define XPRT_NAME_LEN 32
/** /**
* msm_ipc_router_hsic_xprt - IPC Router's HSIC XPRT structure * msm_ipc_router_sdio_xprt - IPC Router's SDIO XPRT structure
* @list: IPC router's HSIC XPRTs list. * @list: IPC router's SDIO XPRTs list.
* @ch_name: Name of the HSIC endpoint exported by ipc_bridge driver. * @ch_name: Name of the SDIO endpoint exported by ipc_bridge driver.
* @xprt_name: Name of the XPRT to be registered with IPC Router. * @xprt_name: Name of the XPRT to be registered with IPC Router.
* @driver: Platform drivers register by this XPRT. * @driver: Platform drivers register by this XPRT.
* @xprt: IPC Router XPRT structure to contain HSIC XPRT specific info. * @xprt: IPC Router XPRT structure to contain SDIO XPRT specific info.
* @pdev: Platform device registered by IPC Bridge function driver. * @pdev: Platform device registered by IPC Bridge function driver.
* @hsic_xprt_wq: Workqueue to queue read & other XPRT related works. * @sdio_xprt_wq: Workqueue to queue read & other XPRT related works.
* @read_work: Read Work to perform read operation from HSIC's ipc_bridge. * @read_work: Read Work to perform read operation from SDIO's ipc_bridge.
* @in_pkt: Pointer to any partially read packet. * @in_pkt: Pointer to any partially read packet.
* @ss_reset_lock: Lock to protect access to the ss_reset flag. * @ss_reset_lock: Lock to protect access to the ss_reset flag.
* @ss_reset: flag used to check SSR state. * @ss_reset: flag used to check SSR state.
@ -61,14 +59,14 @@ if (msm_ipc_router_hsic_xprt_debug_mask) \
* @xprt_version: IPC Router header version supported by this XPRT. * @xprt_version: IPC Router header version supported by this XPRT.
* @xprt_option: XPRT specific options to be handled by IPC Router. * @xprt_option: XPRT specific options to be handled by IPC Router.
*/ */
struct msm_ipc_router_hsic_xprt { struct msm_ipc_router_sdio_xprt {
struct list_head list; struct list_head list;
char ch_name[XPRT_NAME_LEN]; char ch_name[XPRT_NAME_LEN];
char xprt_name[XPRT_NAME_LEN]; char xprt_name[XPRT_NAME_LEN];
struct platform_driver driver; struct platform_driver driver;
struct msm_ipc_router_xprt xprt; struct msm_ipc_router_xprt xprt;
struct platform_device *pdev; struct platform_device *pdev;
struct workqueue_struct *hsic_xprt_wq; struct workqueue_struct *sdio_xprt_wq;
struct delayed_work read_work; struct delayed_work read_work;
struct rr_packet *in_pkt; struct rr_packet *in_pkt;
struct mutex ss_reset_lock; struct mutex ss_reset_lock;
@ -78,159 +76,168 @@ struct msm_ipc_router_hsic_xprt {
unsigned xprt_option; unsigned xprt_option;
}; };
struct msm_ipc_router_hsic_xprt_work { struct ipc_bridge_platform_data {
unsigned int max_read_size;
unsigned int max_write_size;
int (*open)(int id, void *ops);
int (*read)(int id, char *buf, size_t count);
int (*write)(int id, char *buf, size_t count);
int (*close)(int id);
};
struct msm_ipc_router_sdio_xprt_work {
struct msm_ipc_router_xprt *xprt; struct msm_ipc_router_xprt *xprt;
struct work_struct work; struct work_struct work;
}; };
static void hsic_xprt_read_data(struct work_struct *work); static void sdio_xprt_read_data(struct work_struct *work);
/** /**
* msm_ipc_router_hsic_xprt_config - Config. Info. of each HSIC XPRT * msm_ipc_router_sdio_xprt_config - Config. Info. of each SDIO XPRT
* @ch_name: Name of the HSIC endpoint exported by ipc_bridge driver. * @ch_name: Name of the SDIO endpoint exported by ipc_bridge driver.
* @xprt_name: Name of the XPRT to be registered with IPC Router. * @xprt_name: Name of the XPRT to be registered with IPC Router.
* @hsic_pdev_id: ID to differentiate among multiple ipc_bridge endpoints. * @sdio_pdev_id: ID to differentiate among multiple ipc_bridge endpoints.
* @link_id: Network Cluster ID to which this XPRT belongs to. * @link_id: Network Cluster ID to which this XPRT belongs to.
* @xprt_version: IPC Router header version supported by this XPRT. * @xprt_version: IPC Router header version supported by this XPRT.
*/ */
struct msm_ipc_router_hsic_xprt_config { struct msm_ipc_router_sdio_xprt_config {
char ch_name[XPRT_NAME_LEN]; char ch_name[XPRT_NAME_LEN];
char xprt_name[XPRT_NAME_LEN]; char xprt_name[XPRT_NAME_LEN];
int hsic_pdev_id; int sdio_pdev_id;
uint32_t link_id; uint32_t link_id;
unsigned xprt_version; unsigned xprt_version;
}; };
struct msm_ipc_router_hsic_xprt_config hsic_xprt_cfg[] = { struct msm_ipc_router_sdio_xprt_config sdio_xprt_cfg[] = {
{"ipc_bridge", "ipc_rtr_ipc_bridge1", 1, 1, 3}, {"ipc_bridge_sdio", "ipc_rtr_ipc_bridge_sdio", 1, 1, 3},
}; };
#define MODULE_NAME "ipc_router_hsic_xprt" #define MODULE_NAME "ipc_router_sdio_xprt"
#define IPC_ROUTER_HSIC_XPRT_WAIT_TIMEOUT 3000 #define IPC_ROUTER_SDIO_XPRT_WAIT_TIMEOUT 3000
static int ipc_router_hsic_xprt_probe_done; static int ipc_router_sdio_xprt_probe_done;
static struct delayed_work ipc_router_hsic_xprt_probe_work; static struct delayed_work ipc_router_sdio_xprt_probe_work;
static DEFINE_MUTEX(hsic_remote_xprt_list_lock_lha1); static DEFINE_MUTEX(sdio_remote_xprt_list_lock_lha1);
static LIST_HEAD(hsic_remote_xprt_list); static LIST_HEAD(sdio_remote_xprt_list);
/** /**
* find_hsic_xprt_list() - Find xprt item specific to an HSIC endpoint * find_sdio_xprt_list() - Find xprt item specific to an SDIO endpoint
* @name: Name of the platform device to find in list * @name: Name of the platform device to find in list
* *
* @return: pointer to msm_ipc_router_hsic_xprt if matching endpoint is found, * @return: pointer to msm_ipc_router_sdio_xprt if matching endpoint is found,
* else NULL. * else NULL.
* *
* This function is used to find specific xprt item from the global xprt list * This function is used to find specific xprt item from the global xprt list
*/ */
static struct msm_ipc_router_hsic_xprt * static struct msm_ipc_router_sdio_xprt *
find_hsic_xprt_list(const char *name) find_sdio_xprt_list(const char *name)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
mutex_lock(&hsic_remote_xprt_list_lock_lha1); mutex_lock(&sdio_remote_xprt_list_lock_lha1);
list_for_each_entry(hsic_xprtp, &hsic_remote_xprt_list, list) { list_for_each_entry(sdio_xprtp, &sdio_remote_xprt_list, list) {
if (!strcmp(name, hsic_xprtp->ch_name)) { if (!strcmp(name, sdio_xprtp->ch_name)) {
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
return hsic_xprtp; return sdio_xprtp;
} }
} }
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
return NULL; return NULL;
} }
/** /**
* ipc_router_hsic_set_xprt_version() - Set IPC Router header version * ipc_router_sdio_set_xprt_version() - Set IPC Router header version
* in the transport * in the transport
* @xprt: Reference to the transport structure. * @xprt: Reference to the transport structure.
* @version: The version to be set in transport. * @version: The version to be set in transport.
*/ */
static void ipc_router_hsic_set_xprt_version( static void ipc_router_sdio_set_xprt_version(
struct msm_ipc_router_xprt *xprt, unsigned version) struct msm_ipc_router_xprt *xprt, unsigned version)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
if (!xprt) if (!xprt)
return; return;
hsic_xprtp = container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); sdio_xprtp = container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
hsic_xprtp->xprt_version = version; sdio_xprtp->xprt_version = version;
} }
/** /**
* msm_ipc_router_hsic_get_xprt_version() - Get IPC Router header version * msm_ipc_router_sdio_get_xprt_version() - Get IPC Router header version
* supported by the XPRT * supported by the XPRT
* @xprt: XPRT for which the version information is required. * @xprt: XPRT for which the version information is required.
* *
* @return: IPC Router header version supported by the XPRT. * @return: IPC Router header version supported by the XPRT.
*/ */
static int msm_ipc_router_hsic_get_xprt_version( static int msm_ipc_router_sdio_get_xprt_version(
struct msm_ipc_router_xprt *xprt) struct msm_ipc_router_xprt *xprt)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
if (!xprt) if (!xprt)
return -EINVAL; return -EINVAL;
hsic_xprtp = container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); sdio_xprtp = container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
return (int)hsic_xprtp->xprt_version; return (int)sdio_xprtp->xprt_version;
} }
/** /**
* msm_ipc_router_hsic_get_xprt_option() - Get XPRT options * msm_ipc_router_sdio_get_xprt_option() - Get XPRT options
* @xprt: XPRT for which the option information is required. * @xprt: XPRT for which the option information is required.
* *
* @return: Options supported by the XPRT. * @return: Options supported by the XPRT.
*/ */
static int msm_ipc_router_hsic_get_xprt_option( static int msm_ipc_router_sdio_get_xprt_option(
struct msm_ipc_router_xprt *xprt) struct msm_ipc_router_xprt *xprt)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
if (!xprt) if (!xprt)
return -EINVAL; return -EINVAL;
hsic_xprtp = container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); sdio_xprtp = container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
return (int)hsic_xprtp->xprt_option; return (int)sdio_xprtp->xprt_option;
} }
/** /**
* msm_ipc_router_hsic_remote_write_avail() - Get available write space * msm_ipc_router_sdio_remote_write_avail() - Get available write space
* @xprt: XPRT for which the available write space info. is required. * @xprt: XPRT for which the available write space info. is required.
* *
* @return: Write space in bytes on success, 0 on SSR. * @return: Write space in bytes on success, 0 on SSR.
*/ */
static int msm_ipc_router_hsic_remote_write_avail( static int msm_ipc_router_sdio_remote_write_avail(
struct msm_ipc_router_xprt *xprt) struct msm_ipc_router_xprt *xprt)
{ {
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
int write_avail; int write_avail;
struct msm_ipc_router_hsic_xprt *hsic_xprtp = struct msm_ipc_router_sdio_xprt *sdio_xprtp =
container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
mutex_lock(&hsic_xprtp->ss_reset_lock); mutex_lock(&sdio_xprtp->ss_reset_lock);
if (hsic_xprtp->ss_reset || !hsic_xprtp->pdev) { if (sdio_xprtp->ss_reset || !sdio_xprtp->pdev) {
write_avail = 0; write_avail = 0;
} else { } else {
pdata = hsic_xprtp->pdev->dev.platform_data; pdata = sdio_xprtp->pdev->dev.platform_data;
write_avail = pdata->max_write_size; write_avail = pdata->max_write_size;
} }
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return write_avail; return write_avail;
} }
/** /**
* msm_ipc_router_hsic_remote_write() - Write to XPRT * msm_ipc_router_sdio_remote_write() - Write to XPRT
* @data: Data to be written to the XPRT. * @data: Data to be written to the XPRT.
* @len: Length of the data to be written. * @len: Length of the data to be written.
* @xprt: XPRT to which the data has to be written. * @xprt: XPRT to which the data has to be written.
* *
* @return: Data Length on success, standard Linux error codes on failure. * @return: Data Length on success, standard Linux error codes on failure.
*/ */
static int msm_ipc_router_hsic_remote_write(void *data, static int msm_ipc_router_sdio_remote_write(void *data,
uint32_t len, struct msm_ipc_router_xprt *xprt) uint32_t len, struct msm_ipc_router_xprt *xprt)
{ {
struct rr_packet *pkt = (struct rr_packet *)data; struct rr_packet *pkt = (struct rr_packet *)data;
struct sk_buff *skb; struct sk_buff *skb;
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
int ret; int ret;
uint32_t bytes_written = 0; uint32_t bytes_written = 0;
uint32_t bytes_to_write; uint32_t bytes_to_write;
@ -241,31 +248,32 @@ static int msm_ipc_router_hsic_remote_write(void *data,
return -EINVAL; return -EINVAL;
} }
hsic_xprtp = container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); sdio_xprtp = container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
mutex_lock(&hsic_xprtp->ss_reset_lock);
if (hsic_xprtp->ss_reset) { mutex_lock(&sdio_xprtp->ss_reset_lock);
if (sdio_xprtp->ss_reset) {
IPC_RTR_ERR("%s: Trying to write on a reset link\n", __func__); IPC_RTR_ERR("%s: Trying to write on a reset link\n", __func__);
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return -ENETRESET; return -ENETRESET;
} }
if (!hsic_xprtp->pdev) { if (!sdio_xprtp->pdev) {
IPC_RTR_ERR("%s: Trying to write on a closed link\n", __func__); IPC_RTR_ERR("%s: Trying to write on a closed link\n", __func__);
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return -ENODEV; return -ENODEV;
} }
pdata = hsic_xprtp->pdev->dev.platform_data; pdata = sdio_xprtp->pdev->dev.platform_data;
if (!pdata || !pdata->write) { if (!pdata || !pdata->write) {
IPC_RTR_ERR("%s on a uninitialized link\n", __func__); IPC_RTR_ERR("%s on a uninitialized link\n", __func__);
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return -EFAULT; return -EFAULT;
} }
skb = skb_peek(pkt->pkt_fragment_q); skb = skb_peek(pkt->pkt_fragment_q);
if (!skb) { if (!skb) {
IPC_RTR_ERR("%s SKB is NULL\n", __func__); IPC_RTR_ERR("%s SKB is NULL\n", __func__);
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return -EINVAL; return -EINVAL;
} }
D("%s: About to write %d bytes\n", __func__, len); D("%s: About to write %d bytes\n", __func__, len);
@ -274,7 +282,8 @@ static int msm_ipc_router_hsic_remote_write(void *data,
bytes_to_write = min_t(uint32_t, (skb->len - bytes_written), bytes_to_write = min_t(uint32_t, (skb->len - bytes_written),
pdata->max_write_size); pdata->max_write_size);
tx_data = skb->data + bytes_written; tx_data = skb->data + bytes_written;
ret = pdata->write(hsic_xprtp->pdev, tx_data, bytes_to_write); ret = pdata->write(sdio_xprtp->pdev->id, tx_data,
bytes_to_write);
if (ret < 0) { if (ret < 0) {
IPC_RTR_ERR("%s: Error writing data %d\n", IPC_RTR_ERR("%s: Error writing data %d\n",
__func__, ret); __func__, ret);
@ -293,48 +302,48 @@ static int msm_ipc_router_hsic_remote_write(void *data,
ret = -EFAULT; ret = -EFAULT;
} }
D("%s: Finished writing %d bytes\n", __func__, len); D("%s: Finished writing %d bytes\n", __func__, len);
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
return ret; return ret;
} }
/** /**
* msm_ipc_router_hsic_remote_close() - Close the XPRT * msm_ipc_router_sdio_remote_close() - Close the XPRT
* @xprt: XPRT which needs to be closed. * @xprt: XPRT which needs to be closed.
* *
* @return: 0 on success, standard Linux error codes on failure. * @return: 0 on success, standard Linux error codes on failure.
*/ */
static int msm_ipc_router_hsic_remote_close( static int msm_ipc_router_sdio_remote_close(
struct msm_ipc_router_xprt *xprt) struct msm_ipc_router_xprt *xprt)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
if (!xprt) if (!xprt)
return -EINVAL; return -EINVAL;
hsic_xprtp = container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); sdio_xprtp = container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
mutex_lock(&hsic_xprtp->ss_reset_lock); mutex_lock(&sdio_xprtp->ss_reset_lock);
hsic_xprtp->ss_reset = 1; sdio_xprtp->ss_reset = 1;
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
flush_workqueue(hsic_xprtp->hsic_xprt_wq); flush_workqueue(sdio_xprtp->sdio_xprt_wq);
destroy_workqueue(hsic_xprtp->hsic_xprt_wq); destroy_workqueue(sdio_xprtp->sdio_xprt_wq);
pdata = hsic_xprtp->pdev->dev.platform_data; pdata = sdio_xprtp->pdev->dev.platform_data;
if (pdata && pdata->close) if (pdata && pdata->close)
pdata->close(hsic_xprtp->pdev); pdata->close(sdio_xprtp->pdev->id);
hsic_xprtp->pdev = NULL; sdio_xprtp->pdev = NULL;
return 0; return 0;
} }
/** /**
* hsic_xprt_read_data() - Read work to read from the XPRT * sdio_xprt_read_data() - Read work to read from the XPRT
* @work: Read work to be executed. * @work: Read work to be executed.
* *
* This function is a read work item queued on a XPRT specific workqueue. * This function is a read work item queued on a XPRT specific workqueue.
* The work parameter contains information regarding the XPRT on which this * The work parameter contains information regarding the XPRT on which this
* read work has to be performed. The work item keeps reading from the HSIC * read work has to be performed. The work item keeps reading from the SDIO
* endpoint, until the endpoint returns an error. * endpoint, until the endpoint returns an error.
*/ */
static void hsic_xprt_read_data(struct work_struct *work) static void sdio_xprt_read_data(struct work_struct *work)
{ {
int bytes_to_read; int bytes_to_read;
int bytes_read; int bytes_read;
@ -342,20 +351,20 @@ static void hsic_xprt_read_data(struct work_struct *work)
struct sk_buff *skb = NULL; struct sk_buff *skb = NULL;
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
struct delayed_work *rwork = to_delayed_work(work); struct delayed_work *rwork = to_delayed_work(work);
struct msm_ipc_router_hsic_xprt *hsic_xprtp = struct msm_ipc_router_sdio_xprt *sdio_xprtp =
container_of(rwork, struct msm_ipc_router_hsic_xprt, read_work); container_of(rwork, struct msm_ipc_router_sdio_xprt, read_work);
while (1) { while (1) {
mutex_lock(&hsic_xprtp->ss_reset_lock); mutex_lock(&sdio_xprtp->ss_reset_lock);
if (hsic_xprtp->ss_reset) { if (sdio_xprtp->ss_reset) {
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
break; break;
} }
pdata = hsic_xprtp->pdev->dev.platform_data; pdata = sdio_xprtp->pdev->dev.platform_data;
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
while (!hsic_xprtp->in_pkt) { while (!sdio_xprtp->in_pkt) {
hsic_xprtp->in_pkt = create_pkt(NULL); sdio_xprtp->in_pkt = create_pkt(NULL);
if (hsic_xprtp->in_pkt) if (sdio_xprtp->in_pkt)
break; break;
IPC_RTR_ERR("%s: packet allocation failure\n", IPC_RTR_ERR("%s: packet allocation failure\n",
__func__); __func__);
@ -374,8 +383,8 @@ static void hsic_xprt_read_data(struct work_struct *work)
__func__); __func__);
msleep(100); msleep(100);
} while (!skb); } while (!skb);
bytes_read = pdata->read(hsic_xprtp->pdev, skb->data, bytes_read = pdata->read(sdio_xprtp->pdev->id,
pdata->max_read_size); skb->data, pdata->max_read_size);
if (bytes_read < 0) { if (bytes_read < 0) {
IPC_RTR_ERR("%s: Error %d @ read operation\n", IPC_RTR_ERR("%s: Error %d @ read operation\n",
__func__, bytes_read); __func__, bytes_read);
@ -394,92 +403,92 @@ static void hsic_xprt_read_data(struct work_struct *work)
} }
bytes_to_read -= bytes_read; bytes_to_read -= bytes_read;
skb_put(skb, bytes_read); skb_put(skb, bytes_read);
skb_queue_tail(hsic_xprtp->in_pkt->pkt_fragment_q, skb); skb_queue_tail(sdio_xprtp->in_pkt->pkt_fragment_q, skb);
hsic_xprtp->in_pkt->length += bytes_read; sdio_xprtp->in_pkt->length += bytes_read;
skb_size = min_t(uint32_t, pdata->max_read_size, skb_size = min_t(uint32_t, pdata->max_read_size,
(uint32_t)bytes_to_read); (uint32_t)bytes_to_read);
} while (bytes_to_read > 0); } while (bytes_to_read > 0);
D("%s: Packet size read %d\n", D("%s: Packet size read %d\n",
__func__, hsic_xprtp->in_pkt->length); __func__, sdio_xprtp->in_pkt->length);
msm_ipc_router_xprt_notify(&hsic_xprtp->xprt, msm_ipc_router_xprt_notify(&sdio_xprtp->xprt,
IPC_ROUTER_XPRT_EVENT_DATA, (void *)hsic_xprtp->in_pkt); IPC_ROUTER_XPRT_EVENT_DATA, (void *)sdio_xprtp->in_pkt);
release_pkt(hsic_xprtp->in_pkt); release_pkt(sdio_xprtp->in_pkt);
hsic_xprtp->in_pkt = NULL; sdio_xprtp->in_pkt = NULL;
} }
out_read_data: out_read_data:
release_pkt(hsic_xprtp->in_pkt); release_pkt(sdio_xprtp->in_pkt);
hsic_xprtp->in_pkt = NULL; sdio_xprtp->in_pkt = NULL;
} }
/** /**
* hsic_xprt_sft_close_done() - Completion of XPRT reset * sdio_xprt_sft_close_done() - Completion of XPRT reset
* @xprt: XPRT on which the reset operation is complete. * @xprt: XPRT on which the reset operation is complete.
* *
* This function is used by IPC Router to signal this HSIC XPRT Abstraction * This function is used by IPC Router to signal this SDIO XPRT Abstraction
* Layer(XAL) that the reset of XPRT is completely handled by IPC Router. * Layer(XAL) that the reset of XPRT is completely handled by IPC Router.
*/ */
static void hsic_xprt_sft_close_done(struct msm_ipc_router_xprt *xprt) static void sdio_xprt_sft_close_done(struct msm_ipc_router_xprt *xprt)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp = struct msm_ipc_router_sdio_xprt *sdio_xprtp =
container_of(xprt, struct msm_ipc_router_hsic_xprt, xprt); container_of(xprt, struct msm_ipc_router_sdio_xprt, xprt);
complete_all(&hsic_xprtp->sft_close_complete); complete_all(&sdio_xprtp->sft_close_complete);
} }
/** /**
* msm_ipc_router_hsic_remote_remove() - Remove an HSIC endpoint * msm_ipc_router_sdio_remote_remove() - Remove an SDIO endpoint
* @pdev: Platform device corresponding to HSIC endpoint. * @pdev: Platform device corresponding to SDIO endpoint.
* *
* @return: 0 on success, standard Linux error codes on error. * @return: 0 on success, standard Linux error codes on error.
* *
* This function is called when the underlying ipc_bridge driver unregisters * This function is called when the underlying ipc_bridge driver unregisters
* a platform device, mapped to an HSIC endpoint, during SSR. * a platform device, mapped to an SDIO endpoint, during SSR.
*/ */
static int msm_ipc_router_hsic_remote_remove(struct platform_device *pdev) static int msm_ipc_router_sdio_remote_remove(struct platform_device *pdev)
{ {
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
hsic_xprtp = find_hsic_xprt_list(pdev->name); sdio_xprtp = find_sdio_xprt_list(pdev->name);
if (!hsic_xprtp) { if (!sdio_xprtp) {
IPC_RTR_ERR("%s No device with name %s\n", IPC_RTR_ERR("%s No device with name %s\n",
__func__, pdev->name); __func__, pdev->name);
return -ENODEV; return -ENODEV;
} }
mutex_lock(&hsic_xprtp->ss_reset_lock); mutex_lock(&sdio_xprtp->ss_reset_lock);
hsic_xprtp->ss_reset = 1; sdio_xprtp->ss_reset = 1;
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
flush_workqueue(hsic_xprtp->hsic_xprt_wq); flush_workqueue(sdio_xprtp->sdio_xprt_wq);
destroy_workqueue(hsic_xprtp->hsic_xprt_wq); destroy_workqueue(sdio_xprtp->sdio_xprt_wq);
init_completion(&hsic_xprtp->sft_close_complete); init_completion(&sdio_xprtp->sft_close_complete);
msm_ipc_router_xprt_notify(&hsic_xprtp->xprt, msm_ipc_router_xprt_notify(&sdio_xprtp->xprt,
IPC_ROUTER_XPRT_EVENT_CLOSE, NULL); IPC_ROUTER_XPRT_EVENT_CLOSE, NULL);
D("%s: Notified IPC Router of %s CLOSE\n", D("%s: Notified IPC Router of %s CLOSE\n", __func__,
__func__, hsic_xprtp->xprt.name); sdio_xprtp->xprt.name);
wait_for_completion(&hsic_xprtp->sft_close_complete); wait_for_completion(&sdio_xprtp->sft_close_complete);
hsic_xprtp->pdev = NULL; sdio_xprtp->pdev = NULL;
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
if (pdata && pdata->close) if (pdata && pdata->close)
pdata->close(pdev); pdata->close(pdev->id);
return 0; return 0;
} }
/** /**
* msm_ipc_router_hsic_remote_probe() - Probe an HSIC endpoint * msm_ipc_router_sdio_remote_probe() - Probe an SDIO endpoint
* @pdev: Platform device corresponding to HSIC endpoint. * @pdev: Platform device corresponding to SDIO endpoint.
* *
* @return: 0 on success, standard Linux error codes on error. * @return: 0 on success, standard Linux error codes on error.
* *
* This function is called when the underlying ipc_bridge driver registers * This function is called when the underlying ipc_bridge driver registers
* a platform device, mapped to an HSIC endpoint. * a platform device, mapped to an SDIO endpoint.
*/ */
static int msm_ipc_router_hsic_remote_probe(struct platform_device *pdev) static int msm_ipc_router_sdio_remote_probe(struct platform_device *pdev)
{ {
int rc; int rc;
struct ipc_bridge_platform_data *pdata; struct ipc_bridge_platform_data *pdata;
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
pdata = pdev->dev.platform_data; pdata = pdev->dev.platform_data;
if (!pdata || !pdata->open || !pdata->read || if (!pdata || !pdata->open || !pdata->read ||
@ -489,139 +498,139 @@ static int msm_ipc_router_hsic_remote_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
hsic_xprtp = find_hsic_xprt_list(pdev->name); sdio_xprtp = find_sdio_xprt_list(pdev->name);
if (!hsic_xprtp) { if (!sdio_xprtp) {
IPC_RTR_ERR("%s No device with name %s\n", IPC_RTR_ERR("%s No device with name %s\n",
__func__, pdev->name); __func__, pdev->name);
return -ENODEV; return -ENODEV;
} }
hsic_xprtp->hsic_xprt_wq = sdio_xprtp->sdio_xprt_wq =
create_singlethread_workqueue(pdev->name); create_singlethread_workqueue(pdev->name);
if (!hsic_xprtp->hsic_xprt_wq) { if (!sdio_xprtp->sdio_xprt_wq) {
IPC_RTR_ERR("%s: WQ creation failed for %s\n", IPC_RTR_ERR("%s: WQ creation failed for %s\n",
__func__, pdev->name); __func__, pdev->name);
return -EFAULT; return -EFAULT;
} }
rc = pdata->open(pdev); rc = pdata->open(pdev->id, NULL);
if (rc < 0) { if (rc < 0) {
IPC_RTR_ERR("%s: Channel open failed for %s.%d\n", IPC_RTR_ERR("%s: Channel open failed for %s.%d\n",
__func__, pdev->name, pdev->id); __func__, pdev->name, pdev->id);
destroy_workqueue(hsic_xprtp->hsic_xprt_wq); destroy_workqueue(sdio_xprtp->sdio_xprt_wq);
return rc; return rc;
} }
hsic_xprtp->pdev = pdev; sdio_xprtp->pdev = pdev;
mutex_lock(&hsic_xprtp->ss_reset_lock); mutex_lock(&sdio_xprtp->ss_reset_lock);
hsic_xprtp->ss_reset = 0; sdio_xprtp->ss_reset = 0;
mutex_unlock(&hsic_xprtp->ss_reset_lock); mutex_unlock(&sdio_xprtp->ss_reset_lock);
msm_ipc_router_xprt_notify(&hsic_xprtp->xprt, msm_ipc_router_xprt_notify(&sdio_xprtp->xprt,
IPC_ROUTER_XPRT_EVENT_OPEN, NULL); IPC_ROUTER_XPRT_EVENT_OPEN, NULL);
D("%s: Notified IPC Router of %s OPEN\n", D("%s: Notified IPC Router of %s OPEN\n",
__func__, hsic_xprtp->xprt.name); __func__, sdio_xprtp->xprt.name);
queue_delayed_work(hsic_xprtp->hsic_xprt_wq, queue_delayed_work(sdio_xprtp->sdio_xprt_wq,
&hsic_xprtp->read_work, 0); &sdio_xprtp->read_work, 0);
return 0; return 0;
} }
/** /**
* msm_ipc_router_hsic_driver_register() - register HSIC XPRT drivers * msm_ipc_router_sdio_driver_register() - register SDIO XPRT drivers
* *
* @hsic_xprtp: pointer to IPC router hsic xprt structure. * @sdio_xprtp: pointer to IPC router sdio xprt structure.
* *
* @return: 0 on success, standard Linux error codes on error. * @return: 0 on success, standard Linux error codes on error.
* *
* This function is called when a new XPRT is added to register platform * This function is called when a new XPRT is added to register platform
* drivers for new XPRT. * drivers for new XPRT.
*/ */
static int msm_ipc_router_hsic_driver_register( static int msm_ipc_router_sdio_driver_register(
struct msm_ipc_router_hsic_xprt *hsic_xprtp) struct msm_ipc_router_sdio_xprt *sdio_xprtp)
{ {
int ret; int ret;
struct msm_ipc_router_hsic_xprt *hsic_xprtp_item; struct msm_ipc_router_sdio_xprt *sdio_xprtp_item;
hsic_xprtp_item = find_hsic_xprt_list(hsic_xprtp->ch_name); sdio_xprtp_item = find_sdio_xprt_list(sdio_xprtp->ch_name);
mutex_lock(&hsic_remote_xprt_list_lock_lha1); mutex_lock(&sdio_remote_xprt_list_lock_lha1);
list_add(&hsic_xprtp->list, &hsic_remote_xprt_list); list_add(&sdio_xprtp->list, &sdio_remote_xprt_list);
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
if (!hsic_xprtp_item) { if (!sdio_xprtp_item) {
hsic_xprtp->driver.driver.name = hsic_xprtp->ch_name; sdio_xprtp->driver.driver.name = sdio_xprtp->ch_name;
hsic_xprtp->driver.driver.owner = THIS_MODULE; sdio_xprtp->driver.driver.owner = THIS_MODULE;
hsic_xprtp->driver.probe = msm_ipc_router_hsic_remote_probe; sdio_xprtp->driver.probe = msm_ipc_router_sdio_remote_probe;
hsic_xprtp->driver.remove = msm_ipc_router_hsic_remote_remove; sdio_xprtp->driver.remove = msm_ipc_router_sdio_remote_remove;
ret = platform_driver_register(&hsic_xprtp->driver); ret = platform_driver_register(&sdio_xprtp->driver);
if (ret) { if (ret) {
IPC_RTR_ERR( IPC_RTR_ERR(
"%s: Failed to register platform driver[%s]\n", "%s: Failed to register platform driver[%s]\n",
__func__, hsic_xprtp->ch_name); __func__, sdio_xprtp->ch_name);
return ret; return ret;
} }
} else { } else {
IPC_RTR_ERR("%s Already driver registered %s\n", IPC_RTR_ERR("%s Already driver registered %s\n",
__func__, hsic_xprtp->ch_name); __func__, sdio_xprtp->ch_name);
} }
return 0; return 0;
} }
/** /**
* msm_ipc_router_hsic_config_init() - init HSIC xprt configs * msm_ipc_router_sdio_config_init() - init SDIO xprt configs
* *
* @hsic_xprt_config: pointer to HSIC xprt configurations. * @sdio_xprt_config: pointer to SDIO xprt configurations.
* *
* @return: 0 on success, standard Linux error codes on error. * @return: 0 on success, standard Linux error codes on error.
* *
* This function is called to initialize the HSIC XPRT pointer with * This function is called to initialize the SDIO XPRT pointer with
* the HSIC XPRT configurations either from device tree or static arrays. * the SDIO XPRT configurations either from device tree or static arrays.
*/ */
static int msm_ipc_router_hsic_config_init( static int msm_ipc_router_sdio_config_init(
struct msm_ipc_router_hsic_xprt_config *hsic_xprt_config) struct msm_ipc_router_sdio_xprt_config *sdio_xprt_config)
{ {
struct msm_ipc_router_hsic_xprt *hsic_xprtp; struct msm_ipc_router_sdio_xprt *sdio_xprtp;
hsic_xprtp = kzalloc(sizeof(struct msm_ipc_router_hsic_xprt), sdio_xprtp = kzalloc(sizeof(struct msm_ipc_router_sdio_xprt),
GFP_KERNEL); GFP_KERNEL);
if (IS_ERR_OR_NULL(hsic_xprtp)) { if (IS_ERR_OR_NULL(sdio_xprtp)) {
IPC_RTR_ERR("%s: kzalloc() failed for hsic_xprtp id:%s\n", IPC_RTR_ERR("%s: kzalloc() failed for sdio_xprtp id:%s\n",
__func__, hsic_xprt_config->ch_name); __func__, sdio_xprt_config->ch_name);
return -ENOMEM; return -ENOMEM;
} }
hsic_xprtp->xprt.link_id = hsic_xprt_config->link_id; sdio_xprtp->xprt.link_id = sdio_xprt_config->link_id;
hsic_xprtp->xprt_version = hsic_xprt_config->xprt_version; sdio_xprtp->xprt_version = sdio_xprt_config->xprt_version;
strlcpy(hsic_xprtp->ch_name, hsic_xprt_config->ch_name, strlcpy(sdio_xprtp->ch_name, sdio_xprt_config->ch_name,
XPRT_NAME_LEN); XPRT_NAME_LEN);
strlcpy(hsic_xprtp->xprt_name, hsic_xprt_config->xprt_name, strlcpy(sdio_xprtp->xprt_name, sdio_xprt_config->xprt_name,
XPRT_NAME_LEN); XPRT_NAME_LEN);
hsic_xprtp->xprt.name = hsic_xprtp->xprt_name; sdio_xprtp->xprt.name = sdio_xprtp->xprt_name;
hsic_xprtp->xprt.set_version = sdio_xprtp->xprt.set_version =
ipc_router_hsic_set_xprt_version; ipc_router_sdio_set_xprt_version;
hsic_xprtp->xprt.get_version = sdio_xprtp->xprt.get_version =
msm_ipc_router_hsic_get_xprt_version; msm_ipc_router_sdio_get_xprt_version;
hsic_xprtp->xprt.get_option = sdio_xprtp->xprt.get_option =
msm_ipc_router_hsic_get_xprt_option; msm_ipc_router_sdio_get_xprt_option;
hsic_xprtp->xprt.read_avail = NULL; sdio_xprtp->xprt.read_avail = NULL;
hsic_xprtp->xprt.read = NULL; sdio_xprtp->xprt.read = NULL;
hsic_xprtp->xprt.write_avail = sdio_xprtp->xprt.write_avail =
msm_ipc_router_hsic_remote_write_avail; msm_ipc_router_sdio_remote_write_avail;
hsic_xprtp->xprt.write = msm_ipc_router_hsic_remote_write; sdio_xprtp->xprt.write = msm_ipc_router_sdio_remote_write;
hsic_xprtp->xprt.close = msm_ipc_router_hsic_remote_close; sdio_xprtp->xprt.close = msm_ipc_router_sdio_remote_close;
hsic_xprtp->xprt.sft_close_done = hsic_xprt_sft_close_done; sdio_xprtp->xprt.sft_close_done = sdio_xprt_sft_close_done;
hsic_xprtp->xprt.priv = NULL; sdio_xprtp->xprt.priv = NULL;
hsic_xprtp->in_pkt = NULL; sdio_xprtp->in_pkt = NULL;
INIT_DELAYED_WORK(&hsic_xprtp->read_work, hsic_xprt_read_data); INIT_DELAYED_WORK(&sdio_xprtp->read_work, sdio_xprt_read_data);
mutex_init(&hsic_xprtp->ss_reset_lock); mutex_init(&sdio_xprtp->ss_reset_lock);
hsic_xprtp->ss_reset = 0; sdio_xprtp->ss_reset = 0;
hsic_xprtp->xprt_option = 0; sdio_xprtp->xprt_option = 0;
msm_ipc_router_hsic_driver_register(hsic_xprtp); msm_ipc_router_sdio_driver_register(sdio_xprtp);
return 0; return 0;
} }
@ -630,12 +639,12 @@ static int msm_ipc_router_hsic_config_init(
* parse_devicetree() - parse device tree binding * parse_devicetree() - parse device tree binding
* *
* @node: pointer to device tree node * @node: pointer to device tree node
* @hsic_xprt_config: pointer to HSIC XPRT configurations * @sdio_xprt_config: pointer to SDIO XPRT configurations
* *
* @return: 0 on success, -ENODEV on failure. * @return: 0 on success, -ENODEV on failure.
*/ */
static int parse_devicetree(struct device_node *node, static int parse_devicetree(struct device_node *node,
struct msm_ipc_router_hsic_xprt_config *hsic_xprt_config) struct msm_ipc_router_sdio_xprt_config *sdio_xprt_config)
{ {
int ret; int ret;
int link_id; int link_id;
@ -648,7 +657,7 @@ static int parse_devicetree(struct device_node *node,
ch_name = of_get_property(node, key, NULL); ch_name = of_get_property(node, key, NULL);
if (!ch_name) if (!ch_name)
goto error; goto error;
strlcpy(hsic_xprt_config->ch_name, ch_name, XPRT_NAME_LEN); strlcpy(sdio_xprt_config->ch_name, ch_name, XPRT_NAME_LEN);
key = "qcom,xprt-remote"; key = "qcom,xprt-remote";
remote_ss = of_get_property(node, key, NULL); remote_ss = of_get_property(node, key, NULL);
@ -659,16 +668,16 @@ static int parse_devicetree(struct device_node *node,
ret = of_property_read_u32(node, key, &link_id); ret = of_property_read_u32(node, key, &link_id);
if (ret) if (ret)
goto error; goto error;
hsic_xprt_config->link_id = link_id; sdio_xprt_config->link_id = link_id;
key = "qcom,xprt-version"; key = "qcom,xprt-version";
ret = of_property_read_u32(node, key, &version); ret = of_property_read_u32(node, key, &version);
if (ret) if (ret)
goto error; goto error;
hsic_xprt_config->xprt_version = version; sdio_xprt_config->xprt_version = version;
scnprintf(hsic_xprt_config->xprt_name, XPRT_NAME_LEN, "%s_%s", scnprintf(sdio_xprt_config->xprt_name, XPRT_NAME_LEN, "%s_%s",
remote_ss, hsic_xprt_config->ch_name); remote_ss, sdio_xprt_config->ch_name);
return 0; return 0;
@ -678,37 +687,36 @@ error:
} }
/** /**
* msm_ipc_router_hsic_xprt_probe() - Probe an HSIC xprt * msm_ipc_router_sdio_xprt_probe() - Probe an SDIO xprt
* @pdev: Platform device corresponding to HSIC xprt. * @pdev: Platform device corresponding to SDIO xprt.
* *
* @return: 0 on success, standard Linux error codes on error. * @return: 0 on success, standard Linux error codes on error.
* *
* This function is called when the underlying device tree driver registers * This function is called when the underlying device tree driver registers
* a platform device, mapped to an HSIC transport. * a platform device, mapped to an SDIO transport.
*/ */
static int msm_ipc_router_hsic_xprt_probe( static int msm_ipc_router_sdio_xprt_probe(struct platform_device *pdev)
struct platform_device *pdev)
{ {
int ret; int ret;
struct msm_ipc_router_hsic_xprt_config hsic_xprt_config; struct msm_ipc_router_sdio_xprt_config sdio_xprt_config;
if (pdev && pdev->dev.of_node) { if (pdev && pdev->dev.of_node) {
mutex_lock(&hsic_remote_xprt_list_lock_lha1); mutex_lock(&sdio_remote_xprt_list_lock_lha1);
ipc_router_hsic_xprt_probe_done = 1; ipc_router_sdio_xprt_probe_done = 1;
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
ret = parse_devicetree(pdev->dev.of_node, ret = parse_devicetree(pdev->dev.of_node,
&hsic_xprt_config); &sdio_xprt_config);
if (ret) { if (ret) {
IPC_RTR_ERR("%s: Failed to parse device tree\n", IPC_RTR_ERR("%s: Failed to parse device tree\n",
__func__); __func__);
return ret; return ret;
} }
ret = msm_ipc_router_hsic_config_init( ret = msm_ipc_router_sdio_config_init(
&hsic_xprt_config); &sdio_xprt_config);
if (ret) { if (ret) {
IPC_RTR_ERR(" %s init failed\n", __func__); IPC_RTR_ERR("%s init failed\n", __func__);
return ret; return ret;
} }
} }
@ -716,7 +724,7 @@ static int msm_ipc_router_hsic_xprt_probe(
} }
/** /**
* ipc_router_hsic_xprt_probe_worker() - probe worker for non DT configurations * ipc_router_sdio_xprt_probe_worker() - probe worker for non DT configurations
* *
* @work: work item to process * @work: work item to process
* *
@ -724,60 +732,59 @@ static int msm_ipc_router_hsic_xprt_probe(
* device tree probe is done or not. If device tree probe fails the default * device tree probe is done or not. If device tree probe fails the default
* configurations read from static array. * configurations read from static array.
*/ */
static void ipc_router_hsic_xprt_probe_worker(struct work_struct *work) static void ipc_router_sdio_xprt_probe_worker(struct work_struct *work)
{ {
int i, ret; int i, ret;
BUG_ON(ARRAY_SIZE(hsic_xprt_cfg) != NUM_HSIC_XPRTS); BUG_ON(ARRAY_SIZE(sdio_xprt_cfg) != NUM_SDIO_XPRTS);
mutex_lock(&hsic_remote_xprt_list_lock_lha1); mutex_lock(&sdio_remote_xprt_list_lock_lha1);
if (!ipc_router_hsic_xprt_probe_done) { if (!ipc_router_sdio_xprt_probe_done) {
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
for (i = 0; i < ARRAY_SIZE(hsic_xprt_cfg); i++) { for (i = 0; i < ARRAY_SIZE(sdio_xprt_cfg); i++) {
ret = msm_ipc_router_hsic_config_init( ret = msm_ipc_router_sdio_config_init(
&hsic_xprt_cfg[i]); &sdio_xprt_cfg[i]);
if (ret) if (ret)
IPC_RTR_ERR(" %s init failed config idx %d\n", D("%s init failed config idx %d\n",
__func__, i); __func__, i);
} }
mutex_lock(&hsic_remote_xprt_list_lock_lha1); mutex_lock(&sdio_remote_xprt_list_lock_lha1);
} }
mutex_unlock(&hsic_remote_xprt_list_lock_lha1); mutex_unlock(&sdio_remote_xprt_list_lock_lha1);
} }
static const struct of_device_id msm_ipc_router_hsic_xprt_match_table[] = { static const struct of_device_id msm_ipc_router_sdio_xprt_match_table[] = {
{ .compatible = "qcom,ipc_router_hsic_xprt" }, { .compatible = "qcom,ipc_router_sdio_xprt" },
{}, {},
}; };
static struct platform_driver msm_ipc_router_hsic_xprt_driver = { static struct platform_driver msm_ipc_router_sdio_xprt_driver = {
.probe = msm_ipc_router_hsic_xprt_probe, .probe = msm_ipc_router_sdio_xprt_probe,
.driver = { .driver = {
.name = MODULE_NAME, .name = MODULE_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = msm_ipc_router_hsic_xprt_match_table, .of_match_table = msm_ipc_router_sdio_xprt_match_table,
}, },
}; };
static int __init msm_ipc_router_hsic_xprt_init(void) static int __init msm_ipc_router_sdio_xprt_init(void)
{ {
int rc; int rc;
rc = platform_driver_register(&msm_ipc_router_hsic_xprt_driver); rc = platform_driver_register(&msm_ipc_router_sdio_xprt_driver);
if (rc) { if (rc) {
IPC_RTR_ERR( IPC_RTR_ERR(
"%s: msm_ipc_router_hsic_xprt_driver register failed %d\n", "%s: msm_ipc_router_sdio_xprt_driver register failed %d\n",
__func__, rc); __func__, rc);
return rc; return rc;
} }
INIT_DELAYED_WORK(&ipc_router_hsic_xprt_probe_work, INIT_DELAYED_WORK(&ipc_router_sdio_xprt_probe_work,
ipc_router_hsic_xprt_probe_worker); ipc_router_sdio_xprt_probe_worker);
schedule_delayed_work(&ipc_router_hsic_xprt_probe_work, schedule_delayed_work(&ipc_router_sdio_xprt_probe_work,
msecs_to_jiffies(IPC_ROUTER_HSIC_XPRT_WAIT_TIMEOUT)); msecs_to_jiffies(IPC_ROUTER_SDIO_XPRT_WAIT_TIMEOUT));
return 0; return 0;
} }
module_init(msm_ipc_router_hsic_xprt_init); module_init(msm_ipc_router_sdio_xprt_init);
MODULE_DESCRIPTION("IPC Router HSIC XPRT");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");