Re: why iowrite32_rep() doesn't work, I have to use the iowrite32() with a loop

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 16, 2017 at 12:12 PM, ayaka <ayaka@xxxxxxxxxxx> wrote:
> #if 1
>          for (i = 0; i < count; i++) {
>                  u32 *cur = (u32 *)buffer;
>                  u32 pos = offset + i * 4;
>
>                  cur += i;
>                  mpp_debug(DEBUG_SET_REG, "write reg[%03d]: %08x\n",
> pos, *cur);
>                  iowrite32(*cur, mpp_dev->reg_base + pos);
> }
> #else
>          iowrite32_rep(mpp_dev->reg_base + offset, buffer, count);
> mb();
>          for (i = 0; i < count; i++) {
>                  u32 cur = 0;
>                  u32 pos = offset / 4 + i;
>
>                  cur = ioread32(mpp_dev->reg_base + pos * 4);
>                  pr_info("get reg[%03d]: %08x\n", pos, cur);
> }
> #endif

The loop with iowrite32 writes consecutive u32 words from buffer
to consecutive IO memory locations. But iowrite32_rep writes
consecutive u32 words from buffer to the same IO memory location.
So they do different things when count > 1.

-- 
Thanks.
-- Max

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux