|
@@ -57,6 +57,7 @@
|
|
#include <linux/sched.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/random.h>
|
|
#include <linux/random.h>
|
|
#include <linux/of.h>
|
|
#include <linux/of.h>
|
|
|
|
+#include <linux/clk.h>
|
|
|
|
|
|
#include "ssi_config.h"
|
|
#include "ssi_config.h"
|
|
#include "ssi_driver.h"
|
|
#include "ssi_driver.h"
|
|
@@ -219,6 +220,8 @@ static int init_cc_resources(struct platform_device *plat_dev)
|
|
void __iomem *cc_base = NULL;
|
|
void __iomem *cc_base = NULL;
|
|
bool irq_registered = false;
|
|
bool irq_registered = false;
|
|
struct ssi_drvdata *new_drvdata = kzalloc(sizeof(struct ssi_drvdata), GFP_KERNEL);
|
|
struct ssi_drvdata *new_drvdata = kzalloc(sizeof(struct ssi_drvdata), GFP_KERNEL);
|
|
|
|
+ struct device *dev = &plat_dev->dev;
|
|
|
|
+ struct device_node *np = dev->of_node;
|
|
u32 signature_val;
|
|
u32 signature_val;
|
|
int rc = 0;
|
|
int rc = 0;
|
|
|
|
|
|
@@ -228,6 +231,8 @@ static int init_cc_resources(struct platform_device *plat_dev)
|
|
goto init_cc_res_err;
|
|
goto init_cc_res_err;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ new_drvdata->clk = of_clk_get(np, 0);
|
|
|
|
+
|
|
/*Initialize inflight counter used in dx_ablkcipher_secure_complete used for count of BYSPASS blocks operations*/
|
|
/*Initialize inflight counter used in dx_ablkcipher_secure_complete used for count of BYSPASS blocks operations*/
|
|
new_drvdata->inflight_counter = 0;
|
|
new_drvdata->inflight_counter = 0;
|
|
|
|
|
|
@@ -286,6 +291,10 @@ static int init_cc_resources(struct platform_device *plat_dev)
|
|
|
|
|
|
new_drvdata->plat_dev = plat_dev;
|
|
new_drvdata->plat_dev = plat_dev;
|
|
|
|
|
|
|
|
+ rc = cc_clk_on(new_drvdata);
|
|
|
|
+ if (rc)
|
|
|
|
+ goto init_cc_res_err;
|
|
|
|
+
|
|
if(new_drvdata->plat_dev->dev.dma_mask == NULL)
|
|
if(new_drvdata->plat_dev->dev.dma_mask == NULL)
|
|
{
|
|
{
|
|
new_drvdata->plat_dev->dev.dma_mask = & new_drvdata->plat_dev->dev.coherent_dma_mask;
|
|
new_drvdata->plat_dev->dev.dma_mask = & new_drvdata->plat_dev->dev.coherent_dma_mask;
|
|
@@ -450,14 +459,11 @@ static void cleanup_cc_resources(struct platform_device *plat_dev)
|
|
ssi_sysfs_fini();
|
|
ssi_sysfs_fini();
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- /* Mask all interrupts */
|
|
|
|
- WRITE_REGISTER(drvdata->cc_base + CC_REG_OFFSET(HOST_RGF, HOST_IMR),
|
|
|
|
- 0xFFFFFFFF);
|
|
|
|
|
|
+ fini_cc_regs(drvdata);
|
|
|
|
+ cc_clk_off(drvdata);
|
|
free_irq(drvdata->res_irq->start, drvdata);
|
|
free_irq(drvdata->res_irq->start, drvdata);
|
|
drvdata->res_irq = NULL;
|
|
drvdata->res_irq = NULL;
|
|
|
|
|
|
- fini_cc_regs(drvdata);
|
|
|
|
-
|
|
|
|
if (drvdata->cc_base != NULL) {
|
|
if (drvdata->cc_base != NULL) {
|
|
iounmap(drvdata->cc_base);
|
|
iounmap(drvdata->cc_base);
|
|
release_mem_region(drvdata->res_mem->start,
|
|
release_mem_region(drvdata->res_mem->start,
|
|
@@ -470,6 +476,33 @@ static void cleanup_cc_resources(struct platform_device *plat_dev)
|
|
dev_set_drvdata(&plat_dev->dev, NULL);
|
|
dev_set_drvdata(&plat_dev->dev, NULL);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int cc_clk_on(struct ssi_drvdata *drvdata)
|
|
|
|
+{
|
|
|
|
+ struct clk *clk = drvdata->clk;
|
|
|
|
+ int rc;
|
|
|
|
+
|
|
|
|
+ if (IS_ERR(clk))
|
|
|
|
+ /* Not all devices have a clock associated with CCREE */
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ rc = clk_prepare_enable(clk);
|
|
|
|
+ if (rc)
|
|
|
|
+ return rc;
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void cc_clk_off(struct ssi_drvdata *drvdata)
|
|
|
|
+{
|
|
|
|
+ struct clk *clk = drvdata->clk;
|
|
|
|
+
|
|
|
|
+ if (IS_ERR(clk))
|
|
|
|
+ /* Not all devices have a clock associated with CCREE */
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ clk_disable_unprepare(clk);
|
|
|
|
+}
|
|
|
|
+
|
|
static int cc7x_probe(struct platform_device *plat_dev)
|
|
static int cc7x_probe(struct platform_device *plat_dev)
|
|
{
|
|
{
|
|
int rc;
|
|
int rc;
|