msm: pil: Hook into subsystem framework
The subsystem framework is going to replace the PIL framework in the near future. Hook up drivers that don't have subsystem restart counterparts into the subsystem framework so that we can migrate all callers of pil_get/put into their subsystem equivalents. Change-Id: I45f771861d3430117c224b22b64f7d4bf3c6428e Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
This commit is contained in:
parent
152d0ec42f
commit
c8624eb6a4
|
@ -2010,7 +2010,7 @@ config MSM_PIL_RIVA
|
|||
|
||||
config MSM_PIL_TZAPPS
|
||||
tristate "TZApps Boot Support"
|
||||
depends on MSM_PIL
|
||||
depends on MSM_PIL && MSM_SUBSYSTEM_RESTART
|
||||
help
|
||||
Support for booting and shutting down TZApps.
|
||||
|
||||
|
@ -2029,13 +2029,13 @@ config MSM_PIL_DSPS
|
|||
|
||||
config MSM_PIL_VIDC
|
||||
tristate "Video Core Secure Boot Support"
|
||||
depends on MSM_PIL
|
||||
depends on MSM_PIL && MSM_SUBSYSTEM_RESTART
|
||||
help
|
||||
Support for authenticating the video core image.
|
||||
|
||||
config MSM_PIL_VENUS
|
||||
tristate "VENUS (Video) Boot Support"
|
||||
depends on MSM_PIL
|
||||
depends on MSM_PIL && MSM_SUBSYSTEM_RESTART
|
||||
help
|
||||
Support for booting and shutting down the VENUS processor (Video).
|
||||
Venus is the Video subsystem processor used for video codecs.
|
||||
|
|
|
@ -16,9 +16,18 @@
|
|||
#include <linux/elf.h>
|
||||
#include <linux/err.h>
|
||||
|
||||
#include <mach/peripheral-loader.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
|
||||
#include "peripheral-loader.h"
|
||||
#include "scm-pas.h"
|
||||
|
||||
struct tzapps_data {
|
||||
struct pil_device *pil;
|
||||
struct subsys_device *subsys;
|
||||
struct subsys_desc subsys_desc;
|
||||
};
|
||||
|
||||
static int pil_tzapps_init_image(struct pil_desc *pil, const u8 *metadata,
|
||||
size_t size)
|
||||
{
|
||||
|
@ -41,10 +50,28 @@ static struct pil_reset_ops pil_tzapps_ops = {
|
|||
.shutdown = pil_tzapps_shutdown,
|
||||
};
|
||||
|
||||
#define subsys_to_drv(d) container_of(d, struct tzapps_data, subsys_desc)
|
||||
|
||||
static int tzapps_start(const struct subsys_desc *desc)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = pil_get("tzapps");
|
||||
if (IS_ERR(ret))
|
||||
return PTR_ERR(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void tzapps_stop(const struct subsys_desc *desc)
|
||||
{
|
||||
struct tzapps_data *drv = subsys_to_drv(desc);
|
||||
pil_put(drv->pil);
|
||||
}
|
||||
|
||||
static int pil_tzapps_driver_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pil_desc *desc;
|
||||
struct pil_device *pil;
|
||||
struct tzapps_data *drv;
|
||||
|
||||
if (pas_supported(PAS_TZAPPS) < 0)
|
||||
return -ENOSYS;
|
||||
|
@ -53,21 +80,38 @@ static int pil_tzapps_driver_probe(struct platform_device *pdev)
|
|||
if (!desc)
|
||||
return -ENOMEM;
|
||||
|
||||
drv = devm_kzalloc(&pdev->dev, sizeof(*drv), GFP_KERNEL);
|
||||
if (!drv)
|
||||
return -ENOMEM;
|
||||
platform_set_drvdata(pdev, drv);
|
||||
|
||||
desc->name = "tzapps";
|
||||
desc->dev = &pdev->dev;
|
||||
desc->ops = &pil_tzapps_ops;
|
||||
desc->owner = THIS_MODULE;
|
||||
pil = msm_pil_register(desc);
|
||||
if (IS_ERR(pil))
|
||||
return PTR_ERR(pil);
|
||||
platform_set_drvdata(pdev, pil);
|
||||
drv->pil = msm_pil_register(desc);
|
||||
if (IS_ERR(drv->pil))
|
||||
return PTR_ERR(drv->pil);
|
||||
|
||||
drv->subsys_desc.name = "tzapps";
|
||||
drv->subsys_desc.dev = &pdev->dev;
|
||||
drv->subsys_desc.owner = THIS_MODULE;
|
||||
drv->subsys_desc.start = tzapps_start;
|
||||
drv->subsys_desc.stop = tzapps_stop;
|
||||
|
||||
drv->subsys = subsys_register(&drv->subsys_desc);
|
||||
if (IS_ERR(drv->subsys)) {
|
||||
msm_pil_unregister(drv->pil);
|
||||
return PTR_ERR(drv->subsys);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pil_tzapps_driver_exit(struct platform_device *pdev)
|
||||
{
|
||||
struct pil_device *pil = platform_get_drvdata(pdev);
|
||||
msm_pil_unregister(pil);
|
||||
struct tzapps_data *drv = platform_get_drvdata(pdev);
|
||||
subsys_unregister(drv->subsys);
|
||||
msm_pil_unregister(drv->pil);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <mach/iommu.h>
|
||||
#include <mach/iommu_domains.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
#include <mach/peripheral-loader.h>
|
||||
|
||||
#include "peripheral-loader.h"
|
||||
#include "scm-pas.h"
|
||||
|
@ -66,6 +68,8 @@ struct venus_data {
|
|||
void __iomem *venus_wrapper_base;
|
||||
void __iomem *venus_vbif_base;
|
||||
struct pil_device *pil;
|
||||
struct subsys_device *subsys;
|
||||
struct subsys_desc subsys_desc;
|
||||
struct regulator *gdsc;
|
||||
phys_addr_t start_addr;
|
||||
struct clk *clks[ARRAY_SIZE(clk_names)];
|
||||
|
@ -78,6 +82,8 @@ struct venus_data {
|
|||
u32 fw_max_paddr;
|
||||
};
|
||||
|
||||
#define subsys_to_drv(d) container_of(d, struct venus_data, subsys_desc)
|
||||
|
||||
static int venus_register_domain(u32 fw_max_sz)
|
||||
{
|
||||
struct msm_iova_partition venus_fw_partition = {
|
||||
|
@ -381,6 +387,23 @@ static struct pil_reset_ops pil_venus_ops_trusted = {
|
|||
.proxy_unvote = pil_venus_remove_proxy_vote,
|
||||
};
|
||||
|
||||
static int venus_start(const struct subsys_desc *desc)
|
||||
{
|
||||
void *ret;
|
||||
struct venus_data *drv = subsys_to_drv(desc);
|
||||
|
||||
ret = pil_get(drv->subsys_desc.name);
|
||||
if (IS_ERR(ret))
|
||||
return PTR_ERR(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void venus_stop(const struct subsys_desc *desc)
|
||||
{
|
||||
struct venus_data *drv = subsys_to_drv(desc);
|
||||
pil_put(drv->pil);
|
||||
}
|
||||
|
||||
static int pil_venus_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct venus_data *drv;
|
||||
|
@ -488,12 +511,25 @@ static int pil_venus_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(drv->pil))
|
||||
return PTR_ERR(drv->pil);
|
||||
|
||||
drv->subsys_desc.name = desc->name;
|
||||
drv->subsys_desc.owner = THIS_MODULE;
|
||||
drv->subsys_desc.dev = &pdev->dev;
|
||||
drv->subsys_desc.start = venus_start;
|
||||
drv->subsys_desc.stop = venus_stop;
|
||||
|
||||
drv->subsys = subsys_register(&drv->subsys_desc);
|
||||
if (IS_ERR(drv->subsys)) {
|
||||
msm_pil_unregister(drv->pil);
|
||||
return PTR_ERR(drv->subsys);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pil_venus_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct venus_data *drv = platform_get_drvdata(pdev);
|
||||
subsys_unregister(drv->subsys);
|
||||
msm_pil_unregister(drv->pil);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
#include <linux/err.h>
|
||||
#include <linux/clk.h>
|
||||
|
||||
#include <mach/peripheral-loader.h>
|
||||
#include <mach/subsystem_restart.h>
|
||||
|
||||
#include "peripheral-loader.h"
|
||||
#include "scm-pas.h"
|
||||
|
||||
|
@ -24,6 +27,8 @@ struct vidc_data {
|
|||
struct clk *smmu_iface;
|
||||
struct clk *core;
|
||||
struct pil_device *pil;
|
||||
struct subsys_device *subsys;
|
||||
struct subsys_desc subsys_desc;
|
||||
};
|
||||
|
||||
static int pil_vidc_init_image(struct pil_desc *pil, const u8 *metadata,
|
||||
|
@ -63,6 +68,24 @@ static struct pil_reset_ops pil_vidc_ops = {
|
|||
.shutdown = pil_vidc_shutdown,
|
||||
};
|
||||
|
||||
#define subsys_to_drv(d) container_of(d, struct vidc_data, subsys_desc)
|
||||
|
||||
static int vidc_start(const struct subsys_desc *desc)
|
||||
{
|
||||
void *ret;
|
||||
|
||||
ret = pil_get("vidc");
|
||||
if (IS_ERR(ret))
|
||||
return PTR_ERR(ret);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vidc_stop(const struct subsys_desc *desc)
|
||||
{
|
||||
struct vidc_data *drv = subsys_to_drv(desc);
|
||||
pil_put(drv->pil);
|
||||
}
|
||||
|
||||
static int pil_vidc_driver_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pil_desc *desc;
|
||||
|
@ -95,12 +118,25 @@ static int pil_vidc_driver_probe(struct platform_device *pdev)
|
|||
drv->pil = msm_pil_register(desc);
|
||||
if (IS_ERR(drv->pil))
|
||||
return PTR_ERR(drv->pil);
|
||||
|
||||
drv->subsys_desc.name = "vidc";
|
||||
drv->subsys_desc.dev = &pdev->dev;
|
||||
drv->subsys_desc.owner = THIS_MODULE;
|
||||
drv->subsys_desc.start = vidc_start;
|
||||
drv->subsys_desc.stop = vidc_stop;
|
||||
|
||||
drv->subsys = subsys_register(&drv->subsys_desc);
|
||||
if (IS_ERR(drv->subsys)) {
|
||||
msm_pil_unregister(drv->pil);
|
||||
return PTR_ERR(drv->subsys);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pil_vidc_driver_exit(struct platform_device *pdev)
|
||||
{
|
||||
struct vidc_data *drv = platform_get_drvdata(pdev);
|
||||
subsys_unregister(drv->subsys);
|
||||
msm_pil_unregister(drv->pil);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue