27
27
28
28
#define TEGRA186_GPIO_INT_ROUTE_MAPPING (p , x ) (0x14 + (p) * 0x20 + (x) * 4)
29
29
30
- #define TEGRA186_GPIO_VM 0x00
31
- #define TEGRA186_GPIO_VM_RW_MASK 0x03
32
- #define TEGRA186_GPIO_SCR 0x04
33
- #define TEGRA186_GPIO_SCR_PIN_SIZE 0x08
34
- #define TEGRA186_GPIO_SCR_PORT_SIZE 0x40
35
- #define TEGRA186_GPIO_SCR_SEC_WEN BIT(28)
36
- #define TEGRA186_GPIO_SCR_SEC_REN BIT(27)
37
- #define TEGRA186_GPIO_SCR_SEC_G1W BIT(9)
38
- #define TEGRA186_GPIO_SCR_SEC_G1R BIT(1)
39
- #define TEGRA186_GPIO_FULL_ACCESS (TEGRA186_GPIO_SCR_SEC_WEN | \
40
- TEGRA186_GPIO_SCR_SEC_REN | \
41
- TEGRA186_GPIO_SCR_SEC_G1R | \
42
- TEGRA186_GPIO_SCR_SEC_G1W)
43
- #define TEGRA186_GPIO_SCR_SEC_ENABLE (TEGRA186_GPIO_SCR_SEC_WEN | \
44
- TEGRA186_GPIO_SCR_SEC_REN)
45
-
46
30
/* control registers */
47
31
#define TEGRA186_GPIO_ENABLE_CONFIG 0x00
48
32
#define TEGRA186_GPIO_ENABLE_CONFIG_ENABLE BIT(0)
@@ -97,7 +81,6 @@ struct tegra_gpio_soc {
97
81
unsigned int num_pin_ranges ;
98
82
const char * pinmux ;
99
83
bool has_gte ;
100
- bool has_vm_support ;
101
84
};
102
85
103
86
struct tegra_gpio {
@@ -147,58 +130,6 @@ static void __iomem *tegra186_gpio_get_base(struct tegra_gpio *gpio,
147
130
return gpio -> base + offset + pin * 0x20 ;
148
131
}
149
132
150
- static void __iomem * tegra186_gpio_get_secure_base (struct tegra_gpio * gpio ,
151
- unsigned int pin )
152
- {
153
- const struct tegra_gpio_port * port ;
154
- unsigned int offset ;
155
-
156
- port = tegra186_gpio_get_port (gpio , & pin );
157
- if (!port )
158
- return NULL ;
159
-
160
- offset = port -> bank * 0x1000 + port -> port * TEGRA186_GPIO_SCR_PORT_SIZE ;
161
-
162
- return gpio -> secure + offset + pin * TEGRA186_GPIO_SCR_PIN_SIZE ;
163
- }
164
-
165
- static inline bool tegra186_gpio_is_accessible (struct tegra_gpio * gpio , unsigned int pin )
166
- {
167
- void __iomem * secure ;
168
- u32 value ;
169
-
170
- secure = tegra186_gpio_get_secure_base (gpio , pin );
171
-
172
- if (gpio -> soc -> has_vm_support ) {
173
- value = readl (secure + TEGRA186_GPIO_VM );
174
- if ((value & TEGRA186_GPIO_VM_RW_MASK ) != TEGRA186_GPIO_VM_RW_MASK )
175
- return false;
176
- }
177
-
178
- value = __raw_readl (secure + TEGRA186_GPIO_SCR );
179
-
180
- if ((value & TEGRA186_GPIO_SCR_SEC_ENABLE ) == 0 )
181
- return true;
182
-
183
- if ((value & TEGRA186_GPIO_FULL_ACCESS ) == TEGRA186_GPIO_FULL_ACCESS )
184
- return true;
185
-
186
- return false;
187
- }
188
-
189
- static int tegra186_init_valid_mask (struct gpio_chip * chip ,
190
- unsigned long * valid_mask , unsigned int ngpios )
191
- {
192
- struct tegra_gpio * gpio = gpiochip_get_data (chip );
193
- unsigned int j ;
194
-
195
- for (j = 0 ; j < ngpios ; j ++ ) {
196
- if (!tegra186_gpio_is_accessible (gpio , j ))
197
- clear_bit (j , valid_mask );
198
- }
199
- return 0 ;
200
- }
201
-
202
133
static int tegra186_gpio_get_direction (struct gpio_chip * chip ,
203
134
unsigned int offset )
204
135
{
@@ -885,7 +816,6 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
885
816
gpio -> gpio .set = tegra186_gpio_set ;
886
817
gpio -> gpio .set_config = tegra186_gpio_set_config ;
887
818
gpio -> gpio .add_pin_ranges = tegra186_gpio_add_pin_ranges ;
888
- gpio -> gpio .init_valid_mask = tegra186_init_valid_mask ;
889
819
if (gpio -> soc -> has_gte ) {
890
820
gpio -> gpio .en_hw_timestamp = tegra186_gpio_en_hw_ts ;
891
821
gpio -> gpio .dis_hw_timestamp = tegra186_gpio_dis_hw_ts ;
@@ -1032,7 +962,6 @@ static const struct tegra_gpio_soc tegra186_main_soc = {
1032
962
.name = "tegra186-gpio" ,
1033
963
.instance = 0 ,
1034
964
.num_irqs_per_bank = 1 ,
1035
- .has_vm_support = false,
1036
965
};
1037
966
1038
967
#define TEGRA186_AON_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1060,7 +989,6 @@ static const struct tegra_gpio_soc tegra186_aon_soc = {
1060
989
.name = "tegra186-gpio-aon" ,
1061
990
.instance = 1 ,
1062
991
.num_irqs_per_bank = 1 ,
1063
- .has_vm_support = false,
1064
992
};
1065
993
1066
994
#define TEGRA194_MAIN_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1116,7 +1044,6 @@ static const struct tegra_gpio_soc tegra194_main_soc = {
1116
1044
.num_pin_ranges = ARRAY_SIZE (tegra194_main_pin_ranges ),
1117
1045
.pin_ranges = tegra194_main_pin_ranges ,
1118
1046
.pinmux = "nvidia,tegra194-pinmux" ,
1119
- .has_vm_support = true,
1120
1047
};
1121
1048
1122
1049
#define TEGRA194_AON_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1142,7 +1069,6 @@ static const struct tegra_gpio_soc tegra194_aon_soc = {
1142
1069
.instance = 1 ,
1143
1070
.num_irqs_per_bank = 8 ,
1144
1071
.has_gte = true,
1145
- .has_vm_support = false,
1146
1072
};
1147
1073
1148
1074
#define TEGRA234_MAIN_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1187,7 +1113,6 @@ static const struct tegra_gpio_soc tegra234_main_soc = {
1187
1113
.name = "tegra234-gpio" ,
1188
1114
.instance = 0 ,
1189
1115
.num_irqs_per_bank = 8 ,
1190
- .has_vm_support = true,
1191
1116
};
1192
1117
1193
1118
#define TEGRA234_AON_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1214,7 +1139,6 @@ static const struct tegra_gpio_soc tegra234_aon_soc = {
1214
1139
.instance = 1 ,
1215
1140
.num_irqs_per_bank = 8 ,
1216
1141
.has_gte = true,
1217
- .has_vm_support = false,
1218
1142
};
1219
1143
1220
1144
#define TEGRA241_MAIN_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1245,7 +1169,6 @@ static const struct tegra_gpio_soc tegra241_main_soc = {
1245
1169
.name = "tegra241-gpio" ,
1246
1170
.instance = 0 ,
1247
1171
.num_irqs_per_bank = 8 ,
1248
- .has_vm_support = false,
1249
1172
};
1250
1173
1251
1174
#define TEGRA241_AON_GPIO_PORT (_name , _bank , _port , _pins ) \
@@ -1267,7 +1190,6 @@ static const struct tegra_gpio_soc tegra241_aon_soc = {
1267
1190
.name = "tegra241-gpio-aon" ,
1268
1191
.instance = 1 ,
1269
1192
.num_irqs_per_bank = 8 ,
1270
- .has_vm_support = false,
1271
1193
};
1272
1194
1273
1195
static const struct of_device_id tegra186_gpio_of_match [] = {
0 commit comments