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

bcm2708-vcio: Remove module #1087

Merged
merged 5 commits into from Jul 27, 2015

Conversation

Projects
None yet
3 participants
@notro
Contributor

notro commented Jul 24, 2015

All drivers have been converted to the new firmware API, so this module is not needed anymore.

notro added some commits Jul 24, 2015

Fix RASPBERRYPI_FIRMWARE dependents
If forgot this when converting the drivers.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
vc_mem: Remove unnecessary include
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
configs: Remove BCM2708_MBOX
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
bcm2708-vcio: Remove module
All drivers have been converted to the new firmware API, so this
module is not needed anymore.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Revert "firmware: bcm2835: Support legacy mailbox API"
This reverts commit 40aa3c4.

The legacy mailbox API has been removed so this is not needed.

Signed-off-by: Noralf Trønnes <noralf@tronnes.org>

popcornmix added a commit that referenced this pull request Jul 27, 2015

Merge pull request #1087 from notro/vcio-rm
bcm2708-vcio: Remove module

@popcornmix popcornmix merged commit 9f1d5c7 into raspberrypi:rpi-4.1.y Jul 27, 2015

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Jul 27, 2015

Collaborator

Thanks notro. Seems okay in testing and nice to drop downstream drivers.

Collaborator

popcornmix commented Jul 27, 2015

Thanks notro. Seems okay in testing and nice to drop downstream drivers.

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Jul 27, 2015

Collaborator

BTW we have an early rpi-4.2.y tree that seems functional.
I attempted cherry-picking your firmware PRs to 4.2, but as a number of the commits are upstream (and not identical to the downstream commits) and I'm getting quite a few conflicts.

If you fancied porting these commits to 4.2 I'd be happy to accept a PR.

Collaborator

popcornmix commented Jul 27, 2015

BTW we have an early rpi-4.2.y tree that seems functional.
I attempted cherry-picking your firmware PRs to 4.2, but as a number of the commits are upstream (and not identical to the downstream commits) and I'm getting quite a few conflicts.

If you fancied porting these commits to 4.2 I'd be happy to accept a PR.

@notro notro deleted the notro:vcio-rm branch Jul 27, 2015

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

I can make a PR.

Contributor

notro commented Jul 27, 2015

I can make a PR.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

I can't get 4.2 to boot on Pi1 B+ (no fw patches). It hangs with the ACT led constantly lit.
Latest firmware.
Raspian: 2015-05-05-raspbian-wheezy

[   11.057226] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 67 files, 2523/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...

Full log: https://gist.github.com/notro/45e5c7b5ea908d58f1ba

Contributor

notro commented Jul 27, 2015

I can't get 4.2 to boot on Pi1 B+ (no fw patches). It hangs with the ACT led constantly lit.
Latest firmware.
Raspian: 2015-05-05-raspbian-wheezy

[   11.057226] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 67 files, 2523/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...

Full log: https://gist.github.com/notro/45e5c7b5ea908d58f1ba

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Jul 27, 2015

Collaborator

Have you tried with Pi2? I'm running it currently:
Linux raspberrypi 4.2.0-rc4-v7+ #1551 SMP PREEMPT Mon Jul 27 14:29:28 BST 2015 armv7l GNU/Linux
Now it does ring a bell that @pelwell mentioned it wasn't working on PI1, and I think he had a fix. Unfortunately he's off this week. I'll try and remember what it was...

Collaborator

popcornmix commented Jul 27, 2015

Have you tried with Pi2? I'm running it currently:
Linux raspberrypi 4.2.0-rc4-v7+ #1551 SMP PREEMPT Mon Jul 27 14:29:28 BST 2015 armv7l GNU/Linux
Now it does ring a bell that @pelwell mentioned it wasn't working on PI1, and I think he had a fix. Unfortunately he's off this week. I'll try and remember what it was...

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

I'm doing a build for Pi2 now.

Contributor

notro commented Jul 27, 2015

I'm doing a build for Pi2 now.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

I get the same behaviour on Pi2, hang with constantly lit ACT. I took out the SD card to see if I could force an error, but nothing happend.

[    0.000000] Linux version 4.2.0-rc4-v7+ (pi@raspi2) (gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) ) #1 SMP PREEMPT Mon Jul 27 20:36:59 CEST 2015
...
[    5.935110] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 76 files, 3961/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting up ALSA...done.
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[ ok ] Setting up console font and keymap...done.
[....] Setting sensors limitsNo sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
. ok
[ ok ] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.

Contributor

notro commented Jul 27, 2015

I get the same behaviour on Pi2, hang with constantly lit ACT. I took out the SD card to see if I could force an error, but nothing happend.

[    0.000000] Linux version 4.2.0-rc4-v7+ (pi@raspi2) (gcc version 4.8.3 20140106 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2014.01 - Linaro GCC 2013.11) ) #1 SMP PREEMPT Mon Jul 27 20:36:59 CEST 2015
...
[    5.935110] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 76 files, 3961/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting up ALSA...done.
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[ ok ] Setting up console font and keymap...done.
[....] Setting sensors limitsNo sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
No sensors found!
Make sure you loaded all the kernel drivers you need.
Try sensors-detect to find out which these are.
. ok
[ ok ] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Jul 27, 2015

Collaborator

I'm running an nfs boot. But sdcard seems usable (e.g. md5sum /boot).
If firmware (start.elf) latest? Any different with dtoverlay=sdhost?

Collaborator

popcornmix commented Jul 27, 2015

I'm running an nfs boot. But sdcard seems usable (e.g. md5sum /boot).
If firmware (start.elf) latest? Any different with dtoverlay=sdhost?

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

start.elf is latest: 24. july

This is with sdhost after 40-50 minutes, messages slowly drip in:

[    1.886655] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)

[    1.994983] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.997965] mmc0: new high speed SDHC card at address e624
[    1.998612] mmcblk0: mmc0:e624 SL08G 7.40 GiB
[    2.000004]  mmcblk0: p1 p2

[    5.324388] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/mmcblk0p2: clean, 93045/482384 files, 725568/1925120 blocks
done.
[    5.557016] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 67 files, 2525/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting up ALSA...done.
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[ ok ] Setting up console font and keymap...done.
[ ok ] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
Error opening '/dev/input/event*': No such file or directory
[ ok ] Network Interface Plugging Daemon...skip eth0...done.
[info] Initializing cgroups.
[....] Starting enhanced syslogd: rsyslogddhcpcd[1902]: version 6.7.1 starting
[warn] Kernel lacks cgroups or memory controller not available, not starting cgroups. ... (warning).
[  354.697429] EXT4-fs error (device mmcblk0p2): ext4_journal_check_start:56: Detected aborted journal
[  354.710132] EXT4-fs (mmcblk0p2): Remounting filesystem read-only

gzip: /var/log//dmesg.0.gz: Read-only file system
mv: cannot move `/var/log//dmesg.0.gz' to `/var/log//dmesg.1.gz': Read-only file system
touch: cannot touch `/var/log/dmesg.new': Read-only file system
chown: cannot access `/var/log/dmesg.new': No such file or directory
chmod: cannot access `/var/log/dmesg.new': No such file or directory
ln: cannot remove `/var/log//dmesg.0': Read-only file system
Error hardlinking /var/log/dmesg to /var/log//dmesg.0
/etc/init.d/bootlogs: 23: /etc/init.d/bootlogs: cannot create /var/log/dmesg: Read-only file system
chgrp: changing group of `/var/log/dmesg': Read-only file system
dhcpcd[1902]: all: IPv6 kernel autoconf disabled
dhcpcd[1902]: eth0: adding address fe80::c65b:118d:81dc:b45
dhcpcd[1902]: if_addaddress6: Operation not supported
Starting dphys-swapfile swapfile setup ...
dhcpcd[1902]: DUID 00:01:00:01:1c:dd:60:5f:b8:27:eb:6e:52:28
dhcpcd[1902]: eth0: IAID eb:6e:52:28
dhcpcd[1902]: timed out
dhcpcd[1902]: forked to background, child pid 2013
[ ok ady started.
want /var/swap=100MByte, checking existing[....] Starting NTP server: ntpd
[....] Starting system message bus: dbus[....] Starting periodic command scheduler: cron: keeping it
swapon: /var/swap: swapon failed: Read-only file system
done.
. ok
. ok

Here's a log with sdhost debug turned on: https://gist.github.com/notro/f6a40280e5a47a566644

Contributor

notro commented Jul 27, 2015

start.elf is latest: 24. july

This is with sdhost after 40-50 minutes, messages slowly drip in:

[    1.886655] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)

[    1.994983] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.997965] mmc0: new high speed SDHC card at address e624
[    1.998612] mmcblk0: mmc0:e624 SL08G 7.40 GiB
[    2.000004]  mmcblk0: p1 p2

[    5.324388] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[....] Checking root file system...fsck from util-linux 2.20.1
e2fsck 1.42.5 (29-Jul-2012)
/dev/mmcblk0p2: clean, 93045/482384 files, 725568/1925120 blocks
done.
[    5.557016] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[ ok ] Cleaning up temporary files... /tmp.
[info] Loading kernel module snd-bcm2835.
[ ok ] Activating lvm and md swap...done.
[....] Checking file systems...fsck from util-linux 2.20.1
dosfsck 3.0.13, 30 Jun 2012, FAT32, LFN
/dev/mmcblk0p1: 67 files, 2525/7161 clusters
done.
[ ok ] Mounting local filesystems...done.
[ ok ] Activating swapfile swap...done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting kernel variables ...done.
[....] Configuring network interfaces...wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
done.
[ ok ] Cleaning up temporary files....
[ ok ] Setting up ALSA...done.
[info] Setting console screen modes.
setterm: cannot (un)set powersave mode: Inappropriate ioctl for device
[info] Skipping font and keymap setup (handled by console-setup).
[ ok ] Setting up console font and keymap...done.
[ ok ] Setting up X socket directories... /tmp/.X11-unix /tmp/.ICE-unix.
INIT: Entering runlevel: 2
[info] Using makefile-style concurrent boot in runlevel 2.
Error opening '/dev/input/event*': No such file or directory
[ ok ] Network Interface Plugging Daemon...skip eth0...done.
[info] Initializing cgroups.
[....] Starting enhanced syslogd: rsyslogddhcpcd[1902]: version 6.7.1 starting
[warn] Kernel lacks cgroups or memory controller not available, not starting cgroups. ... (warning).
[  354.697429] EXT4-fs error (device mmcblk0p2): ext4_journal_check_start:56: Detected aborted journal
[  354.710132] EXT4-fs (mmcblk0p2): Remounting filesystem read-only

gzip: /var/log//dmesg.0.gz: Read-only file system
mv: cannot move `/var/log//dmesg.0.gz' to `/var/log//dmesg.1.gz': Read-only file system
touch: cannot touch `/var/log/dmesg.new': Read-only file system
chown: cannot access `/var/log/dmesg.new': No such file or directory
chmod: cannot access `/var/log/dmesg.new': No such file or directory
ln: cannot remove `/var/log//dmesg.0': Read-only file system
Error hardlinking /var/log/dmesg to /var/log//dmesg.0
/etc/init.d/bootlogs: 23: /etc/init.d/bootlogs: cannot create /var/log/dmesg: Read-only file system
chgrp: changing group of `/var/log/dmesg': Read-only file system
dhcpcd[1902]: all: IPv6 kernel autoconf disabled
dhcpcd[1902]: eth0: adding address fe80::c65b:118d:81dc:b45
dhcpcd[1902]: if_addaddress6: Operation not supported
Starting dphys-swapfile swapfile setup ...
dhcpcd[1902]: DUID 00:01:00:01:1c:dd:60:5f:b8:27:eb:6e:52:28
dhcpcd[1902]: eth0: IAID eb:6e:52:28
dhcpcd[1902]: timed out
dhcpcd[1902]: forked to background, child pid 2013
[ ok ady started.
want /var/swap=100MByte, checking existing[....] Starting NTP server: ntpd
[....] Starting system message bus: dbus[....] Starting periodic command scheduler: cron: keeping it
swapon: /var/swap: swapon failed: Read-only file system
done.
. ok
. ok

Here's a log with sdhost debug turned on: https://gist.github.com/notro/f6a40280e5a47a566644

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Jul 27, 2015

Collaborator

Are you using bcm2709_defconfig? Seem to be a few differences in kernel log. I have:

[    0.000000] On node 0 totalpages: 192512
[    0.000000] free_area_init_node: node 0, pgdat 8086b1c0, node_mem_map ae156000
[    0.000000]   Normal zone: 1692 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 192512 pages, LIFO batch:31

which you don't. And you have deadline scheduler (I have cfq).

http://paste.ubuntu.com/11950595/

Collaborator

popcornmix commented Jul 27, 2015

Are you using bcm2709_defconfig? Seem to be a few differences in kernel log. I have:

[    0.000000] On node 0 totalpages: 192512
[    0.000000] free_area_init_node: node 0, pgdat 8086b1c0, node_mem_map ae156000
[    0.000000]   Normal zone: 1692 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 192512 pages, LIFO batch:31

which you don't. And you have deadline scheduler (I have cfq).

http://paste.ubuntu.com/11950595/

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Jul 27, 2015

Contributor

I use bcm2709_defconfig.
The free_area_init_node message is a debug message, so when I turn on that, I also get the message.
elevator=deadline is set in Raspian cmdline.txt

Have you tried booting with rootfs on the SD card?

Contributor

notro commented Jul 27, 2015

I use bcm2709_defconfig.
The free_area_init_node message is a debug message, so when I turn on that, I also get the message.
elevator=deadline is set in Raspian cmdline.txt

Have you tried booting with rootfs on the SD card?

@notro

This comment has been minimized.

Show comment
Hide comment
@notro
Contributor

notro commented Jul 28, 2015

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 6, 2015

Contributor

Is 4.2 and rootfs on the sd card working now?

Contributor

notro commented Aug 6, 2015

Is 4.2 and rootfs on the sd card working now?

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Aug 7, 2015

Collaborator

I don't think so. I did test and observed the same hang you reported.
We have since updated to -rc5 which I haven't retested with sdcard, but I don't imagine that will fix it.
@pelwell is back off holiday on Monday, so we'll have a think about what might be going wrong then.

Collaborator

popcornmix commented Aug 7, 2015

I don't think so. I did test and observed the same hang you reported.
We have since updated to -rc5 which I haven't retested with sdcard, but I don't imagine that will fix it.
@pelwell is back off holiday on Monday, so we'll have a think about what might be going wrong then.

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Aug 10, 2015

Collaborator

@notro - @pelwell is back and we've had a look at booting from sdcard and it seems fine.
Not sure if one of -rc updates fixed it, or if I had finger trouble when testing (not updating the dtb files from the original raspbian image would have a similar failure mode).

Can you try again with latest rpi-4.2.y tree and make sure dtb files are from 4.2 kernel and report back if it's working?

Collaborator

popcornmix commented Aug 10, 2015

@notro - @pelwell is back and we've had a look at booting from sdcard and it seems fine.
Not sure if one of -rc updates fixed it, or if I had finger trouble when testing (not updating the dtb files from the original raspbian image would have a similar failure mode).

Can you try again with latest rpi-4.2.y tree and make sure dtb files are from 4.2 kernel and report back if it's working?

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 11, 2015

Contributor

It's working now. I did use the correct dtb files last time, my build script takes care of that for me. I'll get on with the PR now.

Contributor

notro commented Aug 11, 2015

It's working now. I did use the correct dtb files last time, my build script takes care of that for me. I'll get on with the PR now.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 12, 2015

Contributor

@pelwell When I realised that the bcm2835 DT patches hadn't been carried over from 4.1 to 4.2, I sat back and wondered if there could be an easier way to do this than to keep carrying those patches.

What do you think about this approach I just tried?

arch/arm/boot/dts/bcm2835-rpi-b-plus.dts

#include "bcm2708-rpi-b-plus.dts"

/ {
  compatible = "brcm,bcm2835";

  soc {
    ranges = <0x7e000000 0x20000000 0x02000000>;
    dma-ranges = <0x40000000 0x00000000 0x20000000>;

    timer@7e003000 {
      compatible = "brcm,bcm2835-system-timer";
      reg = <0x7e003000 0x1000>;
      interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
      clock-frequency = <1000000>;
    };
  };
};

&intc {
  compatible = "brcm,bcm2835-armctrl-ic";
};

The same would have to be done for bcm2835-rpi-b.dts also and they will be identical except for the include.
Not sure if there's any point in putting this in a common file that both would include?

The ranges property (length value) differs between bcm2835.dtsi and bcm2708.dtsi and looking it up I see it's because of a change you made: 8bbf5ee

This is a good illustration of how close we have come to mainline.

Contributor

notro commented Aug 12, 2015

@pelwell When I realised that the bcm2835 DT patches hadn't been carried over from 4.1 to 4.2, I sat back and wondered if there could be an easier way to do this than to keep carrying those patches.

What do you think about this approach I just tried?

arch/arm/boot/dts/bcm2835-rpi-b-plus.dts

#include "bcm2708-rpi-b-plus.dts"

/ {
  compatible = "brcm,bcm2835";

  soc {
    ranges = <0x7e000000 0x20000000 0x02000000>;
    dma-ranges = <0x40000000 0x00000000 0x20000000>;

    timer@7e003000 {
      compatible = "brcm,bcm2835-system-timer";
      reg = <0x7e003000 0x1000>;
      interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
      clock-frequency = <1000000>;
    };
  };
};

&intc {
  compatible = "brcm,bcm2835-armctrl-ic";
};

The same would have to be done for bcm2835-rpi-b.dts also and they will be identical except for the include.
Not sure if there's any point in putting this in a common file that both would include?

The ranges property (length value) differs between bcm2835.dtsi and bcm2708.dtsi and looking it up I see it's because of a change you made: 8bbf5ee

This is a good illustration of how close we have come to mainline.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 12, 2015

Contributor

We could also add the timer node to bcm2708_common.dtsi to simplify it further.

And maybe we can build drivers/clocksource/bcm2835_timer.c on BCM270x and make this change (untested):

 static void __init bcm2708_timer_init(void)
 {
+   if (use_dt) {
+       of_clk_init(NULL);
+       clocksource_of_init();
+       return;
+   }
+
    /* init high res timer */
    bcm2708_clocksource_init();

Ref: http://lxr.free-electrons.com/source/arch/arm/kernel/time.c#L115

Contributor

notro commented Aug 12, 2015

We could also add the timer node to bcm2708_common.dtsi to simplify it further.

And maybe we can build drivers/clocksource/bcm2835_timer.c on BCM270x and make this change (untested):

 static void __init bcm2708_timer_init(void)
 {
+   if (use_dt) {
+       of_clk_init(NULL);
+       clocksource_of_init();
+       return;
+   }
+
    /* init high res timer */
    bcm2708_clocksource_init();

Ref: http://lxr.free-electrons.com/source/arch/arm/kernel/time.c#L115

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 12, 2015

Contributor

And I guess we should be able to use brcm,bcm2835-armctrl-ic on BCM270x also, now that it has fiq support: c1a5966

Contributor

notro commented Aug 12, 2015

And I guess we should be able to use brcm,bcm2835-armctrl-ic on BCM270x also, now that it has fiq support: c1a5966

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 13, 2015

Contributor

Ok, I see that bcm2709.dtsi already has a timer node, so the node would go in bcm2708.dtsi.

Contributor

notro commented Aug 13, 2015

Ok, I see that bcm2709.dtsi already has a timer node, so the node would go in bcm2708.dtsi.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 13, 2015

Contributor

The bcm2835 ranges property is wrong - only the video codec block is in the 0x7fxxxxxx bank, and that is driven from the VPU. If you look at bcm2709.dtsi you'll see that we map the range to 0x3f000000, which doesn't leave room for the upper 16MB.

I think we can safely add the dma-ranges property to bcm2708.dtsi and bcm2709.dtsi (which uses 0xc0000000 0x00000000 0x3f000000 instead). I'm now trying to switch to the upstream interrupt controller.

Contributor

pelwell commented Aug 13, 2015

The bcm2835 ranges property is wrong - only the video codec block is in the 0x7fxxxxxx bank, and that is driven from the VPU. If you look at bcm2709.dtsi you'll see that we map the range to 0x3f000000, which doesn't leave room for the upper 16MB.

I think we can safely add the dma-ranges property to bcm2708.dtsi and bcm2709.dtsi (which uses 0xc0000000 0x00000000 0x3f000000 instead). I'm now trying to switch to the upstream interrupt controller.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 13, 2015

Contributor

I haven't managed to make it boot with the intc change - something is currently causing it to hang after:

bcm2835-mbox 3f00b880.mailbox: mailbox enabled

But I think the following patch (dma-ranges + your timer patches + one cosmetic change) is worth applying to narrow the gap still further:

diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi
index 0d47427..7cc5a6d 100644
--- a/arch/arm/boot/dts/bcm2708.dtsi
+++ b/arch/arm/boot/dts/bcm2708.dtsi
@@ -11,6 +11,14 @@

        soc {
                ranges = <0x7e000000 0x20000000 0x01000000>;
+               dma-ranges = <0x40000000 0x00000000 0x20000000>;
+
+               timer: timer@7e003000 {
+                       compatible = "brcm,bcm2835-system-timer";
+                       reg = <0x7e003000 0x1000>;
+                       interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
+                       clock-frequency = <1000000>;
+               };

                arm-pmu {
                        compatible = "arm,arm1176-pmu";
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
index d1c3bdf..4077eae 100644
--- a/arch/arm/boot/dts/bcm2708_common.dtsi
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi
@@ -66,7 +66,7 @@
                        brcm,dma-channel-mask = <0x7f35>;
                };

-               intc: interrupt-controller {
+               intc: interrupt-controller@7e00b200 {
                        compatible = "brcm,bcm2708-armctrl-ic";
                        reg = <0x7e00b200 0x200>;
                        interrupt-controller;
diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi
index 5e0b935..1b5efa1 100644
--- a/arch/arm/boot/dts/bcm2709.dtsi
+++ b/arch/arm/boot/dts/bcm2709.dtsi
@@ -11,6 +11,7 @@

        soc {
                ranges = <0x7e000000 0x3f000000 0x01000000>;
+               dma-ranges = <0xc0000000 0x00000000 0x3f000000>;

                arm-pmu {
                        compatible = "arm,cortex-a7-pmu";
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 1b9c3be..f7f357c 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -1054,6 +1054,12 @@ static struct delay_timer bcm2708_delay_timer = {

 static void __init bcm2708_timer_init(void)
 {
+       if (use_dt) {
+           of_clk_init(NULL);
+           clocksource_of_init();
+           return;
+       }
+
        /* init high res timer */
        bcm2708_clocksource_init();

Contributor

pelwell commented Aug 13, 2015

I haven't managed to make it boot with the intc change - something is currently causing it to hang after:

bcm2835-mbox 3f00b880.mailbox: mailbox enabled

But I think the following patch (dma-ranges + your timer patches + one cosmetic change) is worth applying to narrow the gap still further:

diff --git a/arch/arm/boot/dts/bcm2708.dtsi b/arch/arm/boot/dts/bcm2708.dtsi
index 0d47427..7cc5a6d 100644
--- a/arch/arm/boot/dts/bcm2708.dtsi
+++ b/arch/arm/boot/dts/bcm2708.dtsi
@@ -11,6 +11,14 @@

        soc {
                ranges = <0x7e000000 0x20000000 0x01000000>;
+               dma-ranges = <0x40000000 0x00000000 0x20000000>;
+
+               timer: timer@7e003000 {
+                       compatible = "brcm,bcm2835-system-timer";
+                       reg = <0x7e003000 0x1000>;
+                       interrupts = <1 0>, <1 1>, <1 2>, <1 3>;
+                       clock-frequency = <1000000>;
+               };

                arm-pmu {
                        compatible = "arm,arm1176-pmu";
diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
index d1c3bdf..4077eae 100644
--- a/arch/arm/boot/dts/bcm2708_common.dtsi
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi
@@ -66,7 +66,7 @@
                        brcm,dma-channel-mask = <0x7f35>;
                };

-               intc: interrupt-controller {
+               intc: interrupt-controller@7e00b200 {
                        compatible = "brcm,bcm2708-armctrl-ic";
                        reg = <0x7e00b200 0x200>;
                        interrupt-controller;
diff --git a/arch/arm/boot/dts/bcm2709.dtsi b/arch/arm/boot/dts/bcm2709.dtsi
index 5e0b935..1b5efa1 100644
--- a/arch/arm/boot/dts/bcm2709.dtsi
+++ b/arch/arm/boot/dts/bcm2709.dtsi
@@ -11,6 +11,7 @@

        soc {
                ranges = <0x7e000000 0x3f000000 0x01000000>;
+               dma-ranges = <0xc0000000 0x00000000 0x3f000000>;

                arm-pmu {
                        compatible = "arm,cortex-a7-pmu";
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 1b9c3be..f7f357c 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -1054,6 +1054,12 @@ static struct delay_timer bcm2708_delay_timer = {

 static void __init bcm2708_timer_init(void)
 {
+       if (use_dt) {
+           of_clk_init(NULL);
+           clocksource_of_init();
+           return;
+       }
+
        /* init high res timer */
        bcm2708_clocksource_init();

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 13, 2015

Contributor

I have given up on irq-bcm2835 as well when I discovered that msleep() didn't return.

Boot log: https://gist.github.com/notro/ad87b68170f701d54c50
Diff: https://gist.github.com/notro/445656c7c0321a6f2c7c

Adding initcall_debug ignore_loglevel to the kernel command line gives initcall info which aids in detecting where it stops.

Contributor

notro commented Aug 13, 2015

I have given up on irq-bcm2835 as well when I discovered that msleep() didn't return.

Boot log: https://gist.github.com/notro/ad87b68170f701d54c50
Diff: https://gist.github.com/notro/445656c7c0321a6f2c7c

Adding initcall_debug ignore_loglevel to the kernel command line gives initcall info which aids in detecting where it stops.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 14, 2015

Contributor

While watching TV it suddenly hit me that msleep uses timers/scheduling and I didn't have the timer patch applied. With that patch it did work.
But we can't have armctrl and irq-bcm2835 in the same build because MULTI_IRQ_HANDLER affects arch/arm/kernel/entry-armv.S. Which would mean a big change to make it work without Device Tree, so I don't think it's worth it.
Unless irq-bcm2835 can be made to work without MULTI_IRQ_HANDLER.

Contributor

notro commented Aug 14, 2015

While watching TV it suddenly hit me that msleep uses timers/scheduling and I didn't have the timer patch applied. With that patch it did work.
But we can't have armctrl and irq-bcm2835 in the same build because MULTI_IRQ_HANDLER affects arch/arm/kernel/entry-armv.S. Which would mean a big change to make it work without Device Tree, so I don't think it's worth it.
Unless irq-bcm2835 can be made to work without MULTI_IRQ_HANDLER.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 14, 2015

Contributor

Using irq-bcm2835 without MULTI_IRQ_HANDLER would require a big rewrite of the driver which would defeat the purpose.

We could do it the other way around, and that is to make armctrl work with MULTI_IRQ_HANDLER (for booting without Device Tree).
This would require turning the macro get_irqnr_and_base from arch/arm/mach-bcm2708/include/mach/entry-macro.S into C code.
ARM assembly is out of my league I'm afraid.

Maybe something like this could work:

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5105175..eb4e7de 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -328,6 +330,8 @@ config ARCH_BCM2708
        select GENERIC_CLOCKEVENTS
        select ARM_ERRATA_411920
        select MACH_BCM2708
+       select MULTI_IRQ_HANDLER
        select VC4
        select FIQ
        help
diff --git a/arch/arm/mach-bcm2708/armctrl.c b/arch/arm/mach-bcm2708/armctrl.c
index 0429225..82e3f38 100644
--- a/arch/arm/mach-bcm2708/armctrl.c
+++ b/arch/arm/mach-bcm2708/armctrl.c
@@ -285,6 +285,15 @@ static struct irq_chip armctrl_chip = {
        .irq_set_wake = armctrl_set_wake,
 };

+static void __exception_irq_entry armctrl_handle_irq(struct pt_regs *regs)
+{
+       u32 irq;
+
+       /* get irq the way get_irqnr_and_base does */
+
+       handle_IRQ(irq, regs);
+}
+
 /**
  * armctrl_init - initialise a vectored interrupt controller
  * @base: iomem base address
@@ -308,6 +317,7 @@ int __init armctrl_init(void __iomem * base, unsigned int irq_start,
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }

+       set_handle_irq(armctrl_handle_irq);
        armctrl_pm_register(base, irq_start, resume_sources);
        init_FIQ(FIQ_START);
        armctrl_dt_init();
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 937c2d3..d02e5b7 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -43,6 +44,7 @@
 #include <linux/clkdev.h>
 #include <asm/system_info.h>
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <asm/irq.h>
 #include <linux/leds.h>
 #include <asm/mach-types.h>

For the curious reader, here's the assembler part of the interrupt code path (CONFIG_MULTI_IRQ_HANDLER is currently not defined):

arch/arm/kernel/entry-armv.S

/*
 * Interrupt handling.
 */
        .macro  irq_handler
#ifdef CONFIG_MULTI_IRQ_HANDLER
        ldr     r1, =handle_arch_irq
        mov     r0, sp
        adr     lr, BSYM(9997f)
        ldr     pc, [r1]
#else
        arch_irq_handler_default
#endif
9997:
        .endm

arch/arm/include/asm/entry-macro-multi.S (removed SMP part)

/*
 * Interrupt handling.  Preserves r7, r8, r9
 */
        .macro  arch_irq_handler_default
        get_irqnr_preamble r6, lr
1:      get_irqnr_and_base r0, r2, r6, lr
        movne   r1, sp
        @
        @ routine called with r0 = irq number, r1 = struct pt_regs *
        @
        adrne   lr, BSYM(1b)
        bne     asm_do_IRQ
9997:
        .endm

arch/arm/mach-bcm2708/include/mach/entry-macro.S

    .macro  get_irqnr_preamble, base, tmp
    ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
    .endm

    .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
    /* get masked status */
    ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
    mov \irqnr, #(ARM_IRQ0_BASE + 31)
    and \tmp, \irqstat, #0x300     @ save bits 8 and 9
    /* clear bits 8 and 9, and test */
    bics  \irqstat, \irqstat, #0x300
    bne 1010f

    tst \tmp, #0x100
    ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
    movne \irqnr, #(ARM_IRQ1_BASE + 31)
    @ Mask out the interrupts also present in PEND0 - see SW-5809
    bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
    bicne \irqstat, #((1<<18) | (1<<19))
    bne 1010f

    tst \tmp, #0x200
    ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
    movne \irqnr, #(ARM_IRQ2_BASE + 31)
    @ Mask out the interrupts also present in PEND0 - see SW-5809
    bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
    bicne \irqstat, #((1<<30))
    beq 1020f

1010:
    @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
    @ N.B. CLZ is an ARM5 instruction.
    sub \tmp, \irqstat, #1
    eor \irqstat, \irqstat, \tmp
    clz \tmp, \irqstat
    sub \irqnr, \tmp

1020: @ EQ will be set if no irqs pending

    .endm

arch/arm/kernel/irq.c

/*
 * asm_do_IRQ is the interface to be used from assembly code.
 */
asmlinkage void __exception_irq_entry
asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
{
        handle_IRQ(irq, regs);
}
Contributor

notro commented Aug 14, 2015

Using irq-bcm2835 without MULTI_IRQ_HANDLER would require a big rewrite of the driver which would defeat the purpose.

We could do it the other way around, and that is to make armctrl work with MULTI_IRQ_HANDLER (for booting without Device Tree).
This would require turning the macro get_irqnr_and_base from arch/arm/mach-bcm2708/include/mach/entry-macro.S into C code.
ARM assembly is out of my league I'm afraid.

Maybe something like this could work:

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5105175..eb4e7de 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -328,6 +330,8 @@ config ARCH_BCM2708
        select GENERIC_CLOCKEVENTS
        select ARM_ERRATA_411920
        select MACH_BCM2708
+       select MULTI_IRQ_HANDLER
        select VC4
        select FIQ
        help
diff --git a/arch/arm/mach-bcm2708/armctrl.c b/arch/arm/mach-bcm2708/armctrl.c
index 0429225..82e3f38 100644
--- a/arch/arm/mach-bcm2708/armctrl.c
+++ b/arch/arm/mach-bcm2708/armctrl.c
@@ -285,6 +285,15 @@ static struct irq_chip armctrl_chip = {
        .irq_set_wake = armctrl_set_wake,
 };

+static void __exception_irq_entry armctrl_handle_irq(struct pt_regs *regs)
+{
+       u32 irq;
+
+       /* get irq the way get_irqnr_and_base does */
+
+       handle_IRQ(irq, regs);
+}
+
 /**
  * armctrl_init - initialise a vectored interrupt controller
  * @base: iomem base address
@@ -308,6 +317,7 @@ int __init armctrl_init(void __iomem * base, unsigned int irq_start,
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }

+       set_handle_irq(armctrl_handle_irq);
        armctrl_pm_register(base, irq_start, resume_sources);
        init_FIQ(FIQ_START);
        armctrl_dt_init();
diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 937c2d3..d02e5b7 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -43,6 +44,7 @@
 #include <linux/clkdev.h>
 #include <asm/system_info.h>
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <asm/irq.h>
 #include <linux/leds.h>
 #include <asm/mach-types.h>

For the curious reader, here's the assembler part of the interrupt code path (CONFIG_MULTI_IRQ_HANDLER is currently not defined):

arch/arm/kernel/entry-armv.S

/*
 * Interrupt handling.
 */
        .macro  irq_handler
#ifdef CONFIG_MULTI_IRQ_HANDLER
        ldr     r1, =handle_arch_irq
        mov     r0, sp
        adr     lr, BSYM(9997f)
        ldr     pc, [r1]
#else
        arch_irq_handler_default
#endif
9997:
        .endm

arch/arm/include/asm/entry-macro-multi.S (removed SMP part)

/*
 * Interrupt handling.  Preserves r7, r8, r9
 */
        .macro  arch_irq_handler_default
        get_irqnr_preamble r6, lr
1:      get_irqnr_and_base r0, r2, r6, lr
        movne   r1, sp
        @
        @ routine called with r0 = irq number, r1 = struct pt_regs *
        @
        adrne   lr, BSYM(1b)
        bne     asm_do_IRQ
9997:
        .endm

arch/arm/mach-bcm2708/include/mach/entry-macro.S

    .macro  get_irqnr_preamble, base, tmp
    ldr \base, =IO_ADDRESS(ARMCTRL_IC_BASE)
    .endm

    .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
    /* get masked status */
    ldr \irqstat, [\base, #(ARM_IRQ_PEND0 - ARMCTRL_IC_BASE)]
    mov \irqnr, #(ARM_IRQ0_BASE + 31)
    and \tmp, \irqstat, #0x300     @ save bits 8 and 9
    /* clear bits 8 and 9, and test */
    bics  \irqstat, \irqstat, #0x300
    bne 1010f

    tst \tmp, #0x100
    ldrne \irqstat, [\base, #(ARM_IRQ_PEND1 - ARMCTRL_IC_BASE)]
    movne \irqnr, #(ARM_IRQ1_BASE + 31)
    @ Mask out the interrupts also present in PEND0 - see SW-5809
    bicne \irqstat, #((1<<7) | (1<<9) | (1<<10))
    bicne \irqstat, #((1<<18) | (1<<19))
    bne 1010f

    tst \tmp, #0x200
    ldrne \irqstat, [\base, #(ARM_IRQ_PEND2 - ARMCTRL_IC_BASE)]
    movne \irqnr, #(ARM_IRQ2_BASE + 31)
    @ Mask out the interrupts also present in PEND0 - see SW-5809
    bicne \irqstat, #((1<<21) | (1<<22) | (1<<23) | (1<<24) | (1<<25))
    bicne \irqstat, #((1<<30))
    beq 1020f

1010:
    @ For non-zero x, LSB(x) = 31 - CLZ(x^(x-1))
    @ N.B. CLZ is an ARM5 instruction.
    sub \tmp, \irqstat, #1
    eor \irqstat, \irqstat, \tmp
    clz \tmp, \irqstat
    sub \irqnr, \tmp

1020: @ EQ will be set if no irqs pending

    .endm

arch/arm/kernel/irq.c

/*
 * asm_do_IRQ is the interface to be used from assembly code.
 */
asmlinkage void __exception_irq_entry
asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
{
        handle_IRQ(irq, regs);
}
@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Aug 14, 2015

Collaborator

We have said that non-device tree support can be dropped when there is a good reason to. I'm not against dropping it for 4.2 if we believe everything works with DT and it avoids creating extra work supporting non-DT. @pelwell ?

Collaborator

popcornmix commented Aug 14, 2015

We have said that non-device tree support can be dropped when there is a good reason to. I'm not against dropping it for 4.2 if we believe everything works with DT and it avoids creating extra work supporting non-DT. @pelwell ?

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 14, 2015

Contributor

We are going to have to do it eventually, so let's try for 4.2. We should probably be prepared to maintain 4.1 as a refuge for the DT-refuseniks.

Contributor

pelwell commented Aug 14, 2015

We are going to have to do it eventually, so let's try for 4.2. We should probably be prepared to maintain 4.1 as a refuge for the DT-refuseniks.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 14, 2015

Contributor

@notro I wrote that assembly language a very long time ago. It was tricky to get right because of some design decisions in the hardware, but it would be easy to translate should we need to.

Contributor

pelwell commented Aug 14, 2015

@notro I wrote that assembly language a very long time ago. It was tricky to get right because of some design decisions in the hardware, but it would be easy to translate should we need to.

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 14, 2015

Contributor

If so, should we move straight to ARCH_BCM2835 instead of spending more time on ARCH_BCM2708?
Because when we move to the mainline irqchip driver, the only difference between them is the board/platform file being used.

Contributor

notro commented Aug 14, 2015

If so, should we move straight to ARCH_BCM2835 instead of spending more time on ARCH_BCM2708?
Because when we move to the mainline irqchip driver, the only difference between them is the board/platform file being used.

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Aug 14, 2015

Collaborator

I guess the question with each change is "what does it break?"
If we can use ARCH_BCM2835 and not break anything, then sure.

Collaborator

popcornmix commented Aug 14, 2015

I guess the question with each change is "what does it break?"
If we can use ARCH_BCM2835 and not break anything, then sure.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 14, 2015

Contributor

Aside from Pi 2, you mean?

Contributor

pelwell commented Aug 14, 2015

Aside from Pi 2, you mean?

@notro

This comment has been minimized.

Show comment
Hide comment
@notro

notro Aug 14, 2015

Contributor

ARCH_BCM2709 still have to use the armctrl driver. Eric Anholt is ARCH_BCM2835 maintainer now, so hopefully there will be Pi 2 support in mainline "soon". He has posted a Pi 2 irqchip driver.

There is one piece missing with ARCH_BCM2835 and that's the lirc_rpi driver which doesn't compile (bcm2708_gpio_setpull). An ifndef could take care of that.
Apart from that I don't know of anything missing (4.2 doesn't have all the patches from 4.1 yet).

I can make a PR to bring ARCH_BCM2835 up to speed on 4.2 and we can use that as a basis for further discussion and testing.

Contributor

notro commented Aug 14, 2015

ARCH_BCM2709 still have to use the armctrl driver. Eric Anholt is ARCH_BCM2835 maintainer now, so hopefully there will be Pi 2 support in mainline "soon". He has posted a Pi 2 irqchip driver.

There is one piece missing with ARCH_BCM2835 and that's the lirc_rpi driver which doesn't compile (bcm2708_gpio_setpull). An ifndef could take care of that.
Apart from that I don't know of anything missing (4.2 doesn't have all the patches from 4.1 yet).

I can make a PR to bring ARCH_BCM2835 up to speed on 4.2 and we can use that as a basis for further discussion and testing.

@popcornmix

This comment has been minimized.

Show comment
Hide comment
@popcornmix

popcornmix Aug 14, 2015

Collaborator

There is 2836 stuff from Eric (http://linux-rpi-kernel.infradead.narkive.com/wkGrwc08/bcm2836-raspberry-pi-2-port) that I assume will appear upstream at some point.

Collaborator

popcornmix commented Aug 14, 2015

There is 2836 stuff from Eric (http://linux-rpi-kernel.infradead.narkive.com/wkGrwc08/bcm2836-raspberry-pi-2-port) that I assume will appear upstream at some point.

@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 14, 2015

Contributor

Here's my attempt at that function, but I'm not getting any kernel output yet:

diff --git a/arch/arm/mach-bcm2708/armctrl.c b/arch/arm/mach-bcm2708/armctrl.c
index 0429225..480baaa 100644
--- a/arch/arm/mach-bcm2708/armctrl.c
+++ b/arch/arm/mach-bcm2708/armctrl.c
@@ -26,10 +26,19 @@
 #include <linux/irqdomain.h>
 #include <linux/of.h>

+#include <asm/exception.h>
 #include <asm/mach/irq.h>
 #include <mach/hardware.h>
 #include "armctrl.h"

+/* Mask out shortcut interrupts where they also appear in the regular bank */
+#define BANK0_HWIRQ    0x001ffcff
+#define BANK1_HWIRQ    BIT(8)
+#define BANK2_HWIRQ    BIT(9)
+#define BANK0_VALID_MASK       (BANK0_HWIRQ + BANK1_HWIRQ + BANK2_HWIRQ)
+#define BANK1_VALID_MASK       (~(BIT(7) | BIT(9) | BIT(10) | BIT(18) | BIT(19)))
+#define BANK2_VALID_MASK       (~(BIT(21) | BIT(22) | BIT(23) | BIT(24) | BIT(25) | BIT(30)))
+
 /* For support of kernels >= 3.0 assume only one VIC for now*/
 static unsigned int remap_irqs[(INTERRUPT_ARASANSDIO + 1) - INTERRUPT_JPEG] = {
        INTERRUPT_VC_JPEG,
@@ -285,6 +294,42 @@ static struct irq_chip armctrl_chip = {
        .irq_set_wake = armctrl_set_wake,
 };

+#ifdef CONFIG_MULTI_IRQ_HANDLER
+
+static void __exception_irq_entry armctrl_handle_irq(
+       struct pt_regs *regs)
+{
+       u32 stat;
+
+       while ((stat = readl_relaxed(__io_address(ARM_IRQ_PEND0)) &
+               BANK0_VALID_MASK)) {
+               u32 stat2;
+               u32 irq;
+               if (stat & BANK0_HWIRQ) {
+                       irq = ARM_IRQ0_BASE + ffs(stat & BANK0_HWIRQ);
+               } else if ((stat & BANK1_HWIRQ) &&
+                          ((stat2 = readl_relaxed(__io_address(ARM_IRQ_PEND1)) &
+                            BANK1_VALID_MASK))) {
+                       irq = ARM_IRQ1_BASE + ffs(stat2 & BANK1_VALID_MASK);
+               } else if ((stat & BANK2_HWIRQ) &&
+                          ((stat2 = readl_relaxed(__io_address(ARM_IRQ_PEND2)) &
+                            BANK2_VALID_MASK))) {
+                       irq = ARM_IRQ2_BASE + ffs(stat2 & BANK2_VALID_MASK);
+               } else {
+                       /* Arrival here indicates that a shortcut IRQ arrived
+                          after the initial BANK0 read. The best way to handle
+                          this very rare occurence is to go round the loop
+                          again so it is handled as normal.
+                       */
+                       continue;
+               }
+
+               handle_IRQ(irq, regs);
+       }
+}
+
+#endif
+
 /**
  * armctrl_init - initialise a vectored interrupt controller
  * @base: iomem base address
@@ -308,6 +353,9 @@ int __init armctrl_init(void __iomem * base, unsigned int irq_start,
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }

+#ifdef CONFIG_MULTI_IRQ_HANDLER
+       set_handle_irq(armctrl_handle_irq);
+#endif
        armctrl_pm_register(base, irq_start, resume_sources);
        init_FIQ(FIQ_START);
        armctrl_dt_init();
Contributor

pelwell commented Aug 14, 2015

Here's my attempt at that function, but I'm not getting any kernel output yet:

diff --git a/arch/arm/mach-bcm2708/armctrl.c b/arch/arm/mach-bcm2708/armctrl.c
index 0429225..480baaa 100644
--- a/arch/arm/mach-bcm2708/armctrl.c
+++ b/arch/arm/mach-bcm2708/armctrl.c
@@ -26,10 +26,19 @@
 #include <linux/irqdomain.h>
 #include <linux/of.h>

+#include <asm/exception.h>
 #include <asm/mach/irq.h>
 #include <mach/hardware.h>
 #include "armctrl.h"

+/* Mask out shortcut interrupts where they also appear in the regular bank */
+#define BANK0_HWIRQ    0x001ffcff
+#define BANK1_HWIRQ    BIT(8)
+#define BANK2_HWIRQ    BIT(9)
+#define BANK0_VALID_MASK       (BANK0_HWIRQ + BANK1_HWIRQ + BANK2_HWIRQ)
+#define BANK1_VALID_MASK       (~(BIT(7) | BIT(9) | BIT(10) | BIT(18) | BIT(19)))
+#define BANK2_VALID_MASK       (~(BIT(21) | BIT(22) | BIT(23) | BIT(24) | BIT(25) | BIT(30)))
+
 /* For support of kernels >= 3.0 assume only one VIC for now*/
 static unsigned int remap_irqs[(INTERRUPT_ARASANSDIO + 1) - INTERRUPT_JPEG] = {
        INTERRUPT_VC_JPEG,
@@ -285,6 +294,42 @@ static struct irq_chip armctrl_chip = {
        .irq_set_wake = armctrl_set_wake,
 };

+#ifdef CONFIG_MULTI_IRQ_HANDLER
+
+static void __exception_irq_entry armctrl_handle_irq(
+       struct pt_regs *regs)
+{
+       u32 stat;
+
+       while ((stat = readl_relaxed(__io_address(ARM_IRQ_PEND0)) &
+               BANK0_VALID_MASK)) {
+               u32 stat2;
+               u32 irq;
+               if (stat & BANK0_HWIRQ) {
+                       irq = ARM_IRQ0_BASE + ffs(stat & BANK0_HWIRQ);
+               } else if ((stat & BANK1_HWIRQ) &&
+                          ((stat2 = readl_relaxed(__io_address(ARM_IRQ_PEND1)) &
+                            BANK1_VALID_MASK))) {
+                       irq = ARM_IRQ1_BASE + ffs(stat2 & BANK1_VALID_MASK);
+               } else if ((stat & BANK2_HWIRQ) &&
+                          ((stat2 = readl_relaxed(__io_address(ARM_IRQ_PEND2)) &
+                            BANK2_VALID_MASK))) {
+                       irq = ARM_IRQ2_BASE + ffs(stat2 & BANK2_VALID_MASK);
+               } else {
+                       /* Arrival here indicates that a shortcut IRQ arrived
+                          after the initial BANK0 read. The best way to handle
+                          this very rare occurence is to go round the loop
+                          again so it is handled as normal.
+                       */
+                       continue;
+               }
+
+               handle_IRQ(irq, regs);
+       }
+}
+
+#endif
+
 /**
  * armctrl_init - initialise a vectored interrupt controller
  * @base: iomem base address
@@ -308,6 +353,9 @@ int __init armctrl_init(void __iomem * base, unsigned int irq_start,
                set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
        }

+#ifdef CONFIG_MULTI_IRQ_HANDLER
+       set_handle_irq(armctrl_handle_irq);
+#endif
        armctrl_pm_register(base, irq_start, resume_sources);
        init_FIQ(FIQ_START);
        armctrl_dt_init();
@pelwell

This comment has been minimized.

Show comment
Hide comment
@pelwell

pelwell Aug 19, 2015

Contributor

This discussion continues in #1099, where I link to a patch that switches to the upstream interrupt controller driver for Pi 1.

Contributor

pelwell commented Aug 19, 2015

This discussion continues in #1099, where I link to a patch that switches to the upstream interrupt controller driver for Pi 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment