Skip to content

Commit a5bbad2

Browse files
claudiubezneasre
authored andcommitted
power: reset: at91-reset: introduce struct at91_reset_data
Introduce struct at91_reset_data to be able to provide per SoC data. At the moment this being only notifier callback. Signed-off-by: Claudiu Beznea <[email protected]> Signed-off-by: Sebastian Reichel <[email protected]>
1 parent 583ef88 commit a5bbad2

File tree

1 file changed

+44
-6
lines changed

1 file changed

+44
-6
lines changed

drivers/power/reset/at91-reset.c

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ enum reset_type {
4949
RESET_TYPE_ULP2 = 8,
5050
};
5151

52+
struct at91_reset_data {
53+
int (*notifier_call)(struct notifier_block *this, unsigned long mode,
54+
void *cmd);
55+
};
56+
5257
struct at91_reset {
5358
void __iomem *rstc_base;
5459
void __iomem *ramc_base[2];
@@ -203,18 +208,50 @@ static const struct of_device_id at91_ramc_of_match[] = {
203208
{ /* sentinel */ }
204209
};
205210

211+
static const struct at91_reset_data at91sam9260_reset_data = {
212+
.notifier_call = at91sam9260_restart,
213+
};
214+
215+
static const struct at91_reset_data at91sam9g45_reset_data = {
216+
.notifier_call = at91sam9g45_restart,
217+
};
218+
219+
static const struct at91_reset_data sama5d3_reset_data = {
220+
.notifier_call = sama5d3_restart,
221+
};
222+
223+
static const struct at91_reset_data samx7_reset_data = {
224+
.notifier_call = samx7_restart,
225+
};
226+
206227
static const struct of_device_id at91_reset_of_match[] = {
207-
{ .compatible = "atmel,at91sam9260-rstc", .data = at91sam9260_restart },
208-
{ .compatible = "atmel,at91sam9g45-rstc", .data = at91sam9g45_restart },
209-
{ .compatible = "atmel,sama5d3-rstc", .data = sama5d3_restart },
210-
{ .compatible = "atmel,samx7-rstc", .data = samx7_restart },
211-
{ .compatible = "microchip,sam9x60-rstc", .data = samx7_restart },
228+
{
229+
.compatible = "atmel,at91sam9260-rstc",
230+
.data = &at91sam9260_reset_data
231+
},
232+
{
233+
.compatible = "atmel,at91sam9g45-rstc",
234+
.data = &at91sam9g45_reset_data
235+
},
236+
{
237+
.compatible = "atmel,sama5d3-rstc",
238+
.data = &sama5d3_reset_data
239+
},
240+
{
241+
.compatible = "atmel,samx7-rstc",
242+
.data = &samx7_reset_data
243+
},
244+
{
245+
.compatible = "microchip,sam9x60-rstc",
246+
.data = &samx7_reset_data
247+
},
212248
{ /* sentinel */ }
213249
};
214250
MODULE_DEVICE_TABLE(of, at91_reset_of_match);
215251

216252
static int __init at91_reset_probe(struct platform_device *pdev)
217253
{
254+
const struct at91_reset_data *reset_data;
218255
const struct of_device_id *match;
219256
struct at91_reset *reset;
220257
struct device_node *np;
@@ -244,7 +281,8 @@ static int __init at91_reset_probe(struct platform_device *pdev)
244281
}
245282

246283
match = of_match_node(at91_reset_of_match, pdev->dev.of_node);
247-
reset->nb.notifier_call = match->data;
284+
reset_data = match->data;
285+
reset->nb.notifier_call = reset_data->notifier_call;
248286
reset->nb.priority = 192;
249287

250288
reset->sclk = devm_clk_get(&pdev->dev, NULL);

0 commit comments

Comments
 (0)