diff options
author | Tom Rini <trini@konsulko.com> | 2025-07-08 09:34:47 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2025-07-08 09:34:47 -0600 |
commit | f75eaf7356933661ae13b1f5c815ac6ed475eab3 (patch) | |
tree | fa5b17e5a5b2bad591c4e44a06bd6bef6cae778e /net/net-common.c | |
parent | b379335f141e3ddca0cdbb5d9d39af0444530542 (diff) | |
parent | 203be3197de1016236f55652ce8ee4cbfe3035ad (diff) |
Merge tag 'net-next-20250708' of https://source.denx.de/u-boot/custodians/u-boot-net
Pull request net-next-20250708
lwip:
- Call sys_check_timeouts() and schedule() on RX to fix an issue on
boards with a watchdog and simplify the code
- Enable IP_FRAG and IP_REASSEMBLY
- Add support for setting the TFTP blocksize at runtime
- Fix DNS initialization in wget
- Add the sntp command
- Move code from net/lwip/${cmd}.c to cmd/lwip/${cmd}.c
Diffstat (limited to 'net/net-common.c')
-rw-r--r-- | net/net-common.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/net-common.c b/net/net-common.c index e01b0da7d7b..b064557d524 100644 --- a/net/net-common.c +++ b/net/net-common.c @@ -1,5 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 + +#include <dm/uclass.h> #include <net-common.h> +#include <linux/time.h> +#include <rtc.h> void copy_filename(char *dst, const char *src, int size) { @@ -25,3 +29,22 @@ int wget_request(ulong dst_addr, char *uri, struct wget_http_info *info) wget_info = info ? info : &default_wget_info; return wget_do_request(dst_addr, uri); } + +void net_sntp_set_rtc(u32 seconds) +{ + struct rtc_time tm; + struct udevice *dev; + int ret; + + rtc_to_tm(seconds, &tm); + + ret = uclass_get_device(UCLASS_RTC, 0, &dev); + if (ret) + printf("SNTP: cannot find RTC: err=%d\n", ret); + else + dm_rtc_set(dev, &tm); + + printf("Date: %4d-%02d-%02d Time: %2d:%02d:%02d\n", + tm.tm_year, tm.tm_mon, tm.tm_mday, + tm.tm_hour, tm.tm_min, tm.tm_sec); +} |