Skip to content

Commit e753c16

Browse files
committed
Merge tag 'spi-fix-v7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi fixes from Mark Brown: "A couple of changes here, one update to MAINTAINERS for the AMD controller and a chnage from Pei Xiao which in spite of the changelog is actually a fix - previously the zynq-qspi driver leaked a clock enable for every flash operation it did which isn't good, these extra enables were removed when doing the enable cleanup which are probably a good idea anyway" * tag 'spi-fix-v7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: MAINTAINERS: Update AMD SPI driver maintainers spi: zynq-qspi: Simplify clock handling with devm_clk_get_enabled()
2 parents e8ab311 + 705355a commit e753c16

2 files changed

Lines changed: 7 additions & 36 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,6 +1272,7 @@ F: drivers/hid/amd-sfh-hid/
12721272

12731273
AMD SPI DRIVER
12741274
M: Raju Rangoju <Raju.Rangoju@amd.com>
1275+
M: Krishnamoorthi M <krishnamoorthi.m@amd.com>
12751276
L: linux-spi@vger.kernel.org
12761277
S: Supported
12771278
F: drivers/spi/spi-amd-pci.c

drivers/spi/spi-zynq-qspi.c

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -381,21 +381,10 @@ static int zynq_qspi_setup_op(struct spi_device *spi)
381381
{
382382
struct spi_controller *ctlr = spi->controller;
383383
struct zynq_qspi *qspi = spi_controller_get_devdata(ctlr);
384-
int ret;
385384

386385
if (ctlr->busy)
387386
return -EBUSY;
388387

389-
ret = clk_enable(qspi->refclk);
390-
if (ret)
391-
return ret;
392-
393-
ret = clk_enable(qspi->pclk);
394-
if (ret) {
395-
clk_disable(qspi->refclk);
396-
return ret;
397-
}
398-
399388
zynq_qspi_write(qspi, ZYNQ_QSPI_ENABLE_OFFSET,
400389
ZYNQ_QSPI_ENABLE_ENABLE_MASK);
401390

@@ -661,7 +650,7 @@ static int zynq_qspi_probe(struct platform_device *pdev)
661650
goto remove_ctlr;
662651
}
663652

664-
xqspi->pclk = devm_clk_get(&pdev->dev, "pclk");
653+
xqspi->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
665654
if (IS_ERR(xqspi->pclk)) {
666655
dev_err(&pdev->dev, "pclk clock not found.\n");
667656
ret = PTR_ERR(xqspi->pclk);
@@ -670,36 +659,24 @@ static int zynq_qspi_probe(struct platform_device *pdev)
670659

671660
init_completion(&xqspi->data_completion);
672661

673-
xqspi->refclk = devm_clk_get(&pdev->dev, "ref_clk");
662+
xqspi->refclk = devm_clk_get_enabled(&pdev->dev, "ref_clk");
674663
if (IS_ERR(xqspi->refclk)) {
675664
dev_err(&pdev->dev, "ref_clk clock not found.\n");
676665
ret = PTR_ERR(xqspi->refclk);
677666
goto remove_ctlr;
678667
}
679668

680-
ret = clk_prepare_enable(xqspi->pclk);
681-
if (ret) {
682-
dev_err(&pdev->dev, "Unable to enable APB clock.\n");
683-
goto remove_ctlr;
684-
}
685-
686-
ret = clk_prepare_enable(xqspi->refclk);
687-
if (ret) {
688-
dev_err(&pdev->dev, "Unable to enable device clock.\n");
689-
goto clk_dis_pclk;
690-
}
691-
692669
xqspi->irq = platform_get_irq(pdev, 0);
693670
if (xqspi->irq < 0) {
694671
ret = xqspi->irq;
695-
goto clk_dis_all;
672+
goto remove_ctlr;
696673
}
697674
ret = devm_request_irq(&pdev->dev, xqspi->irq, zynq_qspi_irq,
698675
0, pdev->name, xqspi);
699676
if (ret != 0) {
700677
ret = -ENXIO;
701678
dev_err(&pdev->dev, "request_irq failed\n");
702-
goto clk_dis_all;
679+
goto remove_ctlr;
703680
}
704681

705682
ret = of_property_read_u32(np, "num-cs",
@@ -709,7 +686,7 @@ static int zynq_qspi_probe(struct platform_device *pdev)
709686
} else if (num_cs > ZYNQ_QSPI_MAX_NUM_CS) {
710687
ret = -EINVAL;
711688
dev_err(&pdev->dev, "only 2 chip selects are available\n");
712-
goto clk_dis_all;
689+
goto remove_ctlr;
713690
} else {
714691
ctlr->num_chipselect = num_cs;
715692
}
@@ -728,15 +705,11 @@ static int zynq_qspi_probe(struct platform_device *pdev)
728705
ret = devm_spi_register_controller(&pdev->dev, ctlr);
729706
if (ret) {
730707
dev_err(&pdev->dev, "devm_spi_register_controller failed\n");
731-
goto clk_dis_all;
708+
goto remove_ctlr;
732709
}
733710

734711
return ret;
735712

736-
clk_dis_all:
737-
clk_disable_unprepare(xqspi->refclk);
738-
clk_dis_pclk:
739-
clk_disable_unprepare(xqspi->pclk);
740713
remove_ctlr:
741714
spi_controller_put(ctlr);
742715

@@ -758,9 +731,6 @@ static void zynq_qspi_remove(struct platform_device *pdev)
758731
struct zynq_qspi *xqspi = platform_get_drvdata(pdev);
759732

760733
zynq_qspi_write(xqspi, ZYNQ_QSPI_ENABLE_OFFSET, 0);
761-
762-
clk_disable_unprepare(xqspi->refclk);
763-
clk_disable_unprepare(xqspi->pclk);
764734
}
765735

766736
static const struct of_device_id zynq_qspi_of_match[] = {

0 commit comments

Comments
 (0)