mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 20:37:16 +00:00
dm: tegra: Convert clock_decode_periph_id() to support livetree
Adjust this to take a device as a parameter instead of a node. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1 Tested-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
be7890927a
commit
000f15fa15
7 changed files with 8 additions and 9 deletions
|
@ -266,7 +266,7 @@ void clock_ll_start_uart(enum periph_id periph_id);
|
||||||
* @param node Node to look at
|
* @param node Node to look at
|
||||||
* @return peripheral ID, or PERIPH_ID_NONE if none
|
* @return peripheral ID, or PERIPH_ID_NONE if none
|
||||||
*/
|
*/
|
||||||
enum periph_id clock_decode_periph_id(const void *blob, int node);
|
int clock_decode_periph_id(struct udevice *dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the oscillator bypass is enabled (XOBP bit)
|
* Checks if the oscillator bypass is enabled (XOBP bit)
|
||||||
|
|
|
@ -655,14 +655,13 @@ void clock_ll_start_uart(enum periph_id periph_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
#if CONFIG_IS_ENABLED(OF_CONTROL)
|
||||||
int clock_decode_periph_id(const void *blob, int node)
|
int clock_decode_periph_id(struct udevice *dev)
|
||||||
{
|
{
|
||||||
enum periph_id id;
|
enum periph_id id;
|
||||||
u32 cell[2];
|
u32 cell[2];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = fdtdec_get_int_array(blob, node, "clocks", cell,
|
err = dev_read_u32_array(dev, "clocks", cell, ARRAY_SIZE(cell));
|
||||||
ARRAY_SIZE(cell));
|
|
||||||
if (err)
|
if (err)
|
||||||
return -1;
|
return -1;
|
||||||
id = clk_id_to_periph_id(cell[1]);
|
id = clk_id_to_periph_id(cell[1]);
|
||||||
|
|
|
@ -104,7 +104,7 @@ static int tegra114_spi_ofdata_to_platdata(struct udevice *bus)
|
||||||
int node = dev_of_offset(bus);
|
int node = dev_of_offset(bus);
|
||||||
|
|
||||||
plat->base = devfdt_get_addr(bus);
|
plat->base = devfdt_get_addr(bus);
|
||||||
plat->periph_id = clock_decode_periph_id(blob, node);
|
plat->periph_id = clock_decode_periph_id(bus);
|
||||||
|
|
||||||
if (plat->periph_id == PERIPH_ID_NONE) {
|
if (plat->periph_id == PERIPH_ID_NONE) {
|
||||||
debug("%s: could not decode periph id %d\n", __func__,
|
debug("%s: could not decode periph id %d\n", __func__,
|
||||||
|
|
|
@ -91,7 +91,7 @@ static int tegra20_sflash_ofdata_to_platdata(struct udevice *bus)
|
||||||
int node = dev_of_offset(bus);
|
int node = dev_of_offset(bus);
|
||||||
|
|
||||||
plat->base = devfdt_get_addr(bus);
|
plat->base = devfdt_get_addr(bus);
|
||||||
plat->periph_id = clock_decode_periph_id(blob, node);
|
plat->periph_id = clock_decode_periph_id(bus);
|
||||||
|
|
||||||
if (plat->periph_id == PERIPH_ID_NONE) {
|
if (plat->periph_id == PERIPH_ID_NONE) {
|
||||||
debug("%s: could not decode periph id %d\n", __func__,
|
debug("%s: could not decode periph id %d\n", __func__,
|
||||||
|
|
|
@ -97,7 +97,7 @@ static int tegra30_spi_ofdata_to_platdata(struct udevice *bus)
|
||||||
int node = dev_of_offset(bus);
|
int node = dev_of_offset(bus);
|
||||||
|
|
||||||
plat->base = devfdt_get_addr(bus);
|
plat->base = devfdt_get_addr(bus);
|
||||||
plat->periph_id = clock_decode_periph_id(blob, node);
|
plat->periph_id = clock_decode_periph_id(bus);
|
||||||
|
|
||||||
if (plat->periph_id == PERIPH_ID_NONE) {
|
if (plat->periph_id == PERIPH_ID_NONE) {
|
||||||
debug("%s: could not decode periph id %d\n", __func__,
|
debug("%s: could not decode periph id %d\n", __func__,
|
||||||
|
|
|
@ -100,7 +100,7 @@ static int tegra210_qspi_ofdata_to_platdata(struct udevice *bus)
|
||||||
int node = dev_of_offset(bus);
|
int node = dev_of_offset(bus);
|
||||||
|
|
||||||
plat->base = devfdt_get_addr(bus);
|
plat->base = devfdt_get_addr(bus);
|
||||||
plat->periph_id = clock_decode_periph_id(blob, node);
|
plat->periph_id = clock_decode_periph_id(bus);
|
||||||
|
|
||||||
if (plat->periph_id == PERIPH_ID_NONE) {
|
if (plat->periph_id == PERIPH_ID_NONE) {
|
||||||
debug("%s: could not decode periph id %d\n", __func__,
|
debug("%s: could not decode periph id %d\n", __func__,
|
||||||
|
|
|
@ -723,7 +723,7 @@ static int fdt_decode_usb(struct udevice *dev, struct fdt_usb *config)
|
||||||
config->enabled = fdtdec_get_is_enabled(blob, node);
|
config->enabled = fdtdec_get_is_enabled(blob, node);
|
||||||
config->has_legacy_mode = fdtdec_get_bool(blob, node,
|
config->has_legacy_mode = fdtdec_get_bool(blob, node,
|
||||||
"nvidia,has-legacy-mode");
|
"nvidia,has-legacy-mode");
|
||||||
config->periph_id = clock_decode_periph_id(blob, node);
|
config->periph_id = clock_decode_periph_id(dev);
|
||||||
if (config->periph_id == PERIPH_ID_NONE) {
|
if (config->periph_id == PERIPH_ID_NONE) {
|
||||||
debug("%s: Missing/invalid peripheral ID\n", __func__);
|
debug("%s: Missing/invalid peripheral ID\n", __func__);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue