.. | .. |
---|
19 | 19 | spinlock_t lock; |
---|
20 | 20 | }; |
---|
21 | 21 | |
---|
| 22 | +struct meson_audio_arb_match_data { |
---|
| 23 | + const unsigned int *reset_bits; |
---|
| 24 | + unsigned int reset_num; |
---|
| 25 | +}; |
---|
| 26 | + |
---|
22 | 27 | #define ARB_GENERAL_BIT 31 |
---|
23 | 28 | |
---|
24 | 29 | static const unsigned int axg_audio_arb_reset_bits[] = { |
---|
.. | .. |
---|
28 | 33 | [AXG_ARB_FRDDR_A] = 4, |
---|
29 | 34 | [AXG_ARB_FRDDR_B] = 5, |
---|
30 | 35 | [AXG_ARB_FRDDR_C] = 6, |
---|
| 36 | +}; |
---|
| 37 | + |
---|
| 38 | +static const struct meson_audio_arb_match_data axg_audio_arb_match = { |
---|
| 39 | + .reset_bits = axg_audio_arb_reset_bits, |
---|
| 40 | + .reset_num = ARRAY_SIZE(axg_audio_arb_reset_bits), |
---|
| 41 | +}; |
---|
| 42 | + |
---|
| 43 | +static const unsigned int sm1_audio_arb_reset_bits[] = { |
---|
| 44 | + [AXG_ARB_TODDR_A] = 0, |
---|
| 45 | + [AXG_ARB_TODDR_B] = 1, |
---|
| 46 | + [AXG_ARB_TODDR_C] = 2, |
---|
| 47 | + [AXG_ARB_FRDDR_A] = 4, |
---|
| 48 | + [AXG_ARB_FRDDR_B] = 5, |
---|
| 49 | + [AXG_ARB_FRDDR_C] = 6, |
---|
| 50 | + [AXG_ARB_TODDR_D] = 3, |
---|
| 51 | + [AXG_ARB_FRDDR_D] = 7, |
---|
| 52 | +}; |
---|
| 53 | + |
---|
| 54 | +static const struct meson_audio_arb_match_data sm1_audio_arb_match = { |
---|
| 55 | + .reset_bits = sm1_audio_arb_reset_bits, |
---|
| 56 | + .reset_num = ARRAY_SIZE(sm1_audio_arb_reset_bits), |
---|
31 | 57 | }; |
---|
32 | 58 | |
---|
33 | 59 | static int meson_audio_arb_update(struct reset_controller_dev *rcdev, |
---|
.. | .. |
---|
82 | 108 | }; |
---|
83 | 109 | |
---|
84 | 110 | static const struct of_device_id meson_audio_arb_of_match[] = { |
---|
85 | | - { .compatible = "amlogic,meson-axg-audio-arb", }, |
---|
| 111 | + { |
---|
| 112 | + .compatible = "amlogic,meson-axg-audio-arb", |
---|
| 113 | + .data = &axg_audio_arb_match, |
---|
| 114 | + }, { |
---|
| 115 | + .compatible = "amlogic,meson-sm1-audio-arb", |
---|
| 116 | + .data = &sm1_audio_arb_match, |
---|
| 117 | + }, |
---|
86 | 118 | {} |
---|
87 | 119 | }; |
---|
88 | 120 | MODULE_DEVICE_TABLE(of, meson_audio_arb_of_match); |
---|
.. | .. |
---|
104 | 136 | static int meson_audio_arb_probe(struct platform_device *pdev) |
---|
105 | 137 | { |
---|
106 | 138 | struct device *dev = &pdev->dev; |
---|
| 139 | + const struct meson_audio_arb_match_data *data; |
---|
107 | 140 | struct meson_audio_arb_data *arb; |
---|
108 | 141 | struct resource *res; |
---|
109 | 142 | int ret; |
---|
| 143 | + |
---|
| 144 | + data = of_device_get_match_data(dev); |
---|
| 145 | + if (!data) |
---|
| 146 | + return -EINVAL; |
---|
110 | 147 | |
---|
111 | 148 | arb = devm_kzalloc(dev, sizeof(*arb), GFP_KERNEL); |
---|
112 | 149 | if (!arb) |
---|
.. | .. |
---|
126 | 163 | return PTR_ERR(arb->regs); |
---|
127 | 164 | |
---|
128 | 165 | spin_lock_init(&arb->lock); |
---|
129 | | - arb->reset_bits = axg_audio_arb_reset_bits; |
---|
130 | | - arb->rstc.nr_resets = ARRAY_SIZE(axg_audio_arb_reset_bits); |
---|
| 166 | + arb->reset_bits = data->reset_bits; |
---|
| 167 | + arb->rstc.nr_resets = data->reset_num; |
---|
131 | 168 | arb->rstc.ops = &meson_audio_arb_rstc_ops; |
---|
132 | 169 | arb->rstc.of_node = dev->of_node; |
---|
133 | 170 | arb->rstc.owner = THIS_MODULE; |
---|