[Balloon-svn] r1869 - balloon/branches/menuconfig2/package/k…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: subversion@balloonboard.org
Date:  
To: balloon-svn
Subject: [Balloon-svn] r1869 - balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4
Author: nick
Date: 2012-05-04 10:14:09 +0100 (Fri, 04 May 2012)
New Revision: 1869

Added:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/rtc-ds1390.patch
Modified:
balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt
Log:
add rtc patch for ds1390 to enable osc config and trickle charge mode setting

Added: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/rtc-ds1390.patch
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/rtc-ds1390.patch                            (rev 0)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/rtc-ds1390.patch    2012-05-04 09:14:09 UTC (rev 1869)
@@ -0,0 +1,76 @@
+Index: linux-2.6.39.4/drivers/rtc/rtc-ds1390.c
+===================================================================
+--- linux-2.6.39.4.orig/drivers/rtc/rtc-ds1390.c    2012-05-04 09:29:23.000000000 +0100
++++ linux-2.6.39.4/drivers/rtc/rtc-ds1390.c    2012-05-04 09:34:54.000000000 +0100
+@@ -40,6 +40,24 @@
+ #define DS1390_REG_STATUS        0x0E
+ #define DS1390_REG_TRICKLE        0x0F
+ 
++/*Trickle Charge Register States */
++#define DS1390_TRICKLE_NO_DIODE_250R    0xA5
++#define DS1390_TRICKLE_ONE_DIODE_250R   0xA9
++#define DS1390_TRICKLE_NO_DIODE_2KR     0xA6
++#define DS1390_TRICKLE_ONE_DIODE_2KR    0xAA
++#define DS1390_TRICKLE_NO_DIODE_4KR     0xA7
++#define DS1390_TRICKLE_ONE_DIODE_4KR    0xAB
++#define DS1390_TRICKLE_DISABLE          0x00
++
++/*Register bits specific to DS1392 Control Register */
++#define DS1392_CONTROL_REG_NEOSC_BIT (1 << 7)
++#define DS1392_CONTROL_REG_BBSQI_BIT (1 << 5)
++#define DS1392_CONTROL_REG_RS2_BIT   (1 << 4)
++#define DS1392_CONTROL_REG_RS1_BIT   (1 << 3)
++#define DS1392_CONTROL_REG_NESQW     (1 << 2)
++#define DS1392_CONTROL_REG_AIE       (1 << 0)
++
++
+ struct ds1390 {
+     struct rtc_device *rtc;
+     u8 txrx_buf[9];    /* cmd + 8 registers */
+@@ -67,6 +85,27 @@
+     return 0;
+ }
+ 
++static int ds1390_put_reg(struct device *dev, unsigned char address,
++                unsigned char data)
++{
++    struct spi_device *spi = to_spi_device(dev);
++    struct ds1390 *chip = dev_get_drvdata(dev);
++    int status;
++
++    if (!data)
++        return -EINVAL;
++
++    /* Set MSB to indicate write (note datasheet waveform for DS1392 wrong here)*/
++    chip->txrx_buf[0] = address | 0x80;
++    chip->txrx_buf[1] = data;
++    /* do the i/o */
++    status = spi_write_then_read(spi, chip->txrx_buf, 2, chip->txrx_buf, 0);
++    if (status != 0)
++        return status;
++
++    return 0;
++}
++
+ static int ds1390_read_time(struct device *dev, struct rtc_time *dt)
+ {
+     struct spi_device *spi = to_spi_device(dev);
+@@ -152,6 +191,18 @@
+         res = PTR_ERR(chip->rtc);
+         kfree(chip);
+     }
++    /*FIXME should provide the means to set the osc config in reg 0x0D */
++    pr_info("%s : Setting control register to %d\n", __func__, 0);
++    res = ds1390_put_reg(&spi->dev, DS1390_REG_CONTROL, 0);
++    if (res != 0)
++        pr_err("%s : unable to set control reg\n", __func__);
++
++    /*Set up Trickle Charge Reg*/
++    /*FIXME the trickle charge setting ought to be a configuration parameter */
++    pr_info("%s : Setting trickle charge register to %d\n", __func__, DS1390_TRICKLE_ONE_DIODE_4KR);
++    res = ds1390_put_reg(&spi->dev, DS1390_REG_TRICKLE, DS1390_TRICKLE_ONE_DIODE_4KR);
++    if (res != 0)
++        pr_err("%s : unable to set trickle charge reg\n", __func__);
+ 
+     return res;
+ }


Modified: balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt
===================================================================
--- balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt    2012-05-04 09:12:23 UTC (rev 1868)
+++ balloon/branches/menuconfig2/package/kernel/patches/2.6.39.4/series-balloon3-bubble-tt    2012-05-04 09:14:09 UTC (rev 1869)
@@ -24,3 +24,4 @@
 spi_tt.patch
 usb_gadget_vbus.patch
 wm8960.patch
+rtc-ds1390.patch