diff options
author | Doug Gilbert <dgilbert@us.ibm.com> | 2014-05-16 15:16:15 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-06-30 20:08:27 -0500 |
commit | 11d47db77ef4d118c75e9e23ad8c4ca9663d0fff (patch) | |
tree | dc0e09e93de108dc2cf44ef69d2688f7ab40944c /src/usr/hwpf/hwp/dram_training | |
parent | 61a956f980a4be2f19d33067236018e7efd074e7 (diff) | |
download | talos-hostboot-11d47db77ef4d118c75e9e23ad8c4ca9663d0fff.tar.gz talos-hostboot-11d47db77ef4d118c75e9e23ad8c4ca9663d0fff.zip |
Merge GPIO commits from Stradale code base
Change-Id: Ibadeb72f563d86aa933734c7db20a50b19485ac7
RTC: 97490
Origin: Google Shared Technology
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11501
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/dram_training')
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/HBconfig | 4 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/dram_training.C | 127 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/hbVddrMsg.C | 119 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/makefile | 10 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/palmetto_vddr.C | 231 | ||||
-rw-r--r-- | src/usr/hwpf/hwp/dram_training/platform_vddr.H | 51 |
6 files changed, 441 insertions, 101 deletions
diff --git a/src/usr/hwpf/hwp/dram_training/HBconfig b/src/usr/hwpf/hwp/dram_training/HBconfig new file mode 100644 index 000000000..7bfb8abad --- /dev/null +++ b/src/usr/hwpf/hwp/dram_training/HBconfig @@ -0,0 +1,4 @@ +config PALMETTO_VDDR + default n + help + Enable the Hostboot DRAM VDDR function for Palmetto diff --git a/src/usr/hwpf/hwp/dram_training/dram_training.C b/src/usr/hwpf/hwp/dram_training/dram_training.C index e3686c284..0c88ac5d5 100644 --- a/src/usr/hwpf/hwp/dram_training/dram_training.C +++ b/src/usr/hwpf/hwp/dram_training/dram_training.C @@ -5,7 +5,10 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] Google Inc. */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -54,7 +57,7 @@ #include <fapiPlatHwpInvoker.H> //hb vddr support -#include <hbVddrMsg.H> +#include "platform_vddr.H" #include <initservice/initserviceif.H> // Run on all Centaurs/MBAs, but needs to keep this one handy in case we @@ -93,53 +96,33 @@ using namespace fapi; void* call_host_disable_vddr( void *io_pArgs ) { errlHndl_t l_err = NULL; + IStepError l_StepError; - TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_disable_vddr entry"); - - if(INITSERVICE::spBaseServicesEnabled()) - { - IStepError l_StepError; + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK"call_host_disable_vddr"); - HBVddrMsg l_hbVddr; + // This function has Compile-time binding for desired platform + l_err = platform_disable_vddr(); - l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE); - if (l_err) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - "ERROR 0x%.8X: call_host_disable_vddr to sendMsg returns error", - l_err->reasonCode()); - - // Create IStep error log and cross reference to error that occurred - l_StepError.addErrorDetails( l_err ); + if(l_err) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: call_host_disable_vddr returns error", + l_err->reasonCode()); + // Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails( l_err ); - // Commit Error - errlCommit( l_err, HWPF_COMP_ID ); - } - else - { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "SUCCESS : host_disable_vddr()" ); - } - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr" - "when a fsp present exit" ); + errlCommit( l_err, HWPF_COMP_ID ); - return l_StepError.getErrorHandle(); - } - else - { - //This is a fsp less system. Right now the istep - //only works when a FSP is present. May add code in the future for - //Stradale which is a FSP-less system - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_disable_vddr" - "no-op because fsp-less"); - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_disable_vddr " - "for an fsp less system exit" ); - - return l_err; } + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"call_host_disable_vddr"); + + return l_StepError.getErrorHandle(); } + // // Wrapper function to call mem_pll_initf // @@ -183,7 +166,7 @@ void* call_mem_pll_initf( void *io_pArgs ) // capture the target data in the elog ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err ); - // Create IStep error log and cross reference to error that occurred + //Create IStep error log and cross reference to error that occurred l_StepError.addErrorDetails(l_err); // Commit Error @@ -245,7 +228,7 @@ void* call_mem_pll_setup( void *io_pArgs ) // capture the target data in the elog ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err); - // Create IStep error log and cross reference to error that occurred + //Create IStep error log and cross reference to error that occurred l_StepError.addErrorDetails(l_err); // Commit Error @@ -272,7 +255,7 @@ void* call_mem_startclocks( void *io_pArgs ) IStepError l_StepError; - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,"call_mem_startclocks entry" ); + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_mem_startclocks entry" ); // Get all Centaur targets TARGETING::TargetHandleList l_membufTargetList; @@ -307,7 +290,7 @@ void* call_mem_startclocks( void *io_pArgs ) // capture the target data in the elog ErrlUserDetailsTarget(l_pCentaur).addToLog(l_err); - // Create IStep error log and cross reference to error that occurred + //Create IStep error log and cross reference to error that occurred l_StepError.addErrorDetails( l_err ); // Commit Error @@ -321,7 +304,8 @@ void* call_mem_startclocks( void *io_pArgs ) } } - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mem_startclocks exit" ); + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "call_mem_startclocks exit" ); return l_StepError.getErrorHandle(); } @@ -334,52 +318,33 @@ void* call_mem_startclocks( void *io_pArgs ) void* call_host_enable_vddr( void *io_pArgs ) { TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "call_host_enable_vddr entry" ); + ENTER_MRK"call_host_enable_vddr" ); errlHndl_t l_err = NULL; + IStepError l_StepError; - if(INITSERVICE::spBaseServicesEnabled()) - { - IStepError l_StepError; - - HBVddrMsg l_hbVddr; + // This fuction has compile-time binding for different platforms + l_err = platform_enable_vddr(); - l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE); - if (l_err) - { - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, - "ERROR 0x%.8X: call_host_enable_vddr to sendMsg returns error", - l_err->reasonCode()); + if( l_err ) + { + TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: call_host_enable_vddr returns error", + l_err->reasonCode()); - // Create IStep error log and cross reference to error that occurred - l_StepError.addErrorDetails( l_err ); + l_StepError.addErrorDetails( l_err ); - // Commit Error - errlCommit( l_err, HWPF_COMP_ID ); - } - else - { - TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "SUCCESS : host_enable_vddr()" ); - } - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, - "call_host_enable_vddr exit" ); + // Create IStep error log and cross reference to error that occurred + l_StepError.addErrorDetails( l_err ); - return l_StepError.getErrorHandle(); + // Commit Error + errlCommit( l_err, HWPF_COMP_ID ); } - else - { - //This is a fsp less system. Right now the istep - //only works when a FSP is present. May add code in the future for - //Stradale which is a FSP-less system - TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,"call_host_enable_vddr" - "no-op because fsp-less"); - TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_enable_vddr " - "for an fsp less system exit" ); - return l_err; + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK"call_host_enable_vddr" ); - } + return l_StepError.getErrorHandle(); } diff --git a/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C b/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C index 3e4fa82ac..f585de1a2 100644 --- a/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C +++ b/src/usr/hwpf/hwp/dram_training/hbVddrMsg.C @@ -5,7 +5,10 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012,2014 */ +/* Contributors Listed Below - COPYRIGHT 2012,2014 */ +/* [+] Google Inc. */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -36,6 +39,7 @@ #include <initservice/initserviceif.H> #include <pnor/pnorif.H> #include <fapi.H> +#include "platform_vddr.H" using namespace ERRORLOG; @@ -303,7 +307,8 @@ errlHndl_t HBVddrMsg::sendMsg(uint32_t i_msgType) const { errlHndl_t l_err = NULL; - TRACFCOMP(g_trac_volt, ENTER_MRK "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType); + TRACFCOMP(g_trac_volt, ENTER_MRK + "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType); do { @@ -378,7 +383,8 @@ errlHndl_t HBVddrMsg::sendMsg(uint32_t i_msgType) const l_err = MBOX::sendrecv( MBOX::FSP_VDDR_MSGQ, l_msg ); if (l_err) { - TRACFCOMP(g_trac_volt, ERR_MRK "Failed sending VDDR message to FSP"); + TRACFCOMP(g_trac_volt, + ERR_MRK "Failed sending VDDR message to FSP"); } else { @@ -419,7 +425,8 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const if (l_extraData==NULL) { //an error occred in obtaining the extra data from the response msg - TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processVDDRmsg: l_extraData = NULL"); + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processVDDRmsg: l_extraData = NULL"); //create an errorlog /*@ * @errortype @@ -464,9 +471,11 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const } else { - //error occured so break out of the loop and indicate an error was present - TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processVDDRmsg: error occured " - "on the powr function called in hwsv"); + //error occured so break out of the loop and indicate + //an error was present + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processVDDRmsg: error occured " + "on the powr function called in hwsv"); //create an errorlog /*@ * @errortype @@ -475,9 +484,10 @@ errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const * @userdata1 l_errPlid * @userdata2 0 * - * @devdesc The hwsv returned a message where there was an error - * when the powr function was called. userdata1 contains - * the errorlog plid from hwsv generated by the powr function + * @devdesc The hwsv returned a message where there was + * an error when the powr function was called. + * userdata1 contains the errorlog plid from + * hwsv generated by the powr function */ createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG, fapi::RC_VDDR_POWR_ERR, l_errPlid); @@ -502,8 +512,9 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const do { - //check to see if the data[0] =0 or contains a value. A value of 0 means its a - //response to a request and a value not equal to zero means that its an error coming back + //check to see if the data[0] =0 or contains a value. + //A value of 0 means its a response to a request and a value not equal + //to zero means that its an error coming back uint16_t l_value1=i_Msg->data[0]; if (l_value1 ==0) @@ -511,8 +522,10 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const //process a response to a request uint32_t l_msgType =i_Msg->type; - TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType ); - if ( (l_msgType == HB_VDDR_ENABLE) || (l_msgType == HB_VDDR_DISABLE) ) + TRACFCOMP( g_trac_volt, INFO_MRK + "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType ); + if ( (l_msgType == HB_VDDR_ENABLE) || + (l_msgType == HB_VDDR_DISABLE) ) { //process a VDDR message l_errLog=processVDDRmsg(i_Msg); @@ -524,7 +537,8 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const } else { - TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::processMsg recv'd a non valid type"); + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::processMsg recv'd a non valid type"); //generate errorLog; /*@ * @errortype @@ -533,8 +547,9 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const * @userdata1 0 * @userdata2 0 * - * @devdesc HB got an incorrect type message. HWSV did not populate - * the message correctly or mbox corrupted the message + * @devdesc HB got an incorrect type message. + * HWSV did not populate the message correctly + * or mbox corrupted the message */ createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG, fapi::RC_INCORRECT_MSG_TYPE); @@ -543,7 +558,8 @@ errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const else { //an error occurred so should stop the IPL - TRACFCOMP( g_trac_volt, ERR_MRK "HBVddrMsg::RecvMsgHndlr recv'd an error message" ); + TRACFCOMP( g_trac_volt, ERR_MRK + "HBVddrMsg::RecvMsgHndlr recv'd an error message" ); //generate an errorlog /*@ * @errortype @@ -589,4 +605,71 @@ void HBVddrMsg::createErrLog(errlHndl_t& io_err, return; } +// External interfaces + +errlHndl_t platform_enable_vspd() +{ + // noop on FSP based system + return NULL; +} + +errlHndl_t platform_enable_vddr() +{ + errlHndl_t l_err = NULL; + if(INITSERVICE::spBaseServicesEnabled()) + { + HBVddrMsg l_hbVddr; + + l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE); + if (l_err) + { + TRACFCOMP(g_trac_volt, + "ERROR 0x%.8X: call_host_enable_vddr to sendMsg" + " returns error", + l_err->reasonCode()); + } + else + { + TRACFCOMP( g_trac_volt, + "SUCCESS : host_enable_vddr()" ); + } + } + else // simics stand-alone TULETTA + { + TRACFCOMP(g_trac_volt,"call_host_enable_vddr" + "no-op because mbox not available"); + } + + return l_err; +} + +errlHndl_t platform_disable_vddr() +{ + errlHndl_t l_err = NULL; + if(INITSERVICE::spBaseServicesEnabled()) + { + HBVddrMsg l_hbVddr; + + l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE); + if (l_err) + { + TRACFCOMP(g_trac_volt, + "ERROR 0x%.8X: call_host_disable_vddr to sendMsg" + " returns error", + l_err->reasonCode()); + } + else + { + TRACFCOMP( g_trac_volt, + "SUCCESS : host_disable_vddr()" ); + } + } + else // simics stand-along TULETTA + { + TRACFCOMP(g_trac_volt,"call_host_disable_vddr" + "no-op because mbox not available"); + } + + return l_err; +} diff --git a/src/usr/hwpf/hwp/dram_training/makefile b/src/usr/hwpf/hwp/dram_training/makefile index a08b9fc05..dee812c3b 100644 --- a/src/usr/hwpf/hwp/dram_training/makefile +++ b/src/usr/hwpf/hwp/dram_training/makefile @@ -5,7 +5,10 @@ # # OpenPOWER HostBoot Project # -# COPYRIGHT International Business Machines Corp. 2012,2014 +# Contributors Listed Below - COPYRIGHT 2012,2014 +# [+] Google Inc. +# [+] International Business Machines Corp. +# # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -71,12 +74,15 @@ OBJS += mss_access_delay_reg.o OBJS += mss_generic_shmoo.o OBJS += mss_mcbist.o OBJS += mss_mcbist_common.o -OBJS += hbVddrMsg.o OBJS += mss_mcbist_address.o OBJS += mss_dimm_power_test.o OBJS += mss_lrdimm_funcs.o OBJS += cen_stopclocks.o + +# +OBJS += $(if $(CONFIG_PALMETTO_VDDR),palmetto_vddr.o, hbVddrMsg.o) + ## NOTE: add a new directory onto the vpaths when you add a new HWP ##@ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/??? VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/dram_training/mss_dimm_power_test diff --git a/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C b/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C new file mode 100644 index 000000000..5286d26f6 --- /dev/null +++ b/src/usr/hwpf/hwp/dram_training/palmetto_vddr.C @@ -0,0 +1,231 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/dram_training/palmetto_vddr.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] Google Inc. */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// Rhesus board-specific VDDR support. +// VDDR is enabled/disabled via a GPIO on the hammock card. +// A separate GPIO selects between 1.35V and 1.25V output from the VR. + +#include "platform_vddr.H" + +#include <hwpf/hwpf_reasoncodes.H> +#include <errl/errlentry.H> +#include <errl/errlmanager.H> + +#include <targeting/common/commontargeting.H> +#include <targeting/common/util.H> +#include <targeting/common/utilFilter.H> + +#include <kernel/timemgr.H> + +#include <usr/devicefw/driverif.H> +#include <usr/gpio/gpioif.H> + +using namespace TARGETING; +using namespace DeviceFW; + +trace_desc_t* g_trac_vddr = NULL; +TRAC_INIT(&g_trac_vddr, "HB_VDDR", KILOBYTE); + +/** + * PCA95X GPIO function assignements + */ +enum +{ + // Output GPIO to enable VDDR. (GPIO pin 0) + GPIO_P1V35_EN = 0, + + // No other GPIO pins are implemented on the Palmetto board +}; + +// PCA95X internal register addresses +enum +{ + PCA95X_GPIO_REG_INPUT = 0x0, + PCA95X_GPIO_REG_OUTPUT = 0x2, + PCA95X_GPIO_REG_POLARITY = 0x4, + PCA95X_GPIO_POLARITY_NORMAL = 0, + PCA95X_GPIO_POLARITY_INVERTED = 1, + PCA95X_GPIO_REG_CONFIG = 0x6, +}; + +#define PCA95X_GPIO_CONFIG_OUTPUT false +#define PCA95X_GPIO_CONFIG_INPUT true + +// GPIO bit numbers (0-7) => port addr 0 pin(0-7) +// GPIO bit numbers (8-15) => port addr 1 pin(0-7) +#define GPIO_TO_PORT(gpio) (gpio / 8) +#define GPIO_TO_BIT(gpio) (gpio % 8) + +// Helper function to call provided function pointer on each functional +// centaur Target. +static errlHndl_t for_each_centaur(errlHndl_t (*func)(Target *)) +{ + // Get all Centaur targets + TargetHandleList l_membufTargetList; + getAllChips(l_membufTargetList, TYPE_MEMBUF); + + errlHndl_t l_err = NULL; + + for (TargetHandleList::iterator + l_membuf_iter = l_membufTargetList.begin(); + l_membuf_iter != l_membufTargetList.end(); + ++l_membuf_iter) + { + Target* l_pCentaur = *l_membuf_iter; + + l_err = (*func)(l_pCentaur); + + if( l_err ) + { + break; + } + } + + return l_err; +} + +static errlHndl_t pca95xGpioSetBit(TARGETING::Target * i_target, + uint8_t i_reg, + uint8_t i_gpio, + bool i_val) +{ + errlHndl_t err = NULL; + do + { + + uint64_t cmd = i_reg + GPIO_TO_PORT(i_gpio); + uint8_t data = 0; + size_t dataLen = sizeof(data); + + // Might want to make this an attribute; + // However, This is already a palmetto only object + uint64_t deviceType = GPIO::PCA95X_GPIO; + + err = DeviceFW::deviceOp + ( DeviceFW::READ, + i_target, + &data, + dataLen, + DEVICE_GPIO_ADDRESS(deviceType, cmd) + ); + + if( err ) + { + break; + } + + uint8_t new_reg_val = data; + if( i_val ) + { + new_reg_val |= 1 << GPIO_TO_BIT(i_gpio); + } + else + { + new_reg_val &= ~(1 << GPIO_TO_BIT(i_gpio)); + } + + // Do the write only if actually changing value. + if( new_reg_val != data ) + { + data = new_reg_val; + cmd = i_reg + GPIO_TO_PORT(i_gpio); + + err = DeviceFW::deviceOp + ( DeviceFW::WRITE, + i_target, + &data, + dataLen, + DEVICE_GPIO_ADDRESS(deviceType, cmd) + ); + + if( err ) + { + break; + } + } + + } while(0); + + return err; +} + + +static errlHndl_t pca95xGpioWriteBit(TARGETING::Target * i_target, + uint8_t i_gpio_pin, + bool i_val) +{ + assert( i_gpio_pin >= 0 && i_gpio_pin < 16 ); + errlHndl_t err = NULL; + + err = pca95xGpioSetBit(i_target, + PCA95X_GPIO_REG_OUTPUT, + i_gpio_pin, + i_val); + + // Configure gpio bit as output (if necessary). + if(!err) + { + err = pca95xGpioSetBit(i_target, + PCA95X_GPIO_REG_CONFIG, + i_gpio_pin, + PCA95X_GPIO_CONFIG_OUTPUT); + } + + return err; +} + +static errlHndl_t palmetto_centaur_enable_vddr(Target *centaur) +{ + errlHndl_t l_err = NULL; + + // Enable the DIMM power. + l_err = pca95xGpioWriteBit(centaur, GPIO_P1V35_EN, true); + + return l_err; +} + +static errlHndl_t palmetto_centaur_disable_vddr(Target *centaur) +{ + return pca95xGpioWriteBit(centaur, GPIO_P1V35_EN, false); +} + +// External interfaces + +errlHndl_t platform_enable_vspd() +{ + // GPIO pin not implemented on palmetto + // VSPD voltage hardwired. + return NULL; +} + +errlHndl_t platform_enable_vddr() +{ + return for_each_centaur(palmetto_centaur_enable_vddr); +} + +errlHndl_t platform_disable_vddr() +{ + return for_each_centaur(palmetto_centaur_disable_vddr); +} diff --git a/src/usr/hwpf/hwp/dram_training/platform_vddr.H b/src/usr/hwpf/hwp/dram_training/platform_vddr.H new file mode 100644 index 000000000..98c013535 --- /dev/null +++ b/src/usr/hwpf/hwp/dram_training/platform_vddr.H @@ -0,0 +1,51 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/dram_training/platform_vddr.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2014 */ +/* [+] Google Inc. */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +// platform specific VDDR support. + +#ifndef PLATFORM_VDDR_H__ +#define PLATFORM_VDDR_H__ + +#include <usr/errl/errlentry.H> + +/** + * @brief Enable vspd on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_enable_vspd(); + +/** + * @brief Enable vddr on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_enable_vddr(); + +/** + * @brief Disable vddr on DIMMS + * @return NULL | error handle on error + */ +errlHndl_t platform_disable_vddr(); + +#endif // PLATFORM_VDDR_H__ |