All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 2/3] watchdog: rti_wdt: Add support for loading firmware
Date: Tue, 23 Jun 2020 14:37:08 +0200	[thread overview]
Message-ID: <f9575f93-2cd3-6a97-9e85-f390c55ffc52@siemens.com> (raw)
In-Reply-To: <3897255c-f9c7-972e-56e2-6a0036c927fc@ti.com>

On 23.06.20 13:50, Lokesh Vutla wrote:
> 
> 
> On 23/06/20 4:45 pm, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> To avoid the need of extra boot scripting on AM65x for loading a
>> watchdog firmware, add the required rproc init and loading logic for the
>> first R5F core to the watchdog start handler. The firmware itself is
>> embedded into U-Boot binary.
>>
>> One possible firmware source is https://github.com/siemens/k3-rti-wdt.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>   drivers/watchdog/Kconfig      | 20 ++++++++++++++++++++
>>   drivers/watchdog/Makefile     |  3 +++
>>   drivers/watchdog/rti_wdt.c    | 24 ++++++++++++++++++++++++
>>   drivers/watchdog/rti_wdt_fw.S | 20 ++++++++++++++++++++
>>   4 files changed, 67 insertions(+)
>>   create mode 100644 drivers/watchdog/rti_wdt_fw.S
>>
>> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
>> index ee99bd2af1..fd6ab9a85b 100644
>> --- a/drivers/watchdog/Kconfig
>> +++ b/drivers/watchdog/Kconfig
>> @@ -162,6 +162,26 @@ config WDT_K3_RTI
>>   	  Say Y here if you want to include support for the K3 watchdog
>>   	  timer (RTI module) available in the K3 generation of processors.
>>   
>> +if WDT_K3_RTI
>> +
>> +config WDT_K3_RTI_LOAD_FW
>> +	bool "Load watchdog firmware"
>> +	depends on REMOTEPROC
>> +	help
>> +	  Automatically load the specified firmware image into the MCU R5F
>> +	  core 0. On the AM65x, this firmware is supposed to handle the expiry
>> +	  of the watchdog timer, typically by resetting the system.
>> +
>> +config WDT_K3_RTI_FW_FILE
>> +	string "Watchdog firmware image file"
>> +	default "k3-rti-wdt.fw"
>> +	depends on WDT_K3_RTI_LOAD_FW
>> +	help
>> +	  Firmware image to be embedded into U-Boot and loaded on watchdog
>> +	  start.
>> +
>> +endif
>> +
>>   config WDT_SANDBOX
>>   	bool "Enable Watchdog Timer support for Sandbox"
>>   	depends on SANDBOX && WDT
>> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
>> index 16bdbf4970..bf58684875 100644
>> --- a/drivers/watchdog/Makefile
>> +++ b/drivers/watchdog/Makefile
>> @@ -28,7 +28,10 @@ obj-$(CONFIG_WDT_MT7621) += mt7621_wdt.o
>>   obj-$(CONFIG_WDT_MTK) += mtk_wdt.o
>>   obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
>>   obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o
>> +obj-$(CONFIG_WDT_K3_RTI_LOAD_FW) += rti_wdt_fw.o
>>   obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
>>   obj-$(CONFIG_WDT_STM32MP) += stm32mp_wdt.o
>>   obj-$(CONFIG_WDT_TANGIER) += tangier_wdt.o
>>   obj-$(CONFIG_WDT_XILINX) += xilinx_wwdt.o
>> +
>> +$(obj)/rti_wdt_fw.o: $(shell readlink -f $(CONFIG_WDT_K3_RTI_FW_FILE)) FORCE
>> diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c
>> index ebe29c7409..38e82a6b6b 100644
>> --- a/drivers/watchdog/rti_wdt.c
>> +++ b/drivers/watchdog/rti_wdt.c
>> @@ -14,6 +14,7 @@
>>   #include <power-domain.h>
>>   #include <wdt.h>
>>   #include <asm/io.h>
>> +#include <remoteproc.h>
>>   
>>   /* Timer register set definition */
>>   #define RTIDWDCTRL		0x90
>> @@ -37,11 +38,16 @@
>>   
>>   #define WDT_PRELOAD_MAX		0xfff
>>   
>> +#define RTI_PROC_ID		0
> 
> Can we get the rproc id from DT?

You mean, resolve "mcu_r5fss0_core0" to the ID? Doable.

> 
>> +
>>   struct rti_wdt_priv {
>>   	phys_addr_t regs;
>>   	unsigned int clk_khz;
>>   };
>>   
>> +extern const u32 rti_wdt_fw[];
>> +extern const int rti_wdt_fw_size;
> 
> FIT is the preferred way of packing images in U-Boot. Can you try using it?

How does that work? Some example for me?

What benefit would that bring? There are other users of this pattern, 
e.g. board/xilinx/zynqmp/pm_cfg_obj.S.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

  reply	other threads:[~2020-06-23 12:37 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-23 11:15 [PATCH v2 0/3] watchdog: K3: Add RTI watchdog support Jan Kiszka
2020-06-23 11:15 ` [PATCH v2 1/3] watchdog: Add support for K3 RTI watchdog Jan Kiszka
2020-06-23 11:47   ` Lokesh Vutla
2020-06-23 12:26     ` Jan Kiszka
2020-06-23 11:15 ` [PATCH v2 2/3] watchdog: rti_wdt: Add support for loading firmware Jan Kiszka
2020-06-23 11:50   ` Lokesh Vutla
2020-06-23 12:37     ` Jan Kiszka [this message]
2020-06-23 14:41       ` Jan Kiszka
2020-06-29  2:26         ` Lokesh Vutla
2020-06-29  4:50           ` Jan Kiszka
2020-06-29  4:54             ` Lokesh Vutla
2020-06-29  7:44               ` Jan Kiszka
2020-06-29 12:37           ` Tom Rini
2020-06-29 18:44             ` Jan Kiszka
2020-07-20  9:36               ` Jan Kiszka
2020-07-21  5:27                 ` Lokesh Vutla
2020-07-21  6:26                   ` Jan Kiszka
2020-06-23 11:15 ` [PATCH v2 3/3] arm: dts: k3: Add RTI watchdogs Jan Kiszka
2020-08-11 10:33 ` [PATCH v2 0/3] watchdog: K3: Add RTI watchdog support Lokesh Vutla
2020-08-11 10:42   ` Jan Kiszka
2020-08-11 10:46     ` Lokesh Vutla
2020-08-11 12:37       ` Jan Kiszka
2020-08-11 14:36         ` Lokesh Vutla
2020-08-11 14:58           ` Jan Kiszka
2020-08-11 18:01             ` Lokesh Vutla
2020-08-13 12:12               ` Jan Kiszka
2020-08-17 11:31                 ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9575f93-2cd3-6a97-9e85-f390c55ffc52@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.