-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Use Device Tree to add the bcm2835-mmc device #909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Mirror bcm2835-dma.c commit 9eba553: chancnt is already filled by dma_async_device_register, which uses the channel list to know how much channels there is. Since it's already filled, we can safely remove it from the drivers' probe function. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Don't register the device in the driver. Do it in the board file. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. Add Device Tree support to the non ARCH_BCM2835 case. Use the same driver name regardless of architecture. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add Device Tree entry for bcm2835-dma. The entry doesn't contain any resources since they are handled by the arch/arm/mach-bcm270x/dma.c driver. In non-DT mode, don't add the device in the board file. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add clock for the mmc-bcm2835.0 device. Will be used in non-DT mode. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Both ARCH_BCM2835 and ARCH_BCM270x are built with OF now. Enable Device Tree support for all architectures. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Error handling in the bcm2835-mmc probe function is broken. |
Cool. I'll give it a test. |
@@ -734,8 +734,6 @@ static int bcm2835_dma_chan_init(struct bcm2835_dmadev *d, int chan_id, int irq) | |||
vchan_init(&c->vc, &d->ddev); | |||
INIT_LIST_HEAD(&c->node); | |||
|
|||
d->ddev.chancnt++; |
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.
Can you explain why this change is necessary (or why the old code is no longer necessary)?
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's explained in the commit message.
I'm following up on this commit that came with 3.19: 9eba553
I guess this is the line that the message refers to: http://lxr.free-electrons.com/source/drivers/dma/dmaengine.c#L875
There is a slight gotcha with this. If you update the kernel without updating the dtb, you get a rather worrying file system check failed error on drop to a an emergency root console. Not saying there is anything we can necessarily do about this, but I imagine I won't be the only user who does this so we might see users hitting this in the future. |
I have no objections. It is good to be moving closer to BCM2835, but it feels wrong having to ADD a platform device to bcm270x.c. |
I what situation would this happen? Not by using rpi-update? |
rpi-update users should be safe. |
Hopefully it won't stay there very long 😄 |
I have added .device_prep_slave_sg to bcm2835-dma.c which is working fine except that bcm2708_fb doesn't get it's dma channel and errors out (needs dma.c). While doing this I discovered that the dmaengine driver always overwrites the dreq from DT with slave_id from config. - dmas = <&dma 5>,
- <&dma 5>;
+ dmas = <&dma 11>,
+ <&dma 11>;
/* Setup DREQ channel */
- c->dreq = c->cfg.slave_id;
+ if (c->cfg.slave_id)
+ c->dreq = c->cfg.slave_id; A related question: |
It looks like user-mode access to DMA. It's a shame the squashing hides the history. |
I believe this is complete history: It was used by Simon Hall in some experimental X acceleration code, and probably in his open source 3d driver competition entry. I don't believe it is currently in use. In fact it was deleted from mach-bcm2708, so its presence in mach-bcm2709 is only accidental. |
That's good to hear. |
No this isn't just a problem for user built kernels. I'm using Kali 1.1 as a Pen Test and Forensic tool on the Pi 2 and can't get the Tiny3.5 TFT screen to work at all. I've asked Kali folks about it and they are puzzled as to what happened between the Pi B+ and the Pi 2. The Pi's were built fairly close together so why is aren't TFT's supported for most Nix brews? I'm dieing here. Please help. |
@monroerl What does your problem have to do with this Pull Request? Please find a more appropriate location. |
The problem with slave_id always being used also applies to the cyclic case:
So I propose to only use dreq in the prep_dma functions and add this to dma_slave_config:
@popcornmix Do you have hardware to test i2s (uses cyclic dma) if I make this change? |
Not sure what I2S devices use cyclic dma. I've only got audio cards that use I2S. Not sure if @pelwell has anything else? |
I'm pretty sure the audio devices use cyclic dma. |
@koalo submitted both the dmaengine driver and the i2s driver, and it sets slave_id in the probe function and calls snd_dmaengine_pcm_register(). So I guess any i2s audio device will do. Maybe I should just fix the slave_sg case which I can test? |
Add Device Tree entry for bcm2835-mmc. In non-DT mode, don't add the device in the board file. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Probe error handling is broken in several places. Simplify error handling by using device managed functions. Replace pr_{err,info} with dev_{err,info}. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
dreq is set when the DMA channel is fetched from Device Tree. slave_id is set using dmaengine_slave_config(). Only overwrite dreq with slave_id if it is not set. dreq/slave_id in the cyclic DMA case is not touched, because I don't have hardware to test with. Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
I have updated the PR:
|
I skipped dreq/slave_id and the cyclic dma case. |
Use Device Tree to add the bcm2835-mmc device
Thanks. Changes look good, we'll accept for wider testing (e.g. this kernel is used in OpenELEC Milhouse nightly builds) and keep an eye out for any regression reports. |
Move the dma and mmc devices to Device Tree.
This enables drivers to get DMA channels using Device Tree.
Tested on Pi1 B+ and Pi2 in both DT and non-DT mode.