Skip to content

Commit 2dcfd28

Browse files
committed
Merge remote-tracking branches 'spi/topic/sh-msiof', 'spi/topic/stm32', 'spi/topic/sunxi', 'spi/topic/tegra' and 'spi/topic/tools' into spi-next
6 parents 17c49e5 + 61a8dec + d5e9a4a + 36bc749 + e60dfe0 + e9d4650 commit 2dcfd28

File tree

10 files changed

+95
-18
lines changed

10 files changed

+95
-18
lines changed

Documentation/devicetree/bindings/spi/sh-msiof.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Required properties:
66
"renesas,msiof-r8a7792" (R-Car V2H)
77
"renesas,msiof-r8a7793" (R-Car M2-N)
88
"renesas,msiof-r8a7794" (R-Car E2)
9+
"renesas,msiof-r8a7795" (R-Car H3)
910
"renesas,msiof-r8a7796" (R-Car M3-W)
1011
"renesas,msiof-sh73a0" (SH-Mobile AG5)
1112
"renesas,sh-mobile-msiof" (generic SH-Mobile compatibile device)

drivers/spi/spi-sh-msiof.c

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct sh_msiof_chipdata {
3838
u16 tx_fifo_size;
3939
u16 rx_fifo_size;
4040
u16 master_flags;
41+
u16 min_div;
4142
};
4243

4344
struct sh_msiof_spi_priv {
@@ -49,6 +50,7 @@ struct sh_msiof_spi_priv {
4950
struct completion done;
5051
unsigned int tx_fifo_size;
5152
unsigned int rx_fifo_size;
53+
unsigned int min_div;
5254
void *tx_dma_page;
5355
void *rx_dma_page;
5456
dma_addr_t tx_dma_addr;
@@ -261,6 +263,8 @@ static void sh_msiof_spi_set_clk_regs(struct sh_msiof_spi_priv *p,
261263
if (!WARN_ON(!spi_hz || !parent_rate))
262264
div = DIV_ROUND_UP(parent_rate, spi_hz);
263265

266+
div = max_t(unsigned long, div, p->min_div);
267+
264268
for (k = 0; k < ARRAY_SIZE(sh_msiof_spi_div_table); k++) {
265269
brps = DIV_ROUND_UP(div, sh_msiof_spi_div_table[k].div);
266270
/* 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 = {
9981002
.tx_fifo_size = 64,
9991003
.rx_fifo_size = 64,
10001004
.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,
10011013
};
10021014

1003-
static const struct sh_msiof_chipdata r8a779x_data = {
1015+
static const struct sh_msiof_chipdata rcar_gen3_data = {
10041016
.tx_fifo_size = 64,
10051017
.rx_fifo_size = 64,
10061018
.master_flags = SPI_MASTER_MUST_TX,
1019+
.min_div = 2,
10071020
};
10081021

10091022
static const struct of_device_id sh_msiof_match[] = {
10101023
{ .compatible = "renesas,sh-mobile-msiof", .data = &sh_data },
1011-
{ .compatible = "renesas,msiof-r8a7790", .data = &r8a779x_data },
1012-
{ .compatible = "renesas,msiof-r8a7791", .data = &r8a779x_data },
1013-
{ .compatible = "renesas,msiof-r8a7792", .data = &r8a779x_data },
1014-
{ .compatible = "renesas,msiof-r8a7793", .data = &r8a779x_data },
1015-
{ .compatible = "renesas,msiof-r8a7794", .data = &r8a779x_data },
1016-
{ .compatible = "renesas,rcar-gen2-msiof", .data = &r8a779x_data },
1017-
{ .compatible = "renesas,msiof-r8a7796", .data = &r8a779x_data },
1018-
{ .compatible = "renesas,rcar-gen3-msiof", .data = &r8a779x_data },
1024+
{ .compatible = "renesas,msiof-r8a7790", .data = &rcar_gen2_data },
1025+
{ .compatible = "renesas,msiof-r8a7791", .data = &rcar_gen2_data },
1026+
{ .compatible = "renesas,msiof-r8a7792", .data = &rcar_gen2_data },
1027+
{ .compatible = "renesas,msiof-r8a7793", .data = &rcar_gen2_data },
1028+
{ .compatible = "renesas,msiof-r8a7794", .data = &rcar_gen2_data },
1029+
{ .compatible = "renesas,rcar-gen2-msiof", .data = &rcar_gen2_data },
1030+
{ .compatible = "renesas,msiof-r8a7796", .data = &rcar_gen3_data },
1031+
{ .compatible = "renesas,rcar-gen3-msiof", .data = &rcar_gen3_data },
10191032
{ .compatible = "renesas,sh-msiof", .data = &sh_data }, /* Deprecated */
10201033
{},
10211034
};
@@ -1230,6 +1243,7 @@ static int sh_msiof_spi_probe(struct platform_device *pdev)
12301243
platform_set_drvdata(pdev, p);
12311244
p->master = master;
12321245
p->info = info;
1246+
p->min_div = chipdata->min_div;
12331247

12341248
init_completion(&p->done);
12351249

drivers/spi/spi-stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1132,7 +1132,7 @@ static int stm32_spi_probe(struct platform_device *pdev)
11321132
goto err_master_put;
11331133
}
11341134

1135-
spi->rst = devm_reset_control_get(&pdev->dev, NULL);
1135+
spi->rst = devm_reset_control_get_exclusive(&pdev->dev, NULL);
11361136
if (!IS_ERR(spi->rst)) {
11371137
reset_control_assert(spi->rst);
11381138
udelay(2);

drivers/spi/spi-sun6i.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static int sun6i_spi_probe(struct platform_device *pdev)
502502

503503
init_completion(&sspi->done);
504504

505-
sspi->rstc = devm_reset_control_get(&pdev->dev, NULL);
505+
sspi->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);
506506
if (IS_ERR(sspi->rstc)) {
507507
dev_err(&pdev->dev, "Couldn't get reset controller\n");
508508
ret = PTR_ERR(sspi->rstc);

drivers/spi/spi-tegra114.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ static int tegra_spi_probe(struct platform_device *pdev)
10831083
goto exit_free_irq;
10841084
}
10851085

1086-
tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
1086+
tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi");
10871087
if (IS_ERR(tspi->rst)) {
10881088
dev_err(&pdev->dev, "can not get reset\n");
10891089
ret = PTR_ERR(tspi->rst);

drivers/spi/spi-tegra20-sflash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ static int tegra_sflash_probe(struct platform_device *pdev)
485485
goto exit_free_irq;
486486
}
487487

488-
tsd->rst = devm_reset_control_get(&pdev->dev, "spi");
488+
tsd->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi");
489489
if (IS_ERR(tsd->rst)) {
490490
dev_err(&pdev->dev, "can not get reset\n");
491491
ret = PTR_ERR(tsd->rst);

drivers/spi/spi-tegra20-slink.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static int tegra_slink_probe(struct platform_device *pdev)
10811081
goto exit_free_irq;
10821082
}
10831083

1084-
tspi->rst = devm_reset_control_get(&pdev->dev, "spi");
1084+
tspi->rst = devm_reset_control_get_exclusive(&pdev->dev, "spi");
10851085
if (IS_ERR(tspi->rst)) {
10861086
dev_err(&pdev->dev, "can not get reset\n");
10871087
ret = PTR_ERR(tspi->rst);

tools/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ kvm_stat: FORCE
9191
$(call descend,kvm/$@)
9292

9393
all: acpi cgroup cpupower gpio hv firewire lguest liblockdep \
94-
perf selftests turbostat usb \
94+
perf selftests spi turbostat usb \
9595
virtio vm net x86_energy_perf_policy \
9696
tmon freefall objtool kvm_stat
9797

@@ -101,7 +101,7 @@ acpi_install:
101101
cpupower_install:
102102
$(call descend,power/$(@:_install=),install)
103103

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:
105105
$(call descend,$(@:_install=),install)
106106

107107
liblockdep_install:

tools/spi/Build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
spidev_test-y += spidev_test.o
2+
spidev_fdx-y += spidev_fdx.o

tools/spi/Makefile

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
114
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
225

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 $@
452

553
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

0 commit comments

Comments
 (0)