diff options
| -rw-r--r-- | Documentation/devicetree/bindings/spi/sh-msiof.txt | 1 | ||||
| -rw-r--r-- | drivers/spi/spi-sh-msiof.c | 32 | ||||
| -rw-r--r-- | drivers/spi/spi-stm32.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-sun6i.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-tegra114.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-tegra20-sflash.c | 2 | ||||
| -rw-r--r-- | drivers/spi/spi-tegra20-slink.c | 2 | ||||
| -rw-r--r-- | tools/Makefile | 4 | ||||
| -rw-r--r-- | tools/spi/Build | 2 | ||||
| -rw-r--r-- | tools/spi/Makefile | 64 |
10 files changed, 95 insertions, 18 deletions
diff --git a/Documentation/devicetree/bindings/spi/sh-msiof.txt b/Documentation/devicetree/bindings/spi/sh-msiof.txt index 64ee489571c4..39e5ef7c5e71 100644 --- a/Documentation/devicetree/bindings/spi/sh-msiof.txt +++ b/Documentation/devicetree/bindings/spi/sh-msiof.txt | |||
| @@ -6,6 +6,7 @@ Required properties: | |||
| 6 | "renesas,msiof-r8a7792" (R-Car V2H) | 6 | "renesas,msiof-r8a7792" (R-Car V2H) |
| 7 | "renesas,msiof-r8a7793" (R-Car M2-N) | 7 | "renesas,msiof-r8a7793" (R-Car M2-N) |
| 8 | "renesas,msiof-r8a7794" (R-Car E2) | 8 | "renesas,msiof-r8a7794" (R-Car E2) |
| 9 | "renesas,msiof-r8a7795" (R-Car H3) | ||
| 9 | "renesas,msiof-r8a7796" (R-Car M3-W) | 10 | "renesas,msiof-r8a7796" (R-Car M3-W) |
| 10 | "renesas,msiof-sh73a0" (SH-Mobile AG5) | 11 | "renesas,msiof-sh73a0" (SH-Mobile AG5) |
| 11 | "renesas,sh-mobile-msiof" (generic SH-Mobile compatibile device) | 12 | "renesas,sh-mobile-msiof" (generic SH-Mobile compatibile device) |
diff --git a/drivers/spi/spi-sh-msiof.c b/drivers/spi/spi-sh-msiof.c index c304c7167866..0eb1e9583485 100644 --- a/drivers/spi/spi-sh-msiof.c +++ b/drivers/spi/spi-sh-msiof.c | |||
| @@ -38,6 +38,7 @@ struct sh_msiof_chipdata { | |||
| 38 | u16 tx_fifo_size; | 38 | u16 tx_fifo_size; |
| 39 | u16 rx_fifo_size; | 39 | u16 rx_fifo_size; |
| 40 | u16 master_flags; | 40 | u16 master_flags; |
| 41 | u16 min_div; | ||
| 41 | }; | 42 | }; |
| 42 | 43 | ||
| 43 | struct sh_msiof_spi_priv { | 44 | struct sh_msiof_spi_priv { |
| @@ -49,6 +50,7 @@ struct sh_msiof_spi_priv { | |||
| 49 | struct completion done; | 50 | struct completion done; |
| 50 | unsigned int tx_fifo_size; | 51 | unsigned int tx_fifo_size; |
| 51 | unsigned int rx_fifo_size; | 52 | unsigned int rx_fifo_size; |
| 53 | unsigned int min_div; | ||
| 52 | void *tx_dma_page; | 54 | void *tx_dma_page; |
| 53 | void *rx_dma_page; | 55 | void *rx_dma_page; |
| 54 | dma_addr_t tx_dma_addr; | 56 | dma_addr_t tx_dma_addr; |
| @@ -261,6 +263,8 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p, | |||
| 261 | if (!WARN_ON(!spi_hz || !parent_rate)) | 263 | if (!WARN_ON(!spi_hz || !parent_rate)) |
| 262 | div = DIV_ROUND_UP(parent_rate, spi_hz); | 264 | div = DIV_ROUND_UP(parent_rate, spi_hz); |
| 263 | 265 | ||
| 266 | div = max_t(unsigned long, div, p->min_div); | ||
| 267 | |||
| 264 | for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { | 268 | for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) { |
| 265 | brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); | 269 | brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div); |
| 266 | /* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */ | 270 | /* SCR_BRDV_DIV_1 is valid only if BRPS is x 1/1 or x 1/2 */ |
| @@ -998,24 +1002,33 @@ static const struct sh_msiof_chipdata sh_data = { | |||
| 998 | .tx_fifo_size = 64, | 1002 | .tx_fifo_size = 64, |
| 999 | .rx_fifo_size = 64, | 1003 | .rx_fifo_size = 64, |
| 1000 | .master_flags = 0, | 1004 | .master_flags = 0, |
| 1005 | .min_div = 1, | ||
| 1006 | }; | ||
| 1007 | |||
| 1008 | static const struct sh_msiof_chipdata rcar_gen2_data = { | ||
| 1009 | .tx_fifo_size = 64, | ||
| 1010 | .rx_fifo_size = 64, | ||
| 1011 | .master_flags = SPI_MASTER_MUST_TX, | ||
| 1012 | .min_div = 1, | ||
| 1001 | }; | 1013 | }; |
| 1002 | 1014 | ||
| 1003 | static const struct sh_msiof_chipdata r8a779x_data = { | 1015 | static const struct sh_msiof_chipdata rcar_gen3_data = { |
| 1004 | .tx_fifo_size = 64, | 1016 | .tx_fifo_size = 64, |
| 1005 | .rx_fifo_size = 64, | 1017 | .rx_fifo_size = 64, |
| 1006 | .master_flags = SPI_MASTER_MUST_TX, | 1018 | .master_flags = SPI_MASTER_MUST_TX, |
| 1019 | .min_div = 2, | ||
| 1007 | }; | 1020 | }; |
| 1008 | 1021 | ||
| 1009 | static const struct of_device_id sh_msiof_match[] = { | 1022 | static const struct of_device_id sh_msiof_match[] = { |
| 1010 | { .compatible = "renesas,sh-mobile-msiof", .data = &sh_data }, | 1023 | { .compatible = "renesas,sh-mobile-msiof", .data = &sh_data }, |
| 1011 | { .compatible = "renesas,msiof-r8a7790", .data = &r8a779x_data }, | 1024 | { .compatible = "renesas,msiof-r8a7790", .data = &rcar_gen2_data }, |
| 1012 | { .compatible = "renesas,msiof-r8a7791", .data = &r8a779x_data }, | 1025 | { .compatible = "renesas,msiof-r8a7791", .data = &rcar_gen2_data }, |
| 1013 | { .compatible = "renesas,msiof-r8a7792", .data = &r8a779x_data }, | 1026 | { .compatible = "renesas,msiof-r8a7792", .data = &rcar_gen2_data }, |
| 1014 | { .compatible = "renesas,msiof-r8a7793", .data = &r8a779x_data }, | 1027 | { .compatible = "renesas,msiof-r8a7793", .data = &rcar_gen2_data }, |
| 1015 | { .compatible = "renesas,msiof-r8a7794", .data = &r8a779x_data }, | 1028 | { .compatible = "renesas,msiof-r8a7794", .data = &rcar_gen2_data }, |
| 1016 | { .compatible = "renesas,rcar-gen2-msiof", .data = &r8a779x_data }, | 1029 | { .compatible = "renesas,rcar-gen2-msiof", .data = &rcar_gen2_data }, |
| 1017 | { .compatible = "renesas,msiof-r8a7796", .data = &r8a779x_data }, | 1030 | { .compatible = "renesas,msiof-r8a7796", .data = &rcar_gen3_data }, |
| 1018 | { .compatible = "renesas,rcar-gen3-msiof", .data = &r8a779x_data }, | 1031 | { .compatible = "renesas,rcar-gen3-msiof", .data = &rcar_gen3_data }, |
| 1019 | { .compatible = "renesas,sh-msiof", .data = &sh_data }, /* Deprecated */ | 1032 | { .compatible = "renesas,sh-msiof", .data = &sh_data }, /* Deprecated */ |
| 1020 | {}, | 1033 | {}, |
| 1021 | }; | 1034 | }; |
| @@ -1230,6 +1243,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev) | |||
| 1230 | platform_set_drvdata(pdev, p); | 1243 | platform_set_drvdata(pdev, p); |
| 1231 | p->master = master; | 1244 | p->master = master; |
| 1232 | p->info = info; | 1245 | p->info = info; |
| 1246 | p->min_div = chipdata->min_div; | ||
| 1233 | 1247 | ||
| 1234 | init_completion(&p->done); | 1248 | init_completion(&p->done); |
| 1235 | 1249 | ||
diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c index 75644bcd938b..680cdf549506 100644 --- a/drivers/spi/spi-stm32.c +++ b/drivers/spi/spi-stm32.c | |||
| @@ -1132,7 +1132,7 @@ static int stm32_spi_probe(struct platform_device *pdev) | |||
| 1132 | goto err_master_put; | 1132 | goto err_master_put; |
| 1133 | } | 1133 | } |
| 1134 | 1134 | ||
| 1135 | spi->rst = devm_reset_control_get(&pdev->dev, NULL); | 1135 | spi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL); |
| 1136 | if (!IS_ERR(spi->rst)) { | 1136 | if (!IS_ERR(spi->rst)) { |
| 1137 | reset_control_assert(spi->rst); | 1137 | reset_control_assert(spi->rst); |
| 1138 | udelay(2); | 1138 | udelay(2); |
diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c index 03a773a9531a..fb38234249a8 100644 --- a/drivers/spi/spi-sun6i.c +++ b/drivers/spi/spi-sun6i.c | |||
| @@ -502,7 +502,7 @@ static int sun6i_spi_probe(struct platform_device *pdev) | |||
| 502 | 502 | ||
| 503 | init_completion(&sspi->done); | 503 | init_completion(&sspi->done); |
| 504 | 504 | ||
| 505 | sspi->rstc = devm_reset_control_get(&pdev->dev, NULL); | 505 | sspi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL); |
| 506 | if (IS_ERR(sspi->rstc)) { | 506 | if (IS_ERR(sspi->rstc)) { |
| 507 | dev_err(&pdev->dev, "Couldn't get reset controller\n"); | 507 | dev_err(&pdev->dev, "Couldn't get reset controller\n"); |
| 508 | ret = PTR_ERR(sspi->rstc); | 508 | ret = PTR_ERR(sspi->rstc); |
diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 08012ae5aa66..44550182a4a3 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c | |||
| @@ -1083,7 +1083,7 @@ static int tegra_spi_probe(struct platform_device *pdev) | |||
| 1083 | goto exit_free_irq; | 1083 | goto exit_free_irq; |
| 1084 | } | 1084 | } |
| 1085 | 1085 | ||
| 1086 | tspi->rst = devm_reset_control_get(&pdev->dev, "spi"); | 1086 | tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
| 1087 | if (IS_ERR(tspi->rst)) { | 1087 | if (IS_ERR(tspi->rst)) { |
| 1088 | dev_err(&pdev->dev, "can not get reset\n"); | 1088 | dev_err(&pdev->dev, "can not get reset\n"); |
| 1089 | ret = PTR_ERR(tspi->rst); | 1089 | ret = PTR_ERR(tspi->rst); |
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c index 2c797ee2664d..22893a7e0aa0 100644 --- a/drivers/spi/spi-tegra20-sflash.c +++ b/drivers/spi/spi-tegra20-sflash.c | |||
| @@ -485,7 +485,7 @@ static int tegra_sflash_probe(struct platform_device *pdev) | |||
| 485 | goto exit_free_irq; | 485 | goto exit_free_irq; |
| 486 | } | 486 | } |
| 487 | 487 | ||
| 488 | tsd->rst = devm_reset_control_get(&pdev->dev, "spi"); | 488 | tsd->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
| 489 | if (IS_ERR(tsd->rst)) { | 489 | if (IS_ERR(tsd->rst)) { |
| 490 | dev_err(&pdev->dev, "can not get reset\n"); | 490 | dev_err(&pdev->dev, "can not get reset\n"); |
| 491 | ret = PTR_ERR(tsd->rst); | 491 | ret = PTR_ERR(tsd->rst); |
diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 0c06ce424210..3e12d5f87ee4 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c | |||
| @@ -1081,7 +1081,7 @@ static int tegra_slink_probe(struct platform_device *pdev) | |||
| 1081 | goto exit_free_irq; | 1081 | goto exit_free_irq; |
| 1082 | } | 1082 | } |
| 1083 | 1083 | ||
| 1084 | tspi->rst = devm_reset_control_get(&pdev->dev, "spi"); | 1084 | tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi"); |
| 1085 | if (IS_ERR(tspi->rst)) { | 1085 | if (IS_ERR(tspi->rst)) { |
| 1086 | dev_err(&pdev->dev, "can not get reset\n"); | 1086 | dev_err(&pdev->dev, "can not get reset\n"); |
| 1087 | ret = PTR_ERR(tspi->rst); | 1087 | ret = PTR_ERR(tspi->rst); |
diff --git a/tools/Makefile b/tools/Makefile index 221e1ce78b06..616e7722b327 100644 --- a/tools/Makefile +++ b/tools/Makefile | |||
| @@ -91,7 +91,7 @@ kvm_stat: FORCE | |||
| 91 | $(call descend,kvm/$@) | 91 | $(call descend,kvm/$@) |
| 92 | 92 | ||
| 93 | all: acpi cgroup cpupower gpio hv firewire lguest liblockdep \ | 93 | all: acpi cgroup cpupower gpio hv firewire lguest liblockdep \ |
| 94 | perf selftests turbostat usb \ | 94 | perf selftests spi turbostat usb \ |
| 95 | virtio vm net x86_energy_perf_policy \ | 95 | virtio vm net x86_energy_perf_policy \ |
| 96 | tmon freefall objtool kvm_stat | 96 | tmon freefall objtool kvm_stat |
| 97 | 97 | ||
| @@ -101,7 +101,7 @@ acpi_install: | |||
| 101 | cpupower_install: | 101 | cpupower_install: |
| 102 | $(call descend,power/$(@:_install=),install) | 102 | $(call descend,power/$(@:_install=),install) |
| 103 | 103 | ||
| 104 | cgroup_install firewire_install gpio_install hv_install lguest_install perf_install usb_install virtio_install vm_install net_install objtool_install: | 104 | cgroup_install firewire_install gpio_install hv_install lguest_install perf_install spi_install usb_install virtio_install vm_install net_install objtool_install: |
| 105 | $(call descend,$(@:_install=),install) | 105 | $(call descend,$(@:_install=),install) |
| 106 | 106 | ||
| 107 | liblockdep_install: | 107 | liblockdep_install: |
diff --git a/tools/spi/Build b/tools/spi/Build new file mode 100644 index 000000000000..8e8466033d99 --- /dev/null +++ b/tools/spi/Build | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | spidev_test-y += spidev_test.o | ||
| 2 | spidev_fdx-y += spidev_fdx.o | ||
diff --git a/tools/spi/Makefile b/tools/spi/Makefile index 3815b18ba070..90615e10c79a 100644 --- a/tools/spi/Makefile +++ b/tools/spi/Makefile | |||
| @@ -1,6 +1,66 @@ | |||
| 1 | include ../scripts/Makefile.include | ||
| 2 | |||
| 3 | bindir ?= /usr/bin | ||
| 4 | |||
| 5 | ifeq ($(srctree),) | ||
| 6 | srctree := $(patsubst %/,%,$(dir $(CURDIR))) | ||
| 7 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 8 | endif | ||
| 9 | |||
| 10 | # Do not use make's built-in rules | ||
| 11 | # (this improves performance and avoids hard-to-debug behaviour); | ||
| 12 | MAKEFLAGS += -r | ||
| 13 | |||
| 1 | CC = $(CROSS_COMPILE)gcc | 14 | CC = $(CROSS_COMPILE)gcc |
| 15 | LD = $(CROSS_COMPILE)ld | ||
| 16 | CFLAGS += -O2 -Wall -g -D_GNU_SOURCE -I$(OUTPUT)include | ||
| 17 | |||
| 18 | ALL_TARGETS := spidev_test spidev_fdx | ||
| 19 | ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) | ||
| 20 | |||
| 21 | all: $(ALL_PROGRAMS) | ||
| 22 | |||
| 23 | export srctree OUTPUT CC LD CFLAGS | ||
| 24 | include $(srctree)/tools/build/Makefile.include | ||
| 2 | 25 | ||
| 3 | all: spidev_test spidev_fdx | 26 | # |
| 27 | # We need the following to be outside of kernel tree | ||
| 28 | # | ||
| 29 | $(OUTPUT)include/linux/spi/spidev.h: ../../include/uapi/linux/spi/spidev.h | ||
| 30 | mkdir -p $(OUTPUT)include/linux/spi 2>&1 || true | ||
| 31 | ln -sf $(CURDIR)/../../include/uapi/linux/spi/spidev.h $@ | ||
| 32 | |||
| 33 | prepare: $(OUTPUT)include/linux/spi/spidev.h | ||
| 34 | |||
| 35 | # | ||
| 36 | # spidev_test | ||
| 37 | # | ||
| 38 | SPIDEV_TEST_IN := $(OUTPUT)spidev_test-in.o | ||
| 39 | $(SPIDEV_TEST_IN): prepare FORCE | ||
| 40 | $(Q)$(MAKE) $(build)=spidev_test | ||
| 41 | $(OUTPUT)spidev_test: $(SPIDEV_TEST_IN) | ||
| 42 | $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ | ||
| 43 | |||
| 44 | # | ||
| 45 | # spidev_fdx | ||
| 46 | # | ||
| 47 | SPIDEV_FDX_IN := $(OUTPUT)spidev_fdx-in.o | ||
| 48 | $(SPIDEV_FDX_IN): prepare FORCE | ||
| 49 | $(Q)$(MAKE) $(build)=spidev_fdx | ||
| 50 | $(OUTPUT)spidev_fdx: $(SPIDEV_FDX_IN) | ||
| 51 | $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $< -o $@ | ||
| 4 | 52 | ||
| 5 | clean: | 53 | clean: |
| 6 | $(RM) spidev_test spidev_fdx | 54 | rm -f $(ALL_PROGRAMS) |
| 55 | rm -f $(OUTPUT)include/linux/spi/spidev.h | ||
| 56 | find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.d' -delete | ||
| 57 | |||
| 58 | install: $(ALL_PROGRAMS) | ||
| 59 | install -d -m 755 $(DESTDIR)$(bindir); \ | ||
| 60 | for program in $(ALL_PROGRAMS); do \ | ||
| 61 | install $$program $(DESTDIR)$(bindir); \ | ||
| 62 | done | ||
| 63 | |||
| 64 | FORCE: | ||
| 65 | |||
| 66 | .PHONY: all install clean FORCE prepare | ||
