Commit 19c1eac2 authored by Antoine Tenart's avatar Antoine Tenart Committed by Felipe Balbi

usb: rename phy to usb_phy in OTG

This patch prepares the introduction of the generic PHY support in the
USB OTG common functions. The USB PHY member of the OTG structure is
renamed to 'usb_phy' and modifications are done in all drivers accessing
it. Renaming this pointer will allow to keep the compatibility for USB
PHY drivers.
Signed-off-by: default avatarAntoine Tenart <antoine.tenart@free-electrons.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent e47d9254
...@@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator); ...@@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
{ {
struct omap_usb *phy = phy_to_omapusb(otg->phy); struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
if (!phy->comparator) if (!phy->comparator)
return -ENODEV; return -ENODEV;
...@@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled) ...@@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
static int omap_usb_start_srp(struct usb_otg *otg) static int omap_usb_start_srp(struct usb_otg *otg)
{ {
struct omap_usb *phy = phy_to_omapusb(otg->phy); struct omap_usb *phy = phy_to_omapusb(otg->usb_phy);
if (!phy->comparator) if (!phy->comparator)
return -ENODEV; return -ENODEV;
...@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev) ...@@ -251,7 +251,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
otg->set_vbus = omap_usb_set_vbus; otg->set_vbus = omap_usb_set_vbus;
if (phy_data->flags & OMAP_USB2_HAS_START_SRP) if (phy_data->flags & OMAP_USB2_HAS_START_SRP)
otg->start_srp = omap_usb_start_srp; otg->start_srp = omap_usb_start_srp;
otg->phy = &phy->phy; otg->usb_phy = &phy->phy;
platform_set_drvdata(pdev, phy); platform_set_drvdata(pdev, phy);
......
...@@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci) ...@@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
return -ENOMEM; return -ENOMEM;
} }
otg->phy = ci->transceiver; otg->usb_phy = ci->transceiver;
otg->gadget = &ci->gadget; otg->gadget = &ci->gadget;
ci->fsm.otg = otg; ci->fsm.otg = otg;
ci->transceiver->otg = ci->fsm.otg; ci->transceiver->otg = ci->fsm.otg;
......
...@@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg, ...@@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg *otg,
if (!otg) if (!otg)
return -ENODEV; return -ENODEV;
ab = phy_to_ab(otg->phy); ab = phy_to_ab(otg->usb_phy);
ab->phy.otg->gadget = gadget; ab->phy.otg->gadget = gadget;
...@@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
if (!otg) if (!otg)
return -ENODEV; return -ENODEV;
ab = phy_to_ab(otg->phy); ab = phy_to_ab(otg->usb_phy);
ab->phy.otg->host = host; ab->phy.otg->host = host;
...@@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev) ...@@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device *pdev)
ab->phy.set_power = ab8500_usb_set_power; ab->phy.set_power = ab8500_usb_set_power;
ab->phy.otg->state = OTG_STATE_UNDEFINED; ab->phy.otg->state = OTG_STATE_UNDEFINED;
otg->phy = &ab->phy; otg->usb_phy = &ab->phy;
otg->set_host = ab8500_usb_set_host; otg->set_host = ab8500_usb_set_host;
otg->set_peripheral = ab8500_usb_set_peripheral; otg->set_peripheral = ab8500_usb_set_peripheral;
......
...@@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on) ...@@ -499,7 +499,8 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
{ {
struct usb_otg *otg = fsm->otg; struct usb_otg *otg = fsm->otg;
struct device *dev; struct device *dev;
struct fsl_otg *otg_dev = container_of(otg->phy, struct fsl_otg, phy); struct fsl_otg *otg_dev =
container_of(otg->usb_phy, struct fsl_otg, phy);
u32 retval = 0; u32 retval = 0;
if (!otg->host) if (!otg->host)
...@@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -594,7 +595,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
if (!otg) if (!otg)
return -ENODEV; return -ENODEV;
otg_dev = container_of(otg->phy, struct fsl_otg, phy); otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
if (otg_dev != fsl_otg_dev) if (otg_dev != fsl_otg_dev)
return -ENODEV; return -ENODEV;
...@@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg, ...@@ -644,7 +645,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg,
if (!otg) if (!otg)
return -ENODEV; return -ENODEV;
otg_dev = container_of(otg->phy, struct fsl_otg, phy); otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
VDBG("otg_dev 0x%x\n", (int)otg_dev); VDBG("otg_dev 0x%x\n", (int)otg_dev);
VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev); VDBG("fsl_otg_dev 0x%x\n", (int)fsl_otg_dev);
if (otg_dev != fsl_otg_dev) if (otg_dev != fsl_otg_dev)
...@@ -717,7 +718,7 @@ static int fsl_otg_start_srp(struct usb_otg *otg) ...@@ -717,7 +718,7 @@ static int fsl_otg_start_srp(struct usb_otg *otg)
if (!otg || otg.state != OTG_STATE_B_IDLE) if (!otg || otg.state != OTG_STATE_B_IDLE)
return -ENODEV; return -ENODEV;
otg_dev = container_of(otg->phy, struct fsl_otg, phy); otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
if (otg_dev != fsl_otg_dev) if (otg_dev != fsl_otg_dev)
return -ENODEV; return -ENODEV;
...@@ -735,7 +736,7 @@ static int fsl_otg_start_hnp(struct usb_otg *otg) ...@@ -735,7 +736,7 @@ static int fsl_otg_start_hnp(struct usb_otg *otg)
if (!otg) if (!otg)
return -ENODEV; return -ENODEV;
otg_dev = container_of(otg->phy, struct fsl_otg, phy); otg_dev = container_of(otg->usb_phy, struct fsl_otg, phy);
if (otg_dev != fsl_otg_dev) if (otg_dev != fsl_otg_dev)
return -ENODEV; return -ENODEV;
...@@ -857,7 +858,7 @@ static int fsl_otg_conf(struct platform_device *pdev) ...@@ -857,7 +858,7 @@ static int fsl_otg_conf(struct platform_device *pdev)
fsl_otg_tc->phy.dev = &pdev->dev; fsl_otg_tc->phy.dev = &pdev->dev;
fsl_otg_tc->phy.set_power = fsl_otg_set_power; fsl_otg_tc->phy.set_power = fsl_otg_set_power;
fsl_otg_tc->phy.otg->phy = &fsl_otg_tc->phy; fsl_otg_tc->phy.otg->usb_phy = &fsl_otg_tc->phy;
fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host; fsl_otg_tc->phy.otg->set_host = fsl_otg_set_host;
fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral; fsl_otg_tc->phy.otg->set_peripheral = fsl_otg_set_peripheral;
fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp; fsl_otg_tc->phy.otg->start_hnp = fsl_otg_start_hnp;
......
...@@ -228,7 +228,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop, ...@@ -228,7 +228,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop,
nop->phy.type = type; nop->phy.type = type;
nop->phy.otg->state = OTG_STATE_UNDEFINED; nop->phy.otg->state = OTG_STATE_UNDEFINED;
nop->phy.otg->phy = &nop->phy; nop->phy.otg->usb_phy = &nop->phy;
nop->phy.otg->set_host = nop_set_host; nop->phy.otg->set_host = nop_set_host;
nop->phy.otg->set_peripheral = nop_set_peripheral; nop->phy.otg->set_peripheral = nop_set_peripheral;
......
...@@ -180,7 +180,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg, ...@@ -180,7 +180,7 @@ static int gpio_vbus_set_peripheral(struct usb_otg *otg,
struct platform_device *pdev; struct platform_device *pdev;
int gpio; int gpio;
gpio_vbus = container_of(otg->phy, struct gpio_vbus_data, phy); gpio_vbus = container_of(otg->usb_phy, struct gpio_vbus_data, phy);
pdev = to_platform_device(gpio_vbus->dev); pdev = to_platform_device(gpio_vbus->dev);
pdata = dev_get_platdata(gpio_vbus->dev); pdata = dev_get_platdata(gpio_vbus->dev);
gpio = pdata->gpio_pullup; gpio = pdata->gpio_pullup;
...@@ -271,7 +271,7 @@ static int gpio_vbus_probe(struct platform_device *pdev) ...@@ -271,7 +271,7 @@ static int gpio_vbus_probe(struct platform_device *pdev)
gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend; gpio_vbus->phy.set_suspend = gpio_vbus_set_suspend;
gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED; gpio_vbus->phy.otg->state = OTG_STATE_UNDEFINED;
gpio_vbus->phy.otg->phy = &gpio_vbus->phy; gpio_vbus->phy.otg->usb_phy = &gpio_vbus->phy;
gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral; gpio_vbus->phy.otg->set_peripheral = gpio_vbus_set_peripheral;
err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect"); err = devm_gpio_request(&pdev->dev, gpio, "vbus_detect");
......
...@@ -1275,7 +1275,7 @@ static int isp1301_otg_enable(struct isp1301 *isp) ...@@ -1275,7 +1275,7 @@ static int isp1301_otg_enable(struct isp1301 *isp)
static int static int
isp1301_set_host(struct usb_otg *otg, struct usb_bus *host) isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
{ {
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
if (isp != the_transceiver) if (isp != the_transceiver)
return -ENODEV; return -ENODEV;
...@@ -1331,7 +1331,7 @@ isp1301_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -1331,7 +1331,7 @@ isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
static int static int
isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget) isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
{ {
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
if (isp != the_transceiver) if (isp != the_transceiver)
return -ENODEV; return -ENODEV;
...@@ -1411,7 +1411,7 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA) ...@@ -1411,7 +1411,7 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
static int static int
isp1301_start_srp(struct usb_otg *otg) isp1301_start_srp(struct usb_otg *otg)
{ {
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
u32 otg_ctrl; u32 otg_ctrl;
if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE) if (isp != the_transceiver || isp->phy.otg->state != OTG_STATE_B_IDLE)
...@@ -1438,7 +1438,7 @@ static int ...@@ -1438,7 +1438,7 @@ static int
isp1301_start_hnp(struct usb_otg *otg) isp1301_start_hnp(struct usb_otg *otg)
{ {
#ifdef CONFIG_USB_OTG #ifdef CONFIG_USB_OTG
struct isp1301 *isp = container_of(otg->phy, struct isp1301, phy); struct isp1301 *isp = container_of(otg->usb_phy, struct isp1301, phy);
u32 l; u32 l;
if (isp != the_transceiver) if (isp != the_transceiver)
...@@ -1583,7 +1583,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id) ...@@ -1583,7 +1583,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
isp->phy.label = DRIVER_NAME; isp->phy.label = DRIVER_NAME;
isp->phy.set_power = isp1301_set_power, isp->phy.set_power = isp1301_set_power,
isp->phy.otg->phy = &isp->phy; isp->phy.otg->usb_phy = &isp->phy;
isp->phy.otg->set_host = isp1301_set_host, isp->phy.otg->set_host = isp1301_set_host,
isp->phy.otg->set_peripheral = isp1301_set_peripheral, isp->phy.otg->set_peripheral = isp1301_set_peripheral,
isp->phy.otg->start_srp = isp1301_start_srp, isp->phy.otg->start_srp = isp1301_start_srp,
......
...@@ -708,7 +708,7 @@ static void msm_otg_start_host(struct usb_phy *phy, int on) ...@@ -708,7 +708,7 @@ static void msm_otg_start_host(struct usb_phy *phy, int on)
static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
{ {
struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy);
struct usb_hcd *hcd; struct usb_hcd *hcd;
/* /*
...@@ -716,14 +716,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -716,14 +716,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
* only peripheral configuration. * only peripheral configuration.
*/ */
if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) { if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL) {
dev_info(otg->phy->dev, "Host mode is not supported\n"); dev_info(otg->usb_phy->dev, "Host mode is not supported\n");
return -ENODEV; return -ENODEV;
} }
if (!host) { if (!host) {
if (otg->state == OTG_STATE_A_HOST) { if (otg->state == OTG_STATE_A_HOST) {
pm_runtime_get_sync(otg->phy->dev); pm_runtime_get_sync(otg->usb_phy->dev);
msm_otg_start_host(otg->phy, 0); msm_otg_start_host(otg->usb_phy, 0);
otg->host = NULL; otg->host = NULL;
otg->state = OTG_STATE_UNDEFINED; otg->state = OTG_STATE_UNDEFINED;
schedule_work(&motg->sm_work); schedule_work(&motg->sm_work);
...@@ -738,14 +738,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -738,14 +738,14 @@ static int msm_otg_set_host(struct usb_otg *otg, struct usb_bus *host)
hcd->power_budget = motg->pdata->power_budget; hcd->power_budget = motg->pdata->power_budget;
otg->host = host; otg->host = host;
dev_dbg(otg->phy->dev, "host driver registered w/ tranceiver\n"); dev_dbg(otg->usb_phy->dev, "host driver registered w/ tranceiver\n");
/* /*
* Kick the state machine work, if peripheral is not supported * Kick the state machine work, if peripheral is not supported
* or peripheral is already registered with us. * or peripheral is already registered with us.
*/ */
if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) { if (motg->pdata->mode == USB_DR_MODE_HOST || otg->gadget) {
pm_runtime_get_sync(otg->phy->dev); pm_runtime_get_sync(otg->usb_phy->dev);
schedule_work(&motg->sm_work); schedule_work(&motg->sm_work);
} }
...@@ -782,21 +782,21 @@ static void msm_otg_start_peripheral(struct usb_phy *phy, int on) ...@@ -782,21 +782,21 @@ static void msm_otg_start_peripheral(struct usb_phy *phy, int on)
static int msm_otg_set_peripheral(struct usb_otg *otg, static int msm_otg_set_peripheral(struct usb_otg *otg,
struct usb_gadget *gadget) struct usb_gadget *gadget)
{ {
struct msm_otg *motg = container_of(otg->phy, struct msm_otg, phy); struct msm_otg *motg = container_of(otg->usb_phy, struct msm_otg, phy);
/* /*
* Fail peripheral registration if this board can support * Fail peripheral registration if this board can support
* only host configuration. * only host configuration.
*/ */
if (motg->pdata->mode == USB_DR_MODE_HOST) { if (motg->pdata->mode == USB_DR_MODE_HOST) {
dev_info(otg->phy->dev, "Peripheral mode is not supported\n"); dev_info(otg->usb_phy->dev, "Peripheral mode is not supported\n");
return -ENODEV; return -ENODEV;
} }
if (!gadget) { if (!gadget) {
if (otg->state == OTG_STATE_B_PERIPHERAL) { if (otg->state == OTG_STATE_B_PERIPHERAL) {
pm_runtime_get_sync(otg->phy->dev); pm_runtime_get_sync(otg->usb_phy->dev);
msm_otg_start_peripheral(otg->phy, 0); msm_otg_start_peripheral(otg->usb_phy, 0);
otg->gadget = NULL; otg->gadget = NULL;
otg->state = OTG_STATE_UNDEFINED; otg->state = OTG_STATE_UNDEFINED;
schedule_work(&motg->sm_work); schedule_work(&motg->sm_work);
...@@ -807,14 +807,15 @@ static int msm_otg_set_peripheral(struct usb_otg *otg, ...@@ -807,14 +807,15 @@ static int msm_otg_set_peripheral(struct usb_otg *otg,
return 0; return 0;
} }
otg->gadget = gadget; otg->gadget = gadget;
dev_dbg(otg->phy->dev, "peripheral driver registered w/ tranceiver\n"); dev_dbg(otg->usb_phy->dev,
"peripheral driver registered w/ tranceiver\n");
/* /*
* Kick the state machine work, if host is not supported * Kick the state machine work, if host is not supported
* or host is already registered with us. * or host is already registered with us.
*/ */
if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) { if (motg->pdata->mode == USB_DR_MODE_PERIPHERAL || otg->host) {
pm_runtime_get_sync(otg->phy->dev); pm_runtime_get_sync(otg->usb_phy->dev);
schedule_work(&motg->sm_work); schedule_work(&motg->sm_work);
} }
...@@ -1172,17 +1173,17 @@ static void msm_otg_sm_work(struct work_struct *w) ...@@ -1172,17 +1173,17 @@ static void msm_otg_sm_work(struct work_struct *w)
switch (otg->state) { switch (otg->state) {
case OTG_STATE_UNDEFINED: case OTG_STATE_UNDEFINED:
dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n"); dev_dbg(otg->usb_phy->dev, "OTG_STATE_UNDEFINED state\n");
msm_otg_reset(otg->phy); msm_otg_reset(otg->usb_phy);
msm_otg_init_sm(motg); msm_otg_init_sm(motg);
otg->state = OTG_STATE_B_IDLE; otg->state = OTG_STATE_B_IDLE;
/* FALL THROUGH */ /* FALL THROUGH */
case OTG_STATE_B_IDLE: case OTG_STATE_B_IDLE:
dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n"); dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_IDLE state\n");
if (!test_bit(ID, &motg->inputs) && otg->host) { if (!test_bit(ID, &motg->inputs) && otg->host) {
/* disable BSV bit */ /* disable BSV bit */
writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC); writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC);
msm_otg_start_host(otg->phy, 1); msm_otg_start_host(otg->usb_phy, 1);
otg->state = OTG_STATE_A_HOST; otg->state = OTG_STATE_A_HOST;
} else if (test_bit(B_SESS_VLD, &motg->inputs)) { } else if (test_bit(B_SESS_VLD, &motg->inputs)) {
switch (motg->chg_state) { switch (motg->chg_state) {
...@@ -1198,13 +1199,15 @@ static void msm_otg_sm_work(struct work_struct *w) ...@@ -1198,13 +1199,15 @@ static void msm_otg_sm_work(struct work_struct *w)
case USB_CDP_CHARGER: case USB_CDP_CHARGER:
msm_otg_notify_charger(motg, msm_otg_notify_charger(motg,
IDEV_CHG_MAX); IDEV_CHG_MAX);
msm_otg_start_peripheral(otg->phy, 1); msm_otg_start_peripheral(otg->usb_phy,
1);
otg->state otg->state
= OTG_STATE_B_PERIPHERAL; = OTG_STATE_B_PERIPHERAL;
break; break;
case USB_SDP_CHARGER: case USB_SDP_CHARGER:
msm_otg_notify_charger(motg, IUNIT); msm_otg_notify_charger(motg, IUNIT);
msm_otg_start_peripheral(otg->phy, 1); msm_otg_start_peripheral(otg->usb_phy,
1);
otg->state otg->state
= OTG_STATE_B_PERIPHERAL; = OTG_STATE_B_PERIPHERAL;
break; break;
...@@ -1222,8 +1225,8 @@ static void msm_otg_sm_work(struct work_struct *w) ...@@ -1222,8 +1225,8 @@ static void msm_otg_sm_work(struct work_struct *w)
* is incremented in charger detection work. * is incremented in charger detection work.
*/ */
if (cancel_delayed_work_sync(&motg->chg_work)) { if (cancel_delayed_work_sync(&motg->chg_work)) {
pm_runtime_put_sync(otg->phy->dev); pm_runtime_put_sync(otg->usb_phy->dev);
msm_otg_reset(otg->phy); msm_otg_reset(otg->usb_phy);
} }
msm_otg_notify_charger(motg, 0); msm_otg_notify_charger(motg, 0);
motg->chg_state = USB_CHG_STATE_UNDEFINED; motg->chg_state = USB_CHG_STATE_UNDEFINED;
...@@ -1231,27 +1234,27 @@ static void msm_otg_sm_work(struct work_struct *w) ...@@ -1231,27 +1234,27 @@ static void msm_otg_sm_work(struct work_struct *w)
} }
if (otg->state == OTG_STATE_B_IDLE) if (otg->state == OTG_STATE_B_IDLE)
pm_runtime_put_sync(otg->phy->dev); pm_runtime_put_sync(otg->usb_phy->dev);
break; break;
case OTG_STATE_B_PERIPHERAL: case OTG_STATE_B_PERIPHERAL:
dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n"); dev_dbg(otg->usb_phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
if (!test_bit(B_SESS_VLD, &motg->inputs) || if (!test_bit(B_SESS_VLD, &motg->inputs) ||
!test_bit(ID, &motg->inputs)) { !test_bit(ID, &motg->inputs)) {
msm_otg_notify_charger(motg, 0); msm_otg_notify_charger(motg, 0);
msm_otg_start_peripheral(otg->phy, 0); msm_otg_start_peripheral(otg->usb_phy, 0);
motg->chg_state = USB_CHG_STATE_UNDEFINED; motg->chg_state = USB_CHG_STATE_UNDEFINED;
motg->chg_type = USB_INVALID_CHARGER; motg->chg_type = USB_INVALID_CHARGER;
otg->state = OTG_STATE_B_IDLE; otg->state = OTG_STATE_B_IDLE;
msm_otg_reset(otg->phy); msm_otg_reset(otg->usb_phy);
schedule_work(w); schedule_work(w);
} }
break; break;
case OTG_STATE_A_HOST: case OTG_STATE_A_HOST:
dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n"); dev_dbg(otg->usb_phy->dev, "OTG_STATE_A_HOST state\n");
if (test_bit(ID, &motg->inputs)) { if (test_bit(ID, &motg->inputs)) {
msm_otg_start_host(otg->phy, 0); msm_otg_start_host(otg->usb_phy, 0);
otg->state = OTG_STATE_B_IDLE; otg->state = OTG_STATE_B_IDLE;
msm_otg_reset(otg->phy); msm_otg_reset(otg->usb_phy);
schedule_work(w); schedule_work(w);
} }
break; break;
...@@ -1388,7 +1391,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf, ...@@ -1388,7 +1391,7 @@ static ssize_t msm_otg_mode_write(struct file *file, const char __user *ubuf,
goto out; goto out;
} }
pm_runtime_get_sync(otg->phy->dev); pm_runtime_get_sync(otg->usb_phy->dev);
schedule_work(&motg->sm_work); schedule_work(&motg->sm_work);
out: out:
return status; return status;
...@@ -1668,7 +1671,7 @@ static int msm_otg_probe(struct platform_device *pdev) ...@@ -1668,7 +1671,7 @@ static int msm_otg_probe(struct platform_device *pdev)
phy->io_ops = &msm_otg_io_ops; phy->io_ops = &msm_otg_io_ops;
phy->otg->phy = &motg->phy; phy->otg->usb_phy = &motg->phy;
phy->otg->set_host = msm_otg_set_host; phy->otg->set_host = msm_otg_set_host;
phy->otg->set_peripheral = msm_otg_set_peripheral; phy->otg->set_peripheral = msm_otg_set_peripheral;
......
...@@ -56,7 +56,7 @@ static char *state_string[] = { ...@@ -56,7 +56,7 @@ static char *state_string[] = {
static int mv_otg_set_vbus(struct usb_otg *otg, bool on) static int mv_otg_set_vbus(struct usb_otg *otg, bool on)
{ {
struct mv_otg *mvotg = container_of(otg->phy, struct mv_otg, phy); struct mv_otg *mvotg = container_of(otg->usb_phy, struct mv_otg, phy);
if (mvotg->pdata->set_vbus == NULL) if (mvotg->pdata->set_vbus == NULL)
return -ENODEV; return -ENODEV;
...@@ -716,8 +716,8 @@ static int mv_otg_probe(struct platform_device *pdev) ...@@ -716,8 +716,8 @@ static int mv_otg_probe(struct platform_device *pdev)
mvotg->phy.otg = otg; mvotg->phy.otg = otg;
mvotg->phy.label = driver_name; mvotg->phy.label = driver_name;
otg->phy = &mvotg->phy;
otg->state = OTG_STATE_UNDEFINED; otg->state = OTG_STATE_UNDEFINED;
otg->usb_phy = &mvotg->phy;
otg->set_host = mv_otg_set_host; otg->set_host = mv_otg_set_host;
otg->set_peripheral = mv_otg_set_peripheral; otg->set_peripheral = mv_otg_set_peripheral;
otg->set_vbus = mv_otg_set_vbus; otg->set_vbus = mv_otg_set_vbus;
......
...@@ -196,7 +196,8 @@ static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend) ...@@ -196,7 +196,8 @@ static int tahvo_usb_set_suspend(struct usb_phy *dev, int suspend)
static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
{ {
struct tahvo_usb *tu = container_of(otg->phy, struct tahvo_usb, phy); struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb,
phy);
dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, host); dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, host);
...@@ -225,7 +226,8 @@ static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -225,7 +226,8 @@ static int tahvo_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
static int tahvo_usb_set_peripheral(struct usb_otg *otg, static int tahvo_usb_set_peripheral(struct usb_otg *otg,
struct usb_gadget *gadget) struct usb_gadget *gadget)
{ {
struct tahvo_usb *tu = container_of(otg->phy, struct tahvo_usb, phy); struct tahvo_usb *tu = container_of(otg->usb_phy, struct tahvo_usb,
phy);
dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, gadget); dev_dbg(&tu->pt_dev->dev, "%s %p\n", __func__, gadget);
...@@ -383,7 +385,7 @@ static int tahvo_usb_probe(struct platform_device *pdev) ...@@ -383,7 +385,7 @@ static int tahvo_usb_probe(struct platform_device *pdev)
tu->phy.label = DRIVER_NAME; tu->phy.label = DRIVER_NAME;
tu->phy.set_suspend = tahvo_usb_set_suspend; tu->phy.set_suspend = tahvo_usb_set_suspend;
tu->phy.otg->phy = &tu->phy; tu->phy.otg->usb_phy = &tu->phy;
tu->phy.otg->set_host = tahvo_usb_set_host; tu->phy.otg->set_host = tahvo_usb_set_host;
tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral; tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral;
......
...@@ -211,7 +211,7 @@ static int ulpi_init(struct usb_phy *phy) ...@@ -211,7 +211,7 @@ static int ulpi_init(struct usb_phy *phy)
static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host) static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host)
{ {
struct usb_phy *phy = otg->phy; struct usb_phy *phy = otg->usb_phy;
unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL); unsigned int flags = usb_phy_io_read(phy, ULPI_IFC_CTRL);
if (!host) { if (!host) {
...@@ -237,7 +237,7 @@ static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host) ...@@ -237,7 +237,7 @@ static int ulpi_set_host(struct usb_otg *otg, struct usb_bus *host)
static int ulpi_set_vbus(struct usb_otg *otg, bool on) static int ulpi_set_vbus(struct usb_otg *otg, bool on)
{ {
struct usb_phy *phy = otg->phy; struct usb_phy *phy = otg->usb_phy;
unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL); unsigned int flags = usb_phy_io_read(phy, ULPI_OTG_CTRL);
flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT); flags &= ~(ULPI_OTG_CTRL_DRVVBUS | ULPI_OTG_CTRL_DRVVBUS_EXT);
...@@ -276,7 +276,7 @@ otg_ulpi_create(struct usb_phy_io_ops *ops, ...@@ -276,7 +276,7 @@ otg_ulpi_create(struct usb_phy_io_ops *ops,
phy->otg = otg; phy->otg = otg;
phy->init = ulpi_init; phy->init = ulpi_init;
otg->phy = phy; otg->usb_phy = phy;
otg->set_host = ulpi_set_host; otg->set_host = ulpi_set_host;
otg->set_vbus = ulpi_set_vbus; otg->set_vbus = ulpi_set_vbus;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
struct usb_otg { struct usb_otg {
u8 default_a; u8 default_a;
struct usb_phy *phy; struct usb_phy *usb_phy;
struct usb_bus *host; struct usb_bus *host;
struct usb_gadget *gadget; struct usb_gadget *gadget;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment