From olof at lixom.net  Sat Jun  1 02:43:13 2013
From: olof at lixom.net (Olof Johansson)
Date: Fri, 31 May 2013 23:43:13 -0700
Subject: [PATCH] ARM: bcm2835: override the HW UART periphid
In-Reply-To: <1369886859-22114-1-git-send-email-swarren@wwwdotorg.org>
References: <1369886859-22114-1-git-send-email-swarren@wwwdotorg.org>
Message-ID: <20130601064313.GA9010@quad.lixom.net>

On Wed, May 29, 2013 at 10:07:39PM -0600, Stephen Warren wrote:
> From: Jongsung Kim <neidhard.kim at lge.com>
> 
> Stephen Warren reported the recent commit 78506f2 (add support for
> extended FIFO-size of PL011-r1p5) breaks the serial port on the
> BCM2835 ARM SoC.
> 
> A UART compatible with the ARM PL011-r1p5 should have 32-deep FIFOs.
> The BCM2835 UART just looks like an ARM PL011-r1p5, but has 16-deep
> FIFOs just like PL011-r1p4 or earlier revisions. As a workaround for
> this compatibility issue, this patch overrides the HW UART periphid
> register values with the actually compatible UART periphid 0x00241011
> (r1p3 or r1p4).
> 
> Reported-by: Stephen Warren <swarren at wwwdotorg.org>
> Signed-off-by: Jongsung Kim <neidhard.kim at lge.com>
> Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
> ---
> This is a fix for v3.10-rc*.

Applied.


-Olof


From olof at lixom.net  Sat Jun  1 01:12:23 2013
From: olof at lixom.net (Olof Johansson)
Date: Fri, 31 May 2013 22:12:23 -0700
Subject: [PATCH v2] video: simplefb: add mode parsing function
In-Reply-To: <51A42ED5.2060104@wwwdotorg.org>
References: <1369626821-28494-1-git-send-email-acourbot@nvidia.com>
 <51A42ED5.2060104@wwwdotorg.org>
Message-ID: <20130601051223.GB5189@quad.lixom.net>

On Mon, May 27, 2013 at 10:13:09PM -0600, Stephen Warren wrote:
> On 05/26/2013 09:53 PM, Alexandre Courbot wrote:
> > The naming scheme of simplefb's mode is precise enough to allow building
> > the mode structure from it instead of using a static list of modes. This
> > patch introduces a function that does this. In case exotic modes that
> > cannot be represented from their name alone are needed, the static list
> > of modes is still available as a backup.
> > 
> > It also changes the order in which colors are declared from MSB first to
> > the more standard LSB first.
> > 
> > Signed-off-by: Alexandre Courbot <acourbot at nvidia.com>
> > ---
> > Changes from v1:
> > - amended documentation following Stephen's suggestion
> > - allow parsing of bitfields larger than 9 bits
> > - made it clear that the parsing order of bits is changed with respect
> >   to the original patch
> > 
> > Andrew, since this patch introduces a (small) change in the DT bindings,
> > could we try to merge it during the -rc cycle so we don't have to come
> > with a more complex solution in the future?
> 
> So, I think we shouldn't change the DT binding at all now. The original
> driver is now merged for 3.10, and I think it's far too late to take
> code that implements new features for 3.10. This means that we couldn't
> merge this patch until 3.11. However, by then, we shouldn't be changing
> the DT binding in incompatible ways. Olof has already published some
> U-Boot binaries that use the current binding, and on IRC indicated he'd
> prefer not to change the binding because of that.
> 
> As such, we should either:
> 
> a) Just add new entries into the format array that already exists in the
> driver. Given David's response, this might be simplest.

I think so too. Is this even needed? Do we have any users of the newer formats
or is it just someone trying to feature-creep this driver to make the "simple"
part of the name inaccurate? :)

> b) Extend the DT binding in a 100% backwards-compatible way, which would
> mean defaulting the bit-order to match the existing 1 format, and adding
> a new Boolean property to indicate that the format string is specified
> in the other order.

Or just add a new property that has higher priority for the newer format
strings, and make the driver use that if it exists, otherwise fall back.


-Olof


From swarren at wwwdotorg.org  Sun Jun  2 01:07:50 2013
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Sat, 01 Jun 2013 23:07:50 -0600
Subject: [PATCH v2] video: simplefb: add mode parsing function
In-Reply-To: <20130601051223.GB5189@quad.lixom.net>
References: <1369626821-28494-1-git-send-email-acourbot@nvidia.com>
 <51A42ED5.2060104@wwwdotorg.org> <20130601051223.GB5189@quad.lixom.net>
Message-ID: <51AAD326.4040809@wwwdotorg.org>

On 05/31/2013 11:12 PM, Olof Johansson wrote:
> On Mon, May 27, 2013 at 10:13:09PM -0600, Stephen Warren wrote:
>> On 05/26/2013 09:53 PM, Alexandre Courbot wrote:
>>> The naming scheme of simplefb's mode is precise enough to allow building
>>> the mode structure from it instead of using a static list of modes. This
>>> patch introduces a function that does this. In case exotic modes that
>>> cannot be represented from their name alone are needed, the static list
>>> of modes is still available as a backup.
...
>> As such, we should either:
>>
>> a) Just add new entries into the format array that already exists in the
>> driver. Given David's response, this might be simplest.
> 
> I think so too. Is this even needed? Do we have any users of the newer formats
> or is it just someone trying to feature-creep this driver to make the "simple"
> part of the name inaccurate? :)

Alex is working on board support for a new NVIDIA board, where IIRC the
bootloader sets up some 32-bit ARGB format for the panel.


From olof at lixom.net  Sun Jun  2 01:09:04 2013
From: olof at lixom.net (Olof Johansson)
Date: Sat, 1 Jun 2013 22:09:04 -0700
Subject: [PATCH v2] video: simplefb: add mode parsing function
In-Reply-To: <51AAD326.4040809@wwwdotorg.org>
References: <1369626821-28494-1-git-send-email-acourbot@nvidia.com>
 <51A42ED5.2060104@wwwdotorg.org>
 <20130601051223.GB5189@quad.lixom.net>
 <51AAD326.4040809@wwwdotorg.org>
Message-ID: <CAOesGMi=f=2S9y96-DtBzOZydhsJ1pF+m26AzdQjj59qtQu-oA@mail.gmail.com>

On Sat, Jun 1, 2013 at 10:07 PM, Stephen Warren <swarren at wwwdotorg.org> wrote:
> On 05/31/2013 11:12 PM, Olof Johansson wrote:
>> On Mon, May 27, 2013 at 10:13:09PM -0600, Stephen Warren wrote:
>>> On 05/26/2013 09:53 PM, Alexandre Courbot wrote:
>>>> The naming scheme of simplefb's mode is precise enough to allow building
>>>> the mode structure from it instead of using a static list of modes. This
>>>> patch introduces a function that does this. In case exotic modes that
>>>> cannot be represented from their name alone are needed, the static list
>>>> of modes is still available as a backup.
> ...
>>> As such, we should either:
>>>
>>> a) Just add new entries into the format array that already exists in the
>>> driver. Given David's response, this might be simplest.
>>
>> I think so too. Is this even needed? Do we have any users of the newer formats
>> or is it just someone trying to feature-creep this driver to make the "simple"
>> part of the name inaccurate? :)
>
> Alex is working on board support for a new NVIDIA board, where IIRC the
> bootloader sets up some 32-bit ARGB format for the panel.

Ah, ok. Let's just implement that one format too then. :)


-Olof


From swarren at wwwdotorg.org  Tue Jun  4 23:38:19 2013
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Tue, 04 Jun 2013 21:38:19 -0600
Subject: [PATCH V2 REPOST 1/2] lcd: add functions to set up simplefb device
 tree
In-Reply-To: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
References: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
Message-ID: <51AEB2AB.2070901@wwwdotorg.org>

On 05/27/2013 10:31 PM, Stephen Warren wrote:
> simple-framebuffer is a new device tree binding that describes a pre-
> configured frame-buffer memory region and its format. The Linux kernel
> contains a driver that supports this binding. Implement functions to
> create a DT node (or fill in an existing node) with parameters that
> describe the framebuffer format that U-Boot is using.
> 
> This will be immediately used by the Raspberry Pi board in U-Boot, and
> likely will be used by the Samsung ARM ChromeBook support soon too. It
> could well be used by many other boards (e.g. Tegra boards with built-in
> LCD panels, which aren't yet supported by the Linux kernel).

Anatolij, do these patches look good? Are you waiting for Albert to ack
patch 2 in order to take it through the LCD tree? Thanks.


From agust at denx.de  Wed Jun  5 17:33:51 2013
From: agust at denx.de (Anatolij Gustschin)
Date: Wed, 5 Jun 2013 23:33:51 +0200
Subject: [PATCH V2 REPOST 1/2] lcd: add functions to set up simplefb
 device tree
In-Reply-To: <51AEB2AB.2070901@wwwdotorg.org>
References: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
 <51AEB2AB.2070901@wwwdotorg.org>
Message-ID: <20130605233351.5df707cf@crub>

On Tue, 04 Jun 2013 21:38:19 -0600
Stephen Warren <swarren at wwwdotorg.org> wrote:
...
> Anatolij, do these patches look good? Are you waiting for Albert to ack
> patch 2 in order to take it through the LCD tree? Thanks.

these patches look good, I'll queue them. Sorry for delay.

Thanks,

Anatolij


From agust at denx.de  Wed Jun  5 17:35:51 2013
From: agust at denx.de (Anatolij Gustschin)
Date: Wed, 5 Jun 2013 23:35:51 +0200
Subject: [PATCH V2 REPOST 1/2] lcd: add functions to set up simplefb
 device tree
In-Reply-To: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
References: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
Message-ID: <20130605233551.389f447c@crub>

On Mon, 27 May 2013 22:31:17 -0600
Stephen Warren <swarren at wwwdotorg.org> wrote:

> simple-framebuffer is a new device tree binding that describes a pre-
> configured frame-buffer memory region and its format. The Linux kernel
> contains a driver that supports this binding. Implement functions to
> create a DT node (or fill in an existing node) with parameters that
> describe the framebuffer format that U-Boot is using.
> 
> This will be immediately used by the Raspberry Pi board in U-Boot, and
> likely will be used by the Samsung ARM ChromeBook support soon too. It
> could well be used by many other boards (e.g. Tegra boards with built-in
> LCD panels, which aren't yet supported by the Linux kernel).
> 
> Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
> Acked-by: Simon Glass <sjg at chromium.org>
> ---
> v2: Add binding doc, remove ifdefs from lcd.h
> ---
>  common/lcd.c                                       |   87 ++++++++++++++++++++
>  .../video/simple-framebuffer.txt                   |   25 ++++++
>  include/lcd.h                                      |    3 +
>  3 files changed, 115 insertions(+)
>  create mode 100644 doc/device-tree-bindings/video/simple-framebuffer.txt

Applied to u-boot-video/master. Thanks!

Anatolij


From agust at denx.de  Wed Jun  5 17:36:21 2013
From: agust at denx.de (Anatolij Gustschin)
Date: Wed, 5 Jun 2013 23:36:21 +0200
Subject: [PATCH V2 REPOST 2/2] ARM: bcm2835: add simplefb DT node during
 bootz/m
In-Reply-To: <1369715478-3655-2-git-send-email-swarren@wwwdotorg.org>
References: <1369715478-3655-1-git-send-email-swarren@wwwdotorg.org>
 <1369715478-3655-2-git-send-email-swarren@wwwdotorg.org>
Message-ID: <20130605233621.492386c5@crub>

On Mon, 27 May 2013 22:31:18 -0600
Stephen Warren <swarren at wwwdotorg.org> wrote:

> Add a DT simple-framebuffer node to DT when booting the Linux kernel.
> This will allow the kernel to inherit the framebuffer configuration from
> U-Boot, and display a graphical boot console, and even run a full SW-
> rendered X server.
> 
> Signed-off-by: Stephen Warren <swarren at wwwdotorg.org>
> Acked-by: Simon Glass <sjg at chromium.org>
> ---
>  board/raspberrypi/rpi_b/rpi_b.c |   14 +++++++++++++-
>  include/configs/rpi_b.h         |    2 ++
>  2 files changed, 15 insertions(+), 1 deletion(-)

Applied to u-boot-video/master. Thanks!

Anatolij


From swarren at wwwdotorg.org  Wed Jun 12 23:45:27 2013
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Wed, 12 Jun 2013 21:45:27 -0600
Subject: [GIT PULL 2/2] ARM: bcm2835: defconfig updates
In-Reply-To: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>
References: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>
Message-ID: <1371095127-23847-2-git-send-email-swarren@wwwdotorg.org>

This enables gpio-leds and simplefb.

----------------------------------------------------------------

The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:

  Linux 3.10-rc1

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git bcm2835-for-3.11-defconfig

for you to fetch changes up to c321e7164493ac3684bfbb382d66a4a2416291fb:

  ARM: bcm2835: defconfig updates

----------------------------------------------------------------

Stephen Warren (1):
      ARM: bcm2835: defconfig updates

 arch/arm/configs/bcm2835_defconfig |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)


From swarren at wwwdotorg.org  Wed Jun 12 23:45:26 2013
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Wed, 12 Jun 2013 21:45:26 -0600
Subject: [GIT PULL 1/2] ARM: bcm2835: device tree updates
Message-ID: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>

Just one patch this time: enable the LED via gpio-leds.

----------------------------------------------------------------

The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:

  Linux 3.10-rc1

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git bcm2835-for-3.11-dt

for you to fetch changes up to 805b4db8076d47a181032a87db8a732fc8d94596:

  ARM: bcm2835: Add Raspberry Pi's ACT LED to DT

----------------------------------------------------------------

Daniel Mack (1):
      ARM: bcm2835: Add Raspberry Pi's ACT LED to DT

 arch/arm/boot/dts/bcm2835-rpi-b.dts |   11 +++++++++++
 1 file changed, 11 insertions(+)


From olof at lixom.net  Fri Jun 14 20:23:59 2013
From: olof at lixom.net (Olof Johansson)
Date: Fri, 14 Jun 2013 17:23:59 -0700
Subject: [GIT PULL 1/2] ARM: bcm2835: device tree updates
In-Reply-To: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>
References: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>
Message-ID: <20130615002359.GI18124@quad.lixom.net>

On Wed, Jun 12, 2013 at 09:45:26PM -0600, Stephen Warren wrote:
> Just one patch this time: enable the LED via gpio-leds.
> 
> ----------------------------------------------------------------
> 
> The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:
> 
>   Linux 3.10-rc1
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git bcm2835-for-3.11-dt
> 
> for you to fetch changes up to 805b4db8076d47a181032a87db8a732fc8d94596:
> 
>   ARM: bcm2835: Add Raspberry Pi's ACT LED to DT

Pulled, thanks.


-Olof


From olof at lixom.net  Fri Jun 14 20:25:41 2013
From: olof at lixom.net (Olof Johansson)
Date: Fri, 14 Jun 2013 17:25:41 -0700
Subject: [GIT PULL 2/2] ARM: bcm2835: defconfig updates
In-Reply-To: <1371095127-23847-2-git-send-email-swarren@wwwdotorg.org>
References: <1371095127-23847-1-git-send-email-swarren@wwwdotorg.org>
 <1371095127-23847-2-git-send-email-swarren@wwwdotorg.org>
Message-ID: <20130615002541.GJ18124@quad.lixom.net>

On Wed, Jun 12, 2013 at 09:45:27PM -0600, Stephen Warren wrote:
> This enables gpio-leds and simplefb.
> 
> ----------------------------------------------------------------
> 
> The following changes since commit f722406faae2d073cc1d01063d1123c35425939e:
> 
>   Linux 3.10-rc1
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-rpi.git bcm2835-for-3.11-defconfig
> 
> for you to fetch changes up to c321e7164493ac3684bfbb382d66a4a2416291fb:
> 
>   ARM: bcm2835: defconfig updates

Pulled.


-Olof


From lkundrak at v3.sk  Tue Jun 18 12:57:13 2013
From: lkundrak at v3.sk (Lubomir Rintel)
Date: Tue, 18 Jun 2013 18:57:13 +0200
Subject: [PATCH] hwrng: bcm2835: fix MODULE_LICENSE tag
In-Reply-To: <1366732475-479886-4-git-send-email-arnd@arndb.de>
References: <1366732475-479886-1-git-send-email-arnd@arndb.de>
 <1366732475-479886-4-git-send-email-arnd@arndb.de>
Message-ID: <1371574633.18688.9.camel@hobbes.kokotovo>

On Tue, 2013-04-23 at 17:54 +0200, Arnd Bergmann wrote:
> The MODULE_LICENSE macro invocation must use either "GPL" or "GPL v2",
> but not "GPLv2" in order to be detected by the module loader.
> 
> This fixes the allmodconfig build error:
> 
> FATAL: modpost: GPL-incompatible module bcm2835-rng.ko uses GPL-only symbol 'platform_driver_unregister'

Thank you, obviously a typo of mine that slipped through. I'm wondering
if this could get queued for 3.10; it definitely can't do any harm.

Acked-by: Lubomir Rintel <lkundrak at v3.sk>

> 
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> Cc: Dom Cobley <popcornmix at gmail.com>
> Cc: Lubomir Rintel <lkundrak at v3.sk>
> Cc: Stephen Warren <swarren at wwwdotorg.org>
> Cc: Matt Mackall <mpm at selenic.com>
> Cc: linux-rpi-kernel at lists.infradead.org
> Cc: Herbert Xu <herbert at gondor.apana.org.au>
> ---
>  drivers/char/hw_random/bcm2835-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index eb7f147..43577ca 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -110,4 +110,4 @@ module_platform_driver(bcm2835_rng_driver);
>  
>  MODULE_AUTHOR("Lubomir Rintel <lkundrak at v3.sk>");
>  MODULE_DESCRIPTION("BCM2835 Random Number Generator (RNG) driver");
> -MODULE_LICENSE("GPLv2");
> +MODULE_LICENSE("GPL v2");




From swarren at wwwdotorg.org  Tue Jun 18 13:10:16 2013
From: swarren at wwwdotorg.org (Stephen Warren)
Date: Tue, 18 Jun 2013 11:10:16 -0600
Subject: [PATCH v4] watchdog: Add Broadcom BCM2835 watchdog timer driver
In-Reply-To: <1371574241.18688.5.camel@hobbes.kokotovo>
References: <1364320200-23569-1-git-send-email-lkundrak@v3.sk>
 <1364402424-19503-1-git-send-email-lkundrak@v3.sk>
 <5153B24D.1010408@wwwdotorg.org> <20130526142200.GA7603@spo001.leaseweb.com>
 <1371574241.18688.5.camel@hobbes.kokotovo>
Message-ID: <51C09478.30909@wwwdotorg.org>

On 06/18/2013 10:50 AM, Lubomir Rintel wrote:
> Hi Wim,
> 
> On Sun, 2013-05-26 at 16:22 +0200, Wim Van Sebroeck wrote:
>> Hi Lubomir,
>>
>>> On 03/27/2013 10:40 AM, Lubomir Rintel wrote:
>>>> This adds a driver for watchdog timer hardware present on Broadcom BCM2835 SoC,
>>>> used in Raspberry Pi and Roku 2 devices.
>>>>
>>>> Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
>>>> Signed-off-by: Dom Cobley <popcornmix at gmail.com>
>>>
>>> Those two s-o-b lines should be swapped, since if Dom did sign off on
>>> any part of this patch, he did it before you did.
>>>
>>> That said...
>>>
>>> I wonder if it's actually appropriate to include Dom's s-o-b here, since
>>> I don't think he really wrote this patch itself. I think you mentioned
>>> that you hadn't use much of the downstream driver except for some defines?
>>>
>>> To be clear, I mentioned the existence of the S-o-b line downstream
>>> simply to demonstrate that the commits you were getting information from
>>> had correctly followed the process described in
>>> Documentation/SubmittingPatches, and so it was OK to use that
>>> information while creating a GPL'd driver.
>>>
>>> So there are a couple of ways that this patch could have been created:
>>>
>>> 1) You took the downstream commit itself, cherry-picked it into the
>>> upstream kernel, modified it to suit upstream, and then submitted that.
>>> The modifications might be extensive, such as renaming the file,
>>> removing parts of the code that the upstream watchdog core now handles,
>>> adding some new features, fixing bugs, cleanup, etc.; whatever is needed
>>> to upstream the patch.
>>>
>>> In this case, I believe it would be appropriate to maintain any S-o-b
>>> lines from the original downstream commit, and add yours. But, I believe
>>> you should also (a) maintain the git author field from the original
>>> downstream commit (b) include a list of the changes you made to the
>>> patch in the commit description, so you can be blamed for them rather
>>> than the original author:-)
>>>
>>> 2) You read the downstream commit for information, but created a
>>> completely new driver for the upstream kernel, using the downstream
>>> driver just as a reference. In this case, I believe it's fine for the
>>> git author field to be you, and for the only s-o-b line present to be
>>> yours, since you really did write the patch from scratch. However, you
>>> should credit the downstream work in the (c) header and/or commit
>>> description.
>>>
>>> This current patch sees to be a slight hybrid of both approaches (you're
>>> listed as the git author, but have included Dom's s-o-b line on a patch
>>> I don't think he created, and wasn't directly derived from one he created).
>>>
>>> I'm not sure if I'm being too picky. I guess I'll leave it up to Wim Van
>>> Sebroeck, since he's the watchdog maintainer and would be the person who
>>> applies this patch.
>>
>> Can you create a patch v5 with yourselve as author and add the necessary (c)
>> and references in it so that I can do the final review? (That is if situation
>> 2 is indeed the case. If however it is situation 1 then we should get the
>> original code and have that as a patch and then add a second patch with your
>> modifications.).
> 
> I'm still not sure what to do. For most part, the driver is written from
> scratch, since the original one was not utilizing recent enough
> frameworks (such as watchdog-core or device tree bindings). Thus the
> patch against the original driver would not make any sense at all.
> 
> On the other hand, I've referred to the original driver for hardware
> information and copied a couple of defines as they are (such as
> SECS_TO_WDOG_TICKS), thus I figured out it's a required to include the
> original driver's sign-off and copyright information.
> 
> Thus neither 1) nor 2) is the case, and I can't figure out myself what
> needs to be changed at this point. I'm wondering if you could help me
> decide?

This sounds exactly like case (2) to me; copying a few defines for HW
constants doesn't really sound like having derived the driver from the
original commit.


From lkundrak at v3.sk  Tue Jun 18 12:50:41 2013
From: lkundrak at v3.sk (Lubomir Rintel)
Date: Tue, 18 Jun 2013 18:50:41 +0200
Subject: [PATCH v4] watchdog: Add Broadcom BCM2835 watchdog timer driver
In-Reply-To: <20130526142200.GA7603@spo001.leaseweb.com>
References: <1364320200-23569-1-git-send-email-lkundrak@v3.sk>
 <1364402424-19503-1-git-send-email-lkundrak@v3.sk>
 <5153B24D.1010408@wwwdotorg.org>
 <20130526142200.GA7603@spo001.leaseweb.com>
Message-ID: <1371574241.18688.5.camel@hobbes.kokotovo>

Hi Wim,

On Sun, 2013-05-26 at 16:22 +0200, Wim Van Sebroeck wrote:
> Hi Lubomir,
> 
> > On 03/27/2013 10:40 AM, Lubomir Rintel wrote:
> > > This adds a driver for watchdog timer hardware present on Broadcom BCM2835 SoC,
> > > used in Raspberry Pi and Roku 2 devices.
> > > 
> > > Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
> > > Signed-off-by: Dom Cobley <popcornmix at gmail.com>
> > 
> > Those two s-o-b lines should be swapped, since if Dom did sign off on
> > any part of this patch, he did it before you did.
> > 
> > That said...
> > 
> > I wonder if it's actually appropriate to include Dom's s-o-b here, since
> > I don't think he really wrote this patch itself. I think you mentioned
> > that you hadn't use much of the downstream driver except for some defines?
> > 
> > To be clear, I mentioned the existence of the S-o-b line downstream
> > simply to demonstrate that the commits you were getting information from
> > had correctly followed the process described in
> > Documentation/SubmittingPatches, and so it was OK to use that
> > information while creating a GPL'd driver.
> > 
> > So there are a couple of ways that this patch could have been created:
> > 
> > 1) You took the downstream commit itself, cherry-picked it into the
> > upstream kernel, modified it to suit upstream, and then submitted that.
> > The modifications might be extensive, such as renaming the file,
> > removing parts of the code that the upstream watchdog core now handles,
> > adding some new features, fixing bugs, cleanup, etc.; whatever is needed
> > to upstream the patch.
> > 
> > In this case, I believe it would be appropriate to maintain any S-o-b
> > lines from the original downstream commit, and add yours. But, I believe
> > you should also (a) maintain the git author field from the original
> > downstream commit (b) include a list of the changes you made to the
> > patch in the commit description, so you can be blamed for them rather
> > than the original author:-)
> > 
> > 2) You read the downstream commit for information, but created a
> > completely new driver for the upstream kernel, using the downstream
> > driver just as a reference. In this case, I believe it's fine for the
> > git author field to be you, and for the only s-o-b line present to be
> > yours, since you really did write the patch from scratch. However, you
> > should credit the downstream work in the (c) header and/or commit
> > description.
> > 
> > This current patch sees to be a slight hybrid of both approaches (you're
> > listed as the git author, but have included Dom's s-o-b line on a patch
> > I don't think he created, and wasn't directly derived from one he created).
> > 
> > I'm not sure if I'm being too picky. I guess I'll leave it up to Wim Van
> > Sebroeck, since he's the watchdog maintainer and would be the person who
> > applies this patch.
> 
> Can you create a patch v5 with yourselve as author and add the necessary (c)
> and references in it so that I can do the final review? (That is if situation
> 2 is indeed the case. If however it is situation 1 then we should get the
> original code and have that as a patch and then add a second patch with your
> modifications.).

I'm still not sure what to do. For most part, the driver is written from
scratch, since the original one was not utilizing recent enough
frameworks (such as watchdog-core or device tree bindings). Thus the
patch against the original driver would not make any sense at all.

On the other hand, I've referred to the original driver for hardware
information and copied a couple of defines as they are (such as
SECS_TO_WDOG_TICKS), thus I figured out it's a required to include the
original driver's sign-off and copyright information.

Thus neither 1) nor 2) is the case, and I can't figure out myself what
needs to be changed at this point. I'm wondering if you could help me
decide?

Thank you,
-- 
Lubomir Rintel <lkundrak at v3.sk>



From lkundrak at v3.sk  Tue Jun 18 13:44:48 2013
From: lkundrak at v3.sk (Lubomir Rintel)
Date: Tue, 18 Jun 2013 19:44:48 +0200
Subject: [PATCH v5] watchdog: Add Broadcom BCM2835 watchdog timer driver
In-Reply-To: <51C09478.30909@wwwdotorg.org>
References: <51C09478.30909@wwwdotorg.org>
Message-ID: <1371577488-22438-1-git-send-email-lkundrak@v3.sk>

This adds a driver for watchdog timer hardware present on Broadcom BCM2835 SoC,
used in Raspberry Pi and Roku 2 devices.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
Tested-by: Stephen Warren <swarren at wwwdotorg.org>
Cc: Stephen Warren <swarren at wwwdotorg.org>
Cc: Wim Van Sebroeck <wim at iguana.be>
Cc: Guenter Roeck <linux at roeck-us.net>
Cc: linux-rpi-kernel at lists.infradead.org
Cc: linux-watchdog at vger.kernel.org
Cc: devicetree-discuss at lists.ozlabs.org
---
Changes for v2:
    - Use per-device structure instead of global variables for lock and memory base
    - Fix default timeout setting
    - Do not leak memory if probe fails
    - Style fixes
    - Split out defconfig into a separate commit
    - Meaningful commit message with credit

Changes for v3:
    - Add proper copyright notice to header
    - Drop status constants, we don't use them
    - Fix heartbeat parameter's type
    - Log driver initialization message once the device is probed

Changes for v4:
    - Drop an useless initializer
    - Add a signoff from downstream
    - Do not announce the driver to the log if we failed to probe
    - Set platform data earlier and do not explicitly unset it

Changes for v5:
    - Copyright clarification

 .../bindings/watchdog/brcm,bcm2835-pm-wdog.txt     |    5 +
 drivers/watchdog/Kconfig                           |   11 ++
 drivers/watchdog/Makefile                          |    1 +
 drivers/watchdog/bcm2835_wdt.c                     |  189 ++++++++++++++++++++
 4 files changed, 206 insertions(+), 0 deletions(-)
 create mode 100644 drivers/watchdog/bcm2835_wdt.c

diff --git a/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
index d209366..f801d71 100644
--- a/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
+++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
@@ -5,9 +5,14 @@ Required properties:
 - compatible : should be "brcm,bcm2835-pm-wdt"
 - reg : Specifies base physical address and size of the registers.
 
+Optional properties:
+
+- timeout-sec   : Contains the watchdog timeout in seconds
+
 Example:
 
 watchdog {
 	compatible = "brcm,bcm2835-pm-wdt";
 	reg = <0x7e100000 0x28>;
+	timeout-sec = <10>;
 };
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index e89fc31..c3d3b16 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1098,6 +1098,17 @@ config BCM63XX_WDT
 	  To compile this driver as a loadable module, choose M here.
 	  The module will be called bcm63xx_wdt.
 
+config BCM2835_WDT
+	tristate "Broadcom BCM2835 hardware watchdog"
+	depends on ARCH_BCM2835
+	select WATCHDOG_CORE
+	help
+	  Watchdog driver for the built in watchdog hardware in Broadcom
+	  BCM2835 SoC.
+
+	  To compile this driver as a loadable module, choose M here.
+	  The module will be called bcm2835_wdt.
+
 config LANTIQ_WDT
 	tristate "Lantiq SoC watchdog"
 	depends on LANTIQ
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index a300b94..1bf5675 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
 obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
 obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
 obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
+obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
 
 # AVR32 Architecture
 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
new file mode 100644
index 0000000..61566fc
--- /dev/null
+++ b/drivers/watchdog/bcm2835_wdt.c
@@ -0,0 +1,189 @@
+/*
+ * Watchdog driver for Broadcom BCM2835
+ *
+ * "bcm2708_wdog" driver written by Luke Diamand that was obtained from
+ * branch "rpi-3.6.y" of git://github.com/raspberrypi/linux.git was used
+ * as a hardware reference for the Broadcom BCM2835 watchdog timer.
+ *
+ * Copyright (C) 2013 Lubomir Rintel <lkundrak at v3.sk>
+ *
+ * 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.
+ */
+
+#include <linux/types.h>
+#include <linux/module.h>
+#include <linux/io.h>
+#include <linux/watchdog.h>
+#include <linux/platform_device.h>
+#include <linux/of_address.h>
+#include <linux/miscdevice.h>
+
+#define PM_RSTC				0x1c
+#define PM_WDOG				0x24
+
+#define PM_PASSWORD			0x5a000000
+
+#define PM_WDOG_TIME_SET		0x000fffff
+#define PM_RSTC_WRCFG_CLR		0xffffffcf
+#define PM_RSTC_WRCFG_SET		0x00000030
+#define PM_RSTC_WRCFG_FULL_RESET	0x00000020
+#define PM_RSTC_RESET			0x00000102
+
+#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
+#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
+
+struct bcm2835_wdt {
+	void __iomem		*base;
+	spinlock_t		lock;
+};
+
+static unsigned int heartbeat;
+static bool nowayout = WATCHDOG_NOWAYOUT;
+
+static int bcm2835_wdt_start(struct watchdog_device *wdog)
+{
+	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
+	uint32_t cur;
+	unsigned long flags;
+
+	spin_lock_irqsave(&wdt->lock, flags);
+
+	writel_relaxed(PM_PASSWORD | (SECS_TO_WDOG_TICKS(wdog->timeout) &
+				PM_WDOG_TIME_SET), wdt->base + PM_WDOG);
+	cur = readl_relaxed(wdt->base + PM_RSTC);
+	writel_relaxed(PM_PASSWORD | (cur & PM_RSTC_WRCFG_CLR) |
+		  PM_RSTC_WRCFG_FULL_RESET, wdt->base + PM_RSTC);
+
+	spin_unlock_irqrestore(&wdt->lock, flags);
+
+	return 0;
+}
+
+static int bcm2835_wdt_stop(struct watchdog_device *wdog)
+{
+	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
+
+	writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
+	dev_info(wdog->dev, "Watchdog timer stopped");
+	return 0;
+}
+
+static int bcm2835_wdt_set_timeout(struct watchdog_device *wdog, unsigned int t)
+{
+	wdog->timeout = t;
+	return 0;
+}
+
+static unsigned int bcm2835_wdt_get_timeleft(struct watchdog_device *wdog)
+{
+	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
+
+	uint32_t ret = readl_relaxed(wdt->base + PM_WDOG);
+	return WDOG_TICKS_TO_SECS(ret & PM_WDOG_TIME_SET);
+}
+
+static struct watchdog_ops bcm2835_wdt_ops = {
+	.owner =	THIS_MODULE,
+	.start =	bcm2835_wdt_start,
+	.stop =		bcm2835_wdt_stop,
+	.set_timeout =	bcm2835_wdt_set_timeout,
+	.get_timeleft =	bcm2835_wdt_get_timeleft,
+};
+
+static struct watchdog_info bcm2835_wdt_info = {
+	.options =	WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
+			WDIOF_KEEPALIVEPING,
+	.identity =	"Broadcom BCM2835 Watchdog timer",
+};
+
+static struct watchdog_device bcm2835_wdt_wdd = {
+	.info =		&bcm2835_wdt_info,
+	.ops =		&bcm2835_wdt_ops,
+	.min_timeout =	1,
+	.max_timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
+	.timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
+};
+
+static int bcm2835_wdt_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
+	struct bcm2835_wdt *wdt;
+	int err;
+
+	wdt = devm_kzalloc(dev, sizeof(struct bcm2835_wdt), GFP_KERNEL);
+	if (!wdt) {
+		dev_err(dev, "Failed to allocate memory for watchdog device");
+		return -ENOMEM;
+	}
+	platform_set_drvdata(pdev, wdt);
+
+	spin_lock_init(&wdt->lock);
+
+	wdt->base = of_iomap(np, 0);
+	if (!wdt->base) {
+		dev_err(dev, "Failed to remap watchdog regs");
+		return -ENODEV;
+	}
+
+	watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
+	watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
+	watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
+	err = watchdog_register_device(&bcm2835_wdt_wdd);
+	if (err) {
+		dev_err(dev, "Failed to register watchdog device");
+		iounmap(wdt->base);
+		return err;
+	}
+
+	dev_info(dev, "Broadcom BCM2835 watchdog timer");
+	return 0;
+}
+
+static int bcm2835_wdt_remove(struct platform_device *pdev)
+{
+	struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
+
+	watchdog_unregister_device(&bcm2835_wdt_wdd);
+	iounmap(wdt->base);
+
+	return 0;
+}
+
+static void bcm2835_wdt_shutdown(struct platform_device *pdev)
+{
+	bcm2835_wdt_stop(&bcm2835_wdt_wdd);
+}
+
+static const struct of_device_id bcm2835_wdt_of_match[] = {
+	{ .compatible = "brcm,bcm2835-pm-wdt", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, bcm2835_wdt_of_match);
+
+static struct platform_driver bcm2835_wdt_driver = {
+	.probe		= bcm2835_wdt_probe,
+	.remove		= bcm2835_wdt_remove,
+	.shutdown	= bcm2835_wdt_shutdown,
+	.driver = {
+		.name =		"bcm2835-wdt",
+		.owner =	THIS_MODULE,
+		.of_match_table = bcm2835_wdt_of_match,
+	},
+};
+module_platform_driver(bcm2835_wdt_driver);
+
+module_param(heartbeat, uint, 0);
+MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds");
+
+module_param(nowayout, bool, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
+				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+MODULE_AUTHOR("Lubomir Rintel <lkundrak at v3.sk>");
+MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-- 
1.7.1



From linux at roeck-us.net  Tue Jun 18 14:24:00 2013
From: linux at roeck-us.net (Guenter Roeck)
Date: Tue, 18 Jun 2013 11:24:00 -0700
Subject: [PATCH v5] watchdog: Add Broadcom BCM2835 watchdog timer driver
In-Reply-To: <1371577488-22438-1-git-send-email-lkundrak@v3.sk>
References: <51C09478.30909@wwwdotorg.org>
 <1371577488-22438-1-git-send-email-lkundrak@v3.sk>
Message-ID: <20130618182400.GA3776@roeck-us.net>

On Tue, Jun 18, 2013 at 07:44:48PM +0200, Lubomir Rintel wrote:
> This adds a driver for watchdog timer hardware present on Broadcom BCM2835 SoC,
> used in Raspberry Pi and Roku 2 devices.
> 
> Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
> Tested-by: Stephen Warren <swarren at wwwdotorg.org>
> Cc: Stephen Warren <swarren at wwwdotorg.org>
> Cc: Wim Van Sebroeck <wim at iguana.be>
> Cc: Guenter Roeck <linux at roeck-us.net>
> Cc: linux-rpi-kernel at lists.infradead.org
> Cc: linux-watchdog at vger.kernel.org
> Cc: devicetree-discuss at lists.ozlabs.org

Reviewed-by: Guenter Roeck <linux at roeck-us.net>

> ---
> Changes for v2:
>     - Use per-device structure instead of global variables for lock and memory base
>     - Fix default timeout setting
>     - Do not leak memory if probe fails
>     - Style fixes
>     - Split out defconfig into a separate commit
>     - Meaningful commit message with credit
> 
> Changes for v3:
>     - Add proper copyright notice to header
>     - Drop status constants, we don't use them
>     - Fix heartbeat parameter's type
>     - Log driver initialization message once the device is probed
> 
> Changes for v4:
>     - Drop an useless initializer
>     - Add a signoff from downstream
>     - Do not announce the driver to the log if we failed to probe
>     - Set platform data earlier and do not explicitly unset it
> 
> Changes for v5:
>     - Copyright clarification
> 
>  .../bindings/watchdog/brcm,bcm2835-pm-wdog.txt     |    5 +
>  drivers/watchdog/Kconfig                           |   11 ++
>  drivers/watchdog/Makefile                          |    1 +
>  drivers/watchdog/bcm2835_wdt.c                     |  189 ++++++++++++++++++++
>  4 files changed, 206 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/watchdog/bcm2835_wdt.c
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
> index d209366..f801d71 100644
> --- a/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
> +++ b/Documentation/devicetree/bindings/watchdog/brcm,bcm2835-pm-wdog.txt
> @@ -5,9 +5,14 @@ Required properties:
>  - compatible : should be "brcm,bcm2835-pm-wdt"
>  - reg : Specifies base physical address and size of the registers.
>  
> +Optional properties:
> +
> +- timeout-sec   : Contains the watchdog timeout in seconds
> +
>  Example:
>  
>  watchdog {
>  	compatible = "brcm,bcm2835-pm-wdt";
>  	reg = <0x7e100000 0x28>;
> +	timeout-sec = <10>;
>  };
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index e89fc31..c3d3b16 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -1098,6 +1098,17 @@ config BCM63XX_WDT
>  	  To compile this driver as a loadable module, choose M here.
>  	  The module will be called bcm63xx_wdt.
>  
> +config BCM2835_WDT
> +	tristate "Broadcom BCM2835 hardware watchdog"
> +	depends on ARCH_BCM2835
> +	select WATCHDOG_CORE
> +	help
> +	  Watchdog driver for the built in watchdog hardware in Broadcom
> +	  BCM2835 SoC.
> +
> +	  To compile this driver as a loadable module, choose M here.
> +	  The module will be called bcm2835_wdt.
> +
>  config LANTIQ_WDT
>  	tristate "Lantiq SoC watchdog"
>  	depends on LANTIQ
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index a300b94..1bf5675 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -54,6 +54,7 @@ obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
>  obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
>  obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
>  obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
> +obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
>  
>  # AVR32 Architecture
>  obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
> diff --git a/drivers/watchdog/bcm2835_wdt.c b/drivers/watchdog/bcm2835_wdt.c
> new file mode 100644
> index 0000000..61566fc
> --- /dev/null
> +++ b/drivers/watchdog/bcm2835_wdt.c
> @@ -0,0 +1,189 @@
> +/*
> + * Watchdog driver for Broadcom BCM2835
> + *
> + * "bcm2708_wdog" driver written by Luke Diamand that was obtained from
> + * branch "rpi-3.6.y" of git://github.com/raspberrypi/linux.git was used
> + * as a hardware reference for the Broadcom BCM2835 watchdog timer.
> + *
> + * Copyright (C) 2013 Lubomir Rintel <lkundrak at v3.sk>
> + *
> + * 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.
> + */
> +
> +#include <linux/types.h>
> +#include <linux/module.h>
> +#include <linux/io.h>
> +#include <linux/watchdog.h>
> +#include <linux/platform_device.h>
> +#include <linux/of_address.h>
> +#include <linux/miscdevice.h>
> +
> +#define PM_RSTC				0x1c
> +#define PM_WDOG				0x24
> +
> +#define PM_PASSWORD			0x5a000000
> +
> +#define PM_WDOG_TIME_SET		0x000fffff
> +#define PM_RSTC_WRCFG_CLR		0xffffffcf
> +#define PM_RSTC_WRCFG_SET		0x00000030
> +#define PM_RSTC_WRCFG_FULL_RESET	0x00000020
> +#define PM_RSTC_RESET			0x00000102
> +
> +#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
> +#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
> +
> +struct bcm2835_wdt {
> +	void __iomem		*base;
> +	spinlock_t		lock;
> +};
> +
> +static unsigned int heartbeat;
> +static bool nowayout = WATCHDOG_NOWAYOUT;
> +
> +static int bcm2835_wdt_start(struct watchdog_device *wdog)
> +{
> +	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
> +	uint32_t cur;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&wdt->lock, flags);
> +
> +	writel_relaxed(PM_PASSWORD | (SECS_TO_WDOG_TICKS(wdog->timeout) &
> +				PM_WDOG_TIME_SET), wdt->base + PM_WDOG);
> +	cur = readl_relaxed(wdt->base + PM_RSTC);
> +	writel_relaxed(PM_PASSWORD | (cur & PM_RSTC_WRCFG_CLR) |
> +		  PM_RSTC_WRCFG_FULL_RESET, wdt->base + PM_RSTC);
> +
> +	spin_unlock_irqrestore(&wdt->lock, flags);
> +
> +	return 0;
> +}
> +
> +static int bcm2835_wdt_stop(struct watchdog_device *wdog)
> +{
> +	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
> +
> +	writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
> +	dev_info(wdog->dev, "Watchdog timer stopped");
> +	return 0;
> +}
> +
> +static int bcm2835_wdt_set_timeout(struct watchdog_device *wdog, unsigned int t)
> +{
> +	wdog->timeout = t;
> +	return 0;
> +}
> +
> +static unsigned int bcm2835_wdt_get_timeleft(struct watchdog_device *wdog)
> +{
> +	struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
> +
> +	uint32_t ret = readl_relaxed(wdt->base + PM_WDOG);
> +	return WDOG_TICKS_TO_SECS(ret & PM_WDOG_TIME_SET);
> +}
> +
> +static struct watchdog_ops bcm2835_wdt_ops = {
> +	.owner =	THIS_MODULE,
> +	.start =	bcm2835_wdt_start,
> +	.stop =		bcm2835_wdt_stop,
> +	.set_timeout =	bcm2835_wdt_set_timeout,
> +	.get_timeleft =	bcm2835_wdt_get_timeleft,
> +};
> +
> +static struct watchdog_info bcm2835_wdt_info = {
> +	.options =	WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
> +			WDIOF_KEEPALIVEPING,
> +	.identity =	"Broadcom BCM2835 Watchdog timer",
> +};
> +
> +static struct watchdog_device bcm2835_wdt_wdd = {
> +	.info =		&bcm2835_wdt_info,
> +	.ops =		&bcm2835_wdt_ops,
> +	.min_timeout =	1,
> +	.max_timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
> +	.timeout =	WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
> +};
> +
> +static int bcm2835_wdt_probe(struct platform_device *pdev)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
> +	struct bcm2835_wdt *wdt;
> +	int err;
> +
> +	wdt = devm_kzalloc(dev, sizeof(struct bcm2835_wdt), GFP_KERNEL);
> +	if (!wdt) {
> +		dev_err(dev, "Failed to allocate memory for watchdog device");
> +		return -ENOMEM;
> +	}
> +	platform_set_drvdata(pdev, wdt);
> +
> +	spin_lock_init(&wdt->lock);
> +
> +	wdt->base = of_iomap(np, 0);
> +	if (!wdt->base) {
> +		dev_err(dev, "Failed to remap watchdog regs");
> +		return -ENODEV;
> +	}
> +
> +	watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
> +	watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
> +	watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
> +	err = watchdog_register_device(&bcm2835_wdt_wdd);
> +	if (err) {
> +		dev_err(dev, "Failed to register watchdog device");
> +		iounmap(wdt->base);
> +		return err;
> +	}
> +
> +	dev_info(dev, "Broadcom BCM2835 watchdog timer");
> +	return 0;
> +}
> +
> +static int bcm2835_wdt_remove(struct platform_device *pdev)
> +{
> +	struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
> +
> +	watchdog_unregister_device(&bcm2835_wdt_wdd);
> +	iounmap(wdt->base);
> +
> +	return 0;
> +}
> +
> +static void bcm2835_wdt_shutdown(struct platform_device *pdev)
> +{
> +	bcm2835_wdt_stop(&bcm2835_wdt_wdd);
> +}
> +
> +static const struct of_device_id bcm2835_wdt_of_match[] = {
> +	{ .compatible = "brcm,bcm2835-pm-wdt", },
> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, bcm2835_wdt_of_match);
> +
> +static struct platform_driver bcm2835_wdt_driver = {
> +	.probe		= bcm2835_wdt_probe,
> +	.remove		= bcm2835_wdt_remove,
> +	.shutdown	= bcm2835_wdt_shutdown,
> +	.driver = {
> +		.name =		"bcm2835-wdt",
> +		.owner =	THIS_MODULE,
> +		.of_match_table = bcm2835_wdt_of_match,
> +	},
> +};
> +module_platform_driver(bcm2835_wdt_driver);
> +
> +module_param(heartbeat, uint, 0);
> +MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds");
> +
> +module_param(nowayout, bool, 0);
> +MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
> +				__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
> +
> +MODULE_AUTHOR("Lubomir Rintel <lkundrak at v3.sk>");
> +MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
> -- 
> 1.7.1
> 
> 


From herbert at gondor.apana.org.au  Fri Jun 21 03:16:03 2013
From: herbert at gondor.apana.org.au (Herbert Xu)
Date: Fri, 21 Jun 2013 15:16:03 +0800
Subject: [PATCH 05/15] hwrng: bcm2835: fix MODULE_LICENSE tag
In-Reply-To: <1370038972-2318779-6-git-send-email-arnd@arndb.de>
References: <1370038972-2318779-1-git-send-email-arnd@arndb.de>
 <1370038972-2318779-6-git-send-email-arnd@arndb.de>
Message-ID: <20130621071603.GA24151@gondor.apana.org.au>

On Sat, Jun 01, 2013 at 12:22:42AM +0200, Arnd Bergmann wrote:
> The MODULE_LICENSE macro invocation must use either "GPL" or "GPL v2",
> but not "GPLv2" in order to be detected by the module loader.
> 
> This fixes the allmodconfig build error:
> 
> FATAL: modpost: GPL-incompatible module bcm2835-rng.ko uses GPL-only symbol 'platform_driver_unregister'
> 
> Signed-off-by: Arnd Bergmann <arnd at arndb.de>
> Cc: Dom Cobley <popcornmix at gmail.com>
> Cc: Lubomir Rintel <lkundrak at v3.sk>
> Cc: Stephen Warren <swarren at wwwdotorg.org>
> Cc: Matt Mackall <mpm at selenic.com>
> Cc: linux-rpi-kernel at lists.infradead.org
> Cc: Herbert Xu <herbert at gondor.apana.org.au>
> ---
>  drivers/char/hw_random/bcm2835-rng.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
> index eb7f147..43577ca 100644
> --- a/drivers/char/hw_random/bcm2835-rng.c
> +++ b/drivers/char/hw_random/bcm2835-rng.c
> @@ -110,4 +110,4 @@ module_platform_driver(bcm2835_rng_driver);
>  
>  MODULE_AUTHOR("Lubomir Rintel <lkundrak at v3.sk>");
>  MODULE_DESCRIPTION("BCM2835 Random Number Generator (RNG) driver");
> -MODULE_LICENSE("GPLv2");
> +MODULE_LICENSE("GPL v2");

Patch applied.  Thanks!
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


From tom.k.cook at gmail.com  Mon Jun 24 06:11:25 2013
From: tom.k.cook at gmail.com (Tom Cook)
Date: Mon, 24 Jun 2013 11:11:25 +0100
Subject: dwc_otg FIQ Handler and Data Aborts
Message-ID: <CAFSh4UzuTLhce0t2vbeD-gFEmh0u95LHjDaHfE2fTa3agNR32w@mail.gmail.com>

The current dwc_otg driver implementation in
https://github.com/raspberrypi/linux.git causes a kernel oops if a
data abort occurs during the FIQ handler.

Although you might expect this to never happen, there is one case
where it does come up: when using ftrace.  ftrace implements tracing
as a hardware watchpoint, which causes a data abort.  When ftrace is
enabled it instruments the FIQ handler (dwc_otg_hcd_handle_fiq) with a
hw watchpoint, which very quickly leads to a data abort in the
handler.  Since data aborts during FIQ handlers are not implemented,
this leads to a kernel oops.

While it is possible to filter out the FIQ handler using
set_ftrace_filter and set_ftrace_notrace, there must be a way to build
this in to the kernel - after all, data aborts are not handled in IRQ
mode either, and they don't cause kernel oopses.  So I'm guessing that
there is something that should be done to the FIQ handler to make it
'immune' to data aborts that isn't happening.  Can someone point me
toward what that is?

Thanks,
Tom


From lukasmaiwald at gmail.com  Tue Jun 25 04:44:11 2013
From: lukasmaiwald at gmail.com (Lukas Maiwald)
Date: Tue, 25 Jun 2013 10:44:11 +0200
Subject: ARMs standby mode
Message-ID: <CALH25JmqnK20HgRhVH2J5sX+cKX7CafphhBjTz6xXZZLVJXFjA@mail.gmail.com>

Hey Guys,
from what i saw in the archives you really seem to know what you're doing.
For my bachelor thesis i want to make the raspberry pi as energy efficient
as possible. Therefore i want to use the ARM1176jzf-s's standby mode
(which one accesses via the Wait For Interrupt operation of the chip).
Since my ARM is running in user mode i can not access the coprocessor
simply (which i'd need for the WFI operation). Some people even told me
the ARM might automatically use it's standby mode when idle, but i need
a prove for that since it's for my bachelor thesis. Any help is highly
appreciated!
Sincerely Yours,
Lukas


From tom.k.cook at gmail.com  Wed Jun 26 10:39:10 2013
From: tom.k.cook at gmail.com (Tom Cook)
Date: Wed, 26 Jun 2013 15:39:10 +0100
Subject: PATCH: Enable sdhci-bcm2708 build as a module
Message-ID: <CAFSh4UyBuAM_FaaMmp6Km7LBCr2cFoLmABRvqLy__T1PqyW+3w@mail.gmail.com>

See the patch below.  In summary:
 * arch/arm/mach-bcm2708/bcm2708.c modified so that the platform
device is created for both built-in and module cases.  Also export
symbol frc_clock_ticks32.
 * Move the enable_llm parameter from sdhci-bcm2708 to sdhci - that is
where it is used.
 * Export sdhci_spin_lock and sdhci_spin_unlock from sdhci.c.

The patch is against the 3.8.y branch but not much seems to have
changed here in other branches.  Tested on RPI model B.

What's the right process to get this into the github repository?

Regards,
Tom

>From ca4afa3722b4f6c95fa61f5bb570c41abdc25702 Mon Sep 17 00:00:00 2001
From: Tom Cook <tom at ringer>
Date: Wed, 26 Jun 2013 15:30:02 +0100
Subject: [PATCH] Made sdhci-bcm2708 compilable as a module.

---
 arch/arm/mach-bcm2708/bcm2708.c  |    6 ++++--
 drivers/mmc/host/sdhci-bcm2708.c |    5 -----
 drivers/mmc/host/sdhci.c         |   12 +++++++++---
 3 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-bcm2708/bcm2708.c b/arch/arm/mach-bcm2708/bcm2708.c
index 4f15872..f747493 100644
--- a/arch/arm/mach-bcm2708/bcm2708.c
+++ b/arch/arm/mach-bcm2708/bcm2708.c
@@ -187,6 +187,7 @@ unsigned long frc_clock_ticks32(void)
 {
  return timer_read();
 }
+EXPORT_SYMBOL_GPL(frc_clock_ticks32);

 static void __init bcm2708_clocksource_init(void)
 {
@@ -463,7 +464,8 @@ static struct platform_device bcm2708_systemtimer_device = {
  },
 };

-#ifdef CONFIG_MMC_SDHCI_BCM2708 /* Arasan emmc SD */
+/* Arasan emmc SD */
+#if defined CONFIG_MMC_SDHCI_BCM2708 | defined CONFIG_MMC_SDHCI_BCM2708_MODULE
 static struct resource bcm2708_emmc_resources[] = {
  [0] = {
        .start = EMMC_BASE,
@@ -735,7 +737,7 @@ void __init bcm2708_init(void)
  bcm_register_device(&bcm2708_uart1_device);
  bcm_register_device(&bcm2708_powerman_device);

-#ifdef CONFIG_MMC_SDHCI_BCM2708
+#if defined CONFIG_MMC_SDHCI_BCM2708 | defined CONFIG_MMC_SDHCI_BCM2708_MODULE
  bcm_register_device(&bcm2708_emmc_device);
 #endif
  bcm2708_init_led();
diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
index c2409b9..3a9cd3a 100644
--- a/drivers/mmc/host/sdhci-bcm2708.c
+++ b/drivers/mmc/host/sdhci-bcm2708.c
@@ -138,7 +138,6 @@ static int emmc_clock_freq = BCM2708_EMMC_CLOCK_FREQ;
 static bool sync_after_dma = 1;
 static bool missing_status = 1;
 static bool spurious_crc_acmd51 = 0;
-bool enable_llm = 1;
 bool extra_messages = 0;

 #if 0
@@ -1204,8 +1203,6 @@ static int sdhci_bcm2708_probe(struct
platform_device *pdev)
  }


- printk("sdhci: %s low-latency mode\n",enable_llm?"Enable":"Disable");
-
  host->hw_name = "BCM2708_Arasan";
  host->ops = &sdhci_bcm2708_ops;
  host->irq = platform_get_irq(pdev, 0);
@@ -1400,7 +1397,6 @@ module_param(emmc_clock_freq, int, 0444);
 module_param(sync_after_dma, bool, 0444);
 module_param(missing_status, bool, 0444);
 module_param(spurious_crc_acmd51, bool, 0444);
-module_param(enable_llm, bool, 0444);
 module_param(cycle_delay, int, 0444);
 module_param(extra_messages, bool, 0444);

@@ -1414,7 +1410,6 @@ MODULE_PARM_DESC(emmc_clock_freq, "Specify the
speed of emmc clock");
 MODULE_PARM_DESC(sync_after_dma, "Block in driver until dma complete");
 MODULE_PARM_DESC(missing_status, "Use the missing status quirk");
 MODULE_PARM_DESC(spurious_crc_acmd51, "Use the spurious crc quirk for
reading SCR (ACMD51)");
-MODULE_PARM_DESC(enable_llm, "Enable low-latency mode");
 MODULE_PARM_DESC(extra_messages, "Enable more sdcard warning messages");


diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 134154b..cbd4fce 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -123,7 +123,8 @@ static void sdhci_dumpregs(struct sdhci_host *host)
  * Low level functions                                                       *
  *                                                                           *
 \*****************************************************************************/
-extern bool enable_llm;
+bool enable_llm = 1;
+EXPORT_SYMBOL_GPL(enable_llm);
 static int sdhci_locked=0;
 void sdhci_spin_lock(struct sdhci_host *host)
 {
@@ -138,6 +139,7 @@ void sdhci_spin_lock(struct sdhci_host *host)
  }
 #endif
 }
+EXPORT_SYMBOL_GPL(sdhci_spin_lock);

 void sdhci_spin_unlock(struct sdhci_host *host)
 {
@@ -152,6 +154,7 @@ void sdhci_spin_unlock(struct sdhci_host *host)
 #endif
  spin_unlock(&host->lock);
 }
+EXPORT_SYMBOL_GPL(sdhci_spin_unlock);

 void sdhci_spin_lock_irqsave(struct sdhci_host *host,unsigned long *flags)
 {
@@ -1280,9 +1283,9 @@ static void sdhci_set_clock(struct sdhci_host
*host, unsigned int clock)
  return;
  }
  timeout--;
- sdhci_spin_enable_schedule(host);
+ //sdhci_spin_enable_schedule(host);
  mdelay(1);
- sdhci_spin_disable_schedule(host);
+ //sdhci_spin_disable_schedule(host);
  }

  clk |= SDHCI_CLOCK_CARD_EN;
@@ -3402,6 +3405,7 @@ module_exit(sdhci_drv_exit);

 module_param(debug_quirks, uint, 0444);
 module_param(debug_quirks2, uint, 0444);
+module_param(enable_llm, bool, 0444);

 MODULE_AUTHOR("Pierre Ossman <pierre at ossman.eu>");
 MODULE_DESCRIPTION("Secure Digital Host Controller Interface core driver");
@@ -3409,3 +3413,5 @@ MODULE_LICENSE("GPL");

 MODULE_PARM_DESC(debug_quirks, "Force certain quirks.");
 MODULE_PARM_DESC(debug_quirks2, "Force certain other quirks.");
+MODULE_PARM_DESC(enable_llm, "Enable low-latency mode");
+
--
1.7.9.5


