Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

bus: add bus driver for accessing Allwinner A64 DE2

The "Display Engine 2.0" (usually called DE2) on the Allwinner A64 SoC
is different from the ones on other Allwinner SoCs. It requires a SRAM
region to be claimed, otherwise all DE2 subblocks won't be accessible.

Add a bus driver for the Allwinner A64 DE2 part which claims the SRAM
region when probing.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Maxime Ripard <maxime.ripard@bootlin.com>

authored by

Icenowy Zheng and committed by
Maxime Ripard
8818e865 a6e3ab0b

+59
+10
drivers/bus/Kconfig
··· 103 103 Controller (BSC, sometimes called "LBSC within Bus Bridge", or 104 104 "External Bus Interface") as found on several Renesas ARM SoCs. 105 105 106 + config SUN50I_DE2_BUS 107 + bool "Allwinner A64 DE2 Bus Driver" 108 + default ARM64 109 + depends on ARCH_SUNXI 110 + select SUNXI_SRAM 111 + help 112 + Say y here to enable support for Allwinner A64 DE2 bus driver. It's 113 + mostly transparent, but a SRAM region needs to be claimed in the SRAM 114 + controller to make the all blocks in the DE2 part accessible. 115 + 106 116 config SUNXI_RSB 107 117 tristate "Allwinner sunXi Reduced Serial Bus Driver" 108 118 default MACH_SUN8I || MACH_SUN9I || ARM64
+1
drivers/bus/Makefile
··· 21 21 22 22 obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o 23 23 obj-$(CONFIG_QCOM_EBI2) += qcom-ebi2.o 24 + obj-$(CONFIG_SUN50I_DE2_BUS) += sun50i-de2.o 24 25 obj-$(CONFIG_SUNXI_RSB) += sunxi-rsb.o 25 26 obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o 26 27 obj-$(CONFIG_TEGRA_ACONNECT) += tegra-aconnect.o
+48
drivers/bus/sun50i-de2.c
··· 1 + // 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 + 12 + static 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); 18 + if (ret) { 19 + dev_err(&pdev->dev, "Error couldn't map SRAM to device\n"); 20 + return ret; 21 + } 22 + 23 + of_platform_populate(np, NULL, NULL, &pdev->dev); 24 + 25 + return 0; 26 + } 27 + 28 + static int sun50i_de2_bus_remove(struct platform_device *pdev) 29 + { 30 + sunxi_sram_release(&pdev->dev); 31 + return 0; 32 + } 33 + 34 + static const struct of_device_id sun50i_de2_bus_of_match[] = { 35 + { .compatible = "allwinner,sun50i-a64-de2", }, 36 + { /* sentinel */ } 37 + }; 38 + 39 + static struct platform_driver sun50i_de2_bus_driver = { 40 + .probe = sun50i_de2_bus_probe, 41 + .remove = sun50i_de2_bus_remove, 42 + .driver = { 43 + .name = "sun50i-de2-bus", 44 + .of_match_table = sun50i_de2_bus_of_match, 45 + }, 46 + }; 47 + 48 + builtin_platform_driver(sun50i_de2_bus_driver);