From 44672ff09c4377a4a147ed845fa4e26970f7bfce Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:01 +0100 Subject: ARM: rpi: fix typo in rpi-common.c Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 650b26ce7d..840f525bbb 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; @@ -286,7 +286,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); -- cgit v1.2.3 From 86ec9aa7458ef752bdaed124e9905ef5d4ecf978 Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:02 +0100 Subject: ARM: rpi: move clks into board specific rpi-common We don't know if the firmware running on the raspberry pi is the same firmware which is running on all bcm283x devices. Therefore move the console clock initialization into the rpi-common.c board file. A future commit will use this function to retrieve the miniuart clock from the raspberry pi firmware. No functional changes. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 19 +++++++++++++++++++ arch/arm/mach-bcm283x/core.c | 19 ------------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 840f525bbb..887f096f7e 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -298,6 +298,25 @@ static int rpi_clock_init(void) } postconsole_initcall(rpi_clock_init); +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, 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(rpi_console_clock_init); + static int rpi_env_init(void) { struct stat s; 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 #include -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) -- cgit v1.2.3 From 9c3fe58fd962651bcab98b7d6f919a3e11e0dc3f Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:03 +0100 Subject: ARM: rpi: retrieve miniuart clock from firmware The miniuart uses the core clock as the clock source. This clock is fixed by the firmware to 250Mhz if enable_uart=1 is set in the config.txt file. However a user could still choose to overclock the core frequency, which would result in wrong baudrates computed by barebox. Retrieve the core clock frequency from the firmware to allow all potential firmware configurations to work with barebox. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 887f096f7e..f22239c7cc 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -310,6 +310,13 @@ static int rpi_console_clock_init(void) clkdev_add_physbase(clk, 0x20201000, NULL); clkdev_add_physbase(clk, 0x3f201000, 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, 0x3f215040, NULL); + clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); clk_register_clkdev(clk, NULL, "bcm2835-cs"); -- cgit v1.2.3 From de698980f33e6f4f457e38a0b77494de4752feae Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:04 +0100 Subject: serial_ns16550: handle default reg-io-width According to the device tree bindings for 8250, width is an optional property. Default to 1 which is the same default value as used by the kernel. Before this change the driver would not work for device trees which do not include the optional binding. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- drivers/serial/serial_ns16550.c | 46 ++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index 4d73ea8b87..8ddcfdbefc 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -297,36 +297,36 @@ static int ns16550_tstc(struct console_device *cdev) static void ns16550_probe_dt(struct device_d *dev, struct ns16550_priv *priv) { struct device_node *np = dev->device_node; - u32 width; + u32 width = 1; if (!IS_ENABLED(CONFIG_OFDEVICE)) return; of_property_read_u32(np, "clock-frequency", &priv->plat.clock); of_property_read_u32(np, "reg-shift", &priv->plat.shift); - if (!of_property_read_u32(np, "reg-io-width", &width)) - switch (width) { - case 1: - priv->read_reg = ns16550_read_reg_mmio_8; - priv->write_reg = ns16550_write_reg_mmio_8; - break; - case 2: - priv->read_reg = ns16550_read_reg_mmio_16; - priv->write_reg = ns16550_write_reg_mmio_16; - break; - case 4: - if (of_device_is_big_endian(np)) { - priv->read_reg = ns16550_read_reg_mmio_32be; - priv->write_reg = ns16550_write_reg_mmio_32be; - } else { - priv->read_reg = ns16550_read_reg_mmio_32; - priv->write_reg = ns16550_write_reg_mmio_32; - } - break; - default: - dev_err(dev, "unsupported reg-io-width (%d)\n", - width); + of_property_read_u32(np, "reg-io-width", &width); + switch (width) { + case 1: + priv->read_reg = ns16550_read_reg_mmio_8; + priv->write_reg = ns16550_write_reg_mmio_8; + break; + case 2: + priv->read_reg = ns16550_read_reg_mmio_16; + priv->write_reg = ns16550_write_reg_mmio_16; + break; + case 4: + if (of_device_is_big_endian(np)) { + priv->read_reg = ns16550_read_reg_mmio_32be; + priv->write_reg = ns16550_write_reg_mmio_32be; + } else { + priv->read_reg = ns16550_read_reg_mmio_32; + priv->write_reg = ns16550_write_reg_mmio_32; } + break; + default: + dev_err(dev, "unsupported reg-io-width (%d)\n", + width); + } } static struct ns16550_drvdata ns16450_drvdata = { -- cgit v1.2.3 From 77de547cd179b910cdcb8530df15d77a0fc66a3c Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:05 +0100 Subject: serial_ns16550: add raspberry pi compatible and init Add the compatible for the Raspberry Pi AUX UART and an init function which enables it via the aux register and configures the correct shift value. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- drivers/serial/serial_ns16550.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/serial/serial_ns16550.c b/drivers/serial/serial_ns16550.c index 8ddcfdbefc..ccd082e495 100644 --- a/drivers/serial/serial_ns16550.c +++ b/drivers/serial/serial_ns16550.c @@ -253,6 +253,23 @@ static void ns16550_jz_init_port(struct console_device *cdev) ns16550_serial_init_port(cdev); } +#define BCM2836_AUX_CLOCK_ENB 0x3f215004 /* BCM2835 AUX Clock enable register */ +#define BCM2836_AUX_CLOCK_EN_UART BIT(0) /* Bit 0 enables the Miniuart */ + +static void rpi_init_port(struct console_device *cdev) +{ + struct ns16550_priv *priv = to_ns16550_priv(cdev); + + writeb(BCM2836_AUX_CLOCK_EN_UART, BCM2836_AUX_CLOCK_ENB); + priv->plat.shift = 2; + /* + * We double the clock rate since the 16550 will divide by 16 + * (instead of 8 required by the BCM2835 peripheral manual) + */ + priv->plat.clock = priv->plat.clock*2; + ns16550_serial_init_port(cdev); +} + /*********** Exposed Functions **********************************/ /** @@ -353,6 +370,11 @@ static __maybe_unused struct ns16550_drvdata tegra_drvdata = { .linux_console_name = "ttyS", }; +static __maybe_unused struct ns16550_drvdata rpi_drvdata = { + .init_port = rpi_init_port, + .linux_console_name = "ttyS", +}; + static int ns16550_init_iomem(struct device_d *dev, struct ns16550_priv *priv) { struct resource *iores; @@ -527,6 +549,12 @@ static struct of_device_id ns16550_serial_dt_ids[] = { .compatible = "ingenic,jz4740-uart", .data = &jz_drvdata, }, +#endif +#if IS_ENABLED(CONFIG_MACH_RPI_COMMON) + { + .compatible = "brcm,bcm2835-aux-uart", + .data = &rpi_drvdata, + }, #endif { /* sentinel */ -- cgit v1.2.3 From 7afad5ed5265b46f49f410b1bbe7740ff364747e Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:06 +0100 Subject: ARM: rpi: add NS16550 support Since the 16550 driver now supports the RPI3 miniuart, enable it in the default config. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/configs/rpi_defconfig | 1 + 1 file changed, 1 insertion(+) 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 -- cgit v1.2.3 From ab76f9d09d3b7b77fc00d84bc2fac6bfbf82c69c Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:07 +0100 Subject: ARM: rpi: choose miniuart as stdout Since we now support the miniuart, enable it as the default stdout port. With this change the device tree overlay to switch the miniuart to bluetooth is no longer necessary. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/dts/bcm2837-rpi-3.dts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) 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; -}; -- cgit v1.2.3 From f1330536c09310e267f23516bc117a7d1e12aefa Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:08 +0100 Subject: doc: bcm283x: remove miniuart overlay instruction Since we now use the miniuart on the raspberry pi 3, the miniuart overlay is no longer needed. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- Documentation/boards/bcm2835.rst | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/boards/bcm2835.rst b/Documentation/boards/bcm2835.rst index 79ea0ff7a7..ea80d58348 100644 --- a/Documentation/boards/bcm2835.rst +++ b/Documentation/boards/bcm2835.rst @@ -22,7 +22,6 @@ Raspberry Pi kernel=barebox.img enable_uart=1 - dtoverlay=pi3-miniuart-bt (For more information, refer to the `documentation for config.txt`_.) -- cgit v1.2.3 From 9ce9ec82d542c1ec2ce14a01cbe903f7c0dbe41f Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Tue, 15 Jan 2019 06:44:09 +0100 Subject: ARM: rpi: use defines for uart bases Previously the clkdev_add_phybase was called on magic register values, add defines which clarify the device for which the phybase clkdev is created. Signed-off-by: Rouven Czerwinski Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index f22239c7cc..219c9c7d2b 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -298,6 +298,10 @@ 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; @@ -307,15 +311,15 @@ static int rpi_console_clock_init(void) 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); + 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, 0x3f215040, NULL); + clkdev_add_physbase(clk, BCM2836_MINIUART_BASE, NULL); clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000); clk_register_clkdev(clk, NULL, "bcm2835-cs"); -- cgit v1.2.3 From 797430b083fc5c38743524d1c732a89744beef98 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Tue, 15 Jan 2019 11:34:21 +0100 Subject: ARM: rpi: make locally used functions static These functions are not meant to be a public interface, so they can well be static. rpi_b_plus_init() was previously declared with a prototype, which is no longer needed. This fixes the following build warnings: .../arch/arm/boards/raspberry-pi/rpi-common.c:124:6: warning: no previous prototype for 'rpi_add_led' [-Wmissing-prototypes] void rpi_add_led(void) ^~~~~~~~~~~ .../arch/arm/boards/raspberry-pi/rpi-common.c:141:6: warning: no previous prototype for 'rpi_b_init' [-Wmissing-prototypes] void rpi_b_init(void) Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 6 +++--- arch/arm/boards/raspberry-pi/rpi.h | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 219c9c7d2b..44d3ef79dc 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -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; 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__ */ -- cgit v1.2.3 From b7392e27e0103db18a93c6ae004d12ca5e400ec5 Mon Sep 17 00:00:00 2001 From: Roland Hieber Date: Tue, 15 Jan 2019 11:34:22 +0100 Subject: mci: bcm2835: make locally used functions static The mci-bcm2835 driver registers itself as an MCI driver on probing, and is thereby used through the MCI interface, so these functions are not meant to act as a public interface and only used internally in this compilation unit. This fixes the following build warnings: .../drivers/mci/mci-bcm2835.c:56:6: warning: no previous prototype for 'bcm2835_mci_write' [-Wmissing-prototypes] void bcm2835_mci_write(struct bcm2835_mci_host *host, u32 reg, u32 val) ^~~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:74:5: warning: no previous prototype for 'bcm2835_mci_read' [-Wmissing-prototypes] u32 bcm2835_mci_read(struct bcm2835_mci_host *host, u32 reg) ^~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:83:6: warning: no previous prototype for 'bcm2835_mci_write_data' [-Wmissing-prototypes] void bcm2835_mci_write_data(struct bcm2835_mci_host *host, u32 *p) ^~~~~~~~~~~~~~~~~~~~~~ .../drivers/mci/mci-bcm2835.c:89:6: warning: no previous prototype for 'bcm2835_mci_read_data' [-Wmissing-prototypes] void bcm2835_mci_read_data(struct bcm2835_mci_host *host, u32 *p) ^~~~~~~~~~~~~~~~~~~~~ CC common/date.o .../drivers/mci/mci-bcm2835.c:419:5: warning: no previous prototype for 'bcm2835_mci_reset' [-Wmissing-prototypes] int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev) Signed-off-by: Roland Hieber Signed-off-by: Sascha Hauer --- drivers/mci/mci-bcm2835.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c index daf771934a..9438e66af0 100644 --- a/drivers/mci/mci-bcm2835.c +++ b/drivers/mci/mci-bcm2835.c @@ -53,7 +53,7 @@ struct bcm2835_mci_host { uint64_t last_write; }; -void bcm2835_mci_write(struct bcm2835_mci_host *host, u32 reg, u32 val) +static void bcm2835_mci_write(struct bcm2835_mci_host *host, u32 reg, u32 val) { /* * The Arasan has a bugette whereby it may lose the content of @@ -71,7 +71,7 @@ void bcm2835_mci_write(struct bcm2835_mci_host *host, u32 reg, u32 val) writel(val, host->regs + reg); } -u32 bcm2835_mci_read(struct bcm2835_mci_host *host, u32 reg) +static u32 bcm2835_mci_read(struct bcm2835_mci_host *host, u32 reg) { return readl(host->regs + reg); } @@ -80,13 +80,13 @@ u32 bcm2835_mci_read(struct bcm2835_mci_host *host, u32 reg) * register is not affected by the twoticks_delay bug * and we can thus get better speed here */ -void bcm2835_mci_write_data(struct bcm2835_mci_host *host, u32 *p) +static void bcm2835_mci_write_data(struct bcm2835_mci_host *host, u32 *p) { writel(*p, host->regs + SDHCI_BUFFER); } /* Make a read data functions as well just to keep structure */ -void bcm2835_mci_read_data(struct bcm2835_mci_host *host, u32 *p) +static void bcm2835_mci_read_data(struct bcm2835_mci_host *host, u32 *p) { *p = readl(host->regs + SDHCI_BUFFER); } @@ -416,7 +416,7 @@ static void bcm2835_mci_set_ios(struct mci_host *mci, struct mci_ios *ios) host->bus_width, host->clock); } -int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev) +static int bcm2835_mci_reset(struct mci_host *mci, struct device_d *mci_dev) { struct bcm2835_mci_host *host; u32 ret = 0; -- cgit v1.2.3 From 1c7a67ba2fdf8f366127e9cf459c76835ca01004 Mon Sep 17 00:00:00 2001 From: Moritz Augsburger Date: Mon, 28 Jan 2019 10:57:00 +0100 Subject: ARM: rpi: complete new revision scheme Signed-off-by: Sascha Hauer --- arch/arm/boards/raspberry-pi/rpi-common.c | 29 +++++++++++++++------ arch/arm/mach-bcm283x/include/mach/mbox.h | 42 +++++++++++++++++++------------ 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c index 44d3ef79dc..0b14fbdfdc 100644 --- a/arch/arm/boards/raspberry-pi/rpi-common.c +++ b/arch/arm/boards/raspberry-pi/rpi-common.c @@ -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; 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; -- cgit v1.2.3