aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorIvan T. Ivanov <iivanov@mm-sol.com>2014-04-28 09:34:11 -0400
committerFelipe Balbi <balbi@ti.com>2014-04-30 12:28:43 -0400
commit971232cf7c7a71ad3cbf433f592eee3ae1a578ac (patch)
tree646929ed73c9cd216800a5b423895018f71af6d0 /drivers
parent3aca0fa95f61918d5b78b683c0fbcbf693579f81 (diff)
usb: phy: msm: Replace custom enum usb_mode_type with enum usb_dr_mode
Use enum usb_dr_mode and drop default usb_dr_mode from platform data. USB DT bindings states: dr_mode: "...In case this attribute isn't passed via DT, USB DRD controllers should default to OTG...", so remove redundand field. Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Acked-by: David Brown <davidb@codeaurora.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/phy/phy-msm-usb.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index 874c51a85683..7eb2abf3f874 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -348,10 +348,10 @@ static int msm_otg_reset(struct usb_phy *phy)
348 348
349 if (pdata->otg_control == OTG_PHY_CONTROL) { 349 if (pdata->otg_control == OTG_PHY_CONTROL) {
350 val = readl(USB_OTGSC); 350 val = readl(USB_OTGSC);
351 if (pdata->mode == USB_OTG) { 351 if (pdata->mode == USB_DR_MODE_OTG) {
352 ulpi_val = ULPI_INT_IDGRD | ULPI_INT_SESS_VALID; 352 ulpi_val = ULPI_INT_IDGRD | ULPI_INT_SESS_VALID;
353 val |= OTGSC_IDIE | OTGSC_BSVIE; 353 val |= OTGSC_IDIE | OTGSC_BSVIE;
354 } else if (pdata->mode == USB_PERIPHERAL) { 354 } else if (pdata->mode == USB_DR_MODE_PERIPHERAL) {
355 ulpi_val = ULPI_INT_SESS_VALID; 355 ulpi_val = ULPI_INT_SESS_VALID;
356 val |= OTGSC_BSVIE; 356 val |= OTGSC_BSVIE;
357 } 357 }
@@ -637,7 +637,7 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
637 * Fail host registration if this board can support 637 * Fail host registration if this board can support
638 * only peripheral configuration. 638 * only peripheral configuration.
639 */ 639 */
640 if (motg->pdata->mode == USB_PERIPHERAL) { 640 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) {
641 dev_info(otg->phy->dev, "Host mode is not supported\n"); 641 dev_info(otg->phy->dev, "Host mode is not supported\n");
642 return -ENODEV; 642 return -ENODEV;
643 } 643 }
@@ -666,7 +666,7 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
666 * Kick the state machine work, if peripheral is not supported 666 * Kick the state machine work, if peripheral is not supported
667 * or peripheral is already registered with us. 667 * or peripheral is already registered with us.
668 */ 668 */
669 if (motg->pdata->mode == USB_HOST || otg->gadget) { 669 if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) {
670 pm_runtime_get_sync(otg->phy->dev); 670 pm_runtime_get_sync(otg->phy->dev);
671 schedule_work(&motg->sm_work); 671 schedule_work(&motg->sm_work);
672 } 672 }
@@ -710,7 +710,7 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
710 * Fail peripheral registration if this board can support 710 * Fail peripheral registration if this board can support
711 * only host configuration. 711 * only host configuration.
712 */ 712 */
713 if (motg->pdata->mode == USB_HOST) { 713 if (motg->pdata->mode == USB_DR_MODE_HOST) {
714 dev_info(otg->phy->dev, "Peripheral mode is not supported\n"); 714 dev_info(otg->phy->dev, "Peripheral mode is not supported\n");
715 return -ENODEV; 715 return -ENODEV;
716 } 716 }
@@ -735,7 +735,7 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
735 * Kick the state machine work, if host is not supported 735 * Kick the state machine work, if host is not supported
736 * or host is already registered with us. 736 * or host is already registered with us.
737 */ 737 */
738 if (motg->pdata->mode == USB_PERIPHERAL || otg->host) { 738 if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) {
739 pm_runtime_get_sync(otg->phy->dev); 739 pm_runtime_get_sync(otg->phy->dev);
740 schedule_work(&motg->sm_work); 740 schedule_work(&motg->sm_work);
741 } 741 }
@@ -1056,7 +1056,7 @@ static void msm_otg_init_sm(struct msm_otg *motg)
1056 u32 otgsc = readl(USB_OTGSC); 1056 u32 otgsc = readl(USB_OTGSC);
1057 1057
1058 switch (pdata->mode) { 1058 switch (pdata->mode) {
1059 case USB_OTG: 1059 case USB_DR_MODE_OTG:
1060 if (pdata->otg_control == OTG_PHY_CONTROL) { 1060 if (pdata->otg_control == OTG_PHY_CONTROL) {
1061 if (otgsc & OTGSC_ID) 1061 if (otgsc & OTGSC_ID)
1062 set_bit(ID, &motg->inputs); 1062 set_bit(ID, &motg->inputs);
@@ -1068,21 +1068,14 @@ static void msm_otg_init_sm(struct msm_otg *motg)
1068 else 1068 else
1069 clear_bit(B_SESS_VLD, &motg->inputs); 1069 clear_bit(B_SESS_VLD, &motg->inputs);
1070 } else if (pdata->otg_control == OTG_USER_CONTROL) { 1070 } else if (pdata->otg_control == OTG_USER_CONTROL) {
1071 if (pdata->default_mode == USB_HOST) {
1072 clear_bit(ID, &motg->inputs);
1073 } else if (pdata->default_mode == USB_PERIPHERAL) {
1074 set_bit(ID, &motg->inputs);
1075 set_bit(B_SESS_VLD, &motg->inputs);
1076 } else {
1077 set_bit(ID, &motg->inputs); 1071 set_bit(ID, &motg->inputs);
1078 clear_bit(B_SESS_VLD, &motg->inputs); 1072 clear_bit(B_SESS_VLD, &motg->inputs);
1079 }
1080 } 1073 }
1081 break; 1074 break;
1082 case USB_HOST: 1075 case USB_DR_MODE_HOST:
1083 clear_bit(ID, &motg->inputs); 1076 clear_bit(ID, &motg->inputs);
1084 break; 1077 break;
1085 case USB_PERIPHERAL: 1078 case USB_DR_MODE_PERIPHERAL:
1086 set_bit(ID, &motg->inputs); 1079 set_bit(ID, &motg->inputs);
1087 if (otgsc & OTGSC_BSV) 1080 if (otgsc & OTGSC_BSV)
1088 set_bit(B_SESS_VLD, &motg->inputs); 1081 set_bit(B_SESS_VLD, &motg->inputs);
@@ -1258,7 +1251,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
1258 char buf[16]; 1251 char buf[16];
1259 struct usb_otg *otg = motg->phy.otg; 1252 struct usb_otg *otg = motg->phy.otg;
1260 int status = count; 1253 int status = count;
1261 enum usb_mode_type req_mode; 1254 enum usb_dr_mode req_mode;
1262 1255
1263 memset(buf, 0x00, sizeof(buf)); 1256 memset(buf, 0x00, sizeof(buf));
1264 1257
@@ -1268,18 +1261,18 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
1268 } 1261 }
1269 1262
1270 if (!strncmp(buf, "host", 4)) { 1263 if (!strncmp(buf, "host", 4)) {
1271 req_mode = USB_HOST; 1264 req_mode = USB_DR_MODE_HOST;
1272 } else if (!strncmp(buf, "peripheral", 10)) { 1265 } else if (!strncmp(buf, "peripheral", 10)) {
1273 req_mode = USB_PERIPHERAL; 1266 req_mode = USB_DR_MODE_PERIPHERAL;
1274 } else if (!strncmp(buf, "none", 4)) { 1267 } else if (!strncmp(buf, "none", 4)) {
1275 req_mode = USB_NONE; 1268 req_mode = USB_DR_MODE_UNKNOWN;
1276 } else { 1269 } else {
1277 status = -EINVAL; 1270 status = -EINVAL;
1278 goto out; 1271 goto out;
1279 } 1272 }
1280 1273
1281 switch (req_mode) { 1274 switch (req_mode) {
1282 case USB_NONE: 1275 case USB_DR_MODE_UNKNOWN:
1283 switch (otg->phy->state) { 1276 switch (otg->phy->state) {
1284 case OTG_STATE_A_HOST: 1277 case OTG_STATE_A_HOST:
1285 case OTG_STATE_B_PERIPHERAL: 1278 case OTG_STATE_B_PERIPHERAL:
@@ -1290,7 +1283,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
1290 goto out; 1283 goto out;
1291 } 1284 }
1292 break; 1285 break;
1293 case USB_PERIPHERAL: 1286 case USB_DR_MODE_PERIPHERAL:
1294 switch (otg->phy->state) { 1287 switch (otg->phy->state) {
1295 case OTG_STATE_B_IDLE: 1288 case OTG_STATE_B_IDLE:
1296 case OTG_STATE_A_HOST: 1289 case OTG_STATE_A_HOST:
@@ -1301,7 +1294,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
1301 goto out; 1294 goto out;
1302 } 1295 }
1303 break; 1296 break;
1304 case USB_HOST: 1297 case USB_DR_MODE_HOST:
1305 switch (otg->phy->state) { 1298 switch (otg->phy->state) {
1306 case OTG_STATE_B_IDLE: 1299 case OTG_STATE_B_IDLE:
1307 case OTG_STATE_B_PERIPHERAL: 1300 case OTG_STATE_B_PERIPHERAL:
@@ -1511,7 +1504,7 @@ static int msm_otg_probe(struct platform_device *pdev)
1511 platform_set_drvdata(pdev, motg); 1504 platform_set_drvdata(pdev, motg);
1512 device_init_wakeup(&pdev->dev, 1); 1505 device_init_wakeup(&pdev->dev, 1);
1513 1506
1514 if (motg->pdata->mode == USB_OTG && 1507 if (motg->pdata->mode == USB_DR_MODE_OTG &&
1515 motg->pdata->otg_control == OTG_USER_CONTROL) { 1508 motg->pdata->otg_control == OTG_USER_CONTROL) {
1516 ret = msm_otg_debugfs_init(motg); 1509 ret = msm_otg_debugfs_init(motg);
1517 if (ret) 1510 if (ret)