diff options
author | Terry Lv <r65388@freescale.com> | 2011-11-02 17:14:39 +0800 |
---|---|---|
committer | Jason Liu <r64343@freescale.com> | 2012-01-09 21:04:11 +0800 |
commit | c1ce8112f79ae58caebb7993e1a8021b03b2586b (patch) | |
tree | 9b87fa3d7d97ce5df7e90b99668c1394fb5d7181 /drivers/char | |
parent | 07237d563072bbda4334bc96bcde658a534c99bf (diff) |
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>
Diffstat (limited to 'drivers/char')
-rwxr-xr-x | drivers/char/fsl_otp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/char/fsl_otp.c b/drivers/char/fsl_otp.c index 5517e5550128..05ad55e9d6a9 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; } |