All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 2/4] RTC MSECURE: msecure initialization
@ 2009-08-24 15:07 charu
  2009-08-25 18:30 ` Pandita, Vikram
  0 siblings, 1 reply; 3+ messages in thread
From: charu @ 2009-08-24 15:07 UTC (permalink / raw)
  To: linux-omap; +Cc: tony, david-b, sameo, p_gortmaker, Charulatha V

rtc-twlcore.c does initialisation of the msecure gpio pin.
Board files indicate msecure gpio line through twl4030 platform data.
twl4030-core.c passes this information to RTC driver.
Board files does msecure gpio mux configuration.

Signed-off-by: Charulatha V <charu@ti.com>
---
 drivers/rtc/rtc-twl4030.c |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index 9c8c70c..be72253 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -29,7 +29,7 @@
 #include <linux/interrupt.h>
 
 #include <linux/i2c/twl4030.h>
-
+#include <linux/gpio.h>
 
 /*
  * RTC block register offsets (use TWL_MODULE_RTC)
@@ -86,6 +86,37 @@
 /*----------------------------------------------------------------------*/
 
 /*
+ * msecure line initialisation for TWL4030 RTC registers write access
+ */
+static int msecure_init(struct twl4030_rtc_platform_data *pdata)
+{
+	int ret = 0;
+	if (pdata == NULL)
+		goto out;
+
+	ret = gpio_request(pdata->msecure_gpio, "msecure");
+	if (ret) {
+		pr_err("twl4030_rtc: can't reserve msecure GPIO:%d !\n"
+			"RTC functionality will not be available\n",
+			pdata->msecure_gpio);
+		goto out;
+	}
+	/*
+	 * TWL4030 will be in secure mode if msecure line from OMAP is low.
+	 * Make msecure line high in order to change the TWL4030 RTC time
+	 * and calender registers.
+	 */
+	ret = gpio_direction_output(pdata->msecure_gpio, 1);
+	if (ret)
+		pr_err("twl4030_rtc: can't set msecure GPIO direction:%d !\n"
+			"RTC functionality will not be available\n",
+			pdata->msecure_gpio);
+
+out:
+	return ret;
+}
+
+/*
  * Supports 1 byte read from TWL4030 RTC register.
  */
 static int twl4030_rtc_read_u8(u8 *data, u8 reg)
@@ -390,6 +421,7 @@ static struct rtc_class_ops twl4030_rtc_ops = {
 static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
 {
 	struct rtc_device *rtc;
+	struct twl4030_rtc_platform_data *pdata = pdev->dev.platform_data;
 	int ret = 0;
 	int irq = platform_get_irq(pdev, 0);
 	u8 rd_reg;
@@ -397,6 +429,10 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		return -EINVAL;
 
+	ret = msecure_init(pdata);
+	if (ret)
+		goto out0;
+
 	rtc = rtc_device_register(pdev->name,
 				  &pdev->dev, &twl4030_rtc_ops, THIS_MODULE);
 	if (IS_ERR(rtc)) {
-- 
1.6.0.4


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

* RE: [PATCH v2 2/4] RTC MSECURE: msecure initialization
  2009-08-24 15:07 [PATCH v2 2/4] RTC MSECURE: msecure initialization charu
@ 2009-08-25 18:30 ` Pandita, Vikram
       [not found]   ` <19F8576C6E063C45BE387C64729E73940436A49FB1@dbde02.ent.ti.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Pandita, Vikram @ 2009-08-25 18:30 UTC (permalink / raw)
  To: Varadarajan, Charu Latha, linux-omap; +Cc: tony, david-b, sameo, p_gortmaker

Charu -- possible bug

>-----Original Message-----
>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of
>Varadarajan, Charu Latha
> /*
>+ * msecure line initialisation for TWL4030 RTC registers write access
>+ */
>+static int msecure_init(struct twl4030_rtc_platform_data *pdata)
>+{
>+	int ret = 0;
>+	if (pdata == NULL)
>+		goto out;
>+
>+	ret = gpio_request(pdata->msecure_gpio, "msecure");

What about other boards like: Beagle, EVM, Pandora, Zoom2, RX51
What about SDP/LDP with OMAP ES2.1 and above

For these boards, there is no msecure_gpio defined. 

What would be the value for msecure_gpio for these boards?


>+	if (ret) {
>+		pr_err("twl4030_rtc: can't reserve msecure GPIO:%d !\n"
>+			"RTC functionality will not be available\n",
>+			pdata->msecure_gpio);
>+		goto out;
>+	}
>+	/*
>+	 * TWL4030 will be in secure mode if msecure line from OMAP is low.
>+	 * Make msecure line high in order to change the TWL4030 RTC time
>+	 * and calender registers.
>+	 */

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

* [PATCH v2 2/4] RTC MSECURE: msecure initialization
       [not found]   ` <19F8576C6E063C45BE387C64729E73940436A49FB1@dbde02.ent.ti.com>
@ 2009-08-26  5:16     ` Varadarajan, Charu Latha
  0 siblings, 0 replies; 3+ messages in thread
From: Varadarajan, Charu Latha @ 2009-08-26  5:16 UTC (permalink / raw)
  To: Pandita, Vikram; +Cc: tony, david-b, sameo, p_gortmaker, linux-omap

Vikram,
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of Pandita, Vikram
> Sent: Wednesday, August 26, 2009 12:01 AM
> To: Varadarajan, Charu Latha; linux-omap@vger.kernel.org
> Cc: tony@atomide.com; david-b@pacbell.net; sameo@linux.intel.com;
> p_gortmaker@yahoo.com
> Subject: RE: [PATCH v2 2/4] RTC MSECURE: msecure initialization
>
> Charu -- possible bug
>
> >-----Original Message-----
> >From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
> owner@vger.kernel.org] On Behalf Of
> >Varadarajan, Charu Latha
> > /*
> >+ * msecure line initialisation for TWL4030 RTC registers write access
> >+ */
> >+static int msecure_init(struct twl4030_rtc_platform_data *pdata)
> >+{
> >+    int ret = 0;
> >+    if (pdata == NULL)
> >+            goto out;
> >+
> >+    ret = gpio_request(pdata->msecure_gpio, "msecure");
>
> What about other boards like: Beagle, EVM, Pandora, Zoom2, RX51
> What about SDP/LDP with OMAP ES2.1 and above
>
> For these boards, there is no msecure_gpio defined.
>
> What would be the value for msecure_gpio for these boards?
For the twl4030 based boards which don't have msecure gpio lines, the rtc platform data
need to be null. The same was addressed in version 1 patch and it has been agreed that
the default value is NULL and hence need not be initialized in board files.
This patch is tested on SDP boards with silicon version 3.1.
>
>
> >+    if (ret) {
> >+            pr_err("twl4030_rtc: can't reserve msecure GPIO:%d !\n"
> >+                    "RTC functionality will not be available\n",
> >+                    pdata->msecure_gpio);
> >+            goto out;
> >+    }
> >+    /*
> >+     * TWL4030 will be in secure mode if msecure line from OMAP is low.
> >+     * Make msecure line high in order to change the TWL4030 RTC time
> >+     * and calender registers.
> >+     */
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

end of thread, other threads:[~2009-08-26  5:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-24 15:07 [PATCH v2 2/4] RTC MSECURE: msecure initialization charu
2009-08-25 18:30 ` Pandita, Vikram
     [not found]   ` <19F8576C6E063C45BE387C64729E73940436A49FB1@dbde02.ent.ti.com>
2009-08-26  5:16     ` Varadarajan, Charu Latha

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.