diff options
author | Andre Przywara <andre.przywara@arm.com> | 2016-04-14 01:12:17 +0100 |
---|---|---|
committer | Andre Przywara <andre.przywara@arm.com> | 2016-06-02 01:29:48 +0100 |
commit | f0c28c16c21c7fad9029a06da555f068a992a84d (patch) | |
tree | 704c6e0ca6c025433af0cdb044b28224fd1a7ec5 /plat | |
parent | a130eacb706832b009cab3de9c899664b8a7d734 (diff) |
sun50i: arisc: remove code
We no longer need and want the arisc, so remove all code that was
associated with it.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Diffstat (limited to 'plat')
31 files changed, 0 insertions, 4165 deletions
diff --git a/plat/sun50iw1p1/include/arisc.h b/plat/sun50iw1p1/include/arisc.h deleted file mode 100644 index 00384f5..0000000 --- a/plat/sun50iw1p1/include/arisc.h +++ /dev/null @@ -1,789 +0,0 @@ -/* - * include/linux/arisc/arisc.h - * - * Copyright 2012 (c) Allwinner. - * superm (superm@allwinnertech.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - */ - -#ifndef __ASM_ARCH_ARISC_H -#define __ASM_ARCH_ARISC_H - -/* the base of messages */ -#define ARISC_MESSAGE_BASE (0x10) - -/* standby commands */ -#define ARISC_SSTANDBY_ENTER_REQ (ARISC_MESSAGE_BASE + 0x00) /* request to enter (ac327 to arisc) */ -#define ARISC_SSTANDBY_RESTORE_NOTIFY (ARISC_MESSAGE_BASE + 0x01) /* restore finished (ac327 to arisc) */ -#define ARISC_NSTANDBY_ENTER_REQ (ARISC_MESSAGE_BASE + 0x02) /* request to enter (ac327 to arisc) */ -#define ARISC_NSTANDBY_WAKEUP_NOTIFY (ARISC_MESSAGE_BASE + 0x03) /* wakeup notify (arisc to ac327) */ -#define ARISC_NSTANDBY_RESTORE_REQ (ARISC_MESSAGE_BASE + 0x04) /* request to restore (ac327 to arisc) */ -#define ARISC_NSTANDBY_RESTORE_COMPLETE (ARISC_MESSAGE_BASE + 0x05) /* arisc restore complete (arisc to ac327) */ -#define ARISC_ESSTANDBY_ENTER_REQ (ARISC_MESSAGE_BASE + 0x06) /* request to enter (ac327 to arisc) */ -#define ARISC_TSTANDBY_ENTER_REQ (ARISC_MESSAGE_BASE + 0x07) /* request to enter (ac327 to arisc) */ -#define ARISC_TSTANDBY_RESTORE_NOTIFY (ARISC_MESSAGE_BASE + 0x08) /* restore finished (ac327 to arisc) */ -#define ARISC_FAKE_POWER_OFF_REQ (ARISC_MESSAGE_BASE + 0x09) /* request to enter (ac327 to arisc) */ -#define ARISC_CPUIDLE_ENTER_REQ (ARISC_MESSAGE_BASE + 0x0a) /* request to enter (ac327 to arisc) */ -#define ARISC_STANDBY_INFO_REQ (ARISC_MESSAGE_BASE + 0x10) /* request sst info (ac327 to arisc) */ -#define ARISC_CPUIDLE_CFG_REQ (ARISC_MESSAGE_BASE + 0x11) /* request to config (ac327 to arisc) */ -#define ARISC_CPU_OP_REQ (ARISC_MESSAGE_BASE + 0x12) /* cpu operations (ac327 to arisc) */ -#define ARISC_QUERY_WAKEUP_SRC_REQ (ARISC_MESSAGE_BASE + 0x13) /* query wakeup source (ac327 to arisc) */ -#define ARISC_SYS_OP_REQ (ARISC_MESSAGE_BASE + 0x14) /* system operations (ac327 to arisc) */ - -/* dvfs commands */ -#define ARISC_CPUX_DVFS_REQ (ARISC_MESSAGE_BASE + 0x20) /* request dvfs (ac327 to arisc) */ -#define ARISC_CPUX_DVFS_CFG_VF_REQ (ARISC_MESSAGE_BASE + 0x21) /* request config dvfs v-f table(ac327 to arisc) */ - -/* pmu commands */ -#define ARISC_AXP_INT_COMING_NOTIFY (ARISC_MESSAGE_BASE + 0x40) /* interrupt coming notify(arisc to ac327) */ -#define ARISC_AXP_DISABLE_IRQ (ARISC_MESSAGE_BASE + 0x41) /* disable axp irq of arisc */ -#define ARISC_AXP_ENABLE_IRQ (ARISC_MESSAGE_BASE + 0x42) /* enable axp irq of arisc */ -#define ARISC_AXP_GET_CHIP_ID (ARISC_MESSAGE_BASE + 0x43) /* axp get chip id */ -#define ARISC_AXP_SET_PARAS (ARISC_MESSAGE_BASE + 0x44) /* config axp parameters (ac327 to arisc) */ -#define ARISC_SET_PMU_VOLT (ARISC_MESSAGE_BASE + 0x45) /* set pmu volt (ac327 to arisc) */ -#define ARISC_GET_PMU_VOLT (ARISC_MESSAGE_BASE + 0x46) /* get pmu volt (ac327 to arisc) */ -#define ARISC_SET_LED_BLN (ARISC_MESSAGE_BASE + 0x47) /* set led bln (ac327 to arisc) */ -#define ARISC_AXP_REBOOT (ARISC_MESSAGE_BASE + 0x48) /* reboot system for no pmu protocols */ -#define ARISC_SET_PWR_TREE (ARISC_MESSAGE_BASE + 0x49) /* set power tree (ac327 to arisc) */ -#define ARISC_CLR_NMI_STATUS (ARISC_MESSAGE_BASE + 0x4a) /* clear nmi status (ac327 to arisc) */ -#define ARISC_SET_NMI_TRIGGER (ARISC_MESSAGE_BASE + 0x4b) /* set nmi tigger (ac327 to arisc) */ - -/* set arisc debug commands */ -#define ARISC_SET_DEBUG_LEVEL (ARISC_MESSAGE_BASE + 0x50) /* set arisc debug level (ac327 to arisc) */ -#define ARISC_MESSAGE_LOOPBACK (ARISC_MESSAGE_BASE + 0x51) /* loopback message (ac327 to arisc) */ -#define ARISC_SET_UART_BAUDRATE (ARISC_MESSAGE_BASE + 0x52) /* set uart baudrate (ac327 to arisc) */ -#define ARISC_SET_DRAM_PARAS (ARISC_MESSAGE_BASE + 0x53) /* config dram parameter (ac327 to arisc) */ -#define ARISC_SET_DEBUG_DRAM_CRC_PARAS (ARISC_MESSAGE_BASE + 0x54) /* config dram crc parameters (ac327 to arisc) */ -#define ARISC_SET_IR_PARAS (ARISC_MESSAGE_BASE + 0x55) /* config ir parameter (ac327 to arisc) */ -#define ARISC_REPORT_ERR_INFO (ARISC_MESSAGE_BASE + 0x56) /* report arisc error info (arisc to ac327) */ -#define ARISC_SET_PARAS (ARISC_MESSAGE_BASE + 0x57) /* set paras (arisc to ac327) */ - -/* audio commands */ -#define ARISC_AUDIO_START (ARISC_MESSAGE_BASE + 0x60) /* audio start play/capture(ac327 to arisc) */ -#define ARISC_AUDIO_STOP (ARISC_MESSAGE_BASE + 0x61) /* audio stop play/capture(ac327 to arisc) */ -#define ARISC_AUDIO_SET_BUF_PER_PARAS (ARISC_MESSAGE_BASE + 0x62) /* set audio buffer and peroid paras(ac327 to arisc) */ -#define ARISC_AUDIO_GET_POSITION (ARISC_MESSAGE_BASE + 0x63) /* get audio buffer position(ac327 to arisc) */ -#define ARISC_AUDIO_SET_TDM_PARAS (ARISC_MESSAGE_BASE + 0x64) /* set audio tdm parameters(ac327 to arisc) */ -#define ARISC_AUDIO_PERDONE_NOTIFY (ARISC_MESSAGE_BASE + 0x65) /* audio period done notify(arisc to ac327) */ -#define ARISC_AUDIO_ADD_PERIOD (ARISC_MESSAGE_BASE + 0x66) /* audio period done notify(arisc to ac327) */ - -/* rsb commands */ -#define ARISC_RSB_READ_BLOCK_DATA (ARISC_MESSAGE_BASE + 0x70) /* rsb read block data (ac327 to arisc) */ -#define ARISC_RSB_WRITE_BLOCK_DATA (ARISC_MESSAGE_BASE + 0x71) /* rsb write block data (ac327 to arisc) */ -#define ARISC_RSB_BITS_OPS_SYNC (ARISC_MESSAGE_BASE + 0x72) /* rsb clear bits sync (ac327 to arisc) */ -#define ARISC_RSB_SET_INTERFACE_MODE (ARISC_MESSAGE_BASE + 0x73) /* rsb set interface mode (ac327 to arisc) */ -#define ARISC_RSB_SET_RTSADDR (ARISC_MESSAGE_BASE + 0x74) /* rsb set runtime slave addr (ac327 to arisc) */ - -/* arisc initialize state notify commands */ -#define ARISC_STARTUP_NOTIFY (ARISC_MESSAGE_BASE + 0x80) /* arisc init state notify(arisc to ac327) */ - - -/* the base of ARM SVC ARISC */ -#define ARM_SVC_ARISC_BASE (0xc0000000) - -/* standby commands */ -#define ARM_SVC_ARISC_SSTANDBY_ENTER_REQ (ARM_SVC_ARISC_BASE + ARISC_SSTANDBY_ENTER_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_SSTANDBY_RESTORE_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_SSTANDBY_RESTORE_NOTIFY) /* restore finished (ac327 to arisc) */ -#define ARM_SVC_ARISC_NSTANDBY_ENTER_REQ (ARM_SVC_ARISC_BASE + ARISC_NSTANDBY_ENTER_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_NSTANDBY_WAKEUP_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_NSTANDBY_WAKEUP_NOTIFY) /* wakeup notify (arisc to ac327) */ -#define ARM_SVC_ARISC_NSTANDBY_RESTORE_REQ (ARM_SVC_ARISC_BASE + ARISC_NSTANDBY_RESTORE_REQ) /* request to restore (ac327 to arisc) */ -#define ARM_SVC_ARISC_NSTANDBY_RESTORE_COMPLETE (ARM_SVC_ARISC_BASE + ARISC_NSTANDBY_RESTORE_COMPLETE) /* arisc restore complete (arisc to ac327) */ -#define ARM_SVC_ARISC_ESSTANDBY_ENTER_REQ (ARM_SVC_ARISC_BASE + ARISC_ESSTANDBY_ENTER_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_TSTANDBY_ENTER_REQ (ARM_SVC_ARISC_BASE + ARISC_TSTANDBY_ENTER_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_TSTANDBY_RESTORE_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_TSTANDBY_RESTORE_NOTIFY) /* restore finished (ac327 to arisc) */ -#define ARM_SVC_ARISC_FAKE_POWER_OFF_REQ (ARM_SVC_ARISC_BASE + ARISC_FAKE_POWER_OFF_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_CPUIDLE_ENTER_REQ (ARM_SVC_ARISC_BASE + ARISC_CPUIDLE_ENTER_REQ) /* request to enter (ac327 to arisc) */ -#define ARM_SVC_ARISC_STANDBY_INFO_REQ (ARM_SVC_ARISC_BASE + ARISC_STANDBY_INFO_REQ) /* request sst info (ac327 to arisc) */ -#define ARM_SVC_ARISC_CPUIDLE_CFG_REQ (ARM_SVC_ARISC_BASE + ARISC_CPUIDLE_CFG_REQ) /* request to config (ac327 to arisc) */ -#define ARM_SVC_ARISC_CPU_OP_REQ (ARM_SVC_ARISC_BASE + ARISC_CPU_OP_REQ) /* cpu operations (ac327 to arisc) */ -#define ARM_SVC_ARISC_QUERY_WAKEUP_SRC_REQ (ARM_SVC_ARISC_BASE + ARISC_QUERY_WAKEUP_SRC_REQ) /* query wakeup source (ac327 to arisc) */ -#define ARM_SVC_ARISC_SYS_OP_REQ (ARM_SVC_ARISC_BASE + ARISC_SYS_OP_REQ) /* system operations (ac327 to arisc) */ - -/* dvfs commands */ -#define ARM_SVC_ARISC_CPUX_DVFS_REQ (ARM_SVC_ARISC_BASE + ARISC_CPUX_DVFS_REQ) /* request dvfs (ac327 to arisc) */ -#define ARM_SVC_ARISC_CPUX_DVFS_CFG_VF_REQ (ARM_SVC_ARISC_BASE + ARISC_CPUX_DVFS_CFG_VF_REQ) /* request config dvfs v-f table(ac327 to arisc) */ - -/* pmu commands */ -#define ARM_SVC_ARISC_AXP_INT_COMING_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_AXP_INT_COMING_NOTIFY) /* interrupt coming notify(arisc to ac327) */ -#define ARM_SVC_ARISC_AXP_DISABLE_IRQ (ARM_SVC_ARISC_BASE + ARISC_AXP_DISABLE_IRQ) /* disable axp irq of arisc */ -#define ARM_SVC_ARISC_AXP_ENABLE_IRQ (ARM_SVC_ARISC_BASE + ARISC_AXP_ENABLE_IRQ) /* enable axp irq of arisc */ -#define ARM_SVC_ARISC_AXP_GET_CHIP_ID (ARM_SVC_ARISC_BASE + ARISC_AXP_GET_CHIP_ID) /* axp get chip id */ -#define ARM_SVC_ARISC_AXP_SET_PARAS (ARM_SVC_ARISC_BASE + ARISC_AXP_SET_PARAS) /* config axp parameters (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_PMU_VOLT (ARM_SVC_ARISC_BASE + ARISC_SET_PMU_VOLT) /* set pmu volt (ac327 to arisc) */ -#define ARM_SVC_ARISC_GET_PMU_VOLT (ARM_SVC_ARISC_BASE + ARISC_GET_PMU_VOLT) /* get pmu volt (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_LED_BLN (ARM_SVC_ARISC_BASE + ARISC_SET_LED_BLN) /* set led bln (ac327 to arisc) */ -#define ARM_SVC_ARISC_AXP_REBOOT (ARM_SVC_ARISC_BASE + ARISC_AXP_REBOOT) /* reboot system for no pmu protocols */ -#define ARM_SVC_ARISC_SET_PWR_TREE (ARM_SVC_ARISC_BASE + ARISC_SET_PWR_TREE) /* set power tree (ac327 to arisc) */ -#define ARM_SVC_ARISC_CLR_NMI_STATUS (ARM_SVC_ARISC_BASE + ARISC_CLR_NMI_STATUS) /* clear nmi status (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_NMI_TRIGGER (ARM_SVC_ARISC_BASE + ARISC_SET_NMI_TRIGGER) /* set nmi tigger (ac327 to arisc) */ - -/* set arisc debug commands */ -#define ARM_SVC_ARISC_SET_DEBUG_LEVEL (ARM_SVC_ARISC_BASE + ARISC_SET_DEBUG_LEVEL) /* set arisc debug level (ac327 to arisc) */ -#define ARM_SVC_ARISC_MESSAGE_LOOPBACK (ARM_SVC_ARISC_BASE + ARISC_MESSAGE_LOOPBACK) /* loopback message (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_UART_BAUDRATE (ARM_SVC_ARISC_BASE + ARISC_SET_UART_BAUDRATE) /* set uart baudrate (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_DRAM_PARAS (ARM_SVC_ARISC_BASE + ARISC_SET_DRAM_PARAS) /* config dram parameter (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_DEBUG_DRAM_CRC_PARAS (ARM_SVC_ARISC_BASE + ARISC_SET_DEBUG_DRAM_CRC_PARAS) /* config dram crc parameters (ac327 to arisc) */ -#define ARM_SVC_ARISC_SET_IR_PARAS (ARM_SVC_ARISC_BASE + ARISC_SET_IR_PARAS) /* config ir parameter (ac327 to arisc) */ -#define ARM_SVC_ARISC_REPORT_ERR_INFO (ARM_SVC_ARISC_BASE + ARISC_REPORT_ERR_INFO) /* report arisc error info (arisc to ac327) */ -#define ARM_SVC_ARISC_SET_PARAS (ARM_SVC_ARISC_BASE + ARISC_SET_PARAS) /* set paras (arisc to ac327) */ - -/* audio commands */ -#define ARM_SVC_ARISC_AUDIO_START (ARM_SVC_ARISC_BASE + ARISC_AUDIO_START) /* audio start play/capture(ac327 to arisc) */ -#define ARM_SVC_ARISC_AUDIO_STOP (ARM_SVC_ARISC_BASE + ARISC_AUDIO_STOP) /* audio stop play/capture(ac327 to arisc) */ -#define ARM_SVC_ARISC_AUDIO_SET_BUF_PER_PARAS (ARM_SVC_ARISC_BASE + ARISC_AUDIO_SET_BUF_PER_PARAS) /* set audio buffer and peroid paras(ac327 to arisc) */ -#define ARM_SVC_ARISC_AUDIO_GET_POSITION (ARM_SVC_ARISC_BASE + ARISC_AUDIO_GET_POSITION) /* get audio buffer position(ac327 to arisc) */ -#define ARM_SVC_ARISC_AUDIO_SET_TDM_PARAS (ARM_SVC_ARISC_BASE + ARISC_AUDIO_SET_TDM_PARAS) /* set audio tdm parameters(ac327 to arisc) */ -#define ARM_SVC_ARISC_AUDIO_PERDONE_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_AUDIO_PERDONE_NOTIFY) /* audio period done notify(arisc to ac327) */ -#define ARM_SVC_ARISC_AUDIO_ADD_PERIOD (ARM_SVC_ARISC_BASE + ARISC_AUDIO_ADD_PERIOD) /* audio period done notify(arisc to ac327) */ - -/* rsb commands */ -#define ARM_SVC_ARISC_RSB_READ_BLOCK_DATA (ARM_SVC_ARISC_BASE + ARISC_RSB_READ_BLOCK_DATA) /* rsb read block data (ac327 to arisc) */ -#define ARM_SVC_ARISC_RSB_WRITE_BLOCK_DATA (ARM_SVC_ARISC_BASE + ARISC_RSB_WRITE_BLOCK_DATA) /* rsb write block data (ac327 to arisc) */ -#define ARM_SVC_ARISC_RSB_BITS_OPS_SYNC (ARM_SVC_ARISC_BASE + ARISC_RSB_BITS_OPS_SYNC) /* rsb clear bits sync (ac327 to arisc) */ -#define ARM_SVC_ARISC_RSB_SET_INTERFACE_MODE (ARM_SVC_ARISC_BASE + ARISC_RSB_SET_INTERFACE_MODE) /* rsb set interface mode (ac327 to arisc) */ -#define ARM_SVC_ARISC_RSB_SET_RTSADDR (ARM_SVC_ARISC_BASE + ARISC_RSB_SET_RTSADDR) /* rsb set runtime slave addr (ac327 to arisc) */ - -/* arisc initialize state notify commands */ -#define ARM_SVC_ARISC_STARTUP_NOTIFY (ARM_SVC_ARISC_BASE + ARISC_STARTUP_NOTIFY) /* arisc init state notify(arisc to ac327) */ - -#define AW_MSG_HWSPINLOCK (0) -#define AW_AUDIO_HWSPINLOCK (1) -#define AW_RTC_REG_HWSPINLOCK (2) - -#define NMI_INT_TYPE_PMU (0) -#define NMI_INT_TYPE_RTC (1) -#define NMI_INT_TYPE_PMU_OFFSET (0x1 << NMI_INT_TYPE_PMU) -#define NMI_INT_TYPE_RTC_OFFSET (0x1 << NMI_INT_TYPE_RTC) - -/* the modes of arisc dvfs */ -#define ARISC_DVFS_SYN (1<<0) - -/* message attributes(only use 8bit) */ -#define ARISC_MESSAGE_ATTR_ASYN (0<<0) /* need asyn with another cpu */ -#define ARISC_MESSAGE_ATTR_SOFTSYN (1<<0) /* need soft syn with another cpu */ -#define ARISC_MESSAGE_ATTR_HARDSYN (1<<1) /* need hard syn with another cpu */ - -/* axp driver interfaces */ -#define AXP_TRANS_BYTE_MAX (4) -#define RSB_TRANS_BYTE_MAX (4) -#define P2WI_TRANS_BYTE_MAX (8) - -/* RSB devices' address */ -#define RSB_DEVICE_SADDR1 (0x3A3) /* (0x01d1)AXP22x(AW1669) */ -#define RSB_DEVICE_SADDR3 (0x745) /* (0x03a2)AXP15x(AW1657) */ -#define RSB_DEVICE_SADDR7 (0xE89) /* (0x0744)Audio codec, AC100 */ - -/* RSB run time address */ -#define RSB_RTSADDR_AXP809 (0x2d) -#define RSB_RTSADDR_AXP806 (0x3a) -#define RSB_RTSADDR_AC100 (0x4e) - -/* audio sram base address */ -#define AUDIO_SRAM_BASE_PALY (0x08117000) -#define AUDIO_SRAM_BASE_CAPTURE (0x0811f000) - -#define AUDIO_SRAM_BUF_SIZE_02K (2048) /* buffer size 2k = 0x800 = 2048 */ -#define AUDIO_SRAM_BUF_SIZE_04K (4096) /* buffer size 4k = 0x1000 = 4096 */ -#define AUDIO_SRAM_BUF_SIZE_08K (8192) /* buffer size 8k = 0x2000 = 8192 */ -#define AUDIO_SRAM_BUF_SIZE_16K (16384) /* buffer size 16k = 0x4000 = 16384 */ -#define AUDIO_SRAM_BUF_SIZE_32K (32768) /* buffer size 32k = 0x8000 = 32768 */ - -#define AUDIO_SRAM_PER_SIZE_02K (2048) /* period size 2k = 0x800 = 2048 */ -#define AUDIO_SRAM_PER_SIZE_04K (4096) /* period size 4k = 0x1000 = 4096 */ -#define AUDIO_SRAM_PER_SIZE_08K (8192) /* period size 8k = 0x2000 = 8192 */ -#define AUDIO_SRAM_PER_SIZE_16K (16384) /* period size 16k = 0x4000 = 16384 */ -#define AUDIO_SRAM_PER_SIZE_32K (32768) /* period size 32k = 0x8000 = 32768 */ - -typedef enum { - arisc_power_on = 0, - arisc_power_retention = 1, - arisc_power_off = 3, -} arisc_power_state_t; - -typedef enum { - arisc_system_shutdown = 0, - arisc_system_reboot = 1, - arisc_system_reset = 2 -} arisc_system_state_t; - -//pmu voltage types -typedef enum power_voltage_type -{ - AXP809_POWER_VOL_DCDC1 = 0x0, - AXP809_POWER_VOL_DCDC2, - AXP809_POWER_VOL_DCDC3, - AXP809_POWER_VOL_DCDC4, - AXP809_POWER_VOL_DCDC5, - AXP809_POWER_VOL_DC5LDO, - AXP809_POWER_VOL_ALDO1, - AXP809_POWER_VOL_ALDO2, - AXP809_POWER_VOL_ALDO3, - AXP809_POWER_VOL_DLDO1, - AXP809_POWER_VOL_DLDO2, - AXP809_POWER_VOL_ELDO1, - AXP809_POWER_VOL_ELDO2, - AXP809_POWER_VOL_ELDO3, - - AXP806_POWER_VOL_DCDCA, - AXP806_POWER_VOL_DCDCB, - AXP806_POWER_VOL_DCDCC, - AXP806_POWER_VOL_DCDCD, - AXP806_POWER_VOL_DCDCE, - AXP806_POWER_VOL_ALDO1, - AXP806_POWER_VOL_ALDO2, - AXP806_POWER_VOL_ALDO3, - AXP806_POWER_VOL_BLDO1, - AXP806_POWER_VOL_BLDO2, - AXP806_POWER_VOL_BLDO3, - AXP806_POWER_VOL_BLDO4, - AXP806_POWER_VOL_CLDO1, - AXP806_POWER_VOL_CLDO2, - AXP806_POWER_VOL_CLDO3, - - OZ80120_POWER_VOL_DCDC, - - POWER_VOL_MAX, -} power_voltage_type_e; - -/* the pll of arisc dvfs */ -typedef enum arisc_pll_no { - ARISC_DVFS_PLL1 = 1, - ARISC_DVFS_PLL2 = 2 -} arisc_pll_no_e; - -/* rsb transfer data type */ -typedef enum arisc_rsb_datatype { - RSB_DATA_TYPE_BYTE = 1, - RSB_DATA_TYPE_HWORD = 2, - RSB_DATA_TYPE_WORD = 4 -} arisc_rsb_datatype_e; - -#if defined CONFIG_ARCH_SUN8IW1P1 -typedef enum arisc_p2wi_bits_ops { - P2WI_CLR_BITS, - P2WI_SET_BITS -} arisc_p2wi_bits_ops_e; -#elif (defined CONFIG_ARCH_SUN8IW3P1) || (defined CONFIG_ARCH_SUN8IW5P1) || (defined CONFIG_ARCH_SUN8IW6P1) || \ - (defined CONFIG_ARCH_SUN8IW7P1) || (defined CONFIG_ARCH_SUN8IW9P1) || (defined CONFIG_ARCH_SUN9IW1P1) || \ - (defined CONFIG_ARCH_SUN50IW1P1) -/* rsb transfer data type */ -typedef enum arisc_rsb_bits_ops { - RSB_CLR_BITS, - RSB_SET_BITS -} arisc_rsb_bits_ops_e; -#endif - -typedef enum arisc_audio_mode { - AUDIO_PLAY, /* play mode */ - AUDIO_CAPTURE /* capture mode */ -} arisc_audio_mode_e; - -typedef struct arisc_audio_mem -{ - uint32_t mode; - uint32_t sram_base_addr; - uint32_t buffer_size; - uint32_t period_size; -}arisc_audio_mem_t; - -typedef struct arisc_audio_tdm -{ - uint32_t mode; - uint32_t samplerate; - uint32_t channum; -}arisc_audio_tdm_t; - -/* arisc call-back */ -typedef int (*arisc_cb_t)(void *arg); - -/* sunxi_perdone_cbfn - * - * period done callback routine type -*/ -/* audio callback struct */ -typedef struct audio_cb { - arisc_cb_t handler; /* dma callback fuction */ - void *arg; /* args of func */ -}audio_cb_t; - -/* - * @len : number of read registers, max len:4; - * @datatype: type of the data, 0:byte(8bits), 1:halfword(16bits), 2:word(32bits) - * @msgattr: message attribute, 0:async, 1:soft sync, 2:hard aync - * @devaddr: devices address; - * @regaddr: array of registers address; - * @data: array of registers data; - */ -typedef struct arisc_rsb_block_cfg -{ - uint32_t len; - uint32_t datatype; - uint32_t msgattr; - uint32_t devaddr; - unsigned char *regaddr; - uint32_t *data; -}arisc_rsb_block_cfg_t; - -/* - * @len : number of operate registers, max len:4; - * @datatype: type of the data, 0:byte(8bits), 1:halfword(16bits), 2:word(32bits) - * @msgattr: message attribute, 0:async, 1:soft sync, 2:hard aync - * @ops: bits operation, 0:clear bits, 1:set bits - * @devaddr : devices address; - * @regaddr : point of registers address; - * @mask : point of mask bits data; - * @delay: point of delay times; - */ -typedef struct arisc_rsb_bits_cfg -{ - uint32_t len; - uint32_t datatype; - uint32_t msgattr; - uint32_t ops; - uint32_t devaddr; - unsigned char *regaddr; - unsigned char *delay; - uint32_t *mask; -}arisc_rsb_bits_cfg_t; - -typedef enum arisc_rw_type -{ - ARISC_READ = 0x0, - ARISC_WRITE = 0x1, -} arisc_rw_type_e; - -typedef struct nmi_isr -{ - arisc_cb_t handler; - void *arg; -} nmi_isr_t; - -extern nmi_isr_t nmi_isr_node[2]; - -/* - * @flags: 0x01-clean pendings, 0x10-enter cupidle. - * @resume_addr: resume address for cpu0 out of idle. - */ -typedef struct sunxi_enter_idle_para{ - unsigned long flags; - void *resume_addr; -}sunxi_enter_idle_para_t; - -typedef struct sst_power_info_para -{ - /* - * define for sun9iw1p1 - * power_reg bit0 ~ 7 AXP_main REG10, bit 8~15 AXP_main REG12 - * power_reg bit16~23 AXP_slav REG10, bit24~31 AXP_slav REG11 - * - * AXP_main REG10: 0-off, 1-on - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * aldo2 aldo1 dcdc5 dcdc4 dcdc3 dcdc2 dcdc1 dc5ldo - * - * REG12: bit0~5:0-off, 1-on, bit6~7: 0-on, 1-off, dc1sw's power come from dcdc1 - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * dc1sw swout aldo3 dldo2 dldo1 eldo3 eldo2 eldo1 - * - * AXP_slave REG10: 0-off, 1-on. dcdc b&c is not used, ignore them. - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * aldo3 aldo2 aldo1 dcdce dcdcd dcdcc dcdcb dcdca - * - * AXP_slave REG11: 0-off, 1-on - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * swout cldo3 cldo2 cldo1 bldo4 bldo3 bldo2 bldo1 - */ - /* - * define for sun8iw5p1 - * power_reg0 ~ 7 AXP_main REG10, 8~15 AXP_main REG12 - * power_reg16~32 null - * - * AXP_main REG10: 0-off, 1-on - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * aldo2 aldo1 dcdc5 dcdc4 dcdc3 dcdc2 dcdc1 dc5ldo - * - * REG12: 0-off, 1-on - * bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0 - * dc1sw dldo4 dldo3 dldo2 dldo1 eldo3 eldo2 eldo1 - * - * REG13: bit16 aldo3, 0-off, 1-on - * REG90: bit17 gpio0/ldo, 0-off, 1-on - * REG92: bit18 gpio1/ldo, 0-off, 1-on - */ - unsigned int enable; /* enable bit */ - unsigned int power_reg; /* registers of power state should be */ - signed int system_power; /* the max power of system, signed, power mabe negative when charge */ -} sst_power_info_para_t; - -typedef struct sst_dram_info -{ - unsigned int dram_crc_enable; - unsigned int dram_crc_src; - unsigned int dram_crc_len; - unsigned int dram_crc_error; - unsigned int dram_crc_total_count; - unsigned int dram_crc_error_count; -} sst_dram_info_t; - -typedef struct standby_info_para -{ - sst_power_info_para_t power_state; /* size 3W=12B */ - sst_dram_info_t dram_state; /*size 6W=24B */ -} standby_info_para_t; - -int sunxi_arisc_probe(void *cfg); -int sunxi_arisc_wait_ready(void); - - -/* ====================================dvfs interface==================================== */ -/* - * set specific pll target frequency. - * @freq: target frequency to be set, based on KHZ; - * @pll: which pll will be set - * @mode: the attribute of message, whether syn or asyn; - * @cb: callback handler; - * @cb_arg: callback handler arguments; - * - * return: result, 0 - set frequency successed, - * !0 - set frequency failed; - */ -int arisc_dvfs_set_cpufreq(uint32_t freq, uint32_t pll, uint32_t mode); - -/* - * enter cpu idle. - * @cb: callback function. - * @cb_arg: arg for callback function. - * @pars: arg for enter cpuidle. - * - * return: result, 0 - enter cpuidle successed, !0 - failed; - */ -int arisc_enter_cpuidle(arisc_cb_t cb, void *cb_arg, struct sunxi_enter_idle_para *para); - -/** - * cpu operations. - * @mpidr: cpu id; - * @entrypoint: cpu resume entrypoint; - * @cpu_state: cpu state; - * @cluster_state: cluster state; - * - * return: result, 0 - super standby successed, - * !0 - super standby failed; - */ -int arisc_cpu_op(uint32_t mpidr, uint32_t entrypoint, arisc_power_state_t cpu_state, - arisc_power_state_t cluster_state); - - /** - * system operations. - * @state: system state; - * - * return: result, 0 - system operations successed, - * !0 - system operations failed; - */ -int arisc_system_op(arisc_system_state_t state); - -/* ====================================standby interface==================================== */ -/** - * query super-standby wakeup source. - * @para: point of buffer to store wakeup event informations. - * - * return: result, 0 - query successed, !0 - query failed; - */ -int arisc_query_wakeup_source(uint32_t *event); - -int arisc_query_set_standby_info(struct standby_info_para *para, arisc_rw_type_e op); - -/* - * query config of standby power state and consumer. - * @para: point of buffer to store power informations. - * - * return: result, 0 - query successed, !0 - query failed; - */ -int arisc_query_standby_power_cfg(struct standby_info_para *para); - -/* - * set config of standby power state and consumer. - * @para: point of buffer to store power informations. - * - * return: result, 0 - set successed, !0 - set failed; - */ -#define arisc_set_standby_power_cfg(para) \ - arisc_query_set_standby_info(para, ARISC_WRITE) - -/* - * query standby power state and consumer. - * @para: point of buffer to store power informations. - * - * return: result, 0 - query successed, !0 - query failed; - */ -#define arisc_query_standby_power(para) \ - arisc_query_set_standby_info(para, ARISC_READ) - -/** - * query super-standby dram crc result. - * @perror: pointer of dram crc result. - * @ptotal_count: pointer of dram crc total count - * @perror_count: pointer of dram crc error count - * - * return: result, 0 - query successed, - * !0 - query failed; - */ -int arisc_query_dram_crc_result(unsigned long *perror, unsigned long *ptotal_count, - unsigned long *perror_count); - -int arisc_set_dram_crc_result(unsigned long error, unsigned long total_count, - unsigned long error_count); - -/** - * notify arisc cpux restored. - * @para: none. - * - * return: result, 0 - notify successed, !0 - notify failed; - */ -int arisc_cpux_ready_notify(void); - -#if defined CONFIG_ARCH_SUN8IW1P1 -void arisc_fake_power_off(void); -#endif - -/* ====================================axp interface==================================== */ -/** - * register call-back function, call-back function is for arisc notify some event to ac327, - * axp/rtc interrupt for external interrupt NMI. - * @type: nmi type, pmu/rtc; - * @func: call-back function; - * @para: parameter for call-back function; - * - * @return: result, 0 - register call-back function successed; - * !0 - register call-back function failed; - * NOTE: the function is like "int callback(void *para)"; - * this function will execute in system ISR. - */ -int arisc_nmi_cb_register(uint32_t type, arisc_cb_t func, void *para); - -/** - * unregister call-back function. - * @type: nmi type, pmu/rtc; - * @func: call-back function which need be unregister; - */ -void arisc_nmi_cb_unregister(uint32_t type, arisc_cb_t func); - -int arisc_disable_nmi_irq(void); -int arisc_enable_nmi_irq(void); -int arisc_clear_nmi_status(void); -int arisc_set_nmi_trigger(uint32_t type); - -int arisc_axp_get_chip_id(unsigned char *chip_id); -int arisc_adjust_pmu_chgcur(uint32_t max_chgcur, uint32_t chg_ic_temp, uint32_t flag); -int arisc_set_pwr_tree(uint32_t *pwr_tree); - -int arisc_set_led_bln(uint32_t *paras); - -/* ====================================audio interface==================================== */ -/** - * start audio play or capture. - * @mode: start audio in which mode ; 0:play, 1;capture. - * - * return: result, 0 - start audio play or capture successed, - * !0 - start audio play or capture failed. - */ -int arisc_audio_start(int mode); - -/** - * stop audio play or capture. - * @mode: stop audio in which mode ; 0:play, 1;capture. - * - * return: result, 0 - stop audio play or capture successed, - * !0 - stop audio play or capture failed. - */ -int arisc_audio_stop(int mode); - -/** - * set audio buffer and period parameters. - * @audio_mem: - * mode :which mode be set; 0:paly, 1:capture; - * sram_base_addr:sram base addr of buffer; - * buffer_size :the size of buffer; - * period_size :the size of period; - * - * |period|period|period|period|...|period|period|period|period|...| - * | paly buffer | capture buffer | - * | | - * 1 2 - * 1:paly sram_base_addr, 2:capture sram_base_addr; - * buffer size = capture sram_base_addr - paly sram_base_addr. - * - * return: result, 0 - set buffer and period parameters successed, - * !0 - set buffer and period parameters failed. - * - */ -int arisc_buffer_period_paras(struct arisc_audio_mem audio_mem); - -/** - * get audio play or capture real-time address. - * @mode: in which mode; 0:play, 1;capture; - * @addr: real-time address in which mode. - * - * return: result, 0 - get real-time address successed, - * !0 - get real-time address failed. - */ -int arisc_get_position(int mode, uint32_t *addr); - -/** - * register audio callback function. - * @mode: in which mode; 0:play, 1;capture; - * @handler: audio callback handler which need be register; - * @arg : the pointer of audio callback arguments. - * - * return: result, 0 - register audio callback function successed, - * !0 - register audio callback function failed. - */ -int arisc_audio_cb_register(int mode, arisc_cb_t handler, void *arg); - -/** - * unregister audio callback function. - * @mode: in which mode; 0:play, 1;capture; - * @handler: audio callback handler which need be register; - * @arg : the pointer of audio callback arguments. - * - * return: result, 0 - unregister audio callback function successed, - * !0 - unregister audio callback function failed. - */ -int arisc_audio_cb_unregister(int mode, arisc_cb_t handler); - -/** - * set audio tdm parameters. - * @tdm_cfg: audio tdm struct - * mode :in which mode; 0:play, 1;capture; - * samplerate:tdm samplerate depend on audio data; - * channel :audio channel number, 1 or 2. - - * return: result, 0 - set buffer and period parameters successed, - * !0 - set buffer and period parameters failed. - * - */ -int arisc_tdm_paras(struct arisc_audio_tdm tdm_cfg); - -/** - * add audio period. - * @mode: start audio in which mode ; 0:play, 1;capture. - * @addr: period address which will be add in buffer - * - * return: result, 0 - add audio period successed, - * !0 - add audio period failed. - * - */ -int arisc_add_period(uint32_t mode, uint32_t addr); - -/* ====================================rsb interface==================================== */ -/** - * rsb read block data. - * @cfg: point of arisc_rsb_block_cfg struct; - * - * return: result, 0 - read register successed, - * !0 - read register failed or the len more then max len; - */ -int arisc_rsb_read_block_data(uint32_t *paras); - -/** - * rsb write block data. - * @cfg: point of arisc_rsb_block_cfg struct; - * - * return: result, 0 - write register successed, - * !0 - write register failedor the len more then max len; - */ -int arisc_rsb_write_block_data(uint32_t *paras); - - -/** - * rsb read pmu reg. - * @addr: pmu reg addr; - * - * return: if read pmu reg successed, return data of pmu reg; - * if read pmu reg failed, return -1. - */ -uint8_t arisc_rsb_read_pmu_reg(uint32_t addr); - -/** - * rsb write pmu reg. - * @addr: pmu reg addr; - * @data: pmu reg data; - * - * return: result, 0 - write register successed, - * !0 - write register failedor the len more then max len; - */ -int arisc_rsb_write_pmu_reg(uint32_t addr, uint32_t data); - - -/** - * rsb bits operation sync. - * @cfg: point of arisc_rsb_bits_cfg struct; - * - * return: result, 0 - bits operation successed, - * !0 - bits operation failed, or the len more then max len; - * - * rsb clear bits internal: - * data = rsb_read(regaddr); - * data = data & (~mask); - * rsb_write(regaddr, data); - * - * rsb set bits internal: - * data = rsb_read(addr); - * data = data | mask; - * rsb_write(addr, data); - * - */ -int rsb_bits_ops_sync(uint32_t *paras); - -/** - * rsb set interface mode. - * @devaddr: rsb slave device address; - * @regaddr: register address of rsb slave device; - * @data: data which to init rsb slave device interface mode; - * - * return: result, 0 - set interface mode successed, - * !0 - set interface mode failed; - */ -int arisc_rsb_set_interface_mode(uint32_t devaddr, uint32_t regaddr, uint32_t data); - -/** - * rsb set runtime slave address. - * @devaddr: rsb slave device address; - * @rtsaddr: rsb slave device's runtime slave address; - * - * return: result, 0 - set rsb runtime address successed, - * !0 - set rsb runtime address failed; - */ -int arisc_rsb_set_rtsaddr(uint32_t devaddr, uint32_t rtsaddr); - -/** - * set pmu voltage. - * @type: pmu regulator type; - * @voltage: pmu regulator voltage; - * - * return: result, 0 - set pmu voltage successed, - * !0 - set pmu voltage failed; - */ -int arisc_pmu_set_voltage(uint32_t type, uint32_t voltage); - -/** - * get pmu voltage. - * @type: pmu regulator type; - * - * return: pmu regulator voltage; - */ -int arisc_pmu_get_voltage(uint32_t type, uint32_t *voltage); - -/* ====================================debug interface==================================== */ -int arisc_message_loopback(void); -int arisc_config_ir_paras(uint32_t ir_code, uint32_t ir_addr); -int arisc_set_debug_level(unsigned int level); -int arisc_set_uart_baudrate(uint32_t baudrate); -int arisc_set_dram_crc_paras(unsigned int dram_crc_en, unsigned int dram_crc_srcaddr, unsigned int dram_crc_len); -int arisc_set_paras(void); - -#endif /* __ASM_ARCH_A100_H */ - diff --git a/plat/sun50iw1p1/plat_pm.c b/plat/sun50iw1p1/plat_pm.c index 22d37e2..347cc82 100644 --- a/plat/sun50iw1p1/plat_pm.c +++ b/plat/sun50iw1p1/plat_pm.c @@ -41,7 +41,6 @@ #include "sunxi_def.h" #include "sunxi_private.h" #include "sunxi_cpu_ops.h" -#include <arisc.h> #include <cci400.h> #include <console.h> #include <psci.h> @@ -244,7 +243,6 @@ static int32_t sunxi_affinst_suspend_finish(uint64_t mpidr, arm_gic_init(GICC_BASE, GICD_BASE, 0, NULL, 0); arm_gic_setup(); console_init(SUNXI_UART0_BASE, UART0_CLK_IN_HZ, UART0_BAUDRATE); - arisc_cpux_ready_notify(); } diff --git a/plat/sun50iw1p1/platform.mk b/plat/sun50iw1p1/platform.mk index 720c543..a0cad55 100644 --- a/plat/sun50iw1p1/platform.mk +++ b/plat/sun50iw1p1/platform.mk @@ -87,4 +87,3 @@ BL31_SOURCES += drivers/arm/gic/arm_gic.c \ plat/sun50iw1p1/aarch64/sunxi_common.c \ services/arm/arm_svc_setup.c -include plat/${PLAT}/scp/arisc.mk diff --git a/plat/sun50iw1p1/scp/arisc.c b/plat/sun50iw1p1/scp/arisc.c deleted file mode 100644 index 1430b7e..0000000 --- a/plat/sun50iw1p1/scp/arisc.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * drivers/arisc/arisc.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "arisc_i.h" - -/* local functions */ -static int arisc_wait_ready(unsigned int timeout); - -struct dts_cfg dts_cfg; -unsigned int arisc_debug_dram_crc_en = 0; -unsigned int arisc_debug_dram_crc_srcaddr = 0x40000000; -unsigned int arisc_debug_dram_crc_len = (1024 * 1024); -unsigned int arisc_debug_dram_crc_error = 0; -unsigned int arisc_debug_dram_crc_total_count = 0; -unsigned int arisc_debug_dram_crc_error_count = 0; -volatile const unsigned int arisc_debug_level = 2; -static unsigned char arisc_version[40] = "arisc defualt version"; - -static int arisc_wait_ready(unsigned int timeout) -{ - /* wait arisc startup ready */ - while (1) { - /* - * linux cpu interrupt is disable now, - * we should query message by hand. - */ - struct arisc_message *pmessage = arisc_hwmsgbox_query_message(); - if (pmessage == NULL) { - /* try to query again */ - continue; - } - /* query valid message */ - if (pmessage->type == ARISC_STARTUP_NOTIFY) { - /* check arisc software and driver version match or not */ - if (pmessage->paras[0] != ARISC_VERSIONS) { - ARISC_ERR("arisc firmware:%d and driver version:%u not matched\n", pmessage->paras[0], ARISC_VERSIONS); - return -EINVAL; - } else { - /* printf the main and sub version string */ - memcpy((void *)arisc_version, (const void*)(&(pmessage->paras[1])), 40); - ARISC_LOG("arisc version: [%s]\n", arisc_version); - } - - /* received arisc startup ready message */ - ARISC_INF("arisc startup ready\n"); - if ((pmessage->attr & ARISC_MESSAGE_ATTR_SOFTSYN) || - (pmessage->attr & ARISC_MESSAGE_ATTR_HARDSYN)) { - /* synchronous message, just feedback it */ - ARISC_INF("arisc startup notify message feedback\n"); - pmessage->paras[0] = (uint32_t)dts_cfg.image.base; - arisc_hwmsgbox_feedback_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - } else { - /* asyn message, free message directly */ - ARISC_INF("arisc startup notify message free directly\n"); - arisc_message_free(pmessage); - } - break; - } - /* - * invalid message detected, ignore it. - * by superm at 2012-7-6 18:34:38. - */ - ARISC_WRN("arisc startup waiting ignore message\n"); - if ((pmessage->attr & ARISC_MESSAGE_ATTR_SOFTSYN) || - (pmessage->attr & ARISC_MESSAGE_ATTR_HARDSYN)) { - /* synchronous message, just feedback it */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - } else { - /* asyn message, free message directly */ - arisc_message_free(pmessage); - } - /* we need waiting continue */ - } - - return 0; -} - -int sunxi_deassert_arisc(void) -{ - ARISC_INF("set arisc reset to de-assert state\n"); - { - volatile unsigned long value; - value = readl(dts_cfg.cpuscfg.base + 0x0); - value &= ~1; - writel(value, dts_cfg.cpuscfg.base + 0x0); - value = readl(dts_cfg.cpuscfg.base + 0x0); - value |= 1; - writel(value, dts_cfg.cpuscfg.base + 0x0); - } - - return 0; -} - -static int sunxi_arisc_para_init(struct arisc_para *para) -{ - /* init para */ - memset(para, 0, sizeof(struct arisc_para)); - para->message_pool_phys = (uint32_t)dts_cfg.space.msgpool_dst; - para->message_pool_size = (uint32_t)dts_cfg.space.msgpool_size; - para->standby_base = (uint32_t)dts_cfg.space.standby_dst; - para->standby_size = (uint32_t)dts_cfg.space.standby_size; - memcpy((void *)¶->vf, (void *)dts_cfg.vf, sizeof(para->vf)); - memcpy((void *)¶->dram_para, (void *)&dts_cfg.dram_para, sizeof(para->dram_para)); - para->power_key_code = dts_cfg.s_cir.power_key_code; - para->addr_code = dts_cfg.s_cir.addr_code; - para->suart_status = dts_cfg.s_uart.status; - para->pmu_bat_shutdown_ltf = dts_cfg.pmu.pmu_bat_shutdown_ltf; - para->pmu_bat_shutdown_htf = dts_cfg.pmu.pmu_bat_shutdown_htf; - para->pmu_pwroff_vol = dts_cfg.pmu.pmu_pwroff_vol; - para->power_start = dts_cfg.pmu.power_start; - para->powchk_used = dts_cfg.power.powchk_used; - para->power_reg = dts_cfg.power.power_reg; - para->system_power = dts_cfg.power.system_power; - - ARISC_LOG("arisc_para size:%llx\n", sizeof(struct arisc_para)); - ARISC_INF("msgpool base:%x, size:%u\n", para->message_pool_phys, - para->message_pool_size); - - return 0; -} - -uint32_t sunxi_load_arisc(uintptr_t image_addr, size_t image_size, void *para, size_t para_size) -{ - void *dst; - void *src; - size_t size; - -#if 0 - /* - * phys addr to virt addr - * io space: ioremap - * kernel space: phys_to_virt - */ - /* sram code space */ - dst = (void *)dts_cfg.space.sram_dst; - src = (void *)((ptrdiff_t)image_addr + (ptrdiff_t)dts_cfg.space.sram_offset); - size = dts_cfg.space.sram_size; - memset(dst, 0, size); - memcpy(dst, src, size); - flush_dcache_range((uint64_t)dst, (uint64_t)size); - - /* dram code space */ - dst = (void *)dts_cfg.space.dram_dst; - src = (void *)((ptrdiff_t)image_addr + (ptrdiff_t)dts_cfg.space.dram_offset); - size = dts_cfg.space.dram_size; - memset(dst, 0, size); - memcpy(dst, src, size); - flush_dcache_range((uint64_t)dst, (uint64_t)size); - - ARISC_INF("load arisc image finish\n"); -#endif - /* para space */ - dst = (void *)dts_cfg.space.para_dst; - src = para; - size = dts_cfg.space.para_size; - memset(dst, 0, size); - memcpy(dst, src, size); - ARISC_INF("setup arisc para finish\n"); - //dcsw_op_all(DCCISW); - flush_dcache_range((uint64_t)dst, (uint64_t)size); - isb(); - -#if 0 - /* relese arisc reset */ - sunxi_deassert_arisc(); - ARISC_INF("release arisc reset finish\n"); - - ARISC_INF("load arisc finish\n"); -#endif - - return 0; -} - -int sunxi_arisc_probe(void *cfg) -{ - struct arisc_para para; - - ARISC_LOG("sunxi-arisc driver begin startup %d\n", arisc_debug_level); - memcpy((void *)&dts_cfg, (const void *)cfg, sizeof(struct dts_cfg)); - - /* init arisc parameter */ - sunxi_arisc_para_init(¶); - - /* load arisc */ - sunxi_load_arisc(dts_cfg.image.base, dts_cfg.image.size, - (void *)(¶), sizeof(struct arisc_para)); - - /* initialize hwspinlock */ - ARISC_INF("hwspinlock initialize\n"); - arisc_hwspinlock_init(); - - /* initialize hwmsgbox */ - ARISC_INF("hwmsgbox initialize\n"); - arisc_hwmsgbox_init(); - - /* initialize message manager */ - ARISC_INF("message manager initialize start:0x%llx, size:0x%llx\n", dts_cfg.space.msgpool_dst, dts_cfg.space.msgpool_size); - arisc_message_manager_init((void *)dts_cfg.space.msgpool_dst, dts_cfg.space.msgpool_size); - - /* wait arisc ready */ - ARISC_INF("wait arisc ready....\n"); - if (arisc_wait_ready(10000)) { - ARISC_LOG("arisc startup failed\n"); - } - - arisc_set_paras(); - - /* enable arisc asyn tx interrupt */ - //arisc_hwmsgbox_enable_receiver_int(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - /* enable arisc syn tx interrupt */ - //arisc_hwmsgbox_enable_receiver_int(ARISC_HWMSGBOX_ARISC_SYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - /* arisc initialize succeeded */ - ARISC_LOG("sunxi-arisc driver v%s is starting\n", DRV_VERSION); - - return 0; -} - -int sunxi_arisc_wait_ready(void) -{ - ARISC_INF("wait arisc ready....\n"); - if (arisc_wait_ready(10000)) { - ARISC_LOG("arisc startup failed\n"); - } - arisc_set_paras(); - ARISC_LOG("sunxi-arisc driver v%s startup ok\n", DRV_VERSION); - return 0; -} - diff --git a/plat/sun50iw1p1/scp/arisc.mk b/plat/sun50iw1p1/scp/arisc.mk deleted file mode 100644 index f75311c..0000000 --- a/plat/sun50iw1p1/scp/arisc.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# Neither the name of ARM nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -BL31_SOURCES += plat/sun50iw1p1/scp/arisc.c - -include plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.mk -include plat/sun50iw1p1/scp/hwspinlock/hwspinlock.mk -include plat/sun50iw1p1/scp/message_manager/message_manager.mk -include plat/sun50iw1p1/scp/interfaces/interfaces.mk diff --git a/plat/sun50iw1p1/scp/arisc_i.h b/plat/sun50iw1p1/scp/arisc_i.h deleted file mode 100644 index f44ffc1..0000000 --- a/plat/sun50iw1p1/scp/arisc_i.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * arch/arm/mach-sun6i/arisc/arisc_i.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_I_H__ -#define __ARISC_I_H__ - -//#include <asm/atomic.h> -//#include <asm/barrier.h> -//#include <asm/memory.h> -//#include <linux/arisc/arisc.h> -//#include <linux/sysfs.h> -//#include <linux/device.h> -//#include <linux/gpio.h> -//#include <linux/pinctrl/consumer.h> -//#include <linux/module.h> -//#include <linux/platform_device.h> -//#include <linux/delay.h> -//#include <linux/clk.h> -//#include <linux/arisc/arisc-notifier.h> -//#include <linux/of_address.h> -//#include <linux/of_irq.h> -//#include <linux/of_platform.h> - -#include "./include/arisc_includes.h" - -#define DRV_NAME "sunxi-arisc" -#define DEV_NAME "sunxi-arisc" - -#if defined CONFIG_ARCH_SUN8IW1P1 -#define DRV_VERSION "1.00" -#elif defined CONFIG_ARCH_SUN8IW3P1 -#define DRV_VERSION "1.01" -#elif defined CONFIG_ARCH_SUN8IW5P1 -#define DRV_VERSION "1.02" -#elif defined CONFIG_ARCH_SUN8IW6P1 -#define DRV_VERSION "1.03" -#elif defined CONFIG_ARCH_SUN8IW7P1 -#define DRV_VERSION "1.04" -#elif defined CONFIG_ARCH_SUN8IW9P1 -#define DRV_VERSION "1.05" -#elif defined CONFIG_ARCH_SUN50IW1P1 -#define DRV_VERSION "1.10" -#elif defined CONFIG_ARCH_SUN9IW1P1 -#define DRV_VERSION "2.00" -#else -#error "please select a platform\n" -#endif - -extern unsigned int arisc_debug_dram_crc_en; -extern unsigned int arisc_debug_dram_crc_srcaddr; -extern unsigned int arisc_debug_dram_crc_len; -extern unsigned int arisc_debug_dram_crc_error; -extern unsigned int arisc_debug_dram_crc_total_count; -extern unsigned int arisc_debug_dram_crc_error_count; -extern volatile const unsigned int arisc_debug_level; -extern struct standby_info_para arisc_powchk_back; - -//local functions -extern int arisc_config_dram_paras(void); -extern int arisc_sysconfig_ir_paras(void); -extern int arisc_config_pmu_paras(void); -extern int arisc_suspend_flag_query(void); -#if (defined CONFIG_ARCH_SUN8IW7P1) -extern void arisc_power_off(void); -#endif -#endif //__ARISC_I_H__ diff --git a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.c b/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.c deleted file mode 100644 index f1bc032..0000000 --- a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/hwmsgbox/hwmsgbox.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "hwmsgbox_i.h" - -/* spinlock for syn and asyn channel */ -static spinlock_t syn_channel_lock; -static spinlock_t asyn_channel_lock; -static uintptr_t base; - -/** - * initialize hwmsgbox. - * @para: none. - * - * returns: 0 if initialize hwmsgbox succeeded, others if failed. - */ -int arisc_hwmsgbox_init(void) -{ - base = dts_cfg.msgbox.base; - - /* initialize syn and asyn spinlock */ - //writel(0xffffffff, base + AW_MSGBOX_IRQ_STATUS_REG(AW_HWMSG_QUEUE_USER_AC327)); - //writel(0x0, base + AW_MSGBOX_IRQ_EN_REG(AW_HWMSG_QUEUE_USER_AC327)); - - return 0; -} - -/** - * exit hwmsgbox. - * @para: none. - * - * returns: 0 if exit hwmsgbox succeeded, others if failed. - */ -int arisc_hwmsgbox_exit(void) -{ - return 0; -} - -/** - * send one message to another processor by hwmsgbox. - * @pmessage: the pointer of sended message frame. - * @timeout: the wait time limit when message fifo is full, it is valid only when parameter mode = HWMSG_SEND_WAIT_TIMEOUT. - * - * returns: 0 if send message succeeded, other if failed. - */ -int arisc_hwmsgbox_send_message(struct arisc_message *pmessage, unsigned int timeout) -{ - volatile uint32_t value; - - if (pmessage == NULL) { - return -EINVAL; - } - if (pmessage->attr & ARISC_MESSAGE_ATTR_HARDSYN) { - /* use ac327 hwsyn transmit channel */ - spin_lock(&syn_channel_lock); - while (readl(base + AW_MSGBOX_FIFO_STATUS_REG(ARISC_HWMSGBOX_AC327_SYN_TX_CH)) == 1); - - value = arisc_message_map_to_cpus(pmessage); - ARISC_INF("ac327 send hard syn message : %x\n", (unsigned int)value); - writel(value, base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_AC327_SYN_TX_CH)); - - /* hwsyn messsage must feedback use syn rx channel */ - while (readl(base + AW_MSGBOX_MSG_STATUS_REG(ARISC_HWMSGBOX_AC327_SYN_RX_CH)) == 0); - - /* check message valid */ - if (value != (readl(base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_AC327_SYN_RX_CH)))) { - ARISC_ERR("hard syn message error [%x, %x]\n", (uint32_t)value, (uint32_t)(readl(base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_AC327_SYN_RX_CH)))); - spin_unlock(&syn_channel_lock); - return -EINVAL; - } - ARISC_INF("ac327 hard syn message [%x, %x] feedback\n", (unsigned int)value, (unsigned int)pmessage->type); - /* if error call the callback function. by superm */ - if(pmessage->result != 0) { - ARISC_ERR("message process error\n"); - ARISC_ERR("message addr : %llx\n", pmessage); - ARISC_ERR("message state : %x\n", pmessage->state); - ARISC_ERR("message attr : %x\n", pmessage->attr); - ARISC_ERR("message type : %x\n", pmessage->type); - ARISC_ERR("message result : %x\n", pmessage->result); - if (pmessage->cb.handler == NULL) { - ARISC_WRN("callback not install\n"); - } else { - /* call callback function */ - ARISC_WRN("call the callback function\n"); - (*(pmessage->cb.handler))(pmessage->cb.arg); - } - } - spin_unlock(&syn_channel_lock); - return 0; - } - - /* use ac327 asyn transmit channel */ - spin_lock(&asyn_channel_lock); - while (readl(base + AW_MSGBOX_FIFO_STATUS_REG(ARISC_HWMSGBOX_ARISC_ASYN_RX_CH)) == 1); - - /* write message to message-queue fifo */ - value = arisc_message_map_to_cpus(pmessage); - ARISC_INF("ac327 send message : %x\n", (unsigned int)value); - writel(value, base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_ARISC_ASYN_RX_CH)); - spin_unlock(&asyn_channel_lock); - - return 0; -} - -int arisc_hwmsgbox_feedback_message(struct arisc_message *pmessage, unsigned int timeout) -{ - volatile unsigned long value; - - if (pmessage->attr & ARISC_MESSAGE_ATTR_HARDSYN) { - /* use ac327 hard syn receiver channel */ - spin_lock(&syn_channel_lock); - while (readl(base + AW_MSGBOX_FIFO_STATUS_REG(ARISC_HWMSGBOX_ARISC_SYN_RX_CH)) == 1); - - value = arisc_message_map_to_cpus(pmessage); - ARISC_INF("arisc feedback hard syn message : %x\n", (unsigned int)value); - writel(value, base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_ARISC_SYN_RX_CH)); - spin_unlock(&syn_channel_lock); - - return 0; - } - - /* invalid syn message */ - return -EINVAL; -} - -/** - * enbale the receiver interrupt of message-queue. - * @queue: the number of message-queue which we want to enable interrupt. - * @user: the user which we want to enable interrupt. - * - * returns: 0 if enable interrupt succeeded, others if failed. - */ -int arisc_hwmsgbox_enable_receiver_int(int queue, int user) -{ - volatile unsigned int value; - - value = readl(base + AW_MSGBOX_IRQ_EN_REG(user)); - value &= ~(0x1 << (queue * 2)); - value |= (0x1 << (queue * 2)); - writel(value, base + AW_MSGBOX_IRQ_EN_REG(user)); - - return 0; -} - -/** - * disbale the receiver interrupt of message-queue. - * @queue: the number of message-queue which we want to enable interrupt. - * @user: the user which we want to enable interrupt. - * - * returns: 0 if disable interrupt succeeded, others if failed. - */ -int arisc_hwmsgbox_disable_receiver_int(int queue, int user) -{ - volatile unsigned int value; - - value = readl(base + AW_MSGBOX_IRQ_EN_REG(user)); - value &= ~(0x1 << (queue * 2)); - writel(value, base + AW_MSGBOX_IRQ_EN_REG(user)); - - return 0; -} - -/** - * query the receiver interrupt pending of message-queue. - * @queue: the number of message-queue which we want to query. - * @user: the user which we want to query. - * - * returns: 0 if query pending succeeded, others if failed. - */ -int arisc_hwmsgbox_query_receiver_pending(int queue, int user) -{ - volatile unsigned long value; - - value = readl(base + (AW_MSGBOX_IRQ_STATUS_REG(user))); - - return value & (0x1 << (queue * 2)); -} - -/** - * clear the receiver interrupt pending of message-queue. - * @queue: the number of message-queue which we want to clear. - * @user: the user which we want to clear. - * - * returns: 0 if clear pending succeeded, others if failed. - */ -int arisc_hwmsgbox_clear_receiver_pending(int queue, int user) -{ - writel((0x1 << (queue * 2)), base + AW_MSGBOX_IRQ_STATUS_REG(user)); - - return 0; -} - -/** - * query message of hwmsgbox by hand, mainly for. - * @para: none. - * - * returns: the point of message, NULL if timeout. - */ -struct arisc_message *arisc_hwmsgbox_query_message(void) -{ - struct arisc_message *pmessage = NULL; - - /* query ac327 asyn received channel */ - if (readl(base + AW_MSGBOX_MSG_STATUS_REG(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH))) { - volatile unsigned long value; - value = readl(base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH)); - pmessage = arisc_message_map_to_cpux(value); - - if (arisc_message_valid(pmessage)) { - /* message state switch */ - if (pmessage->state == ARISC_MESSAGE_PROCESSED) { - /* ARISC_MESSAGE_PROCESSED->ARISC_MESSAGE_FEEDBACKED */ - pmessage->state = ARISC_MESSAGE_FEEDBACKED; - } else { - /* ARISC_MESSAGE_INITIALIZED->ARISC_MESSAGE_RECEIVED */ - pmessage->state = ARISC_MESSAGE_RECEIVED; - } - } else { - ARISC_ERR("invalid asyn message received: pmessage = 0x%llx. \n", pmessage); - return NULL; - } - /* clear pending */ - arisc_hwmsgbox_clear_receiver_pending(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - return pmessage; - } - /* query ac327 syn received channel */ - if (readl(base + AW_MSGBOX_MSG_STATUS_REG(ARISC_HWMSGBOX_ARISC_SYN_TX_CH))) { - volatile unsigned long value; - value = readl(base + AW_MSGBOX_MSG_REG(ARISC_HWMSGBOX_ARISC_SYN_TX_CH)); - pmessage = arisc_message_map_to_cpux(value); - if (arisc_message_valid(pmessage)) { - /* message state switch */ - if (pmessage->state == ARISC_MESSAGE_PROCESSED) { - /* ARISC_MESSAGE_PROCESSED->ARISC_MESSAGE_FEEDBACKED */ - pmessage->state = ARISC_MESSAGE_FEEDBACKED; - } else { - /* ARISC_MESSAGE_INITIALIZED->ARISC_MESSAGE_RECEIVED */ - pmessage->state = ARISC_MESSAGE_RECEIVED; - } - } else { - ARISC_ERR("invalid syn message received: pmessage = 0x%llx. \n", pmessage); - arisc_hwmsgbox_clear_receiver_pending(ARISC_HWMSGBOX_ARISC_SYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - return NULL; - } - arisc_hwmsgbox_clear_receiver_pending(ARISC_HWMSGBOX_ARISC_SYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - return pmessage; - } - - /* no valid message now */ - return NULL; -} - -int arisc_hwmsgbox_standby_suspend(void) -{ - /* enable arisc asyn tx interrupt */ - //arisc_hwmsgbox_disable_receiver_int(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - /* enable arisc syn tx interrupt */ - //arisc_hwmsgbox_disable_receiver_int(ARISC_HWMSGBOX_ARISC_SYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - return 0; -} - -int arisc_hwmsgbox_standby_resume(void) -{ - /* enable arisc asyn tx interrupt */ - //arisc_hwmsgbox_enable_receiver_int(ARISC_HWMSGBOX_ARISC_ASYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - /* enable arisc syn tx interrupt */ - //arisc_hwmsgbox_enable_receiver_int(ARISC_HWMSGBOX_ARISC_SYN_TX_CH, AW_HWMSG_QUEUE_USER_AC327); - - return 0; -} diff --git a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.mk b/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.mk deleted file mode 100644 index aebb5ec..0000000 --- a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# Neither the name of ARM nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -BL31_SOURCES += plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox.c diff --git a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox_i.h b/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox_i.h deleted file mode 100644 index ffee2a9..0000000 --- a/plat/sun50iw1p1/scp/hwmsgbox/hwmsgbox_i.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/hwmsgbox/hwmsgbox_i.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_HWMSGBOX_I_H -#define __ARISC_HWMSGBOX_I_H - -#include "../include/arisc_includes.h" - -//hardware message-box register list -#define AW_MSGBOX_CTRL_REG(m) (0x0000 + (0x4 * (m>>2))) -#define AW_MSGBOX_IRQ_EN_REG(u) (0x0040 + (0x20* u)) -#define AW_MSGBOX_IRQ_STATUS_REG(u) (0x0050 + (0x20* u)) -#define AW_MSGBOX_FIFO_STATUS_REG(m) (0x0100 + (0x4 * m)) -#define AW_MSGBOX_MSG_STATUS_REG(m) (0x0140 + (0x4 * m)) -#define AW_MSGBOX_MSG_REG(m) (0x0180 + (0x4 * m)) -#define AW_MSGBOX_DEBUG_REG (0x01c0) - -/* local functions */ -int arisc_hwmsgbox_clear_receiver_pending(int queue, int user); -int arisc_hwmsgbox_query_receiver_pending(int queue, int user); -int arisc_hwmsgbox_enable_receiver_int(int queue, int user); -int arisc_hwmsgbox_set_receiver(int queue, int user); -int arisc_hwmsgbox_set_transmitter(int queue, int user); -int arisc_hwmsgbox_wait_message_feedback(struct arisc_message *pmessage); -int arisc_hwmsgbox_message_feedback(struct arisc_message *pmessage); -int arisc_message_valid(struct arisc_message *pmessage); - -#endif /* __ARISC_HWMSGBOX_I_H */ diff --git a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.c b/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.c deleted file mode 100644 index 863d457..0000000 --- a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/hwspinlock/hwspinlock.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "hwspinlock_i.h" - -static struct arisc_hwspinlock arisc_hwspinlocks[ARISC_HW_SPINLOCK_NUM]; -static uintptr_t base; - -/** - * initialize hwspinlock. - * @para: none. - * - * returns: 0 if initialize hwspinlock succeeded, others if failed. - */ -int arisc_hwspinlock_init(void) -{ - base = dts_cfg.hwspinlock.base; - - return 0; -} - -/** - * exit hwspinlock. - * @para:none. - * - * returns: 0 if exit hwspinlock succeeded, others if failed. - */ -int arisc_hwspinlock_exit(void) -{ - return 0; -} - -/** - * lock an hwspinlock with timeout limit, - * and hwspinlock will be unlocked in arisc_hwspin_unlock(). - * @hwid: an hwspinlock id which we want to lock. - * - * returns: 0 if lock hwspinlock succeeded, other if failed. - */ -int arisc_hwspin_lock(int hwid) -{ - arisc_hwspinlock_t *spinlock; - - if (hwid >= ARISC_HW_SPINLOCK_NUM) { - ARISC_ERR("invalid hwspinlock id [%d] for trylock\n", hwid); - return -EINVAL; - } - spinlock = &(arisc_hwspinlocks[hwid]); - - /* is lock already taken by another context on the local cpu ? */ - spin_lock(&(spinlock->lock)); - - /* try to take spinlock */ - while (readl(base + AW_SPINLOCK_LOCK_REG(hwid)) == AW_SPINLOCK_TAKEN); - - return 0; -} - -/** - * unlock a specific hwspinlock. - * hwid: an hwspinlock id which we want to unlock. - * - * returns: 0 if unlock hwspinlock succeeded, other if failed. - */ -int arisc_hwspin_unlock(int hwid) -{ - arisc_hwspinlock_t *spinlock; - - if (hwid >= ARISC_HW_SPINLOCK_NUM) { - ARISC_ERR("invalid hwspinlock id [%d] for unlock\n", hwid); - return -EINVAL; - } - spinlock = &(arisc_hwspinlocks[hwid]); - - /* untaken the spinlock */ - writel(0x0, base + AW_SPINLOCK_LOCK_REG(hwid)); - - spin_unlock(&(spinlock->lock)); - - return 0; -} - -int arisc_hwspinlock_standby_suspend(void) -{ - return 0; -} - -int arisc_hwspinlock_standby_resume(void) -{ - return 0; -} diff --git a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.mk b/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.mk deleted file mode 100644 index 2c5ee59..0000000 --- a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# Neither the name of ARM nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -BL31_SOURCES += plat/sun50iw1p1/scp/hwspinlock/hwspinlock.c diff --git a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock_i.h b/plat/sun50iw1p1/scp/hwspinlock/hwspinlock_i.h deleted file mode 100644 index 231d7ee..0000000 --- a/plat/sun50iw1p1/scp/hwspinlock/hwspinlock_i.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/hwspinlock/hwspinlock-i.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __HW_SPINLOCK_I_H -#define __HW_SPINLOCK_I_H - -#include "../include/arisc_includes.h" - -/* the used state of spinlock */ -#define SPINLOCK_FREE (0) -#define SPINLOCK_USED (1) - -//the taken ot not state of spinlock -#define AW_SPINLOCK_NOTTAKEN (0) -#define AW_SPINLOCK_TAKEN (1) - -//hardware spinlock register list -#define AW_SPINLOCK_SYS_STATUS_REG (0x0000) -#define AW_SPINLOCK_STATUS_REG (0x0010) -#define AW_SPINLOCK_IRQ_EN_REG (0x0020) -#define AW_SPINLOCK_IRQ_PEND_REG (0x0040) -#define AW_SPINLOCK_LOCK_REG(id) (0x0100 + id * 4) - -typedef struct arisc_hwspinlock -{ - unsigned long flags; - spinlock_t lock; -} arisc_hwspinlock_t; - -#endif /* __HW_SPINLOCK_I_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_cfgs.h b/plat/sun50iw1p1/scp/include/arisc_cfgs.h deleted file mode 100644 index 32234ba..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_cfgs.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_cfgs.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_CFGS_H -#define __ARISC_CFGS_H - -/* arisc software version number */ -#if defined CONFIG_ARCH_SUN8IW1P1 -#define ARISC_VERSIONS (100) -#elif defined CONFIG_ARCH_SUN8IW3P1 -#define ARISC_VERSIONS (101) -#elif defined CONFIG_ARCH_SUN8IW5P1 -#define ARISC_VERSIONS (102) -#elif defined CONFIG_ARCH_SUN8IW6P1 -#define ARISC_VERSIONS (103) -#elif defined CONFIG_ARCH_SUN8IW7P1 -#define ARISC_VERSIONS (104) -#elif defined CONFIG_ARCH_SUN8IW9P1 -#define ARISC_VERSIONS (105) -#elif defined CONFIG_ARCH_SUN50IW1P1 -#define ARISC_VERSIONS (110) -#elif defined CONFIG_ARCH_SUN9IW1P1 -#define ARISC_VERSIONS (200) -#else -#error "please select a platform\n" -#endif - -/* debugger system */ -#define ARISC_DEBUG_ON -#define ARISC_DEBUG_LEVEL (3) /* debug level */ - -/* the max number of cached message frame */ -#define ARISC_MESSAGE_CACHED_MAX (4) - -/* spinlock max timeout, base on ms */ -#define ARISC_SPINLOCK_TIMEOUT (100) - -/* send message max timeout, base on ms */ -#define ARISC_SEND_MSG_TIMEOUT (4000) - -/* hwmsgbox channels configure */ -#define ARISC_HWMSGBOX_ARISC_ASYN_TX_CH (0) -#define ARISC_HWMSGBOX_ARISC_ASYN_RX_CH (1) -#define ARISC_HWMSGBOX_ARISC_SYN_TX_CH (2) -#define ARISC_HWMSGBOX_ARISC_SYN_RX_CH (3) -#define ARISC_HWMSGBOX_AC327_SYN_TX_CH (4) -#define ARISC_HWMSGBOX_AC327_SYN_RX_CH (5) - -/* dvfs config */ -#define ARISC_DVFS_VF_TABLE_MAX (16) -/* ir config */ -#define ARISC_IR_KEY_SUP_NUM (8) /* the number of IR remote support */ - -#define ARISC_DEV_CLKSRC_NUM (4) /* the number of dev clocksource support */ - -#endif /* __ARISC_CFGS_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_dbgs.h b/plat/sun50iw1p1/scp/include/arisc_dbgs.h deleted file mode 100644 index 79ca603..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_dbgs.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_dbgs.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_DBGS_H -#define __ARISC_DBGS_H - -/* - * debug level define, - * level 0 : dump debug information--none; - * level 1 : dump debug information--error; - * level 2 : dump debug information--error+warning; - * level 3 : dump debug information--error+warning+information; - * extern void printk(const char *, ...); - */ -#ifdef ARISC_DEBUG_ON -/* debug levels */ -#define DEBUG_LEVEL_INF ((uint32_t)1 << 0) -#define DEBUG_LEVEL_LOG ((uint32_t)1 << 1) -#define DEBUG_LEVEL_WRN ((uint32_t)1 << 2) -#define DEBUG_LEVEL_ERR ((uint32_t)1 << 3) - -#define ARISC_INF(...) \ - if(DEBUG_LEVEL_INF & (0xf0 >> (arisc_debug_level +1))) \ - tf_printf("[SCP] :" __VA_ARGS__); - -#define ARISC_LOG(...) \ - if(DEBUG_LEVEL_LOG & (0xf0 >> (arisc_debug_level +1))) \ - tf_printf("[SCP] :" __VA_ARGS__); - -#define ARISC_WRN(...) \ - if(DEBUG_LEVEL_WRN & (0xf0 >> (arisc_debug_level +1))) \ - tf_printf("[SCP WARING] :" __VA_ARGS__); - -#define ARISC_ERR(...) \ - if(DEBUG_LEVEL_ERR & (0xf0 >> (arisc_debug_level +1))) \ - tf_printf("[SCP ERROR] :" __VA_ARGS__); - -#else /* ARISC_DEBUG_ON */ -#define ARISC_INF(...) -#define ARISC_WRN(...) -#define ARISC_ERR(...) -#define ARISC_LOG(...) -#endif /* ARISC_DEBUG_ON */ - -/* report error information id */ -#define ERR_NMI_INT_TIMEOUT (0x1) - -#endif /* __ARISC_DBGS_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_hwmsgbox.h b/plat/sun50iw1p1/scp/include/arisc_hwmsgbox.h deleted file mode 100644 index 4bab7bc..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_hwmsgbox.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_hwmsgbox.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_HWMSGBOX_H -#define __ARISC_HWMSGBOX_H - -//the number of hardware message queue. -#define AW_HWMSG_QUEUE_NUMBER (8) - -//the user of hardware message queue. -typedef enum aw_hwmsg_queue_user -{ - AW_HWMSG_QUEUE_USER_ARISC, //arisc - AW_HWMSG_QUEUE_USER_AC327, //cpu0 -} aw_hwmsg_queue_user_e; - -/** - * initialize hwmsgbox. - * @para: none. - * - * returns: OK if initialize hwmsgbox succeeded, others if failed. - */ -int arisc_hwmsgbox_init(void); - -/** - * exit hwmsgbox. - * @para: none. - * - * returns: OK if exit hwmsgbox succeeded, others if failed. - */ -int arisc_hwmsgbox_exit(void); - -/** - * send one message to another processor by hwmsgbox. - * @pmessage: the pointer of sended message frame. - * @timeout: the wait time limit when message fifo is full, - * it is valid only when parameter mode = SEND_MESSAGE_WAIT_TIMEOUT. - * - * returns: OK if send message succeeded, other if failed. - */ -int arisc_hwmsgbox_send_message(struct arisc_message *pmessage, unsigned int timeout); - -/** - * Description: query message of hwmsgbox by hand, mainly for. - * @para: none. - * - * returns: the point of message, NULL if timeout. - */ -struct arisc_message *arisc_hwmsgbox_query_message(void); - -int arisc_hwmsgbox_enable_receiver_int(int queue, int user); -int arisc_hwmsgbox_disable_receiver_int(int queue, int user); - -int arisc_hwmsgbox_feedback_message(struct arisc_message *pmessage, unsigned int timeout); - -int arisc_hwmsgbox_standby_resume(void); -int arisc_hwmsgbox_standby_suspend(void); - -#endif /* __ARISC_HWMSGBOX_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_hwspinlock.h b/plat/sun50iw1p1/scp/include/arisc_hwspinlock.h deleted file mode 100644 index 2b34276..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_hwspinlock.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_hwspinlock.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_HW_SPINLOCK_H -#define __ARISC_HW_SPINLOCK_H - -/* the max number of hardware spinlock */ -#define ARISC_HW_SPINLOCK_NUM (32) - -/** - * initialize hwspinlock. - * @para: none. - * - * returns: OK if initialize hwspinlock succeeded, others if failed. - */ -int arisc_hwspinlock_init(void); - -/** - * exit hwspinlock. - * @para: none. - * - * returns: OK if exit hwspinlock succeeded, others if failed. - */ -int arisc_hwspinlock_exit(void); - -/** - * lock an hwspinlock with timeout limit. - * @hwid : an hwspinlock id which we want to lock. - * - * returns: OK if lock hwspinlock succeeded, other if failed. - */ -int arisc_hwspin_lock(int hwid); - -/** - * unlock a specific hwspinlock. - * @hwid : an hwspinlock id which we want to unlock. - * - * returns: OK if unlock hwspinlock succeeded, other if failed. - */ -int arisc_hwspin_unlock(int hwid); - -int arisc_hwspinlock_standby_suspend(void); -int arisc_hwspinlock_standby_resume(void); - -#endif /* __ARISC_HW_SPINLOCK_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_includes.h b/plat/sun50iw1p1/scp/include/arisc_includes.h deleted file mode 100644 index c32970f..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_includes.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_includes.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_INCLUDES_H -#define __ARISC_INCLUDES_H - -//#include <linux/kernel.h> -//#include <linux/module.h> -//#include <linux/string.h> -//#include <linux/spinlock.h> -//#include <linux/err.h> -//#include <linux/io.h> -//#include <linux/slab.h> -//#include <linux/semaphore.h> -//#include <linux/interrupt.h> -//#include <linux/jiffies.h> -//#include <linux/delay.h> -//#include <linux/arisc/hwmsgbox.h> -//#include <linux/arisc/hwspinlock.h> -#define CONFIG_ARCH_SUN50IW1P1 - -#include <arch_helpers.h> -#include <platform.h> -#include <platform_def.h> -#include <bakery_lock.h> -#include <mmio.h> -#include <debug.h> -#include <stdint.h> -#include <stdio.h> -#include <string.h> -#include <assert.h> -#include <errno.h> -#include <psci.h> -#include <bakery_lock.h> -#include <spinlock.h> -#include <arisc.h> - -#include "../../sunxi_private.h" -#include "../../sunxi_cpu_ops.h" -#include "../../sunxi_def.h" -#include "../../mhu.h" -#include "../../scpi.h" - -/* configure and debugger */ -#include "../arisc_i.h" -#include "./arisc_cfgs.h" -#include "./arisc_dbgs.h" -#include "./arisc_para.h" - -/* messages define */ -#include "./arisc_messages.h" -#include "./arisc_message_manager.h" - -/* driver headers */ -#include "./arisc_hwmsgbox.h" -#include "./arisc_hwspinlock.h" - -#define readl(x) mmio_read_32((x)) -#define writel(v, a) mmio_write_32((a), (v)) - -/* global functions */ -extern int arisc_axp_int_notify(struct arisc_message *pmessage); -extern int arisc_audio_perdone_notify(struct arisc_message *pmessage); -extern int arisc_dvfs_cfg_vf_table(void); -extern int arisc_query_set_standby_info(struct standby_info_para *para, arisc_rw_type_e op); -extern int arisc_sysconfig_sstpower_paras(void); -extern int arisc_report_error_info(struct arisc_message *pmessage); - -/* global vars */ -extern unsigned long arisc_sram_a2_base; -extern struct dts_cfg dts_cfg; - -#endif /* __ARISC_INCLUDES_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_message_manager.h b/plat/sun50iw1p1/scp/include/arisc_message_manager.h deleted file mode 100644 index 5b80596..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_message_manager.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_message_manager.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_MESSAGE_MANAGER_H -#define __ARISC_MESSAGE_MANAGER_H - -/** - * initialize message manager. - * @para: none. - * - * returns: OK if initialize succeeded, others if failed. - */ -int arisc_message_manager_init(void *addr, uint32_t size); - -/** - * exit message manager. - * para: none. - * - * returns: OK if exit succeeded, others if failed. - */ -int arisc_message_manager_exit(void); - -/** - * allocate one message frame. mainly use for send message by message-box, - * the message frame allocate form messages pool shared memory area. - * @para: none. - * - * returns: the pointer of allocated message frame, NULL if failed; - */ -struct arisc_message *arisc_message_allocate(unsigned int msg_attr); - -/** - * free one message frame. mainly use for process message finished, - * free it to messages pool or add to free message queue. - * @pmessage: the pointer of free message frame. - * - * returns: none. - */ -void arisc_message_free(struct arisc_message *pmessage); - -/** - * notify system that one message coming. - * @pmessage : the pointer of coming message frame. - * - * returns: OK if notify succeeded, other if failed. - */ -int arisc_message_coming_notify(struct arisc_message *pmessage); - -int arisc_semaphore_used_num_query(void); - -struct arisc_message *arisc_message_map_to_cpux(uint32_t addr); -uint32_t arisc_message_map_to_cpus(struct arisc_message *message); -int arisc_message_valid(struct arisc_message *pmessage); - -#endif /* __MESSAGE_MANAGER_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_messages.h b/plat/sun50iw1p1/scp/include/arisc_messages.h deleted file mode 100644 index 98c47b1..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_messages.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/include/arisc_messages.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#ifndef __ARISC_MESSAGES_H__ -#define __ARISC_MESSAGES_H__ - -#include <arisc.h> - -/* message states */ -#define ARISC_MESSAGE_FREED (0x0) /* freed state */ -#define ARISC_MESSAGE_ALLOCATED (0x1) /* allocated state */ -#define ARISC_MESSAGE_INITIALIZED (0x2) /* initialized state */ -#define ARISC_MESSAGE_RECEIVED (0x3) /* received state */ -#define ARISC_MESSAGE_PROCESSING (0x4) /* processing state */ -#define ARISC_MESSAGE_PROCESSED (0x5) /* processed state */ -#define ARISC_MESSAGE_FEEDBACKED (0x6) /* feedback state */ - -/* call back struct */ -typedef struct arisc_msg_cb -{ - arisc_cb_t handler; - void *arg; -} arisc_msg_cb_t; - -#ifdef CONFIG_ARCH_SUN50IW1P1 -/* - * the structure of message frame, - * this structure will transfer between arisc and ac327. - * sizeof(struct message) : 128Byte. - */ -typedef struct arisc_message -{ - volatile unsigned char state; /* identify the used status of message frame */ - volatile unsigned char attr; /* message attribute : SYN OR ASYN */ - volatile unsigned char type; /* message type : DVFS_REQ */ - volatile unsigned char result; /* message process result */ - volatile unsigned char reserved[4]; /* reserved for 8byte align */ - volatile struct arisc_message *next; /* pointer of next message frame */ - volatile struct arisc_msg_cb cb; /* the callback function and arg of message */ - volatile void *private; /* message private data */ - volatile unsigned int paras[22]; /* the parameters of message */ -} arisc_message_t; -#else -/* - * the structure of message frame, - * this structure will transfer between arisc and ac327. - * sizeof(struct message) : 64Byte. - */ -typedef struct arisc_message -{ - volatile unsigned char state; /* identify the used status of message frame */ - volatile unsigned char attr; /* message attribute : SYN OR ASYN */ - volatile unsigned char type; /* message type : DVFS_REQ */ - volatile unsigned char result; /* message process result */ - volatile struct arisc_message *next; /* pointer of next message frame */ - volatile struct arisc_msg_cb cb; /* the callback function and arg of message */ - volatile void *private; /* message private data */ - volatile unsigned int paras[11]; /* the parameters of message */ -} arisc_message_t; -#endif - -#endif /* __ARISC_MESSAGES_H */ diff --git a/plat/sun50iw1p1/scp/include/arisc_para.h b/plat/sun50iw1p1/scp/include/arisc_para.h deleted file mode 100644 index 1943759..0000000 --- a/plat/sun50iw1p1/scp/include/arisc_para.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef __ARISC_PARA_H__ -#define __ARISC_PARA_H__ - -#define ARISC_MACHINE_PAD 0 -#define ARISC_MACHINE_HOMLET 1 - -/* arisc parameter size: 128byte */ -/* - * machine: machine id, pad = 0, homlet = 1; - * message_pool_phys: message pool physical address; - * message_pool_size: message pool size; - */ -#define SERVICES_DVFS_USED (1<<0) - -/* FIXME: if you modify this struct, you should - * sync this change with linux source, - * by superm at 2015-05-15. - */ -typedef enum power_dm -{ - DM_CPUA = 0, /* 0 */ - DM_CPUB, /* 1 */ - DM_DRAM, /* 2 */ - DM_GPU, /* 3 */ - DM_SYS, /* 4 */ - DM_VPU, /* 5 */ - DM_CPUS, /* 6 */ - DM_DRAMPLL, /* 7 */ - DM_ADC, /* 8 */ - DM_PL, /* 9 */ - DM_PM, /* 10 */ - DM_IO, /* 11 */ - DM_CPVDD, /* 12 */ - DM_LDOIN, /* 13 */ - DM_PLL, /* 14 */ - DM_LPDDR, /* 15 */ - DM_TEST, /* 16 */ - DM_RES1, /* 17 */ - DM_RES2, /* 18 */ - DM_RES3, /* 19 */ - DM_MAX, /* 20 */ -} power_dm_e; - -typedef struct mem_cfg -{ - uintptr_t base; - size_t size; -} mem_cfg_t; - -typedef struct dev_cfg -{ - uintptr_t base; - size_t size; - uint32_t irq; - int status; -} dev_cfg_t; - -typedef struct cir_cfg -{ - uintptr_t base; - size_t size; - uint32_t irq; - uint32_t power_key_code; - uint32_t addr_code; - int status; -} cir_cfg_t; - -typedef struct pmu_cfg -{ - uint32_t pmu_bat_shutdown_ltf; - uint32_t pmu_bat_shutdown_htf; - uint32_t pmu_pwroff_vol; - uint32_t power_start; -} pmu_cfg_t; - -typedef struct power_cfg -{ - uint32_t powchk_used; - uint32_t power_reg; - uint32_t system_power; -} power_cfg_t; - -typedef struct image_cfg -{ - uintptr_t base; - size_t size; -} image_cfg_t; - -typedef struct space_cfg -{ - uintptr_t sram_dst; - uintptr_t sram_offset; - size_t sram_size; - uintptr_t dram_dst; - uintptr_t dram_offset; - size_t dram_size; - uintptr_t para_dst; - uintptr_t para_offset; - size_t para_size; - uintptr_t msgpool_dst; - uintptr_t msgpool_offset; - size_t msgpool_size; - uintptr_t standby_dst; - uintptr_t standby_offset; - size_t standby_size; -} space_cfg_t; - -typedef struct dram_para -{ - //normal configuration - uint32_t dram_clk; - uint32_t dram_type; //dram_type DDR2: 2 DDR3: 3 LPDDR2: 6 DDR3L: 31 - uint32_t dram_zq; - uint32_t dram_odt_en; - - //control configuration - uint32_t dram_para1; - uint32_t dram_para2; - - //timing configuration - uint32_t dram_mr0; - uint32_t dram_mr1; - uint32_t dram_mr2; - uint32_t dram_mr3; - uint32_t dram_tpr0; - uint32_t dram_tpr1; - uint32_t dram_tpr2; - uint32_t dram_tpr3; - uint32_t dram_tpr4; - uint32_t dram_tpr5; - uint32_t dram_tpr6; - - //reserved for future use - uint32_t dram_tpr7; - uint32_t dram_tpr8; - uint32_t dram_tpr9; - uint32_t dram_tpr10; - uint32_t dram_tpr11; - uint32_t dram_tpr12; - uint32_t dram_tpr13; - -}dram_para_t; - -typedef struct arisc_freq_voltage -{ - uint32_t freq; //cpu frequency - uint32_t voltage; //voltage for the frequency - uint32_t axi_div; //the divide ratio of axi bus -} arisc_freq_voltage_t; - -typedef struct dts_cfg -{ - struct dram_para dram_para; - struct arisc_freq_voltage vf[ARISC_DVFS_VF_TABLE_MAX]; - struct space_cfg space; - struct image_cfg image; - struct mem_cfg prcm; - struct mem_cfg cpuscfg; - struct dev_cfg msgbox; - struct dev_cfg hwspinlock; - struct dev_cfg s_uart; - struct dev_cfg s_rsb; - struct dev_cfg s_jtag; - struct cir_cfg s_cir; - struct pmu_cfg pmu; - struct power_cfg power; -} dts_cfg_t; - -typedef struct arisc_para -{ - uint32_t message_pool_phys; - uint32_t message_pool_size; - uint32_t standby_base; - uint32_t standby_size; - uint32_t power_key_code; - uint32_t addr_code; - uint32_t suart_status; - uint32_t pmu_bat_shutdown_ltf; - uint32_t pmu_bat_shutdown_htf; - uint32_t pmu_pwroff_vol; - uint32_t power_start; - uint32_t powchk_used; - uint32_t power_reg; - uint32_t system_power; - struct dram_para dram_para; - struct arisc_freq_voltage vf[ARISC_DVFS_VF_TABLE_MAX]; - uint32_t power_regu_tree[DM_MAX]; -} arisc_para_t; - -#define ARISC_PARA_SIZE (sizeof(struct arisc_para)) - -#endif /* __ARISC_PARA_H__ */ diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_axp.c b/plat/sun50iw1p1/scp/interfaces/arisc_axp.c deleted file mode 100644 index a33cfe2..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_axp.c +++ /dev/null @@ -1,402 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_axp.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -/* nmi isr node, record current nmi interrupt handler and argument */ -nmi_isr_t nmi_isr_node[2]; - -/** - * register call-back function, call-back function is for arisc notify some event to ac327, - * axp/rtc interrupt for external interrupt NMI. - * @type: nmi type, pmu/rtc; - * @func: call-back function; - * @para: parameter for call-back function; - * - * @return: result, 0 - register call-back function successed; - * !0 - register call-back function failed; - * NOTE: the function is like "int callback(void *para)"; - * this function will execute in system ISR. - */ -int arisc_nmi_cb_register(uint32_t type, arisc_cb_t func, void *para) -{ - if (nmi_isr_node[type].handler) { - if(func == nmi_isr_node[type].handler) { - ARISC_WRN("nmi interrupt handler register already\n"); - return 0; - } - /* just output warning message, overlay handler */ - ARISC_WRN("nmi interrupt handler register already\n"); - return -EINVAL; - } - nmi_isr_node[type].handler = func; - nmi_isr_node[type].arg = para; - - return 0; -} - - -/** - * unregister call-back function. - * @type: nmi type, pmu/rtc; - * @func: call-back function which need be unregister; - */ -void arisc_nmi_cb_unregister(uint32_t type, arisc_cb_t func) -{ - if ((nmi_isr_node[type].handler) != (func)) { - /* invalid handler */ - ARISC_WRN("invalid handler for unreg\n\n"); - return ; - } - nmi_isr_node[type].handler = NULL; - nmi_isr_node[type].arg = NULL; -} - -int arisc_disable_nmi_irq(void) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_AXP_DISABLE_IRQ; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_enable_nmi_irq(void) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_AXP_ENABLE_IRQ; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_clear_nmi_status(void) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_CLR_NMI_STATUS; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_set_nmi_trigger(uint32_t type) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_NMI_TRIGGER; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - pmessage->paras[0] = type; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_axp_get_chip_id(unsigned char *chip_id) -{ - int i; - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_AXP_GET_CHIP_ID; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - memset((void *)pmessage->paras, 0, 16); - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* |paras[0] |paras[1] |paras[2] |paras[3] | - * |chip_id[0~3]|chip_id[4~7]|chip_id[8~11]|chip_id[12~15]| - */ - /* copy message readout data to user data buffer */ - for (i = 0; i < 4; i++) { - chip_id[i] = (pmessage->paras[0] >> (i * 8)) & 0xff; - chip_id[4 + i] = (pmessage->paras[1] >> (i * 8)) & 0xff; - chip_id[8 + i] = (pmessage->paras[2] >> (i * 8)) & 0xff; - chip_id[12 + i] = (pmessage->paras[3] >> (i * 8)) & 0xff; - } - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_set_led_bln(uint32_t *paras) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_LED_BLN; - pmessage->paras[0] = paras[0]; - pmessage->paras[1] = paras[1]; - pmessage->paras[2] = paras[2]; - pmessage->paras[3] = paras[3]; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; - -} - -#if (defined CONFIG_ARCH_SUN8IW5P1) || (defined CONFIG_ARCH_SUN50IW1P1) -int arisc_adjust_pmu_chgcur(uint32_t max_chgcur, uint32_t chg_ic_temp, uint32_t flag) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_AXP_SET_PARAS; - pmessage->paras[0] = chg_ic_temp; - pmessage->paras[1] = max_chgcur; - pmessage->paras[2] = flag; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} -#endif - -int arisc_set_pwr_tree(uint32_t *pwr_tree) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_PWR_TREE; - memcpy((void *)pmessage->paras, (void *)pwr_tree, sizeof(int)*DM_MAX); - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_axp_int_notify(struct arisc_message *pmessage) -{ - uint32_t type = pmessage->paras[0]; - uint32_t ret = 0; - - if (type & NMI_INT_TYPE_PMU_OFFSET) { - /* call pmu interrupt handler */ - if (nmi_isr_node[NMI_INT_TYPE_PMU].handler == NULL) { - ARISC_WRN("pmu irq handler not install\n"); - return 1; - } - - ARISC_INF("call pmu interrupt handler\n"); - ret |= (*(nmi_isr_node[NMI_INT_TYPE_PMU].handler))(nmi_isr_node[NMI_INT_TYPE_PMU].arg); - } - if (type & NMI_INT_TYPE_RTC_OFFSET) - { - /* call rtc interrupt handler */ - if (nmi_isr_node[NMI_INT_TYPE_RTC].handler == NULL) { - ARISC_WRN("rtc irq handler not install\n"); - return 1; - } - - ARISC_INF("call rtc interrupt handler\n"); - ret |= (*(nmi_isr_node[NMI_INT_TYPE_RTC].handler))(nmi_isr_node[NMI_INT_TYPE_RTC].arg); - } - - return ret; -} - -int arisc_pmu_set_voltage(uint32_t type, uint32_t voltage) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_PMU_VOLT; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - pmessage->paras[0] = type; - pmessage->paras[1] = voltage; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_pmu_get_voltage(uint32_t type, uint32_t *voltage) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_GET_PMU_VOLT; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - pmessage->paras[0] = type; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - *voltage = pmessage->paras[1]; - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_debug_level.c b/plat/sun50iw1p1/scp/interfaces/arisc_debug_level.c deleted file mode 100644 index e1e5346..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_debug_level.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_debug_level.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -/** - * set arisc debug level. - * @level: arisc debug level; - * - * return: 0 - set arisc debug level successed, !0 - set arisc debug level failed; - */ -int arisc_set_debug_level(unsigned int level) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_ERR("allocate message for debug level request failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_DEBUG_LEVEL; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->paras[0] = level; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send set debug level request to arisc */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_set_uart_baudrate(uint32_t baudrate) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_ERR("allocate message for set baudrate request failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_UART_BAUDRATE; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->paras[0] = baudrate; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -int arisc_report_error_info(struct arisc_message *pmessage) -{ - uint32_t id = pmessage->paras[0]; - - switch(id) { - case ERR_NMI_INT_TIMEOUT: { - ARISC_ERR("arisc report error info: nmi int response timeout\n"); - break; - } - default: { - ARISC_ERR("invaid arisc report error infomation id:%u\n", id); - return -EINVAL; - } - } - - return 0; -} - -/** - * set paras. - * - * return: 0 - set paras successed, !0 - set paras failed; - */ -int arisc_set_paras(void) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_ERR("allocate message for set paras request failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_PARAS; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send set debug level request to arisc */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -}
\ No newline at end of file diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_dram_crc.c b/plat/sun50iw1p1/scp/interfaces/arisc_dram_crc.c deleted file mode 100644 index fd82232..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_dram_crc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_dram_crc.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -/** - * set arisc debug dram crc paras. - * @dram_crc_en: arisc debug dram crc enable or disable; - * @dram_crc_srcaddr: source address of dram crc area - * @dram_crc_len: lenght of dram crc area - * - * return: 0 - set arisc debug dram crc paras successed, !0 - set arisc debug dram crc paras failed; - */ -int arisc_set_dram_crc_paras(unsigned int dram_crc_en, unsigned int dram_crc_srcaddr, unsigned int dram_crc_len) -{ - struct arisc_message *pmessage; - - ARISC_INF("en:%x, src:%x len:%x\n", dram_crc_en, dram_crc_srcaddr, dram_crc_len); - - /* allocate a message frame */ - pmessage = arisc_message_allocate(0); - if (pmessage == NULL) { - ARISC_ERR("allocate message for seting dram crc paras request failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SET_DEBUG_DRAM_CRC_PARAS; - pmessage->paras[0] = dram_crc_en; - pmessage->paras[1] = dram_crc_srcaddr; - pmessage->paras[2] = dram_crc_len; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - - /* send set debug level request to arisc */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - return 0; -} - diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_dvfs.c b/plat/sun50iw1p1/scp/interfaces/arisc_dvfs.c deleted file mode 100644 index c7c50cc..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_dvfs.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_dvfs.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -static int dvfs_err_cb(void *arg) -{ - ARISC_ERR("dvfs error\n"); - - return 0; -} - -/* - * set specific pll target frequency. - * @freq: target frequency to be set, based on KHZ; - * @pll: which pll will be set - * @mode: the attribute of message, whether syn or asyn; - * @cb: callback handler; - * @cb_arg: callback handler arguments; - * - * return: result, 0 - set frequency successed, - * !0 - set frequency failed; - */ -int arisc_dvfs_set_cpufreq(uint32_t freq, uint32_t pll, uint32_t mode) -{ - unsigned int msg_attr = 0; - struct arisc_message *pmessage; - int result = 0; - - if (mode & ARISC_DVFS_SYN) { - msg_attr |= ARISC_MESSAGE_ATTR_HARDSYN; - } - - /* allocate a message frame */ - pmessage = arisc_message_allocate(msg_attr); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message - * - * |paras[0]|paras[1]| - * |freq |pll | - */ - pmessage->type = ARISC_CPUX_DVFS_REQ; - pmessage->paras[0] = freq; - pmessage->paras[1] = pll; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = dvfs_err_cb; - pmessage->cb.arg = NULL; - - ARISC_INF("arisc dvfs request : %d\n", freq); - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* dvfs mode : syn or not */ - if (mode & ARISC_DVFS_SYN) { - result = pmessage->result; - arisc_message_free(pmessage); - } - - return result; -} diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_loopback.c b/plat/sun50iw1p1/scp/interfaces/arisc_loopback.c deleted file mode 100644 index 029d4dc..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_loopback.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_loopback.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -int arisc_message_loopback(void) -{ - int result; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_MESSAGE_LOOPBACK; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->paras[0] = 11; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_rsb.c b/plat/sun50iw1p1/scp/interfaces/arisc_rsb.c deleted file mode 100644 index f3b685b..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_rsb.c +++ /dev/null @@ -1,329 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_rsb.c - * - * Copyright (c) 2013 Allwinner. - * 2013-07-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -#if (defined CONFIG_ARCH_SUN8IW3P1) || (defined CONFIG_ARCH_SUN8IW5P1) || (defined CONFIG_ARCH_SUN8IW6P1) || \ - (defined CONFIG_ARCH_SUN8IW7P1) || (defined CONFIG_ARCH_SUN8IW9P1) || (defined CONFIG_ARCH_SUN9IW1P1) || \ - (defined CONFIG_ARCH_SUN50IW1P1) - -/* - * used for indicate aduio codec been initialized, - * modules like audio & trc mabye initialize, - * but audio codec only can be initialize once - */ -static int audio_codec_init = 0; - -/** - * rsb read block data. - * @cfg: point of arisc_rsb_block_cfg struct; - * - * return: result, 0 - read register successed, - * !0 - read register failed or the len more then max len; - */ -int arisc_rsb_read_block_data(uint32_t *paras) -{ - int result; - struct arisc_message *pmessage; - - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_RSB_READ_BLOCK_DATA; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - memcpy((void *)pmessage->paras, (const void *)paras, sizeof(pmessage->paras)); - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - memcpy((void *)paras, (const void *)pmessage->paras, sizeof(pmessage->paras)); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - - -/** - * rsb write block data. - * @cfg: point of arisc_rsb_block_cfg struct; - * - * return: result, 0 - write register successed, - * !0 - write register failedor the len more then max len; - */ -int arisc_rsb_write_block_data(uint32_t *paras) -{ - int result; - struct arisc_message *pmessage; - - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - /* initialize message */ - pmessage->type = ARISC_RSB_WRITE_BLOCK_DATA; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - memcpy((void *)pmessage->paras, (const void *)paras, sizeof(pmessage->paras)); - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - - -/** - * rsb read pmu reg. - * @addr: pmu reg addr; - * - * return: if read pmu reg successed, return data of pmu reg; - * if read pmu reg failed, return -1. - */ -uint8_t arisc_rsb_read_pmu_reg(uint32_t addr) -{ - int result; - uint32_t paras[22]; - uint32_t data = 0; - - /* - * package address and data to message->paras, - * message->paras data layout: - * |para[0] |para[1]|para[2] |para[3]|para[4]|para[5]|para[6]| - * |(len|datatype)|devaddr|regaddr0~3|data0 |data1 |data2 |data3 | - */ - memset((void *)paras, 0, sizeof(uint32_t) * 6); - paras[0] = ((1 & 0xffff) | ((RSB_DATA_TYPE_BYTE << 16) & 0xffff0000)); - paras[1] = 0x2d; - paras[2] = addr&0xff; - - result = arisc_rsb_read_block_data(paras); - if (!result) { - data = paras[3]; - } else { - ARISC_ERR("arisc rsb read pmu reg 0x%x err\n", addr); - return -1; - } - - ARISC_INF("read pmu reg 0x%x:0x%x\n", addr, data); - - return data; -} - - -/** - * rsb write pmu reg. - * @addr: pmu reg addr; - * @data: pmu reg data; - * - * return: result, 0 - write register successed, - * !0 - write register failedor the len more then max len; - */ -int arisc_rsb_write_pmu_reg(uint32_t addr, uint32_t data) -{ - int result; - uint32_t paras[22]; - - /* - * package address and data to message->paras, - * message->paras data layout: - * |para[0] |para[1]|para[2] |para[3]|para[4]|para[5]|para[6]| - * |(len|datatype)|devaddr|regaddr0~3|data0 |data1 |data2 |data3 | - */ - memset((void *)paras, 0, sizeof(uint32_t) * 6); - paras[0] = ((1 & 0xffff) | ((RSB_DATA_TYPE_BYTE << 16) & 0xffff0000)); - paras[1] = 0x2d; - paras[2] = addr&0xff; - paras[3] = data&0xff; - - result = arisc_rsb_write_block_data(paras); - if (result) { - ARISC_ERR("arisc rsb write pmu reg 0x%x:0x%x err\n", addr, data); - } - ARISC_INF("write pmu reg 0x%x:0x%x\n", addr, data); - - return result; -} - - -/** - * rsb bits operation sync. - * @cfg: point of arisc_rsb_bits_cfg struct; - * - * return: result, 0 - bits operation successed, - * !0 - bits operation failed, or the len more then max len; - * - * rsb clear bits internal: - * data = rsb_read(regaddr); - * data = data & (~mask); - * rsb_write(regaddr, data); - * - * rsb set bits internal: - * data = rsb_read(addr); - * data = data | mask; - * rsb_write(addr, data); - * - */ -int rsb_bits_ops_sync(uint32_t *paras) -{ - int result; - struct arisc_message *pmessage; - - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - /* initialize message */ - pmessage->type = ARISC_RSB_BITS_OPS_SYNC; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - memcpy((void *)pmessage->paras, (const void *)paras, sizeof(pmessage->paras)); - - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -/** - * rsb set interface mode. - * @devaddr: rsb slave device address; - * @regaddr: register address of rsb slave device; - * @data: data which to init rsb slave device interface mode; - * - * return: result, 0 - set interface mode successed, - * !0 - set interface mode failed; - */ -int arisc_rsb_set_interface_mode(uint32_t devaddr, uint32_t regaddr, uint32_t data) -{ - int result; - struct arisc_message *pmessage; - - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_RSB_SET_INTERFACE_MODE; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* - * package address and data to message->paras, - * message->paras data layout: - * |para[0]|para[1]|para[2]| - * |devaddr|regaddr|data | - */ - pmessage->paras[0] = devaddr; - pmessage->paras[1] = regaddr; - pmessage->paras[2] = data; - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} - -/** - * rsb set runtime slave address. - * @devaddr: rsb slave device address; - * @rtsaddr: rsb slave device's runtime slave address; - * - * return: result, 0 - set rsb runtime address successed, - * !0 - set rsb runtime address failed; - */ -int arisc_rsb_set_rtsaddr(uint32_t devaddr, uint32_t rtsaddr) -{ - int result; - struct arisc_message *pmessage; - - /* check audio codec has been initialized */ - if (devaddr == RSB_DEVICE_SADDR7) { - if (audio_codec_init) - return 0; - else - audio_codec_init = 1; - } - - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_RSB_SET_RTSADDR; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - /* - * package address and data to message->paras, - * message->paras data layout: - * |para[0]|para[1]| - * |devaddr|rtsaddr| - */ - pmessage->paras[0] = devaddr; - pmessage->paras[1] = rtsaddr; - /* send message use hwmsgbox */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* free message */ - result = pmessage->result; - arisc_message_free(pmessage); - - return result; -} -#endif diff --git a/plat/sun50iw1p1/scp/interfaces/arisc_standby.c b/plat/sun50iw1p1/scp/interfaces/arisc_standby.c deleted file mode 100644 index d570ddf..0000000 --- a/plat/sun50iw1p1/scp/interfaces/arisc_standby.c +++ /dev/null @@ -1,286 +0,0 @@ -/* - * drivers/arisc/interfaces/arisc_standby.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "../arisc_i.h" - -/* record super-standby wakeup event */ -static unsigned long wakeup_event = 0; -static unsigned long dram_crc_error = 0; -static unsigned long dram_crc_total_count = 0; -static unsigned long dram_crc_error_count = 0; - -/** - * cpu operations. - * @mpidr: cpu id; - * @entrypoint: cpu resume entrypoint; - * @cpu_state: cpu state; - * @cluster_state: cluster state; - * - * return: result, 0 - cpu operations successed, - * !0 - cpu operations failed; - */ -int arisc_cpu_op(uint32_t mpidr, uint32_t entrypoint, arisc_power_state_t cpu_state, - arisc_power_state_t cluster_state) -{ - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(0); - if (pmessage == NULL) { - ARISC_ERR("allocate message for cpu op request failed\n"); - return -ENOMEM; - } - - pmessage->type = ARISC_CPU_OP_REQ; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - pmessage->paras[0] = mpidr; - pmessage->paras[1] = entrypoint; - pmessage->paras[2] = cpu_state; - pmessage->paras[3] = cluster_state; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - - /* send enter cpu operations request to arisc */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - return 0; -} - - /** - * system operations. - * @state: system state; - * - * return: result, 0 - system operations successed, - * !0 - system operations failed; - */ -int arisc_system_op(arisc_system_state_t state) -{ - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(0); - if (pmessage == NULL) { - ARISC_ERR("allocate message for sys op request failed\n"); - return -ENOMEM; - } - - pmessage->type = ARISC_SYS_OP_REQ; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - pmessage->paras[0] = state; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - - /* send enter sys operations request to arisc */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - return 0; -} - -/* - * enter cpu idle. - * @para: parameter for enter cpu idle. - * para->flag: 0x01-clear pending, 0x10-enter cpuidle - * para->resume_addr: the address cpu0 will run when exit idle - * - * return: result, 0 - super standby successed, - * !0 - super standby failed; - */ -int arisc_enter_cpuidle(arisc_cb_t cb, void *cb_arg, struct sunxi_enter_idle_para *para) -{ - struct arisc_message *pmessage; /* allocate a message frame */ - pmessage = arisc_message_allocate(0); - if (pmessage == NULL) { - ARISC_ERR("allocate message for super-standby request failed\n"); - return -ENOMEM; - } - pmessage->type = ARISC_CPUIDLE_ENTER_REQ; - pmessage->cb.handler = cb; - pmessage->cb.arg = cb_arg; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->paras[0] = para->flags; - pmessage->paras[1] = (unsigned long)para->resume_addr; - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - return 0; -} - -/** - * query super-standby wakeup source. - * @para: point of buffer to store wakeup event informations. - * - * return: result, 0 - query successed, - * !0 - query failed; - */ -int arisc_query_wakeup_source(uint32_t *event) -{ - *event = wakeup_event; - - return 0; -} - -/* - * query super-standby infoation. - * @para: point of array to store power states informations during sst. - * @op: 0:read, 1:set - * - * return: result, 0 - query successed, - * !0 - query failed; - */ -int arisc_query_set_standby_info(struct standby_info_para *para, arisc_rw_type_e op) -{ - struct arisc_message *pmsg; - int result; - - /* allocate a message frame */ - pmsg = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmsg == NULL) { - ARISC_ERR("allocate message for query standby info failed\n"); - return -ENOMEM; - } - - /* check standby_info_para size valid or not */ - if (sizeof(struct standby_info_para) > sizeof(pmsg->paras)) { - ARISC_ERR("standby info parameters number too long\n"); - return -EINVAL; - } - - /* initialize message */ - pmsg->type = ARISC_STANDBY_INFO_REQ; - pmsg->cb.handler = NULL; - pmsg->cb.arg = NULL; - pmsg->private = (void *)op; - if (ARISC_WRITE == op) { - memcpy((void *)pmsg->paras, (const void *)para, sizeof(struct standby_info_para)); - } - pmsg->state = ARISC_MESSAGE_INITIALIZED; - - /* send query sst info request to arisc */ - arisc_hwmsgbox_send_message(pmsg, ARISC_SEND_MSG_TIMEOUT); - if (ARISC_READ == op) - memcpy((void *)para, (void *)pmsg->paras, sizeof(struct standby_info_para)); - - /* free message */ - result = pmsg->result; - arisc_message_free(pmsg); - - return result; -} - -/* - * query super-standby dram crc result. - * @para: point of buffer to store dram crc result informations. - * - * return: result, 0 - query successed, - * !0 - query failed; - */ -int arisc_query_dram_crc_result(unsigned long *perror, unsigned long *ptotal_count, - unsigned long *perror_count) -{ - *perror = dram_crc_error; - *ptotal_count = dram_crc_total_count; - *perror_count = dram_crc_error_count; - - return 0; -} - -int arisc_set_dram_crc_result(unsigned long error, unsigned long total_count, - unsigned long error_count) -{ - dram_crc_error = error; - dram_crc_total_count = total_count; - dram_crc_error_count = error_count; - - return 0; -} - -/** - * notify arisc cpux restored. - * @para: none. - * - * return: result, 0 - notify successed, !0 - notify failed; - */ -int arisc_cpux_ready_notify(void) -{ - struct arisc_message *pmessage; - - /* notify hwspinlock and hwmsgbox resume first */ - arisc_hwmsgbox_standby_resume(); - arisc_hwspinlock_standby_resume(); - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - - /* initialize message */ - pmessage->type = ARISC_SSTANDBY_RESTORE_NOTIFY; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - - /* record wakeup event */ - wakeup_event = pmessage->paras[0]; - if (arisc_debug_dram_crc_en) { - dram_crc_error = pmessage->paras[1]; - dram_crc_total_count++; - dram_crc_error_count += (dram_crc_error ? 1 : 0); - } - - /* free message */ - arisc_message_free(pmessage); - - return 0; -} - -int arisc_config_ir_paras(uint32_t ir_code, uint32_t ir_addr) -{ - int result = 0; - struct arisc_message *pmessage; - - /* allocate a message frame */ - pmessage = arisc_message_allocate(ARISC_MESSAGE_ATTR_HARDSYN); - if (pmessage == NULL) { - ARISC_WRN("allocate message failed\n"); - return -ENOMEM; - } - /* initialize message */ - pmessage->type = ARISC_SET_IR_PARAS; - pmessage->paras[0] = ir_code; - pmessage->paras[1] = ir_addr; - pmessage->state = ARISC_MESSAGE_INITIALIZED; - pmessage->cb.handler = NULL; - pmessage->cb.arg = NULL; - - ARISC_INF("ir power key:0x%x, addr:0x%x\n", ir_code, ir_addr); - - /* send request message */ - arisc_hwmsgbox_send_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - if (pmessage->result) { - ARISC_WRN("config ir power key code [%d] fail\n", pmessage->paras[0]); - result = -EINVAL; - } - - /* free allocated message */ - arisc_message_free(pmessage); - - return result; -} diff --git a/plat/sun50iw1p1/scp/interfaces/interfaces.mk b/plat/sun50iw1p1/scp/interfaces/interfaces.mk deleted file mode 100644 index 1571046..0000000 --- a/plat/sun50iw1p1/scp/interfaces/interfaces.mk +++ /dev/null @@ -1,37 +0,0 @@ -# -# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# Neither the name of ARM nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -BL31_SOURCES += plat/sun50iw1p1/scp/interfaces/arisc_loopback.c \ - plat/sun50iw1p1/scp/interfaces/arisc_dvfs.c \ - plat/sun50iw1p1/scp/interfaces/arisc_rsb.c\ - plat/sun50iw1p1/scp/interfaces/arisc_axp.c \ - plat/sun50iw1p1/scp/interfaces/arisc_standby.c \ - plat/sun50iw1p1/scp/interfaces/arisc_dram_crc.c \ - plat/sun50iw1p1/scp/interfaces/arisc_debug_level.c diff --git a/plat/sun50iw1p1/scp/message_manager/message_manager.c b/plat/sun50iw1p1/scp/message_manager/message_manager.c deleted file mode 100644 index 46b8969..0000000 --- a/plat/sun50iw1p1/scp/message_manager/message_manager.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/message_manager/message_manager.c - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - -#include "message_manager_i.h" - -/* the start and end of message pool */ -static struct arisc_message *message_start; -static struct arisc_message *message_end; - -/* spinlock for this module */ -static spinlock_t msg_mgr_lock; - -/* message cache manager */ -static struct arisc_message_cache message_cache; - -static void *arisc_message_pool_base; -static uint32_t arisc_message_pool_size; - -/** - * initialize message manager. - * @para: none. - * - * returns: 0 if initialize succeeded, others if failed. - */ -int arisc_message_manager_init(void *addr, uint32_t size) -{ - int i; - - arisc_message_pool_base = addr; - arisc_message_pool_size = size; - - /* initialize message pool start and end */ - message_start = (struct arisc_message *)(arisc_message_pool_base); - message_end = (struct arisc_message *)((ptrdiff_t)arisc_message_pool_base + arisc_message_pool_size); - - //memset((void *)message_start, 0, arisc_message_pool_size); - - /* initialize message_cache */ - for (i = 0; i < ARISC_MESSAGE_CACHED_MAX; i++) { - message_cache.cache[i] = NULL; - } - message_cache.number = 0; - - return 0; -} - -/** - * exit message manager. - * @para: none. - * - * returns: 0 if exit succeeded, others if failed. - */ -int arisc_message_manager_exit(void) -{ - return 0; -} - -static int arisc_message_invalid(struct arisc_message *pmessage) -{ - if ((pmessage >= message_start) && - (pmessage < message_end)) { - /* valid arisc message */ - return 0; - } - /* invalid arisc message */ - return 1; -} - -/** - * allocate one message frame. mainly use for send message by message-box, - * the message frame allocate form messages pool shared memory area. - * @para: none. - * - * returns: the pointer of allocated message frame, NULL if failed; - */ -struct arisc_message *arisc_message_allocate(unsigned int msg_attr) -{ - struct arisc_message *pmessage = NULL; - struct arisc_message *palloc = NULL; - - /* first find in message_cache */ - spin_lock(&msg_mgr_lock); - if (message_cache.number) { - ARISC_INF("arisc message_cache.number = 0x%x.\n", message_cache.number); - message_cache.number--; - palloc = message_cache.cache[message_cache.number]; - ARISC_INF("message [%llx] allocate from message_cache\n", palloc); - if (arisc_message_invalid(palloc)) { - ARISC_ERR("allocate cache message [%llx] invalid\n", palloc); - } - } - spin_unlock(&msg_mgr_lock); - if (arisc_message_invalid(palloc)) { - /* - * cached message_cache finded fail, - * use spinlock 0 to exclusive with arisc. - */ - arisc_hwspin_lock(AW_MSG_HWSPINLOCK); - - /* search from the start of message pool every time. */ - pmessage = message_start; - while (pmessage < message_end) { - if (pmessage->state == ARISC_MESSAGE_FREED) { - /* find free message in message pool, allocate it */ - palloc = pmessage; - palloc->state = ARISC_MESSAGE_ALLOCATED; - ARISC_INF("message [%llx] allocate from message pool\n", palloc); - break; - } - /* next message frame */ - pmessage++; - } - /* unlock hwspinlock 0 */ - arisc_hwspin_unlock(AW_MSG_HWSPINLOCK); - } - if (arisc_message_invalid(palloc)) { - ARISC_ERR("allocate message [%llx] frame is invalid\n", palloc); - return NULL; - } - /* initialize messgae frame */ - palloc->next = NULL; - palloc->attr = msg_attr; - palloc->private = NULL; - - return palloc; -} - -/** - * free one message frame. mainly use for process message finished, - * free it to messages pool or add to free message queue. - * @pmessage: the pointer of free message frame. - * - * returns: none. - */ -void arisc_message_free(struct arisc_message *pmessage) -{ - struct arisc_message *free_message = pmessage; - - /* check this message valid or not */ - if (arisc_message_invalid(free_message)) { - ARISC_ERR("free invalid arisc message [%llx]\n", free_message); - return; - } - - /* try to free to free_list first */ - spin_lock(&msg_mgr_lock); - if (message_cache.number < ARISC_MESSAGE_CACHED_MAX) { - ARISC_INF("insert message [%llx] to message_cache\n", free_message); - ARISC_INF("message_cache number : %d\n", message_cache.number); - /* cached this message, message state: ALLOCATED */ - message_cache.cache[message_cache.number] = free_message; - message_cache.number++; - free_message->next = NULL; - free_message->state = ARISC_MESSAGE_ALLOCATED; - free_message = NULL; - } - spin_unlock(&msg_mgr_lock); - - /* try to free message to pool if free to cache fail */ - if (free_message) { - /* free to message pool,set message state as FREED. */ - arisc_hwspin_lock(AW_MSG_HWSPINLOCK); - ARISC_INF("insert message [%llx] to message pool\n", free_message); - free_message->state = ARISC_MESSAGE_FREED; - free_message->next = NULL; - arisc_hwspin_unlock(AW_MSG_HWSPINLOCK); - } -} - -/** - * notify system that one message coming. - * @pmessage: the pointer of coming message frame. - * - * returns: 0 if notify succeeded, other if failed. - */ -int arisc_message_coming_notify(struct arisc_message *pmessage) -{ - int ret; - - /* ac327 receive message to arisc */ - ARISC_INF("-------------------------------------------------------------\n"); - ARISC_INF(" MESSAGE FROM ARISC \n"); - ARISC_INF("message addr : %llx\n", pmessage); - ARISC_INF("message type : %x\n", pmessage->type); - ARISC_INF("message attr : %x\n", pmessage->attr); - ARISC_INF("-------------------------------------------------------------\n"); - - /* message per-process */ - pmessage->state = ARISC_MESSAGE_PROCESSING; - - /* process message */ - switch (pmessage->type) { - case ARISC_AXP_INT_COMING_NOTIFY: { - ARISC_INF("pmu interrupt coming notify\n"); - ret = arisc_axp_int_notify(pmessage); - pmessage->result = ret; - break; - } - case ARISC_AUDIO_PERDONE_NOTIFY: { - ARISC_INF("audio perdone notify\n"); - ret = arisc_audio_perdone_notify(pmessage); - pmessage->result = ret; - break; - } - case ARISC_REPORT_ERR_INFO: { - ARISC_INF("arisc report error info\n"); - ret = arisc_report_error_info(pmessage); - pmessage->result = ret; - break; - } - - default : { - ARISC_ERR("invalid message type for ac327 process\n"); - ARISC_ERR("message addr : %llx\n", pmessage); - ARISC_ERR("message state : %x\n", pmessage->state); - ARISC_ERR("message attr : %x\n", pmessage->attr); - ARISC_ERR("message type : %x\n", pmessage->type); - ARISC_ERR("message result : %x\n", pmessage->result); - ret = -EINVAL; - break; - } - } - /* message post process */ - pmessage->state = ARISC_MESSAGE_PROCESSED; - if (pmessage->attr & ARISC_MESSAGE_ATTR_HARDSYN) { - /* synchronous message, should feedback process result */ - arisc_hwmsgbox_feedback_message(pmessage, ARISC_SEND_MSG_TIMEOUT); - } else { - /* - * asyn message, no need feedback message result, - * free message directly. - */ - arisc_message_free(pmessage); - } - - return ret; -} - -struct arisc_message *arisc_message_map_to_cpux(uint32_t addr) -{ - struct arisc_message *message; - message = (struct arisc_message *)((ptrdiff_t)addr + (ptrdiff_t)arisc_message_pool_base); - - return message; -} - -uint32_t arisc_message_map_to_cpus(struct arisc_message *message) -{ - uint32_t value = (uint32_t)((ptrdiff_t)message - (ptrdiff_t)arisc_message_pool_base); - - return value; -} - -int arisc_message_valid(struct arisc_message *pmessage) -{ - if ((pmessage >= message_start) && (pmessage < message_end)) { - /* valid message */ - return 1; - } - - return 0; -} - diff --git a/plat/sun50iw1p1/scp/message_manager/message_manager.mk b/plat/sun50iw1p1/scp/message_manager/message_manager.mk deleted file mode 100644 index 806f3ef..0000000 --- a/plat/sun50iw1p1/scp/message_manager/message_manager.mk +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# -# Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# Neither the name of ARM nor the names of its contributors may be used -# to endorse or promote products derived from this software without specific -# prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# - -BL31_SOURCES += plat/sun50iw1p1/scp/message_manager/message_manager.c diff --git a/plat/sun50iw1p1/scp/message_manager/message_manager_i.h b/plat/sun50iw1p1/scp/message_manager/message_manager_i.h deleted file mode 100644 index 54c5383..0000000 --- a/plat/sun50iw1p1/scp/message_manager/message_manager_i.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * arch/arm/mach-sunxi/arisc/message_manager/message_manager_i.h - * - * Copyright (c) 2012 Allwinner. - * 2012-10-01 Written by superm (superm@allwinnertech.com). - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __ARISC_MESSAGE_MANAGER_I_H -#define __ARISC_MESSAGE_MANAGER_I_H - -#include "../include/arisc_includes.h" -#include "../arisc_i.h" - -#define ARISC_SEM_CACHE_MAX (8) - -/* - *the strcuture of message cache, - *main for messages cache management. - */ -typedef struct arisc_message_cache -{ - uint32_t number; /* valid message number */ - struct arisc_message *cache[ARISC_MESSAGE_CACHED_MAX]; /* message cache table */ -} arisc_message_cache_t; - -#endif /* __ARISC_MESSAGE_MANAGER_I_H */ |