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