Merge branch '2022-05-05-assorted-cleanups-and-fixes'

- Assorted minor code cleanups.
- Clean-up the reset uclass code slightly and fix some issues with a
  lack of handlers for a case in the driver.
- Y2038 RTC fix
This commit is contained in:
Tom Rini 2022-05-05 19:37:22 -04:00
commit 03b873b4f4
38 changed files with 59 additions and 351 deletions

View File

@ -71,7 +71,6 @@ static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int argc,
static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
char *varname = NULL;
struct udevice *dev;
unsigned int data;
int ret, uV, val;
@ -79,9 +78,6 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
if (argc < 3)
return CMD_RET_USAGE;
if (argc >= 3)
varname = argv[2];
ret = adc_channel_single_shot(argv[1], simple_strtol(argv[2], NULL, 0),
&data);
if (ret) {
@ -99,8 +95,7 @@ static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
printf("%u\n", data);
}
if (varname)
env_set_ulong(varname, val);
env_set_ulong(argv[2], val);
return CMD_RET_SUCCESS;
}

View File

@ -1071,7 +1071,7 @@ static int fdt_print(const char *pathp, char *prop, int depth)
/********************************************************************/
#ifdef CONFIG_SYS_LONGHELP
static char fdt_help_text[] =
"addr [-cq] <addr> [<length>] - Set the [control] fdt location to <addr>\n"
"addr [-c] [-q] <addr> [<size>] - Set the [control] fdt location to <addr>\n"
#ifdef CONFIG_OF_LIBFDT_OVERLAY
"fdt apply <addr> - Apply overlay to the DT\n"
#endif

View File

@ -501,11 +501,12 @@ static int do_mmc_rescan(struct cmd_tbl *cmdtp, int flag,
int argc, char *const argv[])
{
struct mmc *mmc;
enum bus_mode speed_mode = MMC_MODES_END;
if (argc == 1) {
mmc = init_mmc_device(curr_device, true);
} else if (argc == 2) {
enum bus_mode speed_mode;
speed_mode = (int)dectoul(argv[1], NULL);
mmc = __init_mmc_device(curr_device, true, speed_mode);
} else {
@ -543,7 +544,6 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
{
int dev, part = 0, ret;
struct mmc *mmc;
enum bus_mode speed_mode = MMC_MODES_END;
if (argc == 1) {
dev = curr_device;
@ -561,6 +561,8 @@ static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
}
mmc = init_mmc_device(dev, true);
} else if (argc == 4) {
enum bus_mode speed_mode;
dev = (int)dectoul(argv[1], NULL);
part = (int)dectoul(argv[2], NULL);
if (part > PART_ACCESS_MASK) {

View File

@ -53,7 +53,7 @@ static int arg_off_size_onenand(int argc, char *const argv[], ulong *off,
if (*size == mtd->size)
puts("whole chip\n");
else
printf("offset 0x%lx, size 0x%x\n", *off, *size);
printf("offset 0x%lx, size 0x%zx\n", *off, *size);
return 0;
}
@ -401,7 +401,7 @@ static int do_onenand_read(struct cmd_tbl *cmdtp, int flag, int argc,
ret = onenand_block_read(ofs, len, &retlen, (u8 *)addr, oob);
printf(" %d bytes read: %s\n", retlen, ret ? "ERROR" : "OK");
printf(" %zu bytes read: %s\n", retlen, ret ? "ERROR" : "OK");
return ret == 0 ? 0 : 1;
}
@ -428,7 +428,7 @@ static int do_onenand_write(struct cmd_tbl *cmdtp, int flag, int argc,
ret = onenand_block_write(ofs, len, &retlen, (u8 *)addr, withoob);
printf(" %d bytes written: %s\n", retlen, ret ? "ERROR" : "OK");
printf(" %zu bytes written: %s\n", retlen, ret ? "ERROR" : "OK");
return ret == 0 ? 0 : 1;
}

View File

@ -53,7 +53,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name)
if (ret)
return ret;
*name = out.clock_name;
*name = strdup(out.clock_name);
return 0;
}
@ -152,11 +152,9 @@ static int scmi_clk_probe(struct udevice *dev)
return ret;
for (i = 0; i < num_clocks; i++) {
char *name;
if (!scmi_clk_get_attibute(dev, i, &name)) {
char *clock_name = strdup(name);
char *clock_name;
if (!scmi_clk_get_attibute(dev, i, &clock_name)) {
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
if (!clk || !clock_name)
ret = -ENOMEM;

View File

@ -20,6 +20,10 @@
#include <malloc.h>
#include <spl.h>
#ifdef CONFIG_CMD_UBIFS
#include <ubi_uboot.h>
#endif
DECLARE_GLOBAL_DATA_PTR;
/**

View File

@ -18,22 +18,6 @@ struct ast2500_reset_priv {
struct ast2500_scu *scu;
};
static int ast2500_reset_request(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int ast2500_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int ast2500_reset_assert(struct reset_ctl *reset_ctl)
{
struct ast2500_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -93,8 +77,6 @@ static const struct udevice_id ast2500_reset_ids[] = {
};
struct reset_ops ast2500_reset_ops = {
.request = ast2500_reset_request,
.rfree = ast2500_reset_free,
.rst_assert = ast2500_reset_assert,
.rst_deassert = ast2500_reset_deassert,
};

View File

@ -17,22 +17,6 @@ struct ast2600_reset_priv {
struct ast2600_scu *scu;
};
static int ast2600_reset_request(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int ast2600_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int ast2600_reset_assert(struct reset_ctl *reset_ctl)
{
struct ast2600_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -92,8 +76,6 @@ static const struct udevice_id ast2600_reset_ids[] = {
};
struct reset_ops ast2600_reset_ops = {
.request = ast2600_reset_request,
.rfree = ast2600_reset_free,
.rst_assert = ast2600_reset_assert,
.rst_deassert = ast2600_reset_deassert,
};

View File

@ -42,11 +42,6 @@ static int bcm6345_reset_deassert(struct reset_ctl *rst)
return 0;
}
static int bcm6345_reset_free(struct reset_ctl *rst)
{
return 0;
}
static int bcm6345_reset_request(struct reset_ctl *rst)
{
if (rst->id >= MAX_RESETS)
@ -56,7 +51,6 @@ static int bcm6345_reset_request(struct reset_ctl *rst)
}
struct reset_ops bcm6345_reset_reset_ops = {
.rfree = bcm6345_reset_free,
.request = bcm6345_reset_request,
.rst_assert = bcm6345_reset_assert,
.rst_deassert = bcm6345_reset_deassert,

View File

@ -18,16 +18,6 @@ struct dra7_reset_priv {
u8 nreset;
};
static int dra7_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int dra7_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static inline void dra7_reset_rmw(u32 addr, u32 value, u32 mask)
{
writel(((readl(addr) & (~mask)) | (value & mask)), addr);
@ -63,8 +53,6 @@ static int dra7_reset_assert(struct reset_ctl *reset_ctl)
}
struct reset_ops dra7_reset_ops = {
.request = dra7_reset_request,
.rfree = dra7_reset_free,
.rst_assert = dra7_reset_assert,
.rst_deassert = dra7_reset_deassert,
};

View File

@ -46,16 +46,6 @@ static int hisi_reset_assert(struct reset_ctl *rst)
return 0;
}
static int hisi_reset_free(struct reset_ctl *rst)
{
return 0;
}
static int hisi_reset_request(struct reset_ctl *rst)
{
return 0;
}
static int hisi_reset_of_xlate(struct reset_ctl *rst,
struct ofnode_phandle_args *args)
{
@ -74,8 +64,6 @@ static int hisi_reset_of_xlate(struct reset_ctl *rst,
static const struct reset_ops hisi_reset_reset_ops = {
.of_xlate = hisi_reset_of_xlate,
.request = hisi_reset_request,
.rfree = hisi_reset_free,
.rst_assert = hisi_reset_assert,
.rst_deassert = hisi_reset_deassert,
};

View File

@ -76,15 +76,7 @@ static int hsdk_reset_reset(struct reset_ctl *rst_ctl)
return hsdk_reset_do(rst);
}
static int hsdk_reset_noop(struct reset_ctl *rst_ctl)
{
return 0;
}
static const struct reset_ops hsdk_reset_ops = {
.request = hsdk_reset_noop,
.rfree = hsdk_reset_noop,
.rst_assert = hsdk_reset_noop,
.rst_deassert = hsdk_reset_reset,
};

View File

@ -264,19 +264,7 @@ static int imx7_reset_deassert(struct reset_ctl *rst)
return priv->ops.rst_deassert(rst);
}
static int imx7_reset_free(struct reset_ctl *rst)
{
return 0;
}
static int imx7_reset_request(struct reset_ctl *rst)
{
return 0;
}
static const struct reset_ops imx7_reset_reset_ops = {
.request = imx7_reset_request,
.rfree = imx7_reset_free,
.rst_assert = imx7_reset_assert,
.rst_deassert = imx7_reset_deassert,
};

View File

@ -130,19 +130,7 @@ static int ipq4019_reset_deassert(struct reset_ctl *rst)
return 0;
}
static int ipq4019_reset_free(struct reset_ctl *rst)
{
return 0;
}
static int ipq4019_reset_request(struct reset_ctl *rst)
{
return 0;
}
static const struct reset_ops ipq4019_reset_ops = {
.request = ipq4019_reset_request,
.rfree = ipq4019_reset_free,
.rst_assert = ipq4019_reset_assert,
.rst_deassert = ipq4019_reset_deassert,
};

View File

@ -24,16 +24,6 @@ struct mediatek_reset_priv {
u32 nr_resets;
};
static int mediatek_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mediatek_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mediatek_reset_assert(struct reset_ctl *reset_ctl)
{
struct mediatek_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -59,8 +49,6 @@ static int mediatek_reset_deassert(struct reset_ctl *reset_ctl)
}
struct reset_ops mediatek_reset_ops = {
.request = mediatek_reset_request,
.rfree = mediatek_reset_free,
.rst_assert = mediatek_reset_assert,
.rst_deassert = mediatek_reset_deassert,
};

View File

@ -30,11 +30,6 @@ static int meson_reset_request(struct reset_ctl *reset_ctl)
return 0;
}
static int meson_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int meson_reset_level(struct reset_ctl *reset_ctl, bool assert)
{
struct meson_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -65,7 +60,6 @@ static int meson_reset_deassert(struct reset_ctl *reset_ctl)
struct reset_ops meson_reset_ops = {
.request = meson_reset_request,
.rfree = meson_reset_free,
.rst_assert = meson_reset_assert,
.rst_deassert = meson_reset_deassert,
};

View File

@ -18,16 +18,6 @@ struct mtmips_reset_priv {
void __iomem *base;
};
static int mtmips_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mtmips_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int mtmips_reset_assert(struct reset_ctl *reset_ctl)
{
struct mtmips_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -47,8 +37,6 @@ static int mtmips_reset_deassert(struct reset_ctl *reset_ctl)
}
static const struct reset_ops mtmips_reset_ops = {
.request = mtmips_reset_request,
.rfree = mtmips_reset_free,
.rst_assert = mtmips_reset_assert,
.rst_deassert = mtmips_reset_deassert,
};

View File

@ -18,11 +18,6 @@ static int raspberrypi_reset_request(struct reset_ctl *reset_ctl)
return 0;
}
static int raspberrypi_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int raspberrypi_reset_assert(struct reset_ctl *reset_ctl)
{
switch (reset_ctl->id) {
@ -34,16 +29,9 @@ static int raspberrypi_reset_assert(struct reset_ctl *reset_ctl)
}
}
static int raspberrypi_reset_deassert(struct reset_ctl *reset_ctl)
{
return 0;
}
struct reset_ops raspberrypi_reset_ops = {
.request = raspberrypi_reset_request,
.rfree = raspberrypi_reset_free,
.rst_assert = raspberrypi_reset_assert,
.rst_deassert = raspberrypi_reset_deassert,
};
static const struct udevice_id raspberrypi_reset_ids[] = {

View File

@ -40,14 +40,6 @@ static int rockchip_reset_request(struct reset_ctl *reset_ctl)
return 0;
}
static int rockchip_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int rockchip_reset_assert(struct reset_ctl *reset_ctl)
{
struct rockchip_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -80,7 +72,6 @@ static int rockchip_reset_deassert(struct reset_ctl *reset_ctl)
struct reset_ops rockchip_reset_ops = {
.request = rockchip_reset_request,
.rfree = rockchip_reset_free,
.rst_assert = rockchip_reset_assert,
.rst_deassert = rockchip_reset_deassert,
};

View File

@ -65,14 +65,8 @@ static int scmi_reset_request(struct reset_ctl *rst)
return scmi_to_linux_errno(out.status);
}
static int scmi_reset_rfree(struct reset_ctl *rst)
{
return 0;
}
static const struct reset_ops scmi_reset_domain_ops = {
.request = scmi_reset_request,
.rfree = scmi_reset_rfree,
.rst_assert = scmi_reset_assert,
.rst_deassert = scmi_reset_deassert,
};

View File

@ -63,16 +63,6 @@ static int sifive_reset_request(struct reset_ctl *rst)
return 0;
}
static int sifive_reset_free(struct reset_ctl *rst)
{
struct sifive_reset_priv *priv = dev_get_priv(rst->dev);
debug("%s(rst=%p) (dev=%p, id=%lu) (nr_reset=%d)\n", __func__,
rst, rst->dev, rst->id, priv->nr_reset);
return 0;
}
static int sifive_reset_probe(struct udevice *dev)
{
struct sifive_reset_priv *priv = dev_get_priv(dev);
@ -105,7 +95,6 @@ int sifive_reset_bind(struct udevice *dev, ulong count)
const struct reset_ops sifive_reset_ops = {
.request = sifive_reset_request,
.rfree = sifive_reset_free,
.rst_assert = sifive_reset_assert,
.rst_deassert = sifive_reset_deassert,
};

View File

@ -89,25 +89,7 @@ static int socfpga_reset_deassert(struct reset_ctl *reset_ctl)
false, 500, false);
}
static int socfpga_reset_request(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__,
reset_ctl, reset_ctl->dev, reset_ctl->id);
return 0;
}
static int socfpga_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static const struct reset_ops socfpga_reset_ops = {
.request = socfpga_reset_request,
.rfree = socfpga_reset_free,
.rst_assert = socfpga_reset_assert,
.rst_deassert = socfpga_reset_deassert,
};

View File

@ -41,13 +41,6 @@ static int sunxi_reset_request(struct reset_ctl *reset_ctl)
return 0;
}
static int sunxi_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s: (RST#%ld)\n", __func__, reset_ctl->id);
return 0;
}
static int sunxi_set_reset(struct reset_ctl *reset_ctl, bool on)
{
struct sunxi_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -85,7 +78,6 @@ static int sunxi_reset_deassert(struct reset_ctl *reset_ctl)
struct reset_ops sunxi_reset_ops = {
.request = sunxi_reset_request,
.rfree = sunxi_reset_free,
.rst_assert = sunxi_reset_assert,
.rst_deassert = sunxi_reset_deassert,
};

View File

@ -63,18 +63,6 @@ static int ti_sci_reset_of_xlate(struct reset_ctl *rst,
return 0;
}
static int ti_sci_reset_request(struct reset_ctl *rst)
{
debug("%s(rst=%p)\n", __func__, rst);
return 0;
}
static int ti_sci_reset_free(struct reset_ctl *rst)
{
debug("%s(rst=%p)\n", __func__, rst);
return 0;
}
/**
* ti_sci_reset_set() - program a device's reset
* @rst: Handle to a single reset signal
@ -193,8 +181,6 @@ static const struct udevice_id ti_sci_reset_of_match[] = {
static struct reset_ops ti_sci_reset_ops = {
.of_xlate = ti_sci_reset_of_xlate,
.request = ti_sci_reset_request,
.rfree = ti_sci_reset_free,
.rst_assert = ti_sci_reset_assert,
.rst_deassert = ti_sci_reset_deassert,
.rst_status = ti_sci_reset_status,

View File

@ -68,7 +68,7 @@ static int reset_get_by_index_tail(int ret, ofnode node,
return ret;
}
ret = ops->request(reset_ctl);
ret = ops->request ? ops->request(reset_ctl) : 0;
if (ret) {
debug("ops->request() failed: %d\n", ret);
return ret;
@ -168,7 +168,7 @@ int reset_request(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
return ops->request(reset_ctl);
return ops->request ? ops->request(reset_ctl) : 0;
}
int reset_free(struct reset_ctl *reset_ctl)
@ -177,7 +177,7 @@ int reset_free(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
return ops->rfree(reset_ctl);
return ops->rfree ? ops->rfree(reset_ctl) : 0;
}
int reset_assert(struct reset_ctl *reset_ctl)
@ -186,7 +186,7 @@ int reset_assert(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
return ops->rst_assert(reset_ctl);
return ops->rst_assert ? ops->rst_assert(reset_ctl) : 0;
}
int reset_assert_bulk(struct reset_ctl_bulk *bulk)
@ -208,7 +208,7 @@ int reset_deassert(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
return ops->rst_deassert(reset_ctl);
return ops->rst_deassert ? ops->rst_deassert(reset_ctl) : 0;
}
int reset_deassert_bulk(struct reset_ctl_bulk *bulk)
@ -230,7 +230,7 @@ int reset_status(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
return ops->rst_status(reset_ctl);
return ops->rst_status ? ops->rst_status(reset_ctl) : 0;
}
int reset_release_all(struct reset_ctl *reset_ctl, int count)

View File

@ -184,16 +184,6 @@ struct uniphier_reset_priv {
const struct uniphier_reset_data *data;
};
static int uniphier_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int uniphier_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int uniphier_reset_update(struct reset_ctl *reset_ctl, int assert)
{
struct uniphier_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -239,8 +229,6 @@ static int uniphier_reset_deassert(struct reset_ctl *reset_ctl)
}
static const struct reset_ops uniphier_reset_ops = {
.request = uniphier_reset_request,
.rfree = uniphier_reset_free,
.rst_assert = uniphier_reset_assert,
.rst_deassert = uniphier_reset_deassert,
};

View File

@ -59,16 +59,6 @@ static int zynqmp_reset_request(struct reset_ctl *rst)
return 0;
}
static int zynqmp_reset_free(struct reset_ctl *rst)
{
struct zynqmp_reset_priv *priv = dev_get_priv(rst->dev);
dev_dbg(rst->dev, "%s(rst=%p) (id=%lu) (nr_reset=%d)\n", __func__,
rst, rst->id, priv->nr_reset);
return 0;
}
static int zynqmp_reset_probe(struct udevice *dev)
{
struct zynqmp_reset_priv *priv = dev_get_priv(dev);
@ -80,7 +70,6 @@ static int zynqmp_reset_probe(struct udevice *dev)
const struct reset_ops zynqmp_reset_ops = {
.request = zynqmp_reset_request,
.rfree = zynqmp_reset_free,
.rst_assert = zynqmp_reset_assert,
.rst_deassert = zynqmp_reset_deassert,
};

View File

@ -280,16 +280,6 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert)
return 0;
}
static int sti_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int sti_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int sti_reset_assert(struct reset_ctl *reset_ctl)
{
return sti_reset_program_hw(reset_ctl, true);
@ -301,8 +291,6 @@ static int sti_reset_deassert(struct reset_ctl *reset_ctl)
}
struct reset_ops sti_reset_ops = {
.request = sti_reset_request,
.rfree = sti_reset_free,
.rst_assert = sti_reset_assert,
.rst_deassert = sti_reset_deassert,
};

View File

@ -27,16 +27,6 @@ struct stm32_reset_priv {
fdt_addr_t base;
};
static int stm32_reset_request(struct reset_ctl *reset_ctl)
{
return 0;
}
static int stm32_reset_free(struct reset_ctl *reset_ctl)
{
return 0;
}
static int stm32_reset_assert(struct reset_ctl *reset_ctl)
{
struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@ -80,8 +70,6 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl)
}
static const struct reset_ops stm32_reset_ops = {
.request = stm32_reset_request,
.rfree = stm32_reset_free,
.rst_assert = stm32_reset_assert,
.rst_deassert = stm32_reset_deassert,
};

View File

@ -23,14 +23,6 @@ static int tegra_car_reset_request(struct reset_ctl *reset_ctl)
return 0;
}
static int tegra_car_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int tegra_car_reset_assert(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
@ -53,21 +45,12 @@ static int tegra_car_reset_deassert(struct reset_ctl *reset_ctl)
struct reset_ops tegra_car_reset_ops = {
.request = tegra_car_reset_request,
.rfree = tegra_car_reset_free,
.rst_assert = tegra_car_reset_assert,
.rst_deassert = tegra_car_reset_deassert,
};
static int tegra_car_reset_probe(struct udevice *dev)
{
debug("%s(dev=%p)\n", __func__, dev);
return 0;
}
U_BOOT_DRIVER(tegra_car_reset) = {
.name = "tegra_car_reset",
.id = UCLASS_RESET,
.probe = tegra_car_reset_probe,
.ops = &tegra_car_reset_ops,
};

View File

@ -11,22 +11,6 @@
#include <reset-uclass.h>
#include <asm/arch-tegra/bpmp_abi.h>
static int tegra186_reset_request(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int tegra186_reset_free(struct reset_ctl *reset_ctl)
{
debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl,
reset_ctl->dev, reset_ctl->id);
return 0;
}
static int tegra186_reset_common(struct reset_ctl *reset_ctl,
enum mrq_reset_commands cmd)
{
@ -61,22 +45,12 @@ static int tegra186_reset_deassert(struct reset_ctl *reset_ctl)
}
struct reset_ops tegra186_reset_ops = {
.request = tegra186_reset_request,
.rfree = tegra186_reset_free,
.rst_assert = tegra186_reset_assert,
.rst_deassert = tegra186_reset_deassert,
};
static int tegra186_reset_probe(struct udevice *dev)
{
debug("%s(dev=%p)\n", __func__, dev);
return 0;
}
U_BOOT_DRIVER(tegra186_reset) = {
.name = "tegra186_reset",
.id = UCLASS_RESET,
.probe = tegra186_reset_probe,
.ops = &tegra186_reset_ops,
};

View File

@ -49,7 +49,7 @@ static int rv8803_rtc_set(struct udevice *dev, const struct rtc_time *tm)
printf("WARNING: year should be between 2000 and 2099!\n");
buf[RTC_YR_REG_ADDR] = bin2bcd(tm->tm_year % 100);
buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon);
buf[RTC_MON_REG_ADDR] = bin2bcd(tm->tm_mon + 1);
buf[RTC_DAY_REG_ADDR] = 1 << (tm->tm_wday & 0x7);
buf[RTC_DATE_REG_ADDR] = bin2bcd(tm->tm_mday);
buf[RTC_HR_REG_ADDR] = bin2bcd(tm->tm_hour);
@ -90,7 +90,7 @@ static int rv8803_rtc_get(struct udevice *dev, struct rtc_time *tm)
tm->tm_min = bcd2bin(buf[RTC_MIN_REG_ADDR] & 0x7F);
tm->tm_hour = bcd2bin(buf[RTC_HR_REG_ADDR] & 0x3F);
tm->tm_mday = bcd2bin(buf[RTC_DATE_REG_ADDR] & 0x3F);
tm->tm_mon = bcd2bin(buf[RTC_MON_REG_ADDR] & 0x1F);
tm->tm_mon = bcd2bin(buf[RTC_MON_REG_ADDR] & 0x1F) - 1;
tm->tm_year = bcd2bin(buf[RTC_YR_REG_ADDR]) + 2000;
tm->tm_wday = fls(buf[RTC_DAY_REG_ADDR] & 0x7F) - 1;
tm->tm_yday = 0;

View File

@ -54,6 +54,9 @@ static ssize_t smh_serial_puts(struct udevice *dev, const char *s, size_t len)
}
buf = strndup(s, len);
if (!buf)
return -ENOMEM;
smh_puts(buf);
free(buf);
return len;

View File

@ -152,9 +152,6 @@ _DEFUN (ctime_r, (tim_p, result),
return asctime_r (localtime_r (tim_p, &tm), result);
}
/* for compatibility with linux code */
typedef __s64 time64_t;
#ifdef CONFIG_LIB_DATE
time64_t mktime64(const unsigned int year, const unsigned int mon,
const unsigned int day, const unsigned int hour,

View File

@ -16,6 +16,8 @@
#include <bcd.h>
#include <rtc_def.h>
typedef int64_t time64_t;
#ifdef CONFIG_DM_RTC
struct udevice;
@ -301,7 +303,7 @@ int rtc_calc_weekday(struct rtc_time *time);
void rtc_to_tm(u64 time_t, struct rtc_time *time);
/**
* rtc_mktime() - Convert a broken-out time into a time_t value
* rtc_mktime() - Convert a broken-out time into a time64_t value
*
* The following fields need to be valid for this function to work:
* tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year
@ -309,9 +311,9 @@ void rtc_to_tm(u64 time_t, struct rtc_time *time);
* Note that tm_wday and tm_yday are ignored.
*
* @time: Broken-out time to convert
* Return: corresponding time_t value, seconds since 1970-01-01 00:00:00
* Return: corresponding time64_t value, seconds since 1970-01-01 00:00:00
*/
unsigned long rtc_mktime(const struct rtc_time *time);
time64_t rtc_mktime(const struct rtc_time *time);
/**
* rtc_month_days() - The number of days in the month

View File

@ -71,19 +71,16 @@ int rtc_calc_weekday(struct rtc_time *tm)
* -year / 100 + year / 400 terms, and add 10.]
*
* This algorithm was first published by Gauss (I think).
*
* WARNING: this function will overflow on 2106-02-07 06:28:16 on
* machines where long is 32-bit! (However, as time_t is signed, we
* will already get problems at other places on 2038-01-19 03:14:08)
*/
unsigned long rtc_mktime(const struct rtc_time *tm)
time64_t rtc_mktime(const struct rtc_time *tm)
{
int mon = tm->tm_mon;
int year = tm->tm_year;
int days, hours;
unsigned long days;
time64_t hours;
mon -= 2;
if (0 >= (int)mon) { /* 1..12 -> 11, 12, 1..10 */
if (0 >= mon) { /* 1..12 -> 11, 12, 1..10 */
mon += 12; /* Puts Feb last since it has leap day */
year -= 1;
}
@ -109,5 +106,5 @@ time64_t mktime64(const unsigned int year, const unsigned int mon,
time.tm_min = min;
time.tm_sec = sec;
return (time64_t)rtc_mktime((const struct rtc_time *)&time);
return rtc_mktime((const struct rtc_time *)&time);
}

View File

@ -1205,7 +1205,7 @@ int fit_pre_load_data(const char *keydir, void *keydest, void *fit)
if (!key_name)
printf("The property key-name is missing in the node %s\n",
IMAGE_PRE_LOAD_PATH);
ret = -ENODATA;
ret = -EINVAL;
goto out;
}

View File

@ -80,27 +80,33 @@ static int imagetool_verify_print_header_by_type(
struct image_type_params *tparams,
struct image_tool_params *params)
{
int retval;
int retval = -1;
retval = tparams->verify_header((unsigned char *)ptr, sbuf->st_size,
params);
if (tparams->verify_header) {
retval = tparams->verify_header((unsigned char *)ptr,
sbuf->st_size, params);
if (retval == 0) {
/*
* Print the image information if verify is successful
*/
if (tparams->print_header) {
if (!params->quiet)
tparams->print_header(ptr);
if (retval == 0) {
/*
* Print the image information if verify is successful
*/
if (tparams->print_header) {
if (!params->quiet)
tparams->print_header(ptr);
} else {
fprintf(stderr,
"%s: print_header undefined for %s\n",
params->cmdname, tparams->name);
}
} else {
fprintf(stderr,
"%s: print_header undefined for %s\n",
params->cmdname, tparams->name);
"%s: verify_header failed for %s with exit code %d\n",
params->cmdname, tparams->name, retval);
}
} else {
fprintf(stderr,
"%s: verify_header failed for %s with exit code %d\n",
params->cmdname, tparams->name, retval);
fprintf(stderr, "%s: print_header undefined for %s\n",
params->cmdname, tparams->name);
}
return retval;