diff options
author | Anton Tikhomirov <av.tikhomirov@samsung.com> | 2013-10-02 23:42:04 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 12:02:23 -0400 |
commit | 8b3271517aae4af5f8af97ce4f60efb57192c7f9 (patch) | |
tree | a65e650d7a9b6af09c49d44ee72f6198a96afda7 | |
parent | 370cdc5e116b4a790358c7f88deb12da9fdaa784 (diff) |
usb: phy: Add and use missed helper functions
This patch implements missed helper functions for start_gadget() and
start_host() OTG FSM callbacks.
Signed-off-by: Anton Tikhomirov <av.tikhomirov@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
(cherry-picked from commit 425d710172cee47ed5e18eefd3308d88643de76d)
-rw-r--r-- | drivers/usb/phy/phy-fsm-usb.c | 8 | ||||
-rw-r--r-- | drivers/usb/phy/phy-fsm-usb.h | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-fsm-usb.c b/drivers/usb/phy/phy-fsm-usb.c index 7f4596606e18..78984591ee74 100644 --- a/drivers/usb/phy/phy-fsm-usb.c +++ b/drivers/usb/phy/phy-fsm-usb.c | |||
@@ -41,17 +41,17 @@ static int otg_set_protocol(struct otg_fsm *fsm, int protocol) | |||
41 | fsm->protocol, protocol); | 41 | fsm->protocol, protocol); |
42 | /* stop old protocol */ | 42 | /* stop old protocol */ |
43 | if (fsm->protocol == PROTO_HOST) | 43 | if (fsm->protocol == PROTO_HOST) |
44 | ret = fsm->ops->start_host(fsm, 0); | 44 | ret = otg_start_host(fsm, 0); |
45 | else if (fsm->protocol == PROTO_GADGET) | 45 | else if (fsm->protocol == PROTO_GADGET) |
46 | ret = fsm->ops->start_gadget(fsm, 0); | 46 | ret = otg_start_gadget(fsm, 0); |
47 | if (ret) | 47 | if (ret) |
48 | return ret; | 48 | return ret; |
49 | 49 | ||
50 | /* start new protocol */ | 50 | /* start new protocol */ |
51 | if (protocol == PROTO_HOST) | 51 | if (protocol == PROTO_HOST) |
52 | ret = fsm->ops->start_host(fsm, 1); | 52 | ret = otg_start_host(fsm, 1); |
53 | else if (protocol == PROTO_GADGET) | 53 | else if (protocol == PROTO_GADGET) |
54 | ret = fsm->ops->start_gadget(fsm, 1); | 54 | ret = otg_start_gadget(fsm, 1); |
55 | if (ret) | 55 | if (ret) |
56 | return ret; | 56 | return ret; |
57 | 57 | ||
diff --git a/drivers/usb/phy/phy-fsm-usb.h b/drivers/usb/phy/phy-fsm-usb.h index 0f3f7d87f887..157f10672767 100644 --- a/drivers/usb/phy/phy-fsm-usb.h +++ b/drivers/usb/phy/phy-fsm-usb.h | |||
@@ -160,6 +160,20 @@ static inline int otg_del_timer(struct otg_fsm *fsm, void *timer) | |||
160 | return 0; | 160 | return 0; |
161 | } | 161 | } |
162 | 162 | ||
163 | static inline int otg_start_host(struct otg_fsm *fsm, int on) | ||
164 | { | ||
165 | if (!fsm->ops->start_host) | ||
166 | return -EOPNOTSUPP; | ||
167 | return fsm->ops->start_host(fsm, on); | ||
168 | } | ||
169 | |||
170 | static inline int otg_start_gadget(struct otg_fsm *fsm, int on) | ||
171 | { | ||
172 | if (!fsm->ops->start_gadget) | ||
173 | return -EOPNOTSUPP; | ||
174 | return fsm->ops->start_gadget(fsm, on); | ||
175 | } | ||
176 | |||
163 | int otg_statemachine(struct otg_fsm *fsm); | 177 | int otg_statemachine(struct otg_fsm *fsm); |
164 | 178 | ||
165 | /* Defined by device specific driver, for different timer implementation */ | 179 | /* Defined by device specific driver, for different timer implementation */ |