Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1581564 > unrolled thread

Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver

Started byGreg KH <gregkh@linuxfoundation.org>
First post2017-02-15 19:40 +0100
Last post2017-02-23 07:00 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver Greg KH <gregkh@linuxfoundation.org> - 2017-02-15 19:40 +0100
    Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver Arnd Bergmann <arnd@arndb.de> - 2017-02-15 21:00 +0100
      Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver "Loh, Tien Hock" <tien.hock.loh@intel.com> - 2017-02-23 07:10 +0100
        Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver "Loh, Tien Hock" <tien.hock.loh@intel.com> - 2017-02-23 09:20 +0100
        Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver Arnd Bergmann <arnd@arndb.de> - 2017-02-23 09:20 +0100
    Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver "Loh, Tien Hock" <tien.hock.loh@intel.com> - 2017-02-23 07:00 +0100

#1581564 — Re: [PATCH 1/1] drivers/misc: Add Intel System ID driver

FromGreg KH <gregkh@linuxfoundation.org>
Date2017-02-15 19:40 +0100
SubjectRe: [PATCH 1/1] drivers/misc: Add Intel System ID driver
Message-ID<tbcEG-3vT-31@gated-at.bofh.it>
On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
> From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
> 
> This patch is to add Altera System ID driver.
> User can obtain the system ID and timestamp of the system by
> reading the sysfs entry.
> 
> Usage:
> cat /sys/bus/platform/devices/[addr].sysid/sysid/id
> cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp

If you add new sysfs attributes, you need to also add a
Documentation/ABI/ description as well.

> 
> Signed-off-by: Loh, Tien Hock <tien.hock.loh@intel.com>
> ---
>  drivers/misc/Kconfig       |    5 ++
>  drivers/misc/Makefile      |    1 +
>  drivers/misc/intel_sysid.c |  142 ++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 148 insertions(+), 0 deletions(-)
>  create mode 100644 drivers/misc/intel_sysid.c
> 
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index b4d6aac..e5552fa 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -139,6 +139,11 @@ config INTEL_MID_PTI
>  	  an Intel Atom (non-netbook) mobile device containing a MIPI
>  	  P1149.7 standard implementation.
>  
> +config INTEL_SYSID
> +        tristate "Intel System ID"
> +        help
> +        This enables Intel System ID soft core driver.
> +
>  config SGI_IOC4
>  	tristate "SGI IOC4 Base IO support"
>  	depends on PCI
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index 7a3ea89..24fe724 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -43,6 +43,7 @@ obj-y				+= ti-st/
>  obj-y				+= lis3lv02d/
>  obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
>  obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
> +obj-$(CONFIG_INTEL_SYSID)       += intel_sysid.o
>  obj-$(CONFIG_INTEL_MEI)		+= mei/
>  obj-$(CONFIG_VMWARE_VMCI)	+= vmw_vmci/
>  obj-$(CONFIG_LATTICE_ECP3_CONFIG)	+= lattice-ecp3-config.o
> diff --git a/drivers/misc/intel_sysid.c b/drivers/misc/intel_sysid.c
> new file mode 100644
> index 0000000..1ef72b8
> --- /dev/null
> +++ b/drivers/misc/intel_sysid.c
> @@ -0,0 +1,142 @@
> +/*
> + * Copyright Intel Corporation (C) 2017.
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms and conditions of the GNU General Public License,
> + * version 2, as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program.  If not, see <http://www.gnu.org/licenses/>.
> + *
> + * Credit:
> + * Walter Goossens
> + */
> +
> +#include <linux/device.h>
> +#include <linux/kernel.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/platform_device.h>
> +#include <linux/slab.h>
> +
> +#define DRV_NAME	"intel_sysid"
> +
> +struct intel_sysid {
> +	void __iomem		*regs;
> +};
> +
> +/* System ID Registers*/
> +#define SYSID_REG_ID		(0x0)
> +#define SYSID_REG_TIMESTAMP	(0x4)
> +
> +static ssize_t intel_sysid_show_id(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	struct intel_sysid *sysid = dev_get_drvdata(dev);
> +
> +	return sprintf(buf, "%u\n", readl(sysid->regs + SYSID_REG_ID));
> +}
> +
> +static ssize_t intel_sysid_show_timestamp(struct device *dev,
> +		struct device_attribute *attr, char *buf)
> +{
> +	unsigned int reg;
> +	struct tm timestamp;
> +	struct intel_sysid *sysid = dev_get_drvdata(dev);
> +
> +	reg = readl(sysid->regs + SYSID_REG_TIMESTAMP);
> +
> +	time_to_tm(reg, 0, &timestamp);
> +
> +	return sprintf(buf, "%u (%u-%u-%u %u:%u:%u UTC)\n", reg,
> +		(unsigned int)(timestamp.tm_year + 1900),
> +		timestamp.tm_mon + 1, timestamp.tm_mday, timestamp.tm_hour,
> +		timestamp.tm_min, timestamp.tm_sec);
> +}
> +
> +static DEVICE_ATTR(id, S_IRUGO, intel_sysid_show_id, NULL);
> +static DEVICE_ATTR(timestamp, S_IRUGO, intel_sysid_show_timestamp, NULL);

DEVICE_ATTR_RO()?

> +static struct attribute *intel_sysid_attrs[] = {
> +	&dev_attr_id.attr,
> +	&dev_attr_timestamp.attr,
> +	NULL,
> +};
> +
> +struct attribute_group intel_sysid_attr_group = {
> +	.name = "sysid",
> +	.attrs = intel_sysid_attrs,
> +};

ATTRIBUTE_GROUP()?

thanks,

greg k-h

[toc] | [next] | [standalone]


#1581606

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-15 21:00 +0100
Message-ID<tbdU5-4d3-9@gated-at.bofh.it>
In reply to#1581564
On Wed, Feb 15, 2017 at 6:17 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
>> From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
>>
>> This patch is to add Altera System ID driver.
>> User can obtain the system ID and timestamp of the system by
>> reading the sysfs entry.
>>
>> Usage:
>> cat /sys/bus/platform/devices/[addr].sysid/sysid/id
>> cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp
>
> If you add new sysfs attributes, you need to also add a
> Documentation/ABI/ description as well.

Maybe we could pretend that this is for a SoC and use the standard soc_device
attributes as well as moving the driver into drivers/soc/?

     Arnd

[toc] | [prev] | [next] | [standalone]


#1586658

From"Loh, Tien Hock" <tien.hock.loh@intel.com>
Date2017-02-23 07:10 +0100
Message-ID<tdULf-5DE-7@gated-at.bofh.it>
In reply to#1581606
Sorry for the late reply. 
This driver can currently be used by ARM and Nios II, so moving it into
drivers/soc might not be the best idea.

Thanks
Tien Hock

On Rab, 2017-02-15 at 20:51 +0100, Arnd Bergmann wrote:
> On Wed, Feb 15, 2017 at 6:17 PM, Greg KH <gregkh@linuxfoundation.org>
> wrote:
> > 
> > On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
> > > 
> > > From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
> > > 
> > > This patch is to add Altera System ID driver.
> > > User can obtain the system ID and timestamp of the system by
> > > reading the sysfs entry.
> > > 
> > > Usage:
> > > cat /sys/bus/platform/devices/[addr].sysid/sysid/id
> > > cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp
> > If you add new sysfs attributes, you need to also add a
> > Documentation/ABI/ description as well.
> Maybe we could pretend that this is for a SoC and use the standard
> soc_device
> attributes as well as moving the driver into drivers/soc/?
> 
>      Arnd

[toc] | [prev] | [next] | [standalone]


#1586718

From"Loh, Tien Hock" <tien.hock.loh@intel.com>
Date2017-02-23 09:20 +0100
Message-ID<tdWN4-731-21@gated-at.bofh.it>
In reply to#1586658
OK then I'll move it into driver/soc/ in that case.

On Kha, 2017-02-23 at 09:05 +0100, Arnd Bergmann wrote:
> On Thu, Feb 23, 2017 at 6:58 AM, Loh, Tien Hock <tien.hock.loh@intel.
> com> wrote:
> > 
> > On Rab, 2017-02-15 at 20:51 +0100, Arnd Bergmann wrote:
> > > 
> > > On Wed, Feb 15, 2017 at 6:17 PM, Greg KH <gregkh@linuxfoundation.
> > > org>
> > > wrote:
> > > > 
> > > > 
> > > > On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
> > > > > 
> > > > > 
> > > > > From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
> > > > > 
> > > > > This patch is to add Altera System ID driver.
> > > > > User can obtain the system ID and timestamp of the system by
> > > > > reading the sysfs entry.
> > > > > 
> > > > > Usage:
> > > > > cat /sys/bus/platform/devices/[addr].sysid/sysid/id
> > > > > cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp
> > > > If you add new sysfs attributes, you need to also add a
> > > > Documentation/ABI/ description as well.
> > > Maybe we could pretend that this is for a SoC and use the
> > > standard
> > > soc_device
> > > attributes as well as moving the driver into drivers/soc/?> Sorry
> > > for the late reply.
> > This driver can currently be used by ARM and Nios II, so moving it
> > into
> > drivers/soc might not be the best idea.
> Why not? drivers/soc/ was specifically introduced for stuff that is
> used on
> some SoC but across more than one architecture (otherwise it would be
> in arch/foo/). This seems to fit perfectly.
> 
>      Arnd

[toc] | [prev] | [next] | [standalone]


#1586725

FromArnd Bergmann <arnd@arndb.de>
Date2017-02-23 09:20 +0100
Message-ID<tdWN4-731-23@gated-at.bofh.it>
In reply to#1586658
On Thu, Feb 23, 2017 at 6:58 AM, Loh, Tien Hock <tien.hock.loh@intel.com> wrote:
> On Rab, 2017-02-15 at 20:51 +0100, Arnd Bergmann wrote:
>> On Wed, Feb 15, 2017 at 6:17 PM, Greg KH <gregkh@linuxfoundation.org>
>> wrote:
>> >
>> > On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
>> > >
>> > > From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
>> > >
>> > > This patch is to add Altera System ID driver.
>> > > User can obtain the system ID and timestamp of the system by
>> > > reading the sysfs entry.
>> > >
>> > > Usage:
>> > > cat /sys/bus/platform/devices/[addr].sysid/sysid/id
>> > > cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp
>> > If you add new sysfs attributes, you need to also add a
>> > Documentation/ABI/ description as well.
>>
>> Maybe we could pretend that this is for a SoC and use the standard
>> soc_device
>> attributes as well as moving the driver into drivers/soc/?> Sorry for the late reply.
>
> This driver can currently be used by ARM and Nios II, so moving it into
> drivers/soc might not be the best idea.

Why not? drivers/soc/ was specifically introduced for stuff that is used on
some SoC but across more than one architecture (otherwise it would be
in arch/foo/). This seems to fit perfectly.

     Arnd

[toc] | [prev] | [next] | [standalone]


#1586652

From"Loh, Tien Hock" <tien.hock.loh@intel.com>
Date2017-02-23 07:00 +0100
Message-ID<tdUBz-5jM-7@gated-at.bofh.it>
In reply to#1581564
Sorry for the late reply. I'll add the Documentation/ABI description,
use DEVICE_ATTR_RO and update ATTRIBUTE_GROUP. 

Thanks
Tien Hock

On Rab, 2017-02-15 at 09:17 -0800, Greg KH wrote:
> On Wed, Feb 15, 2017 at 07:09:41PM +0800, thloh wrote:
> > 
> > From: "Loh, Tien Hock" <tien.hock.loh@intel.com>
> > 
> > This patch is to add Altera System ID driver.
> > User can obtain the system ID and timestamp of the system by
> > reading the sysfs entry.
> > 
> > Usage:
> > cat /sys/bus/platform/devices/[addr].sysid/sysid/id
> > cat /sys/bus/platform/devices/[addr].sysid/sysid/timestamp
> If you add new sysfs attributes, you need to also add a
> Documentation/ABI/ description as well.
> 
> > 
> > 
> > Signed-off-by: Loh, Tien Hock <tien.hock.loh@intel.com>
> > ---
> >  drivers/misc/Kconfig       |    5 ++
> >  drivers/misc/Makefile      |    1 +
> >  drivers/misc/intel_sysid.c |  142
> > ++++++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 148 insertions(+), 0 deletions(-)
> >  create mode 100644 drivers/misc/intel_sysid.c
> > 
> > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> > index b4d6aac..e5552fa 100644
> > --- a/drivers/misc/Kconfig
> > +++ b/drivers/misc/Kconfig
> > @@ -139,6 +139,11 @@ config INTEL_MID_PTI
> >  	  an Intel Atom (non-netbook) mobile device containing a
> > MIPI
> >  	  P1149.7 standard implementation.
> >  
> > +config INTEL_SYSID
> > +        tristate "Intel System ID"
> > +        help
> > +        This enables Intel System ID soft core driver.
> > +
> >  config SGI_IOC4
> >  	tristate "SGI IOC4 Base IO support"
> >  	depends on PCI
> > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> > index 7a3ea89..24fe724 100644
> > --- a/drivers/misc/Makefile
> > +++ b/drivers/misc/Makefile
> > @@ -43,6 +43,7 @@ obj-y				+= ti-st/
> >  obj-y				+= lis3lv02d/
> >  obj-$(CONFIG_USB_SWITCH_FSA9480) += fsa9480.o
> >  obj-$(CONFIG_ALTERA_STAPL)	+=altera-stapl/
> > +obj-$(CONFIG_INTEL_SYSID)       += intel_sysid.o
> >  obj-$(CONFIG_INTEL_MEI)		+= mei/
> >  obj-$(CONFIG_VMWARE_VMCI)	+= vmw_vmci/
> >  obj-$(CONFIG_LATTICE_ECP3_CONFIG)	+= lattice-ecp3-config.o
> > diff --git a/drivers/misc/intel_sysid.c
> > b/drivers/misc/intel_sysid.c
> > new file mode 100644
> > index 0000000..1ef72b8
> > --- /dev/null
> > +++ b/drivers/misc/intel_sysid.c
> > @@ -0,0 +1,142 @@
> > +/*
> > + * Copyright Intel Corporation (C) 2017.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > modify it
> > + * under the terms and conditions of the GNU General Public
> > License,
> > + * version 2, as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope it will be useful, but
> > WITHOUT
> > + * ANY WARRANTY; without even the implied warranty of
> > MERCHANTABILITY or
> > + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
> > License for
> > + * more details.
> > + *
> > + * You should have received a copy of the GNU General Public
> > License along with
> > + * this program.  If not, see <http://www.gnu.org/licenses/>.
> > + *
> > + * Credit:
> > + * Walter Goossens
> > + */
> > +
> > +#include <linux/device.h>
> > +#include <linux/kernel.h>
> > +#include <linux/io.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/slab.h>
> > +
> > +#define DRV_NAME	"intel_sysid"
> > +
> > +struct intel_sysid {
> > +	void __iomem		*regs;
> > +};
> > +
> > +/* System ID Registers*/
> > +#define SYSID_REG_ID		(0x0)
> > +#define SYSID_REG_TIMESTAMP	(0x4)
> > +
> > +static ssize_t intel_sysid_show_id(struct device *dev,
> > +		struct device_attribute *attr, char *buf)
> > +{
> > +	struct intel_sysid *sysid = dev_get_drvdata(dev);
> > +
> > +	return sprintf(buf, "%u\n", readl(sysid->regs +
> > SYSID_REG_ID));
> > +}
> > +
> > +static ssize_t intel_sysid_show_timestamp(struct device *dev,
> > +		struct device_attribute *attr, char *buf)
> > +{
> > +	unsigned int reg;
> > +	struct tm timestamp;
> > +	struct intel_sysid *sysid = dev_get_drvdata(dev);
> > +
> > +	reg = readl(sysid->regs + SYSID_REG_TIMESTAMP);
> > +
> > +	time_to_tm(reg, 0, &timestamp);
> > +
> > +	return sprintf(buf, "%u (%u-%u-%u %u:%u:%u UTC)\n", reg,
> > +		(unsigned int)(timestamp.tm_year + 1900),
> > +		timestamp.tm_mon + 1, timestamp.tm_mday,
> > timestamp.tm_hour,
> > +		timestamp.tm_min, timestamp.tm_sec);
> > +}
> > +
> > +static DEVICE_ATTR(id, S_IRUGO, intel_sysid_show_id, NULL);
> > +static DEVICE_ATTR(timestamp, S_IRUGO, intel_sysid_show_timestamp,
> > NULL);
> DEVICE_ATTR_RO()?
> 
> > 
> > +static struct attribute *intel_sysid_attrs[] = {
> > +	&dev_attr_id.attr,
> > +	&dev_attr_timestamp.attr,
> > +	NULL,
> > +};
> > +
> > +struct attribute_group intel_sysid_attr_group = {
> > +	.name = "sysid",
> > +	.attrs = intel_sysid_attrs,
> > +};
> ATTRIBUTE_GROUP()?
> 
> thanks,
> 
> greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web