Skip to content
Snippets Groups Projects
Commit a7d090b9 authored by Vijayavardhan Vennapusa's avatar Vijayavardhan Vennapusa Committed by Gerrit - the friendly Code Review server
Browse files

USB: ehci-msm2: Add module parameter to activate driver for uicc card


On some platforms, host only port is used for connecting peripherals
like uicc card. Userspace will come to know uicc card insertion and
use sysfs interface to activate driver and binds driver. Hence fail
probe for uicc card till userspace activates this driver through
sysfs.

Userspace has to run following commands to activate driver:
    1. echo Y > /sys/module/ehci_msm2/parameters/uicc_card_present
    2. echo msm_ehci_host > /sys/bus/platform/mdrivers/msm_ehci_host/bind

Also external vbus is not required for uicc card and hence don't fail
probe if no external vbus.

CRs-Fixed: 616098
Change-Id: I821bb2cabf4b5ba46fef71ac48a7df0b7aa74bf6
Signed-off-by: default avatarVijayavardhan Vennapusa <vvreddy@codeaurora.org>
parent 9b1cedc0
Branches
Tags
No related merge requests found
...@@ -193,6 +193,7 @@ Optional properties : ...@@ -193,6 +193,7 @@ Optional properties :
- qcom,ext-hub-reset-gpio: If present then an external HUB is connected to - qcom,ext-hub-reset-gpio: If present then an external HUB is connected to
the USB host controller and its RESET_N signal is connected to this the USB host controller and its RESET_N signal is connected to this
ext-hub-reset-gpio GPIO. It should be driven LOW to RESET the HUB. ext-hub-reset-gpio GPIO. It should be driven LOW to RESET the HUB.
- qcom,usb2-enable-uicc: If present, usb2 port will be used for uicc card connection.
Example MSM HSUSB EHCI controller device node : Example MSM HSUSB EHCI controller device node :
ehci: qcom,ehci-host@f9a55000 { ehci: qcom,ehci-host@f9a55000 {
...@@ -212,6 +213,7 @@ Example MSM HSUSB EHCI controller device node : ...@@ -212,6 +213,7 @@ Example MSM HSUSB EHCI controller device node :
qcom,usb2-enable-hsphy2; qcom,usb2-enable-hsphy2;
qcom,usb2-power-budget = <500>; qcom,usb2-power-budget = <500>;
qcom,vdd-voltage-level = <1 2 3 5 7>; qcom,vdd-voltage-level = <1 2 3 5 7>;
qcom,usb2-enable-uicc;
}; };
ANDROID USB: ANDROID USB:
......
...@@ -57,6 +57,10 @@ static const char hcd_name[] = "ehci-msm2"; ...@@ -57,6 +57,10 @@ static const char hcd_name[] = "ehci-msm2";
#define PDEV_NAME_LEN 20 #define PDEV_NAME_LEN 20
static bool uicc_card_present;
module_param(uicc_card_present, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(uicc_card_present, "UICC card inserted");
struct msm_hcd { struct msm_hcd {
struct ehci_hcd ehci; struct ehci_hcd ehci;
spinlock_t wakeup_lock; spinlock_t wakeup_lock;
...@@ -291,6 +295,11 @@ static int msm_ehci_config_vddcx(struct msm_hcd *mhcd, int high) ...@@ -291,6 +295,11 @@ static int msm_ehci_config_vddcx(struct msm_hcd *mhcd, int high)
static void msm_ehci_vbus_power(struct msm_hcd *mhcd, bool on) static void msm_ehci_vbus_power(struct msm_hcd *mhcd, bool on)
{ {
int ret; int ret;
const struct msm_usb_host_platform_data *pdata;
pdata = mhcd->dev->platform_data;
if (pdata && pdata->is_uicc)
return;
if (!mhcd->vbus) { if (!mhcd->vbus) {
pr_err("vbus is NULL."); pr_err("vbus is NULL.");
...@@ -348,6 +357,10 @@ static int msm_ehci_init_vbus(struct msm_hcd *mhcd, int init) ...@@ -348,6 +357,10 @@ static int msm_ehci_init_vbus(struct msm_hcd *mhcd, int init)
pdata = mhcd->dev->platform_data; pdata = mhcd->dev->platform_data;
/* For uicc card connection, external vbus is not required */
if (pdata && pdata->is_uicc)
return 0;
if (!init) { if (!init) {
if (pdata && pdata->dock_connect_irq) if (pdata && pdata->dock_connect_irq)
free_irq(pdata->dock_connect_irq, mhcd); free_irq(pdata->dock_connect_irq, mhcd);
...@@ -1275,6 +1288,8 @@ struct msm_usb_host_platform_data *ehci_msm2_dt_to_pdata( ...@@ -1275,6 +1288,8 @@ struct msm_usb_host_platform_data *ehci_msm2_dt_to_pdata(
pdata->ext_hub_reset_gpio = of_get_named_gpio(node, pdata->ext_hub_reset_gpio = of_get_named_gpio(node,
"qcom,ext-hub-reset-gpio", 0); "qcom,ext-hub-reset-gpio", 0);
pdata->is_uicc = of_property_read_bool(node,
"qcom,usb2-enable-uicc");
return pdata; return pdata;
} }
...@@ -1292,6 +1307,14 @@ static int ehci_msm2_probe(struct platform_device *pdev) ...@@ -1292,6 +1307,14 @@ static int ehci_msm2_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "ehci_msm2 probe\n"); dev_dbg(&pdev->dev, "ehci_msm2 probe\n");
/*
* Fail probe in case of uicc till userspace activates driver through
* sysfs entry.
*/
if (!uicc_card_present && pdev->dev.of_node && of_property_read_bool(
pdev->dev.of_node, "qcom,usb2-enable-uicc"))
return -ENODEV;
hcd = usb_create_hcd(&ehci_msm2_hc_driver, &pdev->dev, hcd = usb_create_hcd(&ehci_msm2_hc_driver, &pdev->dev,
dev_name(&pdev->dev)); dev_name(&pdev->dev));
if (!hcd) { if (!hcd) {
......
...@@ -556,6 +556,7 @@ struct msm_usb_host_platform_data { ...@@ -556,6 +556,7 @@ struct msm_usb_host_platform_data {
bool no_selective_suspend; bool no_selective_suspend;
int resume_gpio; int resume_gpio;
int ext_hub_reset_gpio; int ext_hub_reset_gpio;
bool is_uicc;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment