diff options
| author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2011-10-11 01:01:40 -0400 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2011-10-13 13:41:38 -0400 |
| commit | 258485d9904703c4cb3a2b3ee38fe2a0cbf01f48 (patch) | |
| tree | ca72cb1d0fab6213da29ebb19a5254ebf4db9284 | |
| parent | 11935de5579a5d01b3c89d69b4fc7a38b4dd8eae (diff) | |
usb: gadget: renesas_usbhs: add bus control functions
this patch add DVSTCTR control function for HOST support
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
| -rw-r--r-- | drivers/usb/renesas_usbhs/common.c | 35 | ||||
| -rw-r--r-- | drivers/usb/renesas_usbhs/common.h | 9 | ||||
| -rw-r--r-- | include/linux/usb/renesas_usbhs.h | 7 |
3 files changed, 50 insertions, 1 deletions
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index fd43fdd6cd81..243512d93e58 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c | |||
| @@ -147,6 +147,33 @@ int usbhs_frame_get_num(struct usbhs_priv *priv) | |||
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | /* | 149 | /* |
| 150 | * bus/vbus functions | ||
| 151 | */ | ||
| 152 | void usbhs_bus_send_sof_enable(struct usbhs_priv *priv) | ||
| 153 | { | ||
| 154 | usbhs_bset(priv, DVSTCTR, (USBRST | UACT), UACT); | ||
| 155 | } | ||
| 156 | |||
| 157 | void usbhs_bus_send_reset(struct usbhs_priv *priv) | ||
| 158 | { | ||
| 159 | usbhs_bset(priv, DVSTCTR, (USBRST | UACT), USBRST); | ||
| 160 | } | ||
| 161 | |||
| 162 | int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable) | ||
| 163 | { | ||
| 164 | struct platform_device *pdev = usbhs_priv_to_pdev(priv); | ||
| 165 | |||
| 166 | return usbhs_platform_call(priv, set_vbus, pdev, enable); | ||
| 167 | } | ||
| 168 | |||
| 169 | static void usbhsc_bus_init(struct usbhs_priv *priv) | ||
| 170 | { | ||
| 171 | usbhs_write(priv, DVSTCTR, 0); | ||
| 172 | |||
| 173 | usbhs_vbus_ctrl(priv, 0); | ||
| 174 | } | ||
| 175 | |||
| 176 | /* | ||
| 150 | * local functions | 177 | * local functions |
| 151 | */ | 178 | */ |
| 152 | static void usbhsc_set_buswait(struct usbhs_priv *priv) | 179 | static void usbhsc_set_buswait(struct usbhs_priv *priv) |
| @@ -187,7 +214,6 @@ static void usbhsc_power_ctrl(struct usbhs_priv *priv, int enable) | |||
| 187 | 214 | ||
| 188 | /* USB on */ | 215 | /* USB on */ |
| 189 | usbhs_sys_clock_ctrl(priv, enable); | 216 | usbhs_sys_clock_ctrl(priv, enable); |
| 190 | usbhsc_set_buswait(priv); | ||
| 191 | } else { | 217 | } else { |
| 192 | /* USB off */ | 218 | /* USB off */ |
| 193 | usbhs_sys_clock_ctrl(priv, enable); | 219 | usbhs_sys_clock_ctrl(priv, enable); |
| @@ -229,6 +255,10 @@ static void usbhsc_hotplug(struct usbhs_priv *priv) | |||
| 229 | if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) | 255 | if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) |
| 230 | usbhsc_power_ctrl(priv, enable); | 256 | usbhsc_power_ctrl(priv, enable); |
| 231 | 257 | ||
| 258 | /* bus init */ | ||
| 259 | usbhsc_set_buswait(priv); | ||
| 260 | usbhsc_bus_init(priv); | ||
| 261 | |||
| 232 | /* module start */ | 262 | /* module start */ |
| 233 | usbhs_mod_call(priv, start, priv); | 263 | usbhs_mod_call(priv, start, priv); |
| 234 | 264 | ||
| @@ -238,6 +268,9 @@ static void usbhsc_hotplug(struct usbhs_priv *priv) | |||
| 238 | /* module stop */ | 268 | /* module stop */ |
| 239 | usbhs_mod_call(priv, stop, priv); | 269 | usbhs_mod_call(priv, stop, priv); |
| 240 | 270 | ||
| 271 | /* bus init */ | ||
| 272 | usbhsc_bus_init(priv); | ||
| 273 | |||
| 241 | /* power off */ | 274 | /* power off */ |
| 242 | if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) | 275 | if (usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) |
| 243 | usbhsc_power_ctrl(priv, enable); | 276 | usbhsc_power_ctrl(priv, enable); |
diff --git a/drivers/usb/renesas_usbhs/common.h b/drivers/usb/renesas_usbhs/common.h index b410463a1212..54b5924baae7 100644 --- a/drivers/usb/renesas_usbhs/common.h +++ b/drivers/usb/renesas_usbhs/common.h | |||
| @@ -102,6 +102,8 @@ struct usbhs_priv; | |||
| 102 | /* DVSTCTR */ | 102 | /* DVSTCTR */ |
| 103 | #define EXTLP (1 << 10) /* Controls the EXTLP pin output state */ | 103 | #define EXTLP (1 << 10) /* Controls the EXTLP pin output state */ |
| 104 | #define PWEN (1 << 9) /* Controls the PWEN pin output state */ | 104 | #define PWEN (1 << 9) /* Controls the PWEN pin output state */ |
| 105 | #define USBRST (1 << 6) /* Bus Reset Output */ | ||
| 106 | #define UACT (1 << 4) /* USB Bus Enable */ | ||
| 105 | #define RHST (0x7) /* Reset Handshake */ | 107 | #define RHST (0x7) /* Reset Handshake */ |
| 106 | #define RHST_LOW_SPEED 1 /* Low-speed connection */ | 108 | #define RHST_LOW_SPEED 1 /* Low-speed connection */ |
| 107 | #define RHST_FULL_SPEED 2 /* Full-speed connection */ | 109 | #define RHST_FULL_SPEED 2 /* Full-speed connection */ |
| @@ -258,6 +260,13 @@ void usbhs_sys_host_ctrl(struct usbhs_priv *priv, int enable); | |||
| 258 | void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable); | 260 | void usbhs_sys_function_ctrl(struct usbhs_priv *priv, int enable); |
| 259 | 261 | ||
| 260 | /* | 262 | /* |
| 263 | * bus | ||
| 264 | */ | ||
| 265 | void usbhs_bus_send_sof_enable(struct usbhs_priv *priv); | ||
| 266 | void usbhs_bus_send_reset(struct usbhs_priv *priv); | ||
| 267 | int usbhs_vbus_ctrl(struct usbhs_priv *priv, int enable); | ||
| 268 | |||
| 269 | /* | ||
| 261 | * frame | 270 | * frame |
| 262 | */ | 271 | */ |
| 263 | int usbhs_frame_get_num(struct usbhs_priv *priv); | 272 | int usbhs_frame_get_num(struct usbhs_priv *priv); |
diff --git a/include/linux/usb/renesas_usbhs.h b/include/linux/usb/renesas_usbhs.h index 959af02d3af6..040d8bb2b5a2 100644 --- a/include/linux/usb/renesas_usbhs.h +++ b/include/linux/usb/renesas_usbhs.h | |||
| @@ -82,6 +82,13 @@ struct renesas_usbhs_platform_callback { | |||
| 82 | * get VBUS status function. | 82 | * get VBUS status function. |
| 83 | */ | 83 | */ |
| 84 | int (*get_vbus)(struct platform_device *pdev); | 84 | int (*get_vbus)(struct platform_device *pdev); |
| 85 | |||
| 86 | /* | ||
| 87 | * option: | ||
| 88 | * | ||
| 89 | * VBUS control is needed for Host | ||
| 90 | */ | ||
| 91 | int (*set_vbus)(struct platform_device *pdev, int enable); | ||
| 85 | }; | 92 | }; |
| 86 | 93 | ||
| 87 | /* | 94 | /* |
