From 6b0ba64edaeede022f74287c0a6f7a30d9340686 Mon Sep 17 00:00:00 2001 From: Jyotheeswar Reddy Date: Thu, 6 Aug 2015 11:02:18 -0700 Subject: [PATCH] PMUFW: MOD: Add new module for legacy power request handling CSU ROM and FSBL send power up/down requests to PMU via the PWR_UP/PWR_DN request register in PMU_GLOBAL. This module handles these requests and routes them to respective ROM handlers Signed-off-by: Jyotheeswar Reddy --- .../zynqmp_pmufw/src/xpfw_mod_legacy.c | 81 +++++++++++++++++++ .../zynqmp_pmufw/src/xpfw_mod_legacy.h | 38 +++++++++ .../zynqmp_pmufw/src/xpfw_user_startup.c | 2 + lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h | 2 +- 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.c create mode 100644 lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.h diff --git a/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.c b/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.c new file mode 100644 index 00000000..de932d11 --- /dev/null +++ b/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.c @@ -0,0 +1,81 @@ +/****************************************************************************** +* +* Copyright (C) 2015 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ + + +#include "xpfw_default.h" +#include "xpfw_rom_interface.h" +#include "xpfw_config.h" +#include "xpfw_core.h" +#include "xpfw_events.h" +#include "xpfw_module.h" + +/* CfgInit Handler */ +static void LegacyCfgInit(const XPfw_Module_t *ModPtr, const u32 *CfgData, + u32 Len) +{ + /* Used for Power Up/Dn request handling */ + XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_REQ_PWRUP); + XPfw_CoreRegisterEvent(ModPtr, XPFW_EV_REQ_PWRDN); + + fw_printf("LEGACY PWR UP/DN (MOD-%d): Initialized.\r\n", ModPtr->ModId); +} + +/* Event Handler */ +static void LegacyEventHandler(const XPfw_Module_t *ModPtr, u32 EventId) +{ + if (XPFW_EV_REQ_PWRUP == EventId) { + /* Call ROM Handler for PwrUp */ + fw_printf("XPFW: Calling ROM PWRUP Handler.."); + XpbrServHndlrTbl[XPBR_SERV_EXT_PWRUP_REQS](); + fw_printf("Done\r\n"); + } + + if (XPFW_EV_REQ_PWRDN == EventId) { + /* Call ROM Handler for PwrDn */ + fw_printf("XPFW: Calling ROM PWRDN Handler.."); + XpbrServHndlrTbl[XPBR_SERV_EXT_PWRDN_REQS](); + fw_printf("Done\r\n"); + } + +} + +/* + * Create a Mod and assign the Handlers. We will call this function + * from XPfw_UserStartup() + */ +void ModLegacyInit(void) +{ + const XPfw_Module_t *LegacyModPtr = XPfw_CoreCreateMod(); + + (void) XPfw_CoreSetCfgHandler(LegacyModPtr, LegacyCfgInit); + (void) XPfw_CoreSetEventHandler(LegacyModPtr, LegacyEventHandler); +} diff --git a/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.h b/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.h new file mode 100644 index 00000000..fb191fc2 --- /dev/null +++ b/lib/sw_apps/zynqmp_pmufw/src/xpfw_mod_legacy.h @@ -0,0 +1,38 @@ +/****************************************************************************** +* +* Copyright (C) 2015 Xilinx, Inc. All rights reserved. +* +* Permission is hereby granted, free of charge, to any person obtaining a copy +* of this software and associated documentation files (the "Software"), to deal +* in the Software without restriction, including without limitation the rights +* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +* copies of the Software, and to permit persons to whom the Software is +* furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* Use of the Software is limited solely to applications: +* (a) running on a Xilinx device, or +* (b) that interact with a Xilinx device through a bus or interconnect. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +* XILINX CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +* SOFTWARE. +* +* Except as contained in this notice, the name of the Xilinx shall not be used +* in advertising or otherwise to promote the sale, use or other dealings in +* this Software without prior written authorization from Xilinx. +* +******************************************************************************/ + +#ifndef XPFW_MOD_LEGACY_H_ +#define XPFW_MOD_LEGACY_H_ + +void ModLegacyInit(void); + +#endif /* XPFW_MOD_LEGACY_H_ */ diff --git a/lib/sw_apps/zynqmp_pmufw/src/xpfw_user_startup.c b/lib/sw_apps/zynqmp_pmufw/src/xpfw_user_startup.c index c7628583..0abe14c1 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/xpfw_user_startup.c +++ b/lib/sw_apps/zynqmp_pmufw/src/xpfw_user_startup.c @@ -44,6 +44,7 @@ #include "pm_defs.h" #include "xpfw_mod_dap.h" +#include "xpfw_mod_legacy.h" #ifdef ENABLE_PM static void PmIpiHandler(const XPfw_Module_t *ModPtr, u32 IpiNum, u32 SrcMask) @@ -269,4 +270,5 @@ void XPfw_UserStartUp(void) ModPmInit(); (void)ModSchInit(); ModDapInit(); + ModLegacyInit(); } diff --git a/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h b/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h index 63a23f3b..39f8329f 100644 --- a/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h +++ b/lib/sw_apps/zynqmp_pmufw/src/xpfw_version.h @@ -1,4 +1,4 @@ #ifndef ZYNQMP_XPFW_VERSION__H_ #define ZYNQMP_XPFW_VERSION__H_ - #define ZYNQMP_XPFW_VERSION "2015.3-rc1-5-gf87012a6ce99" + #define ZYNQMP_XPFW_VERSION "2015.3-rc1-6-g61cf37508b43" #endif