2020-02-27 03:11:44 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ZEPHYR_DRIVERS_IPM_IPM_CAVS_IDC_H_
|
|
|
|
#define ZEPHYR_DRIVERS_IPM_IPM_CAVS_IDC_H_
|
|
|
|
|
2022-07-12 23:15:06 +02:00
|
|
|
#define DT_DRV_COMPAT intel_adsp_idc
|
|
|
|
#include <intel_adsp_ipc_devtree.h>
|
|
|
|
|
soc: intel_adsp: Clean up shim driver
Each platform was defining its own shim.h header, with slightly
variant field definitions, for a register block that is almost
completely compatible between versions. This is made worse by the
fact that these represent an API imported fairly early from SOF, the
upstream version of which has since diverged.
Move the existing shim struct into a header ("cavs-shim.h") of its
own, remove a bunch of unused symbols, fill in definitions for some
registers that were left out, correct naming to match the hardware
docs in a few places, make sure all hardware dependencies are source
from devicetree only, and modify existing usage to use the new API
exclusively.
Interestingly this leaves the older shim.h header in place, as it
turns out to contain definitions for a bunch of things that were never
part of the shim register block. Those will be unified in separate
patches.
Finally: note that the existing IPM_CAVS_IDC driver (soon to be
removed from all the intel_adsp soc's) is still using the old API, so
redeclare the minimal subset that it needs for the benefit of the
platforms in transition.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-06 00:27:46 +02:00
|
|
|
/* Redeclaration of the earlier IDC register API for platforms being
|
|
|
|
* held back on this driver.
|
|
|
|
*/
|
|
|
|
# ifndef IPC_DSP_BASE
|
2022-07-12 23:15:06 +02:00
|
|
|
# define IPC_DSP_BASE(core) (INTEL_ADSP_IDC_REG_ADDRESS + 0x80 * (core))
|
soc: intel_adsp: Clean up shim driver
Each platform was defining its own shim.h header, with slightly
variant field definitions, for a register block that is almost
completely compatible between versions. This is made worse by the
fact that these represent an API imported fairly early from SOF, the
upstream version of which has since diverged.
Move the existing shim struct into a header ("cavs-shim.h") of its
own, remove a bunch of unused symbols, fill in definitions for some
registers that were left out, correct naming to match the hardware
docs in a few places, make sure all hardware dependencies are source
from devicetree only, and modify existing usage to use the new API
exclusively.
Interestingly this leaves the older shim.h header in place, as it
turns out to contain definitions for a bunch of things that were never
part of the shim register block. Those will be unified in separate
patches.
Finally: note that the existing IPM_CAVS_IDC driver (soon to be
removed from all the intel_adsp soc's) is still using the old API, so
redeclare the minimal subset that it needs for the benefit of the
platforms in transition.
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-09-06 00:27:46 +02:00
|
|
|
# endif
|
|
|
|
#define IPC_IDCTFC(x) (x * 0x10)
|
|
|
|
#define IPC_IDCTFC_BUSY BIT(31)
|
|
|
|
#define IPC_IDCTFC_MSG_MASK 0x7FFFFFFF
|
|
|
|
#define IPC_IDCTEFC(x) (0x4 + x * 0x10)
|
|
|
|
#define IPC_IDCTEFC_MSG_MASK 0x3FFFFFFF
|
|
|
|
#define IPC_IDCITC(x) (0x8 + x * 0x10)
|
|
|
|
#define IPC_IDCITC_MSG_MASK 0x7FFFFFFF
|
|
|
|
#define IPC_IDCITC_BUSY BIT(31)
|
|
|
|
#define IPC_IDCIETC(x) (0xc + x * 0x10)
|
|
|
|
#define IPC_IDCIETC_MSG_MASK 0x3FFFFFFF
|
|
|
|
#define IPC_IDCIETC_DONE BIT(30)
|
|
|
|
#define IPC_IDCCTL 0x50
|
|
|
|
#define IPC_IDCCTL_IDCTBIE(x) BIT(x)
|
|
|
|
|
2020-02-27 03:11:44 +01:00
|
|
|
#define IPM_CAVS_IDC_ID_MASK \
|
|
|
|
(CAVS_IDC_TYPE(CAVS_IDC_TYPE_MASK) | \
|
|
|
|
CAVS_IDC_HEADER(CAVS_IDC_HEADER_MASK))
|
|
|
|
|
|
|
|
/* IDC message type. */
|
|
|
|
#define CAVS_IDC_TYPE_SHIFT 24U
|
|
|
|
#define CAVS_IDC_TYPE_MASK 0x7FU
|
|
|
|
#define CAVS_IDC_TYPE(x) \
|
|
|
|
(((x) & CAVS_IDC_TYPE_MASK) << CAVS_IDC_TYPE_SHIFT)
|
|
|
|
|
|
|
|
/* IDC message header. */
|
|
|
|
#define CAVS_IDC_HEADER_MASK 0xFFFFFFU
|
|
|
|
#define CAVS_IDC_HEADER(x) ((x) & CAVS_IDC_HEADER_MASK)
|
|
|
|
|
|
|
|
/* IDC message extension. */
|
|
|
|
#define CAVS_IDC_EXTENSION_MASK 0x3FFFFFFFU
|
|
|
|
#define CAVS_IDC_EXTENSION(x) ((x) & CAVS_IDC_EXTENSION_MASK)
|
|
|
|
|
|
|
|
/* Scheduler IPI message (type 0x7F, header 'IPI' in ascii) */
|
|
|
|
#define IPM_CAVS_IDC_MSG_SCHED_IPI_DATA 0
|
|
|
|
#define IPM_CAVS_IDC_MSG_SCHED_IPI_ID \
|
|
|
|
(CAVS_IDC_TYPE(0x7FU) | CAVS_IDC_HEADER(0x495049U))
|
|
|
|
|
2020-10-14 20:42:48 +02:00
|
|
|
static inline uint32_t idc_read(uint32_t reg, uint32_t core_id)
|
|
|
|
{
|
|
|
|
return *((volatile uint32_t*)(IPC_DSP_BASE(core_id) + reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void idc_write(uint32_t reg, uint32_t core_id, uint32_t val)
|
|
|
|
{
|
|
|
|
*((volatile uint32_t*)(IPC_DSP_BASE(core_id) + reg)) = val;
|
|
|
|
}
|
|
|
|
|
2021-11-19 23:06:25 +01:00
|
|
|
int cavs_idc_smp_init(const struct device *dev);
|
|
|
|
|
2020-02-27 03:11:44 +01:00
|
|
|
#endif /* ZEPHYR_DRIVERS_IPM_IPM_CAVS_IDC_H_ */
|