Skip to content
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

Add firmware driver #1037

Merged
merged 11 commits into from
Jul 13, 2015
Merged

Add firmware driver #1037

merged 11 commits into from
Jul 13, 2015

Conversation

notro
Copy link
Contributor

@notro notro commented Jun 26, 2015

This makes the new firmware driver API available that will replace the old mailbox API.
bcm2835-mailbox will land in v4.2, and the firmware driver will probably land in v4.3

Tested on Pi1 and Pi2 with and without Device Tree + ARCH_BCM2835.

@notro
Copy link
Contributor Author

notro commented Jun 30, 2015

I have rebased and removed the one-process-at-a-time restriction on opening /dev/vcio.

@popcornmix
Copy link
Collaborator

With the PR:
pi@raspberrypi:~ $ ls -l /dev/vcio crw------- 1 root root 249, 0 Jan 1 1970 /dev/vcio
It should look like:
pi@raspberrypi:~ $ ls -l /dev/vcsm crw-rw---T 1 root video 246, 0 Jan 1 1970 /dev/vcsm
So pi user can use it without root privileges.
That appears with:
/lib/udev/rules.d/10-local-rpi.rules:SUBSYSTEM=="bcm2708_vcio", GROUP="video", MODE="0660"
I guess the SUBSYSTEM name has changed with this PR?

@notro
Copy link
Contributor Author

notro commented Jul 1, 2015

You're right. This change:

SUBSYSTEM=="vcio", GROUP="video", MODE="0660"

gave me:

$ ls -l /dev/vcio
crw-rw---T 1 root video 249, 0 Jan  1  1970 /dev/vcio

@notro
Copy link
Contributor Author

notro commented Jul 1, 2015

When we have changed all the mailbox clients and can remove bcm2708_vcio, I beleive we can add a MODULE_ALIAS("bcm2708_vcio"); to the vcio module to keep it from breaking userspace until it's fixed there.

@popcornmix
Copy link
Collaborator

So can the MODULE_ALIAS("bcm2708_vcio") be added to this PR?

@notro notro force-pushed the fw2 branch 2 times, most recently from c80d54f to 9f70667 Compare July 1, 2015 23:05
@notro
Copy link
Contributor Author

notro commented Jul 1, 2015

Sorry, I didn't know what I was talking about. MODULE_ALIAS can't be used for this.
I have updated with this change that makes it work:

-       /* create sysfs entries */
-       vcio.class = class_create(THIS_MODULE, "vcio");
+       /*
+        * Create sysfs entries
+        * 'bcm2708_vcio' is used for backwards compatibility so we don't break
+        * userspace. Raspian has a udev rule that changes the permissions.
+        */
+       vcio.class = class_create(THIS_MODULE, "bcm2708_vcio");

@popcornmix
Copy link
Collaborator

Can you rebase. We've bumped to 4.1.1 and the configs commit is already in.

lkundrak and others added 11 commits July 3, 2015 20:44
This mailbox driver provides a single mailbox channel to write 32-bit
values to the VPU and get a 32-bit response.  The Raspberry Pi
firmware uses this mailbox channel to implement firmware calls, while
Roku 2 (despite being derived from the same firmware tree) doesn't.

The driver was originally submitted by Lubomir, based on the
out-of-tree 2708 mailbox driver.  Eric Anholt fixed it up for
upstreaming, with the major functional change being that it now has no
notion of multiple channels (since that is a firmware-dependent
concept) and instead the raspberrypi-firmware driver will do that
bit-twiddling in its own messages.
[Jassi: made the 'mbox_chan_ops' struct as const and removed a redundant
variable]

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Craig McGeachie <slapdau@yahoo.com.au>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
With the VC reader blocked and the ARM writing, MAIL0_STA reads empty
permanently while MAIL1_STA goes from empty (0x40000000) to non-empty
(0x00000001-0x00000007) to full (0x80000008).

This bug ended up having no effect on us, because all of our
transactions in the client driver were synchronous and under a mutex.

Suggested-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Make it possible to use bcm2835-mailbox without Device Tree.
Load driver early because of lacking support for deferred probing
in many drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Lee Jones <lee@kernel.org> (previous version with pm-domains)
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
[Rebased on rpi-4.1.y]
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Support booting without Device Tree.
Turn on USB power.
Load driver early because of lacking support for deferred probing
in many drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add support for the bcm_mailbox_*() functions.
This is temporary until all drivers have been converted to the
firmware API (rpi_firmware_property*()).

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Add module for accessing the mailbox property channel through
/dev/vcio. Was previously in bcm2708-vcio.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO.
Add firmware node and change mailbox node in Device Tree.
Add/update platform file for firmware and mailbox.
Strip bcm2708-vcio of everything except the legacy API and hook it
up with the firmware driver.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
defconfig: enable BCM2835_MBOX, RASPBERRYPI_FIRMWARE and BCM_VCIO.

Add firmware node and change mailbox node in Device Tree.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
This reverts commit 081ebd4.

This driver is not necessary now that the firmware driver turns on
USB power.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
@notro
Copy link
Contributor Author

notro commented Jul 3, 2015

Rebased

@popcornmix
Copy link
Collaborator

From here: http://marklomas.net/ch-egg/native/native.htm

wget http://marklomas.net/ch-egg/downloads/ch-egg-port-sdl-source_v1_1.zip
unzip ch-egg-port-sdl-source_v1_1.zip 
cd ch-egg-port-sdl-source_v1.1/ch-egg/bbcb
gcc -Os -I/usr/include/SDL -c sound.c mode2font.c r6502main.c
ar cr libbbcb.a sound.o r6502main.o mode2font.o
cd ..
gcc -Os -I/usr/include/SDL -I../ execute.c library.c main.c -Lbbcb -lbbcb -lSDL -lm
mv a.out ../ch-egg.elf

(there is a build script but it seems a little broken).

@notro
Copy link
Contributor Author

notro commented Jul 5, 2015

I only get a blank display:

$ sudo rpi-update && sudo reboot

$ uname -a
Linux raspberrypi 4.0.7+ #801 PREEMPT Tue Jun 30 18:15:24 BST 2015 armv6l GNU/Linux

$ ./ch-egg-port-sdl-source_v1.1/ch-egg.elf

strace log: https://gist.githubusercontent.com/notro/fb0b2a960b6c83197edd/raw/gistfile1.txt

@popcornmix
Copy link
Collaborator

Yes, something is broken, I'll have a look...

popcornmix added a commit that referenced this pull request Jul 13, 2015
@popcornmix popcornmix merged commit 87f03d8 into raspberrypi:rpi-4.1.y Jul 13, 2015
HiassofT added a commit to HiassofT/OpenELEC.tv that referenced this pull request Jul 17, 2015
- add CONFIG_SND_SOC_WM8804_I2C=m

  see raspberrypi/linux@d478458

- enable mailbox and firmware drivers, disable power driver
  CONFIG_BCM_VCIO=y
  CONFIG_BCM2835_MBOX=y
  CONFIG_RASPBERRYPI_FIRMWARE=y
  remove CONFIG_BCM2708_POWER=y

  see raspberrypi/linux#1037
HiassofT added a commit to HiassofT/OpenELEC.tv that referenced this pull request Jul 18, 2015
- add CONFIG_SND_SOC_WM8804_I2C=m

  see raspberrypi/linux@d478458

- enable mailbox and firmware drivers, disable power driver
  CONFIG_BCM_VCIO=y
  CONFIG_BCM2835_MBOX=y
  CONFIG_RASPBERRYPI_FIRMWARE=y
  remove CONFIG_BCM2708_POWER=y

  see raspberrypi/linux#1037
@notro notro deleted the fw2 branch July 19, 2015 17:06
LongChair pushed a commit to plexinc/OpenELEC.tv that referenced this pull request Sep 28, 2015
LongChair pushed a commit to plexinc/OpenELEC.tv that referenced this pull request Dec 30, 2015
ziggimon pushed a commit to plexinc/OpenELEC.tv that referenced this pull request Mar 2, 2016
ncopa pushed a commit to ncopa/linux that referenced this pull request Sep 4, 2024
….c:367

[ Upstream commit 73cb4a2 ]

Use irq*_rcu() functions to fix this kernel warning:

 WARNING: CPU: 0 PID: 0 at kernel/context_tracking.c:367 ct_irq_enter+0xa0/0xd0
 Modules linked in:
 CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc3-64bit+ raspberrypi#1037
 Hardware name: 9000/785/C3700

 IASQ: 0000000000000000 0000000000000000 IAOQ: 00000000412cd758 00000000412cd75c
  IIR: 03ffe01f    ISR: 0000000000000000  IOR: 0000000043c20c20
  CPU:        0   CR30: 0000000041caa000 CR31: 0000000000000000
  ORIG_R28: 0000000000000005
  IAOQ[0]: ct_irq_enter+0xa0/0xd0
  IAOQ[1]: ct_irq_enter+0xa4/0xd0
  RP(r2): irq_enter+0x34/0x68
 Backtrace:
  [<000000004034a3ec>] irq_enter+0x34/0x68
  [<000000004030dc48>] do_cpu_irq_mask+0xc0/0x450
  [<0000000040303070>] intr_return+0x0/0xc

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants