From dbe6f1eb93e14c611865274c53b0be1aa59e7762 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Fri, 4 Dec 2015 22:07:44 -0700 Subject: [PATCH] rpi: get rid of BCM2835_BOARD_REV_* macros There are two numbering schemes for the RPi revision values; old and new scheme. The values within each scheme overlap. Hence, it doesn't make sense to have absolute/global names for the revision IDs. Get rid of the names and just use the raw revision/type values to set up the array of per-revision data. This change makes most sense when coupled with the next change. However, it's split out so that the mechanical cut/paste is separate from the logic changes for easier review and problem bisection. Signed-off-by: Stephen Warren --- arch/arm/mach-bcm283x/include/mach/mbox.h | 28 --------------- board/raspberrypi/rpi/rpi.c | 42 +++++++++++++---------- 2 files changed, 23 insertions(+), 47 deletions(-) diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index 9260ee2df7..af94dff2ac 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -125,34 +125,6 @@ struct bcm2835_mbox_tag_hdr { #define BCM2835_MBOX_TAG_GET_BOARD_REV 0x00010002 -#ifdef CONFIG_BCM2836 -#define BCM2836_BOARD_REV_2_B 0x4 -#else -/* - * 0x2..0xf from: - * http://raspberryalphaomega.org.uk/2013/02/06/automatic-raspberry-pi-board-revision-detection-model-a-b1-and-b2/ - * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=32733 - * http://git.drogon.net/?p=wiringPi;a=blob_plain;f=wiringPi/wiringPi.c;hb=5edd177112c99416f68ba3e8c6c4db6ed942e796 - */ -#define BCM2835_BOARD_REV_B_I2C0_2 0x2 -#define BCM2835_BOARD_REV_B_I2C0_3 0x3 -#define BCM2835_BOARD_REV_B_I2C1_4 0x4 -#define BCM2835_BOARD_REV_B_I2C1_5 0x5 -#define BCM2835_BOARD_REV_B_I2C1_6 0x6 -#define BCM2835_BOARD_REV_A_7 0x7 -#define BCM2835_BOARD_REV_A_8 0x8 -#define BCM2835_BOARD_REV_A_9 0x9 -#define BCM2835_BOARD_REV_B_REV2_d 0xd -#define BCM2835_BOARD_REV_B_REV2_e 0xe -#define BCM2835_BOARD_REV_B_REV2_f 0xf -#define BCM2835_BOARD_REV_B_PLUS 0x10 -#define BCM2835_BOARD_REV_CM 0x11 -#define BCM2835_BOARD_REV_A_PLUS 0x12 -#define BCM2835_BOARD_REV_B_PLUS_13 0x13 -#define BCM2835_BOARD_REV_CM_14 0x14 -#define BCM2835_BOARD_REV_A_PLUS_15 0x15 -#endif - struct bcm2835_mbox_tag_get_board_rev { struct bcm2835_mbox_tag_hdr tag_hdr; union { diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c index 6451d1d916..43ed60ae98 100644 --- a/board/raspberrypi/rpi/rpi.c +++ b/board/raspberrypi/rpi/rpi.c @@ -74,7 +74,11 @@ struct msg_get_clock_rate { u32 end_tag; }; -/* See comments in mbox.h for data source */ +/* + * http://raspberryalphaomega.org.uk/2013/02/06/automatic-raspberry-pi-board-revision-detection-model-a-b1-and-b2/ + * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=32733 + * http://git.drogon.net/?p=wiringPi;a=blob_plain;f=wiringPi/wiringPi.c;hb=5edd177112c99416f68ba3e8c6c4db6ed942e796 + */ static const struct { const char *name; const char *fdtfile; @@ -90,93 +94,93 @@ static const struct { false, }, #ifdef CONFIG_BCM2836 - [BCM2836_BOARD_REV_2_B] = { + [0x4] = { "2 Model B", "bcm2836-rpi-2-b.dtb", true, }, #else - [BCM2835_BOARD_REV_B_I2C0_2] = { + [0x2] = { "Model B (no P5)", "bcm2835-rpi-b-i2c0.dtb", true, }, - [BCM2835_BOARD_REV_B_I2C0_3] = { + [0x3] = { "Model B (no P5)", "bcm2835-rpi-b-i2c0.dtb", true, }, - [BCM2835_BOARD_REV_B_I2C1_4] = { + [0x4] = { "Model B", "bcm2835-rpi-b.dtb", true, }, - [BCM2835_BOARD_REV_B_I2C1_5] = { + [0x5] = { "Model B", "bcm2835-rpi-b.dtb", true, }, - [BCM2835_BOARD_REV_B_I2C1_6] = { + [0x6] = { "Model B", "bcm2835-rpi-b.dtb", true, }, - [BCM2835_BOARD_REV_A_7] = { + [0x7] = { "Model A", "bcm2835-rpi-a.dtb", false, }, - [BCM2835_BOARD_REV_A_8] = { + [0x8] = { "Model A", "bcm2835-rpi-a.dtb", false, }, - [BCM2835_BOARD_REV_A_9] = { + [0x9] = { "Model A", "bcm2835-rpi-a.dtb", false, }, - [BCM2835_BOARD_REV_B_REV2_d] = { + [0xd] = { "Model B rev2", "bcm2835-rpi-b-rev2.dtb", true, }, - [BCM2835_BOARD_REV_B_REV2_e] = { + [0xe] = { "Model B rev2", "bcm2835-rpi-b-rev2.dtb", true, }, - [BCM2835_BOARD_REV_B_REV2_f] = { + [0xf] = { "Model B rev2", "bcm2835-rpi-b-rev2.dtb", true, }, - [BCM2835_BOARD_REV_B_PLUS] = { + [0x10] = { "Model B+", "bcm2835-rpi-b-plus.dtb", true, }, - [BCM2835_BOARD_REV_CM] = { + [0x11] = { "Compute Module", "bcm2835-rpi-cm.dtb", false, }, - [BCM2835_BOARD_REV_A_PLUS] = { + [0x12] = { "Model A+", "bcm2835-rpi-a-plus.dtb", false, }, - [BCM2835_BOARD_REV_B_PLUS_13] = { + [0x13] = { "Model B+", "bcm2835-rpi-b-plus.dtb", true, }, - [BCM2835_BOARD_REV_CM_14] = { + [0x14] = { "Compute Module", "bcm2835-rpi-cm.dtb", false, }, - [BCM2835_BOARD_REV_A_PLUS_15] = { + [0x15] = { "Model A+", "bcm2835-rpi-a-plus.dtb", false, -- 2.39.5