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

Conversation

Projects
None yet
4 participants
@notro
Copy link
Contributor

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 notro force-pushed the notro:fw2 branch from 1d00726 to 8ece6b5 Jun 30, 2015

@notro

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator

popcornmix commented Jun 30, 2015

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator

popcornmix commented Jul 1, 2015

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

@notro notro force-pushed the notro:fw2 branch 2 times, most recently from c80d54f to 9f70667 Jul 1, 2015

@notro

This comment has been minimized.

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 popcornmix force-pushed the raspberrypi:rpi-4.1.y branch from 1dc9403 to 18f4efa Jul 3, 2015

@popcornmix

This comment has been minimized.

Copy link
Collaborator

popcornmix commented Jul 3, 2015

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

lkundrak and others added some commits May 5, 2015

mailbox: Enable BCM2835 mailbox support
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>
mailbox/bcm2835: Fix mailbox full detection.
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>
mailbox: bcm2835: Support ARCH_BCM270x
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>
ARM: bcm2835: Add the firmware driver information to the RPi DT
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>
firmware: bcm2835: Add missing property tags
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
firmware: bcm2835: Support ARCH_BCM270x
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>
firmware: bcm2835: Support legacy mailbox API
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>
char: broadcom: Add vcio module
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>
BCM270x: Switch to firmware driver
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>
bcm2835: Switch to firmware driver
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>
Revert "power: Add power driver"
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 notro force-pushed the notro:fw2 branch from 9f70667 to d979963 Jul 3, 2015

@notro

This comment has been minimized.

Copy link
Contributor Author

notro commented Jul 3, 2015

Rebased

@popcornmix

This comment has been minimized.

Copy link
Collaborator

popcornmix commented Jul 5, 2015

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Collaborator

popcornmix commented Jul 5, 2015

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

projects/RPi*/linux: add new modules
- 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

projects/RPi*/linux: add new modules
- 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 notro:fw2 branch Jul 19, 2015

LongChair added a commit to plexinc/OpenELEC.tv that referenced this pull request Sep 28, 2015

LongChair added a commit to plexinc/OpenELEC.tv that referenced this pull request Dec 30, 2015

ziggimon added a commit to plexinc/OpenELEC.tv that referenced this pull request Mar 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.