diff mbox

[U-Boot,1/2] ARM: add basic support for the Broadcom BCM2835 SoC

Message ID 1339047925-29052-1-git-send-email-swarren@wwwdotorg.org
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Stephen Warren June 7, 2012, 5:45 a.m. UTC
This SoC is used in the Raspberry Pi, for example.

Initial support is enough to boot to a serial console, and execute a
minimal set of U-Boot commands. No drivers are implemented. For more
details, see http://www.broadcom.com/products/BCM2835 or
http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
 arch/arm/cpu/arm1176/bcm2835/Makefile        |   37 +++++++++++++++++
 arch/arm/cpu/arm1176/bcm2835/config.mk       |   19 +++++++++
 arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S |   19 +++++++++
 arch/arm/cpu/arm1176/bcm2835/reset.c         |   27 +++++++++++++
 arch/arm/cpu/arm1176/bcm2835/timer.c         |   55 ++++++++++++++++++++++++++
 arch/arm/include/asm/arch-bcm2835/timer.h    |   37 +++++++++++++++++
 6 files changed, 194 insertions(+)
 create mode 100644 arch/arm/cpu/arm1176/bcm2835/Makefile
 create mode 100644 arch/arm/cpu/arm1176/bcm2835/config.mk
 create mode 100644 arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S
 create mode 100644 arch/arm/cpu/arm1176/bcm2835/reset.c
 create mode 100644 arch/arm/cpu/arm1176/bcm2835/timer.c
 create mode 100644 arch/arm/include/asm/arch-bcm2835/timer.h

Comments

Stephen Warren June 16, 2012, 3:52 a.m. UTC | #1
On 06/06/2012 11:45 PM, Stephen Warren wrote:
> This SoC is used in the Raspberry Pi, for example.
> 
> Initial support is enough to boot to a serial console, and execute a
> minimal set of U-Boot commands. No drivers are implemented. For more
> details, see http://www.broadcom.com/products/BCM2835 or
> http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf.

Albert,

Do these patches look good? I'm assuming you do accept direct patch
emails, and aren't waiting for this to be part of a pull request or
anything like that?

Oleksandr Tymoshenko reports that he now has a working U-Boot USB driver
for this SoC/board, so the port will soon be quite practically useful.

Thanks.
Stephen Warren June 21, 2012, 10:26 p.m. UTC | #2
On 06/06/2012 11:45 PM, Stephen Warren wrote:
> This SoC is used in the Raspberry Pi, for example.
> 
> Initial support is enough to boot to a serial console, and execute a
> minimal set of U-Boot commands. No drivers are implemented. For more
> details, see http://www.broadcom.com/products/BCM2835 or
> http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>

Albert, per your request to remind you about patches in your backlog,
there is this series.

BTW, I expect quite a few more patches to come in for the RPi; I already
have a bunch of small tweaks queued up and I know there's a USB driver
that works and hopefully will be sent soon. Should I be sending pull
requests for these instead to ease your work? Do you take pull requests
from git repos not on denx.de?

Thanks.
Albert ARIBAUD June 22, 2012, 5:05 a.m. UTC | #3
Hi Stephen,

On Thu, 21 Jun 2012 16:26:56 -0600, Stephen Warren
<swarren@wwwdotorg.org> wrote:
> On 06/06/2012 11:45 PM, Stephen Warren wrote:
> > This SoC is used in the Raspberry Pi, for example.
> > 
> > Initial support is enough to boot to a serial console, and execute a
> > minimal set of U-Boot commands. No drivers are implemented. For more
> > details, see http://www.broadcom.com/products/BCM2835 or
> > http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf.
> > 
> > Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> 
> Albert, per your request to remind you about patches in your backlog,
> there is this series.

I've marked the series as assigned to me and under review. IIUC, it is
from June 7, so after the merge window closing, and will thus get in the
next branch.

> BTW, I expect quite a few more patches to come in for the RPi; I
> already have a bunch of small tweaks queued up and I know there's a
> USB driver that works and hopefully will be sent soon. Should I be
> sending pull requests for these instead to ease your work? Do you
> take pull requests from git repos not on denx.de?
> 
> Thanks.

I am sorry, I will not take in pull requests from any other repo than a
custodian's one. Please point me to individual patches -- ideally as
patchwork URLS.

Amicalement,
Stephen Warren June 22, 2012, 4:23 p.m. UTC | #4
On 06/21/2012 11:05 PM, Albert ARIBAUD wrote:
> Hi Stephen,
> 
> On Thu, 21 Jun 2012 16:26:56 -0600, Stephen Warren
> <swarren@wwwdotorg.org> wrote:
>> On 06/06/2012 11:45 PM, Stephen Warren wrote:
>>> This SoC is used in the Raspberry Pi, for example.
>>>
>>> Initial support is enough to boot to a serial console, and execute a
>>> minimal set of U-Boot commands. No drivers are implemented. For more
>>> details, see http://www.broadcom.com/products/BCM2835 or
>>> http://www.raspberrypi.org/wp-content/uploads/2012/02/BCM2835-ARM-Peripherals.pdf.
>>>
>>> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
>>
>> Albert, per your request to remind you about patches in your backlog,
>> there is this series.
> 
> I've marked the series as assigned to me and under review. IIUC, it is
> from June 7, so after the merge window closing, and will thus get in the
> next branch.

OK, great.

>> BTW, I expect quite a few more patches to come in for the RPi; I
>> already have a bunch of small tweaks queued up and I know there's a
>> USB driver that works and hopefully will be sent soon. Should I be
>> sending pull requests for these instead to ease your work? Do you
>> take pull requests from git repos not on denx.de?
>>
>> Thanks.
> 
> I am sorry, I will not take in pull requests from any other repo than a
> custodian's one. Please point me to individual patches -- ideally as
> patchwork URLS.

I haven't yet posted any patches other than the two you've assigned as
mentioned above; I was waiting for those two to be merged first. Perhaps
I should set up a custodian git repo to house them.
Wolfgang Denk June 22, 2012, 4:34 p.m. UTC | #5
Dear Stephen Warren,

In message <4FE49BEB.1090100@wwwdotorg.org> you wrote:
>
> I haven't yet posted any patches other than the two you've assigned as
> mentioned above; I was waiting for those two to be merged first. Perhaps
> I should set up a custodian git repo to house them.

You misunderstand.  A custodian repo is nothing you can set up
yourself.

Please read the docs, especially
http://www.denx.de/wiki/U-Boot/Patches

It is _mandatory_ that all patches get posted here.

Best regards,

Wolfgang Denk
Stephen Warren June 22, 2012, 4:36 p.m. UTC | #6
On 06/22/2012 10:34 AM, Wolfgang Denk wrote:
> Dear Stephen Warren,
> 
> In message <4FE49BEB.1090100@wwwdotorg.org> you wrote:
>>
>> I haven't yet posted any patches other than the two you've assigned as
>> mentioned above; I was waiting for those two to be merged first. Perhaps
>> I should set up a custodian git repo to house them.
> 
> You misunderstand.  A custodian repo is nothing you can set up
> yourself.

No, I don't misunderstand at all. By "set up" I simply meant to follow
the process to obtain one; I didn't mean to create one myself.
Wolfgang Denk June 22, 2012, 5:14 p.m. UTC | #7
Dear Stephen Warren,

In message <4FE49EF4.3040706@wwwdotorg.org> you wrote:
>
> >> I haven't yet posted any patches other than the two you've assigned as
> >> mentioned above; I was waiting for those two to be merged first. Perhaps
> >> I should set up a custodian git repo to house them.
> > 
> > You misunderstand.  A custodian repo is nothing you can set up
> > yourself.
> 
> No, I don't misunderstand at all. By "set up" I simply meant to follow
> the process to obtain one; I didn't mean to create one myself.

For which sub-system to you volunteer to become the custodian?

Best regards,

Wolfgang Denk
Stephen Warren June 22, 2012, 5:29 p.m. UTC | #8
On 06/22/2012 11:14 AM, Wolfgang Denk wrote:
> Dear Stephen Warren,
> 
> In message <4FE49EF4.3040706@wwwdotorg.org> you wrote:
>>
>>>> I haven't yet posted any patches other than the two you've assigned as
>>>> mentioned above; I was waiting for those two to be merged first. Perhaps
>>>> I should set up a custodian git repo to house them.
>>>
>>> You misunderstand.  A custodian repo is nothing you can set up
>>> yourself.
>>
>> No, I don't misunderstand at all. By "set up" I simply meant to follow
>> the process to obtain one; I didn't mean to create one myself.
> 
> For which sub-system to you volunteer to become the custodian?

The BCM2835 ARM sub-architecture, as used in the Raspberry Pi.
Tom Rini June 22, 2012, 5:34 p.m. UTC | #9
On Fri, Jun 22, 2012 at 11:29:43AM -0600, Stephen Warren wrote:
> On 06/22/2012 11:14 AM, Wolfgang Denk wrote:
> > Dear Stephen Warren,
> > 
> > In message <4FE49EF4.3040706@wwwdotorg.org> you wrote:
> >>
> >>>> I haven't yet posted any patches other than the two you've assigned as
> >>>> mentioned above; I was waiting for those two to be merged first. Perhaps
> >>>> I should set up a custodian git repo to house them.
> >>>
> >>> You misunderstand.  A custodian repo is nothing you can set up
> >>> yourself.
> >>
> >> No, I don't misunderstand at all. By "set up" I simply meant to follow
> >> the process to obtain one; I didn't mean to create one myself.
> > 
> > For which sub-system to you volunteer to become the custodian?
> 
> The BCM2835 ARM sub-architecture, as used in the Raspberry Pi.

What Wolfgang is driving at, I believe, is that there's a threshold for
getting a custodian tree hosted on denx, as opposed to hosting $wherever
and using send-email and so forth, which is always required (since all
patches must be posted).
Wolfgang Denk June 22, 2012, 6:18 p.m. UTC | #10
Dear Stephen Warren,

In message <4FE4AB87.1030500@wwwdotorg.org> you wrote:
>
> > For which sub-system to you volunteer to become the custodian?
> 
> The BCM2835 ARM sub-architecture, as used in the Raspberry Pi.

I see no reason to install a new custodian just for a single SoC.

Best regards,

Wolfgang Denk
Stephen Warren June 22, 2012, 6:30 p.m. UTC | #11
On 06/22/2012 12:18 PM, Wolfgang Denk wrote:
> Dear Stephen Warren,
> 
> In message <4FE4AB87.1030500@wwwdotorg.org> you wrote:
>>
>>> For which sub-system to you volunteer to become the custodian?
>>
>> The BCM2835 ARM sub-architecture, as used in the Raspberry Pi.
> 
> I see no reason to install a new custodian just for a single SoC.

OK, that's fine; I'll rely solely on patch email then. I just figured on
saving Albert some git am work, seeing as how many other single SoCs are
handled via git pull already.
Wolfgang Denk June 22, 2012, 9:58 p.m. UTC | #12
Dear Stephen Warren,

In message <4FE4B9C2.3050001@wwwdotorg.org> you wrote:
>
> OK, that's fine; I'll rely solely on patch email then. I just figured on
> saving Albert some git am work, seeing as how many other single SoCs are
> handled via git pull already.

Are there?  Which for example?

Best regards,

Wolfgang Denk
Stephen Warren June 22, 2012, 11:18 p.m. UTC | #13
On 06/22/2012 03:58 PM, Wolfgang Denk wrote:
> Dear Stephen Warren,
> 
> In message <4FE4B9C2.3050001@wwwdotorg.org> you wrote:
>>
>> OK, that's fine; I'll rely solely on patch email then. I just figured on
>> saving Albert some git am work, seeing as how many other single SoCs are
>> handled via git pull already.
> 
> Are there?  Which for example?

Tegra does this for sure. There are also u-boot-ti.git,
u-boot-samsung.git, and u-boot-marvell.git that I believe are for the
same purpose.
Wolfgang Denk June 22, 2012, 11:28 p.m. UTC | #14
Dear Stephen Warren,

In message <4FE4FD2F.4010703@wwwdotorg.org> you wrote:
>
> >> OK, that's fine; I'll rely solely on patch email then. I just figured on
> >> saving Albert some git am work, seeing as how many other single SoCs are
> >> handled via git pull already.
> > 
> > Are there?  Which for example?
> 
> Tegra does this for sure. There are also u-boot-ti.git,
> u-boot-samsung.git, and u-boot-marvell.git that I believe are for the
> same purpose.

All these handle a number of processors - note that (with the
exception of tegra) these are explicitly named as vendor trees,
collingting all processors from some silicon vendors.  Have a closer
look at the imx (Freescale) or TI or Samsung or Marvell trees - all
these handle a pretty large number of different SoCs.

We can discuss to add a Broadcom repository one day - but only after
it turns out that there is sufficiently large traffic here on the
list to justify another split.  Given that Broadcom has essentially
zero coverage in mainline U-Boot, there is some way to go before we
reach such a point.

Just for a single SoC it makes no sense to set up a new custodian
tree.

Best regards,

Wolfgang Denk
Tom Rini June 22, 2012, 11:31 p.m. UTC | #15
On Fri, Jun 22, 2012 at 05:18:07PM -0600, Stephen Warren wrote:
> On 06/22/2012 03:58 PM, Wolfgang Denk wrote:
> > Dear Stephen Warren,
> > 
> > In message <4FE4B9C2.3050001@wwwdotorg.org> you wrote:
> >>
> >> OK, that's fine; I'll rely solely on patch email then. I just figured on
> >> saving Albert some git am work, seeing as how many other single SoCs are
> >> handled via git pull already.
> > 
> > Are there?  Which for example?
> 
> Tegra does this for sure. There are also u-boot-ti.git,
> u-boot-samsung.git, and u-boot-marvell.git that I believe are for the
> same purpose.

u-boot-ti covers omap3 (and derrivatives), omap4, omap5, am33xx and
davinci SoCs.  u-boot-samsung also covers a handful of SoCs (at least 3
by a quick count).  kirkwood (marvell) also has a number of boards.  I
think u-boot-tegra is probably the smallest example but that's still 6
boards (and another SoC family trying to get in).  Once BCM2835 (or
BCM283x or BCM28xx or whatever the generic name would be) reaches that
threshold, I imagine Wolfgang would see the need for a custodian
repository.
diff mbox

Patch

diff --git a/arch/arm/cpu/arm1176/bcm2835/Makefile b/arch/arm/cpu/arm1176/bcm2835/Makefile
new file mode 100644
index 0000000..4ea6d6b
--- /dev/null
+++ b/arch/arm/cpu/arm1176/bcm2835/Makefile
@@ -0,0 +1,37 @@ 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 as published by the Free Software Foundation.
+#
+# 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 $(TOPDIR)/config.mk
+
+LIB	= $(obj)lib$(SOC).o
+
+SOBJS	:= lowlevel_init.o
+COBJS	:= reset.o timer.o
+
+SRCS	:= $(SOBJS:.o=.c) $(COBJS:.o=.c)
+OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
+
+all:	$(obj).depend $(LIB)
+
+$(LIB):	$(OBJS)
+	$(call cmd_link_o_target, $(OBJS))
+
+#########################################################################
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#########################################################################
diff --git a/arch/arm/cpu/arm1176/bcm2835/config.mk b/arch/arm/cpu/arm1176/bcm2835/config.mk
new file mode 100644
index 0000000..b87ce24
--- /dev/null
+++ b/arch/arm/cpu/arm1176/bcm2835/config.mk
@@ -0,0 +1,19 @@ 
+#
+# (C) Copyright 2012 Stephen Warren
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# version 2 as published by the Free Software Foundation.
+#
+# 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.
+
+# Don't attempt to override the target CPU/ABI options;
+# the Raspberry Pi toolchain does the right thing by default.
+PLATFORM_RELFLAGS := $(filter-out -msoft-float,$(PLATFORM_RELFLAGS))
+PLATFORM_CPPFLAGS := $(filter-out -march=armv5t,$(PLATFORM_CPPFLAGS))
diff --git a/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S b/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S
new file mode 100644
index 0000000..c7b0843
--- /dev/null
+++ b/arch/arm/cpu/arm1176/bcm2835/lowlevel_init.S
@@ -0,0 +1,19 @@ 
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+.globl lowlevel_init
+lowlevel_init:
+	mov	pc, lr
diff --git a/arch/arm/cpu/arm1176/bcm2835/reset.c b/arch/arm/cpu/arm1176/bcm2835/reset.c
new file mode 100644
index 0000000..69c9577
--- /dev/null
+++ b/arch/arm/cpu/arm1176/bcm2835/reset.c
@@ -0,0 +1,27 @@ 
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 <asm/io.h>
+
+void reset_cpu(ulong addr)
+{
+	/*
+	 * We should probably use the WDT module here, but an unaligned
+	 * access will do the trick for now.
+	 */
+	readl(1);
+}
diff --git a/arch/arm/cpu/arm1176/bcm2835/timer.c b/arch/arm/cpu/arm1176/bcm2835/timer.c
new file mode 100644
index 0000000..d232d7e
--- /dev/null
+++ b/arch/arm/cpu/arm1176/bcm2835/timer.c
@@ -0,0 +1,55 @@ 
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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 <asm/io.h>
+#include <asm/arch/timer.h>
+
+int timer_init(void)
+{
+	return 0;
+}
+
+ulong get_timer(ulong base)
+{
+	struct bcm2835_timer_regs *regs =
+		(struct bcm2835_timer_regs *)BCM2835_TIMER_PHYSADDR;
+
+	return readl(&regs->clo) - base;
+}
+
+unsigned long long get_ticks(void)
+{
+	return get_timer(0);
+}
+
+ulong get_tbclk(void)
+{
+	return CONFIG_SYS_HZ;
+}
+
+void __udelay(unsigned long usec)
+{
+	ulong endtime;
+	signed long diff;
+
+	endtime = get_timer(0) + usec;
+
+	do {
+		ulong now = get_timer(0);
+		diff = endtime - now;
+	} while (diff >= 0);
+}
diff --git a/arch/arm/include/asm/arch-bcm2835/timer.h b/arch/arm/include/asm/arch-bcm2835/timer.h
new file mode 100644
index 0000000..30c70e0
--- /dev/null
+++ b/arch/arm/include/asm/arch-bcm2835/timer.h
@@ -0,0 +1,37 @@ 
+/*
+ * (C) Copyright 2012 Stephen Warren
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * 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.
+ */
+
+#ifndef _BCM2835_TIMER_H
+#define _BCM2835_TIMER_H
+
+#define BCM2835_TIMER_PHYSADDR	0x20003000
+
+struct bcm2835_timer_regs {
+	u32 cs;
+	u32 clo;
+	u32 chi;
+	u32 c0;
+	u32 c1;
+	u32 c2;
+	u32 c3;
+};
+
+#define BCM2835_TIMER_CS_M3	(1 << 3)
+#define BCM2835_TIMER_CS_M2	(1 << 2)
+#define BCM2835_TIMER_CS_M1	(1 << 1)
+#define BCM2835_TIMER_CS_M0	(1 << 0)
+
+#endif