diff options
author | Ivan T. Ivanov <iivanov@mm-sol.com> | 2014-04-28 09:34:11 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-04-30 12:28:43 -0400 |
commit | 971232cf7c7a71ad3cbf433f592eee3ae1a578ac (patch) | |
tree | 646929ed73c9cd216800a5b423895018f71af6d0 | |
parent | 3aca0fa95f61918d5b78b683c0fbcbf693579f81 (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>
-rw-r--r-- | arch/arm/mach-msm/board-msm7x30.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-msm/board-qsd8x50.c | 2 | ||||
-rw-r--r-- | drivers/usb/phy/phy-msm-usb.c | 41 | ||||
-rw-r--r-- | include/linux/usb/msm_hsusb.h | 20 |
4 files changed, 20 insertions, 45 deletions
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c index 46de789ad3ae..0c4c200e1221 100644 --- a/arch/arm/mach-msm/board-msm7x30.c +++ b/arch/arm/mach-msm/board-msm7x30.c | |||
@@ -95,7 +95,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk) | |||
95 | 95 | ||
96 | static struct msm_otg_platform_data msm_otg_pdata = { | 96 | static struct msm_otg_platform_data msm_otg_pdata = { |
97 | .phy_init_seq = hsusb_phy_init_seq, | 97 | .phy_init_seq = hsusb_phy_init_seq, |
98 | .mode = USB_PERIPHERAL, | 98 | .mode = USB_DR_MODE_PERIPHERAL, |
99 | .otg_control = OTG_PHY_CONTROL, | 99 | .otg_control = OTG_PHY_CONTROL, |
100 | .link_clk_reset = hsusb_link_clk_reset, | 100 | .link_clk_reset = hsusb_link_clk_reset, |
101 | .phy_clk_reset = hsusb_phy_clk_reset, | 101 | .phy_clk_reset = hsusb_phy_clk_reset, |
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c index 9169ec324a43..4c748616ef47 100644 --- a/arch/arm/mach-msm/board-qsd8x50.c +++ b/arch/arm/mach-msm/board-qsd8x50.c | |||
@@ -116,7 +116,7 @@ static int hsusb_phy_clk_reset(struct clk *phy_clk) | |||
116 | 116 | ||
117 | static struct msm_otg_platform_data msm_otg_pdata = { | 117 | static struct msm_otg_platform_data msm_otg_pdata = { |
118 | .phy_init_seq = hsusb_phy_init_seq, | 118 | .phy_init_seq = hsusb_phy_init_seq, |
119 | .mode = USB_PERIPHERAL, | 119 | .mode = USB_DR_MODE_PERIPHERAL, |
120 | .otg_control = OTG_PHY_CONTROL, | 120 | .otg_control = OTG_PHY_CONTROL, |
121 | .link_clk_reset = hsusb_link_clk_reset, | 121 | .link_clk_reset = hsusb_link_clk_reset, |
122 | .phy_clk_reset = hsusb_phy_clk_reset, | 122 | .phy_clk_reset = hsusb_phy_clk_reset, |
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) |
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h index 8705b0164684..72c5830455bf 100644 --- a/include/linux/usb/msm_hsusb.h +++ b/include/linux/usb/msm_hsusb.h | |||
@@ -23,21 +23,6 @@ | |||
23 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * Supported USB modes | ||
27 | * | ||
28 | * USB_PERIPHERAL Only peripheral mode is supported. | ||
29 | * USB_HOST Only host mode is supported. | ||
30 | * USB_OTG OTG mode is supported. | ||
31 | * | ||
32 | */ | ||
33 | enum usb_mode_type { | ||
34 | USB_NONE = 0, | ||
35 | USB_PERIPHERAL, | ||
36 | USB_HOST, | ||
37 | USB_OTG, | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * OTG control | 26 | * OTG control |
42 | * | 27 | * |
43 | * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host | 28 | * OTG_NO_CONTROL Id/VBUS notifications not required. Useful in host |
@@ -121,8 +106,6 @@ enum usb_chg_type { | |||
121 | * @power_budget: VBUS power budget in mA (0 will be treated as 500mA). | 106 | * @power_budget: VBUS power budget in mA (0 will be treated as 500mA). |
122 | * @mode: Supported mode (OTG/peripheral/host). | 107 | * @mode: Supported mode (OTG/peripheral/host). |
123 | * @otg_control: OTG switch controlled by user/Id pin | 108 | * @otg_control: OTG switch controlled by user/Id pin |
124 | * @default_mode: Default operational mode. Applicable only if | ||
125 | * OTG switch is controller by user. | ||
126 | * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k | 109 | * @pclk_src_name: pclk is derived from ebi1_usb_clk in case of 7x27 and 8k |
127 | * dfab_usb_hs_clk in case of 8660 and 8960. | 110 | * dfab_usb_hs_clk in case of 8660 and 8960. |
128 | */ | 111 | */ |
@@ -130,9 +113,8 @@ struct msm_otg_platform_data { | |||
130 | int *phy_init_seq; | 113 | int *phy_init_seq; |
131 | void (*vbus_power)(bool on); | 114 | void (*vbus_power)(bool on); |
132 | unsigned power_budget; | 115 | unsigned power_budget; |
133 | enum usb_mode_type mode; | 116 | enum usb_dr_mode mode; |
134 | enum otg_control_type otg_control; | 117 | enum otg_control_type otg_control; |
135 | enum usb_mode_type default_mode; | ||
136 | enum msm_usb_phy_type phy_type; | 118 | enum msm_usb_phy_type phy_type; |
137 | void (*setup_gpio)(enum usb_otg_state state); | 119 | void (*setup_gpio)(enum usb_otg_state state); |
138 | char *pclk_src_name; | 120 | char *pclk_src_name; |