|
81 | 81 | #define DART_TTBR_VALID BIT(31)
|
82 | 82 | #define DART_TTBR_SHIFT 12
|
83 | 83 |
|
| 84 | +struct apple_dart_hw { |
| 85 | + u32 oas; |
| 86 | + enum io_pgtable_fmt fmt; |
| 87 | +}; |
| 88 | + |
84 | 89 | /*
|
85 | 90 | * Private structure associated with each DART device.
|
86 | 91 | *
|
87 | 92 | * @dev: device struct
|
| 93 | + * @hw: SoC-specific hardware data |
88 | 94 | * @regs: mapped MMIO region
|
89 | 95 | * @irq: interrupt number, can be shared with other DARTs
|
90 | 96 | * @clks: clocks associated with this DART
|
|
98 | 104 | */
|
99 | 105 | struct apple_dart {
|
100 | 106 | struct device *dev;
|
| 107 | + const struct apple_dart_hw *hw; |
101 | 108 |
|
102 | 109 | void __iomem *regs;
|
103 | 110 |
|
@@ -421,13 +428,13 @@ static int apple_dart_finalize_domain(struct iommu_domain *domain,
|
421 | 428 | pgtbl_cfg = (struct io_pgtable_cfg){
|
422 | 429 | .pgsize_bitmap = dart->pgsize,
|
423 | 430 | .ias = 32,
|
424 |
| - .oas = 36, |
| 431 | + .oas = dart->hw->oas, |
425 | 432 | .coherent_walk = 1,
|
426 | 433 | .iommu_dev = dart->dev,
|
427 | 434 | };
|
428 | 435 |
|
429 | 436 | dart_domain->pgtbl_ops =
|
430 |
| - alloc_io_pgtable_ops(APPLE_DART, &pgtbl_cfg, domain); |
| 437 | + alloc_io_pgtable_ops(dart->hw->fmt, &pgtbl_cfg, domain); |
431 | 438 | if (!dart_domain->pgtbl_ops) {
|
432 | 439 | ret = -ENOMEM;
|
433 | 440 | goto done;
|
@@ -854,6 +861,7 @@ static int apple_dart_probe(struct platform_device *pdev)
|
854 | 861 | return -ENOMEM;
|
855 | 862 |
|
856 | 863 | dart->dev = dev;
|
| 864 | + dart->hw = of_device_get_match_data(dev); |
857 | 865 | spin_lock_init(&dart->lock);
|
858 | 866 |
|
859 | 867 | dart->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
|
@@ -942,8 +950,18 @@ static int apple_dart_remove(struct platform_device *pdev)
|
942 | 950 | return 0;
|
943 | 951 | }
|
944 | 952 |
|
| 953 | +static const struct apple_dart_hw apple_dart_hw_t8103 = { |
| 954 | + .oas = 36, |
| 955 | + .fmt = APPLE_DART, |
| 956 | +}; |
| 957 | +static const struct apple_dart_hw apple_dart_hw_t6000 = { |
| 958 | + .oas = 42, |
| 959 | + .fmt = APPLE_DART2, |
| 960 | +}; |
| 961 | + |
945 | 962 | static const struct of_device_id apple_dart_of_match[] = {
|
946 |
| - { .compatible = "apple,t8103-dart", .data = NULL }, |
| 963 | + { .compatible = "apple,t8103-dart", .data = &apple_dart_hw_t8103 }, |
| 964 | + { .compatible = "apple,t6000-dart", .data = &apple_dart_hw_t6000 }, |
947 | 965 | {},
|
948 | 966 | };
|
949 | 967 | MODULE_DEVICE_TABLE(of, apple_dart_of_match);
|
|
0 commit comments