aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/Kconfig14
-rw-r--r--cmd/clk.c79
-rw-r--r--cmd/gpio.c2
-rw-r--r--cmd/pci.c6
4 files changed, 67 insertions, 34 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 041de1d831..05872fa0d7 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -611,6 +611,20 @@ config CMD_MEMORY
base - print or set address offset
loop - initialize loop on address range
+config MX_CYCLIC
+ bool "Enable cyclic md/mw commands"
+ depends on CMD_MEMORY
+ help
+ Add the "mdc" and "mwc" memory commands. These are cyclic
+ "md/mw" commands.
+ Examples:
+
+ => mdc.b 10 4 500
+ This command will print 4 bytes (10,11,12,13) each 500 ms.
+
+ => mwc.l 100 12345678 10
+ This command will write 12345678 to address 100 all 10 ms.
+
config CMD_RANDOM
bool "random"
default y
diff --git a/cmd/clk.c b/cmd/clk.c
index 5402c87de7..74ad868500 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -7,51 +7,70 @@
#include <clk.h>
#if defined(CONFIG_DM) && defined(CONFIG_CLK)
#include <dm.h>
+#include <dm/device.h>
+#include <dm/root.h>
#include <dm/device-internal.h>
+#include <linux/clk-provider.h>
#endif
-int __weak soc_clk_dump(void)
-{
#if defined(CONFIG_DM) && defined(CONFIG_CLK)
- struct udevice *dev;
- struct uclass *uc;
- struct clk clk;
- int ret;
- ulong rate;
-
- /* Device addresses start at 1 */
- ret = uclass_get(UCLASS_CLK, &uc);
- if (ret)
- return ret;
-
- uclass_foreach_dev(dev, uc) {
- memset(&clk, 0, sizeof(clk));
- ret = device_probe(dev);
- if (ret)
- goto noclk;
+static void show_clks(struct udevice *dev, int depth, int last_flag)
+{
+ int i, is_last;
+ struct udevice *child;
+ struct clk *clkp;
+ u32 rate;
+
+ clkp = dev_get_clk_ptr(dev);
+ if (device_get_uclass_id(dev) == UCLASS_CLK && clkp) {
+ rate = clk_get_rate(clkp);
+
+ printf(" %-12u %8d ", rate, clkp->enable_count);
+
+ for (i = depth; i >= 0; i--) {
+ is_last = (last_flag >> i) & 1;
+ if (i) {
+ if (is_last)
+ printf(" ");
+ else
+ printf("| ");
+ } else {
+ if (is_last)
+ printf("`-- ");
+ else
+ printf("|-- ");
+ }
+ }
- ret = clk_request(dev, &clk);
- if (ret)
- goto noclk;
+ printf("%s\n", dev->name);
+ }
- rate = clk_get_rate(&clk);
- clk_free(&clk);
+ list_for_each_entry(child, &dev->child_head, sibling_node) {
+ is_last = list_is_last(&child->sibling_node, &dev->child_head);
+ show_clks(child, depth + 1, (last_flag << 1) | is_last);
+ }
+}
- if (rate == -ENODEV)
- goto noclk;
+int __weak soc_clk_dump(void)
+{
+ struct udevice *root;
- printf("%-30.30s : %lu Hz\n", dev->name, rate);
- continue;
- noclk:
- printf("%-30.30s : ? Hz\n", dev->name);
+ root = dm_root();
+ if (root) {
+ printf(" Rate Usecnt Name\n");
+ printf("------------------------------------------\n");
+ show_clks(root, -1, 0);
}
return 0;
+}
#else
+int __weak soc_clk_dump(void)
+{
puts("Not implemented\n");
return 1;
-#endif
}
+#endif
static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
diff --git a/cmd/gpio.c b/cmd/gpio.c
index 53366f36e7..eff36ab2af 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -91,7 +91,7 @@ static int do_gpio_status(bool all, const char *gpio_name)
if (!gpio_name || !bank_name ||
!strncasecmp(gpio_name, bank_name, banklen)) {
- const char *p = NULL;
+ const char *p;
int offset;
p = gpio_name + banklen;
diff --git a/cmd/pci.c b/cmd/pci.c
index 2c5ee2a19d..0043471fc7 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -148,7 +148,7 @@ int pci_bar_show(struct udevice *dev)
if ((!is_64 && size_low) || (is_64 && size)) {
size = ~size + 1;
- printf(" %d %#016llx %#016llx %d %s %s\n",
+ printf(" %d %#018llx %#018llx %d %s %s\n",
bar_id, (unsigned long long)base,
(unsigned long long)size, is_64 ? 64 : 32,
is_io ? "I/O" : "MEM",
@@ -629,10 +629,10 @@ static void pci_show_regions(struct udevice *bus)
return;
}
- printf("# %-16s %-16s %-16s %s\n", "Bus start", "Phys start", "Size",
+ printf("# %-18s %-18s %-18s %s\n", "Bus start", "Phys start", "Size",
"Flags");
for (i = 0, reg = hose->regions; i < hose->region_count; i++, reg++) {
- printf("%d %#016llx %#016llx %#016llx ", i,
+ printf("%d %#018llx %#018llx %#018llx ", i,
(unsigned long long)reg->bus_start,
(unsigned long long)reg->phys_start,
(unsigned long long)reg->size);