All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 12:37 ` Danny Huang
  0 siblings, 0 replies; 12+ messages in thread
From: Danny Huang @ 2013-03-11 12:37 UTC (permalink / raw)
  To: linux-lFZ/pmaqli7XmaaqVzeoHQ, swarren-3lzwWm7+Weoh9ZMKESR00Q,
	dahuang-DDmLM1+adcrQT0dZR+AlfA, ldewangan-DDmLM1+adcrQT0dZR+AlfA,
	pgaikwad-DDmLM1+adcrQT0dZR+AlfA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
usage.

Signed-off-by: Danny Huang <dahuang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
---
 arch/arm/mach-tegra/fuse.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index f7db078..7895542 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/proc_fs.h>
 #include <linux/tegra-soc.h>
 
 #include "fuse.h"
@@ -43,6 +44,7 @@ enum tegra_revision tegra_revision;
 
 static int tegra_fuse_spare_bit;
 static void (*tegra_init_speedo_data)(void);
+static struct proc_dir_entry *proc_entry;
 
 /* The BCT to use at boot is specified by board straps that can be read
  * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
@@ -161,3 +163,20 @@ unsigned long long tegra_chip_uid(void)
 	return (hi << 32ull) | lo;
 }
 EXPORT_SYMBOL(tegra_chip_uid);
+
+static int show_chip_info(char *page, char **start, off_t offset,
+			    int count, int *eof, void *data)
+{
+	return snprintf(page, count, "tegra_chip_id: %d\ntegra_chip_rev: %d\n",
+			tegra_chip_id, tegra_revision);
+}
+
+static int __init tegra_chip_info(void)
+{
+	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
+	if (proc_entry)
+		proc_entry->read_proc = show_chip_info;
+	return 0;
+}
+
+late_initcall(tegra_chip_info);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 12:37 ` Danny Huang
  0 siblings, 0 replies; 12+ messages in thread
From: Danny Huang @ 2013-03-11 12:37 UTC (permalink / raw)
  To: linux, swarren, dahuang, ldewangan, pgaikwad, linux-arm-kernel,
	linux-tegra, linux-kernel

Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
usage.

Signed-off-by: Danny Huang <dahuang@nvidia.com>
---
 arch/arm/mach-tegra/fuse.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index f7db078..7895542 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/proc_fs.h>
 #include <linux/tegra-soc.h>
 
 #include "fuse.h"
@@ -43,6 +44,7 @@ enum tegra_revision tegra_revision;
 
 static int tegra_fuse_spare_bit;
 static void (*tegra_init_speedo_data)(void);
+static struct proc_dir_entry *proc_entry;
 
 /* The BCT to use at boot is specified by board straps that can be read
  * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
@@ -161,3 +163,20 @@ unsigned long long tegra_chip_uid(void)
 	return (hi << 32ull) | lo;
 }
 EXPORT_SYMBOL(tegra_chip_uid);
+
+static int show_chip_info(char *page, char **start, off_t offset,
+			    int count, int *eof, void *data)
+{
+	return snprintf(page, count, "tegra_chip_id: %d\ntegra_chip_rev: %d\n",
+			tegra_chip_id, tegra_revision);
+}
+
+static int __init tegra_chip_info(void)
+{
+	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
+	if (proc_entry)
+		proc_entry->read_proc = show_chip_info;
+	return 0;
+}
+
+late_initcall(tegra_chip_info);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 12:37 ` Danny Huang
  0 siblings, 0 replies; 12+ messages in thread
From: Danny Huang @ 2013-03-11 12:37 UTC (permalink / raw)
  To: linux-arm-kernel

Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
usage.

Signed-off-by: Danny Huang <dahuang@nvidia.com>
---
 arch/arm/mach-tegra/fuse.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c
index f7db078..7895542 100644
--- a/arch/arm/mach-tegra/fuse.c
+++ b/arch/arm/mach-tegra/fuse.c
@@ -20,6 +20,7 @@
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <linux/export.h>
+#include <linux/proc_fs.h>
 #include <linux/tegra-soc.h>
 
 #include "fuse.h"
@@ -43,6 +44,7 @@ enum tegra_revision tegra_revision;
 
 static int tegra_fuse_spare_bit;
 static void (*tegra_init_speedo_data)(void);
+static struct proc_dir_entry *proc_entry;
 
 /* The BCT to use at boot is specified by board straps that can be read
  * through a APB misc register and decoded. 2 bits, i.e. 4 possible BCTs.
@@ -161,3 +163,20 @@ unsigned long long tegra_chip_uid(void)
 	return (hi << 32ull) | lo;
 }
 EXPORT_SYMBOL(tegra_chip_uid);
+
+static int show_chip_info(char *page, char **start, off_t offset,
+			    int count, int *eof, void *data)
+{
+	return snprintf(page, count, "tegra_chip_id: %d\ntegra_chip_rev: %d\n",
+			tegra_chip_id, tegra_revision);
+}
+
+static int __init tegra_chip_info(void)
+{
+	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
+	if (proc_entry)
+		proc_entry->read_proc = show_chip_info;
+	return 0;
+}
+
+late_initcall(tegra_chip_info);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
  2013-03-11 12:37 ` Danny Huang
  (?)
@ 2013-03-11 13:51   ` Shawn Guo
  -1 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2013-03-11 13:51 UTC (permalink / raw)
  To: Danny Huang
  Cc: linux, swarren, ldewangan, pgaikwad, linux-arm-kernel,
	linux-tegra, linux-kernel

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

It should probably be done in a more generic way.  Check it out
Documentation/ABI/testing/sysfs-devices-soc.

Shawn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 13:51   ` Shawn Guo
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2013-03-11 13:51 UTC (permalink / raw)
  To: Danny Huang
  Cc: linux, swarren, ldewangan, pgaikwad, linux-arm-kernel,
	linux-tegra, linux-kernel

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

It should probably be done in a more generic way.  Check it out
Documentation/ABI/testing/sysfs-devices-soc.

Shawn


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 13:51   ` Shawn Guo
  0 siblings, 0 replies; 12+ messages in thread
From: Shawn Guo @ 2013-03-11 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

It should probably be done in a more generic way.  Check it out
Documentation/ABI/testing/sysfs-devices-soc.

Shawn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
  2013-03-11 12:37 ` Danny Huang
  (?)
@ 2013-03-11 17:10     ` Stephen Warren
  -1 siblings, 0 replies; 12+ messages in thread
From: Stephen Warren @ 2013-03-11 17:10 UTC (permalink / raw)
  To: Danny Huang
  Cc: linux-lFZ/pmaqli7XmaaqVzeoHQ, ldewangan-DDmLM1+adcrQT0dZR+AlfA,
	pgaikwad-DDmLM1+adcrQT0dZR+AlfA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On 03/11/2013 06:37 AM, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I agree with Shawn's comments, but I have a few other comments here too
for the record.

Nit: "Tegra" and "ID" above should be capitalized as I've done so in
this sentence.

> diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c

> +static int __init tegra_chip_info(void)
> +{
> +	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
> +	if (proc_entry)
> +		proc_entry->read_proc = show_chip_info;
> +	return 0;
> +}
> +
> +late_initcall(tegra_chip_info);

Please don't introduce any more initcalls. Especially initcalls that are
not conditional on the run-time (rather than compile-time) SoC. This
code may be compiled into a kernel that supports SoCs other than Tegra.
However, tegra_chip_info() shouldn't run on those SoCs.

It'd probably be simplest to just perform this initialization as part of
the already-existing tegra_init_fuse(). If not, please call this
initialization function from one of the initialization functions in
arch/arm/mach-tegra/common.c. Both those cases only execute on Tegra.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 17:10     ` Stephen Warren
  0 siblings, 0 replies; 12+ messages in thread
From: Stephen Warren @ 2013-03-11 17:10 UTC (permalink / raw)
  To: Danny Huang
  Cc: linux, ldewangan, pgaikwad, linux-arm-kernel, linux-tegra, linux-kernel

On 03/11/2013 06:37 AM, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I agree with Shawn's comments, but I have a few other comments here too
for the record.

Nit: "Tegra" and "ID" above should be capitalized as I've done so in
this sentence.

> diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c

> +static int __init tegra_chip_info(void)
> +{
> +	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
> +	if (proc_entry)
> +		proc_entry->read_proc = show_chip_info;
> +	return 0;
> +}
> +
> +late_initcall(tegra_chip_info);

Please don't introduce any more initcalls. Especially initcalls that are
not conditional on the run-time (rather than compile-time) SoC. This
code may be compiled into a kernel that supports SoCs other than Tegra.
However, tegra_chip_info() shouldn't run on those SoCs.

It'd probably be simplest to just perform this initialization as part of
the already-existing tegra_init_fuse(). If not, please call this
initialization function from one of the initialization functions in
arch/arm/mach-tegra/common.c. Both those cases only execute on Tegra.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 17:10     ` Stephen Warren
  0 siblings, 0 replies; 12+ messages in thread
From: Stephen Warren @ 2013-03-11 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/11/2013 06:37 AM, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I agree with Shawn's comments, but I have a few other comments here too
for the record.

Nit: "Tegra" and "ID" above should be capitalized as I've done so in
this sentence.

> diff --git a/arch/arm/mach-tegra/fuse.c b/arch/arm/mach-tegra/fuse.c

> +static int __init tegra_chip_info(void)
> +{
> +	proc_entry = create_proc_entry("cpu/chipinfo", S_IRUGO, NULL);
> +	if (proc_entry)
> +		proc_entry->read_proc = show_chip_info;
> +	return 0;
> +}
> +
> +late_initcall(tegra_chip_info);

Please don't introduce any more initcalls. Especially initcalls that are
not conditional on the run-time (rather than compile-time) SoC. This
code may be compiled into a kernel that supports SoCs other than Tegra.
However, tegra_chip_info() shouldn't run on those SoCs.

It'd probably be simplest to just perform this initialization as part of
the already-existing tegra_init_fuse(). If not, please call this
initialization function from one of the initialization functions in
arch/arm/mach-tegra/common.c. Both those cases only execute on Tegra.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
  2013-03-11 12:37 ` Danny Huang
  (?)
@ 2013-03-11 17:10     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2013-03-11 17:10 UTC (permalink / raw)
  To: Danny Huang
  Cc: swarren-3lzwWm7+Weoh9ZMKESR00Q, ldewangan-DDmLM1+adcrQT0dZR+AlfA,
	pgaikwad-DDmLM1+adcrQT0dZR+AlfA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I thought we weren't exporting this stuff out via procfs, but had a
soc specific way to do it - drivers/base/soc.c ?  We have soc_id and
revision attributes there... it seems to do what you want already.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 17:10     ` Russell King - ARM Linux
  0 siblings, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2013-03-11 17:10 UTC (permalink / raw)
  To: Danny Huang
  Cc: swarren, ldewangan, pgaikwad, linux-arm-kernel, linux-tegra,
	linux-kernel

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I thought we weren't exporting this stuff out via procfs, but had a
soc specific way to do it - drivers/base/soc.c ?  We have soc_id and
revision attributes there... it seems to do what you want already.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] arm: tegra: fuse: export chip id and revision
@ 2013-03-11 17:10     ` Russell King - ARM Linux
  0 siblings, 0 replies; 12+ messages in thread
From: Russell King - ARM Linux @ 2013-03-11 17:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Mar 11, 2013 at 08:37:21PM +0800, Danny Huang wrote:
> Expose tegra chip id and revision in /proc/cpu/chipinfo for user mode
> usage.

I thought we weren't exporting this stuff out via procfs, but had a
soc specific way to do it - drivers/base/soc.c ?  We have soc_id and
revision attributes there... it seems to do what you want already.

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2013-03-11 17:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 12:37 [PATCH] arm: tegra: fuse: export chip id and revision Danny Huang
2013-03-11 12:37 ` Danny Huang
2013-03-11 12:37 ` Danny Huang
2013-03-11 13:51 ` Shawn Guo
2013-03-11 13:51   ` Shawn Guo
2013-03-11 13:51   ` Shawn Guo
     [not found] ` <1363005441-26329-1-git-send-email-dahuang-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-03-11 17:10   ` Stephen Warren
2013-03-11 17:10     ` Stephen Warren
2013-03-11 17:10     ` Stephen Warren
2013-03-11 17:10   ` Russell King - ARM Linux
2013-03-11 17:10     ` Russell King - ARM Linux
2013-03-11 17:10     ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.