[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1jr0bqmxdj.fsf@starbuckisacylon.baylibre.com>
Date: Thu, 18 Jul 2024 19:19:04 +0200
From: Jerome Brunet <jbrunet@...libre.com>
To: Neil Armstrong <neil.armstrong@...aro.org>
Cc: Philipp Zabel <p.zabel@...gutronix.de>, Stephen Boyd
<sboyd@...nel.org>, Jan Dakinevich <jan.dakinevich@...utedevices.com>,
linux-kernel@...r.kernel.org, linux-amlogic@...ts.infradead.org,
linux-clk@...r.kernel.org
Subject: Re: [PATCH v2 1/9] reset: amlogic: convert driver to regmap
On Thu 18 Jul 2024 at 14:45, Neil Armstrong <neil.armstrong@...aro.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
Powered by blists - more mailing lists