summaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-02-13 20:31:48 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-02-13 20:31:48 +0100
commitd1bebc03b3005b33da3d1541782bb037974d1486 (patch)
tree21054d080018a1925538cd6a399e45e98eb3a84d /arch/arm
parentf5a25b2639e0889e02db5e86080559019c567a1f (diff)
parent1c7a67ba2fdf8f366127e9cf459c76835ca01004 (diff)
downloadbarebox-d1bebc03b3005b33da3d1541782bb037974d1486.tar.gz
barebox-d1bebc03b3005b33da3d1541782bb037974d1486.tar.xz
Merge branch 'for-next/rpi'
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/boards/raspberry-pi/rpi-common.c69
-rw-r--r--arch/arm/boards/raspberry-pi/rpi.h1
-rw-r--r--arch/arm/configs/rpi_defconfig1
-rw-r--r--arch/arm/dts/bcm2837-rpi-3.dts7
-rw-r--r--arch/arm/mach-bcm283x/core.c19
-rw-r--r--arch/arm/mach-bcm283x/include/mach/mbox.h42
6 files changed, 84 insertions, 55 deletions
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index b2febec991..b5d16a15ca 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -73,7 +73,7 @@ static int rpi_get_arm_mem(u32 *size)
return 0;
}
-static struct clk *rpi_register_firmare_clock(u32 clock_id, const char *name)
+static struct clk *rpi_register_firmware_clock(u32 clock_id, const char *name)
{
BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg);
int ret;
@@ -121,7 +121,7 @@ struct gpio_led rpi_leds[] = {
},
};
-void rpi_add_led(void)
+static void rpi_add_led(void)
{
int i;
struct gpio_led *l;
@@ -138,14 +138,14 @@ void rpi_add_led(void)
led_set_trigger(LED_TRIGGER_HEARTBEAT, &l->led);
}
-void rpi_b_init(void)
+static void rpi_b_init(void)
{
rpi_leds[0].gpio = 16;
rpi_leds[0].active_low = 1;
rpi_set_usbethaddr();
}
-void rpi_b_plus_init(void)
+static void rpi_b_plus_init(void)
{
rpi_leds[0].gpio = 47;
rpi_leds[1].gpio = 35;
@@ -166,17 +166,30 @@ const struct rpi_model rpi_models_old_scheme[] = {
RPI_MODEL(BCM2835_BOARD_REV_B_REV2_d, "Model B rev2", rpi_b_init),
RPI_MODEL(BCM2835_BOARD_REV_B_REV2_e, "Model B rev2", rpi_b_init),
RPI_MODEL(BCM2835_BOARD_REV_B_REV2_f, "Model B rev2", rpi_b_init),
- RPI_MODEL(BCM2835_BOARD_REV_B_PLUS, "Model B+", rpi_b_plus_init),
- RPI_MODEL(BCM2835_BOARD_REV_CM, "Compute Module", NULL),
- RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, "Model A+", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_B_PLUS_10, "Model B+", rpi_b_plus_init),
+ RPI_MODEL(BCM2835_BOARD_REV_CM_11, "Compute Module", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_A_PLUS_12, "Model A+", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_B_PLUS_13, "Model B+", rpi_b_plus_init),
+ RPI_MODEL(BCM2835_BOARD_REV_CM_14, "Compute Module", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_A_PLUS_15, "Model A+", NULL),
};
const struct rpi_model rpi_models_new_scheme[] = {
- RPI_MODEL(0, "Unknown model", NULL),
- RPI_MODEL(BCM2836_BOARD_REV_2_B, "2 Model B", rpi_b_plus_init),
- RPI_MODEL(BCM2837_BOARD_REV_3_B, "3 Model B", rpi_b_plus_init),
- RPI_MODEL(BCM2835_BOARD_REV_ZERO, "Zero", rpi_b_plus_init),
- RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, "Zero W", rpi_b_plus_init),
+ RPI_MODEL(BCM2835_BOARD_REV_A, "Model A", NULL ),
+ RPI_MODEL(BCM2835_BOARD_REV_B, "Model B", rpi_b_init ),
+ RPI_MODEL(BCM2835_BOARD_REV_A_PLUS, "Model A+", NULL ),
+ RPI_MODEL(BCM2835_BOARD_REV_B_PLUS, "Model B+", rpi_b_plus_init ),
+ RPI_MODEL(BCM2836_BOARD_REV_2_B, "Model 2B", rpi_b_plus_init),
+ RPI_MODEL(BCM283x_BOARD_REV_Alpha, "Alpha", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_CM1, "Compute Module", NULL ),
+ RPI_MODEL(0x7, "Unknown model", NULL),
+ RPI_MODEL(BCM2837_BOARD_REV_3_B, "Model 3B", rpi_b_init ),
+ RPI_MODEL(BCM2835_BOARD_REV_ZERO, "Zero", rpi_b_plus_init),
+ RPI_MODEL(BCM2837_BOARD_REV_CM3, "Compute Module 3", NULL ),
+ RPI_MODEL(0xb, "Unknown model", NULL),
+ RPI_MODEL(BCM2835_BOARD_REV_ZERO_W, "Zero W", rpi_b_plus_init),
+ RPI_MODEL(BCM2837B0_BOARD_REV_3B_PLUS, "Model 3 B+", rpi_b_plus_init ),
+ RPI_MODEL(BCM2837B0_BOARD_REV_3A_PLUS, "Nodel 3 A+", rpi_b_plus_init),
};
static int rpi_board_rev = 0;
@@ -289,7 +302,7 @@ static int rpi_clock_init(void)
{
struct clk *clk;
- clk = rpi_register_firmare_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
+ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
"bcm2835_mci0");
if (IS_ERR(clk))
return PTR_ERR(clk);
@@ -301,6 +314,36 @@ static int rpi_clock_init(void)
}
postconsole_initcall(rpi_clock_init);
+#define BCM2835_PL011_BASE 0x20201000
+#define BCM2836_PL011_BASE 0x3f201000
+#define BCM2836_MINIUART_BASE 0x3f215040
+
+static int rpi_console_clock_init(void)
+{
+ struct clk *clk;
+
+ clk = clk_fixed("apb_pclk", 0);
+ clk_register_clkdev(clk, "apb_pclk", NULL);
+
+ clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
+ clk_register_clkdev(clk, NULL, "uart0-pl0110");
+ clkdev_add_physbase(clk, BCM2835_PL011_BASE, NULL);
+ clkdev_add_physbase(clk, BCM2836_PL011_BASE, NULL);
+
+ clk = rpi_register_firmware_clock(BCM2835_MBOX_CLOCK_ID_CORE,
+ "uart1-8250");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL);
+
+ clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
+ clk_register_clkdev(clk, NULL, "bcm2835-cs");
+
+ return 0;
+}
+postcore_initcall(rpi_console_clock_init);
+
static int rpi_env_init(void)
{
struct stat s;
diff --git a/arch/arm/boards/raspberry-pi/rpi.h b/arch/arm/boards/raspberry-pi/rpi.h
index dd32fee809..b2a0401bd0 100644
--- a/arch/arm/boards/raspberry-pi/rpi.h
+++ b/arch/arm/boards/raspberry-pi/rpi.h
@@ -19,7 +19,6 @@ struct rpi_model {
extern struct gpio_led rpi_leds[];
-void rpi_b_plus_init(void);
void rpi_set_usbethaddr(void);
#endif /* __ARCH_ARM_BOARDS_RPI_H__ */
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 2bb6158493..dc5ab1fe17 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -63,6 +63,7 @@ CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_TIME=y
CONFIG_SERIAL_AMBA_PL011=y
+CONFIG_DRIVER_SERIAL_NS16550=y
CONFIG_MCI=y
CONFIG_MCI_BCM283X=y
CONFIG_LED=y
diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
index d6ffc36912..194b41c23b 100644
--- a/arch/arm/dts/bcm2837-rpi-3.dts
+++ b/arch/arm/dts/bcm2837-rpi-3.dts
@@ -2,15 +2,10 @@
/ {
chosen {
- stdout-path = &uart0;
+ stdout-path = &uart1;
};
memory {
reg = <0x0 0x0>;
};
};
-
-&uart0 {
- status = "okay";
- /delete-node/ bluetooth;
-};
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
index f1dcda86f7..f2528cf1f1 100644
--- a/arch/arm/mach-bcm283x/core.c
+++ b/arch/arm/mach-bcm283x/core.c
@@ -31,25 +31,6 @@
#include <mach/core.h>
#include <linux/amba/bus.h>
-static int bcm2835_clk_init(void)
-{
- struct clk *clk;
-
- clk = clk_fixed("apb_pclk", 0);
- clk_register_clkdev(clk, "apb_pclk", NULL);
-
- clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "uart0-pl0110");
- clkdev_add_physbase(clk, 0x20201000, NULL);
- clkdev_add_physbase(clk, 0x3f201000, NULL);
-
- clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
- clk_register_clkdev(clk, NULL, "bcm2835-cs");
-
- return 0;
-}
-postcore_initcall(bcm2835_clk_init);
-
void bcm2835_add_device_sdram(u32 size)
{
if (!size)
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index 76b573f85f..e4f6cb6751 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -127,20 +127,12 @@ struct bcm2835_mbox_tag_hdr {
#define BCM2835_MBOX_TAG_GET_BOARD_REV 0x00010002
-/* RPi 2 */
-#define BCM2836_BOARD_REV_2_B 0x4
-/* RPi 3 */
-#define BCM2837_BOARD_REV_3_B 0x8
-/* Zero */
-#define BCM2835_BOARD_REV_ZERO 0x9
-/* Zero W */
-#define BCM2835_BOARD_REV_ZERO_W 0xc
-
/*
- * 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
- * 0x10, 0x11 from swarren's testing
+ * ids
+ * https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
+ * cpu info
+ * https://en.wikipedia.org/wiki/Raspberry_Pi#Processor
+ *
*/
#define BCM2835_BOARD_REV_B_I2C0_2 0x2
#define BCM2835_BOARD_REV_B_I2C0_3 0x3
@@ -153,9 +145,27 @@ struct bcm2835_mbox_tag_hdr {
#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_10 0x10
+#define BCM2835_BOARD_REV_CM_11 0x11
+#define BCM2835_BOARD_REV_A_PLUS_12 0x12
+#define BCM2835_BOARD_REV_B_PLUS_13 0x13
+#define BCM2835_BOARD_REV_CM_14 0x14
+#define BCM2835_BOARD_REV_A_PLUS_15 0x15
+
+
+#define BCM2835_BOARD_REV_A 0x00
+#define BCM2835_BOARD_REV_B 0x01
+#define BCM2835_BOARD_REV_A_PLUS 0x02
+#define BCM2835_BOARD_REV_B_PLUS 0x03
+#define BCM2836_BOARD_REV_2_B 0x04
+#define BCM283x_BOARD_REV_Alpha 0x05
+#define BCM2835_BOARD_REV_CM1 0x06
+#define BCM2837_BOARD_REV_3_B 0x08
+#define BCM2835_BOARD_REV_ZERO 0x09
+#define BCM2837_BOARD_REV_CM3 0x0a
+#define BCM2835_BOARD_REV_ZERO_W 0x0c
+#define BCM2837B0_BOARD_REV_3B_PLUS 0x0d
+#define BCM2837B0_BOARD_REV_3A_PLUS 0x0e
struct bcm2835_mbox_tag_get_board_rev {
struct bcm2835_mbox_tag_hdr tag_hdr;