staging: ti dspbridge: deh: trivial cleanups
No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0bd35016dd
commit
0a466f6913
@@ -52,11 +52,6 @@
|
|||||||
#include <dspbridge/io_sm.h>
|
#include <dspbridge/io_sm.h>
|
||||||
|
|
||||||
|
|
||||||
static struct hw_mmu_map_attrs_t map_attrs = { HW_LITTLE_ENDIAN,
|
|
||||||
HW_ELEM_SIZE16BIT,
|
|
||||||
HW_MMU_CPUES
|
|
||||||
};
|
|
||||||
|
|
||||||
static void *dummy_va_addr;
|
static void *dummy_va_addr;
|
||||||
|
|
||||||
int bridge_deh_create(struct deh_mgr **ret_deh_mgr,
|
int bridge_deh_create(struct deh_mgr **ret_deh_mgr,
|
||||||
@@ -71,23 +66,20 @@ int bridge_deh_create(struct deh_mgr **ret_deh_mgr,
|
|||||||
* the base image. */
|
* the base image. */
|
||||||
/* Get Bridge context info. */
|
/* Get Bridge context info. */
|
||||||
dev_get_bridge_context(hdev_obj, &hbridge_context);
|
dev_get_bridge_context(hdev_obj, &hbridge_context);
|
||||||
DBC_ASSERT(hbridge_context);
|
|
||||||
dummy_va_addr = NULL;
|
|
||||||
/* Allocate IO manager object: */
|
/* Allocate IO manager object: */
|
||||||
deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
|
deh_mgr = kzalloc(sizeof(struct deh_mgr), GFP_KERNEL);
|
||||||
if (!deh_mgr) {
|
if (!deh_mgr) {
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
goto leave;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create an NTFY object to manage notifications */
|
/* Create an NTFY object to manage notifications */
|
||||||
deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
|
deh_mgr->ntfy_obj = kmalloc(sizeof(struct ntfy_object), GFP_KERNEL);
|
||||||
if (deh_mgr->ntfy_obj) {
|
if (!deh_mgr->ntfy_obj) {
|
||||||
ntfy_init(deh_mgr->ntfy_obj);
|
|
||||||
} else {
|
|
||||||
status = -ENOMEM;
|
status = -ENOMEM;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
ntfy_init(deh_mgr->ntfy_obj);
|
||||||
|
|
||||||
/* Create a MMUfault DPC */
|
/* Create a MMUfault DPC */
|
||||||
tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
|
tasklet_init(&deh_mgr->dpc_tasklet, mmu_fault_dpc, (u32) deh_mgr);
|
||||||
@@ -100,22 +92,17 @@ int bridge_deh_create(struct deh_mgr **ret_deh_mgr,
|
|||||||
deh_mgr->err_info.dw_val3 = 0L;
|
deh_mgr->err_info.dw_val3 = 0L;
|
||||||
|
|
||||||
/* Install ISR function for DSP MMU fault */
|
/* Install ISR function for DSP MMU fault */
|
||||||
if ((request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
|
status = request_irq(INT_DSP_MMU_IRQ, mmu_fault_isr, 0,
|
||||||
"DspBridge\tiommu fault",
|
"DspBridge\tiommu fault", deh_mgr);
|
||||||
(void *)deh_mgr)) == 0)
|
if (status < 0)
|
||||||
status = 0;
|
goto err;
|
||||||
else
|
|
||||||
status = -EPERM;
|
*ret_deh_mgr = deh_mgr;
|
||||||
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (DSP_FAILED(status)) {
|
bridge_deh_destroy(deh_mgr);
|
||||||
/* If create failed, cleanup */
|
*ret_deh_mgr = NULL;
|
||||||
bridge_deh_destroy(deh_mgr);
|
|
||||||
deh_mgr = NULL;
|
|
||||||
}
|
|
||||||
leave:
|
|
||||||
*ret_deh_mgr = deh_mgr;
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,33 +134,32 @@ int bridge_deh_register_notify(struct deh_mgr *deh_mgr, u32 event_mask,
|
|||||||
u32 notify_type,
|
u32 notify_type,
|
||||||
struct dsp_notification *hnotification)
|
struct dsp_notification *hnotification)
|
||||||
{
|
{
|
||||||
int status = 0;
|
|
||||||
|
|
||||||
if (!deh_mgr)
|
if (!deh_mgr)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
if (event_mask)
|
if (event_mask)
|
||||||
status = ntfy_register(deh_mgr->ntfy_obj, hnotification,
|
return ntfy_register(deh_mgr->ntfy_obj, hnotification,
|
||||||
event_mask, notify_type);
|
event_mask, notify_type);
|
||||||
else
|
else
|
||||||
status = ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
|
return ntfy_unregister(deh_mgr->ntfy_obj, hnotification);
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
||||||
{
|
{
|
||||||
struct bridge_dev_context *dev_context;
|
struct bridge_dev_context *dev_context;
|
||||||
int status = 0;
|
|
||||||
u32 hw_mmu_max_tlb_count = 31;
|
u32 hw_mmu_max_tlb_count = 31;
|
||||||
struct cfg_hostres *resources;
|
struct cfg_hostres *resources;
|
||||||
hw_status hw_status_obj;
|
struct hw_mmu_map_attrs_t map_attrs = {
|
||||||
|
.endianism = HW_LITTLE_ENDIAN,
|
||||||
|
.element_size = HW_ELEM_SIZE16BIT,
|
||||||
|
.mixed_size = HW_MMU_CPUES,
|
||||||
|
};
|
||||||
|
|
||||||
if (!deh_mgr)
|
if (!deh_mgr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
dev_info(bridge, "%s: device exception\n", __func__);
|
dev_info(bridge, "%s: device exception\n", __func__);
|
||||||
dev_context = (struct bridge_dev_context *)deh_mgr->hbridge_context;
|
dev_context = deh_mgr->hbridge_context;
|
||||||
resources = dev_context->resources;
|
resources = dev_context->resources;
|
||||||
|
|
||||||
switch (ulEventMask) {
|
switch (ulEventMask) {
|
||||||
@@ -200,8 +186,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
|||||||
(unsigned int) deh_mgr->err_info.dw_val2,
|
(unsigned int) deh_mgr->err_info.dw_val2,
|
||||||
(unsigned int) fault_addr);
|
(unsigned int) fault_addr);
|
||||||
dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
|
dummy_va_addr = (void*)__get_free_page(GFP_ATOMIC);
|
||||||
dev_context = (struct bridge_dev_context *)
|
|
||||||
deh_mgr->hbridge_context;
|
|
||||||
|
|
||||||
print_dsp_trace_buffer(dev_context);
|
print_dsp_trace_buffer(dev_context);
|
||||||
dump_dl_modules(dev_context);
|
dump_dl_modules(dev_context);
|
||||||
@@ -216,13 +200,10 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
|||||||
dev_context->num_tlb_entries =
|
dev_context->num_tlb_entries =
|
||||||
dev_context->fixed_tlb_entries;
|
dev_context->fixed_tlb_entries;
|
||||||
}
|
}
|
||||||
if (DSP_SUCCEEDED(status)) {
|
hw_mmu_tlb_add(resources->dw_dmmu_base,
|
||||||
hw_status_obj =
|
virt_to_phys(dummy_va_addr), fault_addr,
|
||||||
hw_mmu_tlb_add(resources->dw_dmmu_base,
|
HW_PAGE_SIZE4KB, 1,
|
||||||
virt_to_phys(dummy_va_addr), fault_addr,
|
&map_attrs, HW_SET, HW_SET);
|
||||||
HW_PAGE_SIZE4KB, 1,
|
|
||||||
&map_attrs, HW_SET, HW_SET);
|
|
||||||
}
|
|
||||||
|
|
||||||
dsp_clk_enable(DSP_CLK_GPT8);
|
dsp_clk_enable(DSP_CLK_GPT8);
|
||||||
|
|
||||||
@@ -231,7 +212,7 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
|||||||
/* Clear MMU interrupt */
|
/* Clear MMU interrupt */
|
||||||
hw_mmu_event_ack(resources->dw_dmmu_base,
|
hw_mmu_event_ack(resources->dw_dmmu_base,
|
||||||
HW_MMU_TRANSLATION_FAULT);
|
HW_MMU_TRANSLATION_FAULT);
|
||||||
dump_dsp_stack(deh_mgr->hbridge_context);
|
dump_dsp_stack(dev_context);
|
||||||
dsp_clk_disable(DSP_CLK_GPT8);
|
dsp_clk_disable(DSP_CLK_GPT8);
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_BRIDGE_NTFY_PWRERR
|
#ifdef CONFIG_BRIDGE_NTFY_PWRERR
|
||||||
@@ -281,9 +262,6 @@ void bridge_deh_notify(struct deh_mgr *deh_mgr, u32 ulEventMask, u32 dwErrInfo)
|
|||||||
int bridge_deh_get_info(struct deh_mgr *deh_mgr,
|
int bridge_deh_get_info(struct deh_mgr *deh_mgr,
|
||||||
struct dsp_errorinfo *pErrInfo)
|
struct dsp_errorinfo *pErrInfo)
|
||||||
{
|
{
|
||||||
DBC_REQUIRE(deh_mgr);
|
|
||||||
DBC_REQUIRE(pErrInfo);
|
|
||||||
|
|
||||||
if (!deh_mgr)
|
if (!deh_mgr)
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user