Thread (33 messages) 33 messages, 6 authors, 2021-12-16

Re: [PATCH v4 09/16] reset: starfive-jh7100: Add StarFive JH7100 reset driver

From: Andy Shevchenko <hidden>
Date: 2021-11-16 16:21:58
Also in: linux-clk, linux-devicetree, linux-gpio, linux-riscv, lkml

On Tue, Nov 16, 2021 at 6:06 PM Emil Renner Berthing [off-list ref] wrote:
On Tue, 16 Nov 2021 at 17:01, Andy Shevchenko [off-list ref] wrote:
quoted
On Tue, Nov 16, 2021 at 5:06 PM Emil Renner Berthing [off-list ref] wrote:
...
quoted
quoted
+#if BITS_PER_LONG == 64
+#define jh7100_reset_read      readq
+#define jh7100_reset_write     writeq
+#else
+#define jh7100_reset_read      readl
+#define jh7100_reset_write     writel
+#endif
No need, just use always readq() / writeq() and include io-64-nonatomic-lo-hi
Hmm.. how would that work on a 32bit architecture where sizeof(long)
== 4? The whole point of this is to read chunks in sizes matching the
words in the bitmap later on.
Why not? You just put some amendments, see below an example.

...
quoted
quoted
+       void __iomem *reg_assert = data->base + JH7100_RESET_ASSERT0 + offset * sizeof(long);
+       void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + offset * sizeof(long);
+       unsigned long value;
      void __iomem *reg_assert = data->base + JH7100_RESET_ASSERT0 + off64;
      void __iomem *reg_status = data->base + JH7100_RESET_STATUS0 + off64;
      u64 value;
quoted
quoted
+       value = jh7100_reset_read(reg_assert);
+       if (assert)
+               value |= mask;
+       else
+               value &= ~mask;
+       jh7100_reset_write(value, reg_assert);
value = readq(...);
...update...
writeq(value, ...);
quoted
quoted
+       /* if the associated clock is gated, deasserting might otherwise hang forever */
+       ret = readx_poll_timeout_atomic(jh7100_reset_read, reg_status, value,
+                                       (value & mask) == done, 0, 1000);
readq_poll_timeout_atomic()

Maybe at the end of the day simple use of u64 will be better than bitmap.
Up to you, you have got the idea. Either way you may put my tag.

-- 
With Best Regards,
Andy Shevchenko
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help