Re: [PATCH v2 1/6] soc/tegra: initial tegra-automotive detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 01, 2019 at 03:35:35PM +0000, Kejia Hu wrote:
> From: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> 
> Add an initial soc_is_tegra_auto() with detection
> via a change in the device-tree.
> 
> Also print the path taken through soc_is_tegra_auto() to
> allow debugging. Only print when debug is enabled as this
> function may be be called from multiple places, resulting
> in duplicated messages in production.
> 
> Signed-off-by: Ben Dooks <ben.dooks@xxxxxxxxxxxxxxx>
> Signed-off-by: Thomas Preston <thomas.preston@xxxxxxxxxxxxxxx>
> Signed-off-by: Kejia Hu <kejia.hu@xxxxxxxxxxxxxxx>
> ---
>  drivers/soc/tegra/common.c             | 23 +++++++++++++++++++++++
>  drivers/soc/tegra/fuse/tegra-apbmisc.c |  2 ++
>  include/soc/tegra/common.h             |  1 +
>  include/soc/tegra/fuse.h               |  1 +
>  4 files changed, 27 insertions(+)
> 
> diff --git a/drivers/soc/tegra/common.c b/drivers/soc/tegra/common.c
> index 7bfb154d6fa5..a10bd26fb5df 100644
> --- a/drivers/soc/tegra/common.c
> +++ b/drivers/soc/tegra/common.c
> @@ -9,6 +9,7 @@
>  #include <linux/of.h>
>  
>  #include <soc/tegra/common.h>
> +#include <soc/tegra/fuse.h>
>  
>  static const struct of_device_id tegra_machine_match[] = {
>  	{ .compatible = "nvidia,tegra20", },
> @@ -34,3 +35,25 @@ bool soc_is_tegra(void)
>  
>  	return match != NULL;
>  }
> +
> +static const struct of_device_id tegra_machine_match_auto[] = {
> +	{ .compatible = "nvidia,tegra20auto", },
> +	{ .compatible = "nvidia,tegra30auto", },
> +	{ },
> +};
> +
> +bool soc_is_tegra_auto(void)
> +{
> +	struct device_node *root;
> +	bool id_match  = false;
> +
> +	root = of_find_node_by_path("/");
> +
> +	if (root && of_match_node(tegra_machine_match_auto, root))
> +		id_match = true;
> +
> +	pr_debug("%s of_device_id match %d, tegra_sku_info.is_automotive %d\n",
> +			__func__, id_match, tegra_sku_info.is_automotive);
> +
> +	return id_match || tegra_sku_info.is_automotive;
> +}

Why do we need two ways of specifying the same thing? If we can read
this information from fuses, I don't think we need the extra compatible
string matching.

Also, if you're going to use this exclusively for clock setup, then the
alternative is to do that as part of the board's device tree, as Dmitry
pointed out.

Thierry

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux