firmware-utils: bump to git HEAD
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0214-soc-bcm-bcm2835-pm-Add-support-for-2711.patch
1 From 0cb69292622e3530a72d3173d78c484c8f4d3eab Mon Sep 17 00:00:00 2001
2 From: Eric Anholt <eric@anholt.net>
3 Date: Fri, 11 Jan 2019 17:31:07 -0800
4 Subject: [PATCH] soc: bcm: bcm2835-pm: Add support for 2711.
5
6 Without the actual power management part any more, there's a lot less
7 to set up for V3D. We just need to clear the RSTN field for the power
8 domain, and expose the reset controller for toggling it again.
9
10 This is definitely incomplete -- the old ISP and H264 is in the old
11 bridge, but since we have no consumers of it I've just done the
12 minimum to get V3D working.
13
14 Signed-off-by: Eric Anholt <eric@anholt.net>
15 ---
16 drivers/mfd/bcm2835-pm.c | 11 +++++++++++
17 drivers/soc/bcm/bcm2835-power.c | 22 ++++++++++++++++++++++
18 include/linux/mfd/bcm2835-pm.h | 1 +
19 3 files changed, 34 insertions(+)
20
21 --- a/drivers/mfd/bcm2835-pm.c
22 +++ b/drivers/mfd/bcm2835-pm.c
23 @@ -50,6 +50,17 @@ static int bcm2835_pm_probe(struct platf
24 if (ret)
25 return ret;
26
27 + /* Map the ARGON ASB regs if present. */
28 + res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
29 + if (res) {
30 + pm->arg_asb = devm_ioremap_resource(dev, res);
31 + if (IS_ERR(pm->arg_asb)) {
32 + dev_err(dev, "Failed to map ARGON ASB: %ld\n",
33 + PTR_ERR(pm->arg_asb));
34 + return PTR_ERR(pm->arg_asb);
35 + }
36 + }
37 +
38 /* We'll use the presence of the AXI ASB regs in the
39 * bcm2835-pm binding as the key for whether we can reference
40 * the full PM register range and support power domains.
41 --- a/drivers/soc/bcm/bcm2835-power.c
42 +++ b/drivers/soc/bcm/bcm2835-power.c
43 @@ -143,6 +143,8 @@ struct bcm2835_power {
44 /* AXI Async bridge registers. */
45 void __iomem *asb;
46
47 + bool is_2711;
48 +
49 struct genpd_onecell_data pd_xlate;
50 struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT];
51 struct reset_controller_dev reset;
52 @@ -192,6 +194,10 @@ static int bcm2835_power_power_off(struc
53 {
54 struct bcm2835_power *power = pd->power;
55
56 + /* 2711 has no power domains above the reset controller. */
57 + if (power->is_2711)
58 + return 0;
59 +
60 /* Enable functional isolation */
61 PM_WRITE(pm_reg, PM_READ(pm_reg) & ~PM_ISFUNC);
62
63 @@ -213,6 +219,10 @@ static int bcm2835_power_power_on(struct
64 int inrush;
65 bool powok;
66
67 + /* 2711 has no power domains above the reset controller. */
68 + if (power->is_2711)
69 + return 0;
70 +
71 /* If it was already powered on by the fw, leave it that way. */
72 if (PM_READ(pm_reg) & PM_POWUP)
73 return 0;
74 @@ -627,6 +637,18 @@ static int bcm2835_power_probe(struct pl
75 power->base = pm->base;
76 power->asb = pm->asb;
77
78 + /* 2711 hack: the new ARGON ASB took over V3D, which is our
79 + * only consumer of this driver so far. The old ASB seems to
80 + * still be present with ISP and H264 bits but no V3D, but I
81 + * don't know if that's real or not. The V3D is in the same
82 + * place in the new ASB as the old one, so just poke the new
83 + * one for now.
84 + */
85 + if (pm->arg_asb) {
86 + power->asb = pm->arg_asb;
87 + power->is_2711 = true;
88 + }
89 +
90 id = ASB_READ(ASB_AXI_BRDG_ID);
91 if (id != 0x62726467 /* "BRDG" */) {
92 dev_err(dev, "ASB register ID returned 0x%08x\n", id);
93 --- a/include/linux/mfd/bcm2835-pm.h
94 +++ b/include/linux/mfd/bcm2835-pm.h
95 @@ -9,6 +9,7 @@ struct bcm2835_pm {
96 struct device *dev;
97 void __iomem *base;
98 void __iomem *asb;
99 + void __iomem *arg_asb;
100 };
101
102 #endif /* BCM2835_MFD_PM_H */