#include <linux/platform_device.h>
#include <linux/sysfs.h>
#include <linux/io.h>
+#include <linux/clk.h>
#include <linux/fsl_devices.h>
#include <mach/hardware.h>
#include <asm/irq.h>
struct attribute_group attr_group;
unsigned int base;
unsigned int initial;
+ struct clk *clk;
/* attribute ** follow */
/* device_attribute follow */
};
int idx;
u32 val;
ssize_t result = 0;
+ struct mxs_platform_perfmon_data *pdata = pdev->dev.platform_data;
idx = attr - devattr;
if ((unsigned int)idx >= pd->count)
[idx - pd->pdata->bit_config_cnt];
if (!pd->initial) {
+ if (pd->clk)
+ clk_enable(pd->clk);
+ if (pdata->plt_init)
+ pdata->plt_init();
+
mxs_reset_block((void *)pd->base, true);
pd->initial = true;
}
struct mxs_perfmon_bit_config *pb;
int idx, r;
unsigned long val, newval;
+ struct mxs_platform_perfmon_data *pdata = pdev->dev.platform_data;
idx = attr - devattr;
if ((unsigned int)idx >= pd->count)
[idx - pd->pdata->bit_config_cnt];
if (!pd->initial) {
+ if (pd->clk)
+ clk_enable(pd->clk);
+ if (pdata->plt_init)
+ pdata->plt_init();
+
mxs_reset_block((void *)pd->base, true);
pd->initial = true;
}
struct device_attribute *devattr;
int i, cnt, size;
int err;
+ struct device *dev = &pdev->dev;
pdata = pdev->dev.platform_data;
if (pdata == NULL)
pd->pdata_common = pdata_common;
pd->base = (unsigned int)ioremap(res->start, res->end - res->start);
pd->initial = false;
+ pd->clk = clk_get(dev, "perfmon");
platform_set_drvdata(pdev, pd);
pd->count = cnt;
static int __devexit mxs_perfmon_remove(struct platform_device *pdev)
{
struct mxs_perfmon_data *pd;
+ struct mxs_platform_perfmon_data *pdata = pdev->dev.platform_data;;
pd = platform_get_drvdata(pdev);
sysfs_remove_group(&pdev->dev.kobj, &pd->attr_group);
platform_set_drvdata(pdev, NULL);
+
+ if (pdata->plt_exit)
+ pdata->plt_exit();
+
+ if (pd->clk) {
+ if (pd->initial)
+ clk_disable(pd->clk);
+ clk_put(pd->clk);
+ }
+
kfree(pd);
return 0;