usb_bam: changes for HSIC IPA functionality

Add support for HSIC device mode

Change-Id: Ibe20b01ef657cb820e3b94d4b85ace828fad58ba
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Gilad Broner <gbroner@codeaurora.org>
Signed-off-by: Lena Salman <esalman@codeaurora.org>
This commit is contained in:
Lena Salman 2014-09-01 15:53:37 +03:00
parent ed57b23277
commit 5a11767bc9
4 changed files with 56 additions and 28 deletions

View file

@ -262,7 +262,8 @@ static int get_bam_type_from_core_name(const char *name)
strnstr(name, "dwc3", USB_BAM_MAX_STR_LEN)) strnstr(name, "dwc3", USB_BAM_MAX_STR_LEN))
return DWC3_CTRL; return DWC3_CTRL;
else if (strnstr(name, bam_enable_strings[HSIC_CTRL], else if (strnstr(name, bam_enable_strings[HSIC_CTRL],
USB_BAM_MAX_STR_LEN)) USB_BAM_MAX_STR_LEN) ||
strnstr(name, "ci13xxx_msm_hsic", USB_BAM_MAX_STR_LEN))
return HSIC_CTRL; return HSIC_CTRL;
else if (strnstr(name, bam_enable_strings[CI_CTRL], else if (strnstr(name, bam_enable_strings[CI_CTRL],
USB_BAM_MAX_STR_LEN) || USB_BAM_MAX_STR_LEN) ||
@ -3480,6 +3481,12 @@ int usb_bam_get_connection_idx(const char *core_name, enum peer_bam client,
} }
EXPORT_SYMBOL(usb_bam_get_connection_idx); EXPORT_SYMBOL(usb_bam_get_connection_idx);
int usb_bam_get_bam_type(int connection_idx)
{
return usb_bam_connections[connection_idx].bam_type;
}
EXPORT_SYMBOL(usb_bam_get_bam_type);
bool msm_bam_device_lpm_ok(enum usb_ctrl bam_type) bool msm_bam_device_lpm_ok(enum usb_ctrl bam_type)
{ {
pr_debug("%s: enter bam%s\n", __func__, bam_enable_strings[bam_type]); pr_debug("%s: enter bam%s\n", __func__, bam_enable_strings[bam_type]);

View file

@ -3613,8 +3613,8 @@ static int android_create_device(struct android_dev *dev, u8 usb_core_id)
snprintf(device_node_name, ANDROID_DEVICE_NODE_NAME_LENGTH, snprintf(device_node_name, ANDROID_DEVICE_NODE_NAME_LENGTH,
"android%d", usb_core_id); "android%d", usb_core_id);
pr_debug("%s(): creating android%d device\n", __func__, usb_core_id); pr_debug("%s(): creating android%d device\n", __func__, usb_core_id);
dev->dev = device_create(android_class, NULL, dev->dev = device_create(android_class, NULL, MKDEV(0, usb_core_id),
MKDEV(0, 0), NULL, device_node_name); NULL, device_node_name);
if (IS_ERR(dev->dev)) if (IS_ERR(dev->dev))
return PTR_ERR(dev->dev); return PTR_ERR(dev->dev);

View file

@ -910,7 +910,6 @@ static void bam2bam_data_connect_work(struct work_struct *w)
d_port->ipa_consumer_ep = d->ipa_params.ipa_cons_ep_idx; d_port->ipa_consumer_ep = d->ipa_params.ipa_cons_ep_idx;
if (gadget_is_dwc3(gadget)) {
d->src_bam_idx = usb_bam_get_connection_idx( d->src_bam_idx = usb_bam_get_connection_idx(
gadget->name, gadget->name,
IPA_P_BAM, USB_TO_PEER_PERIPHERAL, IPA_P_BAM, USB_TO_PEER_PERIPHERAL,
@ -921,11 +920,10 @@ static void bam2bam_data_connect_work(struct work_struct *w)
return; return;
} }
if (gadget_is_dwc3(gadget))
configure_usb_data_fifo(d->src_bam_idx, configure_usb_data_fifo(d->src_bam_idx,
port->port_usb->out, port->port_usb->out,
d->src_pipe_type); d->src_pipe_type);
}
/* Remove support for UL using system-to-IPA towards DL */ /* Remove support for UL using system-to-IPA towards DL */
if (d->src_pipe_type == USB_BAM_PIPE_SYS2BAM) { if (d->src_pipe_type == USB_BAM_PIPE_SYS2BAM) {
@ -966,7 +964,6 @@ static void bam2bam_data_connect_work(struct work_struct *w)
__func__, d_port->ipa_producer_ep, __func__, d_port->ipa_producer_ep,
d_port->ipa_consumer_ep); d_port->ipa_consumer_ep);
if (gadget_is_dwc3(gadget)) {
d->dst_bam_idx = usb_bam_get_connection_idx( d->dst_bam_idx = usb_bam_get_connection_idx(
gadget->name, gadget->name,
IPA_P_BAM, PEER_PERIPHERAL_TO_USB, IPA_P_BAM, PEER_PERIPHERAL_TO_USB,
@ -977,10 +974,10 @@ static void bam2bam_data_connect_work(struct work_struct *w)
return; return;
} }
if (gadget_is_dwc3(gadget))
configure_usb_data_fifo(d->dst_bam_idx, configure_usb_data_fifo(d->dst_bam_idx,
port->port_usb->in, port->port_usb->in,
d->dst_pipe_type); d->dst_pipe_type);
}
/* Upadate BAM specific attributes in usb_request */ /* Upadate BAM specific attributes in usb_request */
if (gadget_is_dwc3(gadget)) { if (gadget_is_dwc3(gadget)) {
@ -1210,8 +1207,6 @@ int bam2bam_data_port_select(int portno)
d = &port->data_ch; d = &port->data_ch;
d->port = port; d->port = port;
bam2bam_data_ports[portno] = port; bam2bam_data_ports[portno] = port;
d->ipa_params.src_client = IPA_CLIENT_USB_PROD;
d->ipa_params.dst_client = IPA_CLIENT_USB_CONS;
/* UL workaround requirements */ /* UL workaround requirements */
skb_queue_head_init(&d->rx_skb_q); skb_queue_head_init(&d->rx_skb_q);
@ -1365,6 +1360,18 @@ int bam_data_connect(struct data_port *gr, u8 port_num,
d->rx_buffer_size = (gr->rx_buffer_size ? gr->rx_buffer_size : d->rx_buffer_size = (gr->rx_buffer_size ? gr->rx_buffer_size :
bam_mux_rx_req_size); bam_mux_rx_req_size);
/*
* Both source (consumer) and destination (producer) use the same
* controller, so checking just one of them should suffice.
*/
if (usb_bam_get_bam_type(src_connection_idx) == HSIC_CTRL) {
d->ipa_params.src_client = IPA_CLIENT_HSIC1_PROD;
d->ipa_params.dst_client = IPA_CLIENT_HSIC1_CONS;
} else {
d->ipa_params.src_client = IPA_CLIENT_USB_PROD;
d->ipa_params.dst_client = IPA_CLIENT_USB_CONS;
}
pr_debug("%s(): rx_buffer_size:%d\n", __func__, d->rx_buffer_size); pr_debug("%s(): rx_buffer_size:%d\n", __func__, d->rx_buffer_size);
if (trans == USB_GADGET_XPORT_BAM2BAM_IPA) { if (trans == USB_GADGET_XPORT_BAM2BAM_IPA) {
d->ipa_params.src_pipe = &(d->src_pipe_idx); d->ipa_params.src_pipe = &(d->src_pipe_idx);

View file

@ -413,6 +413,15 @@ void usb_bam_set_qdss_core(const char *qdss_core);
int usb_bam_get_connection_idx(const char *name, enum peer_bam client, int usb_bam_get_connection_idx(const char *name, enum peer_bam client,
enum usb_bam_pipe_dir dir, enum usb_bam_mode bam_mode, u32 num); enum usb_bam_pipe_dir dir, enum usb_bam_mode bam_mode, u32 num);
/**
* return the usb controller bam type used for the supplied connection index
*
* @connection_idx - Connection index
*
* @return usb control bam type
*/
int usb_bam_get_bam_type(int connection_idx);
/** /**
* Indicates the type of connection the USB side of the connection is. * Indicates the type of connection the USB side of the connection is.
* *
@ -527,6 +536,11 @@ static inline int usb_bam_get_connection_idx(const char *name,
return -ENODEV; return -ENODEV;
} }
static inline int usb_bam_get_bam_type(int connection_idx)
{
return -ENODEV;
}
static inline int usb_bam_get_pipe_type(u8 idx, enum usb_bam_pipe_type *type) static inline int usb_bam_get_pipe_type(u8 idx, enum usb_bam_pipe_type *type)
{ {
return -ENODEV; return -ENODEV;