-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
0 additions
and
308 deletions.
There are no files selected for viewing
42 changes: 0 additions & 42 deletions
42
Documentation/devicetree/bindings/mtd/brcm,bcm2835-smi-nand.txt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@popcornmix
Today I wanted to experiment with smi-nand-overlay to dump a nand-chip connected to the smi-pins of the raspberry pi.
I was wondering about missing messages in dmesg.
Later i found out that this module was removed.
I don't understand why this module was removed while smi-nand-overlay.dts https://github.com/raspberrypi/linux/blob/rpi-5.10.y/arch/arm/boot/dts/overlays/smi-nand-overlay.dts still exists.
Maybe i'm misunderstanding something?
I also don't understand why:
sudo dtoverlay -v smi-nand
won't fail while "bcm2835-smi-nand" clearly does not exist on kernel 5.10.17-v7+ .
Was this code removed because it wasn't working, or because nobody used it?
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was dropped due to conflicts when moving to the newer kernel.
And it's not been re-added as no one was using it.
You are the first to notice after it was dropped 2.5 years ago.
The overlay should have ideally have been removed.
You could try re-adding it back
git cherry-pick 9e5e1dc0
but I suspect it will need some fixing up.
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@popcornmix
Thanks, i used that code and modified it to work with the current kernel.
Sadly it seems that the SMI interface is not reliable enough.
It sometimes seems to skip some read bytes.
For example the full Id of my nand is:
ADh DCh 10h 95h 54h
But it gets:
ADh 10h 95h 54h
Changing the timings a bit I got it to:
ADh DCh 95h 54h
Of course that causes problems detecting other nand-settings like OOB-size.
Cheating by disabling ecc made my driver work and i could use nanddump.
The dump itself contains readable strings.
Problem is that the dump itself is different every time.(sometimes missing some bytes)
Any Idea what could cause that problem?
(first i thought it is a pin connection mistake but i double checked that)
PS:
Wish there would have been a better documentation about that SMI interface on the internet :(
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Wren6991 any suggestions?
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@popcornmix
@Wren6991
I made some progress today, but only with a workaround.
i changed the following line:
https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/mtd/nand/raw/nand_base.c#L1582
to use read_buf instead:
chip->legacy.read_buf(chip, id, len);
and changed:
https://github.com/raspberrypi/linux/blob/rpi-5.10.y/drivers/mtd/nand/raw/nand_base.c#L4723
to:
ret = nand_readid_op(chip, 0, id_data, 5);
Now its successfully detecting my chip.
Well thats enough for the good news.
The bad news is that there seems to be a problem on reading small buffers.
I'm not shure if using an odd number like 5 changes the behaviour on bcm2835_smi_read_buf.
Another bad thing I noticed is that nanddump crashes silently.
dmesg shows the following: https://gist.github.com/TheCrazyT/77b19e074f9679da0c9eedd054de1f7c
"bcm2835_smi_read_buf" is inside that stacktrace so i believe there must be something wrong in it.
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is your flash device attached over a 16 bit or 8 bit bus? Doing raw byte operations with SMI width of 16 is not going to go well, which may be why you saw a difference when patching the multiple
read_byte()
s with a singleread_buf()
. Even for 8-bit bus width, there is a difference in how the bytes modulo 4 are handled versus the main bulk of the transfer, since the SMI FIFO is 32 bits wide, which might be another reason you get different results with a single 5-byte call. It's hard to guess what is going on without more information or some logs.This code did work at one point, but was not maintained and/or used.
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Wren6991
I'm using a 8 bit bus.
kern.log shows some additional information about my new problem:
Wonder what could cause the "DMA timeout".
Looks like I'm running from one problem to another.
Btw.:
Currently it looks like all the blocks are marked as bad for some reason.
Earlier I was atleast able to use nanddump by luck, but now I'm not so lucky anymore.
Update:
Figured out that crash problem.
I was accidently setting:
smi_settings->dma_read_thresh = 0x3f;
because I thought It might have any impact on my main problem.
Now my only problem left is the skipped-byte problem during nanddump (that also causes alot of "uncorrectable bitflip(s)").
Hopefully I find a solution to this :-( .
72ce5a4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to let you know, the skipping byte problem seems to be hardware related.
I was able to stabilize it a bit with a 200pF capacitor between read enable pin and ground.
Still not perfect and i guess its different depending on setup and settings.
(I can only estimate the amount of bytes skipped by the amount of 0xFF-bytes at the end of a read page of the nand by using nanddump with oob-data)
My digital oscilloscope was not much of a help since it seems to change the result while attached to the nand-chip.
But using it without anything attached I'm able to see some unusual spikes on gpio 6(SOE) that maybe could trigger some read instructions.