Skip to content

Commit

Permalink
Merge branch 'master' of git://git.denx.de/u-boot-dm
Browse files Browse the repository at this point in the history
  • Loading branch information
trini committed Jun 21, 2014
2 parents 45f0ad9 + 22ec136 commit 39b6d07
Show file tree
Hide file tree
Showing 38 changed files with 831 additions and 61 deletions.
28 changes: 28 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,7 @@ The following options need to be configured:
CONFIG_CMD_IMLS List all images found in NOR flash
CONFIG_CMD_IMLS_NAND * List all images found in NAND flash
CONFIG_CMD_IMMAP * IMMR dump support
CONFIG_CMD_IOTRACE * I/O tracing for debugging
CONFIG_CMD_IMPORTENV * import an environment
CONFIG_CMD_INI * import data from an ini file into the env
CONFIG_CMD_IRQ * irqinfo
Expand Down Expand Up @@ -1171,6 +1172,28 @@ The following options need to be configured:
Note that if the GPIO device uses I2C, then the I2C interface
must also be configured. See I2C Support, below.

- I/O tracing:
When CONFIG_IO_TRACE is selected, U-Boot intercepts all I/O
accesses and can checksum them or write a list of them out
to memory. See the 'iotrace' command for details. This is
useful for testing device drivers since it can confirm that
the driver behaves the same way before and after a code
change. Currently this is supported on sandbox and arm. To
add support for your architecture, add '#include <iotrace.h>'
to the bottom of arch/<arch>/include/asm/io.h and test.

Example output from the 'iotrace stats' command is below.
Note that if the trace buffer is exhausted, the checksum will
still continue to operate.

iotrace is enabled
Start: 10000000 (buffer start address)
Size: 00010000 (buffer size)
Offset: 00000120 (current buffer offset)
Output: 10000120 (start + offset)
Count: 00000018 (number of trace records)
CRC32: 9526fb66 (CRC32 of all trace records)

- Timestamp Support:

When CONFIG_TIMESTAMP is selected, the timestamp
Expand Down Expand Up @@ -5308,6 +5331,11 @@ Information structure as we define in include/asm-<arch>/u-boot.h,
and make sure that your definition of IMAP_ADDR uses the same value
as your U-Boot configuration in CONFIG_SYS_IMMR.

Note that U-Boot now has a driver model, a unified model for drivers.
If you are adding a new driver, plumb it into driver model. If there
is no uclass available, you are encouraged to create one. See
doc/driver-model.


Configuring the Linux kernel:
-----------------------------
Expand Down
1 change: 1 addition & 0 deletions arch/arm/dts/include/dt-bindings
21 changes: 12 additions & 9 deletions arch/arm/dts/tegra114.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

#include "skeleton.dtsi"

/ {
Expand Down Expand Up @@ -46,17 +49,17 @@
0 143 0x04>;
};

gpio: gpio {
gpio: gpio@6000d000 {
compatible = "nvidia,tegra114-gpio", "nvidia,tegra30-gpio";
reg = <0x6000d000 0x1000>;
interrupts = <0 32 0x04
0 33 0x04
0 34 0x04
0 35 0x04
0 55 0x04
0 87 0x04
0 89 0x04
0 125 0x04>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
Expand Down
19 changes: 11 additions & 8 deletions arch/arm/dts/tegra124.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

#include "skeleton.dtsi"

/ {
Expand Down Expand Up @@ -49,14 +52,14 @@
gpio: gpio@6000d000 {
compatible = "nvidia,tegra124-gpio", "nvidia,tegra30-gpio";
reg = <0x6000d000 0x1000>;
interrupts = <0 32 0x04
0 33 0x04
0 34 0x04
0 35 0x04
0 55 0x04
0 87 0x04
0 89 0x04
0 125 0x04>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
Expand Down
15 changes: 13 additions & 2 deletions arch/arm/dts/tegra20.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

#include "skeleton.dtsi"

/ {
Expand Down Expand Up @@ -139,10 +142,18 @@

gpio: gpio@6000d000 {
compatible = "nvidia,tegra20-gpio";
reg = < 0x6000d000 0x1000 >;
interrupts = < 64 65 66 67 87 119 121 >;
reg = <0x6000d000 0x1000>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>;
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
interrupt-controller;
};

pinmux: pinmux@70000000 {
Expand Down
21 changes: 12 additions & 9 deletions arch/arm/dts/tegra30.dtsi
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>

#include "skeleton.dtsi"

/ {
Expand Down Expand Up @@ -47,17 +50,17 @@
clocks = <&tegra_car 34>;
};

gpio: gpio {
gpio: gpio@6000d000 {
compatible = "nvidia,tegra30-gpio";
reg = <0x6000d000 0x1000>;
interrupts = <0 32 0x04
0 33 0x04
0 34 0x04
0 35 0x04
0 55 0x04
0 87 0x04
0 89 0x04
0 125 0x04>;
interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 34 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 87 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 89 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 125 IRQ_TYPE_LEVEL_HIGH>;
#gpio-cells = <2>;
gpio-controller;
#interrupt-cells = <2>;
Expand Down
3 changes: 3 additions & 0 deletions arch/arm/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -437,4 +437,7 @@ isa_check_signature(unsigned long io_addr, const unsigned char *signature,

#endif /* __mem_isa */
#endif /* __KERNEL__ */

#include <iotrace.h>

#endif /* __ASM_ARM_IO_H */
1 change: 1 addition & 0 deletions arch/microblaze/dts/include/dt-bindings
1 change: 1 addition & 0 deletions arch/sandbox/dts/include/dt-bindings
10 changes: 10 additions & 0 deletions arch/sandbox/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,14 @@ static inline void unmap_sysmem(const void *vaddr)
/* Map from a pointer to our RAM buffer */
phys_addr_t map_to_sysmem(const void *ptr);

/* Define nops for sandbox I/O access */
#define readb(addr) 0
#define readw(addr) 0
#define readl(addr) 0
#define writeb(v, addr)
#define writew(v, addr)
#define writel(v, addr)

#include <iotrace.h>

#endif
1 change: 1 addition & 0 deletions arch/x86/dts/include/dt-bindings
2 changes: 2 additions & 0 deletions common/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ obj-$(CONFIG_CMD_FUSE) += cmd_fuse.o
obj-$(CONFIG_CMD_GETTIME) += cmd_gettime.o
obj-$(CONFIG_CMD_GPIO) += cmd_gpio.o
obj-$(CONFIG_CMD_I2C) += cmd_i2c.o
obj-$(CONFIG_CMD_IOTRACE) += cmd_iotrace.o
obj-$(CONFIG_CMD_HASH) += cmd_hash.o
obj-$(CONFIG_CMD_IDE) += cmd_ide.o
obj-$(CONFIG_CMD_IMMAP) += cmd_immap.o
Expand Down Expand Up @@ -261,6 +262,7 @@ obj-$(CONFIG_ANDROID_BOOT_IMAGE) += image-android.o
obj-$(CONFIG_OF_LIBFDT) += image-fdt.o
obj-$(CONFIG_FIT) += image-fit.o
obj-$(CONFIG_FIT_SIGNATURE) += image-sig.o
obj-$(CONFIG_IO_TRACE) += iotrace.o
obj-y += memsize.o
obj-y += stdio.o

Expand Down
73 changes: 73 additions & 0 deletions common/cmd_iotrace.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (c) 2014 Google, Inc
*
* SPDX-License-Identifier: GPL-2.0+
*/

#include <common.h>
#include <command.h>
#include <iotrace.h>

static void do_print_stats(void)
{
ulong start, size, offset, count;

printf("iotrace is %sabled\n", iotrace_get_enabled() ? "en" : "dis");
iotrace_get_buffer(&start, &size, &offset, &count);
printf("Start: %08lx\n", start);
printf("Size: %08lx\n", size);
printf("Offset: %08lx\n", offset);
printf("Output: %08lx\n", start + offset);
printf("Count: %08lx\n", count);
printf("CRC32: %08lx\n", (ulong)iotrace_get_checksum());
}

static int do_set_buffer(int argc, char * const argv[])
{
ulong addr = 0, size = 0;

if (argc == 2) {
addr = simple_strtoul(*argv++, NULL, 16);
size = simple_strtoul(*argv++, NULL, 16);
} else if (argc != 0) {
return CMD_RET_USAGE;
}

iotrace_set_buffer(addr, size);

return 0;
}

int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
const char *cmd = argc < 2 ? NULL : argv[1];

if (!cmd)
return cmd_usage(cmdtp);
switch (*cmd) {
case 'b':
return do_set_buffer(argc - 2, argv + 2);
case 'p':
iotrace_set_enabled(0);
break;
case 'r':
iotrace_set_enabled(1);
break;
case 's':
do_print_stats();
break;
default:
return CMD_RET_USAGE;
}

return 0;
}

U_BOOT_CMD(
iotrace, 4, 1, do_iotrace,
"iotrace utility commands",
"stats - display iotrace stats\n"
"iotrace buffer <address> <size> - set iotrace buffer\n"
"iotrace pause - pause tracing\n"
"iotrace resume - resume tracing"
);
Loading

0 comments on commit 39b6d07

Please sign in to comment.