diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2017-02-07 12:31:02 +0100 |
---|---|---|
committer | Jonas Gorski <jonas.gorski@gmail.com> | 2017-06-04 11:33:43 +0200 |
commit | b50fd8c2b3abdd557bd7d2bb5628f03b20801350 (patch) | |
tree | a4f71f0f10c0c3b2c2f0a5000f695bfd699ca5d8 /target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch | |
parent | 2a2b16210bbc8c5881286d2ff742f3bdf1a7fd9c (diff) | |
download | mtk-20170518-b50fd8c2b3abdd557bd7d2bb5628f03b20801350.zip mtk-20170518-b50fd8c2b3abdd557bd7d2bb5628f03b20801350.tar.gz mtk-20170518-b50fd8c2b3abdd557bd7d2bb5628f03b20801350.tar.bz2 |
brcm63xx: register SPI controllers through DT
Register SPI controllers through device tree. We will wire up the clocks
at a later stage.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch')
-rw-r--r-- | target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch b/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch new file mode 100644 index 0000000..aaf4a59 --- /dev/null +++ b/target/linux/brcm63xx/patches-4.4/001-4.12-06-spi-bcm63xx-hsspi-add-support-for-probing-through-de.patch @@ -0,0 +1,76 @@ +From 776041498c2b285a7f745c924e10fc11ef720eae Mon Sep 17 00:00:00 2001 +From: Jonas Gorski <jonas.gorski@gmail.com> +Date: Thu, 10 Sep 2015 14:53:53 +0200 +Subject: [PATCH 3/3] spi/bcm63xx-hsspi: allow for probing through devicetree + +Add required binding support to probe through device tree. + +Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> +--- + drivers/spi/spi-bcm63xx-hsspi.c | 23 ++++++++++++++++++++--- + 1 file changed, 20 insertions(+), 3 deletions(-) + +--- a/drivers/spi/spi-bcm63xx-hsspi.c ++++ b/drivers/spi/spi-bcm63xx-hsspi.c +@@ -19,6 +19,7 @@ + #include <linux/interrupt.h> + #include <linux/spi/spi.h> + #include <linux/mutex.h> ++#include <linux/of.h> + + #define HSSPI_GLOBAL_CTRL_REG 0x0 + #define GLOBAL_CTRL_CS_POLARITY_SHIFT 0 +@@ -91,6 +92,7 @@ + + #define HSSPI_MAX_SYNC_CLOCK 30000000 + ++#define HSSPI_SPI_MAX_CS 8 + #define HSSPI_BUS_NUM 1 /* 0 is legacy SPI */ + + struct bcm63xx_hsspi { +@@ -332,7 +334,7 @@ static int bcm63xx_hsspi_probe(struct pl + struct device *dev = &pdev->dev; + struct clk *clk; + int irq, ret; +- u32 reg, rate; ++ u32 reg, rate, num_cs = HSSPI_SPI_MAX_CS; + + irq = platform_get_irq(pdev, 0); + if (irq < 0) { +@@ -382,8 +384,17 @@ static int bcm63xx_hsspi_probe(struct pl + mutex_init(&bs->bus_mutex); + init_completion(&bs->done); + +- master->bus_num = HSSPI_BUS_NUM; +- master->num_chipselect = 8; ++ master->dev.of_node = dev->of_node; ++ if (!dev->of_node) ++ master->bus_num = HSSPI_BUS_NUM; ++ ++ of_property_read_u32(dev->of_node, "num-cs", &num_cs); ++ if (num_cs > 8) { ++ dev_warn(dev, "unsupported number of cs (%i), reducing to 8\n", ++ num_cs); ++ num_cs = HSSPI_SPI_MAX_CS; ++ } ++ master->num_chipselect = num_cs; + master->setup = bcm63xx_hsspi_setup; + master->transfer_one_message = bcm63xx_hsspi_transfer_one; + master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | +@@ -469,10 +480,16 @@ static int bcm63xx_hsspi_resume(struct d + static SIMPLE_DEV_PM_OPS(bcm63xx_hsspi_pm_ops, bcm63xx_hsspi_suspend, + bcm63xx_hsspi_resume); + ++static const struct of_device_id bcm63xx_hsspi_of_match[] = { ++ { .compatible = "brcm,bcm6328-hsspi", }, ++ { }, ++}; ++ + static struct platform_driver bcm63xx_hsspi_driver = { + .driver = { + .name = "bcm63xx-hsspi", + .pm = &bcm63xx_hsspi_pm_ops, ++ .of_match_table = bcm63xx_hsspi_of_match, + }, + .probe = bcm63xx_hsspi_probe, + .remove = bcm63xx_hsspi_remove, |