Writing not working to CPLD/FPGA.

4 messages, 2 authors, 2022-11-13 · open the first message on its own page

Writing not working to CPLD/FPGA.

From: Steven J. Hill <hidden>
Date: 2022-11-11 04:06:05

Hello.

My platform is a 7447A with Marvell GT64260 bridge chip. I have currently
got the kernel upgraded to v3.12 (started from v2.6.26) and only have one
more piece to get working that has never worked. There is a CPLD on the
board. It maps in just fine and I can read the registers without issue.
However, none of my writes work. In the bootloader, I can write the CPLD
registers without issue. The preboot code in 'arch/powerpc/boot' can also
write the CPLD registers. So, write access stops working once the kernel is
booted. Using _PAGE_NO_CACHE with ioremap_prot() and other flags does not
work. Has anyone else ever encountered something similar behavior in the
past? Please CC: me. I am not subscribed to the list. Thanks in advance.

-Steve

Re: Writing not working to CPLD/FPGA.

From: Christophe Leroy <hidden>
Date: 2022-11-11 08:55:09

Hi Steve,

Le 11/11/2022 à 01:45, Steven J. Hill a écrit :
Hello.

My platform is a 7447A with Marvell GT64260 bridge chip. I have currently
got the kernel upgraded to v3.12 (started from v2.6.26) and only have one
more piece to get working that has never worked. There is a CPLD on the
board. It maps in just fine and I can read the registers without issue.
However, none of my writes work. In the bootloader, I can write the CPLD
registers without issue. The preboot code in 'arch/powerpc/boot' can also
write the CPLD registers. So, write access stops working once the kernel is
booted. Using _PAGE_NO_CACHE with ioremap_prot() and other flags does not
work. Has anyone else ever encountered something similar behavior in the
past? Please CC: me. I am not subscribed to the list. Thanks in advance.

It's a bit difficult to answer without knowing more about your setup.

First of all, kernel 3.12 is prehistoric. Have you tried with latest 
kernel, or at least with one of the long term support releases (see 
https://www.kernel.org/category/releases.html) ?

When you say none of your writes work, what does that mean exactly ? Do 
you get any error, an Oops, or is it blindly ignored ?

How do you write to the register, do you use the IO accessors out_be32() 
or equivalent ? If you just dereference a volatile pointer, please read 
https://www.kernel.org/doc/html/latest/process/volatile-considered-harmful.html

I don't think _PAGE_NO_CACHE is enough, you also need _PAGE_GUARDED. Use 
function ioremap(), see 
https://elixir.bootlin.com/linux/v3.12.74/source/arch/powerpc/mm/pgtable_32.c#L129

Christophe

Re: Writing not working to CPLD/FPGA.

From: Steven J. Hill <hidden>
Date: 2022-11-11 14:36:44

On 11/11/22 02:53, Christophe Leroy wrote:
First of all, kernel 3.12 is prehistoric. Have you tried with latest
kernel, or at least with one of the long term support releases (see
https://www.kernel.org/category/releases.html) ?
It is what my customer wants. For this project, upgrading the kernel is not 
an option. I am using the IO accessor out_be32() along with a BAT:

    setbat(6, 0xe50000000, 0xe5000000, 4096*1024, PAGE_KERNEL_NCG);

There are no panics or errors. The writes are just silently ignored.

-Steve

Re: Writing not working to CPLD/FPGA.

From: Christophe Leroy <hidden>
Date: 2022-11-13 13:06:41

Le 11/11/2022 à 15:27, Steven J. Hill a écrit :
On 11/11/22 02:53, Christophe Leroy wrote:
quoted
First of all, kernel 3.12 is prehistoric. Have you tried with latest
kernel, or at least with one of the long term support releases (see
https://www.kernel.org/category/releases.html) ?
It is what my customer wants. For this project, upgrading the kernel is 
not an option. I am using the IO accessor out_be32() along with a BAT:
That's maybe not an option for your customer, but it is a good option 
for yourself to find out what the problem is. If recent kernel don't 
have the problem, you can then perform a 'git bisect' in order to find 
out which commit fixed the problem. Once that is done, you may backport 
the fixing commit to 3.12 for your customer.
    setbat(6, 0xe50000000, 0xe5000000, 4096*1024, PAGE_KERNEL_NCG);
Have you tried with ioremap() instead of setbat() ?

Also, what other BATs do you have in your setup ? Maybe you have some 
overlapping BATs.

Christophe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help