aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/phy
diff options
context:
space:
mode:
authorFabio Baltieri <fabio.baltieri@linaro.org>2013-03-07 21:27:08 -0500
committerFelipe Balbi <balbi@ti.com>2013-03-18 08:41:33 -0400
commit73f226cbd79adb5f3f25ee14c18900bb4a9acd15 (patch)
treef30808fcd74beb346ba96c10ed9b4e54b2283a02 /drivers/usb/phy
parent0135522c48982cf1d456d863272e911fdf8a17da (diff)
usb: otg: ab8500-usb: drop support for ab8500 pre v2.0
AB8500 versions preceding 2.0 were only used internally by ST-Ericsson and are not supported anymore. This patch drops all v1.0 and v1.1 support code. Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c139
1 files changed, 11 insertions, 128 deletions
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 2d86f26a0183..9f5e0e4ab02a 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -42,10 +42,8 @@
42#define AB8500_BIT_WD_CTRL_ENABLE (1 << 0) 42#define AB8500_BIT_WD_CTRL_ENABLE (1 << 0)
43#define AB8500_BIT_WD_CTRL_KICK (1 << 1) 43#define AB8500_BIT_WD_CTRL_KICK (1 << 1)
44 44
45#define AB8500_V1x_LINK_STAT_WAIT (HZ/10)
46#define AB8500_WD_KICK_DELAY_US 100 /* usec */ 45#define AB8500_WD_KICK_DELAY_US 100 /* usec */
47#define AB8500_WD_V11_DISABLE_DELAY_US 100 /* usec */ 46#define AB8500_WD_V11_DISABLE_DELAY_US 100 /* usec */
48#define AB8500_WD_V10_DISABLE_DELAY_MS 100 /* ms */
49 47
50/* Usb line status register */ 48/* Usb line status register */
51enum ab8500_usb_link_status { 49enum ab8500_usb_link_status {
@@ -70,16 +68,12 @@ enum ab8500_usb_link_status {
70struct ab8500_usb { 68struct ab8500_usb {
71 struct usb_phy phy; 69 struct usb_phy phy;
72 struct device *dev; 70 struct device *dev;
73 int irq_num_id_rise; 71 struct ab8500 *ab8500;
74 int irq_num_id_fall;
75 int irq_num_vbus_rise;
76 int irq_num_vbus_fall;
77 int irq_num_link_status; 72 int irq_num_link_status;
78 unsigned vbus_draw; 73 unsigned vbus_draw;
79 struct delayed_work dwork; 74 struct delayed_work dwork;
80 struct work_struct phy_dis_work; 75 struct work_struct phy_dis_work;
81 unsigned long link_status_wait; 76 unsigned long link_status_wait;
82 int rev;
83}; 77};
84 78
85static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x) 79static inline struct ab8500_usb *phy_to_ab(struct usb_phy *x)
@@ -102,10 +96,7 @@ static void ab8500_usb_wd_workaround(struct ab8500_usb *ab)
102 (AB8500_BIT_WD_CTRL_ENABLE 96 (AB8500_BIT_WD_CTRL_ENABLE
103 | AB8500_BIT_WD_CTRL_KICK)); 97 | AB8500_BIT_WD_CTRL_KICK));
104 98
105 if (ab->rev > 0x10) /* v1.1 v2.0 */ 99 udelay(AB8500_WD_V11_DISABLE_DELAY_US);
106 udelay(AB8500_WD_V11_DISABLE_DELAY_US);
107 else /* v1.0 */
108 msleep(AB8500_WD_V10_DISABLE_DELAY_MS);
109 100
110 abx500_set_register_interruptible(ab->dev, 101 abx500_set_register_interruptible(ab->dev,
111 AB8500_SYS_CTRL2_BLOCK, 102 AB8500_SYS_CTRL2_BLOCK,
@@ -225,29 +216,6 @@ static void ab8500_usb_delayed_work(struct work_struct *work)
225 ab8500_usb_link_status_update(ab); 216 ab8500_usb_link_status_update(ab);
226} 217}
227 218
228static irqreturn_t ab8500_usb_v1x_common_irq(int irq, void *data)
229{
230 struct ab8500_usb *ab = (struct ab8500_usb *) data;
231
232 /* Wait for link status to become stable. */
233 schedule_delayed_work(&ab->dwork, ab->link_status_wait);
234
235 return IRQ_HANDLED;
236}
237
238static irqreturn_t ab8500_usb_v1x_vbus_fall_irq(int irq, void *data)
239{
240 struct ab8500_usb *ab = (struct ab8500_usb *) data;
241
242 /* Link status will not be updated till phy is disabled. */
243 ab8500_usb_peri_phy_dis(ab);
244
245 /* Wait for link status to become stable. */
246 schedule_delayed_work(&ab->dwork, ab->link_status_wait);
247
248 return IRQ_HANDLED;
249}
250
251static irqreturn_t ab8500_usb_v20_irq(int irq, void *data) 219static irqreturn_t ab8500_usb_v20_irq(int irq, void *data)
252{ 220{
253 struct ab8500_usb *ab = (struct ab8500_usb *) data; 221 struct ab8500_usb *ab = (struct ab8500_usb *) data;
@@ -361,86 +329,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, struct usb_bus *host)
361 329
362static void ab8500_usb_irq_free(struct ab8500_usb *ab) 330static void ab8500_usb_irq_free(struct ab8500_usb *ab)
363{ 331{
364 if (ab->rev < 0x20) { 332 free_irq(ab->irq_num_link_status, ab);
365 free_irq(ab->irq_num_id_rise, ab);
366 free_irq(ab->irq_num_id_fall, ab);
367 free_irq(ab->irq_num_vbus_rise, ab);
368 free_irq(ab->irq_num_vbus_fall, ab);
369 } else {
370 free_irq(ab->irq_num_link_status, ab);
371 }
372}
373
374static int ab8500_usb_v1x_res_setup(struct platform_device *pdev,
375 struct ab8500_usb *ab)
376{
377 int err;
378
379 ab->irq_num_id_rise = platform_get_irq_byname(pdev, "ID_WAKEUP_R");
380 if (ab->irq_num_id_rise < 0) {
381 dev_err(&pdev->dev, "ID rise irq not found\n");
382 return ab->irq_num_id_rise;
383 }
384 err = request_threaded_irq(ab->irq_num_id_rise, NULL,
385 ab8500_usb_v1x_common_irq,
386 IRQF_NO_SUSPEND | IRQF_SHARED,
387 "usb-id-rise", ab);
388 if (err < 0) {
389 dev_err(ab->dev, "request_irq failed for ID rise irq\n");
390 goto fail0;
391 }
392
393 ab->irq_num_id_fall = platform_get_irq_byname(pdev, "ID_WAKEUP_F");
394 if (ab->irq_num_id_fall < 0) {
395 dev_err(&pdev->dev, "ID fall irq not found\n");
396 return ab->irq_num_id_fall;
397 }
398 err = request_threaded_irq(ab->irq_num_id_fall, NULL,
399 ab8500_usb_v1x_common_irq,
400 IRQF_NO_SUSPEND | IRQF_SHARED,
401 "usb-id-fall", ab);
402 if (err < 0) {
403 dev_err(ab->dev, "request_irq failed for ID fall irq\n");
404 goto fail1;
405 }
406
407 ab->irq_num_vbus_rise = platform_get_irq_byname(pdev, "VBUS_DET_R");
408 if (ab->irq_num_vbus_rise < 0) {
409 dev_err(&pdev->dev, "VBUS rise irq not found\n");
410 return ab->irq_num_vbus_rise;
411 }
412 err = request_threaded_irq(ab->irq_num_vbus_rise, NULL,
413 ab8500_usb_v1x_common_irq,
414 IRQF_NO_SUSPEND | IRQF_SHARED,
415 "usb-vbus-rise", ab);
416 if (err < 0) {
417 dev_err(ab->dev, "request_irq failed for Vbus rise irq\n");
418 goto fail2;
419 }
420
421 ab->irq_num_vbus_fall = platform_get_irq_byname(pdev, "VBUS_DET_F");
422 if (ab->irq_num_vbus_fall < 0) {
423 dev_err(&pdev->dev, "VBUS fall irq not found\n");
424 return ab->irq_num_vbus_fall;
425 }
426 err = request_threaded_irq(ab->irq_num_vbus_fall, NULL,
427 ab8500_usb_v1x_vbus_fall_irq,
428 IRQF_NO_SUSPEND | IRQF_SHARED,
429 "usb-vbus-fall", ab);
430 if (err < 0) {
431 dev_err(ab->dev, "request_irq failed for Vbus fall irq\n");
432 goto fail3;
433 }
434
435 return 0;
436fail3:
437 free_irq(ab->irq_num_vbus_rise, ab);
438fail2:
439 free_irq(ab->irq_num_id_fall, ab);
440fail1:
441 free_irq(ab->irq_num_id_rise, ab);
442fail0:
443 return err;
444} 333}
445 334
446static int ab8500_usb_v2_res_setup(struct platform_device *pdev, 335static int ab8500_usb_v2_res_setup(struct platform_device *pdev,
@@ -471,16 +360,16 @@ static int ab8500_usb_v2_res_setup(struct platform_device *pdev,
471static int ab8500_usb_probe(struct platform_device *pdev) 360static int ab8500_usb_probe(struct platform_device *pdev)
472{ 361{
473 struct ab8500_usb *ab; 362 struct ab8500_usb *ab;
363 struct ab8500 *ab8500;
474 struct usb_otg *otg; 364 struct usb_otg *otg;
475 int err; 365 int err;
476 int rev; 366 int rev;
477 367
368 ab8500 = dev_get_drvdata(pdev->dev.parent);
478 rev = abx500_get_chip_id(&pdev->dev); 369 rev = abx500_get_chip_id(&pdev->dev);
479 if (rev < 0) { 370
480 dev_err(&pdev->dev, "Chip id read failed\n"); 371 if (is_ab8500_1p1_or_earlier(ab8500)) {
481 return rev; 372 dev_err(&pdev->dev, "Unsupported AB8500 chip rev=%d\n", rev);
482 } else if (rev < 0x10) {
483 dev_err(&pdev->dev, "Unsupported AB8500 chip\n");
484 return -ENODEV; 373 return -ENODEV;
485 } 374 }
486 375
@@ -495,7 +384,7 @@ static int ab8500_usb_probe(struct platform_device *pdev)
495 } 384 }
496 385
497 ab->dev = &pdev->dev; 386 ab->dev = &pdev->dev;
498 ab->rev = rev; 387 ab->ab8500 = ab8500;
499 ab->phy.dev = ab->dev; 388 ab->phy.dev = ab->dev;
500 ab->phy.otg = otg; 389 ab->phy.otg = otg;
501 ab->phy.label = "ab8500"; 390 ab->phy.label = "ab8500";
@@ -519,13 +408,7 @@ static int ab8500_usb_probe(struct platform_device *pdev)
519 /* all: Disable phy when called from set_host and set_peripheral */ 408 /* all: Disable phy when called from set_host and set_peripheral */
520 INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work); 409 INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work);
521 410
522 if (ab->rev < 0x20) { 411 err = ab8500_usb_v2_res_setup(pdev, ab);
523 err = ab8500_usb_v1x_res_setup(pdev, ab);
524 ab->link_status_wait = AB8500_V1x_LINK_STAT_WAIT;
525 } else {
526 err = ab8500_usb_v2_res_setup(pdev, ab);
527 }
528
529 if (err < 0) 412 if (err < 0)
530 goto fail0; 413 goto fail0;
531 414
@@ -535,7 +418,7 @@ static int ab8500_usb_probe(struct platform_device *pdev)
535 goto fail1; 418 goto fail1;
536 } 419 }
537 420
538 dev_info(&pdev->dev, "AB8500 usb driver initialized\n"); 421 dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", rev);
539 422
540 return 0; 423 return 0;
541fail1: 424fail1: