Skip to content

Commit 4aa6eb8

Browse files
committed
Merge pull request #949 from notro/vcio
Make vcio (mailbox) driver available on ARCH_BCM2835
2 parents 0934bbe + 3018d8a commit 4aa6eb8

File tree

27 files changed

+251
-952
lines changed

27 files changed

+251
-952
lines changed

arch/arm/boot/dts/bcm2708_common.dtsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
#interrupt-cells = <2>;
3737
};
3838

39+
mailbox: mailbox@7e00b800 {
40+
compatible = "brcm,bcm2708-vcio";
41+
reg = <0x7e00b880 0x40>;
42+
interrupts = <0 1>;
43+
};
44+
3945
gpio: gpio {
4046
compatible = "brcm,bcm2835-gpio";
4147
reg = <0x7e200000 0xb4>;

arch/arm/boot/dts/bcm2835.dtsi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@
6060
reg = <0x7e104000 0x10>;
6161
};
6262

63+
mailbox: mailbox@7e00b800 {
64+
compatible = "brcm,bcm2708-vcio";
65+
reg = <0x7e00b880 0x40>;
66+
interrupts = <0 1>;
67+
};
68+
6369
gpio: gpio@7e200000 {
6470
compatible = "brcm,bcm2835-gpio";
6571
reg = <0x7e200000 0xb4>;

arch/arm/configs/bcm2709_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,8 @@ CONFIG_FB_TFT_UPD161704=m
10521052
CONFIG_FB_TFT_WATTEROTT=m
10531053
CONFIG_FB_FLEX=m
10541054
CONFIG_FB_TFT_FBTFT_DEVICE=m
1055+
CONFIG_MAILBOX=y
1056+
CONFIG_BCM2708_MBOX=y
10551057
# CONFIG_IOMMU_SUPPORT is not set
10561058
CONFIG_EXTCON=m
10571059
CONFIG_EXTCON_ARIZONA=m

arch/arm/configs/bcm2835_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ CONFIG_LEDS_TRIGGER_CAMERA=y
9999
CONFIG_DMADEVICES=y
100100
CONFIG_DMA_BCM2708=y
101101
CONFIG_STAGING=y
102+
CONFIG_MAILBOX=y
103+
CONFIG_BCM2708_MBOX=y
102104
# CONFIG_IOMMU_SUPPORT is not set
103105
CONFIG_EXT2_FS=y
104106
CONFIG_EXT2_FS_XATTR=y

arch/arm/configs/bcmrpi_defconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,8 @@ CONFIG_FB_TFT_UPD161704=m
10451045
CONFIG_FB_TFT_WATTEROTT=m
10461046
CONFIG_FB_FLEX=m
10471047
CONFIG_FB_TFT_FBTFT_DEVICE=m
1048+
CONFIG_MAILBOX=y
1049+
CONFIG_BCM2708_MBOX=y
10481050
# CONFIG_IOMMU_SUPPORT is not set
10491051
CONFIG_EXTCON=m
10501052
CONFIG_EXTCON_ARIZONA=m

arch/arm/mach-bcm2708/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Makefile for the linux kernel.
33
#
44

5-
obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o vcio.o power.o
5+
obj-$(CONFIG_MACH_BCM2708) += bcm2708.o armctrl.o power.o
66
obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
77
obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o

arch/arm/mach-bcm2708/bcm2708.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
#include <asm/mach/map.h>
5656

5757
#include <mach/timex.h>
58-
#include <mach/vcio.h>
5958
#include <mach/system.h>
6059

6160
#include <linux/delay.h>
@@ -414,17 +413,21 @@ static struct platform_device bcm2708_usb_device = {
414413
};
415414

416415
static struct resource bcm2708_vcio_resources[] = {
417-
[0] = { /* mailbox/semaphore/doorbell access */
418-
.start = MCORE_BASE,
419-
.end = MCORE_BASE + SZ_4K - 1,
420-
.flags = IORESOURCE_MEM,
421-
},
416+
{
417+
.start = ARMCTRL_0_MAIL0_BASE,
418+
.end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1,
419+
.flags = IORESOURCE_MEM,
420+
}, {
421+
.start = IRQ_ARM_MAILBOX,
422+
.end = IRQ_ARM_MAILBOX,
423+
.flags = IORESOURCE_IRQ,
424+
},
422425
};
423426

424427
static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
425428

426429
static struct platform_device bcm2708_vcio_device = {
427-
.name = BCM_VCIO_DRIVER_NAME,
430+
.name = "bcm2708_vcio",
428431
.id = -1, /* only one VideoCore I/O area */
429432
.resource = bcm2708_vcio_resources,
430433
.num_resources = ARRAY_SIZE(bcm2708_vcio_resources),
@@ -905,7 +908,7 @@ void __init bcm2708_init(void)
905908
bcm2708_dt_init();
906909

907910
bcm_register_device_dt(&bcm2708_dmaengine_device);
908-
bcm_register_device(&bcm2708_vcio_device);
911+
bcm_register_device_dt(&bcm2708_vcio_device);
909912
#ifdef CONFIG_BCM2708_GPIO
910913
bcm_register_device_dt(&bcm2708_gpio_device);
911914
#endif

arch/arm/mach-bcm2708/include/mach/platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */
8282
#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */
8383
#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */
84+
#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */
8485

8586

8687
/*

arch/arm/mach-bcm2708/power.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
#include <linux/module.h>
1515
#include <linux/semaphore.h>
1616
#include <linux/bug.h>
17+
#include <linux/platform_data/mailbox-bcm2708.h>
1718
#include <mach/power.h>
18-
#include <mach/vcio.h>
1919
#include <mach/arm_power.h>
2020

2121
#define DRIVER_NAME "bcm2708_power"
@@ -189,7 +189,11 @@ static void __exit bcm_power_exit(void)
189189
bcm_mailbox_write(MBOX_CHAN_POWER, 0);
190190
}
191191

192-
arch_initcall(bcm_power_init); /* Initialize early */
192+
/*
193+
* Load after the mailbox driver is initialized (arch_initcall),
194+
* but before depending drivers (module_init).
195+
*/
196+
subsys_initcall(bcm_power_init);
193197
module_exit(bcm_power_exit);
194198

195199
MODULE_AUTHOR("Phil Elwell");

arch/arm/mach-bcm2708/vc_mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <linux/debugfs.h>
2323
#include <asm/uaccess.h>
2424
#include <linux/dma-mapping.h>
25+
#include <linux/platform_data/mailbox-bcm2708.h>
2526

2627
#ifdef CONFIG_ARCH_KONA
2728
#include <chal/chal_ipc.h>
@@ -31,7 +32,6 @@
3132
#endif
3233

3334
#include "mach/vc_mem.h"
34-
#include <mach/vcio.h>
3535

3636
#define DRIVER_NAME "vc-mem"
3737

arch/arm/mach-bcm2709/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# Makefile for the linux kernel.
33
#
44

5-
obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o vcio.o power.o
5+
obj-$(CONFIG_MACH_BCM2709) += bcm2709.o armctrl.o power.o
66
obj-$(CONFIG_BCM2708_GPIO) += bcm2708_gpio.o
77
obj-$(CONFIG_BCM2708_VCMEM) += vc_mem.o

arch/arm/mach-bcm2709/bcm2709.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
#include <asm/mach/map.h>
5757

5858
#include <mach/timex.h>
59-
#include <mach/vcio.h>
6059
#include <mach/system.h>
6160

6261
#include <linux/delay.h>
@@ -433,17 +432,21 @@ static struct platform_device bcm2708_usb_device = {
433432
};
434433

435434
static struct resource bcm2708_vcio_resources[] = {
436-
[0] = { /* mailbox/semaphore/doorbell access */
437-
.start = MCORE_BASE,
438-
.end = MCORE_BASE + SZ_4K - 1,
439-
.flags = IORESOURCE_MEM,
440-
},
435+
{
436+
.start = ARMCTRL_0_MAIL0_BASE,
437+
.end = ARMCTRL_0_MAIL0_BASE + SZ_64 - 1,
438+
.flags = IORESOURCE_MEM,
439+
}, {
440+
.start = IRQ_ARM_MAILBOX,
441+
.end = IRQ_ARM_MAILBOX,
442+
.flags = IORESOURCE_IRQ,
443+
},
441444
};
442445

443446
static u64 vcio_dmamask = DMA_BIT_MASK(DMA_MASK_BITS_COMMON);
444447

445448
static struct platform_device bcm2708_vcio_device = {
446-
.name = BCM_VCIO_DRIVER_NAME,
449+
.name = "bcm2708_vcio",
447450
.id = -1, /* only one VideoCore I/O area */
448451
.resource = bcm2708_vcio_resources,
449452
.num_resources = ARRAY_SIZE(bcm2708_vcio_resources),
@@ -926,7 +929,7 @@ void __init bcm2709_init(void)
926929
bcm2709_dt_init();
927930

928931
bcm_register_device_dt(&bcm2708_dmaengine_device);
929-
bcm_register_device(&bcm2708_vcio_device);
932+
bcm_register_device_dt(&bcm2708_vcio_device);
930933
#ifdef CONFIG_BCM2708_GPIO
931934
bcm_register_device_dt(&bcm2708_gpio_device);
932935
#endif

arch/arm/mach-bcm2709/include/mach/platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
#define ARMCTRL_IC_BASE (ARM_BASE + 0x200) /* ARM interrupt controller */
8282
#define ARMCTRL_TIMER0_1_BASE (ARM_BASE + 0x400) /* Timer 0 and 1 */
8383
#define ARMCTRL_0_SBM_BASE (ARM_BASE + 0x800) /* User 0 (ARM)'s Semaphores Doorbells and Mailboxes */
84+
#define ARMCTRL_0_MAIL0_BASE (ARMCTRL_0_SBM_BASE + 0x80) /* User 0 (ARM)'s Mailbox 0 */
8485

8586

8687
/*

arch/arm/mach-bcm2709/include/mach/vcio.h

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)