kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Tomek The Messenger <tomekthemessenger@gmail.com>
To: kernelnewbies <kernelnewbies@kernelnewbies.org>, ezra@easyb.ch
Subject: initialization of global variables in u-boot
Date: Thu, 5 Nov 2020 00:02:34 +0100	[thread overview]
Message-ID: <CAA4NGyuD492XaJ=-Xmc33pJjhUGDdi_4VO788SGq1ZvnBGttrQ@mail.gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1567 bytes --]

Hi
As there is none u-boot mailing list anymore I will ask question here.
Maybe someone will know answer.
I have two watchdogs in hardware. One is synopsys designware one (so
standard u-boot global functions hw_watchdog_init and hw_watchdog_reset are
implemented by open source synopsys designware driver. And I have second
watchdog for which I implement my own driver and it bases on device tree
model. Let's see at below code:
include/watchdog.h  (I added second config and modify macro WATCHDOG_RESET)
[code]
 extern void hw_watchdog_reset(void);
#if defined(CONFIG_DM_HW_WATCHDOG)
     extern void dm_hw_watchdog_reset(void);
#define WATCHDOG_RESET() {hw_watchdog_reset();      dm_hw_watchdog_reset();}
#else
#define WATCHDOG_RESET hw_watchdog_reset
#endif
[/code]

implementation of dm_hw_watchdog_reset function:
[code]
#ifndef CONFIG_SPL_BUILD
struct udevice* wdt = NULL;
void dm_hw_watchdog_reset(void)
{
int ret;
if (wdt) {
    printf("dm_hw_watchdog_reset\n");
    wdt_reset(wdt);
}
else {
    ret = 2+8;
    /*ret = uclass_get_device_by_driver(UCLASS_WDT,
 DM_GET_DRIVER(wdt_bmu), &wdt);
    if (ret)
        printf("Lack of watchdog device\n");
    else
        wdt_start(wdt, 60000, 0);*/
    }
}
#else
void dm_hw_watchdog_reset(void)
{
}
#endif  [/code]

What is weird when Uboot is started it prints tens of times:
" dm_hw_watchdog_reset"
and then hangs on. I have to power on/off the board and recovery it with
the aid of jtag. I don't understand why 'wdt' variable isn't NULL and code
under if (wdt) is executed. Seems like something uboot specific.

[-- Attachment #1.2: Type: text/html, Size: 1948 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

                 reply	other threads:[~2020-11-04 23:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='CAA4NGyuD492XaJ=-Xmc33pJjhUGDdi_4VO788SGq1ZvnBGttrQ@mail.gmail.com' \
    --to=tomekthemessenger@gmail.com \
    --cc=ezra@easyb.ch \
    --cc=kernelnewbies@kernelnewbies.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).