Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi/s3c64xx: let device core setup the default pin configuration

With device core now able to setup the default pin configuration,
the pin configuration code based on the deprecated Samsung specific
gpio bindings is removed.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Doug Anderson <dianders@chromium.org>
Tested-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Grant Likely <grant.likely@linaro.org>

authored by

Thomas Abraham and committed by
Grant Likely
00ab5392 19624236

+6 -68
+2 -6
Documentation/devicetree/bindings/spi/spi-samsung.txt
··· 31 31 32 32 - #address-cells: should be 1. 33 33 - #size-cells: should be 0. 34 - - gpios: The gpio specifier for clock, mosi and miso interface lines (in the 35 - order specified). The format of the gpio specifier depends on the gpio 36 - controller. 37 34 38 35 Optional Board Specific Properties: 39 36 ··· 83 86 spi_0: spi@12d20000 { 84 87 #address-cells = <1>; 85 88 #size-cells = <0>; 86 - gpios = <&gpa2 4 2 3 0>, 87 - <&gpa2 6 2 3 0>, 88 - <&gpa2 7 2 3 0>; 89 + pinctrl-names = "default"; 90 + pinctrl-0 = <&spi0_bus>; 89 91 90 92 w25q80bw@0 { 91 93 #address-cells = <1>;
+4 -62
drivers/spi/spi-s3c64xx.c
··· 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; ··· 1179 1214 static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev) 1180 1215 { 1181 1216 return dev->platform_data; 1182 - } 1183 - 1184 - static int s3c64xx_spi_parse_dt_gpio(struct s3c64xx_spi_driver_data *sdd) 1185 - { 1186 - return -EINVAL; 1187 - } 1188 - 1189 - static void s3c64xx_spi_dt_gpio_free(struct s3c64xx_spi_driver_data *sdd) 1190 - { 1191 1217 } 1192 1218 #endif 1193 1219 ··· 1300 1344 goto err0; 1301 1345 } 1302 1346 1303 - if (!sci->cfg_gpio && pdev->dev.of_node) { 1304 - if (s3c64xx_spi_parse_dt_gpio(sdd)) 1305 - return -EBUSY; 1306 - } else if (sci->cfg_gpio == NULL || sci->cfg_gpio()) { 1347 + if (sci->cfg_gpio && sci->cfg_gpio()) { 1307 1348 dev_err(&pdev->dev, "Unable to config gpio\n"); 1308 1349 ret = -EBUSY; 1309 1350 goto err0; ··· 1311 1358 if (IS_ERR(sdd->clk)) { 1312 1359 dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n"); 1313 1360 ret = PTR_ERR(sdd->clk); 1314 - goto err1; 1361 + goto err0; 1315 1362 } 1316 1363 1317 1364 if (clk_prepare_enable(sdd->clk)) { 1318 1365 dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n"); 1319 1366 ret = -EBUSY; 1320 - goto err1; 1367 + goto err0; 1321 1368 } 1322 1369 1323 1370 sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr); ··· 1374 1421 clk_disable_unprepare(sdd->src_clk); 1375 1422 err2: 1376 1423 clk_disable_unprepare(sdd->clk); 1377 - err1: 1378 - if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) 1379 - s3c64xx_spi_dt_gpio_free(sdd); 1380 1424 err0: 1381 1425 platform_set_drvdata(pdev, NULL); 1382 1426 spi_master_put(master); ··· 1396 1446 1397 1447 clk_disable_unprepare(sdd->clk); 1398 1448 1399 - if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node) 1400 - s3c64xx_spi_dt_gpio_free(sdd); 1401 - 1402 1449 platform_set_drvdata(pdev, NULL); 1403 1450 spi_master_put(master); 1404 1451 ··· 1414 1467 clk_disable_unprepare(sdd->src_clk); 1415 1468 clk_disable_unprepare(sdd->clk); 1416 1469 1417 - if (!sdd->cntrlr_info->cfg_gpio && dev->of_node) 1418 - s3c64xx_spi_dt_gpio_free(sdd); 1419 - 1420 1470 sdd->cur_speed = 0; /* Output Clock is stopped */ 1421 1471 1422 1472 return 0; ··· 1425 1481 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); 1426 1482 struct s3c64xx_spi_info *sci = sdd->cntrlr_info; 1427 1483 1428 - if (!sci->cfg_gpio && dev->of_node) 1429 - s3c64xx_spi_parse_dt_gpio(sdd); 1430 - else 1484 + if (sci->cfg_gpio) 1431 1485 sci->cfg_gpio(); 1432 1486 1433 1487 /* Enable the clock */