RTC MSECURE: msecure initialization
PATCH v2 2/4 RTC MSECURE: msecure initialization
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.
--- drivers/rtc/rtc-twl4030.c | 38 +++++++++++++++++++++++++++++++++++++- 1 files changed, 37 insertions(+), 1 deletions(-)
drivers/rtc/rtc-twl4030.c +37 -1
@@ -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)) {
Signature · 1 line
1.6.0.4
Charu -- possible bug
drivers/rtc/rtc-twl4030.c line 97
Quoted 13 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Varadarajan, Charu Latha
/*
+ * msecure line initialisation for TWL4030 RTC registers write access
+ */drivers/rtc/rtc-twl4030.c +7
-0+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?
Quoted 11 lines
drivers/rtc/rtc-twl4030.c +11
-0+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. +*/
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v2 2/4 RTC MSECURE: msecure initialization
Vikram,
Quoted 29 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Pandita, Vikram
Sent: Wednesday, August 26, 2009 12:01 AM
To: Varadarajan, Charu Latha; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH v2 2/4] RTC MSECURE: msecure initializationCharu -- possible bug
Quoted 2 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap-[email protected]] On Behalf Of
drivers/rtc/rtc-twl4030.c line 97
Quoted 11 lines
Varadarajan, Charu Latha
/*
+ * msecure line initialisation for TWL4030 RTC registers write access
+ */drivers/rtc/rtc-twl4030.c +7
-0+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
Quoted 3 lines
For these boards, there is no
msecure_gpiodefined.What would be the value for
msecure_gpiofor 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.
Quoted 17 lines
drivers/rtc/rtc-twl4030.c line 108
Quoted 13 lines
drivers/rtc/rtc-twl4030.c +11
-0+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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html