139
139
#define IEN (off ) (0x1800 + (off) * 8)
140
140
#define PUPD (off ) (0x1C00 + (off) * 8)
141
141
#define ISEL (off ) (0x2C00 + (off) * 8)
142
+ #define NOD (off ) (0x3000 + (off) * 8)
143
+ #define SMT (off ) (0x3400 + (off) * 8)
142
144
#define SD_CH (off , ch ) ((off) + (ch) * 4)
143
145
#define ETH_POC (off , ch ) ((off) + (ch) * 4)
144
146
#define QSPI (0x3008)
160
162
#define IOLH_MASK 0x03
161
163
#define SR_MASK 0x01
162
164
#define PUPD_MASK 0x03
165
+ #define NOD_MASK 0x01
166
+ #define SMT_MASK 0x01
163
167
164
168
#define PM_INPUT 0x1
165
169
#define PM_OUTPUT 0x2
168
172
#define RZG2L_PIN_ID_TO_PIN (id ) ((id) % RZG2L_PINS_PER_PORT)
169
173
170
174
#define RZG2L_TINT_MAX_INTERRUPT 32
171
- #define RZG2L_TINT_IRQ_START_INDEX 9
172
175
#define RZG2L_PACK_HWIRQ (t , i ) (((t) << 16) | (i))
173
176
174
177
/* Custom pinconf parameters */
@@ -247,6 +250,7 @@ enum rzg2l_iolh_index {
247
250
* @iolh_groupb_ua: IOLH group B uA specific values
248
251
* @iolh_groupc_ua: IOLH group C uA specific values
249
252
* @iolh_groupb_oi: IOLH group B output impedance specific values
253
+ * @tint_start_index: the start index for the TINT interrupts
250
254
* @drive_strength_ua: drive strength in uA is supported (otherwise mA is supported)
251
255
* @func_base: base number for port function (see register PFC)
252
256
* @oen_max_pin: the maximum pin number supporting output enable
@@ -258,6 +262,7 @@ struct rzg2l_hwcfg {
258
262
u16 iolh_groupb_ua [RZG2L_IOLH_IDX_MAX ];
259
263
u16 iolh_groupc_ua [RZG2L_IOLH_IDX_MAX ];
260
264
u16 iolh_groupb_oi [4 ];
265
+ u16 tint_start_index ;
261
266
bool drive_strength_ua ;
262
267
u8 func_base ;
263
268
u8 oen_max_pin ;
@@ -1337,6 +1342,27 @@ static int rzg2l_pinctrl_pinconf_get(struct pinctrl_dev *pctldev,
1337
1342
break ;
1338
1343
}
1339
1344
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
+
1340
1366
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE :
1341
1367
if (!(cfg & PIN_CFG_IOLH_RZV2H ))
1342
1368
return - EINVAL ;
@@ -1466,6 +1492,22 @@ static int rzg2l_pinctrl_pinconf_set(struct pinctrl_dev *pctldev,
1466
1492
rzg2l_rmw_pin_config (pctrl , IOLH (off ), bit , IOLH_MASK , index );
1467
1493
break ;
1468
1494
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
+
1469
1511
case RENESAS_RZV2H_PIN_CONFIG_OUTPUT_IMPEDANCE :
1470
1512
if (!(cfg & PIN_CFG_IOLH_RZV2H ))
1471
1513
return - EINVAL ;
@@ -2379,7 +2421,7 @@ static int rzg2l_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
2379
2421
2380
2422
rzg2l_gpio_irq_endisable (pctrl , child , true);
2381
2423
pctrl -> hwirq [irq ] = child ;
2382
- irq += RZG2L_TINT_IRQ_START_INDEX ;
2424
+ irq += pctrl -> data -> hwcfg -> tint_start_index ;
2383
2425
2384
2426
/* All these interrupts are level high in the CPU */
2385
2427
* parent_type = IRQ_TYPE_LEVEL_HIGH ;
@@ -2710,7 +2752,7 @@ static int rzg2l_pinctrl_register(struct rzg2l_pinctrl *pctrl)
2710
2752
2711
2753
ret = pinctrl_enable (pctrl -> pctl );
2712
2754
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" );
2714
2756
2715
2757
ret = rzg2l_gpio_register (pctrl );
2716
2758
if (ret )
@@ -3034,6 +3076,7 @@ static const struct rzg2l_hwcfg rzg2l_hwcfg = {
3034
3076
[RZG2L_IOLH_IDX_3V3 ] = 2000 , 4000 , 8000 , 12000 ,
3035
3077
},
3036
3078
.iolh_groupb_oi = { 100 , 66 , 50 , 33 , },
3079
+ .tint_start_index = 9 ,
3037
3080
.oen_max_pin = 0 ,
3038
3081
};
3039
3082
@@ -3063,6 +3106,7 @@ static const struct rzg2l_hwcfg rzg3s_hwcfg = {
3063
3106
/* 3v3 power source */
3064
3107
[RZG2L_IOLH_IDX_3V3 ] = 4500 , 5200 , 5700 , 6050 ,
3065
3108
},
3109
+ .tint_start_index = 9 ,
3066
3110
.drive_strength_ua = true,
3067
3111
.func_base = 1 ,
3068
3112
.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 = {
3073
3117
.regs = {
3074
3118
.pwpr = 0x3c04 ,
3075
3119
},
3120
+ .tint_start_index = 17 ,
3076
3121
};
3077
3122
3078
3123
static struct rzg2l_pinctrl_data r9a07g043_data = {
0 commit comments