aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerry Lv <r65388@freescale.com>2011-11-02 17:14:39 +0800
committerEric Miao <eric.miao@canonical.com>2011-11-10 07:38:59 +0800
commitdb5b3814760c5b78f2489a9633dbc43213678baa (patch)
treeaecdedb3e163acf255b7d7dbca17f727b7c80555
parenta5c49abd2a29ad8719dc33f0efaac538dc72cd66 (diff)
downloadlinux-linaro-db5b3814760c5b78f2489a9633dbc43213678baa.tar.gz
ENGR00161234-1: Enable ocotp clock for mx6q
Add clock enable code to driver. OCOTP driver missed code to enable clock in driver. Thus if ocotp clock is not enabled in clock.c, ocotp will not work. Signed-off-by: Terry Lv <r65388@freescale.com>
-rwxr-xr-xdrivers/char/fsl_otp.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/char/fsl_otp.c b/drivers/char/fsl_otp.c
index 5517e555012..05ad55e9d6a 100755
--- a/drivers/char/fsl_otp.c
+++ b/drivers/char/fsl_otp.c
@@ -40,6 +40,7 @@ static struct attribute **attrs;
static struct kobj_attribute *kattr;
static struct attribute_group attr_group;
static struct mxc_otp_platform_data *otp_data;
+static struct clk *otp_clk;
static inline unsigned int get_reg_index(struct kobj_attribute *tmp)
{
@@ -177,6 +178,12 @@ static int __devinit fsl_otp_probe(struct platform_device *pdev)
if (pdata == NULL)
return -ENODEV;
+ /* Enable clock */
+ if (pdata->clock_name) {
+ otp_clk = clk_get(&pdev->dev, pdata->clock_name);
+ clk_enable(otp_clk);
+ }
+
retval = alloc_otp_attr(pdata);
if (retval)
return retval;
@@ -207,11 +214,23 @@ error:
static int otp_remove(struct platform_device *pdev)
{
+ struct mxc_otp_platform_data *pdata;
+
+ pdata = pdev->dev.platform_data;
+ if (pdata == NULL)
+ return -ENODEV;
+
kobject_put(otp_kobj);
otp_kobj = NULL;
free_otp_attr();
unmap_ocotp_addr();
+
+ if (pdata->clock_name) {
+ clk_disable(otp_clk);
+ clk_put(otp_clk);
+ }
+
return 0;
}