From patchwork Thu May 26 07:03:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Priyanka Jain X-Patchwork-Id: 97501 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-gy0-f184.google.com (mail-gy0-f184.google.com [209.85.160.184]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by ozlabs.org (Postfix) with ESMTPS id BA6BBB6FA7 for ; Thu, 26 May 2011 17:05:26 +1000 (EST) Received: by gyd8 with SMTP id 8sf559145gyd.11 for ; Thu, 26 May 2011 00:05:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:x-beenthere:received-spf:x-spamscore:x-bigfish :x-spam-tcs-scl:x-forefront-antispam-report:from:to:cc:subject:date :message-id:x-mailer:mime-version:x-originatororg:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; bh=H00zbt458ApUMUcBuEgfvCwx7QuUOZuRy0Y/445r8Dw=; b=qPf9bX62kHmkoIUwBLmRg8a0K22Bcc5Vs618njNJwCQi70VHCEP21QcOWGVkNQa7M7 01UsDKZkmMAYMTbzHVvqX+Oq9YR7/M5vPeOwPhLNigCBTUK6xm6HCi7Hzc/9zFO8Tb7Z z9Z5g3j+WsYKQNA8w8vru6XnAze4VIy6B3R10= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:x-spamscore:x-bigfish:x-spam-tcs-scl :x-forefront-antispam-report:from:to:cc:subject:date:message-id :x-mailer:mime-version:x-originatororg:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-google-group-id:list-post:list-help:list-archive:sender :list-subscribe:list-unsubscribe:content-type; b=lfvctVsnAazYEyrHZNrh2NdsgGJdN5gRcgEgxAxdLNVdlU2k3DaR+jOHGVreQJngjJ YaGqxzu5cay84DS+KMO5gpe1krm8/IqnTvc8inpoMUIlkWYU3HB7sRjM4gHVWlqDRTKt 1ivEORyhPEqNDX4SyZrGdsoKxuPh3QJJCdnDo= Received: by 10.146.179.2 with SMTP id b2mr72680yaf.16.1306393522599; Thu, 26 May 2011 00:05:22 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.101.212.20 with SMTP id o20ls299197anq.3.gmail; Thu, 26 May 2011 00:05:22 -0700 (PDT) Received: by 10.100.23.30 with SMTP id 30mr327437anw.27.1306393522094; Thu, 26 May 2011 00:05:22 -0700 (PDT) Received: by 10.100.23.30 with SMTP id 30mr327435anw.27.1306393522054; Thu, 26 May 2011 00:05:22 -0700 (PDT) Received: from TX2EHSOBE005.bigfish.com (tx2ehsobe003.messaging.microsoft.com [65.55.88.13]) by gmr-mx.google.com with ESMTPS id g40si432755anh.0.2011.05.26.00.05.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 May 2011 00:05:20 -0700 (PDT) Received-SPF: neutral (google.com: 65.55.88.13 is neither permitted nor denied by best guess record for domain of b32167@lc1106.zin33.ap.freescale.net) client-ip=65.55.88.13; Received: from mail122-tx2-R.bigfish.com (10.9.14.242) by TX2EHSOBE005.bigfish.com (10.9.40.25) with Microsoft SMTP Server id 14.1.225.22; Thu, 26 May 2011 07:05:20 +0000 Received: from mail122-tx2 (localhost.localdomain [127.0.0.1]) by mail122-tx2-R.bigfish.com (Postfix) with ESMTP id E7547608CA2; Thu, 26 May 2011 07:05:18 +0000 (UTC) X-SpamScore: 3 X-BigFish: VS3(zzc8kzz1202hzz8275bhz2dh2a8h668h839h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail122-tx2 (localhost.localdomain [127.0.0.1]) by mail122-tx2 (MessageSwitch) id 1306393501444130_28942; Thu, 26 May 2011 07:05:01 +0000 (UTC) Received: from TX2EHSMHS021.bigfish.com (unknown [10.9.14.239]) by mail122-tx2.bigfish.com (Postfix) with ESMTP id 12F41AF816A; Thu, 26 May 2011 07:03:34 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS021.bigfish.com (10.9.99.121) with Microsoft SMTP Server (TLS) id 14.1.225.22; Thu, 26 May 2011 07:03:33 +0000 Received: from az33smr01.freescale.net (10.64.34.199) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.270.2; Thu, 26 May 2011 02:03:32 -0500 Received: from lc1106.zin33.ap.freescale.net (lc1106.zin33.ap.freescale.net [10.232.3.106]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id p4Q73U24000634; Thu, 26 May 2011 02:03:31 -0500 (CDT) Received: by lc1106.zin33.ap.freescale.net (Postfix, from userid 65011109) id DC758C06B; Thu, 26 May 2011 12:33:29 +0530 (IST) From: Priyanka Jain To: , , , , , CC: Priyanka Jain Subject: [rtc-linux] [PATCH] Add support for pt7c4338 (rtc device) in rtc-ds1307 driver Date: Thu, 26 May 2011 12:33:29 +0530 Message-ID: <1306393409-16153-1-git-send-email-Priyanka.Jain@freescale.com> X-Mailer: git-send-email 1.6.5.6 MIME-Version: 1.0 X-OriginatorOrg: freescale.net X-Original-Sender: priyanka.jain@freescale.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 65.55.88.13 is neither permitted nor denied by best guess record for domain of b32167@lc1106.zin33.ap.freescale.net) smtp.mail=b32167@lc1106.zin33.ap.freescale.net Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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 --- 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(-) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index b8f4e9e..c6045dd 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -126,13 +126,13 @@ comment "I2C RTC drivers" if I2C config RTC_DRV_DS1307 - tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025" + tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025, PT7C4338" help If you say yes here you get support for various compatible RTC chips (often with battery backup) connected with I2C. This driver should handle DS1307, DS1337, DS1338, DS1339, DS1340, ST M41T00, - EPSON RX-8025 and probably other chips. In some cases the RTC - must already have been initialized (by manufacturing or a + EPSON RX-8025, PT7C4338 and probably other chips. In some cases + the RTC must already have been initialized (by manufacturing or a bootloader). The first seven registers on these chips hold an RTC, and other diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c index 4724ba3..8436f16 100644 --- a/drivers/rtc/rtc-ds1307.c +++ b/drivers/rtc/rtc-ds1307.c @@ -4,6 +4,8 @@ * Copyright (C) 2005 James Chapman (ds1337 core) * Copyright (C) 2006 David Brownell * Copyright (C) 2009 Matthias Fuchs (rx8025 support) + * Copyright (C) 2011 Priyanka Jain (Priyanka.Jain@freescale.com) + * (pt7c4338 support) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -34,6 +36,7 @@ enum ds_type { ds_1388, ds_3231, m41t00, + pt7c4338, rx_8025, // rs5c372 too? different address... }; @@ -137,6 +140,8 @@ static const struct chip_desc chips[] = { }, [m41t00] = { }, +[pt7c4338] = { +}, [rx_8025] = { }, }; @@ -149,6 +154,7 @@ static const struct i2c_device_id ds1307_id[] = { { "ds1340", ds_1340 }, { "ds3231", ds_3231 }, { "m41t00", m41t00 }, + { "pt7c4338", pt7c4338 }, { "rx8025", rx_8025 }, { } }; @@ -769,6 +775,7 @@ read_rtc: switch (ds1307->type) { case ds_1307: case m41t00: + case pt7c4338: /* clock halted? turn it on, so clock can tick. */ if (tmp & DS1307_BIT_CH) { i2c_smbus_write_byte_data(client, DS1307_REG_SECS, 0);