Skip to content

Commit 00ab539

Browse files
Thomas Abrahamglikely
authored andcommitted
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 <[email protected]> Signed-off-by: Doug Anderson <[email protected]> Acked-by: Linus Walleij <[email protected]> Reviewed-by: Doug Anderson <[email protected]> Tested-by: Doug Anderson <[email protected]> Signed-off-by: Grant Likely <[email protected]>
1 parent 1962423 commit 00ab539

File tree

2 files changed

+6
-68
lines changed

2 files changed

+6
-68
lines changed

Documentation/devicetree/bindings/spi/spi-samsung.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ Required Board Specific Properties:
3131

3232
- #address-cells: should be 1.
3333
- #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.
3734

3835
Optional Board Specific Properties:
3936

@@ -86,9 +83,8 @@ Example:
8683
spi_0: spi@12d20000 {
8784
#address-cells = <1>;
8885
#size-cells = <0>;
89-
gpios = <&gpa2 4 2 3 0>,
90-
<&gpa2 6 2 3 0>,
91-
<&gpa2 7 2 3 0>;
86+
pinctrl-names = "default";
87+
pinctrl-0 = <&spi0_bus>;
9288

9389
w25q80bw@0 {
9490
#address-cells = <1>;

drivers/spi/spi-s3c64xx.c

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,41 +1148,6 @@ static void s3c64xx_spi_hwinit(struct s3c64xx_spi_driver_data *sdd, int channel)
11481148
}
11491149

11501150
#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-
11861151
static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
11871152
{
11881153
struct s3c64xx_spi_info *sci;
@@ -1215,15 +1180,6 @@ static struct s3c64xx_spi_info *s3c64xx_spi_parse_dt(struct device *dev)
12151180
{
12161181
return dev->platform_data;
12171182
}
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-
}
12271183
#endif
12281184

12291185
static const struct of_device_id s3c64xx_spi_dt_match[];
@@ -1344,10 +1300,7 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
13441300
goto err0;
13451301
}
13461302

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()) {
13511304
dev_err(&pdev->dev, "Unable to config gpio\n");
13521305
ret = -EBUSY;
13531306
goto err0;
@@ -1358,13 +1311,13 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
13581311
if (IS_ERR(sdd->clk)) {
13591312
dev_err(&pdev->dev, "Unable to acquire clock 'spi'\n");
13601313
ret = PTR_ERR(sdd->clk);
1361-
goto err1;
1314+
goto err0;
13621315
}
13631316

13641317
if (clk_prepare_enable(sdd->clk)) {
13651318
dev_err(&pdev->dev, "Couldn't enable clock 'spi'\n");
13661319
ret = -EBUSY;
1367-
goto err1;
1320+
goto err0;
13681321
}
13691322

13701323
sprintf(clk_name, "spi_busclk%d", sci->src_clk_nr);
@@ -1421,9 +1374,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
14211374
clk_disable_unprepare(sdd->src_clk);
14221375
err2:
14231376
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);
14271377
err0:
14281378
platform_set_drvdata(pdev, NULL);
14291379
spi_master_put(master);
@@ -1446,9 +1396,6 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
14461396

14471397
clk_disable_unprepare(sdd->clk);
14481398

1449-
if (!sdd->cntrlr_info->cfg_gpio && pdev->dev.of_node)
1450-
s3c64xx_spi_dt_gpio_free(sdd);
1451-
14521399
platform_set_drvdata(pdev, NULL);
14531400
spi_master_put(master);
14541401

@@ -1467,9 +1414,6 @@ static int s3c64xx_spi_suspend(struct device *dev)
14671414
clk_disable_unprepare(sdd->src_clk);
14681415
clk_disable_unprepare(sdd->clk);
14691416

1470-
if (!sdd->cntrlr_info->cfg_gpio && dev->of_node)
1471-
s3c64xx_spi_dt_gpio_free(sdd);
1472-
14731417
sdd->cur_speed = 0; /* Output Clock is stopped */
14741418

14751419
return 0;
@@ -1481,9 +1425,7 @@ static int s3c64xx_spi_resume(struct device *dev)
14811425
struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
14821426
struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
14831427

1484-
if (!sci->cfg_gpio && dev->of_node)
1485-
s3c64xx_spi_parse_dt_gpio(sdd);
1486-
else
1428+
if (sci->cfg_gpio)
14871429
sci->cfg_gpio();
14881430

14891431
/* Enable the clock */

0 commit comments

Comments
 (0)