Skip to content

Instantly share code, notes, and snippets.

@kallisti5
Created January 9, 2023 18:28
Show Gist options
  • Save kallisti5/2b69362c18a33c6ab657c261ee60cc51 to your computer and use it in GitHub Desktop.
Save kallisti5/2b69362c18a33c6ab657c261ee60cc51 to your computer and use it in GitHub Desktop.
if (regShift != NULL) {
// Grab any register shifts if requested
prop = (const uint8*)fdt_getprop(fdt, node, "reg-shift", &propSize);
if (prop == NULL)
#if defined(__ARM__) || defined(__aarch64__)
// arm and arm64 before dts's were used outside of these architectures historically
// assumed reg-shift 2 which means dts's from these architectures omit it and assume
// you're shifting.
*regShift = 2;
#else
*regShift = 0;
#endif
else
*regShift = fdt32_to_cpu(*(uint32*)prop);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment