* [PATCH 2/9] ARM: rpi: move model detection before console init
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 3/9] ARM: rpi: convert mailbox interface to regular driver Lucas Stach
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
This way we can print the correct model in the Barebox banner.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
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 7441c06437dd..db9af2be4245 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -278,7 +278,7 @@ static int rpi_mem_init(void)
}
mem_initcall(rpi_mem_init);
-static int rpi_console_init(void)
+static int rpi_postcore_init(void)
{
rpi_get_board_rev();
barebox_set_hostname("rpi");
@@ -286,7 +286,7 @@ static int rpi_console_init(void)
bcm2835_register_uart();
return 0;
}
-console_initcall(rpi_console_init);
+postcore_initcall(rpi_postcore_init);
static int rpi_clock_init(void)
{
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/9] ARM: rpi: convert mailbox interface to regular driver
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
2017-03-01 14:31 ` [PATCH 2/9] ARM: rpi: move model detection before console init Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 4/9] ARM: rpi: convert watchdog/reset " Lucas Stach
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
In prepareation for devicetree probing.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 2 +
arch/arm/mach-bcm283x/include/mach/core.h | 6 +++
arch/arm/mach-bcm283x/include/mach/mbox.h | 19 +++++----
arch/arm/mach-bcm283x/include/mach/platform.h | 1 +
arch/arm/mach-bcm283x/mbox.c | 55 ++++++++++++++++++++++-----
5 files changed, 63 insertions(+), 20 deletions(-)
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index db9af2be4245..d0f4fcb3bad9 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -280,6 +280,8 @@ mem_initcall(rpi_mem_init);
static int rpi_postcore_init(void)
{
+ bcm2835_register_mbox();
+
rpi_get_board_rev();
barebox_set_hostname("rpi");
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index b0bed80ea000..ce54d38707d8 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -32,4 +32,10 @@ static void inline bcm2835_register_fb(void)
add_generic_device("bcm2835_fb", 0, NULL, 0, 0, 0, NULL);
}
+static void inline bcm2835_register_mbox(void)
+{
+ add_generic_device("bcm2835_mbox", 0, NULL, BCM2835_MBOX_BASE, 0x40,
+ IORESOURCE_MEM, NULL);
+}
+
#endif
diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h
index cd9ee1f43415..2b5aea88ee0a 100644
--- a/arch/arm/mach-bcm283x/include/mach/mbox.h
+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h
@@ -41,16 +41,15 @@
*/
/* Raw mailbox HW */
-
-#define BCM2835_MBOX_PHYSADDR (BCM2835_ARM_BASE + 0x880)
-
-struct bcm2835_mbox_regs {
- u32 read;
- u32 rsvd0[5];
- u32 status;
- u32 config;
- u32 write;
-};
+#define ARM_0_MAIL0 0x00
+#define ARM_0_MAIL1 0x20
+
+#define MAIL0_RD (ARM_0_MAIL0 + 0x00)
+#define MAIL0_POL (ARM_0_MAIL0 + 0x10)
+#define MAIL0_STA (ARM_0_MAIL0 + 0x18)
+#define MAIL0_CNF (ARM_0_MAIL0 + 0x1C)
+#define MAIL1_WRT (ARM_0_MAIL1 + 0x00)
+#define MAIL1_STA (ARM_0_MAIL1 + 0x18)
#define BCM2835_MBOX_STATUS_WR_FULL 0x80000000
#define BCM2835_MBOX_STATUS_RD_EMPTY 0x40000000
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 3b73831aa522..09fe78fd41f6 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -41,6 +41,7 @@
#define BCM2835_ST_BASE (BCM2835_PERI_BASE + 0x3000) /* System Timer */
#define BCM2835_DMA_BASE (BCM2835_PERI_BASE + 0x7000) /* DMA controller */
#define BCM2835_ARM_BASE (BCM2835_PERI_BASE + 0xB000) /* BCM2708 ARM control block */
+#define BCM2835_MBOX_BASE (BCM2835_ARM_BASE + 0x880) /* BCM2835 mailbox */
#define BCM2835_PM_BASE (BCM2835_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */
#define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000) /* GPIO */
#define BCM2835_UART0_BASE (BCM2835_PERI_BASE + 0x201000) /* Uart 0 */
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 9d69bc8ea784..b295993359fa 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -6,20 +6,21 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <asm/io.h>
-#include <common.h>
#include <clock.h>
+#include <common.h>
#include <dma.h>
+#include <init.h>
+#include <io.h>
#include <mach/mbox.h>
#define TIMEOUT (MSECOND * 1000)
+static void __iomem *mbox_base;
+
static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
u32 *recv)
{
- struct bcm2835_mbox_regs __iomem *regs =
- (struct bcm2835_mbox_regs *)BCM2835_MBOX_PHYSADDR;
uint64_t starttime = get_time_ns();
u32 send = virt_to_phys(buffer);
u32 val;
@@ -31,19 +32,19 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
/* Drain any stale responses */
for (;;) {
- val = readl(®s->status);
+ val = readl(mbox_base + MAIL0_STA);
if (val & BCM2835_MBOX_STATUS_RD_EMPTY)
break;
if (is_timeout(starttime, TIMEOUT)) {
printf("mbox: Timeout draining stale responses\n");
return -ETIMEDOUT;
}
- val = readl(®s->read);
+ val = readl(mbox_base + MAIL0_RD);
}
/* Wait for space to send */
for (;;) {
- val = readl(®s->status);
+ val = readl(mbox_base + MAIL0_STA);
if (!(val & BCM2835_MBOX_STATUS_WR_FULL))
break;
if (is_timeout(starttime, TIMEOUT)) {
@@ -57,11 +58,11 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
debug("mbox: TX raw: 0x%08x\n", val);
dma_sync_single_for_device((unsigned long)send, buffer->buf_size,
DMA_BIDIRECTIONAL);
- writel(val, ®s->write);
+ writel(val, mbox_base + MAIL1_WRT);
/* Wait for the response */
for (;;) {
- val = readl(®s->status);
+ val = readl(mbox_base + MAIL0_STA);
if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY))
break;
if (is_timeout(starttime, TIMEOUT)) {
@@ -71,7 +72,7 @@ static int bcm2835_mbox_call_raw(u32 chan, struct bcm2835_mbox_hdr *buffer,
}
/* Read the response */
- val = readl(®s->read);
+ val = readl(mbox_base + MAIL0_RD);
debug("mbox: RX raw: 0x%08x\n", val);
dma_sync_single_for_cpu((unsigned long)send, buffer->buf_size,
DMA_BIDIRECTIONAL);
@@ -152,3 +153,37 @@ int bcm2835_mbox_call_prop(u32 chan, struct bcm2835_mbox_hdr *buffer)
return 0;
}
+
+static int bcm2835_mbox_probe(struct device_d *dev)
+{
+ struct resource *iores;
+
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
+ dev_err(dev, "could not get memory region\n");
+ return PTR_ERR(iores);
+ }
+ mbox_base = IOMEM(iores->start);
+
+ return 0;
+}
+
+static __maybe_unused struct of_device_id bcm2835_mbox_dt_ids[] = {
+ {
+ .compatible = "brcm,bcm2835-mbox",
+ }, {
+ /* sentinel */
+ },
+};
+
+static struct driver_d bcm2835_mbox_driver = {
+ .name = "bcm2835_mbox",
+ .of_compatible = DRV_OF_COMPAT(bcm2835_mbox_dt_ids),
+ .probe = bcm2835_mbox_probe,
+};
+
+static int __init bcm2835_mbox_init(void)
+{
+ return platform_driver_register(&bcm2835_mbox_driver);
+}
+core_initcall(bcm2835_mbox_init);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/9] ARM: rpi: convert watchdog/reset to regular driver
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
2017-03-01 14:31 ` [PATCH 2/9] ARM: rpi: move model detection before console init Lucas Stach
2017-03-01 14:31 ` [PATCH 3/9] ARM: rpi: convert mailbox interface to regular driver Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 5/9] clocksource: bcm2835: use clock-frequency property when available Lucas Stach
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
This way it can be probed from DT later on.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/boards/raspberry-pi/rpi-common.c | 1 +
arch/arm/mach-bcm283x/Makefile | 2 +-
arch/arm/mach-bcm283x/core.c | 17 -------
arch/arm/mach-bcm283x/include/mach/core.h | 5 +++
arch/arm/mach-bcm283x/include/mach/wd.h | 6 +--
arch/arm/mach-bcm283x/wd.c | 75 +++++++++++++++++++++++++++++++
6 files changed, 85 insertions(+), 21 deletions(-)
create mode 100644 arch/arm/mach-bcm283x/wd.c
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index d0f4fcb3bad9..331e6873bc49 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -326,6 +326,7 @@ static int rpi_env_init(void)
static int rpi_devices_init(void)
{
rpi_model_init();
+ bcm2835_register_wd();
bcm2835_register_mci();
bcm2835_register_fb();
armlinux_set_architecture(MACH_TYPE_BCM2708);
diff --git a/arch/arm/mach-bcm283x/Makefile b/arch/arm/mach-bcm283x/Makefile
index 940f98cbce76..96ea69365e50 100644
--- a/arch/arm/mach-bcm283x/Makefile
+++ b/arch/arm/mach-bcm283x/Makefile
@@ -1 +1 @@
-obj-y += core.o mbox.o
+obj-y += core.o mbox.o wd.o
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
index 64f37813883a..3319ad63c3d7 100644
--- a/arch/arm/mach-bcm283x/core.c
+++ b/arch/arm/mach-bcm283x/core.c
@@ -18,7 +18,6 @@
#include <common.h>
#include <init.h>
-#include <restart.h>
#include <linux/clk.h>
#include <linux/clkdev.h>
@@ -29,7 +28,6 @@
#include <linux/sizes.h>
#include <mach/platform.h>
-#include <mach/wd.h>
#include <mach/core.h>
#include <linux/amba/bus.h>
@@ -64,25 +62,10 @@ void bcm2835_add_device_sdram(u32 size)
arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
}
-#define RESET_TIMEOUT 10
-
-static void __noreturn bcm2835_restart_soc(struct restart_handler *rst)
-{
- uint32_t rstc;
-
- rstc = readl(PM_RSTC);
- rstc &= ~PM_RSTC_WRCFG_SET;
- rstc |= PM_RSTC_WRCFG_FULL_RESET;
- writel(PM_PASSWORD | RESET_TIMEOUT, PM_WDOG);
- writel(PM_PASSWORD | rstc, PM_RSTC);
-
- hang();
-}
static int bcm2835_dev_init(void)
{
add_generic_device("bcm2835-gpio", 0, NULL, BCM2835_GPIO_BASE, 0xB0, IORESOURCE_MEM, NULL);
- restart_handler_register_fn(bcm2835_restart_soc);
return 0;
}
coredevice_initcall(bcm2835_dev_init);
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index ce54d38707d8..5edd99efa25f 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -37,5 +37,10 @@ static void inline bcm2835_register_mbox(void)
add_generic_device("bcm2835_mbox", 0, NULL, BCM2835_MBOX_BASE, 0x40,
IORESOURCE_MEM, NULL);
}
+static void inline bcm2835_register_wd(void)
+{
+ add_generic_device("bcm2835_wd", 0, NULL, BCM2835_PM_BASE, 0x28,
+ IORESOURCE_MEM, NULL);
+}
#endif
diff --git a/arch/arm/mach-bcm283x/include/mach/wd.h b/arch/arm/mach-bcm283x/include/mach/wd.h
index ad8b762d9631..cdd22d48c07b 100644
--- a/arch/arm/mach-bcm283x/include/mach/wd.h
+++ b/arch/arm/mach-bcm283x/include/mach/wd.h
@@ -21,9 +21,9 @@
/*
* Watchdog
*/
-#define PM_RSTC (BCM2835_PM_BASE+0x1c)
-#define PM_RSTS (BCM2835_PM_BASE+0x20)
-#define PM_WDOG (BCM2835_PM_BASE+0x24)
+#define PM_RSTC 0x1c
+#define PM_RSTS 0x20
+#define PM_WDOG 0x24
#define PM_WDOG_RESET 0000000000
#define PM_PASSWORD 0x5a000000
diff --git a/arch/arm/mach-bcm283x/wd.c b/arch/arm/mach-bcm283x/wd.c
new file mode 100644
index 000000000000..5a5188fd2e26
--- /dev/null
+++ b/arch/arm/mach-bcm283x/wd.c
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 Pengutronix, Lucas Stach <l.stach@pengutronix.de>
+ *
+ * Based on code from Carlo Caione <carlo@carlocaione.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+#include <common.h>
+#include <init.h>
+#include <io.h>
+#include <restart.h>
+
+#include <mach/wd.h>
+
+static void __iomem *wd_base;
+
+#define RESET_TIMEOUT 10
+
+static void __noreturn bcm2835_restart_soc(struct restart_handler *rst)
+{
+ uint32_t rstc;
+
+ rstc = readl(wd_base + PM_RSTC);
+ rstc &= ~PM_RSTC_WRCFG_SET;
+ rstc |= PM_RSTC_WRCFG_FULL_RESET;
+ writel(PM_PASSWORD | RESET_TIMEOUT, wd_base + PM_WDOG);
+ writel(PM_PASSWORD | rstc, wd_base + PM_RSTC);
+
+ hang();
+}
+
+static int bcm2835_wd_probe(struct device_d *dev)
+{
+ struct resource *iores;
+
+ iores = dev_request_mem_resource(dev, 0);
+ if (IS_ERR(iores)) {
+ dev_err(dev, "could not get memory region\n");
+ return PTR_ERR(iores);
+ }
+ wd_base = IOMEM(iores->start);
+
+ restart_handler_register_fn(bcm2835_restart_soc);
+
+ return 0;
+}
+
+static __maybe_unused struct of_device_id bcm2835_wd_dt_ids[] = {
+ {
+ .compatible = "brcm,bcm2835-pm-wdt",
+ }, {
+ /* sentinel */
+ },
+};
+
+static struct driver_d bcm2835_wd_driver = {
+ .name = "bcm2835_wd",
+ .of_compatible = DRV_OF_COMPAT(bcm2835_wd_dt_ids),
+ .probe = bcm2835_wd_probe,
+};
+
+static int __init bcm2835_wd_init(void)
+{
+ return platform_driver_register(&bcm2835_wd_driver);
+}
+device_initcall(bcm2835_wd_init);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 5/9] clocksource: bcm2835: use clock-frequency property when available
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (2 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 4/9] ARM: rpi: convert watchdog/reset " Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 6/9] mci-bcm2835: enable devicetree probing Lucas Stach
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
From: Enrico Joerns <ejo@pengutronix.de>
If the clock frequency is given by a DT property, use this and don't
try to use the clock handle.
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
lst: reworked to fall back gracefully
---
drivers/clocksource/bcm2835.c | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/drivers/clocksource/bcm2835.c b/drivers/clocksource/bcm2835.c
index b5831d5f107b..9130a4b14f9a 100644
--- a/drivers/clocksource/bcm2835.c
+++ b/drivers/clocksource/bcm2835.c
@@ -44,24 +44,33 @@ static int bcm2835_cs_probe(struct device_d *dev)
{
struct resource *iores;
static struct clk *stc_clk;
- u32 rate;
+ u32 rate = 0;
int ret;
- stc_clk = clk_get(dev, NULL);
- if (IS_ERR(stc_clk)) {
- ret = PTR_ERR(stc_clk);
- dev_err(dev, "clock not found: %d\n", ret);
- return ret;
- }
+ /* try to read rate from DT property first */
+ if (IS_ENABLED(CONFIG_OFTREE))
+ of_property_read_u32(dev->device_node, "clock-frequency",
+ &rate);
+
+ /* if rate is still empty, try to get rate from clk */
+ if (!rate) {
+ stc_clk = clk_get(dev, NULL);
+ if (IS_ERR(stc_clk)) {
+ ret = PTR_ERR(stc_clk);
+ dev_err(dev, "clock not found: %d\n", ret);
+ return ret;
+ }
+
+ ret = clk_enable(stc_clk);
+ if (ret) {
+ dev_err(dev, "clock failed to enable: %d\n", ret);
+ clk_put(stc_clk);
+ return ret;
+ }
- ret = clk_enable(stc_clk);
- if (ret) {
- dev_err(dev, "clock failed to enable: %d\n", ret);
- clk_put(stc_clk);
- return ret;
+ rate = clk_get_rate(stc_clk);
}
- rate = clk_get_rate(stc_clk);
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
return PTR_ERR(iores);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/9] mci-bcm2835: enable devicetree probing
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (3 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 5/9] clocksource: bcm2835: use clock-frequency property when available Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 7/9] ARM: rpi: always build relocatable image Lucas Stach
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
From: Enrico Joerns <ejo@pengutronix.de>
Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
---
drivers/mci/mci-bcm2835.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index c7a8cf972ab3..daf771934a6c 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -543,9 +543,18 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
return mci_register(&host->mci);
}
+static __maybe_unused struct of_device_id bcm2835_mci_compatible[] = {
+ {
+ .compatible = "brcm,bcm2835-sdhci",
+ }, {
+ /* sentinel */
+ }
+};
+
static struct driver_d bcm2835_mci_driver = {
.name = "bcm2835_mci",
.probe = bcm2835_mci_probe,
+ .of_compatible = DRV_OF_COMPAT(bcm2835_mci_compatible),
};
static int bcm2835_mci_add(void)
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/9] ARM: rpi: always build relocatable image
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (4 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 6/9] mci-bcm2835: enable devicetree probing Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 8/9] ARM: rpi: move debug UART base selection to Kconfig Lucas Stach
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
Makes more space available for the malloc area and will allow
to switch to multi-image later on.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/Kconfig | 1 +
arch/arm/mach-bcm283x/Kconfig | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e4663ea26872..559cac4016bd 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -27,6 +27,7 @@ config ARCH_BCM283X
select CLOCKSOURCE_BCM283X
select ARM_AMBA
select HAS_DEBUG_LL
+ select RELOCATABLE
menu "System Type"
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index e86126862772..d9be1a9b65c1 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -2,7 +2,7 @@ if ARCH_BCM283X
config ARCH_TEXT_BASE
hex
- default 0x04000000
+ default 0x0
config MACH_RPI_COMMON
bool
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 8/9] ARM: rpi: move debug UART base selection to Kconfig
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (5 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 7/9] ARM: rpi: always build relocatable image Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-01 14:31 ` [PATCH 9/9] ARM: rpi: switch to DT probe and multi-image build Lucas Stach
2017-03-02 8:11 ` [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
To let the user select the right base, when building multi-image.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/mach-bcm283x/Kconfig | 20 ++++++++++++++++++++
arch/arm/mach-bcm283x/include/mach/debug_ll.h | 6 +++++-
2 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index d9be1a9b65c1..bb4fe95ab2f1 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -22,4 +22,24 @@ config MACH_RPI2
endchoice
+config MACH_RPI_DEBUG_UART_BASE
+ hex
+ default 0x20201000 if MACH_RPI_DEBUG_UART_RPI
+ default 0x3f201000 if MACH_RPI_DEBUG_UART_RPI2
+
+if DEBUG_LL
+
+choice
+ prompt "Lowlevel debug UART"
+
+config MACH_RPI_DEBUG_UART_RPI
+ bool "use RaspberryPi 1 compatible base"
+
+config MACH_RPI_DEBUG_UART_RPI2
+ bool "use RaspberryPi 2 and 3 compatible base"
+
+endchoice
+
+endif
+
endif
diff --git a/arch/arm/mach-bcm283x/include/mach/debug_ll.h b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
index be93cd95ad46..a625a8bdb71d 100644
--- a/arch/arm/mach-bcm283x/include/mach/debug_ll.h
+++ b/arch/arm/mach-bcm283x/include/mach/debug_ll.h
@@ -20,7 +20,11 @@
#include <mach/platform.h>
-#define DEBUG_LL_UART_ADDR BCM2835_UART0_BASE
+#ifndef CONFIG_MACH_RPI_DEBUG_UART_BASE
+#define CONFIG_MACH_RPI_DEBUG_UART_BASE 0
+#endif
+
+#define DEBUG_LL_UART_ADDR CONFIG_MACH_RPI_DEBUG_UART_BASE
#include <asm/debug_ll_pl011.h>
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 9/9] ARM: rpi: switch to DT probe and multi-image build
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (6 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 8/9] ARM: rpi: move debug UART base selection to Kconfig Lucas Stach
@ 2017-03-01 14:31 ` Lucas Stach
2017-03-02 8:11 ` [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2017-03-01 14:31 UTC (permalink / raw)
To: barebox
This commit switches the RaspberryPi arch over to probe Barebox
from the builtin DT and enables multi-image builds.
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
arch/arm/Kconfig | 30 +++++------
arch/arm/boards/raspberry-pi/lowlevel.c | 20 ++++++--
arch/arm/boards/raspberry-pi/rpi-common.c | 30 +++++------
arch/arm/configs/rpi2_defconfig | 72 ---------------------------
arch/arm/configs/rpi_defconfig | 5 +-
arch/arm/dts/Makefile | 2 +
arch/arm/dts/bcm2835-rpi.dts | 11 ++++
arch/arm/dts/bcm2836-rpi-2.dts | 11 ++++
arch/arm/mach-bcm283x/Kconfig | 9 ++--
arch/arm/mach-bcm283x/core.c | 15 +-----
arch/arm/mach-bcm283x/include/mach/core.h | 18 -------
arch/arm/mach-bcm283x/include/mach/platform.h | 25 ----------
images/Makefile | 1 +
images/Makefile.bcm283x | 11 ++++
14 files changed, 87 insertions(+), 173 deletions(-)
delete mode 100644 arch/arm/configs/rpi2_defconfig
create mode 100644 arch/arm/dts/bcm2835-rpi.dts
create mode 100644 arch/arm/dts/bcm2836-rpi-2.dts
create mode 100644 images/Makefile.bcm283x
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 559cac4016bd..6a4cdc12b1ad 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -19,16 +19,6 @@ config ARM_USE_COMPRESSED_DTB
select UNCOMPRESS
select LZO_DECOMPRESS
-config ARCH_BCM283X
- bool
- select GPIOLIB
- select CLKDEV_LOOKUP
- select COMMON_CLK
- select CLOCKSOURCE_BCM283X
- select ARM_AMBA
- select HAS_DEBUG_LL
- select RELOCATABLE
-
menu "System Type"
config BUILTIN_DTB
@@ -57,15 +47,19 @@ config ARCH_AT91
select HAVE_CLK
select PINCTRL_AT91
-config ARCH_BCM2835
- bool "Broadcom BCM2835 boards"
- select ARCH_BCM283X
- select CPU_ARM1176
-config ARCH_BCM2836
- bool "Broadcom BCM2836 boards"
- select ARCH_BCM283X
- select CPU_V7
+config ARCH_BCM283X
+ bool "Broadcom BCM283x based boards"
+ select GPIOLIB
+ select CLKDEV_LOOKUP
+ select COMMON_CLK
+ select CLOCKSOURCE_BCM283X
+ select ARM_AMBA
+ select HAS_DEBUG_LL
+ select RELOCATABLE
+ select OFTREE
+ select OFDEVICE
+ select HAVE_PBL_MULTI_IMAGES
config ARCH_CLPS711X
bool "Cirrus Logic EP711x/EP721x/EP731x"
diff --git a/arch/arm/boards/raspberry-pi/lowlevel.c b/arch/arm/boards/raspberry-pi/lowlevel.c
index 485171a11659..4e71e29e0c0b 100644
--- a/arch/arm/boards/raspberry-pi/lowlevel.c
+++ b/arch/arm/boards/raspberry-pi/lowlevel.c
@@ -4,8 +4,22 @@
#include <asm/barebox-arm-head.h>
#include <mach/platform.h>
-void __naked barebox_arm_reset_vector(void)
+extern char __dtb_bcm2835_rpi_start[];
+ENTRY_FUNCTION(start_raspberry_pi1, r0, r1, r2)
{
- arm_cpu_lowlevel_init();
- barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_128M, NULL);
+ void *fdt = __dtb_bcm2835_rpi_start - get_runtime_offset();
+
+ arm_cpu_lowlevel_init();
+
+ barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_128M, fdt);
+}
+
+extern char __dtb_bcm2836_rpi_2_start[];
+ENTRY_FUNCTION(start_raspberry_pi2, r0, r1, r2)
+{
+ void *fdt = __dtb_bcm2836_rpi_2_start - get_runtime_offset();
+
+ arm_cpu_lowlevel_init();
+
+ barebox_arm_entry(BCM2835_SDRAM_BASE, SZ_512M, fdt);
}
diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 331e6873bc49..6e375bc984de 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -73,10 +73,9 @@ static int rpi_get_arm_mem(u32 *size)
return 0;
}
-static int rpi_register_clkdev(u32 clock_id, const char *name)
+static struct clk *rpi_register_firmare_clock(u32 clock_id, const char *name)
{
BCM2835_MBOX_STACK_ALIGN(struct msg_get_clock_rate, msg);
- struct clk *clk;
int ret;
BCM2835_MBOX_INIT_HDR(msg);
@@ -85,16 +84,9 @@ static int rpi_register_clkdev(u32 clock_id, const char *name)
ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr);
if (ret)
- return ret;
+ return ERR_PTR(ret);
- clk = clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
- if (IS_ERR(clk))
- return PTR_ERR(clk);
-
- if (!clk_register_clkdev(clk, NULL, name))
- return -ENODEV;
-
- return 0;
+ return clk_fixed(name, msg->get_clock_rate.body.resp.rate_hz);
}
void rpi_set_usbethaddr(void)
@@ -280,19 +272,25 @@ mem_initcall(rpi_mem_init);
static int rpi_postcore_init(void)
{
- bcm2835_register_mbox();
-
rpi_get_board_rev();
barebox_set_hostname("rpi");
- bcm2835_register_uart();
return 0;
}
postcore_initcall(rpi_postcore_init);
static int rpi_clock_init(void)
{
- rpi_register_clkdev(BCM2835_MBOX_CLOCK_ID_EMMC, "bcm2835_mci0");
+ struct clk *clk;
+
+ clk = rpi_register_firmare_clock(BCM2835_MBOX_CLOCK_ID_EMMC,
+ "bcm2835_mci0");
+ if (IS_ERR(clk))
+ return PTR_ERR(clk);
+
+ clk_register_clkdev(clk, NULL, "20300000.sdhci");
+ clk_register_clkdev(clk, NULL, "3f300000.sdhci");
+
return 0;
}
postconsole_initcall(rpi_clock_init);
@@ -326,8 +324,6 @@ static int rpi_env_init(void)
static int rpi_devices_init(void)
{
rpi_model_init();
- bcm2835_register_wd();
- bcm2835_register_mci();
bcm2835_register_fb();
armlinux_set_architecture(MACH_TYPE_BCM2708);
rpi_env_init();
diff --git a/arch/arm/configs/rpi2_defconfig b/arch/arm/configs/rpi2_defconfig
deleted file mode 100644
index dbb31e62e21e..000000000000
--- a/arch/arm/configs/rpi2_defconfig
+++ /dev/null
@@ -1,72 +0,0 @@
-CONFIG_ARCH_BCM2836=y
-CONFIG_AEABI=y
-CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
-CONFIG_ARM_UNWIND=y
-CONFIG_MMU=y
-CONFIG_MALLOC_TLSF=y
-CONFIG_KALLSYMS=y
-CONFIG_PROMPT="R-Pi> "
-CONFIG_HUSH_FANCY_PROMPT=y
-CONFIG_CMDLINE_EDITING=y
-CONFIG_AUTO_COMPLETE=y
-CONFIG_MENU=y
-CONFIG_BOOTM_SHOW_TYPE=y
-CONFIG_BOOTM_VERBOSE=y
-CONFIG_BOOTM_INITRD=y
-CONFIG_BOOTM_OFTREE=y
-CONFIG_BLSPEC=y
-CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
-CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/raspberry-pi/env"
-CONFIG_LONGHELP=y
-CONFIG_CMD_IOMEM=y
-CONFIG_CMD_MEMINFO=y
-CONFIG_CMD_GO=y
-CONFIG_CMD_LOADB=y
-CONFIG_CMD_LOADY=y
-CONFIG_CMD_RESET=y
-CONFIG_CMD_UIMAGE=y
-CONFIG_CMD_PARTITION=y
-CONFIG_CMD_EXPORT=y
-CONFIG_CMD_PRINTENV=y
-CONFIG_CMD_MAGICVAR=y
-CONFIG_CMD_MAGICVAR_HELP=y
-CONFIG_CMD_SAVEENV=y
-CONFIG_CMD_FILETYPE=y
-CONFIG_CMD_LN=y
-CONFIG_CMD_MD5SUM=y
-CONFIG_CMD_UNCOMPRESS=y
-CONFIG_CMD_LET=y
-CONFIG_CMD_MSLEEP=y
-CONFIG_CMD_SLEEP=y
-CONFIG_CMD_ECHO_E=y
-CONFIG_CMD_EDIT=y
-CONFIG_CMD_LOGIN=y
-CONFIG_CMD_MENU=y
-CONFIG_CMD_MENU_MANAGEMENT=y
-CONFIG_CMD_PASSWD=y
-CONFIG_CMD_READLINE=y
-CONFIG_CMD_TIMEOUT=y
-CONFIG_CMD_CRC=y
-CONFIG_CMD_CRC_CMP=y
-CONFIG_CMD_MM=y
-CONFIG_CMD_CLK=y
-CONFIG_CMD_DETECT=y
-CONFIG_CMD_GPIO=y
-CONFIG_CMD_OF_NODE=y
-CONFIG_CMD_OF_PROPERTY=y
-CONFIG_CMD_OFTREE=y
-CONFIG_CMD_TIME=y
-CONFIG_SERIAL_AMBA_PL011=y
-CONFIG_MCI=y
-CONFIG_MCI_BCM283X=y
-CONFIG_LED=y
-CONFIG_LED_GPIO=y
-CONFIG_LED_TRIGGERS=y
-CONFIG_GPIO_BCM283X=y
-CONFIG_REGULATOR=y
-CONFIG_FS_EXT4=y
-CONFIG_FS_FAT=y
-CONFIG_FS_FAT_WRITE=y
-CONFIG_FS_FAT_LFN=y
-CONFIG_DIGEST_SHA1_GENERIC=y
-CONFIG_DIGEST_SHA256_GENERIC=y
diff --git a/arch/arm/configs/rpi_defconfig b/arch/arm/configs/rpi_defconfig
index 386522dcd33b..6dc90c59b36d 100644
--- a/arch/arm/configs/rpi_defconfig
+++ b/arch/arm/configs/rpi_defconfig
@@ -1,4 +1,6 @@
-CONFIG_ARCH_BCM2835=y
+CONFIG_ARCH_BCM283X=y
+CONFIG_MACH_RPI=y
+CONFIG_MACH_RPI2=y
CONFIG_AEABI=y
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_UNWIND=y
@@ -63,6 +65,7 @@ CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_TRIGGERS=y
CONFIG_GPIO_BCM283X=y
+# CONFIG_PINCTRL is not set
CONFIG_REGULATOR=y
CONFIG_FS_EXT4=y
CONFIG_FS_FAT=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 70359d8242a5..0c9e0e8dadb9 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -58,6 +58,8 @@ pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o
pbl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
+pbl-dtb-$(CONFIG_MACH_RPI) += bcm2835-rpi.dtb.o
+pbl-dtb-$(CONFIG_MACH_RPI2) += bcm2836-rpi-2.dtb.o
pbl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
pbl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
pbl-dtb-$(CONFIG_MACH_FREESCALE_IMX6SX_SABRESDB) += imx6sx-sdb.dtb.o
diff --git a/arch/arm/dts/bcm2835-rpi.dts b/arch/arm/dts/bcm2835-rpi.dts
new file mode 100644
index 000000000000..0095f58a3ce8
--- /dev/null
+++ b/arch/arm/dts/bcm2835-rpi.dts
@@ -0,0 +1,11 @@
+#include <arm/bcm2835-rpi-a.dts>
+
+/ {
+ chosen {
+ stdout-path = &uart0;
+ };
+
+ memory {
+ reg = <0x0 0x0>;
+ };
+};
diff --git a/arch/arm/dts/bcm2836-rpi-2.dts b/arch/arm/dts/bcm2836-rpi-2.dts
new file mode 100644
index 000000000000..42b6abb180de
--- /dev/null
+++ b/arch/arm/dts/bcm2836-rpi-2.dts
@@ -0,0 +1,11 @@
+#include <arm/bcm2836-rpi-2-b.dts>
+
+/ {
+ chosen {
+ stdout-path = &uart0;
+ };
+
+ memory {
+ reg = <0x0 0x0>;
+ };
+};
diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig
index bb4fe95ab2f1..1457f114ccaa 100644
--- a/arch/arm/mach-bcm283x/Kconfig
+++ b/arch/arm/mach-bcm283x/Kconfig
@@ -7,20 +7,19 @@ config ARCH_TEXT_BASE
config MACH_RPI_COMMON
bool
-choice
- prompt "Broadcom Board type"
+menu "select Broadcom BCM283X boards to be built"
config MACH_RPI
bool "RaspberryPi (BCM2835/ARM1176JZF-S)"
- depends on ARCH_BCM2835
+ select CPU_V6
select MACH_RPI_COMMON
config MACH_RPI2
bool "RaspberryPi 2 (BCM2836/CORTEX-A7)"
- depends on ARCH_BCM2836
+ select CPU_V7
select MACH_RPI_COMMON
-endchoice
+endmenu
config MACH_RPI_DEBUG_UART_BASE
hex
diff --git a/arch/arm/mach-bcm283x/core.c b/arch/arm/mach-bcm283x/core.c
index 3319ad63c3d7..fddcb0d1a1d4 100644
--- a/arch/arm/mach-bcm283x/core.c
+++ b/arch/arm/mach-bcm283x/core.c
@@ -40,21 +40,15 @@ static int bcm2835_clk_init(void)
clk = clk_fixed("uart0-pl0110", 3 * 1000 * 1000);
clk_register_clkdev(clk, NULL, "uart0-pl0110");
+ clk_register_clkdev(clk, NULL, "20201000.serial");
clk = clk_fixed("bcm2835-cs", 1 * 1000 * 1000);
clk_register_clkdev(clk, NULL, "bcm2835-cs");
- add_generic_device("bcm2835-cs", DEVICE_ID_SINGLE, NULL, BCM2835_ST_BASE, 0x1C, IORESOURCE_MEM, NULL);
-
return 0;
}
postcore_initcall(bcm2835_clk_init);
-void bcm2835_register_uart(void)
-{
- amba_apb_device_add(NULL, "uart0-pl011", 0, BCM2835_UART0_BASE, 4096, NULL, 0);
-}
-
void bcm2835_add_device_sdram(u32 size)
{
if (!size)
@@ -62,10 +56,3 @@ void bcm2835_add_device_sdram(u32 size)
arm_add_mem_device("ram0", BCM2835_SDRAM_BASE, size);
}
-
-static int bcm2835_dev_init(void)
-{
- add_generic_device("bcm2835-gpio", 0, NULL, BCM2835_GPIO_BASE, 0xB0, IORESOURCE_MEM, NULL);
- return 0;
-}
-coredevice_initcall(bcm2835_dev_init);
diff --git a/arch/arm/mach-bcm283x/include/mach/core.h b/arch/arm/mach-bcm283x/include/mach/core.h
index 5edd99efa25f..a1c47f915448 100644
--- a/arch/arm/mach-bcm283x/include/mach/core.h
+++ b/arch/arm/mach-bcm283x/include/mach/core.h
@@ -18,29 +18,11 @@
#include <mach/platform.h>
-void bcm2835_register_uart(void);
void bcm2835_add_device_sdram(u32 size);
-static void inline bcm2835_register_mci(void)
-{
- add_generic_device("bcm2835_mci", 0, NULL, BCM2835_EMMC_BASE, 0xFC,
- IORESOURCE_MEM, NULL);
-}
-
static void inline bcm2835_register_fb(void)
{
add_generic_device("bcm2835_fb", 0, NULL, 0, 0, 0, NULL);
}
-static void inline bcm2835_register_mbox(void)
-{
- add_generic_device("bcm2835_mbox", 0, NULL, BCM2835_MBOX_BASE, 0x40,
- IORESOURCE_MEM, NULL);
-}
-static void inline bcm2835_register_wd(void)
-{
- add_generic_device("bcm2835_wd", 0, NULL, BCM2835_PM_BASE, 0x28,
- IORESOURCE_MEM, NULL);
-}
-
#endif
diff --git a/arch/arm/mach-bcm283x/include/mach/platform.h b/arch/arm/mach-bcm283x/include/mach/platform.h
index 09fe78fd41f6..80b529a46fe5 100644
--- a/arch/arm/mach-bcm283x/include/mach/platform.h
+++ b/arch/arm/mach-bcm283x/include/mach/platform.h
@@ -28,32 +28,7 @@
* This file is manually generated.
*/
-#ifdef CONFIG_ARCH_BCM2835
-#define BCM2835_PERI_BASE 0x20000000
-#define BCM2835_CACHELINE_SIZE 32
-#elif defined CONFIG_ARCH_BCM2836
-#define BCM2835_PERI_BASE 0x3f000000
#define BCM2835_CACHELINE_SIZE 64
-#else
-#error "no CONFIG_ARCH_BCM283X defined"
-#endif
-
-#define BCM2835_ST_BASE (BCM2835_PERI_BASE + 0x3000) /* System Timer */
-#define BCM2835_DMA_BASE (BCM2835_PERI_BASE + 0x7000) /* DMA controller */
-#define BCM2835_ARM_BASE (BCM2835_PERI_BASE + 0xB000) /* BCM2708 ARM control block */
-#define BCM2835_MBOX_BASE (BCM2835_ARM_BASE + 0x880) /* BCM2835 mailbox */
-#define BCM2835_PM_BASE (BCM2835_PERI_BASE + 0x100000) /* Power Management, Reset controller and Watchdog registers */
-#define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000) /* GPIO */
-#define BCM2835_UART0_BASE (BCM2835_PERI_BASE + 0x201000) /* Uart 0 */
-#define BCM2835_MMCI0_BASE (BCM2835_PERI_BASE + 0x202000) /* MMC interface */
-#define BCM2835_SPI0_BASE (BCM2835_PERI_BASE + 0x204000) /* SPI0 */
-#define BCM2835_BSC0_BASE (BCM2835_PERI_BASE + 0x205000) /* BSC0 I2C/TWI */
-#define BCM2835_UART1_BASE (BCM2835_PERI_BASE + 0x215000) /* Uart 1 */
-#define BCM2835_EMMC_BASE (BCM2835_PERI_BASE + 0x300000) /* eMMC interface */
-#define BCM2835_SMI_BASE (BCM2835_PERI_BASE + 0x600000) /* SMI */
-#define BCM2835_BSC1_BASE (BCM2835_PERI_BASE + 0x804000) /* BSC1 I2C/TWI */
-#define BCM2835_USB_BASE (BCM2835_PERI_BASE + 0x980000) /* DTC_OTG USB controller */
-#define BCM2835_MCORE_BASE (BCM2835_PERI_BASE + 0x0000) /* Fake frame buffer device (actually the multicore sync block*/
#endif
diff --git a/images/Makefile b/images/Makefile
index 0537af1f6d9f..68876e5de97e 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -103,6 +103,7 @@ board = $(srctree)/arch/$(ARCH)/boards
objboard = $(objtree)/arch/$(ARCH)/boards
include $(srctree)/images/Makefile.am33xx
+include $(srctree)/images/Makefile.bcm283x
include $(srctree)/images/Makefile.imx
include $(srctree)/images/Makefile.mvebu
include $(srctree)/images/Makefile.mxs
diff --git a/images/Makefile.bcm283x b/images/Makefile.bcm283x
new file mode 100644
index 000000000000..d59ef043f05c
--- /dev/null
+++ b/images/Makefile.bcm283x
@@ -0,0 +1,11 @@
+#
+# barebox image generation Makefile for BCM283x images
+#
+
+pblx-$(CONFIG_MACH_RPI) += start_raspberry_pi1
+FILE_barebox-raspberry-pi-1.img = start_raspberry_pi1.pblx
+image-$(CONFIG_MACH_RPI) += barebox-raspberry-pi-1.img
+
+pblx-$(CONFIG_MACH_RPI2) += start_raspberry_pi2
+FILE_barebox-raspberry-pi-2.img = start_raspberry_pi2.pblx
+image-$(CONFIG_MACH_RPI2) += barebox-raspberry-pi-2.img
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common
2017-03-01 14:31 [PATCH 1/9] ARM: rpi: move model initialisation to rpi-common Lucas Stach
` (7 preceding siblings ...)
2017-03-01 14:31 ` [PATCH 9/9] ARM: rpi: switch to DT probe and multi-image build Lucas Stach
@ 2017-03-02 8:11 ` Sascha Hauer
8 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2017-03-02 8:11 UTC (permalink / raw)
To: Lucas Stach; +Cc: barebox
On Wed, Mar 01, 2017 at 03:31:29PM +0100, Lucas Stach wrote:
> From: Enrico Joerns <ejo@pengutronix.de>
>
> The Raspberry PIs use different versions schemes for the older and newer
> variants. The decoding arrays for these schemes were split up in rpi.c
> and rpi2.c. This is not required, as the appropriate versioning scheme
> can be determined programmatically.
>
> Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
> lst: remove SoC string
> ---
> arch/arm/boards/raspberry-pi/Makefile | 2 --
> arch/arm/boards/raspberry-pi/rpi-common.c | 57 ++++++++++++++++++++++++++-----
> arch/arm/boards/raspberry-pi/rpi.c | 44 ------------------------
> arch/arm/boards/raspberry-pi/rpi.h | 3 --
> arch/arm/boards/raspberry-pi/rpi2.c | 21 ------------
> 5 files changed, 48 insertions(+), 79 deletions(-)
> delete mode 100644 arch/arm/boards/raspberry-pi/rpi.c
> delete mode 100644 arch/arm/boards/raspberry-pi/rpi2.c
Applied, thanks
Sascha
>
> diff --git a/arch/arm/boards/raspberry-pi/Makefile b/arch/arm/boards/raspberry-pi/Makefile
> index 7a3d7de241f0..a3e93eb73a32 100644
> --- a/arch/arm/boards/raspberry-pi/Makefile
> +++ b/arch/arm/boards/raspberry-pi/Makefile
> @@ -1,4 +1,2 @@
> obj-$(CONFIG_MACH_RPI_COMMON) += rpi-common.o
> -obj-$(CONFIG_MACH_RPI) += rpi.o
> -obj-$(CONFIG_MACH_RPI2) += rpi2.o
> lwl-y += lowlevel.o
> diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
> index 147fce9952ab..7441c06437dd 100644
> --- a/arch/arm/boards/raspberry-pi/rpi-common.c
> +++ b/arch/arm/boards/raspberry-pi/rpi-common.c
> @@ -146,6 +146,13 @@ void rpi_add_led(void)
> led_set_trigger(LED_TRIGGER_HEARTBEAT, &l->led);
> }
>
> +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)
> {
> rpi_leds[0].gpio = 47;
> @@ -153,12 +160,39 @@ void rpi_b_plus_init(void)
> rpi_set_usbethaddr();
> }
>
> +/* See comments in mbox.h for data source */
> +const struct rpi_model rpi_models_old_scheme[] = {
> + RPI_MODEL(0, "Unknown model", NULL),
> + RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_2, "Model B (no P5)", rpi_b_init),
> + RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_3, "Model B (no P5)", rpi_b_init),
> + RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_4, "Model B", rpi_b_init),
> + RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_5, "Model B", rpi_b_init),
> + RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_6, "Model B", rpi_b_init),
> + RPI_MODEL(BCM2835_BOARD_REV_A_7, "Model A", NULL),
> + RPI_MODEL(BCM2835_BOARD_REV_A_8, "Model A", NULL),
> + RPI_MODEL(BCM2835_BOARD_REV_A_9, "Model A", NULL),
> + 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),
> +};
> +
> +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),
> +};
> +
> static int rpi_board_rev = 0;
> +const struct rpi_model *model;
>
> static void rpi_get_board_rev(void)
> {
> int ret;
> char *name;
> + const struct rpi_model *rpi_models;
> + size_t rpi_models_size;
>
> BCM2835_MBOX_STACK_ALIGN(struct msg_get_board_rev, msg);
> BCM2835_MBOX_INIT_HDR(msg);
> @@ -183,10 +217,17 @@ static void rpi_get_board_rev(void)
> * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
> */
> rpi_board_rev = msg->get_board_rev.body.resp.rev;
> - if (rpi_board_rev & 0x800000)
> + if (rpi_board_rev & 0x800000) {
> rpi_board_rev = (rpi_board_rev >> 4) & 0xff;
> - else
> + rpi_models = rpi_models_new_scheme;
> + rpi_models_size = ARRAY_SIZE(rpi_models_new_scheme);
> +
> + } else {
> rpi_board_rev &= 0xff;
> + rpi_models = rpi_models_old_scheme;
> + rpi_models_size = ARRAY_SIZE(rpi_models_old_scheme);
> + }
> +
> if (rpi_board_rev >= rpi_models_size) {
> printf("RPI: Board rev %u outside known range\n",
> rpi_board_rev);
> @@ -201,8 +242,8 @@ static void rpi_get_board_rev(void)
> if (!rpi_board_rev)
> goto unknown_rev;
>
> - name = basprintf("RaspberryPi %s %s",
> - rpi_models[rpi_board_rev].name, rpi_model_string);
> + model = &rpi_models[rpi_board_rev];
> + name = basprintf("RaspberryPi %s", model->name);
> barebox_set_model(name);
> free(name);
>
> @@ -210,17 +251,15 @@ static void rpi_get_board_rev(void)
>
> unknown_rev:
> rpi_board_rev = 0;
> - name = basprintf("RaspberryPi %s", rpi_model_string);
> - barebox_set_model(name);
> - free(name);
> + barebox_set_model("RaspberryPi (unknown rev)");
> }
>
> static void rpi_model_init(void)
> {
> - if (!rpi_models[rpi_board_rev].init)
> + if (!model->init)
> return;
>
> - rpi_models[rpi_board_rev].init();
> + model->init();
> rpi_add_led();
> }
>
> diff --git a/arch/arm/boards/raspberry-pi/rpi.c b/arch/arm/boards/raspberry-pi/rpi.c
> deleted file mode 100644
> index dd2ad7f5a519..000000000000
> --- a/arch/arm/boards/raspberry-pi/rpi.c
> +++ /dev/null
> @@ -1,44 +0,0 @@
> -/*
> - * Copyright (C) 2009 Carlo Caione <carlo@carlocaione.org>
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> -#include "rpi.h"
> -
> -static void rpi_b_init(void)
> -{
> - rpi_leds[0].gpio = 16;
> - rpi_leds[0].active_low = 1;
> - rpi_set_usbethaddr();
> -}
> -
> -/* See comments in mbox.h for data source */
> -const struct rpi_model rpi_models[] = {
> - RPI_MODEL(0, "Unknown model", NULL),
> - RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_2, "Model B (no P5)", rpi_b_init),
> - RPI_MODEL(BCM2835_BOARD_REV_B_I2C0_3, "Model B (no P5)", rpi_b_init),
> - RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_4, "Model B", rpi_b_init),
> - RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_5, "Model B", rpi_b_init),
> - RPI_MODEL(BCM2835_BOARD_REV_B_I2C1_6, "Model B", rpi_b_init),
> - RPI_MODEL(BCM2835_BOARD_REV_A_7, "Model A", NULL),
> - RPI_MODEL(BCM2835_BOARD_REV_A_8, "Model A", NULL),
> - RPI_MODEL(BCM2835_BOARD_REV_A_9, "Model A", NULL),
> - 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),
> -};
> -const size_t rpi_models_size = ARRAY_SIZE(rpi_models);
> -const char *rpi_model_string = "(BCM2835/ARM1176JZF-S)";
> diff --git a/arch/arm/boards/raspberry-pi/rpi.h b/arch/arm/boards/raspberry-pi/rpi.h
> index 739cdee1b3ae..dd32fee80950 100644
> --- a/arch/arm/boards/raspberry-pi/rpi.h
> +++ b/arch/arm/boards/raspberry-pi/rpi.h
> @@ -17,9 +17,6 @@ struct rpi_model {
> void (*init)(void);
> };
>
> -extern const struct rpi_model rpi_models[];
> -extern const size_t rpi_models_size;
> -extern const char *rpi_model_string;
> extern struct gpio_led rpi_leds[];
>
> void rpi_b_plus_init(void);
> diff --git a/arch/arm/boards/raspberry-pi/rpi2.c b/arch/arm/boards/raspberry-pi/rpi2.c
> deleted file mode 100644
> index 2cfc06f8a6a9..000000000000
> --- a/arch/arm/boards/raspberry-pi/rpi2.c
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -/*
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of
> - * the License, or (at your option) any later version.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> - * GNU General Public License for more details.
> - *
> - */
> -
> -#include "rpi.h"
> -
> -const struct rpi_model rpi_models[] = {
> - RPI_MODEL(0, "Unknown model", NULL),
> - RPI_MODEL(BCM2836_BOARD_REV_2_B, "2 Model B", rpi_b_plus_init),
> -};
> -const size_t rpi_models_size = ARRAY_SIZE(rpi_models);
> -const char *rpi_model_string = "(BCM2836/CORTEX-A7)";
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 10+ messages in thread