summaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-03-25 12:22:19 -0600
committerSimon Glass <sjg@chromium.org>2015-04-18 11:11:23 -0600
commitc4a3141d55398660a65417fa15c05d2630400af7 (patch)
tree27bdfc1808365a794346eb229dca302379b54cec /drivers/usb
parent7338287d580fba4f09d052960941c23039e8919d (diff)
downloadtalos-obmc-uboot-c4a3141d55398660a65417fa15c05d2630400af7.tar.gz
talos-obmc-uboot-c4a3141d55398660a65417fa15c05d2630400af7.zip
dm: usb: Allow ECHI to hold private data for the controller
Add a private data pointer that clients of EHCI can use to access their private information. This establishes a link between struct ehci_ctrl and its associated controller data structure. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ehci-hcd.c10
-rw-r--r--drivers/usb/host/ehci.h21
2 files changed, 31 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index cc71016b29..5c71882e3a 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -930,6 +930,16 @@ unknown:
return -1;
}
+void ehci_set_controller_priv(int index, void *priv)
+{
+ ehcic[index].priv = priv;
+}
+
+void *ehci_get_controller_priv(int index)
+{
+ return ehcic[index].priv;
+}
+
int usb_lowlevel_stop(int index)
{
ehci_shutdown(&ehcic[index]);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index ec4d6b0abe..d538bb6e8d 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -248,6 +248,7 @@ struct ehci_ctrl {
uint32_t *periodic_list;
int periodic_schedules;
int ntds;
+ void *priv; /* client's private data */
};
/* Weak functions that drivers can override */
@@ -256,6 +257,26 @@ void ehci_set_usbmode(int index);
void ehci_powerup_fixup(uint32_t *status_reg, uint32_t *reg);
uint32_t *ehci_get_portsc_register(struct ehci_hcor *hcor, int port);
+/**
+ * ehci_set_controller_priv() - Set up private data for the controller
+ *
+ * This function can be called in ehci_hcd_init() to tell the EHCI layer
+ * about the controller's private data pointer. Then in the above functions
+ * this can be accessed given the struct ehci_ctrl pointer.
+ *
+ * @index: Controller number to set
+ * @priv: Controller pointer
+ */
+void ehci_set_controller_priv(int index, void *priv);
+
+/**
+ * ehci_get_controller_priv() - Get controller private data
+ *
+ * @index Controller number to get
+ * @return controller pointer for this index
+ */
+void *ehci_get_controller_priv(int index);
+
/* Low level init functions */
int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor);
OpenPOWER on IntegriCloud