Message ID | 20191103013645.9856-7-afaerber@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ARM: Realtek RTD1195/RTD1295 SoC info | expand |
> Detection logic from downstream drivers/soc/realtek/rtd129x/rtk_chip.c. > > Signed-off-by: Andreas Färber <afaerber@suse.de> > --- > drivers/soc/realtek/chip.c | 18 +++++++++++++++++- > 1 file changed, 17 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c index > 9d13422e9936..ba653c097644 100644 > --- a/drivers/soc/realtek/chip.c > +++ b/drivers/soc/realtek/chip.c > @@ -50,9 +50,25 @@ static const char *default_name(struct device *dev, > const struct rtd_soc *s) > return s->family; > } > > +static const char *rtd1295_name(struct device *dev, const struct > +rtd_soc *s) { > + void __iomem *base; > + > + base = of_iomap(dev->of_node, 1); > + if (base) { > + u32 chipinfo1 = readl_relaxed(base); > + iounmap(base); > + if (chipinfo1 & BIT(11)) { > + return "RTD1296"; > + } > + } > + > + return "RTD1295"; > +} > + > static const struct rtd_soc rtd_soc_families[] = { > { 0x00006329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" }, > - { 0x00006421, "RTD1295", default_name, rtd1295_revisions, "Kylin" }, > + { 0x00006421, "RTD1295", rtd1295_name, rtd1295_revisions, "Kylin" }, > }; > > static const struct rtd_soc *rtd_soc_by_chip_id(u32 chip_id) > -- > 2.16.4 > Acked-by: James Tai <james.tai@realtek.com>
diff --git a/drivers/soc/realtek/chip.c b/drivers/soc/realtek/chip.c index 9d13422e9936..ba653c097644 100644 --- a/drivers/soc/realtek/chip.c +++ b/drivers/soc/realtek/chip.c @@ -50,9 +50,25 @@ static const char *default_name(struct device *dev, const struct rtd_soc *s) return s->family; } +static const char *rtd1295_name(struct device *dev, const struct rtd_soc *s) +{ + void __iomem *base; + + base = of_iomap(dev->of_node, 1); + if (base) { + u32 chipinfo1 = readl_relaxed(base); + iounmap(base); + if (chipinfo1 & BIT(11)) { + return "RTD1296"; + } + } + + return "RTD1295"; +} + static const struct rtd_soc rtd_soc_families[] = { { 0x00006329, "RTD1195", default_name, rtd1195_revisions, "Phoenix" }, - { 0x00006421, "RTD1295", default_name, rtd1295_revisions, "Kylin" }, + { 0x00006421, "RTD1295", rtd1295_name, rtd1295_revisions, "Kylin" }, }; static const struct rtd_soc *rtd_soc_by_chip_id(u32 chip_id)
Detection logic from downstream drivers/soc/realtek/rtd129x/rtk_chip.c. Signed-off-by: Andreas Färber <afaerber@suse.de> --- drivers/soc/realtek/chip.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)