2 * Copyright (c) 2012 The Chromium OS Authors.
4 * SPDX-License-Identifier: GPL-2.0+
8 * IO space access commands.
19 * iod{.b, .w, .l} {addr}
21 int do_io_iod(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
29 size = cmd_get_data_size(argv[0], 4);
33 addr = simple_strtoul(argv[1], NULL, 16);
35 printf("%04x: ", (u16) addr);
38 printf("%08x\n", inl(addr));
40 printf("%04x\n", inw(addr));
42 printf("%02x\n", inb(addr));
47 int do_io_iow(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
49 ulong addr, size, val;
54 size = cmd_get_data_size(argv[0], 4);
58 addr = simple_strtoul(argv[1], NULL, 16);
59 val = simple_strtoul(argv[2], NULL, 16);
62 outl((u32) val, addr);
64 outw((u16) val, addr);
71 /**************************************************/
72 U_BOOT_CMD(iod, 2, 0, do_io_iod,
73 "IO space display", "[.b, .w, .l] address");
75 U_BOOT_CMD(iow, 3, 0, do_io_iow,
77 "[.b, .w, .l] address value");