139139#define IEN (off ) (0x1800 + (off) * 8)
140140#define PUPD (off ) (0x1C00 + (off) * 8)
141141#define ISEL (off ) (0x2C00 + (off) * 8)
142+ #define NOD (off ) (0x3000 + (off) * 8)
143+ #define SMT (off ) (0x3400 + (off) * 8)
142144#define SD_CH (off , ch ) ((off) + (ch) * 4)
143145#define ETH_POC (off , ch ) ((off) + (ch) * 4)
144146#define QSPI (0x3008)
160162#define IOLH_MASK 0x03
161163#define SR_MASK 0x01
162164#define PUPD_MASK 0x03
165+ #define NOD_MASK 0x01
166+ #define SMT_MASK 0x01
163167
164168#define PM_INPUT 0x1
165169#define PM_OUTPUT 0x2
168172#define RZG2L_PIN_ID_TO_PIN (id ) ((id) % RZG2L_PINS_PER_PORT)
169173
170174#define RZG2L_TINT_MAX_INTERRUPT 32
171- #define RZG2L_TINT_IRQ_START_INDEX 9
172175#define RZG2L_PACK_HWIRQ (t , i ) (((t) << 16) | (i))
173176
174177/* Custom pinconf parameters */
@@ -247,6 +250,7 @@ enum rzg2l_iolh_index {
247250 * @iolh_groupb_ua: IOLH group B uA specific values
248251 * @iolh_groupc_ua: IOLH group C uA specific values
249252 * @iolh_groupb_oi: IOLH group B output impedance specific values
253+ * @tint_start_index: the start index for the TINT interrupts
250254 * @drive_strength_ua: drive strength in uA is supported (otherwise mA is supported)
251255 * @func_base: base number for port function (see register PFC)
252256 * @oen_max_pin: the maximum pin number supporting output enable
@@ -258,6 +262,7 @@ struct rzg2l_hwcfg {
258262 u16 iolh_groupb_ua [RZG2L_IOLH_IDX_MAX ];
259263 u16 iolh_groupc_ua [RZG2L_IOLH_IDX_MAX ];
260264 u16 iolh_groupb_oi [4 ];
265+ u16 tint_start_index ;
261266 bool drive_strength_ua ;
262267 u8 func_base ;
263268 u8 oen_max_pin ;
@@ -1337,6 +1342,27 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
13371342 break ;
13381343 }
13391344
1345+ case PIN_CONFIG_DRIVE_OPEN_DRAIN :
1346+ case PIN_CONFIG_DRIVE_PUSH_PULL :
1347+ if (!(cfg & PIN_CFG_NOD ))
1348+ return - EINVAL ;
1349+
1350+ arg = rzg2l_read_pin_config (pctrl , NOD (off ), bit , NOD_MASK );
1351+ if (!arg && param != PIN_CONFIG_DRIVE_PUSH_PULL )
1352+ return - EINVAL ;
1353+ if (arg && param != PIN_CONFIG_DRIVE_OPEN_DRAIN )
1354+ return - EINVAL ;
1355+ break ;
1356+
1357+ case PIN_CONFIG_INPUT_SCHMITT_ENABLE :
1358+ if (!(cfg & PIN_CFG_SMT ))
1359+ return - EINVAL ;
1360+
1361+ arg = rzg2l_read_pin_config (pctrl , SMT (off ), bit , SMT_MASK );
1362+ if (!arg )
1363+ return - EINVAL ;
1364+ break ;
1365+
13401366 case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE :
13411367 if (!(cfg & PIN_CFG_IOLH_RZV2H ))
13421368 return - EINVAL ;
@@ -1466,6 +1492,22 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
14661492 rzg2l_rmw_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK , index );
14671493 break ;
14681494
1495+ case PIN_CONFIG_DRIVE_OPEN_DRAIN :
1496+ case PIN_CONFIG_DRIVE_PUSH_PULL :
1497+ if (!(cfg & PIN_CFG_NOD ))
1498+ return - EINVAL ;
1499+
1500+ rzg2l_rmw_pin_config (pctrl , NOD (off ), bit , NOD_MASK ,
1501+ param == PIN_CONFIG_DRIVE_OPEN_DRAIN ? 1 : 0 );
1502+ break ;
1503+
1504+ case PIN_CONFIG_INPUT_SCHMITT_ENABLE :
1505+ if (!(cfg & PIN_CFG_SMT ))
1506+ return - EINVAL ;
1507+
1508+ rzg2l_rmw_pin_config (pctrl , SMT (off ), bit , SMT_MASK , arg );
1509+ break ;
1510+
14691511 case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE :
14701512 if (!(cfg & PIN_CFG_IOLH_RZV2H ))
14711513 return - EINVAL ;
@@ -2379,7 +2421,7 @@ static int rzg2l_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
23792421
23802422 rzg2l_gpio_irq_endisable (pctrl , child , true);
23812423 pctrl -> hwirq [irq ] = child ;
2382- irq += RZG2L_TINT_IRQ_START_INDEX ;
2424+ irq += pctrl -> data -> hwcfg -> tint_start_index ;
23832425
23842426 /* All these interrupts are level high in the CPU */
23852427 * parent_type = IRQ_TYPE_LEVEL_HIGH ;
@@ -2710,7 +2752,7 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
27102752
27112753 ret = pinctrl_enable (pctrl -> pctl );
27122754 if (ret )
2713- dev_err_probe (pctrl -> dev , ret , "pinctrl enable failed\n" );
2755+ return dev_err_probe (pctrl -> dev , ret , "pinctrl enable failed\n" );
27142756
27152757 ret = rzg2l_gpio_register (pctrl );
27162758 if (ret )
@@ -3034,6 +3076,7 @@ static const struct rzg2l_hwcfg rzg2l_hwcfg = {
30343076 [RZG2L_IOLH_IDX_3V3 ] = 2000 , 4000 , 8000 , 12000 ,
30353077 },
30363078 .iolh_groupb_oi = { 100 , 66 , 50 , 33 , },
3079+ .tint_start_index = 9 ,
30373080 .oen_max_pin = 0 ,
30383081};
30393082
@@ -3063,6 +3106,7 @@ static const struct rzg2l_hwcfg rzg3s_hwcfg = {
30633106 /* 3v3 power source */
30643107 [RZG2L_IOLH_IDX_3V3 ] = 4500 , 5200 , 5700 , 6050 ,
30653108 },
3109+ .tint_start_index = 9 ,
30663110 .drive_strength_ua = true,
30673111 .func_base = 1 ,
30683112 .oen_max_pin = 1 , /* Pin 1 of P0 and P7 is the maximum OEN pin. */
@@ -3073,6 +3117,7 @@ static const struct rzg2l_hwcfg rzv2h_hwcfg = {
30733117 .regs = {
30743118 .pwpr = 0x3c04 ,
30753119 },
3120+ .tint_start_index = 17 ,
30763121};
30773122
30783123static struct rzg2l_pinctrl_data r9a07g043_data = {
0 commit comments