Message ID | 3759de54da8dac772f43c098fcec322de179c1a4.1533815718.git.amit.kucheria@linaro.org (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Andy Gross |
Headers | show |
Series | Another round of tsens cleanups | expand |
On Thu, Aug 09, 2018 at 06:02:38PM +0530, Amit Kucheria wrote: > On platforms whose device trees specify two address spaces for TSENS, the > second one points to the SROT registers. Initialise the SROT map on those > platforms. > > Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> > --- > drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++-- > drivers/thermal/qcom/tsens.h | 1 + > 2 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c > index 0585084630b3..0b8a793f15f4 100644 > --- a/drivers/thermal/qcom/tsens-common.c > +++ b/drivers/thermal/qcom/tsens-common.c > @@ -117,16 +117,26 @@ static const struct regmap_config tsens_config = { > > int __init init_common(struct tsens_device *tmdev) > { > - void __iomem *tm_base; > + void __iomem *tm_base, *srot_base; > struct resource *res; > struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); > > if (!op) > return -EINVAL; > > - /* The driver only uses the TM register address space for now */ > if (op->num_resources > 1) { > + /* DT with separate SROT and TM address space */ > tmdev->tm_offset = 0; > + res = platform_get_resource(op, IORESOURCE_MEM, 1); > + srot_base = devm_ioremap_resource(&op->dev, res); > + if (IS_ERR(srot_base)) > + return PTR_ERR(srot_base); > + > + tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, > + srot_base, &tsens_config); > + if (IS_ERR(tmdev->srot_map)) > + return PTR_ERR(tmdev->srot_map); > + > } else { > /* old DTs where SROT and TM were in a contiguous 2K block */ > tmdev->tm_offset = 0x1000; > diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h > index 58e98c4d3a8b..b9c4bcf255fa 100644 > --- a/drivers/thermal/qcom/tsens.h > +++ b/drivers/thermal/qcom/tsens.h > @@ -70,6 +70,7 @@ struct tsens_device { > struct device *dev; > u32 num_sensors; > struct regmap *tm_map; > + struct regmap *srot_map; > u32 tm_offset; > struct tsens_context ctx; > const struct tsens_ops *ops; Reviewed-by: Matthias Kaehlcke <mka@chromium.org> -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/thermal/qcom/tsens-common.c b/drivers/thermal/qcom/tsens-common.c index 0585084630b3..0b8a793f15f4 100644 --- a/drivers/thermal/qcom/tsens-common.c +++ b/drivers/thermal/qcom/tsens-common.c @@ -117,16 +117,26 @@ static const struct regmap_config tsens_config = { int __init init_common(struct tsens_device *tmdev) { - void __iomem *tm_base; + void __iomem *tm_base, *srot_base; struct resource *res; struct platform_device *op = of_find_device_by_node(tmdev->dev->of_node); if (!op) return -EINVAL; - /* The driver only uses the TM register address space for now */ if (op->num_resources > 1) { + /* DT with separate SROT and TM address space */ tmdev->tm_offset = 0; + res = platform_get_resource(op, IORESOURCE_MEM, 1); + srot_base = devm_ioremap_resource(&op->dev, res); + if (IS_ERR(srot_base)) + return PTR_ERR(srot_base); + + tmdev->srot_map = devm_regmap_init_mmio(tmdev->dev, + srot_base, &tsens_config); + if (IS_ERR(tmdev->srot_map)) + return PTR_ERR(tmdev->srot_map); + } else { /* old DTs where SROT and TM were in a contiguous 2K block */ tmdev->tm_offset = 0x1000; diff --git a/drivers/thermal/qcom/tsens.h b/drivers/thermal/qcom/tsens.h index 58e98c4d3a8b..b9c4bcf255fa 100644 --- a/drivers/thermal/qcom/tsens.h +++ b/drivers/thermal/qcom/tsens.h @@ -70,6 +70,7 @@ struct tsens_device { struct device *dev; u32 num_sensors; struct regmap *tm_map; + struct regmap *srot_map; u32 tm_offset; struct tsens_context ctx; const struct tsens_ops *ops;
On platforms whose device trees specify two address spaces for TSENS, the second one points to the SROT registers. Initialise the SROT map on those platforms. Signed-off-by: Amit Kucheria <amit.kucheria@linaro.org> --- drivers/thermal/qcom/tsens-common.c | 14 ++++++++++++-- drivers/thermal/qcom/tsens.h | 1 + 2 files changed, 13 insertions(+), 2 deletions(-)