PT7C4338 chip is being manufactured by Pericom Technology Inc.
It is a serial real-time clock which provides:
1)Low-power clock/calendar.
2)Programmable square-wave output.
It has 56 bytes of nonvolatile RAM.
Its register set is same as that of rtc device: DS1307.
Signed-off-by: Priyanka Jain <redacted>
---
Changes :
This patch will supersede patch:
"RTC driver(Linux) for PT7C4338 chip"
Incorporting Wolfram Sang's comments to reuse ds1307 driver.
drivers/rtc/Kconfig | 6 +++---
drivers/rtc/rtc-ds1307.c | 7 +++++++
2 files changed, 10 insertions(+), 3 deletions(-)
@@ -769,6 +775,7 @@ read_rtc:switch(ds1307->type){caseds_1307:casem41t00:+casept7c4338:/* clock halted? turn it on, so clock can tick. */if(tmp&DS1307_BIT_CH){i2c_smbus_write_byte_data(client,DS1307_REG_SECS,0);
From: Wolfram Sang <hidden> Date: 2011-05-26 09:10:37
On Thu, May 26, 2011 at 12:33:29PM +0530, Priyanka Jain wrote:
PT7C4338 chip is being manufactured by Pericom Technology Inc.
It is a serial real-time clock which provides:
1)Low-power clock/calendar.
2)Programmable square-wave output.
It has 56 bytes of nonvolatile RAM.
Its register set is same as that of rtc device: DS1307.
Signed-off-by: Priyanka Jain <redacted>
So it is identical to ds1307? Then why not name your platform_device
simply 'ds1307'?
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-----Original Message-----
From: linuxppc-dev-bounces+priyanka.jain=3Dfreescale.com@lists.ozlabs.org
[mailto:linuxppc-dev-
bounces+priyanka.jain=3Dfreescale.com@lists.ozlabs.org] On Behalf Of
Wolfram Sang
Sent: Thursday, May 26, 2011 2:40 PM
To: Jain Priyanka-B32167
Cc: a.zummo@towertech.it; akpm@linux-foundation.org; linuxppc-
dev@lists.ozlabs.org; rtc-linux@googlegroups.com; p_gortmaker@yahoo.com
Subject: Re: [PATCH] Add support for pt7c4338 (rtc device) in rtc-ds1307
driver
=20
On Thu, May 26, 2011 at 12:33:29PM +0530, Priyanka Jain wrote:
=20
quoted
PT7C4338 chip is being manufactured by Pericom Technology Inc.
It is a serial real-time clock which provides:
1)Low-power clock/calendar.
2)Programmable square-wave output.
It has 56 bytes of nonvolatile RAM.
Its register set is same as that of rtc device: DS1307.
Signed-off-by: Priyanka Jain <redacted>
=20
So it is identical to ds1307? Then why not name your platform_device
simply 'ds1307'?
Yes, It is possible to directly use platform device 'ds1307' in device tree=
.=20
But I have one query of how to capture the information that pericom, pt7c43=
38 device is compatible with dallas, ds1307. Can it be done in somewhere in=
some document or some code. Actually for pt7c4338 device driver, I actuall=
y started by asking if there is any already existing rtc device driver whic=
h is compatible with pericom pt7c4338 device on mailing list and as there w=
as no answer or help then, I actually ended up writing device driver for th=
at and then on the suggestion using ds1307 device driver for this.
Thanks
Priyanka
=20
Regards,
=20
Wolfram
=20
--
Pengutronix e.K. | Wolfram Sang
|
Industrial Linux Solutions | http://www.pengutronix.de/
|
From: Wolfram Sang <hidden> Date: 2011-05-30 08:24:46
Hi, Priyanka,
Yes, It is possible to directly use platform device 'ds1307' in device
tree.
Great, thanks for testing.
But I have one query of how to capture the information that pericom,
pt7c4338 device is compatible with dallas, ds1307. Can it be done in
somewhere in some document or some code. Actually for pt7c4338 device
Yes, it should definately be documented in the source.
driver, I actually started by asking if there is any already existing
rtc device driver which is compatible with pericom pt7c4338 device on
mailing list and as there was no answer or help then, I actually ended
up writing device driver for that
The first place where this should be mentioned is the datasheet of the
pt-chip, so you might ask the producer to add this information (don't
expect much to happen, though). For such generic devices, it is then
useful to look for similar register sets in existing drivers to find a
duplicate. Please don't forget that such lists are voluntary, there is
no guarantee that mails get replied to.
and then on the suggestion using ds1307 device driver for this.
IIRC I asked you explicitly for the differences between the chips. If
there are none, you can use the driver directly, right? :)
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
From: Tabi Timur-B04825 <hidden> Date: 2011-05-30 14:30:06
On Mon, May 30, 2011 at 3:24 AM, Wolfram Sang [off-list ref] wrote=
:
The first place where this should be mentioned is the datasheet of the
pt-chip, so you might ask the producer to add this information (don't
expect much to happen, though).
It's true that the data sheet does not mention that it's identical to
the DS1307, but that's still no excuse for not noticing it and writing
a whole driver for it. :-(
IIRC I asked you explicitly for the differences between the chips. If
there are none, you can use the driver directly, right? :)
Yes. The device tree node for the PT7C4338 device should just say
/* The board has a PT7C4338, which is compatible with the DS1307 */
compatible =3D "dallas,ds1307";
And that's it.
--=20
Timur Tabi
Linux kernel developer at Freescale=
From: Wolfram Sang <hidden> Date: 2011-05-30 14:50:50
quoted
IIRC I asked you explicitly for the differences between the chips. If
there are none, you can use the driver directly, right? :)
Yes. The device tree node for the PT7C4338 device should just say
/* The board has a PT7C4338, which is compatible with the DS1307 */
compatible = "dallas,ds1307";
And that's it.
I'd also suggest to add a comment to the id_table in rtc-ds1307.c, so
the chip name can be grepped for.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
From: Anton Vorontsov <hidden> Date: 2011-05-30 17:25:45
On Mon, May 30, 2011 at 02:29:58PM +0000, Tabi Timur-B04825 wrote:
On Mon, May 30, 2011 at 3:24 AM, Wolfram Sang [off-list ref] wrote:
quoted
The first place where this should be mentioned is the datasheet of the
pt-chip, so you might ask the producer to add this information (don't
expect much to happen, though).
It's true that the data sheet does not mention that it's identical to
the DS1307, but that's still no excuse for not noticing it and writing
a whole driver for it. :-(
quoted
IIRC I asked you explicitly for the differences between the chips. If
there are none, you can use the driver directly, right? :)
Yes. The device tree node for the PT7C4338 device should just say
/* The board has a PT7C4338, which is compatible with the DS1307 */
compatible = "dallas,ds1307";
From: Grant Likely <hidden> Date: 2011-06-03 18:03:08
On Mon, May 30, 2011 at 08:57:45PM +0400, Anton Vorontsov wrote:
On Mon, May 30, 2011 at 02:29:58PM +0000, Tabi Timur-B04825 wrote:
quoted
On Mon, May 30, 2011 at 3:24 AM, Wolfram Sang [off-list ref] wrote:
quoted
The first place where this should be mentioned is the datasheet of the
pt-chip, so you might ask the producer to add this information (don't
expect much to happen, though).
It's true that the data sheet does not mention that it's identical to
the DS1307, but that's still no excuse for not noticing it and writing
a whole driver for it. :-(
quoted
IIRC I asked you explicitly for the differences between the chips. If
there are none, you can use the driver directly, right? :)
Yes. The device tree node for the PT7C4338 device should just say
/* The board has a PT7C4338, which is compatible with the DS1307 */
compatible = "dallas,ds1307";
While it seems to be 100% compatible, there could be chip-specific
bugs or some interesting features that are hidden behind "reserved"
bits and registers.
So I think device tree should not lie about the chip model. Doing
'compatible = "pericom,pt7c4338", "dallas,ds1307"' is perfectly fine.
Correct. It's fine (and encouraged) to claim compatibility, but the
node should always specify the exact part in the compatible list.
On that note, device-tree-style of_match_table binding now works for
i2c devices, so the problems you were having with that thread should
now be solved.
The of_find_i2c_driver() approach was only ever a heuristic to get
things working in the short term. of_match_table is is better in the
long run.
g.