@@ -405,10 +405,18 @@ static const struct arm_smmu_impl qcom_adreno_smmu_impl = {
405
405
};
406
406
407
407
static struct arm_smmu_device * qcom_smmu_create (struct arm_smmu_device * smmu ,
408
- const struct arm_smmu_impl * impl )
408
+ const struct qcom_smmu_match_data * data )
409
409
{
410
+ const struct arm_smmu_impl * impl ;
410
411
struct qcom_smmu * qsmmu ;
411
412
413
+ if (!data )
414
+ return ERR_PTR (- EINVAL );
415
+
416
+ impl = data -> impl ;
417
+ if (!impl )
418
+ return smmu ;
419
+
412
420
/* Check to make sure qcom_scm has finished probing */
413
421
if (!qcom_scm_is_available ())
414
422
return ERR_PTR (- EPROBE_DEFER );
@@ -423,24 +431,32 @@ static struct arm_smmu_device *qcom_smmu_create(struct arm_smmu_device *smmu,
423
431
return & qsmmu -> smmu ;
424
432
}
425
433
434
+ static const struct qcom_smmu_match_data qcom_smmu_data = {
435
+ .impl = & qcom_smmu_impl ,
436
+ };
437
+
438
+ static const struct qcom_smmu_match_data qcom_adreno_smmu_data = {
439
+ .impl = & qcom_adreno_smmu_impl ,
440
+ };
441
+
426
442
static const struct of_device_id __maybe_unused qcom_smmu_impl_of_match [] = {
427
- { .compatible = "qcom,msm8998-smmu-v2" },
428
- { .compatible = "qcom,qcm2290-smmu-500" },
429
- { .compatible = "qcom,qdu1000-smmu-500" },
430
- { .compatible = "qcom,sc7180-smmu-500" },
431
- { .compatible = "qcom,sc7280-smmu-500" },
432
- { .compatible = "qcom,sc8180x-smmu-500" },
433
- { .compatible = "qcom,sc8280xp-smmu-500" },
434
- { .compatible = "qcom,sdm630-smmu-v2" },
435
- { .compatible = "qcom,sdm845-smmu-500" },
436
- { .compatible = "qcom,sm6115-smmu-500" },
437
- { .compatible = "qcom,sm6125-smmu-500" },
438
- { .compatible = "qcom,sm6350-smmu-500" },
439
- { .compatible = "qcom,sm6375-smmu-500" },
440
- { .compatible = "qcom,sm8150-smmu-500" },
441
- { .compatible = "qcom,sm8250-smmu-500" },
442
- { .compatible = "qcom,sm8350-smmu-500" },
443
- { .compatible = "qcom,sm8450-smmu-500" },
443
+ { .compatible = "qcom,msm8998-smmu-v2" , . data = & qcom_smmu_data },
444
+ { .compatible = "qcom,qcm2290-smmu-500" , . data = & qcom_smmu_data },
445
+ { .compatible = "qcom,qdu1000-smmu-500" , . data = & qcom_smmu_data },
446
+ { .compatible = "qcom,sc7180-smmu-500" , . data = & qcom_smmu_data },
447
+ { .compatible = "qcom,sc7280-smmu-500" , . data = & qcom_smmu_data },
448
+ { .compatible = "qcom,sc8180x-smmu-500" , . data = & qcom_smmu_data },
449
+ { .compatible = "qcom,sc8280xp-smmu-500" , . data = & qcom_smmu_data },
450
+ { .compatible = "qcom,sdm630-smmu-v2" , . data = & qcom_smmu_data },
451
+ { .compatible = "qcom,sdm845-smmu-500" , . data = & qcom_smmu_data },
452
+ { .compatible = "qcom,sm6115-smmu-500" , . data = & qcom_smmu_data },
453
+ { .compatible = "qcom,sm6125-smmu-500" , . data = & qcom_smmu_data },
454
+ { .compatible = "qcom,sm6350-smmu-500" , . data = & qcom_smmu_data },
455
+ { .compatible = "qcom,sm6375-smmu-500" , . data = & qcom_smmu_data },
456
+ { .compatible = "qcom,sm8150-smmu-500" , . data = & qcom_smmu_data },
457
+ { .compatible = "qcom,sm8250-smmu-500" , . data = & qcom_smmu_data },
458
+ { .compatible = "qcom,sm8350-smmu-500" , . data = & qcom_smmu_data },
459
+ { .compatible = "qcom,sm8450-smmu-500" , . data = & qcom_smmu_data },
444
460
{ }
445
461
};
446
462
@@ -455,12 +471,13 @@ static struct acpi_platform_list qcom_acpi_platlist[] = {
455
471
struct arm_smmu_device * qcom_smmu_impl_init (struct arm_smmu_device * smmu )
456
472
{
457
473
const struct device_node * np = smmu -> dev -> of_node ;
474
+ const struct of_device_id * match ;
458
475
459
476
#ifdef CONFIG_ACPI
460
477
if (np == NULL ) {
461
478
/* Match platform for ACPI boot */
462
479
if (acpi_match_platform_list (qcom_acpi_platlist ) >= 0 )
463
- return qcom_smmu_create (smmu , & qcom_smmu_impl );
480
+ return qcom_smmu_create (smmu , & qcom_smmu_data );
464
481
}
465
482
#endif
466
483
@@ -471,10 +488,11 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct arm_smmu_device *smmu)
471
488
* features if the order is changed.
472
489
*/
473
490
if (of_device_is_compatible (np , "qcom,adreno-smmu" ))
474
- return qcom_smmu_create (smmu , & qcom_adreno_smmu_impl );
491
+ return qcom_smmu_create (smmu , & qcom_adreno_smmu_data );
475
492
476
- if (of_match_node (qcom_smmu_impl_of_match , np ))
477
- return qcom_smmu_create (smmu , & qcom_smmu_impl );
493
+ match = of_match_node (qcom_smmu_impl_of_match , np );
494
+ if (match )
495
+ return qcom_smmu_create (smmu , match -> data );
478
496
479
497
return smmu ;
480
498
}
0 commit comments