1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /**********************************************************************
3 * Copyright (C) 2012-2019 Cadence Design Systems, Inc.
4 **********************************************************************
5 * WARNING: This file is auto-generated using api-generator utility.
6 * api-generator: 12.02.13bb8d5
7 * Do not edit it manually.
8 **********************************************************************
9 * Cadence Core Driver for LPDDR4.
10 **********************************************************************
14 * This file contains sanity API functions. The purpose of sanity functions
15 * is to check input parameters validity. They take the same parameters as
16 * original API functions and return 0 on success or EINVAL on wrong parameter
20 #ifndef LPDDR4_SANITY_H
21 #define LPDDR4_SANITY_H
24 #include <linux/types.h>
25 #include "lpddr4_if.h"
27 #define CDN_EOK 0U /* no error */
29 static inline uint32_t lpddr4_configsf(const lpddr4_config *obj);
30 static inline uint32_t lpddr4_privatedatasf(const lpddr4_privatedata *obj);
31 static inline uint32_t lpddr4_reginitdatasf(const lpddr4_reginitdata *obj);
33 static inline uint32_t lpddr4_sanityfunction1(const lpddr4_config* config, const uint16_t* configsize);
34 static inline uint32_t lpddr4_sanityfunction2(const lpddr4_privatedata* pd, const lpddr4_config* cfg);
35 static inline uint32_t lpddr4_sanityfunction3(const lpddr4_privatedata* pd);
36 static inline uint32_t lpddr4_sanityfunction4(const lpddr4_privatedata* pd, const lpddr4_regblock cpp, const uint32_t* regvalue);
37 static inline uint32_t lpddr4_sanityfunction5(const lpddr4_privatedata* pd, const lpddr4_regblock cpp);
38 static inline uint32_t lpddr4_sanityfunction6(const lpddr4_privatedata* pd, const uint64_t* mmrvalue, const uint8_t* mmrstatus);
39 static inline uint32_t lpddr4_sanityfunction7(const lpddr4_privatedata* pd, const uint8_t* mrwstatus);
40 static inline uint32_t lpddr4_sanityfunction8(const lpddr4_privatedata* pd, const lpddr4_reginitdata* regvalues);
41 static inline uint32_t lpddr4_sanityfunction11(const lpddr4_privatedata* pd, const lpddr4_reginitdata* regvalues);
42 static inline uint32_t lpddr4_sanityfunction14(const lpddr4_privatedata* pd, const uint64_t* mask);
43 static inline uint32_t lpddr4_sanityfunction15(const lpddr4_privatedata* pd, const uint64_t* mask);
44 static inline uint32_t lpddr4_sanityfunction16(const lpddr4_privatedata* pd, const lpddr4_ctlinterrupt intr, const bool* irqstatus);
45 static inline uint32_t lpddr4_sanityfunction17(const lpddr4_privatedata* pd, const lpddr4_ctlinterrupt intr);
46 static inline uint32_t lpddr4_sanityfunction18(const lpddr4_privatedata* pd, const uint32_t* mask);
47 static inline uint32_t lpddr4_sanityfunction20(const lpddr4_privatedata* pd, const lpddr4_phyindepinterrupt intr, const bool* irqstatus);
48 static inline uint32_t lpddr4_sanityfunction21(const lpddr4_privatedata* pd, const lpddr4_phyindepinterrupt intr);
49 static inline uint32_t lpddr4_sanityfunction22(const lpddr4_privatedata* pd, const lpddr4_debuginfo* debuginfo);
50 static inline uint32_t lpddr4_sanityfunction23(const lpddr4_privatedata* pd, const lpddr4_lpiwakeupparam* lpiwakeupparam, const lpddr4_ctlfspnum* fspnum, const uint32_t* cycles);
51 static inline uint32_t lpddr4_sanityfunction25(const lpddr4_privatedata* pd, const lpddr4_eccenable* eccparam);
52 static inline uint32_t lpddr4_sanityfunction26(const lpddr4_privatedata* pd, const lpddr4_eccenable* eccparam);
53 static inline uint32_t lpddr4_sanityfunction27(const lpddr4_privatedata* pd, const lpddr4_reducmode* mode);
54 static inline uint32_t lpddr4_sanityfunction28(const lpddr4_privatedata* pd, const lpddr4_reducmode* mode);
55 static inline uint32_t lpddr4_sanityfunction29(const lpddr4_privatedata* pd, const bool* on_off);
56 static inline uint32_t lpddr4_sanityfunction31(const lpddr4_privatedata* pd, const lpddr4_dbimode* mode);
57 static inline uint32_t lpddr4_sanityfunction32(const lpddr4_privatedata* pd, const lpddr4_ctlfspnum* fspnum, const uint32_t* cycles);
59 #define lpddr4_probesf lpddr4_sanityfunction1
60 #define lpddr4_initsf lpddr4_sanityfunction2
61 #define lpddr4_startsf lpddr4_sanityfunction3
62 #define lpddr4_readregsf lpddr4_sanityfunction4
63 #define lpddr4_writeregsf lpddr4_sanityfunction5
64 #define lpddr4_getmmrregistersf lpddr4_sanityfunction6
65 #define lpddr4_setmmrregistersf lpddr4_sanityfunction7
66 #define lpddr4_writectlconfigsf lpddr4_sanityfunction8
67 #define lpddr4_writephyconfigsf lpddr4_sanityfunction8
68 #define lpddr4_writephyindepconfigsf lpddr4_sanityfunction8
69 #define lpddr4_readctlconfigsf lpddr4_sanityfunction11
70 #define lpddr4_readphyconfigsf lpddr4_sanityfunction11
71 #define lpddr4_readphyindepconfigsf lpddr4_sanityfunction11
72 #define lpddr4_getctlinterruptmasksf lpddr4_sanityfunction14
73 #define lpddr4_setctlinterruptmasksf lpddr4_sanityfunction15
74 #define lpddr4_checkctlinterruptsf lpddr4_sanityfunction16
75 #define lpddr4_ackctlinterruptsf lpddr4_sanityfunction17
76 #define lpddr4_getphyindepinterruptmsf lpddr4_sanityfunction18
77 #define lpddr4_setphyindepinterruptmsf lpddr4_sanityfunction18
78 #define lpddr4_checkphyindepinterrupsf lpddr4_sanityfunction20
79 #define lpddr4_ackphyindepinterruptsf lpddr4_sanityfunction21
80 #define lpddr4_getdebuginitinfosf lpddr4_sanityfunction22
81 #define lpddr4_getlpiwakeuptimesf lpddr4_sanityfunction23
82 #define lpddr4_setlpiwakeuptimesf lpddr4_sanityfunction23
83 #define lpddr4_geteccenablesf lpddr4_sanityfunction25
84 #define lpddr4_seteccenablesf lpddr4_sanityfunction26
85 #define lpddr4_getreducmodesf lpddr4_sanityfunction27
86 #define lpddr4_setreducmodesf lpddr4_sanityfunction28
87 #define lpddr4_getdbireadmodesf lpddr4_sanityfunction29
88 #define lpddr4_getdbiwritemodesf lpddr4_sanityfunction29
89 #define lpddr4_setdbimodesf lpddr4_sanityfunction31
90 #define lpddr4_getrefreshratesf lpddr4_sanityfunction32
91 #define lpddr4_setrefreshratesf lpddr4_sanityfunction32
92 #define lpddr4_refreshperchipselectsf lpddr4_sanityfunction3
95 * Function to validate struct Config
97 * @param[in] obj pointer to struct to be verified
98 * @returns 0 for valid
99 * @returns EINVAL for invalid
101 static inline uint32_t lpddr4_configsf(const lpddr4_config *obj)
114 * Function to validate struct PrivateData
116 * @param[in] obj pointer to struct to be verified
117 * @returns 0 for valid
118 * @returns EINVAL for invalid
120 static inline uint32_t lpddr4_privatedatasf(const lpddr4_privatedata *obj)
133 * Function to validate struct RegInitData
135 * @param[in] obj pointer to struct to be verified
136 * @returns 0 for valid
137 * @returns EINVAL for invalid
139 static inline uint32_t lpddr4_reginitdatasf(const lpddr4_reginitdata *obj)
152 * A common function to check the validity of API functions with
153 * following parameter types
154 * @param[in] config Driver/hardware configuration required.
155 * @param[out] configSize Size of memory allocations required.
157 * @return EINVAL invalid parameters
159 static inline uint32_t lpddr4_sanityfunction1(const lpddr4_config* config, const uint16_t* configsize)
161 /* Declaring return variable */
164 if (configsize == NULL)
168 else if (lpddr4_configsf(config) == EINVAL)
175 * All 'if ... else if' constructs shall be terminated with an 'else' statement
176 * (MISRA2012-RULE-15_7-3)
184 * A common function to check the validity of API functions with
185 * following parameter types
186 * @param[in] pD Driver state info specific to this instance.
187 * @param[in] cfg Specifies driver/hardware configuration.
189 * @return EINVAL invalid parameters
191 static inline uint32_t lpddr4_sanityfunction2(const lpddr4_privatedata* pd, const lpddr4_config* cfg)
193 /* Declaring return variable */
196 if (lpddr4_privatedatasf(pd) == EINVAL)
200 else if (lpddr4_configsf(cfg) == EINVAL)
207 * All 'if ... else if' constructs shall be terminated with an 'else' statement
208 * (MISRA2012-RULE-15_7-3)
216 * A common function to check the validity of API functions with
217 * following parameter types
218 * @param[in] pD Driver state info specific to this instance.
220 * @return EINVAL invalid parameters
222 static inline uint32_t lpddr4_sanityfunction3(const lpddr4_privatedata* pd)
224 /* Declaring return variable */
227 if (lpddr4_privatedatasf(pd) == EINVAL)
236 * A common function to check the validity of API functions with
237 * following parameter types
238 * @param[in] pD Driver state info specific to this instance.
239 * @param[in] cpp Indicates whether controller, PHY or PHY Independent Module register
240 * @param[out] regValue Register value read
242 * @return EINVAL invalid parameters
244 static inline uint32_t lpddr4_sanityfunction4(const lpddr4_privatedata* pd, const lpddr4_regblock cpp, const uint32_t* regvalue)
246 /* Declaring return variable */
249 if (regvalue == NULL)
253 else if (lpddr4_privatedatasf(pd) == EINVAL)
258 (cpp != LPDDR4_CTL_REGS) &&
259 (cpp != LPDDR4_PHY_REGS) &&
260 (cpp != LPDDR4_PHY_INDEP_REGS)
268 * All 'if ... else if' constructs shall be terminated with an 'else' statement
269 * (MISRA2012-RULE-15_7-3)
277 * A common function to check the validity of API functions with
278 * following parameter types
279 * @param[in] pD Driver state info specific to this instance.
280 * @param[in] cpp Indicates whether controller, PHY or PHY Independent Module register
282 * @return EINVAL invalid parameters
284 static inline uint32_t lpddr4_sanityfunction5(const lpddr4_privatedata* pd, const lpddr4_regblock cpp)
286 /* Declaring return variable */
289 if (lpddr4_privatedatasf(pd) == EINVAL)
294 (cpp != LPDDR4_CTL_REGS) &&
295 (cpp != LPDDR4_PHY_REGS) &&
296 (cpp != LPDDR4_PHY_INDEP_REGS)
304 * All 'if ... else if' constructs shall be terminated with an 'else' statement
305 * (MISRA2012-RULE-15_7-3)
313 * A common function to check the validity of API functions with
314 * following parameter types
315 * @param[in] pD Driver state info specific to this instance.
316 * @param[out] mmrValue Value which is read from memory mode register(mmr) for all devices.
317 * @param[out] mmrStatus Status of mode register read(mrr) instruction.
319 * @return EINVAL invalid parameters
321 static inline uint32_t lpddr4_sanityfunction6(const lpddr4_privatedata* pd, const uint64_t* mmrvalue, const uint8_t* mmrstatus)
323 /* Declaring return variable */
326 if (mmrvalue == NULL)
330 else if (mmrstatus == NULL)
334 else if (lpddr4_privatedatasf(pd) == EINVAL)
341 * All 'if ... else if' constructs shall be terminated with an 'else' statement
342 * (MISRA2012-RULE-15_7-3)
350 * A common function to check the validity of API functions with
351 * following parameter types
352 * @param[in] pD Driver state info specific to this instance.
353 * @param[out] mrwStatus Status of mode register write(mrw) instruction.
355 * @return EINVAL invalid parameters
357 static inline uint32_t lpddr4_sanityfunction7(const lpddr4_privatedata* pd, const uint8_t* mrwstatus)
359 /* Declaring return variable */
362 if (mrwstatus == NULL)
366 else if (lpddr4_privatedatasf(pd) == EINVAL)
373 * All 'if ... else if' constructs shall be terminated with an 'else' statement
374 * (MISRA2012-RULE-15_7-3)
382 * A common function to check the validity of API functions with
383 * following parameter types
384 * @param[in] pD Driver state info specific to this instance.
385 * @param[in] regValues Register values to be written
387 * @return EINVAL invalid parameters
389 static inline uint32_t lpddr4_sanityfunction8(const lpddr4_privatedata* pd, const lpddr4_reginitdata* regvalues)
391 /* Declaring return variable */
394 if (lpddr4_privatedatasf(pd) == EINVAL)
398 else if (lpddr4_reginitdatasf(regvalues) == EINVAL)
405 * All 'if ... else if' constructs shall be terminated with an 'else' statement
406 * (MISRA2012-RULE-15_7-3)
414 * A common function to check the validity of API functions with
415 * following parameter types
416 * @param[in] pD Driver state info specific to this instance.
417 * @param[out] regValues Register values which are read
419 * @return EINVAL invalid parameters
421 static inline uint32_t lpddr4_sanityfunction11(const lpddr4_privatedata* pd, const lpddr4_reginitdata* regvalues)
423 /* Declaring return variable */
426 if (regvalues == NULL)
430 else if (lpddr4_privatedatasf(pd) == EINVAL)
437 * All 'if ... else if' constructs shall be terminated with an 'else' statement
438 * (MISRA2012-RULE-15_7-3)
446 * A common function to check the validity of API functions with
447 * following parameter types
448 * @param[in] pD Driver state info specific to this instance.
449 * @param[out] mask Value of interrupt mask
451 * @return EINVAL invalid parameters
453 static inline uint32_t lpddr4_sanityfunction14(const lpddr4_privatedata* pd, const uint64_t* mask)
455 /* Declaring return variable */
462 else if (lpddr4_privatedatasf(pd) == EINVAL)
469 * All 'if ... else if' constructs shall be terminated with an 'else' statement
470 * (MISRA2012-RULE-15_7-3)
478 * A common function to check the validity of API functions with
479 * following parameter types
480 * @param[in] pD Driver state info specific to this instance.
481 * @param[in] mask Value of interrupt mask to be written
483 * @return EINVAL invalid parameters
485 static inline uint32_t lpddr4_sanityfunction15(const lpddr4_privatedata* pd, const uint64_t* mask)
487 /* Declaring return variable */
494 else if (lpddr4_privatedatasf(pd) == EINVAL)
501 * All 'if ... else if' constructs shall be terminated with an 'else' statement
502 * (MISRA2012-RULE-15_7-3)
510 * A common function to check the validity of API functions with
511 * following parameter types
512 * @param[in] pD Driver state info specific to this instance.
513 * @param[in] intr Interrupt to be checked
514 * @param[out] irqStatus Status of the interrupt, TRUE if active
516 * @return EINVAL invalid parameters
518 static inline uint32_t lpddr4_sanityfunction16(const lpddr4_privatedata* pd, const lpddr4_ctlinterrupt intr, const bool* irqstatus)
520 /* Declaring return variable */
523 if (irqstatus == NULL)
527 else if (lpddr4_privatedatasf(pd) == EINVAL)
532 (intr != LPDDR4_RESET_DONE) &&
533 (intr != LPDDR4_BUS_ACCESS_ERROR) &&
534 (intr != LPDDR4_MULTIPLE_BUS_ACCESS_ERROR) &&
535 (intr != LPDDR4_ECC_MULTIPLE_CORR_ERROR) &&
536 (intr != LPDDR4_ECC_MULTIPLE_UNCORR_ERROR) &&
537 (intr != LPDDR4_ECC_WRITEBACK_EXEC_ERROR) &&
538 (intr != LPDDR4_ECC_SCRUB_DONE) &&
539 (intr != LPDDR4_ECC_SCRUB_ERROR) &&
540 (intr != LPDDR4_PORT_COMMAND_ERROR) &&
541 (intr != LPDDR4_MC_INIT_DONE) &&
542 (intr != LPDDR4_LP_DONE) &&
543 (intr != LPDDR4_BIST_DONE) &&
544 (intr != LPDDR4_WRAP_ERROR) &&
545 (intr != LPDDR4_INVALID_BURST_ERROR) &&
546 (intr != LPDDR4_RDLVL_ERROR) &&
547 (intr != LPDDR4_RDLVL_GATE_ERROR) &&
548 (intr != LPDDR4_WRLVL_ERROR) &&
549 (intr != LPDDR4_CA_TRAINING_ERROR) &&
550 (intr != LPDDR4_DFI_UPDATE_ERROR) &&
551 (intr != LPDDR4_MRR_ERROR) &&
552 (intr != LPDDR4_PHY_MASTER_ERROR) &&
553 (intr != LPDDR4_WRLVL_REQ) &&
554 (intr != LPDDR4_RDLVL_REQ) &&
555 (intr != LPDDR4_RDLVL_GATE_REQ) &&
556 (intr != LPDDR4_CA_TRAINING_REQ) &&
557 (intr != LPDDR4_LEVELING_DONE) &&
558 (intr != LPDDR4_PHY_ERROR) &&
559 (intr != LPDDR4_MR_READ_DONE) &&
560 (intr != LPDDR4_TEMP_CHANGE) &&
561 (intr != LPDDR4_TEMP_ALERT) &&
562 (intr != LPDDR4_SW_DQS_COMPLETE) &&
563 (intr != LPDDR4_DQS_OSC_BV_UPDATED) &&
564 (intr != LPDDR4_DQS_OSC_OVERFLOW) &&
565 (intr != LPDDR4_DQS_OSC_VAR_OUT) &&
566 (intr != LPDDR4_MR_WRITE_DONE) &&
567 (intr != LPDDR4_INHIBIT_DRAM_DONE) &&
568 (intr != LPDDR4_DFI_INIT_STATE) &&
569 (intr != LPDDR4_DLL_RESYNC_DONE) &&
570 (intr != LPDDR4_TDFI_TO) &&
571 (intr != LPDDR4_DFS_DONE) &&
572 (intr != LPDDR4_DFS_STATUS) &&
573 (intr != LPDDR4_REFRESH_STATUS) &&
574 (intr != LPDDR4_ZQ_STATUS) &&
575 (intr != LPDDR4_SW_REQ_MODE) &&
576 (intr != LPDDR4_LOR_BITS)
584 * All 'if ... else if' constructs shall be terminated with an 'else' statement
585 * (MISRA2012-RULE-15_7-3)
593 * A common function to check the validity of API functions with
594 * following parameter types
595 * @param[in] pD Driver state info specific to this instance.
596 * @param[in] intr Interrupt to be acknowledged
598 * @return EINVAL invalid parameters
600 static inline uint32_t lpddr4_sanityfunction17(const lpddr4_privatedata* pd, const lpddr4_ctlinterrupt intr)
602 /* Declaring return variable */
605 if (lpddr4_privatedatasf(pd) == EINVAL)
610 (intr != LPDDR4_RESET_DONE) &&
611 (intr != LPDDR4_BUS_ACCESS_ERROR) &&
612 (intr != LPDDR4_MULTIPLE_BUS_ACCESS_ERROR) &&
613 (intr != LPDDR4_ECC_MULTIPLE_CORR_ERROR) &&
614 (intr != LPDDR4_ECC_MULTIPLE_UNCORR_ERROR) &&
615 (intr != LPDDR4_ECC_WRITEBACK_EXEC_ERROR) &&
616 (intr != LPDDR4_ECC_SCRUB_DONE) &&
617 (intr != LPDDR4_ECC_SCRUB_ERROR) &&
618 (intr != LPDDR4_PORT_COMMAND_ERROR) &&
619 (intr != LPDDR4_MC_INIT_DONE) &&
620 (intr != LPDDR4_LP_DONE) &&
621 (intr != LPDDR4_BIST_DONE) &&
622 (intr != LPDDR4_WRAP_ERROR) &&
623 (intr != LPDDR4_INVALID_BURST_ERROR) &&
624 (intr != LPDDR4_RDLVL_ERROR) &&
625 (intr != LPDDR4_RDLVL_GATE_ERROR) &&
626 (intr != LPDDR4_WRLVL_ERROR) &&
627 (intr != LPDDR4_CA_TRAINING_ERROR) &&
628 (intr != LPDDR4_DFI_UPDATE_ERROR) &&
629 (intr != LPDDR4_MRR_ERROR) &&
630 (intr != LPDDR4_PHY_MASTER_ERROR) &&
631 (intr != LPDDR4_WRLVL_REQ) &&
632 (intr != LPDDR4_RDLVL_REQ) &&
633 (intr != LPDDR4_RDLVL_GATE_REQ) &&
634 (intr != LPDDR4_CA_TRAINING_REQ) &&
635 (intr != LPDDR4_LEVELING_DONE) &&
636 (intr != LPDDR4_PHY_ERROR) &&
637 (intr != LPDDR4_MR_READ_DONE) &&
638 (intr != LPDDR4_TEMP_CHANGE) &&
639 (intr != LPDDR4_TEMP_ALERT) &&
640 (intr != LPDDR4_SW_DQS_COMPLETE) &&
641 (intr != LPDDR4_DQS_OSC_BV_UPDATED) &&
642 (intr != LPDDR4_DQS_OSC_OVERFLOW) &&
643 (intr != LPDDR4_DQS_OSC_VAR_OUT) &&
644 (intr != LPDDR4_MR_WRITE_DONE) &&
645 (intr != LPDDR4_INHIBIT_DRAM_DONE) &&
646 (intr != LPDDR4_DFI_INIT_STATE) &&
647 (intr != LPDDR4_DLL_RESYNC_DONE) &&
648 (intr != LPDDR4_TDFI_TO) &&
649 (intr != LPDDR4_DFS_DONE) &&
650 (intr != LPDDR4_DFS_STATUS) &&
651 (intr != LPDDR4_REFRESH_STATUS) &&
652 (intr != LPDDR4_ZQ_STATUS) &&
653 (intr != LPDDR4_SW_REQ_MODE) &&
654 (intr != LPDDR4_LOR_BITS)
662 * All 'if ... else if' constructs shall be terminated with an 'else' statement
663 * (MISRA2012-RULE-15_7-3)
671 * A common function to check the validity of API functions with
672 * following parameter types
673 * @param[in] pD Driver state info specific to this instance.
674 * @param[out] mask Value of interrupt mask
676 * @return EINVAL invalid parameters
678 static inline uint32_t lpddr4_sanityfunction18(const lpddr4_privatedata* pd, const uint32_t* mask)
680 /* Declaring return variable */
687 else if (lpddr4_privatedatasf(pd) == EINVAL)
694 * All 'if ... else if' constructs shall be terminated with an 'else' statement
695 * (MISRA2012-RULE-15_7-3)
703 * A common function to check the validity of API functions with
704 * following parameter types
705 * @param[in] pD Driver state info specific to this instance.
706 * @param[in] intr Interrupt to be checked
707 * @param[out] irqStatus Status of the interrupt, TRUE if active
709 * @return EINVAL invalid parameters
711 static inline uint32_t lpddr4_sanityfunction20(const lpddr4_privatedata* pd, const lpddr4_phyindepinterrupt intr, const bool* irqstatus)
713 /* Declaring return variable */
716 if (irqstatus == NULL)
720 else if (lpddr4_privatedatasf(pd) == EINVAL)
725 (intr != LPDDR4_PHY_INDEP_INIT_DONE_BIT) &&
726 (intr != LPDDR4_PHY_INDEP_CONTROL_ERROR_BIT) &&
727 (intr != LPDDR4_PHY_INDEP_CA_PARITY_ERR_BIT) &&
728 (intr != LPDDR4_PHY_INDEP_RDLVL_ERROR_BIT) &&
729 (intr != LPDDR4_PHY_INDEP_RDLVL_GATE_ERROR_BIT) &&
730 (intr != LPDDR4_PHY_INDEP_WRLVL_ERROR_BIT) &&
731 (intr != LPDDR4_PHY_INDEP_CALVL_ERROR_BIT) &&
732 (intr != LPDDR4_PHY_INDEP_WDQLVL_ERROR_BIT) &&
733 (intr != LPDDR4_PHY_INDEP_UPDATE_ERROR_BIT) &&
734 (intr != LPDDR4_PHY_INDEP_RDLVL_REQ_BIT) &&
735 (intr != LPDDR4_PHY_INDEP_RDLVL_GATE_REQ_BIT) &&
736 (intr != LPDDR4_PHY_INDEP_WRLVL_REQ_BIT) &&
737 (intr != LPDDR4_PHY_INDEP_CALVL_REQ_BIT) &&
738 (intr != LPDDR4_PHY_INDEP_WDQLVL_REQ_BIT) &&
739 (intr != LPDDR4_PHY_INDEP_LVL_DONE_BIT) &&
740 (intr != LPDDR4_PHY_INDEP_BIST_DONE_BIT) &&
741 (intr != LPDDR4_PHY_INDEP_TDFI_INIT_TIME_OUT_BIT) &&
742 (intr != LPDDR4_PHY_INDEP_DLL_LOCK_STATE_CHANGE_BIT)
750 * All 'if ... else if' constructs shall be terminated with an 'else' statement
751 * (MISRA2012-RULE-15_7-3)
759 * A common function to check the validity of API functions with
760 * following parameter types
761 * @param[in] pD Driver state info specific to this instance.
762 * @param[in] intr Interrupt to be acknowledged
764 * @return EINVAL invalid parameters
766 static inline uint32_t lpddr4_sanityfunction21(const lpddr4_privatedata* pd, const lpddr4_phyindepinterrupt intr)
768 /* Declaring return variable */
771 if (lpddr4_privatedatasf(pd) == EINVAL)
776 (intr != LPDDR4_PHY_INDEP_INIT_DONE_BIT) &&
777 (intr != LPDDR4_PHY_INDEP_CONTROL_ERROR_BIT) &&
778 (intr != LPDDR4_PHY_INDEP_CA_PARITY_ERR_BIT) &&
779 (intr != LPDDR4_PHY_INDEP_RDLVL_ERROR_BIT) &&
780 (intr != LPDDR4_PHY_INDEP_RDLVL_GATE_ERROR_BIT) &&
781 (intr != LPDDR4_PHY_INDEP_WRLVL_ERROR_BIT) &&
782 (intr != LPDDR4_PHY_INDEP_CALVL_ERROR_BIT) &&
783 (intr != LPDDR4_PHY_INDEP_WDQLVL_ERROR_BIT) &&
784 (intr != LPDDR4_PHY_INDEP_UPDATE_ERROR_BIT) &&
785 (intr != LPDDR4_PHY_INDEP_RDLVL_REQ_BIT) &&
786 (intr != LPDDR4_PHY_INDEP_RDLVL_GATE_REQ_BIT) &&
787 (intr != LPDDR4_PHY_INDEP_WRLVL_REQ_BIT) &&
788 (intr != LPDDR4_PHY_INDEP_CALVL_REQ_BIT) &&
789 (intr != LPDDR4_PHY_INDEP_WDQLVL_REQ_BIT) &&
790 (intr != LPDDR4_PHY_INDEP_LVL_DONE_BIT) &&
791 (intr != LPDDR4_PHY_INDEP_BIST_DONE_BIT) &&
792 (intr != LPDDR4_PHY_INDEP_TDFI_INIT_TIME_OUT_BIT) &&
793 (intr != LPDDR4_PHY_INDEP_DLL_LOCK_STATE_CHANGE_BIT)
801 * All 'if ... else if' constructs shall be terminated with an 'else' statement
802 * (MISRA2012-RULE-15_7-3)
810 * A common function to check the validity of API functions with
811 * following parameter types
812 * @param[in] pD Driver state info specific to this instance.
813 * @param[out] debugInfo status
815 * @return EINVAL invalid parameters
817 static inline uint32_t lpddr4_sanityfunction22(const lpddr4_privatedata* pd, const lpddr4_debuginfo* debuginfo)
819 /* Declaring return variable */
822 if (debuginfo == NULL)
826 else if (lpddr4_privatedatasf(pd) == EINVAL)
833 * All 'if ... else if' constructs shall be terminated with an 'else' statement
834 * (MISRA2012-RULE-15_7-3)
842 * A common function to check the validity of API functions with
843 * following parameter types
844 * @param[in] pD Driver state info specific to this instance.
845 * @param[in] lpiWakeUpParam LPI timing parameter
846 * @param[in] fspNum Frequency copy
847 * @param[out] cycles Timing value(in cycles)
849 * @return EINVAL invalid parameters
851 static inline uint32_t lpddr4_sanityfunction23(const lpddr4_privatedata* pd, const lpddr4_lpiwakeupparam* lpiwakeupparam, const lpddr4_ctlfspnum* fspnum, const uint32_t* cycles)
853 /* Declaring return variable */
856 if (lpiwakeupparam == NULL)
860 else if (fspnum == NULL)
864 else if (cycles == NULL)
868 else if (lpddr4_privatedatasf(pd) == EINVAL)
873 (*lpiwakeupparam != LPDDR4_LPI_PD_WAKEUP_FN) &&
874 (*lpiwakeupparam != LPDDR4_LPI_SR_SHORT_WAKEUP_FN) &&
875 (*lpiwakeupparam != LPDDR4_LPI_SR_LONG_WAKEUP_FN) &&
876 (*lpiwakeupparam != LPDDR4_LPI_SR_LONG_MCCLK_GATE_WAKEUP_FN) &&
877 (*lpiwakeupparam != LPDDR4_LPI_SRPD_SHORT_WAKEUP_FN) &&
878 (*lpiwakeupparam != LPDDR4_LPI_SRPD_LONG_WAKEUP_FN) &&
879 (*lpiwakeupparam != LPDDR4_LPI_SRPD_LONG_MCCLK_GATE_WAKEUP_FN)
885 (*fspnum != LPDDR4_FSP_0) &&
886 (*fspnum != LPDDR4_FSP_1) &&
887 (*fspnum != LPDDR4_FSP_2)
895 * All 'if ... else if' constructs shall be terminated with an 'else' statement
896 * (MISRA2012-RULE-15_7-3)
904 * A common function to check the validity of API functions with
905 * following parameter types
906 * @param[in] pD Driver state info specific to this instance.
907 * @param[out] eccParam ECC parameter setting
909 * @return EINVAL invalid parameters
911 static inline uint32_t lpddr4_sanityfunction25(const lpddr4_privatedata* pd, const lpddr4_eccenable* eccparam)
913 /* Declaring return variable */
916 if (eccparam == NULL)
920 else if (lpddr4_privatedatasf(pd) == EINVAL)
927 * All 'if ... else if' constructs shall be terminated with an 'else' statement
928 * (MISRA2012-RULE-15_7-3)
936 * A common function to check the validity of API functions with
937 * following parameter types
938 * @param[in] pD Driver state info specific to this instance.
939 * @param[in] eccParam ECC control parameter setting
941 * @return EINVAL invalid parameters
943 static inline uint32_t lpddr4_sanityfunction26(const lpddr4_privatedata* pd, const lpddr4_eccenable* eccparam)
945 /* Declaring return variable */
948 if (eccparam == NULL)
952 else if (lpddr4_privatedatasf(pd) == EINVAL)
957 (*eccparam != LPDDR4_ECC_DISABLED) &&
958 (*eccparam != LPDDR4_ECC_ENABLED) &&
959 (*eccparam != LPDDR4_ECC_ERR_DETECT) &&
960 (*eccparam != LPDDR4_ECC_ERR_DETECT_CORRECT)
968 * All 'if ... else if' constructs shall be terminated with an 'else' statement
969 * (MISRA2012-RULE-15_7-3)
977 * A common function to check the validity of API functions with
978 * following parameter types
979 * @param[in] pD Driver state info specific to this instance.
980 * @param[out] mode Half Datapath setting
982 * @return EINVAL invalid parameters
984 static inline uint32_t lpddr4_sanityfunction27(const lpddr4_privatedata* pd, const lpddr4_reducmode* mode)
986 /* Declaring return variable */
993 else if (lpddr4_privatedatasf(pd) == EINVAL)
1000 * All 'if ... else if' constructs shall be terminated with an 'else' statement
1001 * (MISRA2012-RULE-15_7-3)
1009 * A common function to check the validity of API functions with
1010 * following parameter types
1011 * @param[in] pD Driver state info specific to this instance.
1012 * @param[in] mode Half Datapath setting
1014 * @return EINVAL invalid parameters
1016 static inline uint32_t lpddr4_sanityfunction28(const lpddr4_privatedata* pd, const lpddr4_reducmode* mode)
1018 /* Declaring return variable */
1025 else if (lpddr4_privatedatasf(pd) == EINVAL)
1030 (*mode != LPDDR4_REDUC_ON) &&
1031 (*mode != LPDDR4_REDUC_OFF)
1039 * All 'if ... else if' constructs shall be terminated with an 'else' statement
1040 * (MISRA2012-RULE-15_7-3)
1048 * A common function to check the validity of API functions with
1049 * following parameter types
1050 * @param[in] pD Driver state info specific to this instance.
1051 * @param[out] on_off DBI read value
1053 * @return EINVAL invalid parameters
1055 static inline uint32_t lpddr4_sanityfunction29(const lpddr4_privatedata* pd, const bool* on_off)
1057 /* Declaring return variable */
1064 else if (lpddr4_privatedatasf(pd) == EINVAL)
1071 * All 'if ... else if' constructs shall be terminated with an 'else' statement
1072 * (MISRA2012-RULE-15_7-3)
1080 * A common function to check the validity of API functions with
1081 * following parameter types
1082 * @param[in] pD Driver state info specific to this instance.
1083 * @param[in] mode status
1085 * @return EINVAL invalid parameters
1087 static inline uint32_t lpddr4_sanityfunction31(const lpddr4_privatedata* pd, const lpddr4_dbimode* mode)
1089 /* Declaring return variable */
1096 else if (lpddr4_privatedatasf(pd) == EINVAL)
1101 (*mode != LPDDR4_DBI_RD_ON) &&
1102 (*mode != LPDDR4_DBI_RD_OFF) &&
1103 (*mode != LPDDR4_DBI_WR_ON) &&
1104 (*mode != LPDDR4_DBI_WR_OFF)
1112 * All 'if ... else if' constructs shall be terminated with an 'else' statement
1113 * (MISRA2012-RULE-15_7-3)
1121 * A common function to check the validity of API functions with
1122 * following parameter types
1123 * @param[in] pD Driver state info specific to this instance.
1124 * @param[in] fspNum Frequency set number
1125 * @param[out] cycles Refresh rate (in cycles)
1127 * @return EINVAL invalid parameters
1129 static inline uint32_t lpddr4_sanityfunction32(const lpddr4_privatedata* pd, const lpddr4_ctlfspnum* fspnum, const uint32_t* cycles)
1131 /* Declaring return variable */
1138 else if (cycles == NULL)
1142 else if (lpddr4_privatedatasf(pd) == EINVAL)
1147 (*fspnum != LPDDR4_FSP_0) &&
1148 (*fspnum != LPDDR4_FSP_1) &&
1149 (*fspnum != LPDDR4_FSP_2)
1157 * All 'if ... else if' constructs shall be terminated with an 'else' statement
1158 * (MISRA2012-RULE-15_7-3)
1165 #endif /* LPDDR4_SANITY_H */