123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968 |
- --- a/configure.in
- +++ b/configure.in
- @@ -956,14 +956,15 @@ AC_DEFINE([VMMC],[1],[enable VMMC suppor
- AM_CONDITIONAL(DANUBE, false)
- AM_CONDITIONAL(AR9, false)
- AM_CONDITIONAL(VR9, false)
- +AM_CONDITIONAL(FALCON, false)
- AC_ARG_WITH(device,
- AC_HELP_STRING(
- - [--with-device=DANUBE|TWINPASS|AR9|VR9],
- + [--with-device=DANUBE|TWINPASS|AR9|VR9|FALCON],
- [Set device type, default is DANUBE]
- ),
- [
- if test "$withval" = yes; then
- - AC_MSG_ERROR([Set device type! Valid choices are DANUBE|TWINPASS|AR9|VR9]);
- + AC_MSG_ERROR([Set device type! Valid choices are DANUBE|TWINPASS|AR9|VR9|FALCON]);
- else
- case $withval in
- DANUBE)
- @@ -986,8 +987,13 @@ AC_ARG_WITH(device,
- AC_DEFINE([SYSTEM_VR9],[1],[enable VR9 specific code])
- AM_CONDITIONAL(VR9, true)
- ;;
- + FALCON)
- + AC_MSG_RESULT(FALCON device is used);
- + AC_DEFINE([SYSTEM_FALCON],[1],[enable FALCON specific code])
- + AM_CONDITIONAL(FALCON, true)
- + ;;
- *)
- - AC_MSG_ERROR([Set device type! Valid choices are DANUBE|TWINPASS|AR9|VR9]);
- + AC_MSG_ERROR([Set device type! Valid choices are DANUBE|TWINPASS|AR9|VR9|FALCON]);
- ;;
- esac
- fi
- --- a/src/Makefile.am
- +++ b/src/Makefile.am
- @@ -70,6 +70,11 @@ drv_vmmc_SOURCES +=\
- mps/drv_mps_vmmc_ar9.c
- endif
-
- +if FALCON
- +drv_vmmc_SOURCES +=\
- + mps/drv_mps_vmmc_falcon.c
- +endif
- +
- endif
-
- if PMC_SUPPORT
- --- a/drv_version.h
- +++ b/drv_version.h
- @@ -36,6 +36,10 @@
- #define MIN_FW_MAJORSTEP 2
- #define MIN_FW_MINORSTEP 1
- #define MIN_FW_HOTFIXSTEP 0
- +#elif defined(SYSTEM_FALCON)
- +#define MIN_FW_MAJORSTEP 0
- +#define MIN_FW_MINORSTEP 1
- +#define MIN_FW_HOTFIXSTEP 0
- #else
- #error unknown system
- #endif
- --- a/src/drv_vmmc_bbd.c
- +++ b/src/drv_vmmc_bbd.c
- @@ -34,6 +34,7 @@
- #define VMMC_WL_SDD_BASIC_CFG 0x04000400
- #define VMMC_WL_SDD_RING_CFG 0x04000500
- #define VMMC_WL_SDD_DCDC_CFG 0x04000C00
- +#define VMMC_WL_SDD_MWI_CFG 0x04000600
-
- #define IDLE_EXT_TOGGLE_SLEEP_MS 5
-
- @@ -52,6 +53,8 @@
- #define BBD_VMMC_MAGIC 0x41523921 /* "AR9" */
- #elif defined(SYSTEM_VR9)
- #define BBD_VMMC_MAGIC 0x56523921 /* "VR9" */
- +#elif defined(SYSTEM_FALCON)
- +#define BBD_VMMC_MAGIC 0x46414C43 /* "FALC" */
- #else
- #error system undefined
- #endif
- @@ -525,9 +528,6 @@ static IFX_int32_t VMMC_BBD_BlockHandler
- IFX_uint16_t slic_val;
- IFX_int32_t ret = IFX_SUCCESS;
-
- - TRACE(VMMC, DBG_LEVEL_LOW,
- - ("bbd block with tag 0x%04X passed\n", pBBDblock->tag));
- -
- /* for FXO line allowed blocks are FXO_CRAM and TRANSPARENT */
- if (pCh->pALM->line_type_fxs != IFX_TRUE)
- {
- @@ -686,6 +686,7 @@ static IFX_int32_t VMMC_BBD_BlockHandler
- break;
- }
- } /* if */
- +
- return ret;
- }
-
- @@ -1026,6 +1027,7 @@ static IFX_int32_t vmmc_BBD_WhiteListedC
- }
- case VMMC_WL_SDD_RING_CFG:
- case VMMC_WL_SDD_DCDC_CFG:
- + case VMMC_WL_SDD_MWI_CFG:
- ret = CmdWrite (pCh->pParent, Msg.val, Msg.cmd.LENGTH);
- break;
-
- @@ -1068,7 +1070,7 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
- IFX_uint32_t countWords;
- IFX_uint32_t posBytes = 0;
- IFX_uint8_t lenBytes, *pByte;
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- IFX_uint8_t padBytes = 0;
- #endif
- IFX_uint16_t cram_offset, cram_crc,
- @@ -1088,7 +1090,7 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
- #ifdef SYSTEM_DANUBE
- /* CMD1 is a COP command */
- pCmd[0] = (0x0200) | (pCh->nChannel - 1);
- -#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /* SDD_Coef command */
- pCmd[0] = (0x0400) | (pCh->nChannel - 1);
- pCmd[1] = (0x0D00);
- @@ -1111,7 +1113,7 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
- pCmd[1] = ((cram_offset + (posBytes >> 1)) << 8);
- /* set CRAM data while taking care of endianess */
- cpb2w (&pCmd[2], &pByte[posBytes], lenBytes);
- -#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /* calculate length to download (in words = 16bit),
- maximum allowed length for this message is 56 Bytes = 28 Words */
- if (countWords > ((MAX_CMD_WORD - CMD_HDR_CNT - 1)))
- @@ -1140,7 +1142,7 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
- /* write Data */
- #if defined SYSTEM_DANUBE
- ret = CmdWrite (pCh->pParent, (IFX_uint32_t *) pCmd, lenBytes);
- -#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- #if 1
- /* lenBytes + 2 bytes for block offset/length which are not calculated
- in the download progress */
- --- a/src/mps/drv_mps_version.h
- +++ b/src/mps/drv_mps_version.h
- @@ -17,7 +17,7 @@
- #define VERSIONSTEP 2
- #define VERS_TYPE 5
-
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- #define IFX_MPS_PLATFORM_NAME "MIPS34KEc"
- #elif defined(SYSTEM_DANUBE)
- #define IFX_MPS_PLATFORM_NAME "MIPS24KEc"
- --- a/src/mps/drv_mps_vmmc_linux.c
- +++ b/src/mps/drv_mps_vmmc_linux.c
- @@ -2229,7 +2229,7 @@ IFX_int32_t __init ifx_mps_init_module (
- #if defined(CONFIG_MIPS) && !defined(CONFIG_MIPS_UNCACHED)
- #if defined(SYSTEM_DANUBE)
- bDoCacheOps = IFX_TRUE; /* on Danube always perform cache ops */
- -#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /* on AR9/VR9 cache is configured by BSP;
- here we check whether the D-cache is shared or partitioned;
- 1) in case of shared D-cache all cache operations are omitted;
- @@ -2259,7 +2259,8 @@ IFX_int32_t __init ifx_mps_init_module (
-
- /* reset the device before initializing the device driver */
- ifx_mps_reset ();
- - result = request_irq (INT_NUM_IM4_IRL18,
- +
- + result = request_irq (INT_NUM_IM4_IRL18,
- #ifdef LINUX_2_6
- ifx_mps_ad0_irq, 0x0
- #else /* */
- @@ -2400,7 +2401,7 @@ IFX_int32_t __init ifx_mps_init_module (
- if (result = ifx_mps_init_gpt_danube ())
- return result;
- #endif /*DANUBE*/
- - TRACE (MPS, DBG_LEVEL_HIGH, ("Downloading Firmware...\n"));
- + TRACE (MPS, DBG_LEVEL_HIGH, ("Downloading Firmware...\n"));
- ifx_mps_download_firmware (IFX_NULL, (mps_fw *) 0xa0a00000);
- udelay (500);
- TRACE (MPS, DBG_LEVEL_HIGH, ("Providing Buffers...\n"));
- --- /dev/null
- +++ b/src/mps/drv_mps_vmmc_falcon.c
- @@ -0,0 +1,463 @@
- +/******************************************************************************
- +
- + Copyright (c) 2009
- + Lantiq Deutschland GmbH
- + Am Campeon 3; 85579 Neubiberg, Germany
- +
- + For licensing information, see the file 'LICENSE' in the root folder of
- + this software module.
- +
- +****************************************************************************
- + Module : drv_mps_vmmc_falcon.c
- + Description : This file contains the implementation of the FALC-ON specific
- + driver functions.
- +*******************************************************************************/
- +
- +/* ============================= */
- +/* Includes */
- +/* ============================= */
- +#include "drv_config.h"
- +
- +#if defined(SYSTEM_FALCON) /* defined in drv_config.h */
- +
- +/* lib_ifxos headers */
- +#include "ifx_types.h"
- +#include "ifxos_linux_drv.h"
- +#include "ifxos_copy_user_space.h"
- +#include "ifxos_event.h"
- +#include "ifxos_lock.h"
- +#include "ifxos_select.h"
- +#include "ifxos_interrupt.h"
- +#include <linux/gpio.h>
- +#include <sys1_reg.h>
- +#include <falcon.h>
- +#include <falcon_irq.h>
- +#include <vpe.h>
- +#include <sysctrl.h>
- +void (*ifx_bsp_basic_mps_decrypt)(unsigned int addr, int n) = (void (*)(unsigned int, int))0xbf000290;
- +
- +#define IFX_MPS_SRAM IFXMIPS_MPS_SRAM
- +
- +/*#define USE_PLAIN_VOICE_FIRMWARE*/
- +/* board specific headers */
- +
- +/* device specific headers */
- +#include "drv_mps_vmmc.h"
- +#include "drv_mps_vmmc_dbg.h"
- +#include "drv_mps_vmmc_device.h"
- +
- +/* ============================= */
- +/* Local Macros & Definitions */
- +/* ============================= */
- +/* Firmware watchdog timer counter address */
- +#define VPE1_WDOG_CTR_ADDR ((IFX_uint32_t)((IFX_uint8_t* )IFX_MPS_SRAM + 432))
- +
- +/* Firmware watchdog timeout range, values in ms */
- +#define VPE1_WDOG_TMOUT_MIN 20
- +#define VPE1_WDOG_TMOUT_MAX 5000
- +
- +/* ============================= */
- +/* Global variable definition */
- +/* ============================= */
- +extern mps_comm_dev *pMPSDev;
- +
- +/* ============================= */
- +/* Global function declaration */
- +/* ============================= */
- +IFX_void_t ifx_mps_release (IFX_void_t);
- +extern IFX_uint32_t ifx_mps_reset_structures (mps_comm_dev * pMPSDev);
- +extern IFX_int32_t ifx_mps_bufman_close (IFX_void_t);
- +IFX_int32_t ifx_mps_wdog_callback (IFX_uint32_t wdog_cleared_ok_count);
- +extern IFXOS_event_t fw_ready_evt;
- +/* ============================= */
- +/* Local function declaration */
- +/* ============================= */
- +static IFX_int32_t ifx_mps_fw_wdog_start_ar9(IFX_void_t);
- +
- +/* ============================= */
- +/* Local variable definition */
- +/* ============================= */
- +static IFX_int32_t vpe1_started = 0;
- +/* VMMC watchdog timer callback */
- +IFX_int32_t (*ifx_wdog_callback) (IFX_uint32_t flags) = IFX_NULL;
- +
- +/* ============================= */
- +/* Local function definition */
- +/* ============================= */
- +
- +/******************************************************************************
- + * AR9 Specific Routines
- + ******************************************************************************/
- +
- +/**
- + * Start AR9 EDSP firmware watchdog mechanism.
- + * Called after download and startup of VPE1.
- + *
- + * \param none
- + * \return 0 IFX_SUCCESS
- + * \return -1 IFX_ERROR
- + * \ingroup Internal
- + */
- +IFX_int32_t ifx_mps_fw_wdog_start_ar9()
- +{
- + return IFX_SUCCESS;
- +}
- +
- +/**
- + * Firmware download to Voice CPU
- + * This function performs a firmware download to the coprocessor.
- + *
- + * \param pMBDev Pointer to mailbox device structure
- + * \param pFWDwnld Pointer to firmware structure
- + * \return 0 IFX_SUCCESS, firmware ready
- + * \return -1 IFX_ERROR, firmware not downloaded.
- + * \ingroup Internal
- + */
- +IFX_int32_t ifx_mps_download_firmware (mps_mbx_dev *pMBDev, mps_fw *pFWDwnld)
- +{
- + IFX_uint32_t mem, cksum;
- + IFX_uint8_t crc;
- + IFX_boolean_t bMemReqNotPresent = IFX_FALSE;
- +
- + /* VCC register */
- + /* dummy accesss on GTC for GPONC-55, otherwise upper bits are random on read */
- + ltq_r32 ((u32 *)((KSEG1 | 0x1DC000B0)));
- + /* NTR Frequency Select 1536 kHz per default or take existing,
- + NTR Output Enable and NTR8K Output Enable */
- + if ((ltq_r32 ((u32 *)(GPON_SYS_BASE + 0xBC)) & 7) == 0)
- + ltq_w32_mask (0x10187, 0x183, (u32 *)(GPON_SYS_BASE + 0xBC));
- + else
- + ltq_w32_mask (0x10180, 0x180, (u32 *)(GPON_SYS_BASE + 0xBC));
- +#if 0
- + /* BIU-ICU1-IM1_ISR - IM1:FSCT_CMP1=1 and FSC_ROOT=1
- + (0x1f880328 = 0x00002800) */
- + ltq_w32 (0x00002800, (u32 *)(GPON_ICU1_BASE + 0x30));
- +#endif
- + /* copy FW footer from user space */
- + if (IFX_NULL == IFXOS_CpyFromUser(pFW_img_data,
- + pFWDwnld->data+pFWDwnld->length/4-sizeof(*pFW_img_data)/4,
- + sizeof(*pFW_img_data)))
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + (KERN_ERR "[%s %s %d]: copy_from_user error\r\n",
- + __FILE__, __func__, __LINE__));
- + return IFX_ERROR;
- + }
- +
- + mem = pFW_img_data->mem;
- +
- + /* memory requirement sanity check */
- + if ((crc = ~((mem >> 16) + (mem >> 8) + mem)) != (mem >> 24))
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + ("[%s %s %d]: warning, image does not contain size - assuming 1MB!\n",
- + __FILE__, __func__, __LINE__));
- + mem = 1 * 1024 * 1024;
- + bMemReqNotPresent = IFX_TRUE;
- + }
- + else
- + {
- + mem &= 0x00FFFFFF;
- + }
- +
- + /* check if FW image fits in available memory space */
- + if (mem > vpe1_get_max_mem(0))
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + ("[%s %s %d]: error, firmware memory exceeds reserved space (%i > %i)!\n",
- + __FILE__, __func__, __LINE__, mem, vpe1_get_max_mem(0)));
- + return IFX_ERROR;
- + }
- +
- + /* reset the driver */
- + ifx_mps_reset ();
- +
- + /* call BSP to get cpu1 base address */
- + cpu1_base_addr = (IFX_uint32_t *)vpe1_get_load_addr(0);
- +
- + /* check if CPU1 base address is sane
- + \todo: check if address is 1MB aligned,
- + also make it visible in a /proc fs */
- + if (!cpu1_base_addr)
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + (KERN_ERR "IFX_MPS: CPU1 base address is invalid!\r\n"));
- + return IFX_ERROR;
- + }
- + /* further use uncached value */
- + cpu1_base_addr = (IFX_uint32_t *)KSEG1ADDR(cpu1_base_addr);
- +
- + /* free all data buffers that might be currently used by FW */
- + if (IFX_NULL != ifx_mps_bufman_freeall)
- + {
- + ifx_mps_bufman_freeall();
- + }
- +
- + if(FW_FORMAT_NEW)
- + {
- + /* adjust download length */
- + pFWDwnld->length -= (sizeof(*pFW_img_data)-sizeof(IFX_uint32_t));
- + }
- + else
- + {
- + pFWDwnld->length -= sizeof(IFX_uint32_t);
- +
- + /* handle unlikely case if FW image does not contain memory requirement -
- + assumed for old format only */
- + if (IFX_TRUE == bMemReqNotPresent)
- + pFWDwnld->length += sizeof(IFX_uint32_t);
- +
- + /* in case of old FW format always assume that FW is encrypted;
- + use compile switch USE_PLAIN_VOICE_FIRMWARE for plain FW */
- +#ifndef USE_PLAIN_VOICE_FIRMWARE
- + pFW_img_data->enc = 1;
- +#else
- +#warning Using unencrypted firmware!
- + pFW_img_data->enc = 0;
- +#endif /* USE_PLAIN_VOICE_FIRMWARE */
- + /* initializations for the old format */
- + pFW_img_data->st_addr_crc = 2*sizeof(IFX_uint32_t) +
- + FW_AR9_OLD_FMT_XCPT_AREA_SZ;
- + pFW_img_data->en_addr_crc = pFWDwnld->length;
- + pFW_img_data->fw_vers = 0;
- + pFW_img_data->magic = 0;
- + }
- +
- + /* copy FW image to base address of CPU1 */
- + if (IFX_NULL ==
- + IFXOS_CpyFromUser ((IFX_void_t *)cpu1_base_addr,
- + (IFX_void_t *)pFWDwnld->data, pFWDwnld->length))
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + (KERN_ERR "[%s %s %d]: copy_from_user error\r\n", __FILE__,
- + __func__, __LINE__));
- + return IFX_ERROR;
- + }
- +
- + /* process firmware decryption */
- + if (pFW_img_data->enc == 1)
- + {
- + if(FW_FORMAT_NEW)
- + {
- + /* adjust decryption length (avoid decrypting CRC32 checksum) */
- + pFWDwnld->length -= sizeof(IFX_uint32_t);
- + }
- + /* BootROM actually decrypts n+4 bytes if n bytes were passed for
- + decryption. Subtract sizeof(u32) from length to avoid decryption
- + of data beyond the FW image code */
- + pFWDwnld->length -= sizeof(IFX_uint32_t);
- + ifx_bsp_basic_mps_decrypt((unsigned int)cpu1_base_addr, pFWDwnld->length);
- + }
- +
- + /* calculate CRC32 checksum over downloaded image */
- + cksum = ifx_mps_fw_crc32(cpu1_base_addr, pFW_img_data);
- +
- + /* verify the checksum */
- + if(FW_FORMAT_NEW)
- + {
- + if (cksum != pFW_img_data->crc32)
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + ("MPS: FW checksum error: img=0x%08x calc=0x%08x\r\n",
- + pFW_img_data->crc32, cksum));
- + /*return IFX_ERROR;*/
- + }
- + }
- + else
- + {
- + /* just store self-calculated checksum */
- + pFW_img_data->crc32 = cksum;
- + }
- +
- + /* start VPE1 */
- + ifx_mps_release ();
- +#if 0
- + /* start FW watchdog mechanism */
- + ifx_mps_fw_wdog_start_ar9();
- +#endif
- + /* get FW version */
- + return ifx_mps_get_fw_version (0);
- +}
- +
- +
- +/**
- + * Restart CPU1
- + * This function restarts CPU1 by accessing the reset request register and
- + * reinitializes the mailbox.
- + *
- + * \return 0 IFX_SUCCESS, successful restart
- + * \return -1 IFX_ERROR, if reset failed
- + * \ingroup Internal
- + */
- +IFX_int32_t ifx_mps_restart (IFX_void_t)
- +{
- + /* raise reset request for CPU1 and reset driver structures */
- + ifx_mps_reset ();
- + /* Disable GPTC Interrupt to CPU1 */
- + ifx_mps_shutdown_gpt ();
- + /* re-configure GPTC */
- + ifx_mps_init_gpt ();
- + /* let CPU1 run */
- + ifx_mps_release ();
- + /* start FW watchdog mechanism */
- + ifx_mps_fw_wdog_start_ar9();
- + TRACE (MPS, DBG_LEVEL_HIGH, ("IFX_MPS: Restarting firmware..."));
- + return ifx_mps_get_fw_version (0);
- +}
- +
- +/**
- + * Shutdown MPS - stop VPE1
- + * This function stops VPE1
- + *
- + * \ingroup Internal
- + */
- +IFX_void_t ifx_mps_shutdown (IFX_void_t)
- +{
- + if (vpe1_started)
- + {
- + /* stop software watchdog timer */
- + vpe1_sw_wdog_stop (0);
- + /* clean up the BSP callback function */
- + vpe1_sw_wdog_register_reset_handler (IFX_NULL);
- + /* stop VPE1 */
- + vpe1_sw_stop (0);
- + vpe1_started = 0;
- + }
- + /* free GPTC */
- + ifx_mps_shutdown_gpt ();
- +}
- +
- +/**
- + * Reset CPU1
- + * This function causes a reset of CPU1 by clearing the CPU0 boot ready bit
- + * in the reset request register RCU_RST_REQ.
- + * It does not change the boot configuration registers for CPU0 or CPU1.
- + *
- + * \return 0 IFX_SUCCESS, cannot fail
- + * \ingroup Internal
- + */
- +IFX_void_t ifx_mps_reset (IFX_void_t)
- +{
- + /* if VPE1 is already started, stop it */
- + if (vpe1_started)
- + {
- + /* stop software watchdog timer first */
- + vpe1_sw_wdog_stop (0);
- + vpe1_sw_stop (0);
- + vpe1_started = 0;
- + }
- +
- + /* reset driver */
- + ifx_mps_reset_structures (pMPSDev);
- + ifx_mps_bufman_close ();
- + return;
- +}
- +
- +/**
- + * Let CPU1 run
- + * This function starts VPE1
- + *
- + * \return none
- + * \ingroup Internal
- + */
- +IFX_void_t ifx_mps_release (IFX_void_t)
- +{
- + IFX_int_t ret;
- + IFX_int32_t RetCode = 0;
- +
- + /* Start VPE1 */
- + if (IFX_SUCCESS !=
- + vpe1_sw_start ((IFX_void_t *)cpu1_base_addr, 0, 0))
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH, (KERN_ERR "Error starting VPE1\r\n"));
- + return;
- + }
- + vpe1_started = 1;
- +
- + /* sleep 3 seconds until FW is ready */
- + ret = IFXOS_EventWait (&fw_ready_evt, 3000, &RetCode);
- + if ((ret == IFX_ERROR) && (RetCode == 1))
- + {
- + /* timeout */
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + (KERN_ERR "[%s %s %d]: Timeout waiting for firmware ready.\r\n",
- + __FILE__, __func__, __LINE__));
- + /* recalculate and compare the firmware checksum */
- + ifx_mps_fw_crc_compare(cpu1_base_addr, pFW_img_data);
- + /* dump exception area on a console */
- + ifx_mps_dump_fw_xcpt(cpu1_base_addr, pFW_img_data);
- + }
- +}
- +
- +/**
- + * WDT callback.
- + * This function is called by BSP (module softdog_vpe) in case if software
- + * watchdog timer expiration is detected by BSP.
- + * This function needs to be registered at BSP as WDT callback using
- + * vpe1_sw_wdog_register_reset_handler() API.
- + *
- + * \return 0 IFX_SUCCESS, cannot fail
- + * \ingroup Internal
- + */
- +IFX_int32_t ifx_mps_wdog_callback (IFX_uint32_t wdog_cleared_ok_count)
- +{
- +#ifdef DEBUG
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + ("MPS: watchdog callback! arg=0x%08x\r\n", wdog_cleared_ok_count));
- +#endif /* DEBUG */
- +
- + /* reset SmartSLIC is done by FW */
- + /* recalculate and compare the firmware checksum */
- + ifx_mps_fw_crc_compare(cpu1_base_addr, pFW_img_data);
- +
- + /* dump exception area on a console */
- + ifx_mps_dump_fw_xcpt(cpu1_base_addr, pFW_img_data);
- +
- + if (IFX_NULL != ifx_wdog_callback)
- + {
- + /* call VMMC driver */
- + ifx_wdog_callback (wdog_cleared_ok_count);
- + }
- + else
- + {
- + TRACE (MPS, DBG_LEVEL_HIGH,
- + (KERN_WARNING "MPS: VMMC watchdog timer callback is NULL.\r\n"));
- + }
- + return 0;
- +}
- +
- +/**
- + * Register WDT callback.
- + * This function is called by VMMC driver to register its callback in
- + * the MPS driver.
- + *
- + * \return 0 IFX_SUCCESS, cannot fail
- + * \ingroup Internal
- + */
- +IFX_int32_t
- +ifx_mps_register_wdog_callback (IFX_int32_t (*pfn) (IFX_uint32_t flags))
- +{
- + ifx_wdog_callback = pfn;
- + return 0;
- +}
- +
- +/**
- + Hardware setup on FALC ON
- +*/
- +void sys_hw_setup (void)
- +{
- + /* Set INFRAC register bit 1: clock enable of the GPE primary clock. */
- + sys_gpe_hw_activate (0);
- + /* enable 1.5 V */
- + ltq_w32_mask (0xf, 0x0b, (u32 *)(GPON_SYS1_BASE | 0xbc));
- + /* SYS1-CLKEN:GPTC = 1 and MPS, no longer FSCT = 1 */
- + sys1_hw_activate (ACTS_MPS | ACTS_GPTC);
- + /* GPTC:CLC:RMC = 1 */
- + ltq_w32 (0x00000100, (u32 *)(KSEG1 | 0x1E100E00));
- +}
- +
- +#ifndef VMMC_WITH_MPS
- +EXPORT_SYMBOL (ifx_mps_register_wdog_callback);
- +#endif /* !VMMC_WITH_MPS */
- +
- +#endif /* SYSTEM_FALCON */
- --- a/src/mps/drv_mps_vmmc_common.c
- +++ b/src/mps/drv_mps_vmmc_common.c
- @@ -66,6 +66,10 @@ static void inline bsp_mask_and_ack_irq(
- # include <asm/ifx/ifx_regs.h>
- # include <asm/ifx/ifx_gptu.h>
- #endif
- +#if defined(SYSTEM_FALCON)
- +#include <sys1_reg.h>
- +#include <sysctrl.h>
- +#endif
-
- #include "drv_mps_vmmc.h"
- #include "drv_mps_vmmc_dbg.h"
- @@ -1156,7 +1160,12 @@ IFX_uint32_t ifx_mps_init_structures (mp
- mailbox, * upstream and downstream direction. */
- memset (
- /* avoid to overwrite CPU boot registers */
- +#if defined(SYSTEM_FALCON)
- + (IFX_void_t *) MBX_Memory +
- + 2 * sizeof (mps_boot_cfg_reg),
- +#else
- (IFX_void_t *) MBX_Memory,
- +#endif
- 0,
- sizeof (mps_mbx_reg) - 2 * sizeof (mps_boot_cfg_reg));
- MBX_Memory->MBX_UPSTR_CMD_BASE =
- @@ -2651,7 +2660,6 @@ IFX_void_t ifx_mps_enable_mailbox_int ()
- #endif
-
- *IFX_MPS_AD0ENR = Ad0Reg.val;
- -
- }
-
- /**
- @@ -2669,6 +2677,7 @@ IFX_void_t ifx_mps_disable_mailbox_int (
- Ad0Reg.fld.cu_mbx = 0;
- Ad0Reg.fld.du_mbx = 0;
- *IFX_MPS_AD0ENR = Ad0Reg.val;
- +
- }
-
- /**
- @@ -2766,11 +2775,13 @@ irqreturn_t ifx_mps_ad0_irq (IFX_int32_t
- /* handle only enabled interrupts */
- MPS_Ad0StatusReg.val &= *IFX_MPS_AD0ENR;
-
- +#if !defined(SYSTEM_FALCON)
- #ifdef LINUX_2_6
- bsp_mask_and_ack_irq (irq);
- #else /* */
- mask_and_ack_danube_irq (irq);
- #endif /* */
- +#endif /* !defined(SYSTEM_FALCON) */
- /* FW is up and ready to process commands */
- if (MPS_Ad0StatusReg.fld.dl_end)
- {
- @@ -2919,11 +2930,13 @@ irqreturn_t ifx_mps_ad1_irq (IFX_int32_t
- /* handle only enabled interrupts */
- MPS_Ad1StatusReg.val &= *IFX_MPS_AD1ENR;
-
- +#if !defined(SYSTEM_FALCON)
- #ifdef LINUX_2_6
- bsp_mask_and_ack_irq (irq);
- #else /* */
- mask_and_ack_danube_irq (irq);
- #endif /* */
- +#endif /* !defined(SYSTEM_FALCON) */
- pMPSDev->event.MPS_Ad1Reg.val = MPS_Ad1StatusReg.val;
-
- /* use callback function or queue wake up to notify about data reception */
- @@ -2977,11 +2990,13 @@ irqreturn_t ifx_mps_vc_irq (IFX_int32_t
- IFX_MPS_CVC0SR[chan] = MPS_VCStatusReg.val;
- /* handle only enabled interrupts */
- MPS_VCStatusReg.val &= IFX_MPS_VC0ENR[chan];
- +#if !defined(SYSTEM_FALCON)
- #ifdef LINUX_2_6
- bsp_mask_and_ack_irq (irq);
- #else /* */
- mask_and_ack_danube_irq (irq);
- #endif /* */
- +#endif /* !defined(SYSTEM_FALCON) */
-
- pMPSDev->event.MPS_VCStatReg[chan].val = MPS_VCStatusReg.val;
- #ifdef PRINT_ON_ERR_INTERRUPT
- @@ -3126,6 +3141,7 @@ IFX_int32_t ifx_mps_get_fw_version (IFX_
- */
- IFX_return_t ifx_mps_init_gpt ()
- {
- +#if !defined(SYSTEM_FALCON)
- unsigned long flags;
- IFX_uint32_t timer_flags, timer, loops = 0;
- IFX_ulong_t count;
- @@ -3134,7 +3150,11 @@ IFX_return_t ifx_mps_init_gpt ()
- #else /* Danube */
- timer = TIMER1B;
- #endif /* SYSTEM_AR9 || SYSTEM_VR9 */
- +#endif
-
- +#if defined(SYSTEM_FALCON)
- + sys_hw_setup ();
- +#else
- /* calibration loop - required to syncronize GPTC interrupt with falling
- edge of FSC clock */
- timer_flags =
- @@ -3179,7 +3199,7 @@ Probably already in use.\r\n", __FILE__,
- #endif /* DEBUG */
-
- IFXOS_UNLOCKINT (flags);
- -
- +#endif
- return IFX_SUCCESS;
- }
-
- @@ -3194,6 +3214,9 @@ Probably already in use.\r\n", __FILE__,
- */
- IFX_void_t ifx_mps_shutdown_gpt (IFX_void_t)
- {
- +#if defined(SYSTEM_FALCON)
- + sys1_hw_deactivate (ACTS_MPS);
- +#else
- IFX_uint32_t timer;
- #if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- timer = TIMER1A;
- @@ -3202,6 +3225,7 @@ IFX_void_t ifx_mps_shutdown_gpt (IFX_voi
- #endif /* SYSTEM_AR9 || SYSTEM_VR9 */
-
- ifx_gptu_timer_free (timer);
- +#endif
- }
-
- /**
- --- a/src/mps/drv_mps_vmmc_device.h
- +++ b/src/mps/drv_mps_vmmc_device.h
- @@ -22,7 +22,12 @@
- # include <lantiq_soc.h>
- # include <linux/gpio.h>
- #define IFXMIPS_MPS_SRAM ((u32 *)(KSEG1 + 0x1F200000))
- +#if defined(SYSTEM_FALCON)
- +#define IFXMIPS_MPS_BASE_ADDR (KSEG1 + 0x1D004000)
- +#else
- #define IFXMIPS_MPS_BASE_ADDR (KSEG1 + 0x1F107000)
- +#endif
- +
- #define IFXMIPS_MPS_CHIPID ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0344))
- #define IFXMIPS_MPS_VC0ENR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0000))
- #define IFXMIPS_MPS_RVC0SR ((u32 *)(IFXMIPS_MPS_BASE_ADDR + 0x0010))
- @@ -73,10 +78,11 @@
- /* MPS Common defines */
- /* ============================= */
-
- -#define MPS_BASEADDRESS 0xBF107000
- -#define MPS_RAD0SR MPS_BASEADDRESS + 0x0004
- -
- +#if defined(SYSTEM_FALCON)
- +#define MBX_BASEADDRESS 0xBF200040
- +#else
- #define MBX_BASEADDRESS 0xBF200000
- +#endif
- #define VCPU_BASEADDRESS 0xBF208000 /* 0xBF108000 */
- /*---------------------------------------------------------------------------*/
- #if !defined(CONFIG_LANTIQ)
- @@ -118,7 +124,6 @@
- /*---------------------------------------------------------------------------*/
-
- #ifdef CONFIG_MPS_EVENT_MBX
- -
- #define MBX_CMD_FIFO_SIZE 64 /**< Size of command FIFO in bytes */
- #define MBX_DATA_UPSTRM_FIFO_SIZE 64
- #define MBX_DATA_DNSTRM_FIFO_SIZE 128
- @@ -294,6 +299,10 @@ typedef struct
- #ifdef CONFIG_MPS_EVENT_MBX
- typedef struct
- {
- +#if defined(SYSTEM_FALCON)
- + mps_boot_cfg_reg MBX_CPU0_BOOT_CFG; /**< CPU0 Boot Configuration */
- + mps_boot_cfg_reg MBX_CPU1_BOOT_CFG; /**< CPU1 Boot Configuration */
- +#endif
- volatile IFX_uint32_t *MBX_UPSTR_CMD_BASE; /**< Upstream Command FIFO Base Address */
- volatile IFX_uint32_t MBX_UPSTR_CMD_SIZE; /**< Upstream Command FIFO size in byte */
- volatile IFX_uint32_t *MBX_DNSTR_CMD_BASE; /**< Downstream Command FIFO Base Address */
- @@ -317,13 +326,19 @@ typedef struct
- volatile IFX_uint32_t MBX_UPSTR_EVENT_WRITE; /**< Upstream Event FIFO Write Index */
- volatile IFX_uint32_t MBX_EVENT[MBX_EVENT_DATA_WORDS];
- volatile IFX_uint32_t reserved[4];
- +#if !defined(SYSTEM_FALCON)
- mps_boot_cfg_reg MBX_CPU0_BOOT_CFG; /**< CPU0 Boot Configuration */
- mps_boot_cfg_reg MBX_CPU1_BOOT_CFG; /**< CPU1 Boot Configuration */
- +#endif
- } mps_mbx_reg;
-
- #else /* */
- typedef struct
- {
- +#if defined(SYSTEM_FALCON)
- + mps_boot_cfg_reg MBX_CPU0_BOOT_CFG; /**< CPU0 Boot Configuration */
- + mps_boot_cfg_reg MBX_CPU1_BOOT_CFG; /**< CPU1 Boot Configuration */
- +#endif
- volatile IFX_uint32_t *MBX_UPSTR_CMD_BASE; /**< Upstream Command FIFO Base Address */
- volatile IFX_uint32_t MBX_UPSTR_CMD_SIZE; /**< Upstream Command FIFO size in byte */
- volatile IFX_uint32_t *MBX_DNSTR_CMD_BASE; /**< Downstream Command FIFO Base Address */
- @@ -341,8 +356,10 @@ typedef struct
- volatile IFX_uint32_t MBX_DNSTR_DATA_READ; /**< Downstream Data FIFO Read Index */
- volatile IFX_uint32_t MBX_DNSTR_DATA_WRITE; /**< Downstream Data FIFO Write Index */
- volatile IFX_uint32_t MBX_DATA[MBX_DATA_WORDS];
- +#if !defined(SYSTEM_FALCON)
- mps_boot_cfg_reg MBX_CPU0_BOOT_CFG; /**< CPU0 Boot Configuration */
- mps_boot_cfg_reg MBX_CPU1_BOOT_CFG; /**< CPU1 Boot Configuration */
- +#endif
- } mps_mbx_reg;
- #endif /* CONFIG_MPS_EVENT_MBX */
-
- --- a/src/drv_api.h
- +++ b/src/drv_api.h
- @@ -183,7 +183,7 @@
- #endif
-
- /* TAPI FXS Phone Detection feature is not available for Danube platform */
- -#if defined(TAPI_PHONE_DETECTION) && (defined(SYSTEM_AR9) || defined(SYSTEM_VR9))
- +#if defined(TAPI_PHONE_DETECTION) && (defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON))
- #define VMMC_CFG_ADD_FEAT_PHONE_DETECTION VMMC_FEAT_PHONE_DETECTION
- #else
- #define VMMC_CFG_ADD_FEAT_PHONE_DETECTION 0
- --- a/src/drv_vmmc_alm.c
- +++ b/src/drv_vmmc_alm.c
- @@ -800,7 +800,7 @@ IFX_void_t VMMC_ALM_Free_Ch_Structures (
- }
-
-
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /**
- Check whether SmartSLIC is connected
-
- @@ -836,7 +836,7 @@ IFX_boolean_t VMMC_ALM_SmartSLIC_IsConne
- #endif /*SYSTEM_AR9 || SYSTEM_VR9*/
-
-
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /**
- Read the number of channels on the SmartSLIC.
-
- @@ -1876,7 +1876,7 @@ IFX_int32_t VMMC_TAPI_LL_ALM_VMMC_Test_L
- /* write updated message contents */
- ret = CmdWrite (pDev, (IFX_uint32_t *)((IFX_void_t *)&debugCfg),
- DCCTL_CMD_LEN);
- -#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#elif defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- IFX_uint32_t dcctrlLoop[2];
- IFX_uint32_t ch = (IFX_uint32_t)(pCh->nChannel - 1);
-
- --- a/src/drv_vmmc_alm.h
- +++ b/src/drv_vmmc_alm.h
- @@ -65,7 +65,7 @@ extern IFX_void_t irq_VMMC_ALM_LineDisab
- extern IFX_void_t VMMC_ALM_CorrectLinemodeCache (VMMC_CHANNEL *pCh,
- IFX_uint16_t lm);
-
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- extern IFX_boolean_t VMMC_ALM_SmartSLIC_IsConnected (
- VMMC_DEVICE *pDev);
-
- --- a/src/drv_vmmc_init.c
- +++ b/src/drv_vmmc_init.c
- @@ -52,15 +52,6 @@
- #include "ifx_pmu.h"
- #endif /* PMU_SUPPORTED */
-
- -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28))
- -# define IFX_MPS_CAD0SR IFXMIPS_MPS_CAD0SR
- -# define IFX_MPS_CAD1SR IFXMIPS_MPS_CAD1SR
- -# define IFX_MPS_CVC0SR IFXMIPS_MPS_CVC0SR
- -# define IFX_MPS_CVC1SR IFXMIPS_MPS_CVC1SR
- -# define IFX_MPS_CVC2SR IFXMIPS_MPS_CVC2SR
- -# define IFX_MPS_CVC3SR IFXMIPS_MPS_CVC3SR
- -#endif
- -
- /* ============================= */
- /* Local Macros & Definitions */
- /* ============================= */
- @@ -820,7 +811,7 @@ static IFX_int32_t VMMC_TAPI_LL_FW_Init(
- MIN_FW_HOTFIXSTEP};
- IFX_uint8_t tmp1, tmp2;
- IFX_TAPI_RESOURCE nResource;
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- IFX_uint8_t nChannels, nFXOChannels;
- #endif /*SYSTEM_AR9 || SYSTEM_VR9*/
- IFX_int32_t ret = VMMC_statusOk;
- @@ -874,7 +865,7 @@ static IFX_int32_t VMMC_TAPI_LL_FW_Init(
- pDev->bSmartSlic = IFX_FALSE;
- pDev->bSlicSupportsIdleMode = IFX_FALSE;
-
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- if (VMMC_SUCCESS(ret))
- {
- /* Reduce the number of ALM channels in the capabilities if the SLIC
- --- a/src/drv_vmmc_ioctl.c
- +++ b/src/drv_vmmc_ioctl.c
- @@ -273,7 +273,7 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
- case FIO_GET_VERS:
- {
- VMMC_IO_VERSION *pVers;
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- VMMC_SDD_REVISION_READ_t *pSDDVersCmd = IFX_NULL;
- #endif /*SYSTEM_AR9 || SYSTEM_VR9*/
- SYS_VER_t *pCmd;
- @@ -322,7 +322,7 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
- pVers->nTapiVers = 3;
- pVers->nDrvVers = MAJORSTEP << 24 | MINORSTEP << 16 |
- VERSIONSTEP << 8 | VERS_TYPE;
- -#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9)
- +#if defined(SYSTEM_AR9) || defined(SYSTEM_VR9) || defined(SYSTEM_FALCON)
- /* in case of SmartSLIC based systems, we can give some more
- versions.*/
- if (VMMC_ALM_SmartSLIC_IsConnected(pDev))
|