[PATCH v2 1/9] reset: amlogic: convert driver to regmap
Jerome Brunet
jbrunet at baylibre.com
Thu Jul 18 10:19:04 PDT 2024
On Thu 18 Jul 2024 at 14:45, Neil Armstrong <neil.armstrong at linaro.org> wrote:
>> +
>> static int meson_reset_reset(struct reset_controller_dev *rcdev,
>> - unsigned long id)
>> + unsigned long id)
>> {
>> struct meson_reset *data =
>> container_of(rcdev, struct meson_reset, rcdev);
>> - unsigned int bank = id / BITS_PER_REG;
>> - unsigned int offset = id % BITS_PER_REG;
>> - void __iomem *reg_addr = data->reg_base + (bank << 2);
>> + unsigned int offset, bit;
>> - writel(BIT(offset), reg_addr);
>> + meson_reset_offset_and_bit(data, id, &offset, &bit);
>> - return 0;
>> + return regmap_update_bits(data->map, offset,
>> + BIT(bit), BIT(bit));
>
> Here, you're converting a:
> writel(BIT())
> to a:
> reg = readl()
> reg |= BIT()
> writel(reg)
>
> so indeed you should use regmap_write(data->map, offset, BIT(bit))
>
Ok the trouble is this particular register which is write only, not
some writel vs regmap problem. The read value is probably undefined.
I should not have changed which the migration anyway.
Thanks for pointing it out, I'll fix that in v3
--
Jerome
More information about the linux-amlogic
mailing list