blob: 414f29cdedf0db88691c54b1f2b826f696fd9785 [file] [log] [blame]
Icenowy Zheng8818e862018-06-22 20:45:36 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Allwinner A64 Display Engine 2.0 Bus Driver
4 *
5 * Copyright (C) 2018 Icenowy Zheng <icenowy@aosc.io>
6 */
7
8#include <linux/of_platform.h>
9#include <linux/platform_device.h>
10#include <linux/soc/sunxi/sunxi_sram.h>
11
12static int sun50i_de2_bus_probe(struct platform_device *pdev)
13{
14 struct device_node *np = pdev->dev.of_node;
15 int ret;
16
17 ret = sunxi_sram_claim(&pdev->dev);
Jernej Skrabec50ac48a2021-10-10 09:18:12 +020018 if (ret)
19 return dev_err_probe(&pdev->dev, ret,
20 "Couldn't map SRAM to device\n");
Icenowy Zheng8818e862018-06-22 20:45:36 +080021
22 of_platform_populate(np, NULL, NULL, &pdev->dev);
23
24 return 0;
25}
26
27static int sun50i_de2_bus_remove(struct platform_device *pdev)
28{
29 sunxi_sram_release(&pdev->dev);
30 return 0;
31}
32
33static const struct of_device_id sun50i_de2_bus_of_match[] = {
34 { .compatible = "allwinner,sun50i-a64-de2", },
35 { /* sentinel */ }
36};
37
38static struct platform_driver sun50i_de2_bus_driver = {
39 .probe = sun50i_de2_bus_probe,
40 .remove = sun50i_de2_bus_remove,
41 .driver = {
42 .name = "sun50i-de2-bus",
43 .of_match_table = sun50i_de2_bus_of_match,
44 },
45};
46
47builtin_platform_driver(sun50i_de2_bus_driver);