Message ID | 20220515202032.3046-11-stefan.wahren@i2se.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | soc: bcm2835-power: Prepare BCM2711 V3D support | expand |
On Sun, May 15, 2022 at 9:21 PM Stefan Wahren <stefan.wahren@i2se.com> wrote: > > In BCM2711 the new RPiVid ASB took over V3D. The old ASB is still present > with the ISP and H264 bits, and V3D is in the same place in the new ASB > as the old one. > > Use the fact that 'pm->rpivid_asb' is populated as a hint that we're on > BCM2711. > > Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Reviewed-by: Peter Robinson <pbrobinson@gmail.com> > --- > drivers/soc/bcm/bcm2835-power.c | 26 +++++++++++++++++++++++--- > 1 file changed, 23 insertions(+), 3 deletions(-) > > diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c > index fa0a13035794..1e06d91c0739 100644 > --- a/drivers/soc/bcm/bcm2835-power.c > +++ b/drivers/soc/bcm/bcm2835-power.c > @@ -126,6 +126,8 @@ > > #define ASB_AXI_BRDG_ID 0x20 > > +#define BCM2835_BRDG_ID 0x62726467 > + > struct bcm2835_power_domain { > struct generic_pm_domain base; > struct bcm2835_power *power; > @@ -139,6 +141,8 @@ struct bcm2835_power { > void __iomem *base; > /* AXI Async bridge registers. */ > void __iomem *asb; > + /* RPiVid bridge registers. */ > + void __iomem *rpivid_asb; > > struct genpd_onecell_data pd_xlate; > struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT]; > @@ -151,9 +155,15 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable > u64 start; > u32 val; > > - > - if (!reg) > + switch (reg) { > + case 0: > return 0; > + case ASB_V3D_S_CTRL: > + case ASB_V3D_M_CTRL: > + if (power->rpivid_asb) > + base = power->rpivid_asb; > + break; > + } > > start = ktime_get_ns(); > > @@ -622,13 +632,23 @@ static int bcm2835_power_probe(struct platform_device *pdev) > power->dev = dev; > power->base = pm->base; > power->asb = pm->asb; > + power->rpivid_asb = pm->rpivid_asb; > > id = readl(power->asb + ASB_AXI_BRDG_ID); > - if (id != 0x62726467 /* "BRDG" */) { > + if (id != BCM2835_BRDG_ID /* "BRDG" */) { > dev_err(dev, "ASB register ID returned 0x%08x\n", id); > return -ENODEV; > } > > + if (power->rpivid_asb) { > + id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID); > + if (id != BCM2835_BRDG_ID /* "BRDG" */) { > + dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n", > + id); > + return -ENODEV; > + } > + } > + > power->pd_xlate.domains = devm_kcalloc(dev, > ARRAY_SIZE(power_domain_names), > sizeof(*power->pd_xlate.domains), > -- > 2.25.1 >
diff --git a/drivers/soc/bcm/bcm2835-power.c b/drivers/soc/bcm/bcm2835-power.c index fa0a13035794..1e06d91c0739 100644 --- a/drivers/soc/bcm/bcm2835-power.c +++ b/drivers/soc/bcm/bcm2835-power.c @@ -126,6 +126,8 @@ #define ASB_AXI_BRDG_ID 0x20 +#define BCM2835_BRDG_ID 0x62726467 + struct bcm2835_power_domain { struct generic_pm_domain base; struct bcm2835_power *power; @@ -139,6 +141,8 @@ struct bcm2835_power { void __iomem *base; /* AXI Async bridge registers. */ void __iomem *asb; + /* RPiVid bridge registers. */ + void __iomem *rpivid_asb; struct genpd_onecell_data pd_xlate; struct bcm2835_power_domain domains[BCM2835_POWER_DOMAIN_COUNT]; @@ -151,9 +155,15 @@ static int bcm2835_asb_control(struct bcm2835_power *power, u32 reg, bool enable u64 start; u32 val; - - if (!reg) + switch (reg) { + case 0: return 0; + case ASB_V3D_S_CTRL: + case ASB_V3D_M_CTRL: + if (power->rpivid_asb) + base = power->rpivid_asb; + break; + } start = ktime_get_ns(); @@ -622,13 +632,23 @@ static int bcm2835_power_probe(struct platform_device *pdev) power->dev = dev; power->base = pm->base; power->asb = pm->asb; + power->rpivid_asb = pm->rpivid_asb; id = readl(power->asb + ASB_AXI_BRDG_ID); - if (id != 0x62726467 /* "BRDG" */) { + if (id != BCM2835_BRDG_ID /* "BRDG" */) { dev_err(dev, "ASB register ID returned 0x%08x\n", id); return -ENODEV; } + if (power->rpivid_asb) { + id = readl(power->rpivid_asb + ASB_AXI_BRDG_ID); + if (id != BCM2835_BRDG_ID /* "BRDG" */) { + dev_err(dev, "RPiVid ASB register ID returned 0x%08x\n", + id); + return -ENODEV; + } + } + power->pd_xlate.domains = devm_kcalloc(dev, ARRAY_SIZE(power_domain_names), sizeof(*power->pd_xlate.domains),
In BCM2711 the new RPiVid ASB took over V3D. The old ASB is still present with the ISP and H264 bits, and V3D is in the same place in the new ASB as the old one. Use the fact that 'pm->rpivid_asb' is populated as a hint that we're on BCM2711. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> --- drivers/soc/bcm/bcm2835-power.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)