@@ -133,13 +133,30 @@ struct rzg2l_register_offsets {
133
133
u16 sd_ch ;
134
134
};
135
135
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
+
136
149
/**
137
150
* struct rzg2l_hwcfg - hardware configuration data structure
138
151
* @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
139
154
* @func_base: base number for port function (see register PFC)
140
155
*/
141
156
struct rzg2l_hwcfg {
142
157
const struct rzg2l_register_offsets regs ;
158
+ u16 iolh_groupa_ua [RZG2L_IOLH_IDX_MAX ];
159
+ u16 iolh_groupb_oi [4 ];
143
160
u8 func_base ;
144
161
};
145
162
@@ -177,9 +194,6 @@ struct rzg2l_pinctrl {
177
194
struct mutex mutex ; /* serialize adding groups and functions */
178
195
};
179
196
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
-
183
197
static void rzg2l_pinctrl_set_pfc_mode (struct rzg2l_pinctrl * pctrl ,
184
198
u8 pin , u8 off , u8 func )
185
199
{
@@ -604,7 +618,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
604
618
return - EINVAL ;
605
619
606
620
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 ;
608
622
break ;
609
623
}
610
624
@@ -615,7 +629,7 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
615
629
return - EINVAL ;
616
630
617
631
index = rzg2l_read_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK );
618
- arg = iolh_groupb_oi [index ];
632
+ arg = hwcfg -> iolh_groupb_oi [index ];
619
633
break ;
620
634
}
621
635
@@ -703,11 +717,12 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
703
717
if (!(cfg & PIN_CFG_IOLH_A ))
704
718
return - EINVAL ;
705
719
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 ))
708
723
break ;
709
724
}
710
- if (index >= ARRAY_SIZE ( iolh_groupa_mA ))
725
+ if (index == ( RZG2L_IOLH_IDX_3V3 + RZG2L_IOLH_MAX_DS_ENTRIES ))
711
726
return - EINVAL ;
712
727
713
728
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,
721
736
if (!(cfg & PIN_CFG_IOLH_B ))
722
737
return - EINVAL ;
723
738
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 ])
726
741
break ;
727
742
}
728
- if (index >= ARRAY_SIZE (iolh_groupb_oi ))
743
+ if (index == ARRAY_SIZE (hwcfg -> iolh_groupb_oi ))
729
744
return - EINVAL ;
730
745
731
746
rzg2l_rmw_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK , index );
@@ -1563,6 +1578,11 @@ static const struct rzg2l_hwcfg rzg2l_hwcfg = {
1563
1578
.pwpr = 0x3014 ,
1564
1579
.sd_ch = 0x3000 ,
1565
1580
},
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 , },
1566
1586
};
1567
1587
1568
1588
static struct rzg2l_pinctrl_data r9a07g043_data = {
0 commit comments