bcm27xx: update 6.1 patches to latest version
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-6.1 / 950-0898-mfd-bcm2835-pm-Add-support-for-BCM2712.patch
1 From 0c7aeb96fd3ab68011ba6c24239c501190890308 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Wed, 8 Mar 2023 14:27:58 +0000
4 Subject: [PATCH] mfd: bcm2835-pm: Add support for BCM2712
5
6 BCM2712 lacks the "asb" and "rpivid_asb" register ranges, but still
7 requires the use of the bcm2835-power driver to reset the V3D block.
8
9 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
10 ---
11 drivers/mfd/bcm2835-pm.c | 28 +++++++++++++++++++---------
12 1 file changed, 19 insertions(+), 9 deletions(-)
13
14 --- a/drivers/mfd/bcm2835-pm.c
15 +++ b/drivers/mfd/bcm2835-pm.c
16 @@ -69,12 +69,30 @@ static int bcm2835_pm_get_pdata(struct p
17 return 0;
18 }
19
20 +static const struct of_device_id bcm2835_pm_of_match[] = {
21 + { .compatible = "brcm,bcm2835-pm-wdt", },
22 + { .compatible = "brcm,bcm2835-pm", },
23 + { .compatible = "brcm,bcm2711-pm", },
24 + { .compatible = "brcm,bcm2712-pm", .data = (const void *)1},
25 + {},
26 +};
27 +MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match);
28 +
29 static int bcm2835_pm_probe(struct platform_device *pdev)
30 {
31 + const struct of_device_id *of_id;
32 struct device *dev = &pdev->dev;
33 struct bcm2835_pm *pm;
34 + bool is_2712;
35 int ret;
36
37 + of_id = of_match_node(bcm2835_pm_of_match, pdev->dev.of_node);
38 + if (!of_id) {
39 + dev_err(&pdev->dev, "Failed to match compatible string\n");
40 + return -EINVAL;
41 + }
42 + is_2712 = !!of_id->data;
43 +
44 pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL);
45 if (!pm)
46 return -ENOMEM;
47 @@ -97,21 +115,13 @@ static int bcm2835_pm_probe(struct platf
48 * bcm2835-pm binding as the key for whether we can reference
49 * the full PM register range and support power domains.
50 */
51 - if (pm->asb)
52 + if (pm->asb || is_2712)
53 return devm_mfd_add_devices(dev, -1, bcm2835_power_devs,
54 ARRAY_SIZE(bcm2835_power_devs),
55 NULL, 0, NULL);
56 return 0;
57 }
58
59 -static const struct of_device_id bcm2835_pm_of_match[] = {
60 - { .compatible = "brcm,bcm2835-pm-wdt", },
61 - { .compatible = "brcm,bcm2835-pm", },
62 - { .compatible = "brcm,bcm2711-pm", },
63 - {},
64 -};
65 -MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match);
66 -
67 static struct platform_driver bcm2835_pm_driver = {
68 .probe = bcm2835_pm_probe,
69 .driver = {