Skip to content

Commit adf189e

Browse files
anholtpopcornmix
authored andcommitted
soc: bcm: bcm2835-pm: Add support for 2711.
Without the actual power management part any more, there's a lot less to set up for V3D. We just need to clear the RSTN field for the power domain, and expose the reset controller for toggling it again. This is definitely incomplete -- the old ISP and H264 is in the old bridge, but since we have no consumers of it I've just done the minimum to get V3D working. Signed-off-by: Eric Anholt <eric@anholt.net>
1 parent 378da81 commit adf189e

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

‎drivers/mfd/bcm2835-pm.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ static int bcm2835_pm_probe(struct platform_device *pdev)
5050
if (ret)
5151
return ret;
5252

53+
/* Map the ARGON ASB regs if present. */
54+
res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
55+
if (res) {
56+
pm->arg_asb = devm_ioremap_resource(dev, res);
57+
if (IS_ERR(pm->arg_asb)) {
58+
dev_err(dev, "Failed to map ARGON ASB: %ld\n",
59+
PTR_ERR(pm->arg_asb));
60+
return PTR_ERR(pm->arg_asb);
61+
}
62+
}
63+
5364
/* We'll use the presence of the AXI ASB regs in the
5465
* bcm2835-pm binding as the key for whether we can reference
5566
* the full PM register range and support power domains.

‎drivers/soc/bcm/bcm2835-power.c‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ struct bcm2835_power {
143143
/* AXI Async bridge registers. */
144144
void __iomem *asb;
145145

146+
bool is_2711;
147+
146148
struct genpd_onecell_data pd_xlate;
147149
struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT];
148150
struct reset_controller_dev reset;
@@ -192,6 +194,10 @@ static int bcm2835_power_power_off(struct bcm2835_power_domain *pd, u32 pm_reg)
192194
{
193195
struct bcm2835_power *power = pd->power;
194196

197+
/* 2711 has no power domains above the reset controller. */
198+
if (power->is_2711)
199+
return 0;
200+
195201
/* Enable functional isolation */
196202
PM_WRITE(pm_reg, PM_READ(pm_reg) & ~PM_ISFUNC);
197203

@@ -213,6 +219,10 @@ static int bcm2835_power_power_on(struct bcm2835_power_domain *pd, u32 pm_reg)
213219
int inrush;
214220
bool powok;
215221

222+
/* 2711 has no power domains above the reset controller. */
223+
if (power->is_2711)
224+
return 0;
225+
216226
/* If it was already powered on by the fw, leave it that way. */
217227
if (PM_READ(pm_reg) & PM_POWUP)
218228
return 0;
@@ -627,6 +637,18 @@ static int bcm2835_power_probe(struct platform_device *pdev)
627637
power->base = pm->base;
628638
power->asb = pm->asb;
629639

640+
/* 2711 hack: the new ARGON ASB took over V3D, which is our
641+
* only consumer of this driver so far. The old ASB seems to
642+
* still be present with ISP and H264 bits but no V3D, but I
643+
* don't know if that's real or not. The V3D is in the same
644+
* place in the new ASB as the old one, so just poke the new
645+
* one for now.
646+
*/
647+
if (pm->arg_asb) {
648+
power->asb = pm->arg_asb;
649+
power->is_2711 = true;
650+
}
651+
630652
id = ASB_READ(ASB_AXI_BRDG_ID);
631653
if (id != 0x62726467 /* "BRDG" */) {
632654
dev_err(dev, "ASB register ID returned 0x%08x\n", id);

‎include/linux/mfd/bcm2835-pm.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ struct bcm2835_pm {
99
struct device *dev;
1010
void __iomem *base;
1111
void __iomem *asb;
12+
void __iomem *arg_asb;
1213
};
1314

1415
#endif /* BCM2835_MFD_PM_H */

0 commit comments

Comments
 (0)