@@ -133,13 +133,30 @@ struct rzg2l_register_offsets {
133133 u16 sd_ch ;
134134};
135135
136+ /**
137+ * enum rzg2l_iolh_index - starting indices in IOLH specific arrays
138+ * @RZG2L_IOLH_IDX_3V3: starting index for 3V3 power source
139+ * @RZG2L_IOLH_IDX_MAX: maximum index
140+ */
141+ enum rzg2l_iolh_index {
142+ RZG2L_IOLH_IDX_3V3 = 0 ,
143+ RZG2L_IOLH_IDX_MAX = 4 ,
144+ };
145+
146+ /* Maximum number of driver strength entries per power source. */
147+ #define RZG2L_IOLH_MAX_DS_ENTRIES (4)
148+
136149/**
137150 * struct rzg2l_hwcfg - hardware configuration data structure
138151 * @regs: hardware specific register offsets
152+ * @iolh_groupa_ua: IOLH group A uA specific values
153+ * @iolh_groupb_oi: IOLH group B output impedance specific values
139154 * @func_base: base number for port function (see register PFC)
140155 */
141156struct rzg2l_hwcfg {
142157 const struct rzg2l_register_offsets regs ;
158+ u16 iolh_groupa_ua [RZG2L_IOLH_IDX_MAX ];
159+ u16 iolh_groupb_oi [4 ];
143160 u8 func_base ;
144161};
145162
@@ -177,9 +194,6 @@ struct rzg2l_pinctrl {
177194 struct mutex mutex ; /* serialize adding groups and functions */
178195};
179196
180- static const unsigned int iolh_groupa_mA [] = { 2 , 4 , 8 , 12 };
181- static const unsigned int iolh_groupb_oi [] = { 100 , 66 , 50 , 33 };
182-
183197static void rzg2l_pinctrl_set_pfc_mode (struct rzg2l_pinctrl * pctrl ,
184198 u8 pin , u8 off , u8 func )
185199{
@@ -604,7 +618,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
604618 return - EINVAL ;
605619
606620 index = rzg2l_read_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK );
607- arg = iolh_groupa_mA [index ] ;
621+ arg = hwcfg -> iolh_groupa_ua [index + RZG2L_IOLH_IDX_3V3 ] / 1000 ;
608622 break ;
609623 }
610624
@@ -615,7 +629,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
615629 return - EINVAL ;
616630
617631 index = rzg2l_read_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK );
618- arg = iolh_groupb_oi [index ];
632+ arg = hwcfg -> iolh_groupb_oi [index ];
619633 break ;
620634 }
621635
@@ -703,11 +717,12 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
703717 if (!(cfg & PIN_CFG_IOLH_A ))
704718 return - EINVAL ;
705719
706- for (index = 0 ; index < ARRAY_SIZE (iolh_groupa_mA ); index ++ ) {
707- if (arg == iolh_groupa_mA [index ])
720+ for (index = RZG2L_IOLH_IDX_3V3 ;
721+ index < RZG2L_IOLH_IDX_3V3 + RZG2L_IOLH_MAX_DS_ENTRIES ; index ++ ) {
722+ if (arg == (hwcfg -> iolh_groupa_ua [index ] / 1000 ))
708723 break ;
709724 }
710- if (index >= ARRAY_SIZE ( iolh_groupa_mA ))
725+ if (index == ( RZG2L_IOLH_IDX_3V3 + RZG2L_IOLH_MAX_DS_ENTRIES ))
711726 return - EINVAL ;
712727
713728 rzg2l_rmw_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK , index );
@@ -721,11 +736,11 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
721736 if (!(cfg & PIN_CFG_IOLH_B ))
722737 return - EINVAL ;
723738
724- for (index = 0 ; index < ARRAY_SIZE (iolh_groupb_oi ); index ++ ) {
725- if (arg == iolh_groupb_oi [index ])
739+ for (index = 0 ; index < ARRAY_SIZE (hwcfg -> iolh_groupb_oi ); index ++ ) {
740+ if (arg == hwcfg -> iolh_groupb_oi [index ])
726741 break ;
727742 }
728- if (index >= ARRAY_SIZE (iolh_groupb_oi ))
743+ if (index == ARRAY_SIZE (hwcfg -> iolh_groupb_oi ))
729744 return - EINVAL ;
730745
731746 rzg2l_rmw_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK , index );
@@ -1563,6 +1578,11 @@ static const struct rzg2l_hwcfg rzg2l_hwcfg = {
15631578 .pwpr = 0x3014 ,
15641579 .sd_ch = 0x3000 ,
15651580 },
1581+ .iolh_groupa_ua = {
1582+ /* 3v3 power source */
1583+ [RZG2L_IOLH_IDX_3V3 ] = 2000 , 4000 , 8000 , 12000 ,
1584+ },
1585+ .iolh_groupb_oi = { 100 , 66 , 50 , 33 , },
15661586};
15671587
15681588static struct rzg2l_pinctrl_data r9a07g043_data = {
0 commit comments