@@ -373,176 +373,6 @@ void omap_device_delete(struct omap_device *od)
373
373
kfree (od );
374
374
}
375
375
376
- /**
377
- * omap_device_copy_resources - Add legacy IO and IRQ resources
378
- * @oh: interconnect target module
379
- * @pdev: platform device to copy resources to
380
- *
381
- * We still have legacy DMA and smartreflex needing resources.
382
- * Let's populate what they need until we can eventually just
383
- * remove this function. Note that there should be no need to
384
- * call this from omap_device_build_from_dt(), nor should there
385
- * be any need to call it for other devices.
386
- */
387
- static int
388
- omap_device_copy_resources (struct omap_hwmod * oh ,
389
- struct platform_device * pdev )
390
- {
391
- struct device_node * np , * child ;
392
- struct property * prop ;
393
- struct resource * res ;
394
- const char * name ;
395
- int error , irq = 0 ;
396
-
397
- if (!oh || !oh -> od || !oh -> od -> pdev )
398
- return - EINVAL ;
399
-
400
- np = oh -> od -> pdev -> dev .of_node ;
401
- if (!np ) {
402
- error = - ENODEV ;
403
- goto error ;
404
- }
405
-
406
- res = kcalloc (2 , sizeof (* res ), GFP_KERNEL );
407
- if (!res )
408
- return - ENOMEM ;
409
-
410
- /* Do we have a dts range for the interconnect target module? */
411
- error = omap_hwmod_parse_module_range (oh , np , res );
412
-
413
- /* No ranges, rely on device reg entry */
414
- if (error )
415
- error = of_address_to_resource (np , 0 , res );
416
- if (error )
417
- goto free ;
418
-
419
- /* SmartReflex needs first IO resource name to be "mpu" */
420
- res [0 ].name = "mpu" ;
421
-
422
- /*
423
- * We may have a configured "ti,sysc" interconnect target with a
424
- * dts child with the interrupt. If so use the first child's
425
- * first interrupt for "ti-hwmods" legacy support.
426
- */
427
- of_property_for_each_string (np , "compatible" , prop , name )
428
- if (!strncmp ("ti,sysc-" , name , 8 ))
429
- break ;
430
-
431
- child = of_get_next_available_child (np , NULL );
432
-
433
- if (name )
434
- irq = irq_of_parse_and_map (child , 0 );
435
- if (!irq )
436
- irq = irq_of_parse_and_map (np , 0 );
437
- if (!irq ) {
438
- error = - EINVAL ;
439
- goto free ;
440
- }
441
-
442
- /* Legacy DMA code needs interrupt name to be "0" */
443
- res [1 ].start = irq ;
444
- res [1 ].end = irq ;
445
- res [1 ].flags = IORESOURCE_IRQ ;
446
- res [1 ].name = "0" ;
447
-
448
- error = platform_device_add_resources (pdev , res , 2 );
449
-
450
- free :
451
- kfree (res );
452
-
453
- error :
454
- WARN (error , "%s: %s device %s failed: %i\n" ,
455
- __func__ , oh -> name , dev_name (& pdev -> dev ),
456
- error );
457
-
458
- return error ;
459
- }
460
-
461
- /**
462
- * omap_device_build - build and register an omap_device with one omap_hwmod
463
- * @pdev_name: name of the platform_device driver to use
464
- * @pdev_id: this platform_device's connection ID
465
- * @oh: ptr to the single omap_hwmod that backs this omap_device
466
- * @pdata: platform_data ptr to associate with the platform_device
467
- * @pdata_len: amount of memory pointed to by @pdata
468
- *
469
- * Convenience function for building and registering a single
470
- * omap_device record, which in turn builds and registers a
471
- * platform_device record. See omap_device_build_ss() for more
472
- * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
473
- * passes along the return value of omap_device_build_ss().
474
- */
475
- struct platform_device __init * omap_device_build (const char * pdev_name ,
476
- int pdev_id ,
477
- struct omap_hwmod * oh ,
478
- void * pdata , int pdata_len )
479
- {
480
- int ret = - ENOMEM ;
481
- struct platform_device * pdev ;
482
- struct omap_device * od ;
483
-
484
- if (!oh || !pdev_name )
485
- return ERR_PTR (- EINVAL );
486
-
487
- if (!pdata && pdata_len > 0 )
488
- return ERR_PTR (- EINVAL );
489
-
490
- if (strncmp (oh -> name , "smartreflex" , 11 ) &&
491
- strncmp (oh -> name , "dma" , 3 )) {
492
- pr_warn ("%s need to update %s to probe with dt\na" ,
493
- __func__ , pdev_name );
494
- ret = - ENODEV ;
495
- goto odbs_exit ;
496
- }
497
-
498
- pdev = platform_device_alloc (pdev_name , pdev_id );
499
- if (!pdev ) {
500
- ret = - ENOMEM ;
501
- goto odbs_exit ;
502
- }
503
-
504
- /* Set the dev_name early to allow dev_xxx in omap_device_alloc */
505
- if (pdev -> id != -1 )
506
- dev_set_name (& pdev -> dev , "%s.%d" , pdev -> name , pdev -> id );
507
- else
508
- dev_set_name (& pdev -> dev , "%s" , pdev -> name );
509
-
510
- /*
511
- * Must be called before omap_device_alloc() as oh->od
512
- * only contains the currently registered omap_device
513
- * and will get overwritten by omap_device_alloc().
514
- */
515
- ret = omap_device_copy_resources (oh , pdev );
516
- if (ret )
517
- goto odbs_exit1 ;
518
-
519
- od = omap_device_alloc (pdev , & oh , 1 );
520
- if (IS_ERR (od )) {
521
- ret = PTR_ERR (od );
522
- goto odbs_exit1 ;
523
- }
524
-
525
- ret = platform_device_add_data (pdev , pdata , pdata_len );
526
- if (ret )
527
- goto odbs_exit2 ;
528
-
529
- ret = omap_device_register (pdev );
530
- if (ret )
531
- goto odbs_exit2 ;
532
-
533
- return pdev ;
534
-
535
- odbs_exit2 :
536
- omap_device_delete (od );
537
- odbs_exit1 :
538
- platform_device_put (pdev );
539
- odbs_exit :
540
-
541
- pr_err ("omap_device: %s: build failed (%d)\n" , pdev_name , ret );
542
-
543
- return ERR_PTR (ret );
544
- }
545
-
546
376
#ifdef CONFIG_PM
547
377
static int _od_runtime_suspend (struct device * dev )
548
378
{
0 commit comments