@@ -1148,41 +1148,6 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
1148
1148
}
1149
1149
1150
1150
#ifdef CONFIG_OF
1151
- static int s3c64xx_spi_parse_dt_gpio (struct s3c64xx_spi_driver_data * sdd )
1152
- {
1153
- struct device * dev = & sdd -> pdev -> dev ;
1154
- int idx , gpio , ret ;
1155
-
1156
- /* find gpios for mosi, miso and clock lines */
1157
- for (idx = 0 ; idx < 3 ; idx ++ ) {
1158
- gpio = of_get_gpio (dev -> of_node , idx );
1159
- if (!gpio_is_valid (gpio )) {
1160
- dev_err (dev , "invalid gpio[%d]: %d\n" , idx , gpio );
1161
- goto free_gpio ;
1162
- }
1163
- sdd -> gpios [idx ] = gpio ;
1164
- ret = gpio_request (gpio , "spi-bus" );
1165
- if (ret ) {
1166
- dev_err (dev , "gpio [%d] request failed: %d\n" ,
1167
- gpio , ret );
1168
- goto free_gpio ;
1169
- }
1170
- }
1171
- return 0 ;
1172
-
1173
- free_gpio :
1174
- while (-- idx >= 0 )
1175
- gpio_free (sdd -> gpios [idx ]);
1176
- return - EINVAL ;
1177
- }
1178
-
1179
- static void s3c64xx_spi_dt_gpio_free (struct s3c64xx_spi_driver_data * sdd )
1180
- {
1181
- unsigned int idx ;
1182
- for (idx = 0 ; idx < 3 ; idx ++ )
1183
- gpio_free (sdd -> gpios [idx ]);
1184
- }
1185
-
1186
1151
static struct s3c64xx_spi_info * s3c64xx_spi_parse_dt (struct device * dev )
1187
1152
{
1188
1153
struct s3c64xx_spi_info * sci ;
@@ -1215,15 +1180,6 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
1215
1180
{
1216
1181
return dev -> platform_data ;
1217
1182
}
1218
-
1219
- static int s3c64xx_spi_parse_dt_gpio (struct s3c64xx_spi_driver_data * sdd )
1220
- {
1221
- return - EINVAL ;
1222
- }
1223
-
1224
- static void s3c64xx_spi_dt_gpio_free (struct s3c64xx_spi_driver_data * sdd )
1225
- {
1226
- }
1227
1183
#endif
1228
1184
1229
1185
static const struct of_device_id s3c64xx_spi_dt_match [];
@@ -1344,10 +1300,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1344
1300
goto err0 ;
1345
1301
}
1346
1302
1347
- if (!sci -> cfg_gpio && pdev -> dev .of_node ) {
1348
- if (s3c64xx_spi_parse_dt_gpio (sdd ))
1349
- return - EBUSY ;
1350
- } else if (sci -> cfg_gpio == NULL || sci -> cfg_gpio ()) {
1303
+ if (sci -> cfg_gpio && sci -> cfg_gpio ()) {
1351
1304
dev_err (& pdev -> dev , "Unable to config gpio\n" );
1352
1305
ret = - EBUSY ;
1353
1306
goto err0 ;
@@ -1358,13 +1311,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1358
1311
if (IS_ERR (sdd -> clk )) {
1359
1312
dev_err (& pdev -> dev , "Unable to acquire clock 'spi'\n" );
1360
1313
ret = PTR_ERR (sdd -> clk );
1361
- goto err1 ;
1314
+ goto err0 ;
1362
1315
}
1363
1316
1364
1317
if (clk_prepare_enable (sdd -> clk )) {
1365
1318
dev_err (& pdev -> dev , "Couldn't enable clock 'spi'\n" );
1366
1319
ret = - EBUSY ;
1367
- goto err1 ;
1320
+ goto err0 ;
1368
1321
}
1369
1322
1370
1323
sprintf (clk_name , "spi_busclk%d" , sci -> src_clk_nr );
@@ -1421,9 +1374,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1421
1374
clk_disable_unprepare (sdd -> src_clk );
1422
1375
err2 :
1423
1376
clk_disable_unprepare (sdd -> clk );
1424
- err1 :
1425
- if (!sdd -> cntrlr_info -> cfg_gpio && pdev -> dev .of_node )
1426
- s3c64xx_spi_dt_gpio_free (sdd );
1427
1377
err0 :
1428
1378
platform_set_drvdata (pdev , NULL );
1429
1379
spi_master_put (master );
@@ -1446,9 +1396,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
1446
1396
1447
1397
clk_disable_unprepare (sdd -> clk );
1448
1398
1449
- if (!sdd -> cntrlr_info -> cfg_gpio && pdev -> dev .of_node )
1450
- s3c64xx_spi_dt_gpio_free (sdd );
1451
-
1452
1399
platform_set_drvdata (pdev , NULL );
1453
1400
spi_master_put (master );
1454
1401
@@ -1467,9 +1414,6 @@ static int s3c64xx_spi_suspend(struct device *dev)
1467
1414
clk_disable_unprepare (sdd -> src_clk );
1468
1415
clk_disable_unprepare (sdd -> clk );
1469
1416
1470
- if (!sdd -> cntrlr_info -> cfg_gpio && dev -> of_node )
1471
- s3c64xx_spi_dt_gpio_free (sdd );
1472
-
1473
1417
sdd -> cur_speed = 0 ; /* Output Clock is stopped */
1474
1418
1475
1419
return 0 ;
@@ -1481,9 +1425,7 @@ static int s3c64xx_spi_resume(struct device *dev)
1481
1425
struct s3c64xx_spi_driver_data * sdd = spi_master_get_devdata (master );
1482
1426
struct s3c64xx_spi_info * sci = sdd -> cntrlr_info ;
1483
1427
1484
- if (!sci -> cfg_gpio && dev -> of_node )
1485
- s3c64xx_spi_parse_dt_gpio (sdd );
1486
- else
1428
+ if (sci -> cfg_gpio )
1487
1429
sci -> cfg_gpio ();
1488
1430
1489
1431
/* Enable the clock */
0 commit comments