aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/fsl-mph-dr-of.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/fsl-mph-dr-of.c')
-rw-r--r--drivers/usb/host/fsl-mph-dr-of.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/usb/host/fsl-mph-dr-of.c b/drivers/usb/host/fsl-mph-dr-of.c
index ab333ac6071..22ff6b3a676 100644
--- a/drivers/usb/host/fsl-mph-dr-of.c
+++ b/drivers/usb/host/fsl-mph-dr-of.c
@@ -119,6 +119,39 @@ error:
119 119
120static const struct of_device_id fsl_usb2_mph_dr_of_match[]; 120static const struct of_device_id fsl_usb2_mph_dr_of_match[];
121 121
122static int usb_get_ver_info(struct device_node *np)
123{
124 int ver = -1;
125
126 /*
127 * returns 1 for usb controller version 1.6
128 * returns 2 for usb controller version 2.2
129 * returns 0 otherwise
130 */
131 if (of_device_is_compatible(np, "fsl-usb2-dr")) {
132 if (of_device_is_compatible(np, "fsl-usb2-dr-v1.6"))
133 ver = FSL_USB_VER_1_6;
134 else if (of_device_is_compatible(np, "fsl-usb2-dr-v2.2"))
135 ver = FSL_USB_VER_2_2;
136 else /* for previous controller versions */
137 ver = FSL_USB_VER_OLD;
138
139 if (ver > -1)
140 return ver;
141 }
142
143 if (of_device_is_compatible(np, "fsl-usb2-mph")) {
144 if (of_device_is_compatible(np, "fsl-usb2-mph-v1.6"))
145 ver = FSL_USB_VER_1_6;
146 else if (of_device_is_compatible(np, "fsl-usb2-mph-v2.2"))
147 ver = FSL_USB_VER_2_2;
148 else /* for previous controller versions */
149 ver = FSL_USB_VER_OLD;
150 }
151
152 return ver;
153}
154
122static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev) 155static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
123{ 156{
124 struct device_node *np = ofdev->dev.of_node; 157 struct device_node *np = ofdev->dev.of_node;
@@ -166,6 +199,14 @@ static int __devinit fsl_usb2_mph_dr_of_probe(struct platform_device *ofdev)
166 199
167 prop = of_get_property(np, "phy_type", NULL); 200 prop = of_get_property(np, "phy_type", NULL);
168 pdata->phy_mode = determine_usb_phy(prop); 201 pdata->phy_mode = determine_usb_phy(prop);
202 pdata->controller_ver = usb_get_ver_info(np);
203
204 if (pdata->have_sysif_regs) {
205 if (pdata->controller_ver < 0) {
206 dev_warn(&ofdev->dev, "Could not get controller version\n");
207 return -ENODEV;
208 }
209 }
169 210
170 for (i = 0; i < ARRAY_SIZE(dev_data->drivers); i++) { 211 for (i = 0; i < ARRAY_SIZE(dev_data->drivers); i++) {
171 if (!dev_data->drivers[i]) 212 if (!dev_data->drivers[i])