@@ -119,6 +119,8 @@ struct ingenic_chip_info {
119
119
unsigned int num_functions ;
120
120
121
121
const u32 * pull_ups , * pull_downs ;
122
+
123
+ const struct regmap_access_table * access_table ;
122
124
};
123
125
124
126
struct ingenic_pinctrl {
@@ -2179,6 +2181,17 @@ static const struct function_desc x1000_functions[] = {
2179
2181
{ "mac" , x1000_mac_groups , ARRAY_SIZE (x1000_mac_groups ), },
2180
2182
};
2181
2183
2184
+ static const struct regmap_range x1000_access_ranges [] = {
2185
+ regmap_reg_range (0x000 , 0x400 - 4 ),
2186
+ regmap_reg_range (0x700 , 0x800 - 4 ),
2187
+ };
2188
+
2189
+ /* shared with X1500 */
2190
+ static const struct regmap_access_table x1000_access_table = {
2191
+ .yes_ranges = x1000_access_ranges ,
2192
+ .n_yes_ranges = ARRAY_SIZE (x1000_access_ranges ),
2193
+ };
2194
+
2182
2195
static const struct ingenic_chip_info x1000_chip_info = {
2183
2196
.num_chips = 4 ,
2184
2197
.reg_offset = 0x100 ,
@@ -2189,6 +2202,7 @@ static const struct ingenic_chip_info x1000_chip_info = {
2189
2202
.num_functions = ARRAY_SIZE (x1000_functions ),
2190
2203
.pull_ups = x1000_pull_ups ,
2191
2204
.pull_downs = x1000_pull_downs ,
2205
+ .access_table = & x1000_access_table ,
2192
2206
};
2193
2207
2194
2208
static int x1500_uart0_data_pins [] = { 0x4a , 0x4b , };
@@ -2300,6 +2314,7 @@ static const struct ingenic_chip_info x1500_chip_info = {
2300
2314
.num_functions = ARRAY_SIZE (x1500_functions ),
2301
2315
.pull_ups = x1000_pull_ups ,
2302
2316
.pull_downs = x1000_pull_downs ,
2317
+ .access_table = & x1000_access_table ,
2303
2318
};
2304
2319
2305
2320
static const u32 x1830_pull_ups [4 ] = {
@@ -2506,6 +2521,16 @@ static const struct function_desc x1830_functions[] = {
2506
2521
{ "mac" , x1830_mac_groups , ARRAY_SIZE (x1830_mac_groups ), },
2507
2522
};
2508
2523
2524
+ static const struct regmap_range x1830_access_ranges [] = {
2525
+ regmap_reg_range (0x0000 , 0x4000 - 4 ),
2526
+ regmap_reg_range (0x7000 , 0x8000 - 4 ),
2527
+ };
2528
+
2529
+ static const struct regmap_access_table x1830_access_table = {
2530
+ .yes_ranges = x1830_access_ranges ,
2531
+ .n_yes_ranges = ARRAY_SIZE (x1830_access_ranges ),
2532
+ };
2533
+
2509
2534
static const struct ingenic_chip_info x1830_chip_info = {
2510
2535
.num_chips = 4 ,
2511
2536
.reg_offset = 0x1000 ,
@@ -2516,6 +2541,7 @@ static const struct ingenic_chip_info x1830_chip_info = {
2516
2541
.num_functions = ARRAY_SIZE (x1830_functions ),
2517
2542
.pull_ups = x1830_pull_ups ,
2518
2543
.pull_downs = x1830_pull_downs ,
2544
+ .access_table = & x1830_access_table ,
2519
2545
};
2520
2546
2521
2547
static const u32 x2000_pull_ups [5 ] = {
@@ -2969,6 +2995,17 @@ static const struct function_desc x2000_functions[] = {
2969
2995
{ "otg" , x2000_otg_groups , ARRAY_SIZE (x2000_otg_groups ), },
2970
2996
};
2971
2997
2998
+ static const struct regmap_range x2000_access_ranges [] = {
2999
+ regmap_reg_range (0x000 , 0x500 - 4 ),
3000
+ regmap_reg_range (0x700 , 0x800 - 4 ),
3001
+ };
3002
+
3003
+ /* shared with X2100 */
3004
+ static const struct regmap_access_table x2000_access_table = {
3005
+ .yes_ranges = x2000_access_ranges ,
3006
+ .n_yes_ranges = ARRAY_SIZE (x2000_access_ranges ),
3007
+ };
3008
+
2972
3009
static const struct ingenic_chip_info x2000_chip_info = {
2973
3010
.num_chips = 5 ,
2974
3011
.reg_offset = 0x100 ,
@@ -2979,6 +3016,7 @@ static const struct ingenic_chip_info x2000_chip_info = {
2979
3016
.num_functions = ARRAY_SIZE (x2000_functions ),
2980
3017
.pull_ups = x2000_pull_ups ,
2981
3018
.pull_downs = x2000_pull_downs ,
3019
+ .access_table = & x2000_access_table ,
2982
3020
};
2983
3021
2984
3022
static const u32 x2100_pull_ups [5 ] = {
@@ -3189,6 +3227,7 @@ static const struct ingenic_chip_info x2100_chip_info = {
3189
3227
.num_functions = ARRAY_SIZE (x2100_functions ),
3190
3228
.pull_ups = x2100_pull_ups ,
3191
3229
.pull_downs = x2100_pull_downs ,
3230
+ .access_table = & x2000_access_table ,
3192
3231
};
3193
3232
3194
3233
static u32 ingenic_gpio_read_reg (struct ingenic_gpio_chip * jzgc , u8 reg )
@@ -4168,7 +4207,12 @@ static int __init ingenic_pinctrl_probe(struct platform_device *pdev)
4168
4207
return PTR_ERR (base );
4169
4208
4170
4209
regmap_config = ingenic_pinctrl_regmap_config ;
4171
- regmap_config .max_register = chip_info -> num_chips * chip_info -> reg_offset ;
4210
+ if (chip_info -> access_table ) {
4211
+ regmap_config .rd_table = chip_info -> access_table ;
4212
+ regmap_config .wr_table = chip_info -> access_table ;
4213
+ } else {
4214
+ regmap_config .max_register = chip_info -> num_chips * chip_info -> reg_offset - 4 ;
4215
+ }
4172
4216
4173
4217
jzpc -> map = devm_regmap_init_mmio (dev , base , & regmap_config );
4174
4218
if (IS_ERR (jzpc -> map )) {
0 commit comments