ARC: IRQ: drop excessive PM_DEVICE hooks
All ARC CPUs (supported by Zephyr) don't lose core interrupt controller configuration after switching to sleep mode / modes, so we don't need to save & restore it's configuration with PM. This PM code most likely was added for Arduino 101 (Genuino 101) board which isn't supported by Zephyr anymore - so we can drop it. Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
This commit is contained in:
parent
e1455fafdf
commit
6807e02655
1 changed files with 0 additions and 139 deletions
|
@ -21,30 +21,6 @@
|
|||
#include <device.h>
|
||||
#include <init.h>
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
#include <pm/device.h>
|
||||
#include <kernel_structs.h>
|
||||
|
||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||
#undef _ARC_V2_IRQ_VECT_BASE
|
||||
#define _ARC_V2_IRQ_VECT_BASE _ARC_V2_IRQ_VECT_BASE_S
|
||||
#endif
|
||||
|
||||
struct arc_v2_irq_unit_ctx {
|
||||
uint32_t irq_ctrl; /* Interrupt Context Saving Control Register. */
|
||||
uint32_t irq_vect_base; /* Interrupt Vector Base. */
|
||||
|
||||
/*
|
||||
* IRQ configuration:
|
||||
* - IRQ Priority:BIT(6):BIT(2)
|
||||
* - IRQ Trigger:BIT(1)
|
||||
* - IRQ Enable:BIT(0)
|
||||
*/
|
||||
uint8_t irq_config[CONFIG_NUM_IRQS - 16];
|
||||
};
|
||||
static struct arc_v2_irq_unit_ctx ctx;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @brief Initialize the interrupt unit device driver
|
||||
*
|
||||
|
@ -84,119 +60,4 @@ static int arc_v2_irq_unit_init(const struct device *unused)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
|
||||
/*
|
||||
* @brief Suspend the interrupt unit device driver
|
||||
*
|
||||
* Suspends the interrupt unit device driver and the device
|
||||
* itself.
|
||||
*
|
||||
* @return 0 for success
|
||||
*/
|
||||
static int arc_v2_irq_unit_suspend(const struct device *dev)
|
||||
{
|
||||
uint8_t irq;
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
/* Interrupts from 0 to 15 are exceptions and they are ignored
|
||||
* by IRQ auxiliary registers. For that reason we skip those
|
||||
* values in this loop.
|
||||
*/
|
||||
for (irq = 16U; irq < CONFIG_NUM_IRQS; irq++) {
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq);
|
||||
ctx.irq_config[irq - 16] =
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_IRQ_PRIORITY) << 2;
|
||||
ctx.irq_config[irq - 16] |=
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_IRQ_TRIGGER) << 1;
|
||||
ctx.irq_config[irq - 16] |=
|
||||
z_arc_v2_aux_reg_read(_ARC_V2_IRQ_ENABLE);
|
||||
}
|
||||
|
||||
ctx.irq_ctrl = z_arc_v2_aux_reg_read(_ARC_V2_AUX_IRQ_CTRL);
|
||||
ctx.irq_vect_base = z_arc_v2_aux_reg_read(_ARC_V2_IRQ_VECT_BASE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Resume the interrupt unit device driver
|
||||
*
|
||||
* Resume the interrupt unit device driver and the device
|
||||
* itself.
|
||||
*
|
||||
* @return 0 for success
|
||||
*/
|
||||
static int arc_v2_irq_unit_resume(const struct device *dev)
|
||||
{
|
||||
uint8_t irq;
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
/* Interrupts from 0 to 15 are exceptions and they are ignored
|
||||
* by IRQ auxiliary registers. For that reason we skip those
|
||||
* values in this loop.
|
||||
*/
|
||||
for (irq = 16U; irq < CONFIG_NUM_IRQS; irq++) {
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_SELECT, irq);
|
||||
#ifdef CONFIG_ARC_SECURE_FIRMWARE
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_PRIORITY,
|
||||
ctx.irq_config[irq - 16] >> 2 |
|
||||
_ARC_V2_IRQ_PRIORITY_SECURE);
|
||||
#else
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_PRIORITY,
|
||||
ctx.irq_config[irq - 16] >> 2);
|
||||
#endif
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_TRIGGER,
|
||||
(ctx.irq_config[irq - 16] >> 1) & BIT(0));
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_ENABLE,
|
||||
ctx.irq_config[irq - 16] & BIT(0));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ARC_NORMAL_FIRMWARE
|
||||
/* \todo use sjli instruction to access irq_ctrl */
|
||||
#else
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_CTRL, ctx.irq_ctrl);
|
||||
#endif
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_VECT_BASE, ctx.irq_vect_base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Implement the driver control of interrupt unit
|
||||
*
|
||||
* The operation on interrupt unit requires interrupt lock.
|
||||
* The *context may include IN data or/and OUT data
|
||||
*
|
||||
* @return operation result
|
||||
*/
|
||||
static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
|
||||
enum pm_device_action action)
|
||||
{
|
||||
int ret = 0;
|
||||
unsigned int key = arch_irq_lock();
|
||||
|
||||
switch (action) {
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
ret = arc_v2_irq_unit_suspend(dev);
|
||||
break;
|
||||
case PM_DEVICE_ACTION_RESUME:
|
||||
ret = arc_v2_irq_unit_resume(dev);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOTSUP;
|
||||
break;
|
||||
}
|
||||
|
||||
arch_irq_unlock(key);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
SYS_DEVICE_DEFINE("arc_v2_irq_unit", arc_v2_irq_unit_init,
|
||||
arc_v2_irq_unit_device_ctrl, PRE_KERNEL_1, 0);
|
||||
#else
|
||||
SYS_INIT(arc_v2_irq_unit_init, PRE_KERNEL_1, 0);
|
||||
#endif /* CONFIG_PM_DEVICE */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue