[PATCHv8 07/19] usb: otg: isp1301_omap: Start using struct usb_otg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use struct usb_otg members with OTG specific functions instead
of usb_phy members.

Signed-off-by: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx>
---
 drivers/usb/otg/isp1301_omap.c |  176 ++++++++++++++++++++-------------------
 1 files changed, 90 insertions(+), 86 deletions(-)

diff --git a/drivers/usb/otg/isp1301_omap.c b/drivers/usb/otg/isp1301_omap.c
index c9a9441..cb73ed3 100644
--- a/drivers/usb/otg/isp1301_omap.c
+++ b/drivers/usb/otg/isp1301_omap.c
@@ -52,7 +52,8 @@ MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
 MODULE_LICENSE("GPL");
 
 struct isp1301 {
-	struct usb_phy		otg;
+	struct usb_phy		phy;
+	struct usb_otg		otg;
 	struct i2c_client	*client;
 	void			(*i2c_release)(struct device *dev);
 
@@ -236,7 +237,7 @@ isp1301_clear_bits(struct isp1301 *isp, u8 reg, u8 bits)
 
 static inline const char *state_name(struct isp1301 *isp)
 {
-	return usb_phy_state_string(isp->otg.state);
+	return usb_phy_state_string(isp->phy.state);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -251,7 +252,7 @@ static inline const char *state_name(struct isp1301 *isp)
 
 static void power_down(struct isp1301 *isp)
 {
-	isp->otg.state = USB_PHY_STATE_UNDEFINED;
+	isp->phy.state = USB_PHY_STATE_UNDEFINED;
 
 	// isp1301_set_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
 	isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND);
@@ -341,7 +342,7 @@ static void a_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == USB_PHY_STATE_A_IDLE)
+	if (isp->phy.state == USB_PHY_STATE_A_IDLE)
 		return;
 
 	isp->otg.default_a = 1;
@@ -353,7 +354,7 @@ static void a_idle(struct isp1301 *isp, const char *tag)
 		isp->otg.gadget->is_a_peripheral = 1;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = USB_PHY_STATE_A_IDLE;
+	isp->phy.state = USB_PHY_STATE_A_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -365,7 +366,7 @@ static void b_idle(struct isp1301 *isp, const char *tag)
 {
 	u32 l;
 
-	if (isp->otg.state == USB_PHY_STATE_B_IDLE)
+	if (isp->phy.state == USB_PHY_STATE_B_IDLE)
 		return;
 
 	isp->otg.default_a = 0;
@@ -377,7 +378,7 @@ static void b_idle(struct isp1301 *isp, const char *tag)
 		isp->otg.gadget->is_a_peripheral = 0;
 		gadget_suspend(isp);
 	}
-	isp->otg.state = USB_PHY_STATE_B_IDLE;
+	isp->phy.state = USB_PHY_STATE_B_IDLE;
 	l = omap_readl(OTG_CTRL) & OTG_XCEIV_OUTPUTS;
 	omap_writel(l, OTG_CTRL);
 	isp->last_otg_ctrl = l;
@@ -478,7 +479,7 @@ static void check_state(struct isp1301 *isp, const char *tag)
 	default:
 		break;
 	}
-	if (isp->otg.state == state && !extra)
+	if (isp->phy.state == state && !extra)
 		return;
 	pr_debug("otg: %s FSM %s/%02x, %s, %06x\n", tag,
 		usb_phy_state_string(state), fsm, state_name(isp),
@@ -502,22 +503,23 @@ static void update_otg1(struct isp1301 *isp, u8 int_src)
 
 	if (int_src & INTR_SESS_VLD)
 		otg_ctrl |= OTG_ASESSVLD;
-	else if (isp->otg.state == USB_PHY_STATE_A_WAIT_VFALL) {
+	else if (isp->phy.state == USB_PHY_STATE_A_WAIT_VFALL) {
 		a_idle(isp, "vfall");
 		otg_ctrl &= ~OTG_CTRL_BITS;
 	}
 	if (int_src & INTR_VBUS_VLD)
 		otg_ctrl |= OTG_VBUSVLD;
 	if (int_src & INTR_ID_GND) {		/* default-A */
-		if (isp->otg.state == USB_PHY_STATE_B_IDLE
-				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
+		if (isp->phy.state == USB_PHY_STATE_B_IDLE
+				|| isp->phy.state
+					== USB_PHY_STATE_UNDEFINED) {
 			a_idle(isp, "init");
 			return;
 		}
 	} else {				/* default-B */
 		otg_ctrl |= OTG_ID;
-		if (isp->otg.state == USB_PHY_STATE_A_IDLE
-				|| isp->otg.state == USB_PHY_STATE_UNDEFINED) {
+		if (isp->phy.state == USB_PHY_STATE_A_IDLE
+			|| isp->phy.state == USB_PHY_STATE_UNDEFINED) {
 			b_idle(isp, "init");
 			return;
 		}
@@ -551,14 +553,14 @@ static void otg_update_isp(struct isp1301 *isp)
 	isp->last_otg_ctrl = otg_ctrl;
 	otg_ctrl = otg_ctrl & OTG_XCEIV_INPUTS;
 
-	switch (isp->otg.state) {
+	switch (isp->phy.state) {
 	case USB_PHY_STATE_B_IDLE:
 	case USB_PHY_STATE_B_PERIPHERAL:
 	case USB_PHY_STATE_B_SRP_INIT:
 		if (!(otg_ctrl & OTG_PULLUP)) {
 			// if (otg_ctrl & OTG_B_HNPEN) {
 			if (isp->otg.gadget->b_hnp_enable) {
-				isp->otg.state = USB_PHY_STATE_B_WAIT_ACON;
+				isp->phy.state = USB_PHY_STATE_B_WAIT_ACON;
 				pr_debug("  --> b_wait_acon\n");
 			}
 			goto pulldown;
@@ -588,7 +590,7 @@ pulldown:
 	if (!(isp->otg.host))
 		otg_ctrl &= ~OTG_DRV_VBUS;
 
-	switch (isp->otg.state) {
+	switch (isp->phy.state) {
 	case USB_PHY_STATE_A_SUSPEND:
 		if (otg_ctrl & OTG_DRV_VBUS) {
 			set |= OTG1_VBUS_DRV;
@@ -599,7 +601,7 @@ pulldown:
 
 		/* FALLTHROUGH */
 	case USB_PHY_STATE_A_VBUS_ERR:
-		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+		isp->phy.state = USB_PHY_STATE_A_WAIT_VFALL;
 		pr_debug("  --> a_wait_vfall\n");
 		/* FALLTHROUGH */
 	case USB_PHY_STATE_A_WAIT_VFALL:
@@ -608,7 +610,7 @@ pulldown:
 		break;
 	case USB_PHY_STATE_A_IDLE:
 		if (otg_ctrl & OTG_DRV_VBUS) {
-			isp->otg.state = USB_PHY_STATE_A_WAIT_VRISE;
+			isp->phy.state = USB_PHY_STATE_A_WAIT_VRISE;
 			pr_debug("  --> a_wait_vrise\n");
 		}
 		/* FALLTHROUGH */
@@ -628,17 +630,17 @@ pulldown:
 	if (otg_change & OTG_PULLUP) {
 		u32 l;
 
-		switch (isp->otg.state) {
+		switch (isp->phy.state) {
 		case USB_PHY_STATE_B_IDLE:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+			isp->phy.state = USB_PHY_STATE_B_PERIPHERAL;
 			pr_debug("  --> b_peripheral\n");
 			break;
 		case USB_PHY_STATE_A_SUSPEND:
 			if (clr & OTG1_DP_PULLUP)
 				break;
-			isp->otg.state = USB_PHY_STATE_A_PERIPHERAL;
+			isp->phy.state = USB_PHY_STATE_A_PERIPHERAL;
 			pr_debug("  --> a_peripheral\n");
 			break;
 		default:
@@ -659,6 +661,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 	u32		otg_ctrl;
 	int		ret = IRQ_NONE;
 	struct isp1301	*isp = _isp;
+	struct usb_otg	*otg = &isp->otg;
 
 	/* update ISP1301 transceiver from OTG controller */
 	if (otg_irq & OPRT_CHG) {
@@ -675,7 +678,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		 * remote wakeup (SRP, normal) using their own timer
 		 * to give "check cable and A-device" messages.
 		 */
-		if (isp->otg.state == USB_PHY_STATE_B_SRP_INIT)
+		if (isp->phy.state == USB_PHY_STATE_B_SRP_INIT)
 			b_idle(isp, "srp_timeout");
 
 		omap_writew(B_SRP_TMROUT, OTG_IRQ_SRC);
@@ -693,7 +696,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		omap_writel(otg_ctrl, OTG_CTRL);
 
 		/* subset of b_peripheral()... */
-		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+		isp->phy.state = USB_PHY_STATE_B_PERIPHERAL;
 		pr_debug("  --> b_peripheral\n");
 
 		omap_writew(B_HNP_FAIL, OTG_IRQ_SRC);
@@ -705,9 +708,9 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 				state_name(isp), omap_readl(OTG_CTRL));
 
 		isp1301_defer_work(isp, WORK_UPDATE_OTG);
-		switch (isp->otg.state) {
+		switch (isp->phy.state) {
 		case USB_PHY_STATE_A_IDLE:
-			if (!isp->otg.host)
+			if (!otg->host)
 				break;
 			isp1301_defer_work(isp, WORK_HOST_RESUME);
 			otg_ctrl = omap_readl(OTG_CTRL);
@@ -736,7 +739,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+		isp->phy.state = USB_PHY_STATE_A_WAIT_VFALL;
 
 		omap_writew(A_REQ_TMROUT, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -750,7 +753,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		otg_ctrl |= OTG_BUSDROP;
 		otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
 		omap_writel(otg_ctrl, OTG_CTRL);
-		isp->otg.state = USB_PHY_STATE_A_VBUS_ERR;
+		isp->phy.state = USB_PHY_STATE_A_VBUS_ERR;
 
 		omap_writew(A_VBUS_ERR, OTG_IRQ_SRC);
 		ret = IRQ_HANDLED;
@@ -771,7 +774,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 
 		/* role is peripheral */
 		if (otg_ctrl & OTG_DRIVER_SEL) {
-			switch (isp->otg.state) {
+			switch (isp->phy.state) {
 			case USB_PHY_STATE_A_IDLE:
 				b_idle(isp, __func__);
 				break;
@@ -787,20 +790,20 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 				omap_writel(otg_ctrl | OTG_A_BUSREQ, OTG_CTRL);
 			}
 
-			if (isp->otg.host) {
-				switch (isp->otg.state) {
+			if (otg->host) {
+				switch (isp->phy.state) {
 				case USB_PHY_STATE_B_WAIT_ACON:
-					isp->otg.state = USB_PHY_STATE_B_HOST;
+					isp->phy.state = USB_PHY_STATE_B_HOST;
 					pr_debug("  --> b_host\n");
 					kick = 1;
 					break;
 				case USB_PHY_STATE_A_WAIT_BCON:
-					isp->otg.state = USB_PHY_STATE_A_HOST;
+					isp->phy.state = USB_PHY_STATE_A_HOST;
 					pr_debug("  --> a_host\n");
 					break;
 				case USB_PHY_STATE_A_PERIPHERAL:
-					isp->otg.state =
-						USB_PHY_STATE_A_WAIT_BCON;
+					isp->phy.state
+						= USB_PHY_STATE_A_WAIT_BCON;
 					pr_debug("  --> a_wait_bcon\n");
 					break;
 				default:
@@ -814,8 +817,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
 		ret = IRQ_HANDLED;
 
 		if (kick)
-			usb_bus_start_enum(isp->otg.host,
-						isp->otg.host->otg_port);
+			usb_bus_start_enum(otg->host, otg->host->otg_port);
 	}
 
 	check_state(isp, __func__);
@@ -941,7 +943,7 @@ static void b_peripheral(struct isp1301 *isp)
 	/* UDC driver just set OTG_BSESSVLD */
 	isp1301_set_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLUP);
 	isp1301_clear_bits(isp, ISP1301_OTG_CONTROL_1, OTG1_DP_PULLDOWN);
-	isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+	isp->phy.state = USB_PHY_STATE_B_PERIPHERAL;
 	pr_debug("  --> b_peripheral\n");
 	dump_regs(isp, "2periph");
 #endif
@@ -949,8 +951,9 @@ static void b_peripheral(struct isp1301 *isp)
 
 static void isp_update_otg(struct isp1301 *isp, u8 stat)
 {
+	struct usb_otg		*otg = &isp->otg;
 	u8			isp_stat, isp_bstat;
-	enum usb_phy_state	state = isp->otg.state;
+	enum usb_phy_state	state = isp->phy.state;
 
 	if (stat & INTR_BDIS_ACON)
 		pr_debug("OTG:  BDIS_ACON, %s\n", state_name(isp));
@@ -958,7 +961,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 	/* start certain state transitions right away */
 	isp_stat = isp1301_get_u8(isp, ISP1301_INTERRUPT_SOURCE);
 	if (isp_stat & INTR_ID_GND) {
-		if (isp->otg.default_a) {
+		if (otg->default_a) {
 			switch (state) {
 			case USB_PHY_STATE_B_IDLE:
 				a_idle(isp, "idle");
@@ -973,7 +976,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				 * when HNP is used.
 				 */
 				if (isp_stat & INTR_VBUS_VLD)
-					isp->otg.state = USB_PHY_STATE_A_HOST;
+					isp->phy.state = USB_PHY_STATE_A_HOST;
 				break;
 			case USB_PHY_STATE_A_WAIT_VFALL:
 				if (!(isp_stat & INTR_SESS_VLD))
@@ -981,8 +984,8 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				break;
 			default:
 				if (!(isp_stat & INTR_VBUS_VLD))
-					isp->otg.state =
-						USB_PHY_STATE_A_VBUS_ERR;
+					isp->phy.state
+						= USB_PHY_STATE_A_VBUS_ERR;
 				break;
 			}
 			isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
@@ -991,14 +994,14 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			case USB_PHY_STATE_B_PERIPHERAL:
 			case USB_PHY_STATE_B_HOST:
 			case USB_PHY_STATE_B_WAIT_ACON:
-				usb_gadget_vbus_disconnect(isp->otg.gadget);
+				usb_gadget_vbus_disconnect(otg->gadget);
 				break;
 			default:
 				break;
 			}
 			if (state != USB_PHY_STATE_A_IDLE)
 				a_idle(isp, "id");
-			if (isp->otg.host && state == USB_PHY_STATE_A_IDLE)
+			if (otg->host && state == USB_PHY_STATE_A_IDLE)
 				isp1301_defer_work(isp, WORK_HOST_RESUME);
 			isp_bstat = 0;
 		}
@@ -1008,10 +1011,10 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		/* if user unplugged mini-A end of cable,
 		 * don't bypass A_WAIT_VFALL.
 		 */
-		if (isp->otg.default_a) {
+		if (otg->default_a) {
 			switch (state) {
 			default:
-				isp->otg.state = USB_PHY_STATE_A_WAIT_VFALL;
+				isp->phy.state = USB_PHY_STATE_A_WAIT_VFALL;
 				break;
 			case USB_PHY_STATE_A_WAIT_VFALL:
 				state = USB_PHY_STATE_A_IDLE;
@@ -1024,7 +1027,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 				host_suspend(isp);
 				isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1,
 						MC1_BDIS_ACON_EN);
-				isp->otg.state = USB_PHY_STATE_B_IDLE;
+				isp->phy.state = USB_PHY_STATE_B_IDLE;
 				l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
 				l &= ~OTG_CTRL_BITS;
 				omap_writel(l, OTG_CTRL);
@@ -1035,7 +1038,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		}
 		isp_bstat = isp1301_get_u8(isp, ISP1301_OTG_STATUS);
 
-		switch (isp->otg.state) {
+		switch (isp->phy.state) {
 		case USB_PHY_STATE_B_PERIPHERAL:
 		case USB_PHY_STATE_B_WAIT_ACON:
 		case USB_PHY_STATE_B_HOST:
@@ -1057,7 +1060,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 			omap_writel(l, OTG_CTRL);
 			/* FALLTHROUGH */
 		case USB_PHY_STATE_B_IDLE:
-			if (isp->otg.gadget && (isp_bstat & OTG_B_SESS_VLD)) {
+			if (otg->gadget && (isp_bstat & OTG_B_SESS_VLD)) {
 #ifdef	CONFIG_USB_OTG
 				update_otg1(isp, isp_stat);
 				update_otg2(isp, isp_bstat);
@@ -1075,7 +1078,7 @@ static void isp_update_otg(struct isp1301 *isp, u8 stat)
 		}
 	}
 
-	if (state != isp->otg.state)
+	if (state != isp->phy.state)
 		pr_debug("  isp, %s -> %s\n",
 				usb_phy_state_string(state), state_name(isp));
 
@@ -1133,10 +1136,10 @@ isp1301_work(struct work_struct *work)
 			 * skip A_WAIT_VRISE; hc transitions invisibly
 			 * skip A_WAIT_BCON; same.
 			 */
-			switch (isp->otg.state) {
+			switch (isp->phy.state) {
 			case USB_PHY_STATE_A_WAIT_BCON:
 			case USB_PHY_STATE_A_WAIT_VRISE:
-				isp->otg.state = USB_PHY_STATE_A_HOST;
+				isp->phy.state = USB_PHY_STATE_A_HOST;
 				pr_debug("  --> a_host\n");
 				otg_ctrl = omap_readl(OTG_CTRL);
 				otg_ctrl |= OTG_A_BUSREQ;
@@ -1145,7 +1148,7 @@ isp1301_work(struct work_struct *work)
 				omap_writel(otg_ctrl, OTG_CTRL);
 				break;
 			case USB_PHY_STATE_B_WAIT_ACON:
-				isp->otg.state = USB_PHY_STATE_B_HOST;
+				isp->phy.state = USB_PHY_STATE_B_HOST;
 				pr_debug("  --> b_host (acon)\n");
 				break;
 			case USB_PHY_STATE_B_HOST:
@@ -1276,7 +1279,7 @@ static int isp1301_otg_enable(struct isp1301 *isp)
 
 /* add or disable the host device+driver */
 static int
-isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
+isp1301_set_host(struct usb_otg *otg, struct usb_bus *host)
 {
 	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 
@@ -1286,21 +1289,21 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
 	if (!host) {
 		omap_writew(0, OTG_IRQ_EN);
 		power_down(isp);
-		isp->otg.host = NULL;
+		otg->host = NULL;
 		return 0;
 	}
 
 #ifdef	CONFIG_USB_OTG
-	isp->otg.host = host;
+	otg->host = host;
 	dev_dbg(&isp->client->dev, "registered host\n");
 	host_suspend(isp);
-	if (isp->otg.gadget)
+	if (otg->gadget)
 		return isp1301_otg_enable(isp);
 	return 0;
 
 #elif	!defined(CONFIG_USB_GADGET_OMAP)
 	// FIXME update its refcount
-	isp->otg.host = host;
+	otg->host = host;
 
 	power_up(isp);
 
@@ -1332,7 +1335,7 @@ isp1301_set_host(struct usb_phy *otg, struct usb_bus *host)
 }
 
 static int
-isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
+isp1301_set_peripheral(struct usb_otg *otg, struct usb_gadget *gadget)
 {
 	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 #ifndef	CONFIG_USB_OTG
@@ -1344,24 +1347,24 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 
 	if (!gadget) {
 		omap_writew(0, OTG_IRQ_EN);
-		if (!isp->otg.default_a)
+		if (!otg->default_a)
 			enable_vbus_draw(isp, 0);
-		usb_gadget_vbus_disconnect(isp->otg.gadget);
-		isp->otg.gadget = NULL;
+		usb_gadget_vbus_disconnect(otg->gadget);
+		otg->gadget = NULL;
 		power_down(isp);
 		return 0;
 	}
 
 #ifdef	CONFIG_USB_OTG
-	isp->otg.gadget = gadget;
+	otg->gadget = gadget;
 	dev_dbg(&isp->client->dev, "registered gadget\n");
 	/* gadget driver may be suspended until vbus_connect () */
-	if (isp->otg.host)
+	if (otg->host)
 		return isp1301_otg_enable(isp);
 	return 0;
 
 #elif	!defined(CONFIG_USB_OHCI_HCD) && !defined(CONFIG_USB_OHCI_HCD_MODULE)
-	isp->otg.gadget = gadget;
+	otg->gadget = gadget;
 	// FIXME update its refcount
 
 	l = omap_readl(OTG_CTRL) & OTG_CTRL_MASK;
@@ -1370,7 +1373,7 @@ isp1301_set_peripheral(struct usb_phy *otg, struct usb_gadget *gadget)
 	omap_writel(l, OTG_CTRL);
 
 	power_up(isp);
-	isp->otg.state = USB_PHY_STATE_B_IDLE;
+	isp->phy.state = USB_PHY_STATE_B_IDLE;
 
 	if (machine_is_omap_h2() || machine_is_omap_h3())
 		isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
@@ -1411,13 +1414,13 @@ isp1301_set_power(struct usb_phy *dev, unsigned mA)
 }
 
 static int
-isp1301_start_srp(struct usb_phy *dev)
+isp1301_start_srp(struct usb_otg *otg)
 {
-	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 	u32		otg_ctrl;
 
-	if (!dev || isp != the_transceiver
-			|| isp->otg.state != USB_PHY_STATE_B_IDLE)
+	if (!otg || isp != the_transceiver
+			|| isp->phy.state != USB_PHY_STATE_B_IDLE)
 		return -ENODEV;
 
 	otg_ctrl = omap_readl(OTG_CTRL);
@@ -1427,7 +1430,7 @@ isp1301_start_srp(struct usb_phy *dev)
 	otg_ctrl |= OTG_B_BUSREQ;
 	otg_ctrl &= ~OTG_A_BUSREQ & OTG_CTRL_MASK;
 	omap_writel(otg_ctrl, OTG_CTRL);
-	isp->otg.state = USB_PHY_STATE_B_SRP_INIT;
+	isp->phy.state = USB_PHY_STATE_B_SRP_INIT;
 
 	pr_debug("otg: SRP, %s ... %06x\n", state_name(isp),
 			omap_readl(OTG_CTRL));
@@ -1438,27 +1441,26 @@ isp1301_start_srp(struct usb_phy *dev)
 }
 
 static int
-isp1301_start_hnp(struct usb_phy *dev)
+isp1301_start_hnp(struct usb_otg *otg)
 {
 #ifdef	CONFIG_USB_OTG
-	struct isp1301	*isp = container_of(dev, struct isp1301, otg);
+	struct isp1301	*isp = container_of(otg, struct isp1301, otg);
 	u32 l;
 
-	if (!dev || isp != the_transceiver)
+	if (!otg || isp != the_transceiver)
 		return -ENODEV;
-	if (isp->otg.default_a && (isp->otg.host == NULL
-			|| !isp->otg.host->b_hnp_enable))
+	if (otg->default_a && (otg->host == NULL || !otg->host->b_hnp_enable))
 		return -ENOTCONN;
-	if (!isp->otg.default_a && (isp->otg.gadget == NULL
-			|| !isp->otg.gadget->b_hnp_enable))
+	if (!otg->default_a && (otg->gadget == NULL
+			|| !otg->gadget->b_hnp_enable))
 		return -ENOTCONN;
 
 	/* We want hardware to manage most HNP protocol timings.
 	 * So do this part as early as possible...
 	 */
-	switch (isp->otg.state) {
+	switch (isp->phy.state) {
 	case USB_PHY_STATE_B_HOST:
-		isp->otg.state = USB_PHY_STATE_B_PERIPHERAL;
+		isp->phy.state = USB_PHY_STATE_B_PERIPHERAL;
 		/* caller will suspend next */
 		break;
 	case USB_PHY_STATE_A_HOST:
@@ -1468,7 +1470,7 @@ isp1301_start_hnp(struct usb_phy *dev)
 				MC1_BDIS_ACON_EN);
 #endif
 		/* caller must suspend then clear A_BUSREQ */
-		usb_gadget_vbus_connect(isp->otg.gadget);
+		usb_gadget_vbus_connect(otg->gadget);
 		l = omap_readl(OTG_CTRL);
 		l |= OTG_A_SETB_HNPEN;
 		omap_writel(l, OTG_CTRL);
@@ -1578,12 +1580,14 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 		goto fail;
 	}
 
-	isp->otg.dev = &i2c->dev;
-	isp->otg.label = DRIVER_NAME;
+	isp->phy.dev = &i2c->dev;
+	isp->phy.label = DRIVER_NAME;
+	isp->phy.otg = &isp->otg;
+	isp->phy.set_power = isp1301_set_power,
 
+	isp->otg.phy = &isp->phy;
 	isp->otg.set_host = isp1301_set_host,
 	isp->otg.set_peripheral = isp1301_set_peripheral,
-	isp->otg.set_power = isp1301_set_power,
 	isp->otg.start_srp = isp1301_start_srp,
 	isp->otg.start_hnp = isp1301_start_hnp,
 
@@ -1603,7 +1607,7 @@ isp1301_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	dev_dbg(&i2c->dev, "scheduled timer, %d min\n", TIMER_MINUTES);
 #endif
 
-	status = otg_set_transceiver(&isp->otg);
+	status = usb_set_transceiver(&isp->phy);
 	if (status < 0)
 		dev_err(&i2c->dev, "can't register transceiver, %d\n",
 			status);
@@ -1641,7 +1645,7 @@ subsys_initcall(isp_init);
 static void __exit isp_exit(void)
 {
 	if (the_transceiver)
-		otg_set_transceiver(NULL);
+		usb_set_transceiver(NULL);
 	i2c_del_driver(&isp1301_driver);
 }
 module_exit(isp_exit);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux