nvidia_shield/inspect_hwio.py

99 lines
2.5 KiB
Python

import argparse, pickle
'''
sdmmc1: sdhci@700b0000 {
compatible = "nvidia,tegra210-sdhci", "nvidia,tegra132-sdhci";
reg = <0x0 0x700b0000 0x0 0x200>;
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&tegra_car TEGRA210_CLK_SDMMC1>;
resets = <&tegra_car 14>;
reset-names = "sdhci";
status = "disabled";
};
pinmux: pinmux@700008d4 {
compatible = "nvidia,tegra210-pinmux";
reg = <0x0 0x700008d4 0x0 0x299 /* Pad control registers */
0x0 0x70003000 0x0 0x290>; /* Mux registers */
#gpio-range-cells = <3>;
status = "disabled";
};
tegra_car: clock@60006000 {
compatible = "nvidia,tegra210-car", "syscon";
reg = <0x0 0x60006000 0x0 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
rtc: rtc@7000e000 {
compatible = "nvidia,tegra-rtc";
reg = <0x0 0x7000e000 0x0 0x100>;
interrupts = <0 2 0x04>;
status = "disabled";
};
tegra_timer: timer@60005000 {
compatible = "nvidia,tegra210-timer";
reg = <0x0 0x60005000 0x0 0x400>;
interrupts = <GIC_SPI 176 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 178 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 179 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&tegra_car TEGRA210_CLK_TIMER>;
};
rtc: rtc@7000e000 {
compatible = "nvidia,tegra-rtc";
reg = <0x0 0x7000e000 0x0 0x100>;
interrupts = <0 2 0x04>;
status = "disabled";
};
'''
t124_mem_map = {
0x60006000 :
{
"name" : "tegra_car",
"size" : 0x1000,
},
0x60005000 : {
"name" : "tegra_timer",
"size" : 0x400,
},
0x70019000 :
{
"name" : "memory_controller",
"size" : 0x1000,
},
0x700b0000 : {
"name" : "sdhci1",
"size" : 0x200,
},
0x70003000 : {
"name" : "pinmux",
"size" : 0x290,
},
0x7000e000 : {
"name" : "rtc",
"size" : 0x100,
}
}
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Inspect HWIO")
parser.add_argument("hwio", help="Path to HWIO file")
args = parser.parse_args()
hwio = pickle.load(open(args.hwio, "rb"))
devices = {}
for address in hwio:
t_dev = address - (address % 0x1000)
if t_dev not in devices:
devices[t_dev] = []
devices[t_dev].append(address)
for d in devices:
print(f"Device at 0x{d:04x} {t124_mem_map[d]['name'] if d in t124_mem_map else ''}")
pass