1*654c293eSBiju Das /* SPDX-License-Identifier: GPL-2.0-only */ 2*654c293eSBiju Das /* 3*654c293eSBiju Das * MFD internals for Renesas RZ/G2L MTU3 Core driver 4*654c293eSBiju Das * 5*654c293eSBiju Das * Copyright (C) 2023 Renesas Electronics Corporation 6*654c293eSBiju Das */ 7*654c293eSBiju Das 8*654c293eSBiju Das #ifndef RZ_MTU3_MFD_H 9*654c293eSBiju Das #define RZ_MTU3_MFD_H 10*654c293eSBiju Das 11*654c293eSBiju Das #define MTU_8BIT_CH_0(_tier, _nfcr, _tcr, _tcr2, _tmdr1, _tiorh, _tiorl, _tbtm) \ 12*654c293eSBiju Das { \ 13*654c293eSBiju Das [RZ_MTU3_TIER] = _tier, \ 14*654c293eSBiju Das [RZ_MTU3_NFCR] = _nfcr, \ 15*654c293eSBiju Das [RZ_MTU3_TCR] = _tcr, \ 16*654c293eSBiju Das [RZ_MTU3_TCR2] = _tcr2, \ 17*654c293eSBiju Das [RZ_MTU3_TMDR1] = _tmdr1, \ 18*654c293eSBiju Das [RZ_MTU3_TIORH] = _tiorh, \ 19*654c293eSBiju Das [RZ_MTU3_TIORL] = _tiorl, \ 20*654c293eSBiju Das [RZ_MTU3_TBTM] = _tbtm \ 21*654c293eSBiju Das } 22*654c293eSBiju Das 23*654c293eSBiju Das #define MTU_8BIT_CH_1_2(_tier, _nfcr, _tsr, _tcr, _tcr2, _tmdr1, _tior) \ 24*654c293eSBiju Das { \ 25*654c293eSBiju Das [RZ_MTU3_TIER] = _tier, \ 26*654c293eSBiju Das [RZ_MTU3_NFCR] = _nfcr, \ 27*654c293eSBiju Das [RZ_MTU3_TSR] = _tsr, \ 28*654c293eSBiju Das [RZ_MTU3_TCR] = _tcr, \ 29*654c293eSBiju Das [RZ_MTU3_TCR2] = _tcr2, \ 30*654c293eSBiju Das [RZ_MTU3_TMDR1] = _tmdr1, \ 31*654c293eSBiju Das [RZ_MTU3_TIOR] = _tior \ 32*654c293eSBiju Das } \ 33*654c293eSBiju Das 34*654c293eSBiju Das #define MTU_8BIT_CH_3_4_6_7(_tier, _nfcr, _tsr, _tcr, _tcr2, _tmdr1, _tiorh, _tiorl, _tbtm) \ 35*654c293eSBiju Das { \ 36*654c293eSBiju Das [RZ_MTU3_TIER] = _tier, \ 37*654c293eSBiju Das [RZ_MTU3_NFCR] = _nfcr, \ 38*654c293eSBiju Das [RZ_MTU3_TSR] = _tsr, \ 39*654c293eSBiju Das [RZ_MTU3_TCR] = _tcr, \ 40*654c293eSBiju Das [RZ_MTU3_TCR2] = _tcr2, \ 41*654c293eSBiju Das [RZ_MTU3_TMDR1] = _tmdr1, \ 42*654c293eSBiju Das [RZ_MTU3_TIORH] = _tiorh, \ 43*654c293eSBiju Das [RZ_MTU3_TIORL] = _tiorl, \ 44*654c293eSBiju Das [RZ_MTU3_TBTM] = _tbtm \ 45*654c293eSBiju Das } \ 46*654c293eSBiju Das 47*654c293eSBiju Das #define MTU_8BIT_CH_5(_tier, _nfcr, _tstr, _tcntcmpclr, _tcru, _tcr2u, _tioru, \ 48*654c293eSBiju Das _tcrv, _tcr2v, _tiorv, _tcrw, _tcr2w, _tiorw) \ 49*654c293eSBiju Das { \ 50*654c293eSBiju Das [RZ_MTU3_TIER] = _tier, \ 51*654c293eSBiju Das [RZ_MTU3_NFCR] = _nfcr, \ 52*654c293eSBiju Das [RZ_MTU3_TSTR] = _tstr, \ 53*654c293eSBiju Das [RZ_MTU3_TCNTCMPCLR] = _tcntcmpclr, \ 54*654c293eSBiju Das [RZ_MTU3_TCRU] = _tcru, \ 55*654c293eSBiju Das [RZ_MTU3_TCR2U] = _tcr2u, \ 56*654c293eSBiju Das [RZ_MTU3_TIORU] = _tioru, \ 57*654c293eSBiju Das [RZ_MTU3_TCRV] = _tcrv, \ 58*654c293eSBiju Das [RZ_MTU3_TCR2V] = _tcr2v, \ 59*654c293eSBiju Das [RZ_MTU3_TIORV] = _tiorv, \ 60*654c293eSBiju Das [RZ_MTU3_TCRW] = _tcrw, \ 61*654c293eSBiju Das [RZ_MTU3_TCR2W] = _tcr2w, \ 62*654c293eSBiju Das [RZ_MTU3_TIORW] = _tiorw \ 63*654c293eSBiju Das } \ 64*654c293eSBiju Das 65*654c293eSBiju Das #define MTU_8BIT_CH_8(_tier, _nfcr, _tcr, _tcr2, _tmdr1, _tiorh, _tiorl) \ 66*654c293eSBiju Das { \ 67*654c293eSBiju Das [RZ_MTU3_TIER] = _tier, \ 68*654c293eSBiju Das [RZ_MTU3_NFCR] = _nfcr, \ 69*654c293eSBiju Das [RZ_MTU3_TCR] = _tcr, \ 70*654c293eSBiju Das [RZ_MTU3_TCR2] = _tcr2, \ 71*654c293eSBiju Das [RZ_MTU3_TMDR1] = _tmdr1, \ 72*654c293eSBiju Das [RZ_MTU3_TIORH] = _tiorh, \ 73*654c293eSBiju Das [RZ_MTU3_TIORL] = _tiorl \ 74*654c293eSBiju Das } \ 75*654c293eSBiju Das 76*654c293eSBiju Das #define MTU_16BIT_CH_0(_tcnt, _tgra, _tgrb, _tgrc, _tgrd, _tgre, _tgrf) \ 77*654c293eSBiju Das { \ 78*654c293eSBiju Das [RZ_MTU3_TCNT] = _tcnt, \ 79*654c293eSBiju Das [RZ_MTU3_TGRA] = _tgra, \ 80*654c293eSBiju Das [RZ_MTU3_TGRB] = _tgrb, \ 81*654c293eSBiju Das [RZ_MTU3_TGRC] = _tgrc, \ 82*654c293eSBiju Das [RZ_MTU3_TGRD] = _tgrd, \ 83*654c293eSBiju Das [RZ_MTU3_TGRE] = _tgre, \ 84*654c293eSBiju Das [RZ_MTU3_TGRF] = _tgrf \ 85*654c293eSBiju Das } 86*654c293eSBiju Das 87*654c293eSBiju Das #define MTU_16BIT_CH_1_2(_tcnt, _tgra, _tgrb) \ 88*654c293eSBiju Das { \ 89*654c293eSBiju Das [RZ_MTU3_TCNT] = _tcnt, \ 90*654c293eSBiju Das [RZ_MTU3_TGRA] = _tgra, \ 91*654c293eSBiju Das [RZ_MTU3_TGRB] = _tgrb \ 92*654c293eSBiju Das } 93*654c293eSBiju Das 94*654c293eSBiju Das #define MTU_16BIT_CH_3_6(_tcnt, _tgra, _tgrb, _tgrc, _tgrd, _tgre) \ 95*654c293eSBiju Das { \ 96*654c293eSBiju Das [RZ_MTU3_TCNT] = _tcnt, \ 97*654c293eSBiju Das [RZ_MTU3_TGRA] = _tgra, \ 98*654c293eSBiju Das [RZ_MTU3_TGRB] = _tgrb, \ 99*654c293eSBiju Das [RZ_MTU3_TGRC] = _tgrc, \ 100*654c293eSBiju Das [RZ_MTU3_TGRD] = _tgrd, \ 101*654c293eSBiju Das [RZ_MTU3_TGRE] = _tgre \ 102*654c293eSBiju Das } 103*654c293eSBiju Das 104*654c293eSBiju Das #define MTU_16BIT_CH_4_7(_tcnt, _tgra, _tgrb, _tgrc, _tgrd, _tgre, _tgrf, \ 105*654c293eSBiju Das _tadcr, _tadcora, _tadcorb, _tadcobra, _tadcobrb) \ 106*654c293eSBiju Das { \ 107*654c293eSBiju Das [RZ_MTU3_TCNT] = _tcnt, \ 108*654c293eSBiju Das [RZ_MTU3_TGRA] = _tgra, \ 109*654c293eSBiju Das [RZ_MTU3_TGRB] = _tgrb, \ 110*654c293eSBiju Das [RZ_MTU3_TGRC] = _tgrc, \ 111*654c293eSBiju Das [RZ_MTU3_TGRD] = _tgrd, \ 112*654c293eSBiju Das [RZ_MTU3_TGRE] = _tgre, \ 113*654c293eSBiju Das [RZ_MTU3_TGRF] = _tgrf, \ 114*654c293eSBiju Das [RZ_MTU3_TADCR] = _tadcr, \ 115*654c293eSBiju Das [RZ_MTU3_TADCORA] = _tadcora, \ 116*654c293eSBiju Das [RZ_MTU3_TADCORB] = _tadcorb, \ 117*654c293eSBiju Das [RZ_MTU3_TADCOBRA] = _tadcobra, \ 118*654c293eSBiju Das [RZ_MTU3_TADCOBRB] = _tadcobrb \ 119*654c293eSBiju Das } 120*654c293eSBiju Das 121*654c293eSBiju Das #define MTU_16BIT_CH_5(_tcntu, _tgru, _tcntv, _tgrv, _tcntw, _tgrw) \ 122*654c293eSBiju Das { \ 123*654c293eSBiju Das [RZ_MTU3_TCNTU] = _tcntu, \ 124*654c293eSBiju Das [RZ_MTU3_TGRU] = _tgru, \ 125*654c293eSBiju Das [RZ_MTU3_TCNTV] = _tcntv, \ 126*654c293eSBiju Das [RZ_MTU3_TGRV] = _tgrv, \ 127*654c293eSBiju Das [RZ_MTU3_TCNTW] = _tcntw, \ 128*654c293eSBiju Das [RZ_MTU3_TGRW] = _tgrw \ 129*654c293eSBiju Das } 130*654c293eSBiju Das 131*654c293eSBiju Das #define MTU_32BIT_CH_1(_tcntlw, _tgralw, _tgrblw) \ 132*654c293eSBiju Das { \ 133*654c293eSBiju Das [RZ_MTU3_TCNTLW] = _tcntlw, \ 134*654c293eSBiju Das [RZ_MTU3_TGRALW] = _tgralw, \ 135*654c293eSBiju Das [RZ_MTU3_TGRBLW] = _tgrblw \ 136*654c293eSBiju Das } 137*654c293eSBiju Das 138*654c293eSBiju Das #define MTU_32BIT_CH_8(_tcnt, _tgra, _tgrb, _tgrc, _tgrd) \ 139*654c293eSBiju Das { \ 140*654c293eSBiju Das [RZ_MTU3_TCNT] = _tcnt, \ 141*654c293eSBiju Das [RZ_MTU3_TGRA] = _tgra, \ 142*654c293eSBiju Das [RZ_MTU3_TGRB] = _tgrb, \ 143*654c293eSBiju Das [RZ_MTU3_TGRC] = _tgrc, \ 144*654c293eSBiju Das [RZ_MTU3_TGRD] = _tgrd \ 145*654c293eSBiju Das } 146*654c293eSBiju Das 147*654c293eSBiju Das #endif 148