aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/host/ehci-hcd.c73
-rw-r--r--drivers/usb/host/ehci-hub.c6
-rw-r--r--drivers/usb/host/ehci.h17
3 files changed, 89 insertions, 7 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index ab4a769a4104..dee3541bfae8 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -649,7 +649,7 @@ static int ehci_run (struct usb_hcd *hcd)
649 return 0; 649 return 0;
650} 650}
651 651
652static int ehci_setup(struct usb_hcd *hcd) 652int ehci_setup(struct usb_hcd *hcd)
653{ 653{
654 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 654 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
655 int retval; 655 int retval;
@@ -680,6 +680,7 @@ static int ehci_setup(struct usb_hcd *hcd)
680 680
681 return 0; 681 return 0;
682} 682}
683EXPORT_SYMBOL_GPL(ehci_setup);
683 684
684/*-------------------------------------------------------------------------*/ 685/*-------------------------------------------------------------------------*/
685 686
@@ -1085,7 +1086,7 @@ static int ehci_get_frame (struct usb_hcd *hcd)
1085 1086
1086/* These routines handle the generic parts of controller suspend/resume */ 1087/* These routines handle the generic parts of controller suspend/resume */
1087 1088
1088static int __maybe_unused ehci_suspend(struct usb_hcd *hcd, bool do_wakeup) 1089int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup)
1089{ 1090{
1090 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 1091 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1091 1092
@@ -1108,9 +1109,10 @@ static int __maybe_unused ehci_suspend(struct usb_hcd *hcd, bool do_wakeup)
1108 1109
1109 return 0; 1110 return 0;
1110} 1111}
1112EXPORT_SYMBOL_GPL(ehci_suspend);
1111 1113
1112/* Returns 0 if power was preserved, 1 if power was lost */ 1114/* Returns 0 if power was preserved, 1 if power was lost */
1113static int __maybe_unused ehci_resume(struct usb_hcd *hcd, bool hibernated) 1115int ehci_resume(struct usb_hcd *hcd, bool hibernated)
1114{ 1116{
1115 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 1117 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1116 1118
@@ -1168,12 +1170,77 @@ static int __maybe_unused ehci_resume(struct usb_hcd *hcd, bool hibernated)
1168 1170
1169 return 1; 1171 return 1;
1170} 1172}
1173EXPORT_SYMBOL_GPL(ehci_resume);
1171 1174
1172#endif 1175#endif
1173 1176
1174/*-------------------------------------------------------------------------*/ 1177/*-------------------------------------------------------------------------*/
1175 1178
1176/* 1179/*
1180 * Generic structure: This gets copied for platform drivers so that
1181 * individual entries can be overridden as needed.
1182 */
1183
1184static const struct hc_driver ehci_hc_driver = {
1185 .description = hcd_name,
1186 .product_desc = "EHCI Host Controller",
1187 .hcd_priv_size = sizeof(struct ehci_hcd),
1188
1189 /*
1190 * generic hardware linkage
1191 */
1192 .irq = ehci_irq,
1193 .flags = HCD_MEMORY | HCD_USB2,
1194
1195 /*
1196 * basic lifecycle operations
1197 */
1198 .reset = ehci_setup,
1199 .start = ehci_run,
1200 .stop = ehci_stop,
1201 .shutdown = ehci_shutdown,
1202
1203 /*
1204 * managing i/o requests and associated device resources
1205 */
1206 .urb_enqueue = ehci_urb_enqueue,
1207 .urb_dequeue = ehci_urb_dequeue,
1208 .endpoint_disable = ehci_endpoint_disable,
1209 .endpoint_reset = ehci_endpoint_reset,
1210 .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
1211
1212 /*
1213 * scheduling support
1214 */
1215 .get_frame_number = ehci_get_frame,
1216
1217 /*
1218 * root hub support
1219 */
1220 .hub_status_data = ehci_hub_status_data,
1221 .hub_control = ehci_hub_control,
1222 .bus_suspend = ehci_bus_suspend,
1223 .bus_resume = ehci_bus_resume,
1224 .relinquish_port = ehci_relinquish_port,
1225 .port_handed_over = ehci_port_handed_over,
1226};
1227
1228void ehci_init_driver(struct hc_driver *drv,
1229 const struct ehci_driver_overrides *over)
1230{
1231 /* Copy the generic table to drv and then apply the overrides */
1232 *drv = ehci_hc_driver;
1233
1234 drv->product_desc = over->product_desc;
1235 drv->hcd_priv_size += over->extra_priv_size;
1236 if (over->reset)
1237 drv->reset = over->reset;
1238}
1239EXPORT_SYMBOL_GPL(ehci_init_driver);
1240
1241/*-------------------------------------------------------------------------*/
1242
1243/*
1177 * The EHCI in ChipIdea HDRC cannot be a separate module or device, 1244 * The EHCI in ChipIdea HDRC cannot be a separate module or device,
1178 * because its registers (and irq) are shared between host/gadget/otg 1245 * because its registers (and irq) are shared between host/gadget/otg
1179 * functions and in order to facilitate role switching we cannot 1246 * functions and in order to facilitate role switching we cannot
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index a59c61fea09f..4ccb97c0678f 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -1109,8 +1109,7 @@ error_exit:
1109 return retval; 1109 return retval;
1110} 1110}
1111 1111
1112static void __maybe_unused ehci_relinquish_port(struct usb_hcd *hcd, 1112static void ehci_relinquish_port(struct usb_hcd *hcd, int portnum)
1113 int portnum)
1114{ 1113{
1115 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 1114 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1116 1115
@@ -1119,8 +1118,7 @@ static void __maybe_unused ehci_relinquish_port(struct usb_hcd *hcd,
1119 set_owner(ehci, --portnum, PORT_OWNER); 1118 set_owner(ehci, --portnum, PORT_OWNER);
1120} 1119}
1121 1120
1122static int __maybe_unused ehci_port_handed_over(struct usb_hcd *hcd, 1121static int ehci_port_handed_over(struct usb_hcd *hcd, int portnum)
1123 int portnum)
1124{ 1122{
1125 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 1123 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
1126 u32 __iomem *reg; 1124 u32 __iomem *reg;
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 2262dcdaa3c1..24a8ada4701c 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -781,4 +781,21 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd *ehci, const __hc32 *x)
781 781
782/*-------------------------------------------------------------------------*/ 782/*-------------------------------------------------------------------------*/
783 783
784/* Declarations of things exported for use by ehci platform drivers */
785
786struct ehci_driver_overrides {
787 const char *product_desc;
788 size_t extra_priv_size;
789 int (*reset)(struct usb_hcd *hcd);
790};
791
792extern void ehci_init_driver(struct hc_driver *drv,
793 const struct ehci_driver_overrides *over);
794extern int ehci_setup(struct usb_hcd *hcd);
795
796#ifdef CONFIG_PM
797extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup);
798extern int ehci_resume(struct usb_hcd *hcd, bool hibernated);
799#endif /* CONFIG_PM */
800
784#endif /* __LINUX_EHCI_HCD_H */ 801#endif /* __LINUX_EHCI_HCD_H */