aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 16:15:12 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-05 16:15:12 -0500
commit75f5db39ff14ed95056f2cca3ad98c3cae97170c (patch)
treef265bdbda7dc9fab1bc07bca2449f9fc79c99f25
parent52787e91bf5375e68e90f381bd157bd92e1f4a77 (diff)
parentc70efb85153162295dc80099e95dab93d486a3ed (diff)
Merge tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown: "Quite a lot of activity in SPI this cycle, almost all of it in drivers with a few minor improvements and tweaks in the core. - Updates to pxa2xx to support Intel Broxton and multiple chip selects. - Support for big endian in the bcm63xx driver. - Multiple slave support for the mt8173 - New driver for the auxiliary SPI controller in bcm2835 SoCs. - Support for Layerscale SoCs in the Freescale DSPI driver" * tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits) spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI spi: pxa2xx: Add support for Intel Broxton spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals spi: pxa2xx: Add output control for multiple Intel LPSS chip selects spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific spi: Add DSPI support for layerscape family spi: ti-qspi: improve ->remove() callback spi/spi-xilinx: Fix race condition on last word read spi: Drop owner assignment from spi_drivers spi: Add THIS_MODULE to spi_driver in SPI core spi: Setup the master controller driver before setting the chipselect spi: dw: replace magic constant by DW_SPI_DR spi: mediatek: mt8173 spi multiple devices support spi: mediatek: handle controller_data in mtk_spi_setup spi: mediatek: remove mtk_spi_config spi: mediatek: Update document devicetree bindings to support multiple devices spi: fix kernel-doc warnings about missing return desc in spi.c spi: fix kernel-doc warnings about missing return desc in spi.h spi: pxa2xx: Align a few defines spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select ...
-rw-r--r--Documentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt38
-rw-r--r--Documentation/devicetree/bindings/spi/spi-mt65xx.txt9
-rw-r--r--arch/arm/mach-u300/dummyspichip.c1
-rw-r--r--arch/mips/bcm63xx/dev-spi.c42
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h44
-rw-r--r--arch/mips/txx9/generic/spi_eeprom.c1
-rw-r--r--drivers/char/tpm/st33zp24/spi.c1
-rw-r--r--drivers/gpio/gpio-74x164.c1
-rw-r--r--drivers/gpio/gpio-max7301.c1
-rw-r--r--drivers/gpio/gpio-mc33880.c1
-rw-r--r--drivers/gpio/gpio-mcp23s08.c2
-rw-r--r--drivers/gpu/drm/panel/panel-lg-lg4573.c1
-rw-r--r--drivers/gpu/drm/panel/panel-samsung-ld9040.c1
-rw-r--r--drivers/hwmon/ad7314.c1
-rw-r--r--drivers/hwmon/adcxx.c1
-rw-r--r--drivers/hwmon/ads7871.c1
-rw-r--r--drivers/hwmon/adt7310.c1
-rw-r--r--drivers/hwmon/lm70.c1
-rw-r--r--drivers/hwmon/max1111.c1
-rw-r--r--drivers/iio/accel/kxsd9.c1
-rw-r--r--drivers/iio/accel/st_accel_spi.c1
-rw-r--r--drivers/iio/adc/ad7266.c1
-rw-r--r--drivers/iio/adc/ad7298.c1
-rw-r--r--drivers/iio/adc/ad7476.c1
-rw-r--r--drivers/iio/adc/ad7791.c1
-rw-r--r--drivers/iio/adc/ad7793.c1
-rw-r--r--drivers/iio/adc/ad7887.c1
-rw-r--r--drivers/iio/adc/ad7923.c1
-rw-r--r--drivers/iio/adc/max1027.c1
-rw-r--r--drivers/iio/adc/mcp320x.c1
-rw-r--r--drivers/iio/adc/ti-adc128s052.c1
-rw-r--r--drivers/iio/amplifiers/ad8366.c1
-rw-r--r--drivers/iio/common/ssp_sensors/ssp_dev.c1
-rw-r--r--drivers/iio/dac/ad5064.c1
-rw-r--r--drivers/iio/dac/ad5360.c1
-rw-r--r--drivers/iio/dac/ad5380.c1
-rw-r--r--drivers/iio/dac/ad5421.c1
-rw-r--r--drivers/iio/dac/ad5446.c1
-rw-r--r--drivers/iio/dac/ad5449.c1
-rw-r--r--drivers/iio/dac/ad5504.c1
-rw-r--r--drivers/iio/dac/ad5624r_spi.c1
-rw-r--r--drivers/iio/dac/ad5686.c1
-rw-r--r--drivers/iio/dac/ad5755.c1
-rw-r--r--drivers/iio/dac/ad5764.c1
-rw-r--r--drivers/iio/dac/ad5791.c1
-rw-r--r--drivers/iio/dac/ad7303.c1
-rw-r--r--drivers/iio/dac/mcp4922.c1
-rw-r--r--drivers/iio/frequency/ad9523.c1
-rw-r--r--drivers/iio/frequency/adf4350.c1
-rw-r--r--drivers/iio/gyro/adis16080.c1
-rw-r--r--drivers/iio/gyro/adis16130.c1
-rw-r--r--drivers/iio/gyro/adis16136.c1
-rw-r--r--drivers/iio/gyro/adis16260.c1
-rw-r--r--drivers/iio/gyro/adxrs450.c1
-rw-r--r--drivers/iio/gyro/st_gyro_spi.c1
-rw-r--r--drivers/iio/imu/adis16400_core.c1
-rw-r--r--drivers/iio/imu/adis16480.c1
-rw-r--r--drivers/iio/magnetometer/st_magn_spi.c1
-rw-r--r--drivers/iio/pressure/ms5611_spi.c1
-rw-r--r--drivers/iio/pressure/st_pressure_spi.c1
-rw-r--r--drivers/iio/proximity/as3935.c1
-rw-r--r--drivers/input/misc/ad714x-spi.c1
-rw-r--r--drivers/input/misc/adxl34x-spi.c1
-rw-r--r--drivers/input/touchscreen/ad7877.c1
-rw-r--r--drivers/input/touchscreen/ad7879-spi.c1
-rw-r--r--drivers/input/touchscreen/ads7846.c1
-rw-r--r--drivers/input/touchscreen/cyttsp4_spi.c1
-rw-r--r--drivers/input/touchscreen/cyttsp_spi.c1
-rw-r--r--drivers/input/touchscreen/tsc2005.c1
-rw-r--r--drivers/leds/leds-dac124s085.c1
-rw-r--r--drivers/media/i2c/s5c73m3/s5c73m3-spi.c1
-rw-r--r--drivers/media/tuners/msi001.c1
-rw-r--r--drivers/mfd/arizona-spi.c1
-rw-r--r--drivers/mfd/cros_ec_spi.c1
-rw-r--r--drivers/mfd/da9052-spi.c1
-rw-r--r--drivers/mfd/ezx-pcap.c1
-rw-r--r--drivers/mfd/mc13xxx-spi.c1
-rw-r--r--drivers/mfd/stmpe-spi.c1
-rw-r--r--drivers/mfd/tps65912-spi.c1
-rw-r--r--drivers/mfd/wm831x-spi.c1
-rw-r--r--drivers/misc/ad525x_dpot-spi.c1
-rw-r--r--drivers/misc/bmp085-spi.c1
-rw-r--r--drivers/misc/eeprom/at25.c1
-rw-r--r--drivers/misc/eeprom/eeprom_93xx46.c1
-rw-r--r--drivers/misc/lattice-ecp3-config.c1
-rw-r--r--drivers/misc/lis3lv02d/lis3lv02d_spi.c1
-rw-r--r--drivers/misc/ti_dac7512.c1
-rw-r--r--drivers/mmc/host/mmc_spi.c1
-rw-r--r--drivers/mtd/devices/m25p80.c1
-rw-r--r--drivers/mtd/devices/mtd_dataflash.c1
-rw-r--r--drivers/mtd/devices/sst25l.c1
-rw-r--r--drivers/net/can/spi/mcp251x.c1
-rw-r--r--drivers/net/ethernet/micrel/ks8851.c1
-rw-r--r--drivers/net/ethernet/microchip/enc28j60.c1
-rw-r--r--drivers/net/ethernet/qualcomm/qca_spi.c1
-rw-r--r--drivers/net/ieee802154/at86rf230.c1
-rw-r--r--drivers/net/ieee802154/cc2520.c1
-rw-r--r--drivers/net/ieee802154/mrf24j40.c1
-rw-r--r--drivers/net/phy/spi_ks8995.c1
-rw-r--r--drivers/net/wireless/cw1200/cw1200_spi.c1
-rw-r--r--drivers/net/wireless/libertas/if_spi.c1
-rw-r--r--drivers/net/wireless/p54/p54spi.c1
-rw-r--r--drivers/net/wireless/ti/wl1251/spi.c1
-rw-r--r--drivers/net/wireless/ti/wlcore/spi.c1
-rw-r--r--drivers/nfc/st-nci/spi.c1
-rw-r--r--drivers/nfc/trf7970a.c1
-rw-r--r--drivers/regulator/tps6524x-regulator.c1
-rw-r--r--drivers/rtc/rtc-ds1305.c1
-rw-r--r--drivers/rtc/rtc-ds1343.c1
-rw-r--r--drivers/rtc/rtc-ds1347.c1
-rw-r--r--drivers/rtc/rtc-ds1390.c1
-rw-r--r--drivers/rtc/rtc-ds3234.c1
-rw-r--r--drivers/rtc/rtc-m41t93.c1
-rw-r--r--drivers/rtc/rtc-m41t94.c1
-rw-r--r--drivers/rtc/rtc-max6902.c1
-rw-r--r--drivers/rtc/rtc-mcp795.c1
-rw-r--r--drivers/rtc/rtc-pcf2123.c1
-rw-r--r--drivers/rtc/rtc-r9701.c1
-rw-r--r--drivers/rtc/rtc-rs5c348.c1
-rw-r--r--drivers/rtc/rtc-rx4581.c1
-rw-r--r--drivers/spi/Kconfig15
-rw-r--r--drivers/spi/Makefile1
-rw-r--r--drivers/spi/spi-ath79.c11
-rw-r--r--drivers/spi/spi-atmel.c24
-rw-r--r--drivers/spi/spi-au1550.c11
-rw-r--r--drivers/spi/spi-bcm2835.c14
-rw-r--r--drivers/spi/spi-bcm2835aux.c512
-rw-r--r--drivers/spi/spi-bcm53xx.c13
-rw-r--r--drivers/spi/spi-bcm63xx.c210
-rw-r--r--drivers/spi/spi-bfin-sport.c5
-rw-r--r--drivers/spi/spi-bfin5xx.c6
-rw-r--r--drivers/spi/spi-bitbang.c152
-rw-r--r--drivers/spi/spi-coldfire-qspi.c3
-rw-r--r--drivers/spi/spi-davinci.c15
-rw-r--r--drivers/spi/spi-dw-mmio.c7
-rw-r--r--drivers/spi/spi-dw-pci.c29
-rw-r--r--drivers/spi/spi-dw.c108
-rw-r--r--drivers/spi/spi-dw.h6
-rw-r--r--drivers/spi/spi-fsl-dspi.c3
-rw-r--r--drivers/spi/spi-imx.c7
-rw-r--r--drivers/spi/spi-mpc512x-psc.c8
-rw-r--r--drivers/spi/spi-mt65xx.c129
-rw-r--r--drivers/spi/spi-oc-tiny.c14
-rw-r--r--drivers/spi/spi-octeon.c2
-rw-r--r--drivers/spi/spi-omap-100k.c26
-rw-r--r--drivers/spi/spi-omap-uwire.c7
-rw-r--r--drivers/spi/spi-omap2-mcspi.c28
-rw-r--r--drivers/spi/spi-ppc4xx.c4
-rw-r--r--drivers/spi/spi-pxa2xx-dma.c4
-rw-r--r--drivers/spi/spi-pxa2xx.c257
-rw-r--r--drivers/spi/spi-pxa2xx.h9
-rw-r--r--drivers/spi/spi-s3c24xx.c4
-rw-r--r--drivers/spi/spi-s3c64xx.c46
-rw-r--r--drivers/spi/spi-ti-qspi.c88
-rw-r--r--drivers/spi/spi-tle62x0.c1
-rw-r--r--drivers/spi/spi-txx9.c2
-rw-r--r--drivers/spi/spi-xilinx.c38
-rw-r--r--drivers/spi/spi.c136
-rw-r--r--drivers/spi/spidev.c1
-rw-r--r--drivers/staging/fbtft/fbtft.h1
-rw-r--r--drivers/staging/fbtft/flexfb.c1
-rw-r--r--drivers/staging/iio/accel/adis16201_core.c1
-rw-r--r--drivers/staging/iio/accel/adis16203_core.c1
-rw-r--r--drivers/staging/iio/accel/adis16204_core.c1
-rw-r--r--drivers/staging/iio/accel/adis16209_core.c1
-rw-r--r--drivers/staging/iio/accel/adis16220_core.c1
-rw-r--r--drivers/staging/iio/accel/adis16240_core.c1
-rw-r--r--drivers/staging/iio/accel/lis3l02dq_core.c1
-rw-r--r--drivers/staging/iio/accel/sca3000_core.c1
-rw-r--r--drivers/staging/iio/adc/ad7192.c1
-rw-r--r--drivers/staging/iio/adc/ad7280a.c1
-rw-r--r--drivers/staging/iio/adc/ad7606_spi.c1
-rw-r--r--drivers/staging/iio/adc/ad7780.c1
-rw-r--r--drivers/staging/iio/adc/ad7816.c1
-rw-r--r--drivers/staging/iio/addac/adt7316-spi.c1
-rw-r--r--drivers/staging/iio/frequency/ad9832.c1
-rw-r--r--drivers/staging/iio/frequency/ad9834.c1
-rw-r--r--drivers/staging/iio/gyro/adis16060_core.c2
-rw-r--r--drivers/staging/iio/magnetometer/hmc5843_spi.c1
-rw-r--r--drivers/staging/iio/meter/ade7753.c1
-rw-r--r--drivers/staging/iio/meter/ade7754.c1
-rw-r--r--drivers/staging/iio/meter/ade7758_core.c1
-rw-r--r--drivers/staging/iio/meter/ade7759.c1
-rw-r--r--drivers/staging/iio/meter/ade7854-spi.c1
-rw-r--r--drivers/staging/iio/resolver/ad2s1200.c1
-rw-r--r--drivers/staging/iio/resolver/ad2s1210.c1
-rw-r--r--drivers/staging/iio/resolver/ad2s90.c1
-rw-r--r--drivers/staging/mt29f_spinand/mt29f_spinand.c1
-rw-r--r--drivers/tty/serial/ifx6x60.c2
-rw-r--r--drivers/tty/serial/max3100.c1
-rw-r--r--drivers/tty/serial/max310x.c1
-rw-r--r--drivers/tty/serial/sc16is7xx.c1
-rw-r--r--drivers/usb/host/max3421-hcd.c1
-rw-r--r--drivers/video/backlight/ams369fg06.c1
-rw-r--r--drivers/video/backlight/corgi_lcd.c1
-rw-r--r--drivers/video/backlight/ili922x.c1
-rw-r--r--drivers/video/backlight/l4f00242t03.c1
-rw-r--r--drivers/video/backlight/ld9040.c1
-rw-r--r--drivers/video/backlight/lms283gf05.c1
-rw-r--r--drivers/video/backlight/lms501kf03.c1
-rw-r--r--drivers/video/backlight/ltv350qv.c1
-rw-r--r--drivers/video/backlight/s6e63m0.c1
-rw-r--r--drivers/video/backlight/tdo24m.c1
-rw-r--r--drivers/video/backlight/tosa_lcd.c1
-rw-r--r--drivers/video/backlight/vgg2432a4.c1
-rw-r--r--drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c1
-rw-r--r--drivers/video/fbdev/omap/lcd_mipid.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c1
-rw-r--r--drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c1
-rw-r--r--include/linux/pxa2xx_ssp.h1
-rw-r--r--include/linux/spi/spi.h44
-rw-r--r--include/linux/spi/spi_bitbang.h2
-rw-r--r--sound/soc/codecs/ad1836.c1
-rw-r--r--sound/soc/codecs/ad193x-spi.c1
-rw-r--r--sound/soc/codecs/adau1761-spi.c1
-rw-r--r--sound/soc/codecs/adau1781-spi.c1
-rw-r--r--sound/soc/codecs/adau1977-spi.c1
-rw-r--r--sound/soc/codecs/adav801.c1
-rw-r--r--sound/soc/codecs/ak4104.c1
-rw-r--r--sound/soc/codecs/cs4271-spi.c1
-rw-r--r--sound/soc/codecs/da7210.c1
-rw-r--r--sound/soc/codecs/pcm1792a.c1
-rw-r--r--sound/soc/codecs/pcm512x-spi.c1
-rw-r--r--sound/soc/codecs/rt5677-spi.c1
-rw-r--r--sound/soc/codecs/ssm2602-spi.c1
-rw-r--r--sound/soc/codecs/tlv320aic23-spi.c1
-rw-r--r--sound/soc/codecs/tlv320aic26.c1
-rw-r--r--sound/soc/codecs/wm0010.c1
-rw-r--r--sound/soc/codecs/wm8510.c1
-rw-r--r--sound/soc/codecs/wm8711.c1
-rw-r--r--sound/soc/codecs/wm8728.c1
-rw-r--r--sound/soc/codecs/wm8731.c1
-rw-r--r--sound/soc/codecs/wm8737.c1
-rw-r--r--sound/soc/codecs/wm8741.c1
-rw-r--r--sound/soc/codecs/wm8750.c1
-rw-r--r--sound/soc/codecs/wm8753.c1
-rw-r--r--sound/soc/codecs/wm8770.c1
-rw-r--r--sound/soc/codecs/wm8776.c1
-rw-r--r--sound/soc/codecs/wm8804-spi.c1
-rw-r--r--sound/soc/codecs/wm8900.c1
-rw-r--r--sound/soc/codecs/wm8983.c1
-rw-r--r--sound/soc/codecs/wm8985.c1
-rw-r--r--sound/soc/codecs/wm8988.c1
-rw-r--r--sound/soc/codecs/wm8995.c1
247 files changed, 1409 insertions, 931 deletions
diff --git a/Documentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt b/Documentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt
new file mode 100644
index 000000000000..9887b0724759
--- /dev/null
+++ b/Documentation/devicetree/bindings/spi/brcm,bcm2835-aux-spi.txt
@@ -0,0 +1,38 @@
1Broadcom BCM2835 auxiliar SPI1/2 controller
2
3The BCM2835 contains two forms of SPI master controller, one known simply as
4SPI0, and the other known as the "Universal SPI Master"; part of the
5auxiliary block. This binding applies to the SPI1/2 controller.
6
7Required properties:
8- compatible: Should be "brcm,bcm2835-aux-spi".
9- reg: Should contain register location and length for the spi block
10- interrupts: Should contain shared interrupt of the aux block
11- clocks: The clock feeding the SPI controller - needs to
12 point to the auxiliar clock driver of the bcm2835,
13 as this clock will enable the output gate for the specific
14 clock.
15- cs-gpios: the cs-gpios (native cs is NOT supported)
16 see also spi-bus.txt
17
18Example:
19
20spi1@7e215080 {
21 compatible = "brcm,bcm2835-aux-spi";
22 reg = <0x7e215080 0x40>;
23 interrupts = <1 29>;
24 clocks = <&aux_clocks BCM2835_AUX_CLOCK_SPI1>;
25 #address-cells = <1>;
26 #size-cells = <0>;
27 cs-gpios = <&gpio 18>, <&gpio 17>, <&gpio 16>;
28};
29
30spi2@7e2150c0 {
31 compatible = "brcm,bcm2835-aux-spi";
32 reg = <0x7e2150c0 0x40>;
33 interrupts = <1 29>;
34 clocks = <&aux_clocks BCM2835_AUX_CLOCK_SPI2>;
35 #address-cells = <1>;
36 #size-cells = <0>;
37 cs-gpios = <&gpio 43>, <&gpio 44>, <&gpio 45>;
38};
diff --git a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
index 6160ffbcb3d3..ce363c923f44 100644
--- a/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
+++ b/Documentation/devicetree/bindings/spi/spi-mt65xx.txt
@@ -29,8 +29,11 @@ Required properties:
29 muxes clock, and "spi-clk" for the clock gate. 29 muxes clock, and "spi-clk" for the clock gate.
30 30
31Optional properties: 31Optional properties:
32-cs-gpios: see spi-bus.txt, only required for MT8173.
33
32- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi 34- mediatek,pad-select: specify which pins group(ck/mi/mo/cs) spi
33 controller used, this value should be 0~3, only required for MT8173. 35 controller used. This is a array, the element value should be 0~3,
36 only required for MT8173.
34 0: specify GPIO69,70,71,72 for spi pins. 37 0: specify GPIO69,70,71,72 for spi pins.
35 1: specify GPIO102,103,104,105 for spi pins. 38 1: specify GPIO102,103,104,105 for spi pins.
36 2: specify GPIO128,129,130,131 for spi pins. 39 2: specify GPIO128,129,130,131 for spi pins.
@@ -49,7 +52,7 @@ spi: spi@1100a000 {
49 <&topckgen CLK_TOP_SPI_SEL>, 52 <&topckgen CLK_TOP_SPI_SEL>,
50 <&pericfg CLK_PERI_SPI0>; 53 <&pericfg CLK_PERI_SPI0>;
51 clock-names = "parent-clk", "sel-clk", "spi-clk"; 54 clock-names = "parent-clk", "sel-clk", "spi-clk";
52 55 cs-gpios = <&pio 105 GPIO_ACTIVE_LOW>, <&pio 72 GPIO_ACTIVE_LOW>;
53 mediatek,pad-select = <0>; 56 mediatek,pad-select = <1>, <0>;
54 status = "disabled"; 57 status = "disabled";
55}; 58};
diff --git a/arch/arm/mach-u300/dummyspichip.c b/arch/arm/mach-u300/dummyspichip.c
index 131996805690..68fe986ca42e 100644
--- a/arch/arm/mach-u300/dummyspichip.c
+++ b/arch/arm/mach-u300/dummyspichip.c
@@ -264,7 +264,6 @@ static const struct of_device_id pl022_dummy_dt_match[] = {
264static struct spi_driver pl022_dummy_driver = { 264static struct spi_driver pl022_dummy_driver = {
265 .driver = { 265 .driver = {
266 .name = "spi-dummy", 266 .name = "spi-dummy",
267 .owner = THIS_MODULE,
268 .of_match_table = pl022_dummy_dt_match, 267 .of_match_table = pl022_dummy_dt_match,
269 }, 268 },
270 .probe = pl022_dummy_probe, 269 .probe = pl022_dummy_probe,
diff --git a/arch/mips/bcm63xx/dev-spi.c b/arch/mips/bcm63xx/dev-spi.c
index ad448e41e3bd..232385441e46 100644
--- a/arch/mips/bcm63xx/dev-spi.c
+++ b/arch/mips/bcm63xx/dev-spi.c
@@ -18,29 +18,6 @@
18#include <bcm63xx_dev_spi.h> 18#include <bcm63xx_dev_spi.h>
19#include <bcm63xx_regs.h> 19#include <bcm63xx_regs.h>
20 20
21/*
22 * register offsets
23 */
24static const unsigned long bcm6348_regs_spi[] = {
25 __GEN_SPI_REGS_TABLE(6348)
26};
27
28static const unsigned long bcm6358_regs_spi[] = {
29 __GEN_SPI_REGS_TABLE(6358)
30};
31
32const unsigned long *bcm63xx_regs_spi;
33EXPORT_SYMBOL(bcm63xx_regs_spi);
34
35static __init void bcm63xx_spi_regs_init(void)
36{
37 if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
38 bcm63xx_regs_spi = bcm6348_regs_spi;
39 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() ||
40 BCMCPU_IS_6362() || BCMCPU_IS_6368())
41 bcm63xx_regs_spi = bcm6358_regs_spi;
42}
43
44static struct resource spi_resources[] = { 21static struct resource spi_resources[] = {
45 { 22 {
46 .start = -1, /* filled at runtime */ 23 .start = -1, /* filled at runtime */
@@ -53,19 +30,10 @@ static struct resource spi_resources[] = {
53 }, 30 },
54}; 31};
55 32
56static struct bcm63xx_spi_pdata spi_pdata = {
57 .bus_num = 0,
58 .num_chipselect = 8,
59};
60
61static struct platform_device bcm63xx_spi_device = { 33static struct platform_device bcm63xx_spi_device = {
62 .name = "bcm63xx-spi",
63 .id = -1, 34 .id = -1,
64 .num_resources = ARRAY_SIZE(spi_resources), 35 .num_resources = ARRAY_SIZE(spi_resources),
65 .resource = spi_resources, 36 .resource = spi_resources,
66 .dev = {
67 .platform_data = &spi_pdata,
68 },
69}; 37};
70 38
71int __init bcm63xx_spi_register(void) 39int __init bcm63xx_spi_register(void)
@@ -78,21 +46,15 @@ int __init bcm63xx_spi_register(void)
78 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI); 46 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
79 47
80 if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) { 48 if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
49 bcm63xx_spi_device.name = "bcm6348-spi",
81 spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1; 50 spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1;
82 spi_pdata.fifo_size = SPI_6348_MSG_DATA_SIZE;
83 spi_pdata.msg_type_shift = SPI_6348_MSG_TYPE_SHIFT;
84 spi_pdata.msg_ctl_width = SPI_6348_MSG_CTL_WIDTH;
85 } 51 }
86 52
87 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() || 53 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() ||
88 BCMCPU_IS_6368()) { 54 BCMCPU_IS_6368()) {
55 bcm63xx_spi_device.name = "bcm6358-spi",
89 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1; 56 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
90 spi_pdata.fifo_size = SPI_6358_MSG_DATA_SIZE;
91 spi_pdata.msg_type_shift = SPI_6358_MSG_TYPE_SHIFT;
92 spi_pdata.msg_ctl_width = SPI_6358_MSG_CTL_WIDTH;
93 } 57 }
94 58
95 bcm63xx_spi_regs_init();
96
97 return platform_device_register(&bcm63xx_spi_device); 59 return platform_device_register(&bcm63xx_spi_device);
98} 60}
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
index 25737655d141..dd299548860d 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_spi.h
@@ -7,48 +7,4 @@
7 7
8int __init bcm63xx_spi_register(void); 8int __init bcm63xx_spi_register(void);
9 9
10struct bcm63xx_spi_pdata {
11 unsigned int fifo_size;
12 unsigned int msg_type_shift;
13 unsigned int msg_ctl_width;
14 int bus_num;
15 int num_chipselect;
16};
17
18enum bcm63xx_regs_spi {
19 SPI_CMD,
20 SPI_INT_STATUS,
21 SPI_INT_MASK_ST,
22 SPI_INT_MASK,
23 SPI_ST,
24 SPI_CLK_CFG,
25 SPI_FILL_BYTE,
26 SPI_MSG_TAIL,
27 SPI_RX_TAIL,
28 SPI_MSG_CTL,
29 SPI_MSG_DATA,
30 SPI_RX_DATA,
31};
32
33#define __GEN_SPI_REGS_TABLE(__cpu) \
34 [SPI_CMD] = SPI_## __cpu ##_CMD, \
35 [SPI_INT_STATUS] = SPI_## __cpu ##_INT_STATUS, \
36 [SPI_INT_MASK_ST] = SPI_## __cpu ##_INT_MASK_ST, \
37 [SPI_INT_MASK] = SPI_## __cpu ##_INT_MASK, \
38 [SPI_ST] = SPI_## __cpu ##_ST, \
39 [SPI_CLK_CFG] = SPI_## __cpu ##_CLK_CFG, \
40 [SPI_FILL_BYTE] = SPI_## __cpu ##_FILL_BYTE, \
41 [SPI_MSG_TAIL] = SPI_## __cpu ##_MSG_TAIL, \
42 [SPI_RX_TAIL] = SPI_## __cpu ##_RX_TAIL, \
43 [SPI_MSG_CTL] = SPI_## __cpu ##_MSG_CTL, \
44 [SPI_MSG_DATA] = SPI_## __cpu ##_MSG_DATA, \
45 [SPI_RX_DATA] = SPI_## __cpu ##_RX_DATA,
46
47static inline unsigned long bcm63xx_spireg(enum bcm63xx_regs_spi reg)
48{
49 extern const unsigned long *bcm63xx_regs_spi;
50
51 return bcm63xx_regs_spi[reg];
52}
53
54#endif /* BCM63XX_DEV_SPI_H */ 10#endif /* BCM63XX_DEV_SPI_H */
diff --git a/arch/mips/txx9/generic/spi_eeprom.c b/arch/mips/txx9/generic/spi_eeprom.c
index 3dbad99d5611..d833dd2c9b55 100644
--- a/arch/mips/txx9/generic/spi_eeprom.c
+++ b/arch/mips/txx9/generic/spi_eeprom.c
@@ -80,7 +80,6 @@ static int __init early_seeprom_probe(struct spi_device *spi)
80static struct spi_driver early_seeprom_driver __initdata = { 80static struct spi_driver early_seeprom_driver __initdata = {
81 .driver = { 81 .driver = {
82 .name = "at25", 82 .name = "at25",
83 .owner = THIS_MODULE,
84 }, 83 },
85 .probe = early_seeprom_probe, 84 .probe = early_seeprom_probe,
86}; 85};
diff --git a/drivers/char/tpm/st33zp24/spi.c b/drivers/char/tpm/st33zp24/spi.c
index f0184a1b0c1c..f974c945c97a 100644
--- a/drivers/char/tpm/st33zp24/spi.c
+++ b/drivers/char/tpm/st33zp24/spi.c
@@ -381,7 +381,6 @@ static SIMPLE_DEV_PM_OPS(st33zp24_spi_ops, st33zp24_pm_suspend,
381 381
382static struct spi_driver tpm_st33_spi_driver = { 382static struct spi_driver tpm_st33_spi_driver = {
383 .driver = { 383 .driver = {
384 .owner = THIS_MODULE,
385 .name = TPM_ST33_SPI, 384 .name = TPM_ST33_SPI,
386 .pm = &st33zp24_spi_ops, 385 .pm = &st33zp24_spi_ops,
387 .of_match_table = of_match_ptr(of_st33zp24_spi_match), 386 .of_match_table = of_match_ptr(of_st33zp24_spi_match),
diff --git a/drivers/gpio/gpio-74x164.c b/drivers/gpio/gpio-74x164.c
index e3d968f751f1..60172f835d15 100644
--- a/drivers/gpio/gpio-74x164.c
+++ b/drivers/gpio/gpio-74x164.c
@@ -183,7 +183,6 @@ MODULE_DEVICE_TABLE(of, gen_74x164_dt_ids);
183static struct spi_driver gen_74x164_driver = { 183static struct spi_driver gen_74x164_driver = {
184 .driver = { 184 .driver = {
185 .name = "74x164", 185 .name = "74x164",
186 .owner = THIS_MODULE,
187 .of_match_table = gen_74x164_dt_ids, 186 .of_match_table = gen_74x164_dt_ids,
188 }, 187 },
189 .probe = gen_74x164_probe, 188 .probe = gen_74x164_probe,
diff --git a/drivers/gpio/gpio-max7301.c b/drivers/gpio/gpio-max7301.c
index 6e1c984a75d4..05813fbf3daf 100644
--- a/drivers/gpio/gpio-max7301.c
+++ b/drivers/gpio/gpio-max7301.c
@@ -87,7 +87,6 @@ MODULE_DEVICE_TABLE(spi, max7301_id);
87static struct spi_driver max7301_driver = { 87static struct spi_driver max7301_driver = {
88 .driver = { 88 .driver = {
89 .name = "max7301", 89 .name = "max7301",
90 .owner = THIS_MODULE,
91 }, 90 },
92 .probe = max7301_probe, 91 .probe = max7301_probe,
93 .remove = max7301_remove, 92 .remove = max7301_remove,
diff --git a/drivers/gpio/gpio-mc33880.c b/drivers/gpio/gpio-mc33880.c
index a431604c9e67..2853731db5bc 100644
--- a/drivers/gpio/gpio-mc33880.c
+++ b/drivers/gpio/gpio-mc33880.c
@@ -163,7 +163,6 @@ static int mc33880_remove(struct spi_device *spi)
163static struct spi_driver mc33880_driver = { 163static struct spi_driver mc33880_driver = {
164 .driver = { 164 .driver = {
165 .name = DRIVER_NAME, 165 .name = DRIVER_NAME,
166 .owner = THIS_MODULE,
167 }, 166 },
168 .probe = mc33880_probe, 167 .probe = mc33880_probe,
169 .remove = mc33880_remove, 168 .remove = mc33880_remove,
diff --git a/drivers/gpio/gpio-mcp23s08.c b/drivers/gpio/gpio-mcp23s08.c
index 73db7ecd7ffd..4a41694919da 100644
--- a/drivers/gpio/gpio-mcp23s08.c
+++ b/drivers/gpio/gpio-mcp23s08.c
@@ -848,7 +848,6 @@ MODULE_DEVICE_TABLE(i2c, mcp230xx_id);
848static struct i2c_driver mcp230xx_driver = { 848static struct i2c_driver mcp230xx_driver = {
849 .driver = { 849 .driver = {
850 .name = "mcp230xx", 850 .name = "mcp230xx",
851 .owner = THIS_MODULE,
852 .of_match_table = of_match_ptr(mcp23s08_i2c_of_match), 851 .of_match_table = of_match_ptr(mcp23s08_i2c_of_match),
853 }, 852 },
854 .probe = mcp230xx_probe, 853 .probe = mcp230xx_probe,
@@ -1021,7 +1020,6 @@ static struct spi_driver mcp23s08_driver = {
1021 .id_table = mcp23s08_ids, 1020 .id_table = mcp23s08_ids,
1022 .driver = { 1021 .driver = {
1023 .name = "mcp23s08", 1022 .name = "mcp23s08",
1024 .owner = THIS_MODULE,
1025 .of_match_table = of_match_ptr(mcp23s08_spi_of_match), 1023 .of_match_table = of_match_ptr(mcp23s08_spi_of_match),
1026 }, 1024 },
1027}; 1025};
diff --git a/drivers/gpu/drm/panel/panel-lg-lg4573.c b/drivers/gpu/drm/panel/panel-lg-lg4573.c
index a7b4939cee6d..6989238b276a 100644
--- a/drivers/gpu/drm/panel/panel-lg-lg4573.c
+++ b/drivers/gpu/drm/panel/panel-lg-lg4573.c
@@ -287,7 +287,6 @@ static struct spi_driver lg4573_driver = {
287 .remove = lg4573_remove, 287 .remove = lg4573_remove,
288 .driver = { 288 .driver = {
289 .name = "lg4573", 289 .name = "lg4573",
290 .owner = THIS_MODULE,
291 .of_match_table = lg4573_of_match, 290 .of_match_table = lg4573_of_match,
292 }, 291 },
293}; 292};
diff --git a/drivers/gpu/drm/panel/panel-samsung-ld9040.c b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
index b202377135e7..3cf4cf6a6942 100644
--- a/drivers/gpu/drm/panel/panel-samsung-ld9040.c
+++ b/drivers/gpu/drm/panel/panel-samsung-ld9040.c
@@ -378,7 +378,6 @@ static struct spi_driver ld9040_driver = {
378 .remove = ld9040_remove, 378 .remove = ld9040_remove,
379 .driver = { 379 .driver = {
380 .name = "panel-samsung-ld9040", 380 .name = "panel-samsung-ld9040",
381 .owner = THIS_MODULE,
382 .of_match_table = ld9040_of_match, 381 .of_match_table = ld9040_of_match,
383 }, 382 },
384}; 383};
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c
index 11955467fc0f..202c1fbb3407 100644
--- a/drivers/hwmon/ad7314.c
+++ b/drivers/hwmon/ad7314.c
@@ -157,7 +157,6 @@ MODULE_DEVICE_TABLE(spi, ad7314_id);
157static struct spi_driver ad7314_driver = { 157static struct spi_driver ad7314_driver = {
158 .driver = { 158 .driver = {
159 .name = "ad7314", 159 .name = "ad7314",
160 .owner = THIS_MODULE,
161 }, 160 },
162 .probe = ad7314_probe, 161 .probe = ad7314_probe,
163 .remove = ad7314_remove, 162 .remove = ad7314_remove,
diff --git a/drivers/hwmon/adcxx.c b/drivers/hwmon/adcxx.c
index 04c08c2f79b8..69e0bb97e597 100644
--- a/drivers/hwmon/adcxx.c
+++ b/drivers/hwmon/adcxx.c
@@ -234,7 +234,6 @@ MODULE_DEVICE_TABLE(spi, adcxx_ids);
234static struct spi_driver adcxx_driver = { 234static struct spi_driver adcxx_driver = {
235 .driver = { 235 .driver = {
236 .name = "adcxx", 236 .name = "adcxx",
237 .owner = THIS_MODULE,
238 }, 237 },
239 .id_table = adcxx_ids, 238 .id_table = adcxx_ids,
240 .probe = adcxx_probe, 239 .probe = adcxx_probe,
diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c
index 3eff73b6220d..4fd9e4de1972 100644
--- a/drivers/hwmon/ads7871.c
+++ b/drivers/hwmon/ads7871.c
@@ -237,7 +237,6 @@ static int ads7871_remove(struct spi_device *spi)
237static struct spi_driver ads7871_driver = { 237static struct spi_driver ads7871_driver = {
238 .driver = { 238 .driver = {
239 .name = DEVICE_NAME, 239 .name = DEVICE_NAME,
240 .owner = THIS_MODULE,
241 }, 240 },
242 241
243 .probe = ads7871_probe, 242 .probe = ads7871_probe,
diff --git a/drivers/hwmon/adt7310.c b/drivers/hwmon/adt7310.c
index 5994cf68e0a4..ec02f4f0d67a 100644
--- a/drivers/hwmon/adt7310.c
+++ b/drivers/hwmon/adt7310.c
@@ -104,7 +104,6 @@ MODULE_DEVICE_TABLE(spi, adt7310_id);
104static struct spi_driver adt7310_driver = { 104static struct spi_driver adt7310_driver = {
105 .driver = { 105 .driver = {
106 .name = "adt7310", 106 .name = "adt7310",
107 .owner = THIS_MODULE,
108 .pm = ADT7X10_DEV_PM_OPS, 107 .pm = ADT7X10_DEV_PM_OPS,
109 }, 108 },
110 .probe = adt7310_spi_probe, 109 .probe = adt7310_spi_probe,
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index 9296e9daf774..583f883a4cfe 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -199,7 +199,6 @@ MODULE_DEVICE_TABLE(spi, lm70_ids);
199static struct spi_driver lm70_driver = { 199static struct spi_driver lm70_driver = {
200 .driver = { 200 .driver = {
201 .name = "lm70", 201 .name = "lm70",
202 .owner = THIS_MODULE,
203 .of_match_table = of_match_ptr(lm70_of_ids), 202 .of_match_table = of_match_ptr(lm70_of_ids),
204 }, 203 },
205 .id_table = lm70_ids, 204 .id_table = lm70_ids,
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index f67d71ee8386..36544c4f653c 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -277,7 +277,6 @@ MODULE_DEVICE_TABLE(spi, max1111_ids);
277static struct spi_driver max1111_driver = { 277static struct spi_driver max1111_driver = {
278 .driver = { 278 .driver = {
279 .name = "max1111", 279 .name = "max1111",
280 .owner = THIS_MODULE,
281 }, 280 },
282 .id_table = max1111_ids, 281 .id_table = max1111_ids,
283 .probe = max1111_probe, 282 .probe = max1111_probe,
diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c
index 98ba761cbb9c..923f56598d4b 100644
--- a/drivers/iio/accel/kxsd9.c
+++ b/drivers/iio/accel/kxsd9.c
@@ -263,7 +263,6 @@ MODULE_DEVICE_TABLE(spi, kxsd9_id);
263static struct spi_driver kxsd9_driver = { 263static struct spi_driver kxsd9_driver = {
264 .driver = { 264 .driver = {
265 .name = "kxsd9", 265 .name = "kxsd9",
266 .owner = THIS_MODULE,
267 }, 266 },
268 .probe = kxsd9_probe, 267 .probe = kxsd9_probe,
269 .remove = kxsd9_remove, 268 .remove = kxsd9_remove,
diff --git a/drivers/iio/accel/st_accel_spi.c b/drivers/iio/accel/st_accel_spi.c
index 54b61a3961c3..f71b0d391272 100644
--- a/drivers/iio/accel/st_accel_spi.c
+++ b/drivers/iio/accel/st_accel_spi.c
@@ -64,7 +64,6 @@ MODULE_DEVICE_TABLE(spi, st_accel_id_table);
64 64
65static struct spi_driver st_accel_driver = { 65static struct spi_driver st_accel_driver = {
66 .driver = { 66 .driver = {
67 .owner = THIS_MODULE,
68 .name = "st-accel-spi", 67 .name = "st-accel-spi",
69 }, 68 },
70 .probe = st_accel_spi_probe, 69 .probe = st_accel_spi_probe,
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index 70f78c3062a7..21e19b60e2b9 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -509,7 +509,6 @@ MODULE_DEVICE_TABLE(spi, ad7266_id);
509static struct spi_driver ad7266_driver = { 509static struct spi_driver ad7266_driver = {
510 .driver = { 510 .driver = {
511 .name = "ad7266", 511 .name = "ad7266",
512 .owner = THIS_MODULE,
513 }, 512 },
514 .probe = ad7266_probe, 513 .probe = ad7266_probe,
515 .remove = ad7266_remove, 514 .remove = ad7266_remove,
diff --git a/drivers/iio/adc/ad7298.c b/drivers/iio/adc/ad7298.c
index 4a8c0a2f49b6..62bb8f7ce4a0 100644
--- a/drivers/iio/adc/ad7298.c
+++ b/drivers/iio/adc/ad7298.c
@@ -378,7 +378,6 @@ MODULE_DEVICE_TABLE(spi, ad7298_id);
378static struct spi_driver ad7298_driver = { 378static struct spi_driver ad7298_driver = {
379 .driver = { 379 .driver = {
380 .name = "ad7298", 380 .name = "ad7298",
381 .owner = THIS_MODULE,
382 }, 381 },
383 .probe = ad7298_probe, 382 .probe = ad7298_probe,
384 .remove = ad7298_remove, 383 .remove = ad7298_remove,
diff --git a/drivers/iio/adc/ad7476.c b/drivers/iio/adc/ad7476.c
index ce400ec176f1..be85c2a0ad97 100644
--- a/drivers/iio/adc/ad7476.c
+++ b/drivers/iio/adc/ad7476.c
@@ -302,7 +302,6 @@ MODULE_DEVICE_TABLE(spi, ad7476_id);
302static struct spi_driver ad7476_driver = { 302static struct spi_driver ad7476_driver = {
303 .driver = { 303 .driver = {
304 .name = "ad7476", 304 .name = "ad7476",
305 .owner = THIS_MODULE,
306 }, 305 },
307 .probe = ad7476_probe, 306 .probe = ad7476_probe,
308 .remove = ad7476_remove, 307 .remove = ad7476_remove,
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index c19f8fd1b4b7..cf172d58cd44 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -440,7 +440,6 @@ MODULE_DEVICE_TABLE(spi, ad7791_spi_ids);
440static struct spi_driver ad7791_driver = { 440static struct spi_driver ad7791_driver = {
441 .driver = { 441 .driver = {
442 .name = "ad7791", 442 .name = "ad7791",
443 .owner = THIS_MODULE,
444 }, 443 },
445 .probe = ad7791_probe, 444 .probe = ad7791_probe,
446 .remove = ad7791_remove, 445 .remove = ad7791_remove,
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index b84922a4b32e..eea0c79111e7 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -852,7 +852,6 @@ MODULE_DEVICE_TABLE(spi, ad7793_id);
852static struct spi_driver ad7793_driver = { 852static struct spi_driver ad7793_driver = {
853 .driver = { 853 .driver = {
854 .name = "ad7793", 854 .name = "ad7793",
855 .owner = THIS_MODULE,
856 }, 855 },
857 .probe = ad7793_probe, 856 .probe = ad7793_probe,
858 .remove = ad7793_remove, 857 .remove = ad7793_remove,
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 2fd012ee99f5..2d3c397e66ad 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -356,7 +356,6 @@ MODULE_DEVICE_TABLE(spi, ad7887_id);
356static struct spi_driver ad7887_driver = { 356static struct spi_driver ad7887_driver = {
357 .driver = { 357 .driver = {
358 .name = "ad7887", 358 .name = "ad7887",
359 .owner = THIS_MODULE,
360 }, 359 },
361 .probe = ad7887_probe, 360 .probe = ad7887_probe,
362 .remove = ad7887_remove, 361 .remove = ad7887_remove,
diff --git a/drivers/iio/adc/ad7923.c b/drivers/iio/adc/ad7923.c
index 28732c28e819..45e29ccd824f 100644
--- a/drivers/iio/adc/ad7923.c
+++ b/drivers/iio/adc/ad7923.c
@@ -357,7 +357,6 @@ MODULE_DEVICE_TABLE(spi, ad7923_id);
357static struct spi_driver ad7923_driver = { 357static struct spi_driver ad7923_driver = {
358 .driver = { 358 .driver = {
359 .name = "ad7923", 359 .name = "ad7923",
360 .owner = THIS_MODULE,
361 }, 360 },
362 .probe = ad7923_probe, 361 .probe = ad7923_probe,
363 .remove = ad7923_remove, 362 .remove = ad7923_remove,
diff --git a/drivers/iio/adc/max1027.c b/drivers/iio/adc/max1027.c
index 54a8302aaace..41d495c6035e 100644
--- a/drivers/iio/adc/max1027.c
+++ b/drivers/iio/adc/max1027.c
@@ -509,7 +509,6 @@ static struct spi_driver max1027_driver = {
509 .driver = { 509 .driver = {
510 .name = "max1027", 510 .name = "max1027",
511 .of_match_table = of_match_ptr(max1027_adc_dt_ids), 511 .of_match_table = of_match_ptr(max1027_adc_dt_ids),
512 .owner = THIS_MODULE,
513 }, 512 },
514 .probe = max1027_probe, 513 .probe = max1027_probe,
515 .remove = max1027_remove, 514 .remove = max1027_remove,
diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index 41a21e986c1a..8569c8e1f4b2 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -405,7 +405,6 @@ static struct spi_driver mcp320x_driver = {
405 .driver = { 405 .driver = {
406 .name = "mcp320x", 406 .name = "mcp320x",
407 .of_match_table = of_match_ptr(mcp320x_dt_ids), 407 .of_match_table = of_match_ptr(mcp320x_dt_ids),
408 .owner = THIS_MODULE,
409 }, 408 },
410 .probe = mcp320x_probe, 409 .probe = mcp320x_probe,
411 .remove = mcp320x_remove, 410 .remove = mcp320x_remove,
diff --git a/drivers/iio/adc/ti-adc128s052.c b/drivers/iio/adc/ti-adc128s052.c
index 98c0d2b444bf..ff6f7f63c8d9 100644
--- a/drivers/iio/adc/ti-adc128s052.c
+++ b/drivers/iio/adc/ti-adc128s052.c
@@ -192,7 +192,6 @@ static struct spi_driver adc128_driver = {
192 .driver = { 192 .driver = {
193 .name = "adc128s052", 193 .name = "adc128s052",
194 .of_match_table = of_match_ptr(adc128_of_match), 194 .of_match_table = of_match_ptr(adc128_of_match),
195 .owner = THIS_MODULE,
196 }, 195 },
197 .probe = adc128_probe, 196 .probe = adc128_probe,
198 .remove = adc128_remove, 197 .remove = adc128_remove,
diff --git a/drivers/iio/amplifiers/ad8366.c b/drivers/iio/amplifiers/ad8366.c
index 32b82a2dc894..102c7174da5b 100644
--- a/drivers/iio/amplifiers/ad8366.c
+++ b/drivers/iio/amplifiers/ad8366.c
@@ -200,7 +200,6 @@ MODULE_DEVICE_TABLE(spi, ad8366_id);
200static struct spi_driver ad8366_driver = { 200static struct spi_driver ad8366_driver = {
201 .driver = { 201 .driver = {
202 .name = KBUILD_MODNAME, 202 .name = KBUILD_MODNAME,
203 .owner = THIS_MODULE,
204 }, 203 },
205 .probe = ad8366_probe, 204 .probe = ad8366_probe,
206 .remove = ad8366_remove, 205 .remove = ad8366_remove,
diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c
index d338bb595db3..ea7adb638d99 100644
--- a/drivers/iio/common/ssp_sensors/ssp_dev.c
+++ b/drivers/iio/common/ssp_sensors/ssp_dev.c
@@ -700,7 +700,6 @@ static struct spi_driver ssp_driver = {
700 .remove = ssp_remove, 700 .remove = ssp_remove,
701 .driver = { 701 .driver = {
702 .pm = &ssp_pm_ops, 702 .pm = &ssp_pm_ops,
703 .owner = THIS_MODULE,
704 .of_match_table = of_match_ptr(ssp_of_match), 703 .of_match_table = of_match_ptr(ssp_of_match),
705 .name = "sensorhub" 704 .name = "sensorhub"
706 }, 705 },
diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
index c067e6821496..9e4d2c18b554 100644
--- a/drivers/iio/dac/ad5064.c
+++ b/drivers/iio/dac/ad5064.c
@@ -568,7 +568,6 @@ MODULE_DEVICE_TABLE(spi, ad5064_spi_ids);
568static struct spi_driver ad5064_spi_driver = { 568static struct spi_driver ad5064_spi_driver = {
569 .driver = { 569 .driver = {
570 .name = "ad5064", 570 .name = "ad5064",
571 .owner = THIS_MODULE,
572 }, 571 },
573 .probe = ad5064_spi_probe, 572 .probe = ad5064_spi_probe,
574 .remove = ad5064_spi_remove, 573 .remove = ad5064_spi_remove,
diff --git a/drivers/iio/dac/ad5360.c b/drivers/iio/dac/ad5360.c
index 64634d7f578e..8ba0e9c50176 100644
--- a/drivers/iio/dac/ad5360.c
+++ b/drivers/iio/dac/ad5360.c
@@ -549,7 +549,6 @@ MODULE_DEVICE_TABLE(spi, ad5360_ids);
549static struct spi_driver ad5360_driver = { 549static struct spi_driver ad5360_driver = {
550 .driver = { 550 .driver = {
551 .name = "ad5360", 551 .name = "ad5360",
552 .owner = THIS_MODULE,
553 }, 552 },
554 .probe = ad5360_probe, 553 .probe = ad5360_probe,
555 .remove = ad5360_remove, 554 .remove = ad5360_remove,
diff --git a/drivers/iio/dac/ad5380.c b/drivers/iio/dac/ad5380.c
index 130de9b3e0bf..97d2c5111f43 100644
--- a/drivers/iio/dac/ad5380.c
+++ b/drivers/iio/dac/ad5380.c
@@ -519,7 +519,6 @@ MODULE_DEVICE_TABLE(spi, ad5380_spi_ids);
519static struct spi_driver ad5380_spi_driver = { 519static struct spi_driver ad5380_spi_driver = {
520 .driver = { 520 .driver = {
521 .name = "ad5380", 521 .name = "ad5380",
522 .owner = THIS_MODULE,
523 }, 522 },
524 .probe = ad5380_spi_probe, 523 .probe = ad5380_spi_probe,
525 .remove = ad5380_spi_remove, 524 .remove = ad5380_spi_remove,
diff --git a/drivers/iio/dac/ad5421.c b/drivers/iio/dac/ad5421.c
index 787ef1d859c6..968712be967f 100644
--- a/drivers/iio/dac/ad5421.c
+++ b/drivers/iio/dac/ad5421.c
@@ -524,7 +524,6 @@ static int ad5421_probe(struct spi_device *spi)
524static struct spi_driver ad5421_driver = { 524static struct spi_driver ad5421_driver = {
525 .driver = { 525 .driver = {
526 .name = "ad5421", 526 .name = "ad5421",
527 .owner = THIS_MODULE,
528 }, 527 },
529 .probe = ad5421_probe, 528 .probe = ad5421_probe,
530}; 529};
diff --git a/drivers/iio/dac/ad5446.c b/drivers/iio/dac/ad5446.c
index 07e17d72a3f3..b555552a0d80 100644
--- a/drivers/iio/dac/ad5446.c
+++ b/drivers/iio/dac/ad5446.c
@@ -481,7 +481,6 @@ static int ad5446_spi_remove(struct spi_device *spi)
481static struct spi_driver ad5446_spi_driver = { 481static struct spi_driver ad5446_spi_driver = {
482 .driver = { 482 .driver = {
483 .name = "ad5446", 483 .name = "ad5446",
484 .owner = THIS_MODULE,
485 }, 484 },
486 .probe = ad5446_spi_probe, 485 .probe = ad5446_spi_probe,
487 .remove = ad5446_spi_remove, 486 .remove = ad5446_spi_remove,
diff --git a/drivers/iio/dac/ad5449.c b/drivers/iio/dac/ad5449.c
index 64d7256cbb6d..5f3202339420 100644
--- a/drivers/iio/dac/ad5449.c
+++ b/drivers/iio/dac/ad5449.c
@@ -356,7 +356,6 @@ MODULE_DEVICE_TABLE(spi, ad5449_spi_ids);
356static struct spi_driver ad5449_spi_driver = { 356static struct spi_driver ad5449_spi_driver = {
357 .driver = { 357 .driver = {
358 .name = "ad5449", 358 .name = "ad5449",
359 .owner = THIS_MODULE,
360 }, 359 },
361 .probe = ad5449_spi_probe, 360 .probe = ad5449_spi_probe,
362 .remove = ad5449_spi_remove, 361 .remove = ad5449_spi_remove,
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index e6e9756580af..4e4c20d6d8b5 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -363,7 +363,6 @@ MODULE_DEVICE_TABLE(spi, ad5504_id);
363static struct spi_driver ad5504_driver = { 363static struct spi_driver ad5504_driver = {
364 .driver = { 364 .driver = {
365 .name = "ad5504", 365 .name = "ad5504",
366 .owner = THIS_MODULE,
367 }, 366 },
368 .probe = ad5504_probe, 367 .probe = ad5504_probe,
369 .remove = ad5504_remove, 368 .remove = ad5504_remove,
diff --git a/drivers/iio/dac/ad5624r_spi.c b/drivers/iio/dac/ad5624r_spi.c
index e98428df0d44..5489ec43b95d 100644
--- a/drivers/iio/dac/ad5624r_spi.c
+++ b/drivers/iio/dac/ad5624r_spi.c
@@ -306,7 +306,6 @@ MODULE_DEVICE_TABLE(spi, ad5624r_id);
306static struct spi_driver ad5624r_driver = { 306static struct spi_driver ad5624r_driver = {
307 .driver = { 307 .driver = {
308 .name = "ad5624r", 308 .name = "ad5624r",
309 .owner = THIS_MODULE,
310 }, 309 },
311 .probe = ad5624r_probe, 310 .probe = ad5624r_probe,
312 .remove = ad5624r_remove, 311 .remove = ad5624r_remove,
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 15c73e20272d..d1d8450c19f6 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -395,7 +395,6 @@ MODULE_DEVICE_TABLE(spi, ad5686_id);
395static struct spi_driver ad5686_driver = { 395static struct spi_driver ad5686_driver = {
396 .driver = { 396 .driver = {
397 .name = "ad5686", 397 .name = "ad5686",
398 .owner = THIS_MODULE,
399 }, 398 },
400 .probe = ad5686_probe, 399 .probe = ad5686_probe,
401 .remove = ad5686_remove, 400 .remove = ad5686_remove,
diff --git a/drivers/iio/dac/ad5755.c b/drivers/iio/dac/ad5755.c
index a7c851f62d7c..bfb350a85a16 100644
--- a/drivers/iio/dac/ad5755.c
+++ b/drivers/iio/dac/ad5755.c
@@ -610,7 +610,6 @@ MODULE_DEVICE_TABLE(spi, ad5755_id);
610static struct spi_driver ad5755_driver = { 610static struct spi_driver ad5755_driver = {
611 .driver = { 611 .driver = {
612 .name = "ad5755", 612 .name = "ad5755",
613 .owner = THIS_MODULE,
614 }, 613 },
615 .probe = ad5755_probe, 614 .probe = ad5755_probe,
616 .id_table = ad5755_id, 615 .id_table = ad5755_id,
diff --git a/drivers/iio/dac/ad5764.c b/drivers/iio/dac/ad5764.c
index d0d38165339d..9a547bbf7d2b 100644
--- a/drivers/iio/dac/ad5764.c
+++ b/drivers/iio/dac/ad5764.c
@@ -357,7 +357,6 @@ MODULE_DEVICE_TABLE(spi, ad5764_ids);
357static struct spi_driver ad5764_driver = { 357static struct spi_driver ad5764_driver = {
358 .driver = { 358 .driver = {
359 .name = "ad5764", 359 .name = "ad5764",
360 .owner = THIS_MODULE,
361 }, 360 },
362 .probe = ad5764_probe, 361 .probe = ad5764_probe,
363 .remove = ad5764_remove, 362 .remove = ad5764_remove,
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 5ba785f18589..33e4ae5c42f8 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -461,7 +461,6 @@ MODULE_DEVICE_TABLE(spi, ad5791_id);
461static struct spi_driver ad5791_driver = { 461static struct spi_driver ad5791_driver = {
462 .driver = { 462 .driver = {
463 .name = "ad5791", 463 .name = "ad5791",
464 .owner = THIS_MODULE,
465 }, 464 },
466 .probe = ad5791_probe, 465 .probe = ad5791_probe,
467 .remove = ad5791_remove, 466 .remove = ad5791_remove,
diff --git a/drivers/iio/dac/ad7303.c b/drivers/iio/dac/ad7303.c
index 18a4ad5ff8c5..e690dd11e99f 100644
--- a/drivers/iio/dac/ad7303.c
+++ b/drivers/iio/dac/ad7303.c
@@ -297,7 +297,6 @@ static struct spi_driver ad7303_driver = {
297 .driver = { 297 .driver = {
298 .name = "ad7303", 298 .name = "ad7303",
299 .of_match_table = of_match_ptr(ad7303_spi_of_match), 299 .of_match_table = of_match_ptr(ad7303_spi_of_match),
300 .owner = THIS_MODULE,
301 }, 300 },
302 .probe = ad7303_probe, 301 .probe = ad7303_probe,
303 .remove = ad7303_remove, 302 .remove = ad7303_remove,
diff --git a/drivers/iio/dac/mcp4922.c b/drivers/iio/dac/mcp4922.c
index 92cf4ca6981d..3854d201a5d6 100644
--- a/drivers/iio/dac/mcp4922.c
+++ b/drivers/iio/dac/mcp4922.c
@@ -203,7 +203,6 @@ MODULE_DEVICE_TABLE(spi, mcp4922_id);
203static struct spi_driver mcp4922_driver = { 203static struct spi_driver mcp4922_driver = {
204 .driver = { 204 .driver = {
205 .name = "mcp4922", 205 .name = "mcp4922",
206 .owner = THIS_MODULE,
207 }, 206 },
208 .probe = mcp4922_probe, 207 .probe = mcp4922_probe,
209 .remove = mcp4922_remove, 208 .remove = mcp4922_remove,
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 50ed8d1ca45a..44a30f286de1 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -1027,7 +1027,6 @@ MODULE_DEVICE_TABLE(spi, ad9523_id);
1027static struct spi_driver ad9523_driver = { 1027static struct spi_driver ad9523_driver = {
1028 .driver = { 1028 .driver = {
1029 .name = "ad9523", 1029 .name = "ad9523",
1030 .owner = THIS_MODULE,
1031 }, 1030 },
1032 .probe = ad9523_probe, 1031 .probe = ad9523_probe,
1033 .remove = ad9523_remove, 1032 .remove = ad9523_remove,
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index 73f27e0a08dd..d2d824b446f5 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -634,7 +634,6 @@ static struct spi_driver adf4350_driver = {
634 .driver = { 634 .driver = {
635 .name = "adf4350", 635 .name = "adf4350",
636 .of_match_table = of_match_ptr(adf4350_of_match), 636 .of_match_table = of_match_ptr(adf4350_of_match),
637 .owner = THIS_MODULE,
638 }, 637 },
639 .probe = adf4350_probe, 638 .probe = adf4350_probe,
640 .remove = adf4350_remove, 639 .remove = adf4350_remove,
diff --git a/drivers/iio/gyro/adis16080.c b/drivers/iio/gyro/adis16080.c
index add509837269..ad31a1372a04 100644
--- a/drivers/iio/gyro/adis16080.c
+++ b/drivers/iio/gyro/adis16080.c
@@ -228,7 +228,6 @@ MODULE_DEVICE_TABLE(spi, adis16080_ids);
228static struct spi_driver adis16080_driver = { 228static struct spi_driver adis16080_driver = {
229 .driver = { 229 .driver = {
230 .name = "adis16080", 230 .name = "adis16080",
231 .owner = THIS_MODULE,
232 }, 231 },
233 .probe = adis16080_probe, 232 .probe = adis16080_probe,
234 .remove = adis16080_remove, 233 .remove = adis16080_remove,
diff --git a/drivers/iio/gyro/adis16130.c b/drivers/iio/gyro/adis16130.c
index 8d08c7ed1ea6..e5241f41e65e 100644
--- a/drivers/iio/gyro/adis16130.c
+++ b/drivers/iio/gyro/adis16130.c
@@ -167,7 +167,6 @@ static int adis16130_probe(struct spi_device *spi)
167static struct spi_driver adis16130_driver = { 167static struct spi_driver adis16130_driver = {
168 .driver = { 168 .driver = {
169 .name = "adis16130", 169 .name = "adis16130",
170 .owner = THIS_MODULE,
171 }, 170 },
172 .probe = adis16130_probe, 171 .probe = adis16130_probe,
173}; 172};
diff --git a/drivers/iio/gyro/adis16136.c b/drivers/iio/gyro/adis16136.c
index 26de876b223d..f8d1c2210066 100644
--- a/drivers/iio/gyro/adis16136.c
+++ b/drivers/iio/gyro/adis16136.c
@@ -570,7 +570,6 @@ MODULE_DEVICE_TABLE(spi, adis16136_ids);
570static struct spi_driver adis16136_driver = { 570static struct spi_driver adis16136_driver = {
571 .driver = { 571 .driver = {
572 .name = "adis16136", 572 .name = "adis16136",
573 .owner = THIS_MODULE,
574 }, 573 },
575 .id_table = adis16136_ids, 574 .id_table = adis16136_ids,
576 .probe = adis16136_probe, 575 .probe = adis16136_probe,
diff --git a/drivers/iio/gyro/adis16260.c b/drivers/iio/gyro/adis16260.c
index 00c6ad9bf35f..7da8825f4791 100644
--- a/drivers/iio/gyro/adis16260.c
+++ b/drivers/iio/gyro/adis16260.c
@@ -435,7 +435,6 @@ MODULE_DEVICE_TABLE(spi, adis16260_id);
435static struct spi_driver adis16260_driver = { 435static struct spi_driver adis16260_driver = {
436 .driver = { 436 .driver = {
437 .name = "adis16260", 437 .name = "adis16260",
438 .owner = THIS_MODULE,
439 }, 438 },
440 .probe = adis16260_probe, 439 .probe = adis16260_probe,
441 .remove = adis16260_remove, 440 .remove = adis16260_remove,
diff --git a/drivers/iio/gyro/adxrs450.c b/drivers/iio/gyro/adxrs450.c
index eb0e08ec9e20..a330d4288bb0 100644
--- a/drivers/iio/gyro/adxrs450.c
+++ b/drivers/iio/gyro/adxrs450.c
@@ -456,7 +456,6 @@ MODULE_DEVICE_TABLE(spi, adxrs450_id);
456static struct spi_driver adxrs450_driver = { 456static struct spi_driver adxrs450_driver = {
457 .driver = { 457 .driver = {
458 .name = "adxrs450", 458 .name = "adxrs450",
459 .owner = THIS_MODULE,
460 }, 459 },
461 .probe = adxrs450_probe, 460 .probe = adxrs450_probe,
462 .id_table = adxrs450_id, 461 .id_table = adxrs450_id,
diff --git a/drivers/iio/gyro/st_gyro_spi.c b/drivers/iio/gyro/st_gyro_spi.c
index e59bead6bc3c..d2b7a5fa344c 100644
--- a/drivers/iio/gyro/st_gyro_spi.c
+++ b/drivers/iio/gyro/st_gyro_spi.c
@@ -60,7 +60,6 @@ MODULE_DEVICE_TABLE(spi, st_gyro_id_table);
60 60
61static struct spi_driver st_gyro_driver = { 61static struct spi_driver st_gyro_driver = {
62 .driver = { 62 .driver = {
63 .owner = THIS_MODULE,
64 .name = "st-gyro-spi", 63 .name = "st-gyro-spi",
65 }, 64 },
66 .probe = st_gyro_spi_probe, 65 .probe = st_gyro_spi_probe,
diff --git a/drivers/iio/imu/adis16400_core.c b/drivers/iio/imu/adis16400_core.c
index abc4c50de9e8..0618f831ecd4 100644
--- a/drivers/iio/imu/adis16400_core.c
+++ b/drivers/iio/imu/adis16400_core.c
@@ -986,7 +986,6 @@ MODULE_DEVICE_TABLE(spi, adis16400_id);
986static struct spi_driver adis16400_driver = { 986static struct spi_driver adis16400_driver = {
987 .driver = { 987 .driver = {
988 .name = "adis16400", 988 .name = "adis16400",
989 .owner = THIS_MODULE,
990 }, 989 },
991 .id_table = adis16400_id, 990 .id_table = adis16400_id,
992 .probe = adis16400_probe, 991 .probe = adis16400_probe,
diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index b94bfd3f595b..2485b88ee1b6 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -896,7 +896,6 @@ MODULE_DEVICE_TABLE(spi, adis16480_ids);
896static struct spi_driver adis16480_driver = { 896static struct spi_driver adis16480_driver = {
897 .driver = { 897 .driver = {
898 .name = "adis16480", 898 .name = "adis16480",
899 .owner = THIS_MODULE,
900 }, 899 },
901 .id_table = adis16480_ids, 900 .id_table = adis16480_ids,
902 .probe = adis16480_probe, 901 .probe = adis16480_probe,
diff --git a/drivers/iio/magnetometer/st_magn_spi.c b/drivers/iio/magnetometer/st_magn_spi.c
index 0abca2c6afa6..6325e7dc8e03 100644
--- a/drivers/iio/magnetometer/st_magn_spi.c
+++ b/drivers/iio/magnetometer/st_magn_spi.c
@@ -58,7 +58,6 @@ MODULE_DEVICE_TABLE(spi, st_magn_id_table);
58 58
59static struct spi_driver st_magn_driver = { 59static struct spi_driver st_magn_driver = {
60 .driver = { 60 .driver = {
61 .owner = THIS_MODULE,
62 .name = "st-magn-spi", 61 .name = "st-magn-spi",
63 }, 62 },
64 .probe = st_magn_spi_probe, 63 .probe = st_magn_spi_probe,
diff --git a/drivers/iio/pressure/ms5611_spi.c b/drivers/iio/pressure/ms5611_spi.c
index 08ee6e88c79f..aaa0c4ba91a7 100644
--- a/drivers/iio/pressure/ms5611_spi.c
+++ b/drivers/iio/pressure/ms5611_spi.c
@@ -117,7 +117,6 @@ MODULE_DEVICE_TABLE(spi, ms5611_id);
117static struct spi_driver ms5611_driver = { 117static struct spi_driver ms5611_driver = {
118 .driver = { 118 .driver = {
119 .name = "ms5611", 119 .name = "ms5611",
120 .owner = THIS_MODULE,
121 }, 120 },
122 .id_table = ms5611_id, 121 .id_table = ms5611_id,
123 .probe = ms5611_spi_probe, 122 .probe = ms5611_spi_probe,
diff --git a/drivers/iio/pressure/st_pressure_spi.c b/drivers/iio/pressure/st_pressure_spi.c
index 1ffa6d4d349c..40c0692ff1de 100644
--- a/drivers/iio/pressure/st_pressure_spi.c
+++ b/drivers/iio/pressure/st_pressure_spi.c
@@ -56,7 +56,6 @@ MODULE_DEVICE_TABLE(spi, st_press_id_table);
56 56
57static struct spi_driver st_press_driver = { 57static struct spi_driver st_press_driver = {
58 .driver = { 58 .driver = {
59 .owner = THIS_MODULE,
60 .name = "st-press-spi", 59 .name = "st-press-spi",
61 }, 60 },
62 .probe = st_press_spi_probe, 61 .probe = st_press_spi_probe,
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
index e95035136889..f4d29d5dbd5f 100644
--- a/drivers/iio/proximity/as3935.c
+++ b/drivers/iio/proximity/as3935.c
@@ -450,7 +450,6 @@ static struct spi_driver as3935_driver = {
450 .driver = { 450 .driver = {
451 .name = "as3935", 451 .name = "as3935",
452 .of_match_table = of_match_ptr(as3935_of_match), 452 .of_match_table = of_match_ptr(as3935_of_match),
453 .owner = THIS_MODULE,
454 .pm = AS3935_PM_OPS, 453 .pm = AS3935_PM_OPS,
455 }, 454 },
456 .probe = as3935_probe, 455 .probe = as3935_probe,
diff --git a/drivers/input/misc/ad714x-spi.c b/drivers/input/misc/ad714x-spi.c
index a79e50b58bf5..fea315e76bc8 100644
--- a/drivers/input/misc/ad714x-spi.c
+++ b/drivers/input/misc/ad714x-spi.c
@@ -113,7 +113,6 @@ static int ad714x_spi_remove(struct spi_device *spi)
113static struct spi_driver ad714x_spi_driver = { 113static struct spi_driver ad714x_spi_driver = {
114 .driver = { 114 .driver = {
115 .name = "ad714x_captouch", 115 .name = "ad714x_captouch",
116 .owner = THIS_MODULE,
117 .pm = &ad714x_spi_pm, 116 .pm = &ad714x_spi_pm,
118 }, 117 },
119 .probe = ad714x_spi_probe, 118 .probe = ad714x_spi_probe,
diff --git a/drivers/input/misc/adxl34x-spi.c b/drivers/input/misc/adxl34x-spi.c
index da6e76b58dab..3ec03ad88eed 100644
--- a/drivers/input/misc/adxl34x-spi.c
+++ b/drivers/input/misc/adxl34x-spi.c
@@ -120,7 +120,6 @@ static SIMPLE_DEV_PM_OPS(adxl34x_spi_pm, adxl34x_spi_suspend,
120static struct spi_driver adxl34x_driver = { 120static struct spi_driver adxl34x_driver = {
121 .driver = { 121 .driver = {
122 .name = "adxl34x", 122 .name = "adxl34x",
123 .owner = THIS_MODULE,
124 .pm = &adxl34x_spi_pm, 123 .pm = &adxl34x_spi_pm,
125 }, 124 },
126 .probe = adxl34x_spi_probe, 125 .probe = adxl34x_spi_probe,
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index da4e5bb5e045..9c250ae780d9 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -843,7 +843,6 @@ static SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
843static struct spi_driver ad7877_driver = { 843static struct spi_driver ad7877_driver = {
844 .driver = { 844 .driver = {
845 .name = "ad7877", 845 .name = "ad7877",
846 .owner = THIS_MODULE,
847 .pm = &ad7877_pm, 846 .pm = &ad7877_pm,
848 }, 847 },
849 .probe = ad7877_probe, 848 .probe = ad7877_probe,
diff --git a/drivers/input/touchscreen/ad7879-spi.c b/drivers/input/touchscreen/ad7879-spi.c
index 1a7b1143536e..48033c2689ab 100644
--- a/drivers/input/touchscreen/ad7879-spi.c
+++ b/drivers/input/touchscreen/ad7879-spi.c
@@ -149,7 +149,6 @@ static int ad7879_spi_remove(struct spi_device *spi)
149static struct spi_driver ad7879_spi_driver = { 149static struct spi_driver ad7879_spi_driver = {
150 .driver = { 150 .driver = {
151 .name = "ad7879", 151 .name = "ad7879",
152 .owner = THIS_MODULE,
153 .pm = &ad7879_pm_ops, 152 .pm = &ad7879_pm_ops,
154 }, 153 },
155 .probe = ad7879_spi_probe, 154 .probe = ad7879_spi_probe,
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 04edc8f7122f..e431cf63a85d 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -1500,7 +1500,6 @@ static int ads7846_remove(struct spi_device *spi)
1500static struct spi_driver ads7846_driver = { 1500static struct spi_driver ads7846_driver = {
1501 .driver = { 1501 .driver = {
1502 .name = "ads7846", 1502 .name = "ads7846",
1503 .owner = THIS_MODULE,
1504 .pm = &ads7846_pm, 1503 .pm = &ads7846_pm,
1505 .of_match_table = of_match_ptr(ads7846_dt_ids), 1504 .of_match_table = of_match_ptr(ads7846_dt_ids),
1506 }, 1505 },
diff --git a/drivers/input/touchscreen/cyttsp4_spi.c b/drivers/input/touchscreen/cyttsp4_spi.c
index b19434cebbf6..ec5f7c74f048 100644
--- a/drivers/input/touchscreen/cyttsp4_spi.c
+++ b/drivers/input/touchscreen/cyttsp4_spi.c
@@ -185,7 +185,6 @@ static int cyttsp4_spi_remove(struct spi_device *spi)
185static struct spi_driver cyttsp4_spi_driver = { 185static struct spi_driver cyttsp4_spi_driver = {
186 .driver = { 186 .driver = {
187 .name = CYTTSP4_SPI_NAME, 187 .name = CYTTSP4_SPI_NAME,
188 .owner = THIS_MODULE,
189 .pm = &cyttsp4_pm_ops, 188 .pm = &cyttsp4_pm_ops,
190 }, 189 },
191 .probe = cyttsp4_spi_probe, 190 .probe = cyttsp4_spi_probe,
diff --git a/drivers/input/touchscreen/cyttsp_spi.c b/drivers/input/touchscreen/cyttsp_spi.c
index 4728bcb1916c..bbeeb2488b57 100644
--- a/drivers/input/touchscreen/cyttsp_spi.c
+++ b/drivers/input/touchscreen/cyttsp_spi.c
@@ -182,7 +182,6 @@ static int cyttsp_spi_remove(struct spi_device *spi)
182static struct spi_driver cyttsp_spi_driver = { 182static struct spi_driver cyttsp_spi_driver = {
183 .driver = { 183 .driver = {
184 .name = CY_SPI_NAME, 184 .name = CY_SPI_NAME,
185 .owner = THIS_MODULE,
186 .pm = &cyttsp_pm_ops, 185 .pm = &cyttsp_pm_ops,
187 }, 186 },
188 .probe = cyttsp_spi_probe, 187 .probe = cyttsp_spi_probe,
diff --git a/drivers/input/touchscreen/tsc2005.c b/drivers/input/touchscreen/tsc2005.c
index 0f65d02eeb26..f41f23318484 100644
--- a/drivers/input/touchscreen/tsc2005.c
+++ b/drivers/input/touchscreen/tsc2005.c
@@ -752,7 +752,6 @@ static SIMPLE_DEV_PM_OPS(tsc2005_pm_ops, tsc2005_suspend, tsc2005_resume);
752static struct spi_driver tsc2005_driver = { 752static struct spi_driver tsc2005_driver = {
753 .driver = { 753 .driver = {
754 .name = "tsc2005", 754 .name = "tsc2005",
755 .owner = THIS_MODULE,
756 .pm = &tsc2005_pm_ops, 755 .pm = &tsc2005_pm_ops,
757 }, 756 },
758 .probe = tsc2005_probe, 757 .probe = tsc2005_probe,
diff --git a/drivers/leds/leds-dac124s085.c b/drivers/leds/leds-dac124s085.c
index db3ba8b42517..314159610d24 100644
--- a/drivers/leds/leds-dac124s085.c
+++ b/drivers/leds/leds-dac124s085.c
@@ -122,7 +122,6 @@ static struct spi_driver dac124s085_driver = {
122 .remove = dac124s085_remove, 122 .remove = dac124s085_remove,
123 .driver = { 123 .driver = {
124 .name = "dac124s085", 124 .name = "dac124s085",
125 .owner = THIS_MODULE,
126 }, 125 },
127}; 126};
128 127
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
index 17ac4417fb17..72ef9f936e6c 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-spi.c
@@ -150,7 +150,6 @@ int s5c73m3_register_spi_driver(struct s5c73m3 *state)
150 spidrv->remove = s5c73m3_spi_remove; 150 spidrv->remove = s5c73m3_spi_remove;
151 spidrv->probe = s5c73m3_spi_probe; 151 spidrv->probe = s5c73m3_spi_probe;
152 spidrv->driver.name = S5C73M3_SPI_DRV_NAME; 152 spidrv->driver.name = S5C73M3_SPI_DRV_NAME;
153 spidrv->driver.owner = THIS_MODULE;
154 spidrv->driver.of_match_table = s5c73m3_spi_ids; 153 spidrv->driver.of_match_table = s5c73m3_spi_ids;
155 154
156 return spi_register_driver(spidrv); 155 return spi_register_driver(spidrv);
diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c
index b533240f8ec0..3a12ef35682b 100644
--- a/drivers/media/tuners/msi001.c
+++ b/drivers/media/tuners/msi001.c
@@ -513,7 +513,6 @@ MODULE_DEVICE_TABLE(spi, msi001_id_table);
513static struct spi_driver msi001_driver = { 513static struct spi_driver msi001_driver = {
514 .driver = { 514 .driver = {
515 .name = "msi001", 515 .name = "msi001",
516 .owner = THIS_MODULE,
517 .suppress_bind_attrs = true, 516 .suppress_bind_attrs = true,
518 }, 517 },
519 .probe = msi001_probe, 518 .probe = msi001_probe,
diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c
index 1e845f6d407b..03d62f7b4720 100644
--- a/drivers/mfd/arizona-spi.c
+++ b/drivers/mfd/arizona-spi.c
@@ -93,7 +93,6 @@ MODULE_DEVICE_TABLE(spi, arizona_spi_ids);
93static struct spi_driver arizona_spi_driver = { 93static struct spi_driver arizona_spi_driver = {
94 .driver = { 94 .driver = {
95 .name = "arizona", 95 .name = "arizona",
96 .owner = THIS_MODULE,
97 .pm = &arizona_pm_ops, 96 .pm = &arizona_pm_ops,
98 .of_match_table = of_match_ptr(arizona_of_match), 97 .of_match_table = of_match_ptr(arizona_of_match),
99 }, 98 },
diff --git a/drivers/mfd/cros_ec_spi.c b/drivers/mfd/cros_ec_spi.c
index 30a296b4e748..6a0f6ec67c6b 100644
--- a/drivers/mfd/cros_ec_spi.c
+++ b/drivers/mfd/cros_ec_spi.c
@@ -717,7 +717,6 @@ static struct spi_driver cros_ec_driver_spi = {
717 .driver = { 717 .driver = {
718 .name = "cros-ec-spi", 718 .name = "cros-ec-spi",
719 .of_match_table = of_match_ptr(cros_ec_spi_of_match), 719 .of_match_table = of_match_ptr(cros_ec_spi_of_match),
720 .owner = THIS_MODULE,
721 .pm = &cros_ec_spi_pm_ops, 720 .pm = &cros_ec_spi_pm_ops,
722 }, 721 },
723 .probe = cros_ec_spi_probe, 722 .probe = cros_ec_spi_probe,
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index b5de8a6856c0..71b89dd4e8de 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -86,7 +86,6 @@ static struct spi_driver da9052_spi_driver = {
86 .id_table = da9052_spi_id, 86 .id_table = da9052_spi_id,
87 .driver = { 87 .driver = {
88 .name = "da9052", 88 .name = "da9052",
89 .owner = THIS_MODULE,
90 }, 89 },
91}; 90};
92 91
diff --git a/drivers/mfd/ezx-pcap.c b/drivers/mfd/ezx-pcap.c
index b279205659a4..542b47c6bcd2 100644
--- a/drivers/mfd/ezx-pcap.c
+++ b/drivers/mfd/ezx-pcap.c
@@ -513,7 +513,6 @@ static struct spi_driver ezxpcap_driver = {
513 .remove = ezx_pcap_remove, 513 .remove = ezx_pcap_remove,
514 .driver = { 514 .driver = {
515 .name = "ezx-pcap", 515 .name = "ezx-pcap",
516 .owner = THIS_MODULE,
517 }, 516 },
518}; 517};
519 518
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 58a170e45d88..cbc1e5ed599c 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -177,7 +177,6 @@ static struct spi_driver mc13xxx_spi_driver = {
177 .id_table = mc13xxx_device_id, 177 .id_table = mc13xxx_device_id,
178 .driver = { 178 .driver = {
179 .name = "mc13xxx", 179 .name = "mc13xxx",
180 .owner = THIS_MODULE,
181 .of_match_table = mc13xxx_dt_ids, 180 .of_match_table = mc13xxx_dt_ids,
182 }, 181 },
183 .probe = mc13xxx_spi_probe, 182 .probe = mc13xxx_spi_probe,
diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c
index 618ba244d98a..f8b14ab8b9d7 100644
--- a/drivers/mfd/stmpe-spi.c
+++ b/drivers/mfd/stmpe-spi.c
@@ -135,7 +135,6 @@ static struct spi_driver stmpe_spi_driver = {
135 .driver = { 135 .driver = {
136 .name = "stmpe-spi", 136 .name = "stmpe-spi",
137 .of_match_table = of_match_ptr(stmpe_spi_of_match), 137 .of_match_table = of_match_ptr(stmpe_spi_of_match),
138 .owner = THIS_MODULE,
139#ifdef CONFIG_PM 138#ifdef CONFIG_PM
140 .pm = &stmpe_dev_pm_ops, 139 .pm = &stmpe_dev_pm_ops,
141#endif 140#endif
diff --git a/drivers/mfd/tps65912-spi.c b/drivers/mfd/tps65912-spi.c
index de60ad98bd9f..d59aa55b1495 100644
--- a/drivers/mfd/tps65912-spi.c
+++ b/drivers/mfd/tps65912-spi.c
@@ -111,7 +111,6 @@ static int tps65912_spi_remove(struct spi_device *spi)
111static struct spi_driver tps65912_spi_driver = { 111static struct spi_driver tps65912_spi_driver = {
112 .driver = { 112 .driver = {
113 .name = "tps65912", 113 .name = "tps65912",
114 .owner = THIS_MODULE,
115 }, 114 },
116 .probe = tps65912_spi_probe, 115 .probe = tps65912_spi_probe,
117 .remove = tps65912_spi_remove, 116 .remove = tps65912_spi_remove,
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index b8a5e3b34ec7..80482aeb246a 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -96,7 +96,6 @@ MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
96static struct spi_driver wm831x_spi_driver = { 96static struct spi_driver wm831x_spi_driver = {
97 .driver = { 97 .driver = {
98 .name = "wm831x", 98 .name = "wm831x",
99 .owner = THIS_MODULE,
100 .pm = &wm831x_spi_pm, 99 .pm = &wm831x_spi_pm,
101 }, 100 },
102 .id_table = wm831x_spi_ids, 101 .id_table = wm831x_spi_ids,
diff --git a/drivers/misc/ad525x_dpot-spi.c b/drivers/misc/ad525x_dpot-spi.c
index f4c82eafa8e5..39a7f517ee7e 100644
--- a/drivers/misc/ad525x_dpot-spi.c
+++ b/drivers/misc/ad525x_dpot-spi.c
@@ -132,7 +132,6 @@ MODULE_DEVICE_TABLE(spi, ad_dpot_spi_id);
132static struct spi_driver ad_dpot_spi_driver = { 132static struct spi_driver ad_dpot_spi_driver = {
133 .driver = { 133 .driver = {
134 .name = "ad_dpot", 134 .name = "ad_dpot",
135 .owner = THIS_MODULE,
136 }, 135 },
137 .probe = ad_dpot_spi_probe, 136 .probe = ad_dpot_spi_probe,
138 .remove = ad_dpot_spi_remove, 137 .remove = ad_dpot_spi_remove,
diff --git a/drivers/misc/bmp085-spi.c b/drivers/misc/bmp085-spi.c
index 864ecac32373..17ecbf95ff15 100644
--- a/drivers/misc/bmp085-spi.c
+++ b/drivers/misc/bmp085-spi.c
@@ -64,7 +64,6 @@ MODULE_DEVICE_TABLE(spi, bmp085_id);
64 64
65static struct spi_driver bmp085_spi_driver = { 65static struct spi_driver bmp085_spi_driver = {
66 .driver = { 66 .driver = {
67 .owner = THIS_MODULE,
68 .name = BMP085_NAME, 67 .name = BMP085_NAME,
69 .of_match_table = bmp085_of_match 68 .of_match_table = bmp085_of_match
70 }, 69 },
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 0a1af93ec638..f850ef556bcc 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -462,7 +462,6 @@ MODULE_DEVICE_TABLE(of, at25_of_match);
462static struct spi_driver at25_driver = { 462static struct spi_driver at25_driver = {
463 .driver = { 463 .driver = {
464 .name = "at25", 464 .name = "at25",
465 .owner = THIS_MODULE,
466 .of_match_table = at25_of_match, 465 .of_match_table = at25_of_match,
467 }, 466 },
468 .probe = at25_probe, 467 .probe = at25_probe,
diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c
index a6bd9e3fe9d3..ff63f05edc76 100644
--- a/drivers/misc/eeprom/eeprom_93xx46.c
+++ b/drivers/misc/eeprom/eeprom_93xx46.c
@@ -370,7 +370,6 @@ static int eeprom_93xx46_remove(struct spi_device *spi)
370static struct spi_driver eeprom_93xx46_driver = { 370static struct spi_driver eeprom_93xx46_driver = {
371 .driver = { 371 .driver = {
372 .name = "93xx46", 372 .name = "93xx46",
373 .owner = THIS_MODULE,
374 }, 373 },
375 .probe = eeprom_93xx46_probe, 374 .probe = eeprom_93xx46_probe,
376 .remove = eeprom_93xx46_remove, 375 .remove = eeprom_93xx46_remove,
diff --git a/drivers/misc/lattice-ecp3-config.c b/drivers/misc/lattice-ecp3-config.c
index c544f1f50f52..626fdcaf2510 100644
--- a/drivers/misc/lattice-ecp3-config.c
+++ b/drivers/misc/lattice-ecp3-config.c
@@ -235,7 +235,6 @@ MODULE_DEVICE_TABLE(spi, lattice_ecp3_id);
235static struct spi_driver lattice_ecp3_driver = { 235static struct spi_driver lattice_ecp3_driver = {
236 .driver = { 236 .driver = {
237 .name = "lattice-ecp3", 237 .name = "lattice-ecp3",
238 .owner = THIS_MODULE,
239 }, 238 },
240 .probe = lattice_ecp3_probe, 239 .probe = lattice_ecp3_probe,
241 .remove = lattice_ecp3_remove, 240 .remove = lattice_ecp3_remove,
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
index b2f6e1651ac9..e575475123c8 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c
@@ -138,7 +138,6 @@ static SIMPLE_DEV_PM_OPS(lis3lv02d_spi_pm, lis3lv02d_spi_suspend,
138static struct spi_driver lis302dl_spi_driver = { 138static struct spi_driver lis302dl_spi_driver = {
139 .driver = { 139 .driver = {
140 .name = DRV_NAME, 140 .name = DRV_NAME,
141 .owner = THIS_MODULE,
142 .pm = &lis3lv02d_spi_pm, 141 .pm = &lis3lv02d_spi_pm,
143 .of_match_table = of_match_ptr(lis302dl_spi_dt_ids), 142 .of_match_table = of_match_ptr(lis302dl_spi_dt_ids),
144 }, 143 },
diff --git a/drivers/misc/ti_dac7512.c b/drivers/misc/ti_dac7512.c
index cb0289b44a17..f5456fb7d773 100644
--- a/drivers/misc/ti_dac7512.c
+++ b/drivers/misc/ti_dac7512.c
@@ -89,7 +89,6 @@ MODULE_DEVICE_TABLE(of, dac7512_of_match);
89static struct spi_driver dac7512_driver = { 89static struct spi_driver dac7512_driver = {
90 .driver = { 90 .driver = {
91 .name = "dac7512", 91 .name = "dac7512",
92 .owner = THIS_MODULE,
93 .of_match_table = of_match_ptr(dac7512_of_match), 92 .of_match_table = of_match_ptr(dac7512_of_match),
94 }, 93 },
95 .probe = dac7512_probe, 94 .probe = dac7512_probe,
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c
index 8ee11f4120fc..1c1b45ef3faf 100644
--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1516,7 +1516,6 @@ MODULE_DEVICE_TABLE(of, mmc_spi_of_match_table);
1516static struct spi_driver mmc_spi_driver = { 1516static struct spi_driver mmc_spi_driver = {
1517 .driver = { 1517 .driver = {
1518 .name = "mmc_spi", 1518 .name = "mmc_spi",
1519 .owner = THIS_MODULE,
1520 .of_match_table = mmc_spi_of_match_table, 1519 .of_match_table = mmc_spi_of_match_table,
1521 }, 1520 },
1522 .probe = mmc_spi_probe, 1521 .probe = mmc_spi_probe,
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 9cd3631170ef..fcf171a1325e 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -304,7 +304,6 @@ MODULE_DEVICE_TABLE(of, m25p_of_table);
304static struct spi_driver m25p80_driver = { 304static struct spi_driver m25p80_driver = {
305 .driver = { 305 .driver = {
306 .name = "m25p80", 306 .name = "m25p80",
307 .owner = THIS_MODULE,
308 .of_match_table = m25p_of_table, 307 .of_match_table = m25p_of_table,
309 }, 308 },
310 .id_table = m25p_ids, 309 .id_table = m25p_ids,
diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
index df6f61137376..70c16399e8ba 100644
--- a/drivers/mtd/devices/mtd_dataflash.c
+++ b/drivers/mtd/devices/mtd_dataflash.c
@@ -911,7 +911,6 @@ static int dataflash_remove(struct spi_device *spi)
911static struct spi_driver dataflash_driver = { 911static struct spi_driver dataflash_driver = {
912 .driver = { 912 .driver = {
913 .name = "mtd_dataflash", 913 .name = "mtd_dataflash",
914 .owner = THIS_MODULE,
915 .of_match_table = of_match_ptr(dataflash_dt_ids), 914 .of_match_table = of_match_ptr(dataflash_dt_ids),
916 }, 915 },
917 916
diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c
index c63ecbcad0b7..18febf74404d 100644
--- a/drivers/mtd/devices/sst25l.c
+++ b/drivers/mtd/devices/sst25l.c
@@ -417,7 +417,6 @@ static int sst25l_remove(struct spi_device *spi)
417static struct spi_driver sst25l_driver = { 417static struct spi_driver sst25l_driver = {
418 .driver = { 418 .driver = {
419 .name = "sst25l", 419 .name = "sst25l",
420 .owner = THIS_MODULE,
421 }, 420 },
422 .probe = sst25l_probe, 421 .probe = sst25l_probe,
423 .remove = sst25l_remove, 422 .remove = sst25l_remove,
diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c
index b7e83c212023..575790e8a75a 100644
--- a/drivers/net/can/spi/mcp251x.c
+++ b/drivers/net/can/spi/mcp251x.c
@@ -1243,7 +1243,6 @@ static SIMPLE_DEV_PM_OPS(mcp251x_can_pm_ops, mcp251x_can_suspend,
1243static struct spi_driver mcp251x_can_driver = { 1243static struct spi_driver mcp251x_can_driver = {
1244 .driver = { 1244 .driver = {
1245 .name = DEVICE_NAME, 1245 .name = DEVICE_NAME,
1246 .owner = THIS_MODULE,
1247 .of_match_table = mcp251x_of_match, 1246 .of_match_table = mcp251x_of_match,
1248 .pm = &mcp251x_can_pm_ops, 1247 .pm = &mcp251x_can_pm_ops,
1249 }, 1248 },
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 60f43ec22175..1edc973df4c4 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -1607,7 +1607,6 @@ static struct spi_driver ks8851_driver = {
1607 .driver = { 1607 .driver = {
1608 .name = "ks8851", 1608 .name = "ks8851",
1609 .of_match_table = ks8851_match_table, 1609 .of_match_table = ks8851_match_table,
1610 .owner = THIS_MODULE,
1611 .pm = &ks8851_pm_ops, 1610 .pm = &ks8851_pm_ops,
1612 }, 1611 },
1613 .probe = ks8851_probe, 1612 .probe = ks8851_probe,
diff --git a/drivers/net/ethernet/microchip/enc28j60.c b/drivers/net/ethernet/microchip/enc28j60.c
index b1b5f66b8b69..86ea17e7ba7b 100644
--- a/drivers/net/ethernet/microchip/enc28j60.c
+++ b/drivers/net/ethernet/microchip/enc28j60.c
@@ -1633,7 +1633,6 @@ static int enc28j60_remove(struct spi_device *spi)
1633static struct spi_driver enc28j60_driver = { 1633static struct spi_driver enc28j60_driver = {
1634 .driver = { 1634 .driver = {
1635 .name = DRV_NAME, 1635 .name = DRV_NAME,
1636 .owner = THIS_MODULE,
1637 }, 1636 },
1638 .probe = enc28j60_probe, 1637 .probe = enc28j60_probe,
1639 .remove = enc28j60_remove, 1638 .remove = enc28j60_remove,
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 2f87909f5186..ddb2c6c6ec94 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -974,7 +974,6 @@ MODULE_DEVICE_TABLE(spi, qca_spi_id);
974static struct spi_driver qca_spi_driver = { 974static struct spi_driver qca_spi_driver = {
975 .driver = { 975 .driver = {
976 .name = QCASPI_DRV_NAME, 976 .name = QCASPI_DRV_NAME,
977 .owner = THIS_MODULE,
978 .of_match_table = qca_spi_of_match, 977 .of_match_table = qca_spi_of_match,
979 }, 978 },
980 .id_table = qca_spi_id, 979 .id_table = qca_spi_id,
diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index de6e4fa2d6aa..0fbbba7a0cae 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -1816,7 +1816,6 @@ static struct spi_driver at86rf230_driver = {
1816 .driver = { 1816 .driver = {
1817 .of_match_table = of_match_ptr(at86rf230_of_match), 1817 .of_match_table = of_match_ptr(at86rf230_of_match),
1818 .name = "at86rf230", 1818 .name = "at86rf230",
1819 .owner = THIS_MODULE,
1820 }, 1819 },
1821 .probe = at86rf230_probe, 1820 .probe = at86rf230_probe,
1822 .remove = at86rf230_remove, 1821 .remove = at86rf230_remove,
diff --git a/drivers/net/ieee802154/cc2520.c b/drivers/net/ieee802154/cc2520.c
index c5b54a15fc4c..e65b60591317 100644
--- a/drivers/net/ieee802154/cc2520.c
+++ b/drivers/net/ieee802154/cc2520.c
@@ -1152,7 +1152,6 @@ MODULE_DEVICE_TABLE(of, cc2520_of_ids);
1152static struct spi_driver cc2520_driver = { 1152static struct spi_driver cc2520_driver = {
1153 .driver = { 1153 .driver = {
1154 .name = "cc2520", 1154 .name = "cc2520",
1155 .owner = THIS_MODULE,
1156 .of_match_table = of_match_ptr(cc2520_of_ids), 1155 .of_match_table = of_match_ptr(cc2520_of_ids),
1157 }, 1156 },
1158 .id_table = cc2520_ids, 1157 .id_table = cc2520_ids,
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index aca0fb3cccbf..4cdf51638972 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -1382,7 +1382,6 @@ static struct spi_driver mrf24j40_driver = {
1382 .driver = { 1382 .driver = {
1383 .of_match_table = of_match_ptr(mrf24j40_of_match), 1383 .of_match_table = of_match_ptr(mrf24j40_of_match),
1384 .name = "mrf24j40", 1384 .name = "mrf24j40",
1385 .owner = THIS_MODULE,
1386 }, 1385 },
1387 .id_table = mrf24j40_ids, 1386 .id_table = mrf24j40_ids,
1388 .probe = mrf24j40_probe, 1387 .probe = mrf24j40_probe,
diff --git a/drivers/net/phy/spi_ks8995.c b/drivers/net/phy/spi_ks8995.c
index f091d691cf6f..c72c42206850 100644
--- a/drivers/net/phy/spi_ks8995.c
+++ b/drivers/net/phy/spi_ks8995.c
@@ -343,7 +343,6 @@ static int ks8995_remove(struct spi_device *spi)
343static struct spi_driver ks8995_driver = { 343static struct spi_driver ks8995_driver = {
344 .driver = { 344 .driver = {
345 .name = "spi-ks8995", 345 .name = "spi-ks8995",
346 .owner = THIS_MODULE,
347 }, 346 },
348 .probe = ks8995_probe, 347 .probe = ks8995_probe,
349 .remove = ks8995_remove, 348 .remove = ks8995_remove,
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c
index 29185aeccba8..a740083634d8 100644
--- a/drivers/net/wireless/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/cw1200/cw1200_spi.c
@@ -467,7 +467,6 @@ static struct spi_driver spi_driver = {
467 .remove = cw1200_spi_disconnect, 467 .remove = cw1200_spi_disconnect,
468 .driver = { 468 .driver = {
469 .name = "cw1200_wlan_spi", 469 .name = "cw1200_wlan_spi",
470 .owner = THIS_MODULE,
471#ifdef CONFIG_PM 470#ifdef CONFIG_PM
472 .pm = &cw1200_pm_ops, 471 .pm = &cw1200_pm_ops,
473#endif 472#endif
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
index f11728a866ff..82c0796377aa 100644
--- a/drivers/net/wireless/libertas/if_spi.c
+++ b/drivers/net/wireless/libertas/if_spi.c
@@ -1283,7 +1283,6 @@ static struct spi_driver libertas_spi_driver = {
1283 .remove = libertas_spi_remove, 1283 .remove = libertas_spi_remove,
1284 .driver = { 1284 .driver = {
1285 .name = "libertas_spi", 1285 .name = "libertas_spi",
1286 .owner = THIS_MODULE,
1287 .pm = &if_spi_pm_ops, 1286 .pm = &if_spi_pm_ops,
1288 }, 1287 },
1289}; 1288};
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
index 63de5eed25cf..7ab2f43ab425 100644
--- a/drivers/net/wireless/p54/p54spi.c
+++ b/drivers/net/wireless/p54/p54spi.c
@@ -705,7 +705,6 @@ static int p54spi_remove(struct spi_device *spi)
705static struct spi_driver p54spi_driver = { 705static struct spi_driver p54spi_driver = {
706 .driver = { 706 .driver = {
707 .name = "p54spi", 707 .name = "p54spi",
708 .owner = THIS_MODULE,
709 }, 708 },
710 709
711 .probe = p54spi_probe, 710 .probe = p54spi_probe,
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index 735be5352143..8de9d4444a6a 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -354,7 +354,6 @@ static int wl1251_spi_remove(struct spi_device *spi)
354static struct spi_driver wl1251_spi_driver = { 354static struct spi_driver wl1251_spi_driver = {
355 .driver = { 355 .driver = {
356 .name = DRIVER_NAME, 356 .name = DRIVER_NAME,
357 .owner = THIS_MODULE,
358 }, 357 },
359 358
360 .probe = wl1251_spi_probe, 359 .probe = wl1251_spi_probe,
diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index f1ac2839d97c..236b41090827 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -408,7 +408,6 @@ static int wl1271_remove(struct spi_device *spi)
408static struct spi_driver wl1271_spi_driver = { 408static struct spi_driver wl1271_spi_driver = {
409 .driver = { 409 .driver = {
410 .name = "wl1271_spi", 410 .name = "wl1271_spi",
411 .owner = THIS_MODULE,
412 }, 411 },
413 412
414 .probe = wl1271_probe, 413 .probe = wl1271_probe,
diff --git a/drivers/nfc/st-nci/spi.c b/drivers/nfc/st-nci/spi.c
index cf7ad8121e11..d6519bb9dba5 100644
--- a/drivers/nfc/st-nci/spi.c
+++ b/drivers/nfc/st-nci/spi.c
@@ -384,7 +384,6 @@ MODULE_DEVICE_TABLE(of, of_st_nci_spi_match);
384 384
385static struct spi_driver st_nci_spi_driver = { 385static struct spi_driver st_nci_spi_driver = {
386 .driver = { 386 .driver = {
387 .owner = THIS_MODULE,
388 .name = ST_NCI_SPI_DRIVER_NAME, 387 .name = ST_NCI_SPI_DRIVER_NAME,
389 .of_match_table = of_match_ptr(of_st_nci_spi_match), 388 .of_match_table = of_match_ptr(of_st_nci_spi_match),
390 }, 389 },
diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 123aa981c9d8..f857feb2b573 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -2230,7 +2230,6 @@ static struct spi_driver trf7970a_spi_driver = {
2230 .driver = { 2230 .driver = {
2231 .name = "trf7970a", 2231 .name = "trf7970a",
2232 .of_match_table = of_match_ptr(trf7970a_of_match), 2232 .of_match_table = of_match_ptr(trf7970a_of_match),
2233 .owner = THIS_MODULE,
2234 .pm = &trf7970a_pm_ops, 2233 .pm = &trf7970a_pm_ops,
2235 }, 2234 },
2236}; 2235};
diff --git a/drivers/regulator/tps6524x-regulator.c b/drivers/regulator/tps6524x-regulator.c
index 5b494db9f95c..9d6ea3a4dccd 100644
--- a/drivers/regulator/tps6524x-regulator.c
+++ b/drivers/regulator/tps6524x-regulator.c
@@ -629,7 +629,6 @@ static struct spi_driver pmic_driver = {
629 .probe = pmic_probe, 629 .probe = pmic_probe,
630 .driver = { 630 .driver = {
631 .name = "tps6524x", 631 .name = "tps6524x",
632 .owner = THIS_MODULE,
633 }, 632 },
634}; 633};
635 634
diff --git a/drivers/rtc/rtc-ds1305.c b/drivers/rtc/rtc-ds1305.c
index baa5d047f9c8..85706a9f82c9 100644
--- a/drivers/rtc/rtc-ds1305.c
+++ b/drivers/rtc/rtc-ds1305.c
@@ -772,7 +772,6 @@ static int ds1305_remove(struct spi_device *spi)
772 772
773static struct spi_driver ds1305_driver = { 773static struct spi_driver ds1305_driver = {
774 .driver.name = "rtc-ds1305", 774 .driver.name = "rtc-ds1305",
775 .driver.owner = THIS_MODULE,
776 .probe = ds1305_probe, 775 .probe = ds1305_probe,
777 .remove = ds1305_remove, 776 .remove = ds1305_remove,
778 /* REVISIT add suspend/resume */ 777 /* REVISIT add suspend/resume */
diff --git a/drivers/rtc/rtc-ds1343.c b/drivers/rtc/rtc-ds1343.c
index 79a06dd3c185..07371a9e3793 100644
--- a/drivers/rtc/rtc-ds1343.c
+++ b/drivers/rtc/rtc-ds1343.c
@@ -731,7 +731,6 @@ static SIMPLE_DEV_PM_OPS(ds1343_pm, ds1343_suspend, ds1343_resume);
731static struct spi_driver ds1343_driver = { 731static struct spi_driver ds1343_driver = {
732 .driver = { 732 .driver = {
733 .name = "ds1343", 733 .name = "ds1343",
734 .owner = THIS_MODULE,
735 .pm = &ds1343_pm, 734 .pm = &ds1343_pm,
736 }, 735 },
737 .probe = ds1343_probe, 736 .probe = ds1343_probe,
diff --git a/drivers/rtc/rtc-ds1347.c b/drivers/rtc/rtc-ds1347.c
index c82b4c050326..641e8e8a0dd7 100644
--- a/drivers/rtc/rtc-ds1347.c
+++ b/drivers/rtc/rtc-ds1347.c
@@ -154,7 +154,6 @@ static int ds1347_probe(struct spi_device *spi)
154static struct spi_driver ds1347_driver = { 154static struct spi_driver ds1347_driver = {
155 .driver = { 155 .driver = {
156 .name = "ds1347", 156 .name = "ds1347",
157 .owner = THIS_MODULE,
158 }, 157 },
159 .probe = ds1347_probe, 158 .probe = ds1347_probe,
160}; 159};
diff --git a/drivers/rtc/rtc-ds1390.c b/drivers/rtc/rtc-ds1390.c
index e67bfcb3a1aa..4c229c97ef97 100644
--- a/drivers/rtc/rtc-ds1390.c
+++ b/drivers/rtc/rtc-ds1390.c
@@ -156,7 +156,6 @@ static int ds1390_probe(struct spi_device *spi)
156static struct spi_driver ds1390_driver = { 156static struct spi_driver ds1390_driver = {
157 .driver = { 157 .driver = {
158 .name = "rtc-ds1390", 158 .name = "rtc-ds1390",
159 .owner = THIS_MODULE,
160 }, 159 },
161 .probe = ds1390_probe, 160 .probe = ds1390_probe,
162}; 161};
diff --git a/drivers/rtc/rtc-ds3234.c b/drivers/rtc/rtc-ds3234.c
index 4c9ba5368464..570ab28fc354 100644
--- a/drivers/rtc/rtc-ds3234.c
+++ b/drivers/rtc/rtc-ds3234.c
@@ -159,7 +159,6 @@ static int ds3234_probe(struct spi_device *spi)
159static struct spi_driver ds3234_driver = { 159static struct spi_driver ds3234_driver = {
160 .driver = { 160 .driver = {
161 .name = "ds3234", 161 .name = "ds3234",
162 .owner = THIS_MODULE,
163 }, 162 },
164 .probe = ds3234_probe, 163 .probe = ds3234_probe,
165}; 164};
diff --git a/drivers/rtc/rtc-m41t93.c b/drivers/rtc/rtc-m41t93.c
index 4698c7e344e4..5ac45fc1a787 100644
--- a/drivers/rtc/rtc-m41t93.c
+++ b/drivers/rtc/rtc-m41t93.c
@@ -197,7 +197,6 @@ static int m41t93_probe(struct spi_device *spi)
197static struct spi_driver m41t93_driver = { 197static struct spi_driver m41t93_driver = {
198 .driver = { 198 .driver = {
199 .name = "rtc-m41t93", 199 .name = "rtc-m41t93",
200 .owner = THIS_MODULE,
201 }, 200 },
202 .probe = m41t93_probe, 201 .probe = m41t93_probe,
203}; 202};
diff --git a/drivers/rtc/rtc-m41t94.c b/drivers/rtc/rtc-m41t94.c
index 8d800b1bf87b..1f0eb79e69f9 100644
--- a/drivers/rtc/rtc-m41t94.c
+++ b/drivers/rtc/rtc-m41t94.c
@@ -137,7 +137,6 @@ static int m41t94_probe(struct spi_device *spi)
137static struct spi_driver m41t94_driver = { 137static struct spi_driver m41t94_driver = {
138 .driver = { 138 .driver = {
139 .name = "rtc-m41t94", 139 .name = "rtc-m41t94",
140 .owner = THIS_MODULE,
141 }, 140 },
142 .probe = m41t94_probe, 141 .probe = m41t94_probe,
143}; 142};
diff --git a/drivers/rtc/rtc-max6902.c b/drivers/rtc/rtc-max6902.c
index ac3f4191864f..315d09e0f2c1 100644
--- a/drivers/rtc/rtc-max6902.c
+++ b/drivers/rtc/rtc-max6902.c
@@ -146,7 +146,6 @@ static int max6902_probe(struct spi_device *spi)
146static struct spi_driver max6902_driver = { 146static struct spi_driver max6902_driver = {
147 .driver = { 147 .driver = {
148 .name = "rtc-max6902", 148 .name = "rtc-max6902",
149 .owner = THIS_MODULE,
150 }, 149 },
151 .probe = max6902_probe, 150 .probe = max6902_probe,
152}; 151};
diff --git a/drivers/rtc/rtc-mcp795.c b/drivers/rtc/rtc-mcp795.c
index 34295bf00416..1c91ce8a6d75 100644
--- a/drivers/rtc/rtc-mcp795.c
+++ b/drivers/rtc/rtc-mcp795.c
@@ -186,7 +186,6 @@ static int mcp795_probe(struct spi_device *spi)
186static struct spi_driver mcp795_driver = { 186static struct spi_driver mcp795_driver = {
187 .driver = { 187 .driver = {
188 .name = "rtc-mcp795", 188 .name = "rtc-mcp795",
189 .owner = THIS_MODULE,
190 }, 189 },
191 .probe = mcp795_probe, 190 .probe = mcp795_probe,
192}; 191};
diff --git a/drivers/rtc/rtc-pcf2123.c b/drivers/rtc/rtc-pcf2123.c
index 1c47650fe624..ea8a31c91641 100644
--- a/drivers/rtc/rtc-pcf2123.c
+++ b/drivers/rtc/rtc-pcf2123.c
@@ -346,7 +346,6 @@ MODULE_DEVICE_TABLE(of, pcf2123_dt_ids);
346static struct spi_driver pcf2123_driver = { 346static struct spi_driver pcf2123_driver = {
347 .driver = { 347 .driver = {
348 .name = "rtc-pcf2123", 348 .name = "rtc-pcf2123",
349 .owner = THIS_MODULE,
350 .of_match_table = of_match_ptr(pcf2123_dt_ids), 349 .of_match_table = of_match_ptr(pcf2123_dt_ids),
351 }, 350 },
352 .probe = pcf2123_probe, 351 .probe = pcf2123_probe,
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index feeedbd82000..83d2bcca6a8f 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -172,7 +172,6 @@ static int r9701_remove(struct spi_device *spi)
172static struct spi_driver r9701_driver = { 172static struct spi_driver r9701_driver = {
173 .driver = { 173 .driver = {
174 .name = "rtc-r9701", 174 .name = "rtc-r9701",
175 .owner = THIS_MODULE,
176 }, 175 },
177 .probe = r9701_probe, 176 .probe = r9701_probe,
178 .remove = r9701_remove, 177 .remove = r9701_remove,
diff --git a/drivers/rtc/rtc-rs5c348.c b/drivers/rtc/rtc-rs5c348.c
index 090a101c1c81..1162fecab8cf 100644
--- a/drivers/rtc/rtc-rs5c348.c
+++ b/drivers/rtc/rtc-rs5c348.c
@@ -221,7 +221,6 @@ static int rs5c348_probe(struct spi_device *spi)
221static struct spi_driver rs5c348_driver = { 221static struct spi_driver rs5c348_driver = {
222 .driver = { 222 .driver = {
223 .name = "rtc-rs5c348", 223 .name = "rtc-rs5c348",
224 .owner = THIS_MODULE,
225 }, 224 },
226 .probe = rs5c348_probe, 225 .probe = rs5c348_probe,
227}; 226};
diff --git a/drivers/rtc/rtc-rx4581.c b/drivers/rtc/rtc-rx4581.c
index 6889222f9ed6..de3fe4f8d133 100644
--- a/drivers/rtc/rtc-rx4581.c
+++ b/drivers/rtc/rtc-rx4581.c
@@ -291,7 +291,6 @@ MODULE_DEVICE_TABLE(spi, rx4581_id);
291static struct spi_driver rx4581_driver = { 291static struct spi_driver rx4581_driver = {
292 .driver = { 292 .driver = {
293 .name = "rtc-rx4581", 293 .name = "rtc-rx4581",
294 .owner = THIS_MODULE,
295 }, 294 },
296 .probe = rx4581_probe, 295 .probe = rx4581_probe,
297 .id_table = rx4581_id, 296 .id_table = rx4581_id,
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
index 4887f317ea58..8b9c2a38d1cc 100644
--- a/drivers/spi/Kconfig
+++ b/drivers/spi/Kconfig
@@ -88,6 +88,17 @@ config SPI_BCM2835
88 is for the regular SPI controller. Slave mode operation is not also 88 is for the regular SPI controller. Slave mode operation is not also
89 not supported. 89 not supported.
90 90
91config SPI_BCM2835AUX
92 tristate "BCM2835 SPI auxiliary controller"
93 depends on ARCH_BCM2835 || COMPILE_TEST
94 depends on GPIOLIB
95 help
96 This selects a driver for the Broadcom BCM2835 SPI aux master.
97
98 The BCM2835 contains two types of SPI master controller; the
99 "universal SPI master", and the regular SPI controller.
100 This driver is for the universal/auxiliary SPI controller.
101
91config SPI_BFIN5XX 102config SPI_BFIN5XX
92 tristate "SPI controller driver for ADI Blackfin5xx" 103 tristate "SPI controller driver for ADI Blackfin5xx"
93 depends on BLACKFIN && !BF60x 104 depends on BLACKFIN && !BF60x
@@ -125,7 +136,7 @@ config SPI_BCM53XX
125 136
126config SPI_BCM63XX 137config SPI_BCM63XX
127 tristate "Broadcom BCM63xx SPI controller" 138 tristate "Broadcom BCM63xx SPI controller"
128 depends on BCM63XX 139 depends on BCM63XX || COMPILE_TEST
129 help 140 help
130 Enable support for the SPI controller on the Broadcom BCM63xx SoCs. 141 Enable support for the SPI controller on the Broadcom BCM63xx SoCs.
131 142
@@ -304,7 +315,7 @@ config SPI_FSL_SPI
304config SPI_FSL_DSPI 315config SPI_FSL_DSPI
305 tristate "Freescale DSPI controller" 316 tristate "Freescale DSPI controller"
306 select REGMAP_MMIO 317 select REGMAP_MMIO
307 depends on SOC_VF610 || SOC_LS1021A || COMPILE_TEST 318 depends on SOC_VF610 || SOC_LS1021A || ARCH_LAYERSCAPE || COMPILE_TEST
308 help 319 help
309 This enables support for the Freescale DSPI controller in master 320 This enables support for the Freescale DSPI controller in master
310 mode. VF610 platform uses the controller. 321 mode. VF610 platform uses the controller.
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 6a7f6f9d0d1c..31fb7fb2a0b6 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SPI_ATMEL) += spi-atmel.o
15obj-$(CONFIG_SPI_ATH79) += spi-ath79.o 15obj-$(CONFIG_SPI_ATH79) += spi-ath79.o
16obj-$(CONFIG_SPI_AU1550) += spi-au1550.o 16obj-$(CONFIG_SPI_AU1550) += spi-au1550.o
17obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o 17obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o
18obj-$(CONFIG_SPI_BCM2835AUX) += spi-bcm2835aux.o
18obj-$(CONFIG_SPI_BCM53XX) += spi-bcm53xx.o 19obj-$(CONFIG_SPI_BCM53XX) += spi-bcm53xx.o
19obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o 20obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o
20obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o 21obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o
diff --git a/drivers/spi/spi-ath79.c b/drivers/spi/spi-ath79.c
index bf1f9b32c597..6165bf21d427 100644
--- a/drivers/spi/spi-ath79.c
+++ b/drivers/spi/spi-ath79.c
@@ -240,14 +240,9 @@ static int ath79_spi_probe(struct platform_device *pdev)
240 sp->bitbang.flags = SPI_CS_HIGH; 240 sp->bitbang.flags = SPI_CS_HIGH;
241 241
242 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 242 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
243 if (r == NULL) { 243 sp->base = devm_ioremap_resource(&pdev->dev, r);
244 ret = -ENOENT; 244 if (IS_ERR(sp->base)) {
245 goto err_put_master; 245 ret = PTR_ERR(sp->base);
246 }
247
248 sp->base = devm_ioremap(&pdev->dev, r->start, resource_size(r));
249 if (!sp->base) {
250 ret = -ENXIO;
251 goto err_put_master; 246 goto err_put_master;
252 } 247 }
253 248
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 63318e2afba1..aebad36391c9 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -773,7 +773,8 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master,
773 773
774 *plen = len; 774 *plen = len;
775 775
776 if (atmel_spi_dma_slave_config(as, &slave_config, 8)) 776 if (atmel_spi_dma_slave_config(as, &slave_config,
777 xfer->bits_per_word))
777 goto err_exit; 778 goto err_exit;
778 779
779 /* Send both scatterlists */ 780 /* Send both scatterlists */
@@ -871,14 +872,7 @@ static int atmel_spi_set_xfer_speed(struct atmel_spi *as,
871 * Calculate the lowest divider that satisfies the 872 * Calculate the lowest divider that satisfies the
872 * constraint, assuming div32/fdiv/mbz == 0. 873 * constraint, assuming div32/fdiv/mbz == 0.
873 */ 874 */
874 if (xfer->speed_hz) 875 scbr = DIV_ROUND_UP(bus_hz, xfer->speed_hz);
875 scbr = DIV_ROUND_UP(bus_hz, xfer->speed_hz);
876 else
877 /*
878 * This can happend if max_speed is null.
879 * In this case, we set the lowest possible speed
880 */
881 scbr = 0xff;
882 876
883 /* 877 /*
884 * If the resulting divider doesn't fit into the 878 * If the resulting divider doesn't fit into the
@@ -1300,14 +1294,12 @@ static int atmel_spi_one_transfer(struct spi_master *master,
1300 return -EINVAL; 1294 return -EINVAL;
1301 } 1295 }
1302 1296
1303 if (xfer->bits_per_word) { 1297 asd = spi->controller_state;
1304 asd = spi->controller_state; 1298 bits = (asd->csr >> 4) & 0xf;
1305 bits = (asd->csr >> 4) & 0xf; 1299 if (bits != xfer->bits_per_word - 8) {
1306 if (bits != xfer->bits_per_word - 8) { 1300 dev_dbg(&spi->dev,
1307 dev_dbg(&spi->dev,
1308 "you can't yet change bits_per_word in transfers\n"); 1301 "you can't yet change bits_per_word in transfers\n");
1309 return -ENOPROTOOPT; 1302 return -ENOPROTOOPT;
1310 }
1311 } 1303 }
1312 1304
1313 /* 1305 /*
diff --git a/drivers/spi/spi-au1550.c b/drivers/spi/spi-au1550.c
index f45e085c01a6..afd239d6dec1 100644
--- a/drivers/spi/spi-au1550.c
+++ b/drivers/spi/spi-au1550.c
@@ -233,13 +233,12 @@ static int au1550_spi_setupxfer(struct spi_device *spi, struct spi_transfer *t)
233 unsigned bpw, hz; 233 unsigned bpw, hz;
234 u32 cfg, stat; 234 u32 cfg, stat;
235 235
236 bpw = spi->bits_per_word;
237 hz = spi->max_speed_hz;
238 if (t) { 236 if (t) {
239 if (t->bits_per_word) 237 bpw = t->bits_per_word;
240 bpw = t->bits_per_word; 238 hz = t->speed_hz;
241 if (t->speed_hz) 239 } else {
242 hz = t->speed_hz; 240 bpw = spi->bits_per_word;
241 hz = spi->max_speed_hz;
243 } 242 }
244 243
245 if (!hz) 244 if (!hz)
diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c
index 3e8eeb23d4e9..cf04960cc3e6 100644
--- a/drivers/spi/spi-bcm2835.c
+++ b/drivers/spi/spi-bcm2835.c
@@ -777,7 +777,7 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
777 goto out_master_put; 777 goto out_master_put;
778 } 778 }
779 779
780 bs->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); 780 bs->irq = platform_get_irq(pdev, 0);
781 if (bs->irq <= 0) { 781 if (bs->irq <= 0) {
782 dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq); 782 dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
783 err = bs->irq ? bs->irq : -ENODEV; 783 err = bs->irq ? bs->irq : -ENODEV;
@@ -786,6 +786,12 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
786 786
787 clk_prepare_enable(bs->clk); 787 clk_prepare_enable(bs->clk);
788 788
789 bcm2835_dma_init(master, &pdev->dev);
790
791 /* initialise the hardware with the default polarities */
792 bcm2835_wr(bs, BCM2835_SPI_CS,
793 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
794
789 err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0, 795 err = devm_request_irq(&pdev->dev, bs->irq, bcm2835_spi_interrupt, 0,
790 dev_name(&pdev->dev), master); 796 dev_name(&pdev->dev), master);
791 if (err) { 797 if (err) {
@@ -793,12 +799,6 @@ static int bcm2835_spi_probe(struct platform_device *pdev)
793 goto out_clk_disable; 799 goto out_clk_disable;
794 } 800 }
795 801
796 bcm2835_dma_init(master, &pdev->dev);
797
798 /* initialise the hardware with the default polarities */
799 bcm2835_wr(bs, BCM2835_SPI_CS,
800 BCM2835_SPI_CS_CLEAR_RX | BCM2835_SPI_CS_CLEAR_TX);
801
802 err = devm_spi_register_master(&pdev->dev, master); 802 err = devm_spi_register_master(&pdev->dev, master);
803 if (err) { 803 if (err) {
804 dev_err(&pdev->dev, "could not register SPI master: %d\n", err); 804 dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
diff --git a/drivers/spi/spi-bcm2835aux.c b/drivers/spi/spi-bcm2835aux.c
new file mode 100644
index 000000000000..7de6f8472a81
--- /dev/null
+++ b/drivers/spi/spi-bcm2835aux.c
@@ -0,0 +1,512 @@
1/*
2 * Driver for Broadcom BCM2835 auxiliary SPI Controllers
3 *
4 * the driver does not rely on the native chipselects at all
5 * but only uses the gpio type chipselects
6 *
7 * Based on: spi-bcm2835.c
8 *
9 * Copyright (C) 2015 Martin Sperl
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 */
21
22#include <linux/clk.h>
23#include <linux/completion.h>
24#include <linux/delay.h>
25#include <linux/err.h>
26#include <linux/interrupt.h>
27#include <linux/io.h>
28#include <linux/kernel.h>
29#include <linux/module.h>
30#include <linux/of.h>
31#include <linux/of_address.h>
32#include <linux/of_device.h>
33#include <linux/of_gpio.h>
34#include <linux/of_irq.h>
35#include <linux/regmap.h>
36#include <linux/spi/spi.h>
37#include <linux/spinlock.h>
38
39/*
40 * spi register defines
41 *
42 * note there is garbage in the "official" documentation,
43 * so some data is taken from the file:
44 * brcm_usrlib/dag/vmcsx/vcinclude/bcm2708_chip/aux_io.h
45 * inside of:
46 * http://www.broadcom.com/docs/support/videocore/Brcm_Android_ICS_Graphics_Stack.tar.gz
47 */
48
49/* SPI register offsets */
50#define BCM2835_AUX_SPI_CNTL0 0x00
51#define BCM2835_AUX_SPI_CNTL1 0x04
52#define BCM2835_AUX_SPI_STAT 0x08
53#define BCM2835_AUX_SPI_PEEK 0x0C
54#define BCM2835_AUX_SPI_IO 0x20
55#define BCM2835_AUX_SPI_TXHOLD 0x30
56
57/* Bitfields in CNTL0 */
58#define BCM2835_AUX_SPI_CNTL0_SPEED 0xFFF00000
59#define BCM2835_AUX_SPI_CNTL0_SPEED_MAX 0xFFF
60#define BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT 20
61#define BCM2835_AUX_SPI_CNTL0_CS 0x000E0000
62#define BCM2835_AUX_SPI_CNTL0_POSTINPUT 0x00010000
63#define BCM2835_AUX_SPI_CNTL0_VAR_CS 0x00008000
64#define BCM2835_AUX_SPI_CNTL0_VAR_WIDTH 0x00004000
65#define BCM2835_AUX_SPI_CNTL0_DOUTHOLD 0x00003000
66#define BCM2835_AUX_SPI_CNTL0_ENABLE 0x00000800
67#define BCM2835_AUX_SPI_CNTL0_CPHA_IN 0x00000400
68#define BCM2835_AUX_SPI_CNTL0_CLEARFIFO 0x00000200
69#define BCM2835_AUX_SPI_CNTL0_CPHA_OUT 0x00000100
70#define BCM2835_AUX_SPI_CNTL0_CPOL 0x00000080
71#define BCM2835_AUX_SPI_CNTL0_MSBF_OUT 0x00000040
72#define BCM2835_AUX_SPI_CNTL0_SHIFTLEN 0x0000003F
73
74/* Bitfields in CNTL1 */
75#define BCM2835_AUX_SPI_CNTL1_CSHIGH 0x00000700
76#define BCM2835_AUX_SPI_CNTL1_IDLE 0x00000080
77#define BCM2835_AUX_SPI_CNTL1_TXEMPTY 0x00000040
78#define BCM2835_AUX_SPI_CNTL1_MSBF_IN 0x00000002
79#define BCM2835_AUX_SPI_CNTL1_KEEP_IN 0x00000001
80
81/* Bitfields in STAT */
82#define BCM2835_AUX_SPI_STAT_TX_LVL 0xFF000000
83#define BCM2835_AUX_SPI_STAT_RX_LVL 0x00FF0000
84#define BCM2835_AUX_SPI_STAT_TX_FULL 0x00000400
85#define BCM2835_AUX_SPI_STAT_TX_EMPTY 0x00000200
86#define BCM2835_AUX_SPI_STAT_RX_FULL 0x00000100
87#define BCM2835_AUX_SPI_STAT_RX_EMPTY 0x00000080
88#define BCM2835_AUX_SPI_STAT_BUSY 0x00000040
89#define BCM2835_AUX_SPI_STAT_BITCOUNT 0x0000003F
90
91/* timeout values */
92#define BCM2835_AUX_SPI_POLLING_LIMIT_US 30
93#define BCM2835_AUX_SPI_POLLING_JIFFIES 2
94
95#define BCM2835_AUX_SPI_MODE_BITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
96 | SPI_NO_CS)
97
98struct bcm2835aux_spi {
99 void __iomem *regs;
100 struct clk *clk;
101 int irq;
102 u32 cntl[2];
103 const u8 *tx_buf;
104 u8 *rx_buf;
105 int tx_len;
106 int rx_len;
107 int pending;
108};
109
110static inline u32 bcm2835aux_rd(struct bcm2835aux_spi *bs, unsigned reg)
111{
112 return readl(bs->regs + reg);
113}
114
115static inline void bcm2835aux_wr(struct bcm2835aux_spi *bs, unsigned reg,
116 u32 val)
117{
118 writel(val, bs->regs + reg);
119}
120
121static inline void bcm2835aux_rd_fifo(struct bcm2835aux_spi *bs)
122{
123 u32 data;
124 int count = min(bs->rx_len, 3);
125
126 data = bcm2835aux_rd(bs, BCM2835_AUX_SPI_IO);
127 if (bs->rx_buf) {
128 switch (count) {
129 case 4:
130 *bs->rx_buf++ = (data >> 24) & 0xff;
131 /* fallthrough */
132 case 3:
133 *bs->rx_buf++ = (data >> 16) & 0xff;
134 /* fallthrough */
135 case 2:
136 *bs->rx_buf++ = (data >> 8) & 0xff;
137 /* fallthrough */
138 case 1:
139 *bs->rx_buf++ = (data >> 0) & 0xff;
140 /* fallthrough - no default */
141 }
142 }
143 bs->rx_len -= count;
144 bs->pending -= count;
145}
146
147static inline void bcm2835aux_wr_fifo(struct bcm2835aux_spi *bs)
148{
149 u32 data;
150 u8 byte;
151 int count;
152 int i;
153
154 /* gather up to 3 bytes to write to the FIFO */
155 count = min(bs->tx_len, 3);
156 data = 0;
157 for (i = 0; i < count; i++) {
158 byte = bs->tx_buf ? *bs->tx_buf++ : 0;
159 data |= byte << (8 * (2 - i));
160 }
161
162 /* and set the variable bit-length */
163 data |= (count * 8) << 24;
164
165 /* and decrement length */
166 bs->tx_len -= count;
167 bs->pending += count;
168
169 /* write to the correct TX-register */
170 if (bs->tx_len)
171 bcm2835aux_wr(bs, BCM2835_AUX_SPI_TXHOLD, data);
172 else
173 bcm2835aux_wr(bs, BCM2835_AUX_SPI_IO, data);
174}
175
176static void bcm2835aux_spi_reset_hw(struct bcm2835aux_spi *bs)
177{
178 /* disable spi clearing fifo and interrupts */
179 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, 0);
180 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL0,
181 BCM2835_AUX_SPI_CNTL0_CLEARFIFO);
182}
183
184static irqreturn_t bcm2835aux_spi_interrupt(int irq, void *dev_id)
185{
186 struct spi_master *master = dev_id;
187 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
188 irqreturn_t ret = IRQ_NONE;
189
190 /* check if we have data to read */
191 while (bs->rx_len &&
192 (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
193 BCM2835_AUX_SPI_STAT_RX_EMPTY))) {
194 bcm2835aux_rd_fifo(bs);
195 ret = IRQ_HANDLED;
196 }
197
198 /* check if we have data to write */
199 while (bs->tx_len &&
200 (bs->pending < 12) &&
201 (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
202 BCM2835_AUX_SPI_STAT_TX_FULL))) {
203 bcm2835aux_wr_fifo(bs);
204 ret = IRQ_HANDLED;
205 }
206
207 /* and check if we have reached "done" */
208 while (bs->rx_len &&
209 (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
210 BCM2835_AUX_SPI_STAT_BUSY))) {
211 bcm2835aux_rd_fifo(bs);
212 ret = IRQ_HANDLED;
213 }
214
215 /* and if rx_len is 0 then wake up completion and disable spi */
216 if (!bs->rx_len) {
217 bcm2835aux_spi_reset_hw(bs);
218 complete(&master->xfer_completion);
219 }
220
221 /* and return */
222 return ret;
223}
224
225static int __bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
226 struct spi_device *spi,
227 struct spi_transfer *tfr)
228{
229 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
230
231 /* enable interrupts */
232 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1] |
233 BCM2835_AUX_SPI_CNTL1_TXEMPTY |
234 BCM2835_AUX_SPI_CNTL1_IDLE);
235
236 /* and wait for finish... */
237 return 1;
238}
239
240static int bcm2835aux_spi_transfer_one_irq(struct spi_master *master,
241 struct spi_device *spi,
242 struct spi_transfer *tfr)
243{
244 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
245
246 /* fill in registers and fifos before enabling interrupts */
247 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1]);
248 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL0, bs->cntl[0]);
249
250 /* fill in tx fifo with data before enabling interrupts */
251 while ((bs->tx_len) &&
252 (bs->pending < 12) &&
253 (!(bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT) &
254 BCM2835_AUX_SPI_STAT_TX_FULL))) {
255 bcm2835aux_wr_fifo(bs);
256 }
257
258 /* now run the interrupt mode */
259 return __bcm2835aux_spi_transfer_one_irq(master, spi, tfr);
260}
261
262static int bcm2835aux_spi_transfer_one_poll(struct spi_master *master,
263 struct spi_device *spi,
264 struct spi_transfer *tfr)
265{
266 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
267 unsigned long timeout;
268 u32 stat;
269
270 /* configure spi */
271 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL1, bs->cntl[1]);
272 bcm2835aux_wr(bs, BCM2835_AUX_SPI_CNTL0, bs->cntl[0]);
273
274 /* set the timeout */
275 timeout = jiffies + BCM2835_AUX_SPI_POLLING_JIFFIES;
276
277 /* loop until finished the transfer */
278 while (bs->rx_len) {
279 /* read status */
280 stat = bcm2835aux_rd(bs, BCM2835_AUX_SPI_STAT);
281
282 /* fill in tx fifo with remaining data */
283 if ((bs->tx_len) && (!(stat & BCM2835_AUX_SPI_STAT_TX_FULL))) {
284 bcm2835aux_wr_fifo(bs);
285 continue;
286 }
287
288 /* read data from fifo for both cases */
289 if (!(stat & BCM2835_AUX_SPI_STAT_RX_EMPTY)) {
290 bcm2835aux_rd_fifo(bs);
291 continue;
292 }
293 if (!(stat & BCM2835_AUX_SPI_STAT_BUSY)) {
294 bcm2835aux_rd_fifo(bs);
295 continue;
296 }
297
298 /* there is still data pending to read check the timeout */
299 if (bs->rx_len && time_after(jiffies, timeout)) {
300 dev_dbg_ratelimited(&spi->dev,
301 "timeout period reached: jiffies: %lu remaining tx/rx: %d/%d - falling back to interrupt mode\n",
302 jiffies - timeout,
303 bs->tx_len, bs->rx_len);
304 /* forward to interrupt handler */
305 return __bcm2835aux_spi_transfer_one_irq(master,
306 spi, tfr);
307 }
308 }
309
310 /* Transfer complete - reset SPI HW */
311 bcm2835aux_spi_reset_hw(bs);
312
313 /* and return without waiting for completion */
314 return 0;
315}
316
317static int bcm2835aux_spi_transfer_one(struct spi_master *master,
318 struct spi_device *spi,
319 struct spi_transfer *tfr)
320{
321 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
322 unsigned long spi_hz, clk_hz, speed;
323 unsigned long spi_used_hz;
324 unsigned long long xfer_time_us;
325
326 /* calculate the registers to handle
327 *
328 * note that we use the variable data mode, which
329 * is not optimal for longer transfers as we waste registers
330 * resulting (potentially) in more interrupts when transferring
331 * more than 12 bytes
332 */
333 bs->cntl[0] = BCM2835_AUX_SPI_CNTL0_ENABLE |
334 BCM2835_AUX_SPI_CNTL0_VAR_WIDTH |
335 BCM2835_AUX_SPI_CNTL0_MSBF_OUT;
336 bs->cntl[1] = BCM2835_AUX_SPI_CNTL1_MSBF_IN;
337
338 /* set clock */
339 spi_hz = tfr->speed_hz;
340 clk_hz = clk_get_rate(bs->clk);
341
342 if (spi_hz >= clk_hz / 2) {
343 speed = 0;
344 } else if (spi_hz) {
345 speed = DIV_ROUND_UP(clk_hz, 2 * spi_hz) - 1;
346 if (speed > BCM2835_AUX_SPI_CNTL0_SPEED_MAX)
347 speed = BCM2835_AUX_SPI_CNTL0_SPEED_MAX;
348 } else { /* the slowest we can go */
349 speed = BCM2835_AUX_SPI_CNTL0_SPEED_MAX;
350 }
351 bs->cntl[0] |= speed << BCM2835_AUX_SPI_CNTL0_SPEED_SHIFT;
352
353 spi_used_hz = clk_hz / (2 * (speed + 1));
354
355 /* handle all the modes */
356 if (spi->mode & SPI_CPOL)
357 bs->cntl[0] |= BCM2835_AUX_SPI_CNTL0_CPOL;
358 if (spi->mode & SPI_CPHA)
359 bs->cntl[0] |= BCM2835_AUX_SPI_CNTL0_CPHA_OUT |
360 BCM2835_AUX_SPI_CNTL0_CPHA_IN;
361
362 /* set transmit buffers and length */
363 bs->tx_buf = tfr->tx_buf;
364 bs->rx_buf = tfr->rx_buf;
365 bs->tx_len = tfr->len;
366 bs->rx_len = tfr->len;
367 bs->pending = 0;
368
369 /* calculate the estimated time in us the transfer runs
370 * note that there are are 2 idle clocks after each
371 * chunk getting transferred - in our case the chunk size
372 * is 3 bytes, so we approximate this by 9 bits/byte
373 */
374 xfer_time_us = tfr->len * 9 * 1000000;
375 do_div(xfer_time_us, spi_used_hz);
376
377 /* run in polling mode for short transfers */
378 if (xfer_time_us < BCM2835_AUX_SPI_POLLING_LIMIT_US)
379 return bcm2835aux_spi_transfer_one_poll(master, spi, tfr);
380
381 /* run in interrupt mode for all others */
382 return bcm2835aux_spi_transfer_one_irq(master, spi, tfr);
383}
384
385static void bcm2835aux_spi_handle_err(struct spi_master *master,
386 struct spi_message *msg)
387{
388 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
389
390 bcm2835aux_spi_reset_hw(bs);
391}
392
393static int bcm2835aux_spi_probe(struct platform_device *pdev)
394{
395 struct spi_master *master;
396 struct bcm2835aux_spi *bs;
397 struct resource *res;
398 unsigned long clk_hz;
399 int err;
400
401 master = spi_alloc_master(&pdev->dev, sizeof(*bs));
402 if (!master) {
403 dev_err(&pdev->dev, "spi_alloc_master() failed\n");
404 return -ENOMEM;
405 }
406
407 platform_set_drvdata(pdev, master);
408 master->mode_bits = BCM2835_AUX_SPI_MODE_BITS;
409 master->bits_per_word_mask = SPI_BPW_MASK(8);
410 master->num_chipselect = -1;
411 master->transfer_one = bcm2835aux_spi_transfer_one;
412 master->handle_err = bcm2835aux_spi_handle_err;
413 master->dev.of_node = pdev->dev.of_node;
414
415 bs = spi_master_get_devdata(master);
416
417 /* the main area */
418 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
419 bs->regs = devm_ioremap_resource(&pdev->dev, res);
420 if (IS_ERR(bs->regs)) {
421 err = PTR_ERR(bs->regs);
422 goto out_master_put;
423 }
424
425 bs->clk = devm_clk_get(&pdev->dev, NULL);
426 if ((!bs->clk) || (IS_ERR(bs->clk))) {
427 err = PTR_ERR(bs->clk);
428 dev_err(&pdev->dev, "could not get clk: %d\n", err);
429 goto out_master_put;
430 }
431
432 bs->irq = platform_get_irq(pdev, 0);
433 if (bs->irq <= 0) {
434 dev_err(&pdev->dev, "could not get IRQ: %d\n", bs->irq);
435 err = bs->irq ? bs->irq : -ENODEV;
436 goto out_master_put;
437 }
438
439 /* this also enables the HW block */
440 err = clk_prepare_enable(bs->clk);
441 if (err) {
442 dev_err(&pdev->dev, "could not prepare clock: %d\n", err);
443 goto out_master_put;
444 }
445
446 /* just checking if the clock returns a sane value */
447 clk_hz = clk_get_rate(bs->clk);
448 if (!clk_hz) {
449 dev_err(&pdev->dev, "clock returns 0 Hz\n");
450 err = -ENODEV;
451 goto out_clk_disable;
452 }
453
454 /* reset SPI-HW block */
455 bcm2835aux_spi_reset_hw(bs);
456
457 err = devm_request_irq(&pdev->dev, bs->irq,
458 bcm2835aux_spi_interrupt,
459 IRQF_SHARED,
460 dev_name(&pdev->dev), master);
461 if (err) {
462 dev_err(&pdev->dev, "could not request IRQ: %d\n", err);
463 goto out_clk_disable;
464 }
465
466 err = devm_spi_register_master(&pdev->dev, master);
467 if (err) {
468 dev_err(&pdev->dev, "could not register SPI master: %d\n", err);
469 goto out_clk_disable;
470 }
471
472 return 0;
473
474out_clk_disable:
475 clk_disable_unprepare(bs->clk);
476out_master_put:
477 spi_master_put(master);
478 return err;
479}
480
481static int bcm2835aux_spi_remove(struct platform_device *pdev)
482{
483 struct spi_master *master = platform_get_drvdata(pdev);
484 struct bcm2835aux_spi *bs = spi_master_get_devdata(master);
485
486 bcm2835aux_spi_reset_hw(bs);
487
488 /* disable the HW block by releasing the clock */
489 clk_disable_unprepare(bs->clk);
490
491 return 0;
492}
493
494static const struct of_device_id bcm2835aux_spi_match[] = {
495 { .compatible = "brcm,bcm2835-aux-spi", },
496 {}
497};
498MODULE_DEVICE_TABLE(of, bcm2835aux_spi_match);
499
500static struct platform_driver bcm2835aux_spi_driver = {
501 .driver = {
502 .name = "spi-bcm2835aux",
503 .of_match_table = bcm2835aux_spi_match,
504 },
505 .probe = bcm2835aux_spi_probe,
506 .remove = bcm2835aux_spi_remove,
507};
508module_platform_driver(bcm2835aux_spi_driver);
509
510MODULE_DESCRIPTION("SPI controller driver for Broadcom BCM2835 aux");
511MODULE_AUTHOR("Martin Sperl <kernel@martin.sperl.org>");
512MODULE_LICENSE("GPL v2");
diff --git a/drivers/spi/spi-bcm53xx.c b/drivers/spi/spi-bcm53xx.c
index 1520554978a3..cc3f938f0a6b 100644
--- a/drivers/spi/spi-bcm53xx.c
+++ b/drivers/spi/spi-bcm53xx.c
@@ -247,28 +247,19 @@ static int bcm53xxspi_bcma_probe(struct bcma_device *core)
247 if (err) { 247 if (err) {
248 spi_master_put(master); 248 spi_master_put(master);
249 bcma_set_drvdata(core, NULL); 249 bcma_set_drvdata(core, NULL);
250 goto out; 250 return err;
251 } 251 }
252 252
253 /* Broadcom SoCs (at least with the CC rev 42) use SPI for flash only */ 253 /* Broadcom SoCs (at least with the CC rev 42) use SPI for flash only */
254 spi_new_device(master, &bcm53xx_info); 254 spi_new_device(master, &bcm53xx_info);
255 255
256out: 256 return 0;
257 return err;
258}
259
260static void bcm53xxspi_bcma_remove(struct bcma_device *core)
261{
262 struct bcm53xxspi *b53spi = bcma_get_drvdata(core);
263
264 spi_unregister_master(b53spi->master);
265} 257}
266 258
267static struct bcma_driver bcm53xxspi_bcma_driver = { 259static struct bcma_driver bcm53xxspi_bcma_driver = {
268 .name = KBUILD_MODNAME, 260 .name = KBUILD_MODNAME,
269 .id_table = bcm53xxspi_bcma_tbl, 261 .id_table = bcm53xxspi_bcma_tbl,
270 .probe = bcm53xxspi_bcma_probe, 262 .probe = bcm53xxspi_bcma_probe,
271 .remove = bcm53xxspi_bcma_remove,
272}; 263};
273 264
274/************************************************** 265/**************************************************
diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index e73e2b052c9c..06858e04ec59 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -27,10 +27,117 @@
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29 29
30#include <bcm63xx_dev_spi.h> 30/* BCM 6338/6348 SPI core */
31#define SPI_6348_RSET_SIZE 64
32#define SPI_6348_CMD 0x00 /* 16-bits register */
33#define SPI_6348_INT_STATUS 0x02
34#define SPI_6348_INT_MASK_ST 0x03
35#define SPI_6348_INT_MASK 0x04
36#define SPI_6348_ST 0x05
37#define SPI_6348_CLK_CFG 0x06
38#define SPI_6348_FILL_BYTE 0x07
39#define SPI_6348_MSG_TAIL 0x09
40#define SPI_6348_RX_TAIL 0x0b
41#define SPI_6348_MSG_CTL 0x40 /* 8-bits register */
42#define SPI_6348_MSG_CTL_WIDTH 8
43#define SPI_6348_MSG_DATA 0x41
44#define SPI_6348_MSG_DATA_SIZE 0x3f
45#define SPI_6348_RX_DATA 0x80
46#define SPI_6348_RX_DATA_SIZE 0x3f
47
48/* BCM 3368/6358/6262/6368 SPI core */
49#define SPI_6358_RSET_SIZE 1804
50#define SPI_6358_MSG_CTL 0x00 /* 16-bits register */
51#define SPI_6358_MSG_CTL_WIDTH 16
52#define SPI_6358_MSG_DATA 0x02
53#define SPI_6358_MSG_DATA_SIZE 0x21e
54#define SPI_6358_RX_DATA 0x400
55#define SPI_6358_RX_DATA_SIZE 0x220
56#define SPI_6358_CMD 0x700 /* 16-bits register */
57#define SPI_6358_INT_STATUS 0x702
58#define SPI_6358_INT_MASK_ST 0x703
59#define SPI_6358_INT_MASK 0x704
60#define SPI_6358_ST 0x705
61#define SPI_6358_CLK_CFG 0x706
62#define SPI_6358_FILL_BYTE 0x707
63#define SPI_6358_MSG_TAIL 0x709
64#define SPI_6358_RX_TAIL 0x70B
65
66/* Shared SPI definitions */
67
68/* Message configuration */
69#define SPI_FD_RW 0x00
70#define SPI_HD_W 0x01
71#define SPI_HD_R 0x02
72#define SPI_BYTE_CNT_SHIFT 0
73#define SPI_6348_MSG_TYPE_SHIFT 6
74#define SPI_6358_MSG_TYPE_SHIFT 14
75
76/* Command */
77#define SPI_CMD_NOOP 0x00
78#define SPI_CMD_SOFT_RESET 0x01
79#define SPI_CMD_HARD_RESET 0x02
80#define SPI_CMD_START_IMMEDIATE 0x03
81#define SPI_CMD_COMMAND_SHIFT 0
82#define SPI_CMD_COMMAND_MASK 0x000f
83#define SPI_CMD_DEVICE_ID_SHIFT 4
84#define SPI_CMD_PREPEND_BYTE_CNT_SHIFT 8
85#define SPI_CMD_ONE_BYTE_SHIFT 11
86#define SPI_CMD_ONE_WIRE_SHIFT 12
87#define SPI_DEV_ID_0 0
88#define SPI_DEV_ID_1 1
89#define SPI_DEV_ID_2 2
90#define SPI_DEV_ID_3 3
91
92/* Interrupt mask */
93#define SPI_INTR_CMD_DONE 0x01
94#define SPI_INTR_RX_OVERFLOW 0x02
95#define SPI_INTR_TX_UNDERFLOW 0x04
96#define SPI_INTR_TX_OVERFLOW 0x08
97#define SPI_INTR_RX_UNDERFLOW 0x10
98#define SPI_INTR_CLEAR_ALL 0x1f
99
100/* Status */
101#define SPI_RX_EMPTY 0x02
102#define SPI_CMD_BUSY 0x04
103#define SPI_SERIAL_BUSY 0x08
104
105/* Clock configuration */
106#define SPI_CLK_20MHZ 0x00
107#define SPI_CLK_0_391MHZ 0x01
108#define SPI_CLK_0_781MHZ 0x02 /* default */
109#define SPI_CLK_1_563MHZ 0x03
110#define SPI_CLK_3_125MHZ 0x04
111#define SPI_CLK_6_250MHZ 0x05
112#define SPI_CLK_12_50MHZ 0x06
113#define SPI_CLK_MASK 0x07
114#define SPI_SSOFFTIME_MASK 0x38
115#define SPI_SSOFFTIME_SHIFT 3
116#define SPI_BYTE_SWAP 0x80
117
118enum bcm63xx_regs_spi {
119 SPI_CMD,
120 SPI_INT_STATUS,
121 SPI_INT_MASK_ST,
122 SPI_INT_MASK,
123 SPI_ST,
124 SPI_CLK_CFG,
125 SPI_FILL_BYTE,
126 SPI_MSG_TAIL,
127 SPI_RX_TAIL,
128 SPI_MSG_CTL,
129 SPI_MSG_DATA,
130 SPI_RX_DATA,
131 SPI_MSG_TYPE_SHIFT,
132 SPI_MSG_CTL_WIDTH,
133 SPI_MSG_DATA_SIZE,
134};
31 135
32#define BCM63XX_SPI_MAX_PREPEND 15 136#define BCM63XX_SPI_MAX_PREPEND 15
33 137
138#define BCM63XX_SPI_MAX_CS 8
139#define BCM63XX_SPI_BUS_NUM 0
140
34struct bcm63xx_spi { 141struct bcm63xx_spi {
35 struct completion done; 142 struct completion done;
36 143
@@ -38,6 +145,7 @@ struct bcm63xx_spi {
38 int irq; 145 int irq;
39 146
40 /* Platform data */ 147 /* Platform data */
148 const unsigned long *reg_offsets;
41 unsigned fifo_size; 149 unsigned fifo_size;
42 unsigned int msg_type_shift; 150 unsigned int msg_type_shift;
43 unsigned int msg_ctl_width; 151 unsigned int msg_ctl_width;
@@ -51,27 +159,35 @@ struct bcm63xx_spi {
51}; 159};
52 160
53static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs, 161static inline u8 bcm_spi_readb(struct bcm63xx_spi *bs,
54 unsigned int offset) 162 unsigned int offset)
55{ 163{
56 return bcm_readb(bs->regs + bcm63xx_spireg(offset)); 164 return readb(bs->regs + bs->reg_offsets[offset]);
57} 165}
58 166
59static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs, 167static inline u16 bcm_spi_readw(struct bcm63xx_spi *bs,
60 unsigned int offset) 168 unsigned int offset)
61{ 169{
62 return bcm_readw(bs->regs + bcm63xx_spireg(offset)); 170#ifdef CONFIG_CPU_BIG_ENDIAN
171 return ioread16be(bs->regs + bs->reg_offsets[offset]);
172#else
173 return readw(bs->regs + bs->reg_offsets[offset]);
174#endif
63} 175}
64 176
65static inline void bcm_spi_writeb(struct bcm63xx_spi *bs, 177static inline void bcm_spi_writeb(struct bcm63xx_spi *bs,
66 u8 value, unsigned int offset) 178 u8 value, unsigned int offset)
67{ 179{
68 bcm_writeb(value, bs->regs + bcm63xx_spireg(offset)); 180 writeb(value, bs->regs + bs->reg_offsets[offset]);
69} 181}
70 182
71static inline void bcm_spi_writew(struct bcm63xx_spi *bs, 183static inline void bcm_spi_writew(struct bcm63xx_spi *bs,
72 u16 value, unsigned int offset) 184 u16 value, unsigned int offset)
73{ 185{
74 bcm_writew(value, bs->regs + bcm63xx_spireg(offset)); 186#ifdef CONFIG_CPU_BIG_ENDIAN
187 iowrite16be(value, bs->regs + bs->reg_offsets[offset]);
188#else
189 writew(value, bs->regs + bs->reg_offsets[offset]);
190#endif
75} 191}
76 192
77static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = { 193static const unsigned bcm63xx_spi_freq_table[SPI_CLK_MASK][2] = {
@@ -122,7 +238,6 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,
122 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master); 238 struct bcm63xx_spi *bs = spi_master_get_devdata(spi->master);
123 u16 msg_ctl; 239 u16 msg_ctl;
124 u16 cmd; 240 u16 cmd;
125 u8 rx_tail;
126 unsigned int i, timeout = 0, prepend_len = 0, len = 0; 241 unsigned int i, timeout = 0, prepend_len = 0, len = 0;
127 struct spi_transfer *t = first; 242 struct spi_transfer *t = first;
128 bool do_rx = false; 243 bool do_rx = false;
@@ -314,18 +429,71 @@ static irqreturn_t bcm63xx_spi_interrupt(int irq, void *dev_id)
314 return IRQ_HANDLED; 429 return IRQ_HANDLED;
315} 430}
316 431
432static const unsigned long bcm6348_spi_reg_offsets[] = {
433 [SPI_CMD] = SPI_6348_CMD,
434 [SPI_INT_STATUS] = SPI_6348_INT_STATUS,
435 [SPI_INT_MASK_ST] = SPI_6348_INT_MASK_ST,
436 [SPI_INT_MASK] = SPI_6348_INT_MASK,
437 [SPI_ST] = SPI_6348_ST,
438 [SPI_CLK_CFG] = SPI_6348_CLK_CFG,
439 [SPI_FILL_BYTE] = SPI_6348_FILL_BYTE,
440 [SPI_MSG_TAIL] = SPI_6348_MSG_TAIL,
441 [SPI_RX_TAIL] = SPI_6348_RX_TAIL,
442 [SPI_MSG_CTL] = SPI_6348_MSG_CTL,
443 [SPI_MSG_DATA] = SPI_6348_MSG_DATA,
444 [SPI_RX_DATA] = SPI_6348_RX_DATA,
445 [SPI_MSG_TYPE_SHIFT] = SPI_6348_MSG_TYPE_SHIFT,
446 [SPI_MSG_CTL_WIDTH] = SPI_6348_MSG_CTL_WIDTH,
447 [SPI_MSG_DATA_SIZE] = SPI_6348_MSG_DATA_SIZE,
448};
449
450static const unsigned long bcm6358_spi_reg_offsets[] = {
451 [SPI_CMD] = SPI_6358_CMD,
452 [SPI_INT_STATUS] = SPI_6358_INT_STATUS,
453 [SPI_INT_MASK_ST] = SPI_6358_INT_MASK_ST,
454 [SPI_INT_MASK] = SPI_6358_INT_MASK,
455 [SPI_ST] = SPI_6358_ST,
456 [SPI_CLK_CFG] = SPI_6358_CLK_CFG,
457 [SPI_FILL_BYTE] = SPI_6358_FILL_BYTE,
458 [SPI_MSG_TAIL] = SPI_6358_MSG_TAIL,
459 [SPI_RX_TAIL] = SPI_6358_RX_TAIL,
460 [SPI_MSG_CTL] = SPI_6358_MSG_CTL,
461 [SPI_MSG_DATA] = SPI_6358_MSG_DATA,
462 [SPI_RX_DATA] = SPI_6358_RX_DATA,
463 [SPI_MSG_TYPE_SHIFT] = SPI_6358_MSG_TYPE_SHIFT,
464 [SPI_MSG_CTL_WIDTH] = SPI_6358_MSG_CTL_WIDTH,
465 [SPI_MSG_DATA_SIZE] = SPI_6358_MSG_DATA_SIZE,
466};
467
468static const struct platform_device_id bcm63xx_spi_dev_match[] = {
469 {
470 .name = "bcm6348-spi",
471 .driver_data = (unsigned long)bcm6348_spi_reg_offsets,
472 },
473 {
474 .name = "bcm6358-spi",
475 .driver_data = (unsigned long)bcm6358_spi_reg_offsets,
476 },
477 {
478 },
479};
317 480
318static int bcm63xx_spi_probe(struct platform_device *pdev) 481static int bcm63xx_spi_probe(struct platform_device *pdev)
319{ 482{
320 struct resource *r; 483 struct resource *r;
484 const unsigned long *bcm63xx_spireg;
321 struct device *dev = &pdev->dev; 485 struct device *dev = &pdev->dev;
322 struct bcm63xx_spi_pdata *pdata = dev_get_platdata(&pdev->dev);
323 int irq; 486 int irq;
324 struct spi_master *master; 487 struct spi_master *master;
325 struct clk *clk; 488 struct clk *clk;
326 struct bcm63xx_spi *bs; 489 struct bcm63xx_spi *bs;
327 int ret; 490 int ret;
328 491
492 if (!pdev->id_entry->driver_data)
493 return -EINVAL;
494
495 bcm63xx_spireg = (const unsigned long *)pdev->id_entry->driver_data;
496
329 irq = platform_get_irq(pdev, 0); 497 irq = platform_get_irq(pdev, 0);
330 if (irq < 0) { 498 if (irq < 0) {
331 dev_err(dev, "no irq\n"); 499 dev_err(dev, "no irq\n");
@@ -359,7 +527,8 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
359 527
360 bs->irq = irq; 528 bs->irq = irq;
361 bs->clk = clk; 529 bs->clk = clk;
362 bs->fifo_size = pdata->fifo_size; 530 bs->reg_offsets = bcm63xx_spireg;
531 bs->fifo_size = bs->reg_offsets[SPI_MSG_DATA_SIZE];
363 532
364 ret = devm_request_irq(&pdev->dev, irq, bcm63xx_spi_interrupt, 0, 533 ret = devm_request_irq(&pdev->dev, irq, bcm63xx_spi_interrupt, 0,
365 pdev->name, master); 534 pdev->name, master);
@@ -368,26 +537,16 @@ static int bcm63xx_spi_probe(struct platform_device *pdev)
368 goto out_err; 537 goto out_err;
369 } 538 }
370 539
371 master->bus_num = pdata->bus_num; 540 master->bus_num = BCM63XX_SPI_BUS_NUM;
372 master->num_chipselect = pdata->num_chipselect; 541 master->num_chipselect = BCM63XX_SPI_MAX_CS;
373 master->transfer_one_message = bcm63xx_spi_transfer_one; 542 master->transfer_one_message = bcm63xx_spi_transfer_one;
374 master->mode_bits = MODEBITS; 543 master->mode_bits = MODEBITS;
375 master->bits_per_word_mask = SPI_BPW_MASK(8); 544 master->bits_per_word_mask = SPI_BPW_MASK(8);
376 master->auto_runtime_pm = true; 545 master->auto_runtime_pm = true;
377 bs->msg_type_shift = pdata->msg_type_shift; 546 bs->msg_type_shift = bs->reg_offsets[SPI_MSG_TYPE_SHIFT];
378 bs->msg_ctl_width = pdata->msg_ctl_width; 547 bs->msg_ctl_width = bs->reg_offsets[SPI_MSG_CTL_WIDTH];
379 bs->tx_io = (u8 *)(bs->regs + bcm63xx_spireg(SPI_MSG_DATA)); 548 bs->tx_io = (u8 *)(bs->regs + bs->reg_offsets[SPI_MSG_DATA]);
380 bs->rx_io = (const u8 *)(bs->regs + bcm63xx_spireg(SPI_RX_DATA)); 549 bs->rx_io = (const u8 *)(bs->regs + bs->reg_offsets[SPI_RX_DATA]);
381
382 switch (bs->msg_ctl_width) {
383 case 8:
384 case 16:
385 break;
386 default:
387 dev_err(dev, "unsupported MSG_CTL width: %d\n",
388 bs->msg_ctl_width);
389 goto out_err;
390 }
391 550
392 /* Initialize hardware */ 551 /* Initialize hardware */
393 ret = clk_prepare_enable(bs->clk); 552 ret = clk_prepare_enable(bs->clk);
@@ -467,6 +626,7 @@ static struct platform_driver bcm63xx_spi_driver = {
467 .name = "bcm63xx-spi", 626 .name = "bcm63xx-spi",
468 .pm = &bcm63xx_spi_pm_ops, 627 .pm = &bcm63xx_spi_pm_ops,
469 }, 628 },
629 .id_table = bcm63xx_spi_dev_match,
470 .probe = bcm63xx_spi_probe, 630 .probe = bcm63xx_spi_probe,
471 .remove = bcm63xx_spi_remove, 631 .remove = bcm63xx_spi_remove,
472}; 632};
diff --git a/drivers/spi/spi-bfin-sport.c b/drivers/spi/spi-bfin-sport.c
index a78693189f45..6c967555a56a 100644
--- a/drivers/spi/spi-bfin-sport.c
+++ b/drivers/spi/spi-bfin-sport.c
@@ -352,10 +352,7 @@ bfin_sport_spi_pump_transfers(unsigned long data)
352 transfer = drv_data->cur_transfer; 352 transfer = drv_data->cur_transfer;
353 chip = drv_data->cur_chip; 353 chip = drv_data->cur_chip;
354 354
355 if (transfer->speed_hz) 355 transfer_speed = bfin_sport_hz_to_spi_baud(transfer->speed_hz);
356 transfer_speed = bfin_sport_hz_to_spi_baud(transfer->speed_hz);
357 else
358 transfer_speed = chip->baud;
359 bfin_write(&drv_data->regs->tclkdiv, transfer_speed); 356 bfin_write(&drv_data->regs->tclkdiv, transfer_speed);
360 SSYNC(); 357 SSYNC();
361 358
diff --git a/drivers/spi/spi-bfin5xx.c b/drivers/spi/spi-bfin5xx.c
index a3d65b4f4944..1e91325bf39c 100644
--- a/drivers/spi/spi-bfin5xx.c
+++ b/drivers/spi/spi-bfin5xx.c
@@ -661,11 +661,7 @@ static void bfin_spi_pump_transfers(unsigned long data)
661 message->state = RUNNING_STATE; 661 message->state = RUNNING_STATE;
662 dma_config = 0; 662 dma_config = 0;
663 663
664 /* Speed setup (surely valid because already checked) */ 664 bfin_write(&drv_data->regs->baud, hz_to_spi_baud(transfer->speed_hz));
665 if (transfer->speed_hz)
666 bfin_write(&drv_data->regs->baud, hz_to_spi_baud(transfer->speed_hz));
667 else
668 bfin_write(&drv_data->regs->baud, chip->baud);
669 665
670 bfin_write(&drv_data->regs->stat, BIT_STAT_CLR); 666 bfin_write(&drv_data->regs->stat, BIT_STAT_CLR);
671 bfin_spi_cs_active(drv_data, chip); 667 bfin_spi_cs_active(drv_data, chip);
diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c
index 840a4984d365..3aa9e6e3dac8 100644
--- a/drivers/spi/spi-bitbang.c
+++ b/drivers/spi/spi-bitbang.c
@@ -24,6 +24,8 @@
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/spi_bitbang.h> 25#include <linux/spi/spi_bitbang.h>
26 26
27#define SPI_BITBANG_CS_DELAY 100
28
27 29
28/*----------------------------------------------------------------------*/ 30/*----------------------------------------------------------------------*/
29 31
@@ -180,7 +182,6 @@ int spi_bitbang_setup(struct spi_device *spi)
180{ 182{
181 struct spi_bitbang_cs *cs = spi->controller_state; 183 struct spi_bitbang_cs *cs = spi->controller_state;
182 struct spi_bitbang *bitbang; 184 struct spi_bitbang *bitbang;
183 unsigned long flags;
184 185
185 bitbang = spi_master_get_devdata(spi->master); 186 bitbang = spi_master_get_devdata(spi->master);
186 187
@@ -210,12 +211,12 @@ int spi_bitbang_setup(struct spi_device *spi)
210 */ 211 */
211 212
212 /* deselect chip (low or high) */ 213 /* deselect chip (low or high) */
213 spin_lock_irqsave(&bitbang->lock, flags); 214 mutex_lock(&bitbang->lock);
214 if (!bitbang->busy) { 215 if (!bitbang->busy) {
215 bitbang->chipselect(spi, BITBANG_CS_INACTIVE); 216 bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
216 ndelay(cs->nsecs); 217 ndelay(cs->nsecs);
217 } 218 }
218 spin_unlock_irqrestore(&bitbang->lock, flags); 219 mutex_unlock(&bitbang->lock);
219 220
220 return 0; 221 return 0;
221} 222}
@@ -255,122 +256,39 @@ static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t)
255static int spi_bitbang_prepare_hardware(struct spi_master *spi) 256static int spi_bitbang_prepare_hardware(struct spi_master *spi)
256{ 257{
257 struct spi_bitbang *bitbang; 258 struct spi_bitbang *bitbang;
258 unsigned long flags;
259 259
260 bitbang = spi_master_get_devdata(spi); 260 bitbang = spi_master_get_devdata(spi);
261 261
262 spin_lock_irqsave(&bitbang->lock, flags); 262 mutex_lock(&bitbang->lock);
263 bitbang->busy = 1; 263 bitbang->busy = 1;
264 spin_unlock_irqrestore(&bitbang->lock, flags); 264 mutex_unlock(&bitbang->lock);
265 265
266 return 0; 266 return 0;
267} 267}
268 268
269static int spi_bitbang_transfer_one(struct spi_master *master, 269static int spi_bitbang_transfer_one(struct spi_master *master,
270 struct spi_message *m) 270 struct spi_device *spi,
271 struct spi_transfer *transfer)
271{ 272{
272 struct spi_bitbang *bitbang; 273 struct spi_bitbang *bitbang = spi_master_get_devdata(master);
273 unsigned nsecs; 274 int status = 0;
274 struct spi_transfer *t = NULL;
275 unsigned cs_change;
276 int status;
277 int do_setup = -1;
278 struct spi_device *spi = m->spi;
279
280 bitbang = spi_master_get_devdata(master);
281
282 /* FIXME this is made-up ... the correct value is known to
283 * word-at-a-time bitbang code, and presumably chipselect()
284 * should enforce these requirements too?
285 */
286 nsecs = 100;
287
288 cs_change = 1;
289 status = 0;
290
291 list_for_each_entry(t, &m->transfers, transfer_list) {
292
293 /* override speed or wordsize? */
294 if (t->speed_hz || t->bits_per_word)
295 do_setup = 1;
296
297 /* init (-1) or override (1) transfer params */
298 if (do_setup != 0) {
299 if (bitbang->setup_transfer) {
300 status = bitbang->setup_transfer(spi, t);
301 if (status < 0)
302 break;
303 }
304 if (do_setup == -1)
305 do_setup = 0;
306 }
307
308 /* set up default clock polarity, and activate chip;
309 * this implicitly updates clock and spi modes as
310 * previously recorded for this device via setup().
311 * (and also deselects any other chip that might be
312 * selected ...)
313 */
314 if (cs_change) {
315 bitbang->chipselect(spi, BITBANG_CS_ACTIVE);
316 ndelay(nsecs);
317 }
318 cs_change = t->cs_change;
319 if (!t->tx_buf && !t->rx_buf && t->len) {
320 status = -EINVAL;
321 break;
322 }
323
324 /* transfer data. the lower level code handles any
325 * new dma mappings it needs. our caller always gave
326 * us dma-safe buffers.
327 */
328 if (t->len) {
329 /* REVISIT dma API still needs a designated
330 * DMA_ADDR_INVALID; ~0 might be better.
331 */
332 if (!m->is_dma_mapped)
333 t->rx_dma = t->tx_dma = 0;
334 status = bitbang->txrx_bufs(spi, t);
335 }
336 if (status > 0)
337 m->actual_length += status;
338 if (status != t->len) {
339 /* always report some kind of error */
340 if (status >= 0)
341 status = -EREMOTEIO;
342 break;
343 }
344 status = 0;
345 275
346 /* protocol tweaks before next transfer */ 276 if (bitbang->setup_transfer) {
347 if (t->delay_usecs) 277 status = bitbang->setup_transfer(spi, transfer);
348 udelay(t->delay_usecs); 278 if (status < 0)
349 279 goto out;
350 if (cs_change &&
351 !list_is_last(&t->transfer_list, &m->transfers)) {
352 /* sometimes a short mid-message deselect of the chip
353 * may be needed to terminate a mode or command
354 */
355 ndelay(nsecs);
356 bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
357 ndelay(nsecs);
358 }
359 } 280 }
360 281
361 m->status = status; 282 if (transfer->len)
283 status = bitbang->txrx_bufs(spi, transfer);
362 284
363 /* normally deactivate chipselect ... unless no error and 285 if (status == transfer->len)
364 * cs_change has hinted that the next message will probably 286 status = 0;
365 * be for this chip too. 287 else if (status >= 0)
366 */ 288 status = -EREMOTEIO;
367 if (!(status == 0 && cs_change)) {
368 ndelay(nsecs);
369 bitbang->chipselect(spi, BITBANG_CS_INACTIVE);
370 ndelay(nsecs);
371 }
372 289
373 spi_finalize_current_message(master); 290out:
291 spi_finalize_current_transfer(master);
374 292
375 return status; 293 return status;
376} 294}
@@ -378,17 +296,32 @@ static int spi_bitbang_transfer_one(struct spi_master *master,
378static int spi_bitbang_unprepare_hardware(struct spi_master *spi) 296static int spi_bitbang_unprepare_hardware(struct spi_master *spi)
379{ 297{
380 struct spi_bitbang *bitbang; 298 struct spi_bitbang *bitbang;
381 unsigned long flags;
382 299
383 bitbang = spi_master_get_devdata(spi); 300 bitbang = spi_master_get_devdata(spi);
384 301
385 spin_lock_irqsave(&bitbang->lock, flags); 302 mutex_lock(&bitbang->lock);
386 bitbang->busy = 0; 303 bitbang->busy = 0;
387 spin_unlock_irqrestore(&bitbang->lock, flags); 304 mutex_unlock(&bitbang->lock);
388 305
389 return 0; 306 return 0;
390} 307}
391 308
309static void spi_bitbang_set_cs(struct spi_device *spi, bool enable)
310{
311 struct spi_bitbang *bitbang = spi_master_get_devdata(spi->master);
312
313 /* SPI core provides CS high / low, but bitbang driver
314 * expects CS active
315 * spi device driver takes care of handling SPI_CS_HIGH
316 */
317 enable = (!!(spi->mode & SPI_CS_HIGH) == enable);
318
319 ndelay(SPI_BITBANG_CS_DELAY);
320 bitbang->chipselect(spi, enable ? BITBANG_CS_ACTIVE :
321 BITBANG_CS_INACTIVE);
322 ndelay(SPI_BITBANG_CS_DELAY);
323}
324
392/*----------------------------------------------------------------------*/ 325/*----------------------------------------------------------------------*/
393 326
394/** 327/**
@@ -427,7 +360,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
427 if (!master || !bitbang->chipselect) 360 if (!master || !bitbang->chipselect)
428 return -EINVAL; 361 return -EINVAL;
429 362
430 spin_lock_init(&bitbang->lock); 363 mutex_init(&bitbang->lock);
431 364
432 if (!master->mode_bits) 365 if (!master->mode_bits)
433 master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags; 366 master->mode_bits = SPI_CPOL | SPI_CPHA | bitbang->flags;
@@ -437,7 +370,8 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
437 370
438 master->prepare_transfer_hardware = spi_bitbang_prepare_hardware; 371 master->prepare_transfer_hardware = spi_bitbang_prepare_hardware;
439 master->unprepare_transfer_hardware = spi_bitbang_unprepare_hardware; 372 master->unprepare_transfer_hardware = spi_bitbang_unprepare_hardware;
440 master->transfer_one_message = spi_bitbang_transfer_one; 373 master->transfer_one = spi_bitbang_transfer_one;
374 master->set_cs = spi_bitbang_set_cs;
441 375
442 if (!bitbang->txrx_bufs) { 376 if (!bitbang->txrx_bufs) {
443 bitbang->use_dma = 0; 377 bitbang->use_dma = 0;
diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index 688956ff5095..23f6fffd75e1 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -420,19 +420,20 @@ static int mcfqspi_probe(struct platform_device *pdev)
420 master->auto_runtime_pm = true; 420 master->auto_runtime_pm = true;
421 421
422 platform_set_drvdata(pdev, master); 422 platform_set_drvdata(pdev, master);
423 pm_runtime_enable(&pdev->dev);
423 424
424 status = devm_spi_register_master(&pdev->dev, master); 425 status = devm_spi_register_master(&pdev->dev, master);
425 if (status) { 426 if (status) {
426 dev_dbg(&pdev->dev, "spi_register_master failed\n"); 427 dev_dbg(&pdev->dev, "spi_register_master failed\n");
427 goto fail2; 428 goto fail2;
428 } 429 }
429 pm_runtime_enable(&pdev->dev);
430 430
431 dev_info(&pdev->dev, "Coldfire QSPI bus driver\n"); 431 dev_info(&pdev->dev, "Coldfire QSPI bus driver\n");
432 432
433 return 0; 433 return 0;
434 434
435fail2: 435fail2:
436 pm_runtime_disable(&pdev->dev);
436 mcfqspi_cs_teardown(mcfqspi); 437 mcfqspi_cs_teardown(mcfqspi);
437fail1: 438fail1:
438 clk_disable(mcfqspi->clk); 439 clk_disable(mcfqspi->clk);
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
index a85d863d4a44..7d3af3eacf57 100644
--- a/drivers/spi/spi-davinci.c
+++ b/drivers/spi/spi-davinci.c
@@ -215,18 +215,10 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value)
215 struct davinci_spi_config *spicfg = spi->controller_data; 215 struct davinci_spi_config *spicfg = spi->controller_data;
216 u8 chip_sel = spi->chip_select; 216 u8 chip_sel = spi->chip_select;
217 u16 spidat1 = CS_DEFAULT; 217 u16 spidat1 = CS_DEFAULT;
218 bool gpio_chipsel = false;
219 int gpio;
220 218
221 dspi = spi_master_get_devdata(spi->master); 219 dspi = spi_master_get_devdata(spi->master);
222 pdata = &dspi->pdata; 220 pdata = &dspi->pdata;
223 221
224 if (spi->cs_gpio >= 0) {
225 /* SPI core parse and update master->cs_gpio */
226 gpio_chipsel = true;
227 gpio = spi->cs_gpio;
228 }
229
230 /* program delay transfers if tx_delay is non zero */ 222 /* program delay transfers if tx_delay is non zero */
231 if (spicfg->wdelay) 223 if (spicfg->wdelay)
232 spidat1 |= SPIDAT1_WDEL; 224 spidat1 |= SPIDAT1_WDEL;
@@ -235,11 +227,12 @@ static void davinci_spi_chipselect(struct spi_device *spi, int value)
235 * Board specific chip select logic decides the polarity and cs 227 * Board specific chip select logic decides the polarity and cs
236 * line for the controller 228 * line for the controller
237 */ 229 */
238 if (gpio_chipsel) { 230 if (spi->cs_gpio >= 0) {
239 if (value == BITBANG_CS_ACTIVE) 231 if (value == BITBANG_CS_ACTIVE)
240 gpio_set_value(gpio, spi->mode & SPI_CS_HIGH); 232 gpio_set_value(spi->cs_gpio, spi->mode & SPI_CS_HIGH);
241 else 233 else
242 gpio_set_value(gpio, !(spi->mode & SPI_CS_HIGH)); 234 gpio_set_value(spi->cs_gpio,
235 !(spi->mode & SPI_CS_HIGH));
243 } else { 236 } else {
244 if (value == BITBANG_CS_ACTIVE) { 237 if (value == BITBANG_CS_ACTIVE) {
245 spidat1 |= SPIDAT1_CSHOLD_MASK; 238 spidat1 |= SPIDAT1_CSHOLD_MASK;
diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
index 7edede6e024b..a6d7029a85ac 100644
--- a/drivers/spi/spi-dw-mmio.c
+++ b/drivers/spi/spi-dw-mmio.c
@@ -19,6 +19,7 @@
19#include <linux/of.h> 19#include <linux/of.h>
20#include <linux/of_gpio.h> 20#include <linux/of_gpio.h>
21#include <linux/of_platform.h> 21#include <linux/of_platform.h>
22#include <linux/property.h>
22 23
23#include "spi-dw.h" 24#include "spi-dw.h"
24 25
@@ -74,13 +75,11 @@ static int dw_spi_mmio_probe(struct platform_device *pdev)
74 75
75 dws->max_freq = clk_get_rate(dwsmmio->clk); 76 dws->max_freq = clk_get_rate(dwsmmio->clk);
76 77
77 of_property_read_u32(pdev->dev.of_node, "reg-io-width", 78 device_property_read_u32(&pdev->dev, "reg-io-width", &dws->reg_io_width);
78 &dws->reg_io_width);
79 79
80 num_cs = 4; 80 num_cs = 4;
81 81
82 if (pdev->dev.of_node) 82 device_property_read_u32(&pdev->dev, "num-cs", &num_cs);
83 of_property_read_u32(pdev->dev.of_node, "num-cs", &num_cs);
84 83
85 dws->num_cs = num_cs; 84 dws->num_cs = num_cs;
86 85
diff --git a/drivers/spi/spi-dw-pci.c b/drivers/spi/spi-dw-pci.c
index 6d331e0db331..332ccb0539a7 100644
--- a/drivers/spi/spi-dw-pci.c
+++ b/drivers/spi/spi-dw-pci.c
@@ -23,11 +23,6 @@
23 23
24#define DRIVER_NAME "dw_spi_pci" 24#define DRIVER_NAME "dw_spi_pci"
25 25
26struct dw_spi_pci {
27 struct pci_dev *pdev;
28 struct dw_spi dws;
29};
30
31struct spi_pci_desc { 26struct spi_pci_desc {
32 int (*setup)(struct dw_spi *); 27 int (*setup)(struct dw_spi *);
33 u16 num_cs; 28 u16 num_cs;
@@ -48,7 +43,6 @@ static struct spi_pci_desc spi_pci_mid_desc_2 = {
48 43
49static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) 44static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
50{ 45{
51 struct dw_spi_pci *dwpci;
52 struct dw_spi *dws; 46 struct dw_spi *dws;
53 struct spi_pci_desc *desc = (struct spi_pci_desc *)ent->driver_data; 47 struct spi_pci_desc *desc = (struct spi_pci_desc *)ent->driver_data;
54 int pci_bar = 0; 48 int pci_bar = 0;
@@ -58,14 +52,10 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
58 if (ret) 52 if (ret)
59 return ret; 53 return ret;
60 54
61 dwpci = devm_kzalloc(&pdev->dev, sizeof(struct dw_spi_pci), 55 dws = devm_kzalloc(&pdev->dev, sizeof(*dws), GFP_KERNEL);
62 GFP_KERNEL); 56 if (!dws)
63 if (!dwpci)
64 return -ENOMEM; 57 return -ENOMEM;
65 58
66 dwpci->pdev = pdev;
67 dws = &dwpci->dws;
68
69 /* Get basic io resource and map it */ 59 /* Get basic io resource and map it */
70 dws->paddr = pci_resource_start(pdev, pci_bar); 60 dws->paddr = pci_resource_start(pdev, pci_bar);
71 61
@@ -74,7 +64,6 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
74 return ret; 64 return ret;
75 65
76 dws->regs = pcim_iomap_table(pdev)[pci_bar]; 66 dws->regs = pcim_iomap_table(pdev)[pci_bar];
77
78 dws->irq = pdev->irq; 67 dws->irq = pdev->irq;
79 68
80 /* 69 /*
@@ -99,7 +88,7 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
99 return ret; 88 return ret;
100 89
101 /* PCI hook and SPI hook use the same drv data */ 90 /* PCI hook and SPI hook use the same drv data */
102 pci_set_drvdata(pdev, dwpci); 91 pci_set_drvdata(pdev, dws);
103 92
104 dev_info(&pdev->dev, "found PCI SPI controller(ID: %04x:%04x)\n", 93 dev_info(&pdev->dev, "found PCI SPI controller(ID: %04x:%04x)\n",
105 pdev->vendor, pdev->device); 94 pdev->vendor, pdev->device);
@@ -109,26 +98,26 @@ static int spi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
109 98
110static void spi_pci_remove(struct pci_dev *pdev) 99static void spi_pci_remove(struct pci_dev *pdev)
111{ 100{
112 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); 101 struct dw_spi *dws = pci_get_drvdata(pdev);
113 102
114 dw_spi_remove_host(&dwpci->dws); 103 dw_spi_remove_host(dws);
115} 104}
116 105
117#ifdef CONFIG_PM_SLEEP 106#ifdef CONFIG_PM_SLEEP
118static int spi_suspend(struct device *dev) 107static int spi_suspend(struct device *dev)
119{ 108{
120 struct pci_dev *pdev = to_pci_dev(dev); 109 struct pci_dev *pdev = to_pci_dev(dev);
121 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); 110 struct dw_spi *dws = pci_get_drvdata(pdev);
122 111
123 return dw_spi_suspend_host(&dwpci->dws); 112 return dw_spi_suspend_host(dws);
124} 113}
125 114
126static int spi_resume(struct device *dev) 115static int spi_resume(struct device *dev)
127{ 116{
128 struct pci_dev *pdev = to_pci_dev(dev); 117 struct pci_dev *pdev = to_pci_dev(dev);
129 struct dw_spi_pci *dwpci = pci_get_drvdata(pdev); 118 struct dw_spi *dws = pci_get_drvdata(pdev);
130 119
131 return dw_spi_resume_host(&dwpci->dws); 120 return dw_spi_resume_host(dws);
132} 121}
133#endif 122#endif
134 123
diff --git a/drivers/spi/spi-dw.c b/drivers/spi/spi-dw.c
index 4fbfcdc5cb24..882cd6618cd5 100644
--- a/drivers/spi/spi-dw.c
+++ b/drivers/spi/spi-dw.c
@@ -30,19 +30,13 @@
30 30
31/* Slave spi_dev related */ 31/* Slave spi_dev related */
32struct chip_data { 32struct chip_data {
33 u16 cr0;
34 u8 cs; /* chip select pin */ 33 u8 cs; /* chip select pin */
35 u8 n_bytes; /* current is a 1/2/4 byte op */
36 u8 tmode; /* TR/TO/RO/EEPROM */ 34 u8 tmode; /* TR/TO/RO/EEPROM */
37 u8 type; /* SPI/SSP/MicroWire */ 35 u8 type; /* SPI/SSP/MicroWire */
38 36
39 u8 poll_mode; /* 1 means use poll mode */ 37 u8 poll_mode; /* 1 means use poll mode */
40 38
41 u32 dma_width;
42 u32 rx_threshold;
43 u32 tx_threshold;
44 u8 enable_dma; 39 u8 enable_dma;
45 u8 bits_per_word;
46 u16 clk_div; /* baud rate divider */ 40 u16 clk_div; /* baud rate divider */
47 u32 speed_hz; /* baud rate */ 41 u32 speed_hz; /* baud rate */
48 void (*cs_control)(u32 command); 42 void (*cs_control)(u32 command);
@@ -289,14 +283,11 @@ static int dw_spi_transfer_one(struct spi_master *master,
289 struct chip_data *chip = spi_get_ctldata(spi); 283 struct chip_data *chip = spi_get_ctldata(spi);
290 u8 imask = 0; 284 u8 imask = 0;
291 u16 txlevel = 0; 285 u16 txlevel = 0;
292 u16 clk_div = 0; 286 u16 clk_div;
293 u32 speed = 0; 287 u32 cr0;
294 u32 cr0 = 0;
295 int ret; 288 int ret;
296 289
297 dws->dma_mapped = 0; 290 dws->dma_mapped = 0;
298 dws->n_bytes = chip->n_bytes;
299 dws->dma_width = chip->dma_width;
300 291
301 dws->tx = (void *)transfer->tx_buf; 292 dws->tx = (void *)transfer->tx_buf;
302 dws->tx_end = dws->tx + transfer->len; 293 dws->tx_end = dws->tx + transfer->len;
@@ -306,37 +297,30 @@ static int dw_spi_transfer_one(struct spi_master *master,
306 297
307 spi_enable_chip(dws, 0); 298 spi_enable_chip(dws, 0);
308 299
309 cr0 = chip->cr0;
310
311 /* Handle per transfer options for bpw and speed */ 300 /* Handle per transfer options for bpw and speed */
312 if (transfer->speed_hz) { 301 if (transfer->speed_hz != chip->speed_hz) {
313 speed = chip->speed_hz; 302 /* clk_div doesn't support odd number */
314 303 clk_div = (dws->max_freq / transfer->speed_hz + 1) & 0xfffe;
315 if ((transfer->speed_hz != speed) || !chip->clk_div) {
316 speed = transfer->speed_hz;
317
318 /* clk_div doesn't support odd number */
319 clk_div = (dws->max_freq / speed + 1) & 0xfffe;
320 304
321 chip->speed_hz = speed; 305 chip->speed_hz = transfer->speed_hz;
322 chip->clk_div = clk_div; 306 chip->clk_div = clk_div;
323 307
324 spi_set_clk(dws, chip->clk_div); 308 spi_set_clk(dws, chip->clk_div);
325 }
326 } 309 }
327 if (transfer->bits_per_word) { 310 if (transfer->bits_per_word == 8) {
328 if (transfer->bits_per_word == 8) { 311 dws->n_bytes = 1;
329 dws->n_bytes = 1; 312 dws->dma_width = 1;
330 dws->dma_width = 1; 313 } else if (transfer->bits_per_word == 16) {
331 } else if (transfer->bits_per_word == 16) { 314 dws->n_bytes = 2;
332 dws->n_bytes = 2; 315 dws->dma_width = 2;
333 dws->dma_width = 2; 316 } else {
334 } 317 return -EINVAL;
335 cr0 = (transfer->bits_per_word - 1)
336 | (chip->type << SPI_FRF_OFFSET)
337 | (spi->mode << SPI_MODE_OFFSET)
338 | (chip->tmode << SPI_TMOD_OFFSET);
339 } 318 }
319 /* Default SPI mode is SCPOL = 0, SCPH = 0 */
320 cr0 = (transfer->bits_per_word - 1)
321 | (chip->type << SPI_FRF_OFFSET)
322 | (spi->mode << SPI_MODE_OFFSET)
323 | (chip->tmode << SPI_TMOD_OFFSET);
340 324
341 /* 325 /*
342 * Adjust transfer mode if necessary. Requires platform dependent 326 * Adjust transfer mode if necessary. Requires platform dependent
@@ -439,34 +423,9 @@ static int dw_spi_setup(struct spi_device *spi)
439 423
440 chip->poll_mode = chip_info->poll_mode; 424 chip->poll_mode = chip_info->poll_mode;
441 chip->type = chip_info->type; 425 chip->type = chip_info->type;
442
443 chip->rx_threshold = 0;
444 chip->tx_threshold = 0;
445 }
446
447 if (spi->bits_per_word == 8) {
448 chip->n_bytes = 1;
449 chip->dma_width = 1;
450 } else if (spi->bits_per_word == 16) {
451 chip->n_bytes = 2;
452 chip->dma_width = 2;
453 }
454 chip->bits_per_word = spi->bits_per_word;
455
456 if (!spi->max_speed_hz) {
457 dev_err(&spi->dev, "No max speed HZ parameter\n");
458 return -EINVAL;
459 } 426 }
460 427
461 chip->tmode = 0; /* Tx & Rx */ 428 chip->tmode = 0; /* Tx & Rx */
462 /* Default SPI mode is SCPOL = 0, SCPH = 0 */
463 chip->cr0 = (chip->bits_per_word - 1)
464 | (chip->type << SPI_FRF_OFFSET)
465 | (spi->mode << SPI_MODE_OFFSET)
466 | (chip->tmode << SPI_TMOD_OFFSET);
467
468 if (spi->mode & SPI_LOOP)
469 chip->cr0 |= 1 << SPI_SRL_OFFSET;
470 429
471 if (gpio_is_valid(spi->cs_gpio)) { 430 if (gpio_is_valid(spi->cs_gpio)) {
472 ret = gpio_direction_output(spi->cs_gpio, 431 ret = gpio_direction_output(spi->cs_gpio,
@@ -524,13 +483,12 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
524 dws->master = master; 483 dws->master = master;
525 dws->type = SSI_MOTO_SPI; 484 dws->type = SSI_MOTO_SPI;
526 dws->dma_inited = 0; 485 dws->dma_inited = 0;
527 dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60); 486 dws->dma_addr = (dma_addr_t)(dws->paddr + DW_SPI_DR);
528 snprintf(dws->name, sizeof(dws->name), "dw_spi%d", dws->bus_num); 487 snprintf(dws->name, sizeof(dws->name), "dw_spi%d", dws->bus_num);
529 488
530 ret = devm_request_irq(dev, dws->irq, dw_spi_irq, IRQF_SHARED, 489 ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, dws->name, master);
531 dws->name, master);
532 if (ret < 0) { 490 if (ret < 0) {
533 dev_err(&master->dev, "can not get IRQ\n"); 491 dev_err(dev, "can not get IRQ\n");
534 goto err_free_master; 492 goto err_free_master;
535 } 493 }
536 494
@@ -573,6 +531,7 @@ err_dma_exit:
573 if (dws->dma_ops && dws->dma_ops->dma_exit) 531 if (dws->dma_ops && dws->dma_ops->dma_exit)
574 dws->dma_ops->dma_exit(dws); 532 dws->dma_ops->dma_exit(dws);
575 spi_enable_chip(dws, 0); 533 spi_enable_chip(dws, 0);
534 free_irq(dws->irq, master);
576err_free_master: 535err_free_master:
577 spi_master_put(master); 536 spi_master_put(master);
578 return ret; 537 return ret;
@@ -581,28 +540,27 @@ EXPORT_SYMBOL_GPL(dw_spi_add_host);
581 540
582void dw_spi_remove_host(struct dw_spi *dws) 541void dw_spi_remove_host(struct dw_spi *dws)
583{ 542{
584 if (!dws)
585 return;
586 dw_spi_debugfs_remove(dws); 543 dw_spi_debugfs_remove(dws);
587 544
588 if (dws->dma_ops && dws->dma_ops->dma_exit) 545 if (dws->dma_ops && dws->dma_ops->dma_exit)
589 dws->dma_ops->dma_exit(dws); 546 dws->dma_ops->dma_exit(dws);
590 spi_enable_chip(dws, 0); 547
591 /* Disable clk */ 548 spi_shutdown_chip(dws);
592 spi_set_clk(dws, 0); 549
550 free_irq(dws->irq, dws->master);
593} 551}
594EXPORT_SYMBOL_GPL(dw_spi_remove_host); 552EXPORT_SYMBOL_GPL(dw_spi_remove_host);
595 553
596int dw_spi_suspend_host(struct dw_spi *dws) 554int dw_spi_suspend_host(struct dw_spi *dws)
597{ 555{
598 int ret = 0; 556 int ret;
599 557
600 ret = spi_master_suspend(dws->master); 558 ret = spi_master_suspend(dws->master);
601 if (ret) 559 if (ret)
602 return ret; 560 return ret;
603 spi_enable_chip(dws, 0); 561
604 spi_set_clk(dws, 0); 562 spi_shutdown_chip(dws);
605 return ret; 563 return 0;
606} 564}
607EXPORT_SYMBOL_GPL(dw_spi_suspend_host); 565EXPORT_SYMBOL_GPL(dw_spi_suspend_host);
608 566
diff --git a/drivers/spi/spi-dw.h b/drivers/spi/spi-dw.h
index b75ed327d5a2..35589a270468 100644
--- a/drivers/spi/spi-dw.h
+++ b/drivers/spi/spi-dw.h
@@ -225,6 +225,12 @@ static inline void spi_reset_chip(struct dw_spi *dws)
225 spi_enable_chip(dws, 1); 225 spi_enable_chip(dws, 1);
226} 226}
227 227
228static inline void spi_shutdown_chip(struct dw_spi *dws)
229{
230 spi_enable_chip(dws, 0);
231 spi_set_clk(dws, 0);
232}
233
228/* 234/*
229 * Each SPI slave device to work with dw_api controller should 235 * Each SPI slave device to work with dw_api controller should
230 * has such a structure claiming its working mode (poll or PIO/DMA), 236 * has such a structure claiming its working mode (poll or PIO/DMA),
diff --git a/drivers/spi/spi-fsl-dspi.c b/drivers/spi/spi-fsl-dspi.c
index 86bcdd68c1fe..59a11437db70 100644
--- a/drivers/spi/spi-fsl-dspi.c
+++ b/drivers/spi/spi-fsl-dspi.c
@@ -409,9 +409,6 @@ static int dspi_transfer_one_message(struct spi_master *master,
409 SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF); 409 SPI_MCR_CLR_TXF | SPI_MCR_CLR_RXF);
410 regmap_write(dspi->regmap, SPI_CTAR(dspi->cs), 410 regmap_write(dspi->regmap, SPI_CTAR(dspi->cs),
411 dspi->cur_chip->ctar_val); 411 dspi->cur_chip->ctar_val);
412 if (transfer->speed_hz)
413 regmap_write(dspi->regmap, SPI_CTAR(dspi->cs),
414 dspi->cur_chip->ctar_val);
415 412
416 trans_mode = dspi->devtype_data->trans_mode; 413 trans_mode = dspi->devtype_data->trans_mode;
417 switch (trans_mode) { 414 switch (trans_mode) {
diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
index f9deb84e4e55..0e5723ab47f0 100644
--- a/drivers/spi/spi-imx.c
+++ b/drivers/spi/spi-imx.c
@@ -336,13 +336,20 @@ static int __maybe_unused mx51_ecspi_config(struct spi_imx_data *spi_imx,
336 336
337 if (config->mode & SPI_CPHA) 337 if (config->mode & SPI_CPHA)
338 cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs); 338 cfg |= MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
339 else
340 cfg &= ~MX51_ECSPI_CONFIG_SCLKPHA(config->cs);
339 341
340 if (config->mode & SPI_CPOL) { 342 if (config->mode & SPI_CPOL) {
341 cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs); 343 cfg |= MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
342 cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs); 344 cfg |= MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
345 } else {
346 cfg &= ~MX51_ECSPI_CONFIG_SCLKPOL(config->cs);
347 cfg &= ~MX51_ECSPI_CONFIG_SCLKCTL(config->cs);
343 } 348 }
344 if (config->mode & SPI_CS_HIGH) 349 if (config->mode & SPI_CS_HIGH)
345 cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs); 350 cfg |= MX51_ECSPI_CONFIG_SSBPOL(config->cs);
351 else
352 cfg &= ~MX51_ECSPI_CONFIG_SSBPOL(config->cs);
346 353
347 writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL); 354 writel(ctrl, spi_imx->base + MX51_ECSPI_CTRL);
348 writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG); 355 writel(cfg, spi_imx->base + MX51_ECSPI_CONFIG);
diff --git a/drivers/spi/spi-mpc512x-psc.c b/drivers/spi/spi-mpc512x-psc.c
index 1e75341689a6..c3ec46cd9f91 100644
--- a/drivers/spi/spi-mpc512x-psc.c
+++ b/drivers/spi/spi-mpc512x-psc.c
@@ -302,11 +302,9 @@ static int mpc512x_psc_spi_msg_xfer(struct spi_master *master,
302 cs_change = 1; 302 cs_change = 1;
303 status = 0; 303 status = 0;
304 list_for_each_entry(t, &m->transfers, transfer_list) { 304 list_for_each_entry(t, &m->transfers, transfer_list) {
305 if (t->bits_per_word || t->speed_hz) { 305 status = mpc512x_psc_spi_transfer_setup(spi, t);
306 status = mpc512x_psc_spi_transfer_setup(spi, t); 306 if (status < 0)
307 if (status < 0) 307 break;
308 break;
309 }
310 308
311 if (cs_change) 309 if (cs_change)
312 mpc512x_psc_spi_activate_cs(spi); 310 mpc512x_psc_spi_activate_cs(spi);
diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c
index ecb6c58238c4..563954a61424 100644
--- a/drivers/spi/spi-mt65xx.c
+++ b/drivers/spi/spi-mt65xx.c
@@ -20,6 +20,7 @@
20#include <linux/ioport.h> 20#include <linux/ioport.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/of_gpio.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24#include <linux/platform_data/spi-mt65xx.h> 25#include <linux/platform_data/spi-mt65xx.h>
25#include <linux/pm_runtime.h> 26#include <linux/pm_runtime.h>
@@ -84,7 +85,8 @@ struct mtk_spi_compatible {
84struct mtk_spi { 85struct mtk_spi {
85 void __iomem *base; 86 void __iomem *base;
86 u32 state; 87 u32 state;
87 u32 pad_sel; 88 int pad_num;
89 u32 *pad_sel;
88 struct clk *parent_clk, *sel_clk, *spi_clk; 90 struct clk *parent_clk, *sel_clk, *spi_clk;
89 struct spi_transfer *cur_transfer; 91 struct spi_transfer *cur_transfer;
90 u32 xfer_len; 92 u32 xfer_len;
@@ -131,10 +133,28 @@ static void mtk_spi_reset(struct mtk_spi *mdata)
131 writel(reg_val, mdata->base + SPI_CMD_REG); 133 writel(reg_val, mdata->base + SPI_CMD_REG);
132} 134}
133 135
134static void mtk_spi_config(struct mtk_spi *mdata, 136static int mtk_spi_prepare_message(struct spi_master *master,
135 struct mtk_chip_config *chip_config) 137 struct spi_message *msg)
136{ 138{
139 u16 cpha, cpol;
137 u32 reg_val; 140 u32 reg_val;
141 struct spi_device *spi = msg->spi;
142 struct mtk_chip_config *chip_config = spi->controller_data;
143 struct mtk_spi *mdata = spi_master_get_devdata(master);
144
145 cpha = spi->mode & SPI_CPHA ? 1 : 0;
146 cpol = spi->mode & SPI_CPOL ? 1 : 0;
147
148 reg_val = readl(mdata->base + SPI_CMD_REG);
149 if (cpha)
150 reg_val |= SPI_CMD_CPHA;
151 else
152 reg_val &= ~SPI_CMD_CPHA;
153 if (cpol)
154 reg_val |= SPI_CMD_CPOL;
155 else
156 reg_val &= ~SPI_CMD_CPOL;
157 writel(reg_val, mdata->base + SPI_CMD_REG);
138 158
139 reg_val = readl(mdata->base + SPI_CMD_REG); 159 reg_val = readl(mdata->base + SPI_CMD_REG);
140 160
@@ -170,38 +190,8 @@ static void mtk_spi_config(struct mtk_spi *mdata,
170 190
171 /* pad select */ 191 /* pad select */
172 if (mdata->dev_comp->need_pad_sel) 192 if (mdata->dev_comp->need_pad_sel)
173 writel(mdata->pad_sel, mdata->base + SPI_PAD_SEL_REG); 193 writel(mdata->pad_sel[spi->chip_select],
174} 194 mdata->base + SPI_PAD_SEL_REG);
175
176static int mtk_spi_prepare_message(struct spi_master *master,
177 struct spi_message *msg)
178{
179 u32 reg_val;
180 u8 cpha, cpol;
181 struct mtk_chip_config *chip_config;
182 struct spi_device *spi = msg->spi;
183 struct mtk_spi *mdata = spi_master_get_devdata(master);
184
185 cpha = spi->mode & SPI_CPHA ? 1 : 0;
186 cpol = spi->mode & SPI_CPOL ? 1 : 0;
187
188 reg_val = readl(mdata->base + SPI_CMD_REG);
189 if (cpha)
190 reg_val |= SPI_CMD_CPHA;
191 else
192 reg_val &= ~SPI_CMD_CPHA;
193 if (cpol)
194 reg_val |= SPI_CMD_CPOL;
195 else
196 reg_val &= ~SPI_CMD_CPOL;
197 writel(reg_val, mdata->base + SPI_CMD_REG);
198
199 chip_config = spi->controller_data;
200 if (!chip_config) {
201 chip_config = (void *)&mtk_default_chip_info;
202 spi->controller_data = chip_config;
203 }
204 mtk_spi_config(mdata, chip_config);
205 195
206 return 0; 196 return 0;
207} 197}
@@ -413,6 +403,19 @@ static bool mtk_spi_can_dma(struct spi_master *master,
413 return xfer->len > MTK_SPI_MAX_FIFO_SIZE; 403 return xfer->len > MTK_SPI_MAX_FIFO_SIZE;
414} 404}
415 405
406static int mtk_spi_setup(struct spi_device *spi)
407{
408 struct mtk_spi *mdata = spi_master_get_devdata(spi->master);
409
410 if (!spi->controller_data)
411 spi->controller_data = (void *)&mtk_default_chip_info;
412
413 if (mdata->dev_comp->need_pad_sel)
414 gpio_direction_output(spi->cs_gpio, !(spi->mode & SPI_CS_HIGH));
415
416 return 0;
417}
418
416static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) 419static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
417{ 420{
418 u32 cmd, reg_val, cnt; 421 u32 cmd, reg_val, cnt;
@@ -484,7 +487,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
484 struct mtk_spi *mdata; 487 struct mtk_spi *mdata;
485 const struct of_device_id *of_id; 488 const struct of_device_id *of_id;
486 struct resource *res; 489 struct resource *res;
487 int irq, ret; 490 int i, irq, ret;
488 491
489 master = spi_alloc_master(&pdev->dev, sizeof(*mdata)); 492 master = spi_alloc_master(&pdev->dev, sizeof(*mdata));
490 if (!master) { 493 if (!master) {
@@ -500,6 +503,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
500 master->prepare_message = mtk_spi_prepare_message; 503 master->prepare_message = mtk_spi_prepare_message;
501 master->transfer_one = mtk_spi_transfer_one; 504 master->transfer_one = mtk_spi_transfer_one;
502 master->can_dma = mtk_spi_can_dma; 505 master->can_dma = mtk_spi_can_dma;
506 master->setup = mtk_spi_setup;
503 507
504 of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node); 508 of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node);
505 if (!of_id) { 509 if (!of_id) {
@@ -514,21 +518,34 @@ static int mtk_spi_probe(struct platform_device *pdev)
514 master->flags = SPI_MASTER_MUST_TX; 518 master->flags = SPI_MASTER_MUST_TX;
515 519
516 if (mdata->dev_comp->need_pad_sel) { 520 if (mdata->dev_comp->need_pad_sel) {
517 ret = of_property_read_u32(pdev->dev.of_node, 521 mdata->pad_num = of_property_count_u32_elems(
518 "mediatek,pad-select", 522 pdev->dev.of_node,
519 &mdata->pad_sel); 523 "mediatek,pad-select");
520 if (ret) { 524 if (mdata->pad_num < 0) {
521 dev_err(&pdev->dev, "failed to read pad select: %d\n", 525 dev_err(&pdev->dev,
522 ret); 526 "No 'mediatek,pad-select' property\n");
527 ret = -EINVAL;
523 goto err_put_master; 528 goto err_put_master;
524 } 529 }
525 530
526 if (mdata->pad_sel > MT8173_SPI_MAX_PAD_SEL) { 531 mdata->pad_sel = devm_kmalloc_array(&pdev->dev, mdata->pad_num,
527 dev_err(&pdev->dev, "wrong pad-select: %u\n", 532 sizeof(u32), GFP_KERNEL);
528 mdata->pad_sel); 533 if (!mdata->pad_sel) {
529 ret = -EINVAL; 534 ret = -ENOMEM;
530 goto err_put_master; 535 goto err_put_master;
531 } 536 }
537
538 for (i = 0; i < mdata->pad_num; i++) {
539 of_property_read_u32_index(pdev->dev.of_node,
540 "mediatek,pad-select",
541 i, &mdata->pad_sel[i]);
542 if (mdata->pad_sel[i] > MT8173_SPI_MAX_PAD_SEL) {
543 dev_err(&pdev->dev, "wrong pad-sel[%d]: %u\n",
544 i, mdata->pad_sel[i]);
545 ret = -EINVAL;
546 goto err_put_master;
547 }
548 }
532 } 549 }
533 550
534 platform_set_drvdata(pdev, master); 551 platform_set_drvdata(pdev, master);
@@ -606,6 +623,26 @@ static int mtk_spi_probe(struct platform_device *pdev)
606 goto err_put_master; 623 goto err_put_master;
607 } 624 }
608 625
626 if (mdata->dev_comp->need_pad_sel) {
627 if (mdata->pad_num != master->num_chipselect) {
628 dev_err(&pdev->dev,
629 "pad_num does not match num_chipselect(%d != %d)\n",
630 mdata->pad_num, master->num_chipselect);
631 ret = -EINVAL;
632 goto err_put_master;
633 }
634
635 for (i = 0; i < master->num_chipselect; i++) {
636 ret = devm_gpio_request(&pdev->dev, master->cs_gpios[i],
637 dev_name(&pdev->dev));
638 if (ret) {
639 dev_err(&pdev->dev,
640 "can't get CS GPIO %i\n", i);
641 goto err_put_master;
642 }
643 }
644 }
645
609 return 0; 646 return 0;
610 647
611err_disable_clk: 648err_disable_clk:
diff --git a/drivers/spi/spi-oc-tiny.c b/drivers/spi/spi-oc-tiny.c
index 76656a77ec12..b5911282a611 100644
--- a/drivers/spi/spi-oc-tiny.c
+++ b/drivers/spi/spi-oc-tiny.c
@@ -207,8 +207,7 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
207 struct tiny_spi *hw = platform_get_drvdata(pdev); 207 struct tiny_spi *hw = platform_get_drvdata(pdev);
208 struct device_node *np = pdev->dev.of_node; 208 struct device_node *np = pdev->dev.of_node;
209 unsigned int i; 209 unsigned int i;
210 const __be32 *val; 210 u32 val;
211 int len;
212 211
213 if (!np) 212 if (!np)
214 return 0; 213 return 0;
@@ -226,13 +225,10 @@ static int tiny_spi_of_probe(struct platform_device *pdev)
226 return -ENODEV; 225 return -ENODEV;
227 } 226 }
228 hw->bitbang.master->dev.of_node = pdev->dev.of_node; 227 hw->bitbang.master->dev.of_node = pdev->dev.of_node;
229 val = of_get_property(pdev->dev.of_node, 228 if (!of_property_read_u32(np, "clock-frequency", &val))
230 "clock-frequency", &len); 229 hw->freq = val;
231 if (val && len >= sizeof(__be32)) 230 if (!of_property_read_u32(np, "baud-width", &val))
232 hw->freq = be32_to_cpup(val); 231 hw->baudwidth = val;
233 val = of_get_property(pdev->dev.of_node, "baud-width", &len);
234 if (val && len >= sizeof(__be32))
235 hw->baudwidth = be32_to_cpup(val);
236 return 0; 232 return 0;
237} 233}
238#else /* !CONFIG_OF */ 234#else /* !CONFIG_OF */
diff --git a/drivers/spi/spi-octeon.c b/drivers/spi/spi-octeon.c
index e99d6a93d394..07e4ce8273df 100644
--- a/drivers/spi/spi-octeon.c
+++ b/drivers/spi/spi-octeon.c
@@ -65,7 +65,7 @@ static int octeon_spi_do_transfer(struct octeon_spi *p,
65 cpha = mode & SPI_CPHA; 65 cpha = mode & SPI_CPHA;
66 cpol = mode & SPI_CPOL; 66 cpol = mode & SPI_CPOL;
67 67
68 speed_hz = xfer->speed_hz ? : spi->max_speed_hz; 68 speed_hz = xfer->speed_hz;
69 69
70 clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz); 70 clkdiv = octeon_get_io_clock_rate() / (2 * speed_hz);
71 71
diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
index 35b332dacb13..76a8425be227 100644
--- a/drivers/spi/spi-omap-100k.c
+++ b/drivers/spi/spi-omap-100k.c
@@ -244,12 +244,12 @@ static int omap1_spi100k_setup_transfer(struct spi_device *spi,
244{ 244{
245 struct omap1_spi100k *spi100k = spi_master_get_devdata(spi->master); 245 struct omap1_spi100k *spi100k = spi_master_get_devdata(spi->master);
246 struct omap1_spi100k_cs *cs = spi->controller_state; 246 struct omap1_spi100k_cs *cs = spi->controller_state;
247 u8 word_len = spi->bits_per_word; 247 u8 word_len;
248 248
249 if (t != NULL && t->bits_per_word) 249 if (t != NULL)
250 word_len = t->bits_per_word; 250 word_len = t->bits_per_word;
251 if (!word_len) 251 else
252 word_len = 8; 252 word_len = spi->bits_per_word;
253 253
254 if (spi->bits_per_word > 32) 254 if (spi->bits_per_word > 32)
255 return -EINVAL; 255 return -EINVAL;
@@ -302,7 +302,6 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master,
302 struct spi_device *spi = m->spi; 302 struct spi_device *spi = m->spi;
303 struct spi_transfer *t = NULL; 303 struct spi_transfer *t = NULL;
304 int cs_active = 0; 304 int cs_active = 0;
305 int par_override = 0;
306 int status = 0; 305 int status = 0;
307 306
308 list_for_each_entry(t, &m->transfers, transfer_list) { 307 list_for_each_entry(t, &m->transfers, transfer_list) {
@@ -310,14 +309,9 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master,
310 status = -EINVAL; 309 status = -EINVAL;
311 break; 310 break;
312 } 311 }
313 if (par_override || t->speed_hz || t->bits_per_word) { 312 status = omap1_spi100k_setup_transfer(spi, t);
314 par_override = 1; 313 if (status < 0)
315 status = omap1_spi100k_setup_transfer(spi, t); 314 break;
316 if (status < 0)
317 break;
318 if (!t->speed_hz && !t->bits_per_word)
319 par_override = 0;
320 }
321 315
322 if (!cs_active) { 316 if (!cs_active) {
323 omap1_spi100k_force_cs(spi100k, 1); 317 omap1_spi100k_force_cs(spi100k, 1);
@@ -347,11 +341,7 @@ static int omap1_spi100k_transfer_one_message(struct spi_master *master,
347 } 341 }
348 } 342 }
349 343
350 /* Restore defaults if they were overriden */ 344 status = omap1_spi100k_setup_transfer(spi, NULL);
351 if (par_override) {
352 par_override = 0;
353 status = omap1_spi100k_setup_transfer(spi, NULL);
354 }
355 345
356 if (cs_active) 346 if (cs_active)
357 omap1_spi100k_force_cs(spi100k, 0); 347 omap1_spi100k_force_cs(spi100k, 0);
diff --git a/drivers/spi/spi-omap-uwire.c b/drivers/spi/spi-omap-uwire.c
index 55576db31549..ce8dbdbce312 100644
--- a/drivers/spi/spi-omap-uwire.c
+++ b/drivers/spi/spi-omap-uwire.c
@@ -205,7 +205,7 @@ static void uwire_chipselect(struct spi_device *spi, int value)
205static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t) 205static int uwire_txrx(struct spi_device *spi, struct spi_transfer *t)
206{ 206{
207 unsigned len = t->len; 207 unsigned len = t->len;
208 unsigned bits = t->bits_per_word ? : spi->bits_per_word; 208 unsigned bits = t->bits_per_word;
209 unsigned bytes; 209 unsigned bytes;
210 u16 val, w; 210 u16 val, w;
211 int status = 0; 211 int status = 0;
@@ -344,9 +344,10 @@ static int uwire_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
344 /* assume it's already enabled */ 344 /* assume it's already enabled */
345 rate = clk_get_rate(uwire->ck); 345 rate = clk_get_rate(uwire->ck);
346 346
347 hz = spi->max_speed_hz; 347 if (t != NULL)
348 if (t != NULL && t->speed_hz)
349 hz = t->speed_hz; 348 hz = t->speed_hz;
349 else
350 hz = spi->max_speed_hz;
350 351
351 if (!hz) { 352 if (!hz) {
352 pr_debug("%s: zero speed?\n", dev_name(&spi->dev)); 353 pr_debug("%s: zero speed?\n", dev_name(&spi->dev));
diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c
index 3d09e0b69b73..1f8903d356e5 100644
--- a/drivers/spi/spi-omap2-mcspi.c
+++ b/drivers/spi/spi-omap2-mcspi.c
@@ -1217,6 +1217,33 @@ out:
1217 return status; 1217 return status;
1218} 1218}
1219 1219
1220static int omap2_mcspi_prepare_message(struct spi_master *master,
1221 struct spi_message *msg)
1222{
1223 struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
1224 struct omap2_mcspi_regs *ctx = &mcspi->ctx;
1225 struct omap2_mcspi_cs *cs;
1226
1227 /* Only a single channel can have the FORCE bit enabled
1228 * in its chconf0 register.
1229 * Scan all channels and disable them except the current one.
1230 * A FORCE can remain from a last transfer having cs_change enabled
1231 */
1232 list_for_each_entry(cs, &ctx->cs, node) {
1233 if (msg->spi->controller_state == cs)
1234 continue;
1235
1236 if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE)) {
1237 cs->chconf0 &= ~OMAP2_MCSPI_CHCONF_FORCE;
1238 writel_relaxed(cs->chconf0,
1239 cs->base + OMAP2_MCSPI_CHCONF0);
1240 readl_relaxed(cs->base + OMAP2_MCSPI_CHCONF0);
1241 }
1242 }
1243
1244 return 0;
1245}
1246
1220static int omap2_mcspi_transfer_one(struct spi_master *master, 1247static int omap2_mcspi_transfer_one(struct spi_master *master,
1221 struct spi_device *spi, struct spi_transfer *t) 1248 struct spi_device *spi, struct spi_transfer *t)
1222{ 1249{
@@ -1344,6 +1371,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
1344 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32); 1371 master->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
1345 master->setup = omap2_mcspi_setup; 1372 master->setup = omap2_mcspi_setup;
1346 master->auto_runtime_pm = true; 1373 master->auto_runtime_pm = true;
1374 master->prepare_message = omap2_mcspi_prepare_message;
1347 master->transfer_one = omap2_mcspi_transfer_one; 1375 master->transfer_one = omap2_mcspi_transfer_one;
1348 master->set_cs = omap2_mcspi_set_cs; 1376 master->set_cs = omap2_mcspi_set_cs;
1349 master->cleanup = omap2_mcspi_cleanup; 1377 master->cleanup = omap2_mcspi_cleanup;
diff --git a/drivers/spi/spi-ppc4xx.c b/drivers/spi/spi-ppc4xx.c
index 54fb984a3e17..dd3d0a218d8b 100644
--- a/drivers/spi/spi-ppc4xx.c
+++ b/drivers/spi/spi-ppc4xx.c
@@ -210,12 +210,12 @@ static int spi_ppc4xx_setupxfer(struct spi_device *spi, struct spi_transfer *t)
210 if (in_8(&hw->regs->cdm) != cdm) 210 if (in_8(&hw->regs->cdm) != cdm)
211 out_8(&hw->regs->cdm, cdm); 211 out_8(&hw->regs->cdm, cdm);
212 212
213 spin_lock(&hw->bitbang.lock); 213 mutex_lock(&hw->bitbang.lock);
214 if (!hw->bitbang.busy) { 214 if (!hw->bitbang.busy) {
215 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); 215 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);
216 /* Need to ndelay here? */ 216 /* Need to ndelay here? */
217 } 217 }
218 spin_unlock(&hw->bitbang.lock); 218 mutex_unlock(&hw->bitbang.lock);
219 219
220 return 0; 220 return 0;
221} 221}
diff --git a/drivers/spi/spi-pxa2xx-dma.c b/drivers/spi/spi-pxa2xx-dma.c
index 66a173939be8..bd8b369a343c 100644
--- a/drivers/spi/spi-pxa2xx-dma.c
+++ b/drivers/spi/spi-pxa2xx-dma.c
@@ -344,10 +344,6 @@ void pxa2xx_spi_dma_release(struct driver_data *drv_data)
344 } 344 }
345} 345}
346 346
347void pxa2xx_spi_dma_resume(struct driver_data *drv_data)
348{
349}
350
351int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, 347int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip,
352 struct spi_device *spi, 348 struct spi_device *spi,
353 u8 bits_per_word, u32 *burst_code, 349 u8 bits_per_word, u32 *burst_code,
diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index a8ef38ebb9c9..b25dc71b0ea9 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -13,6 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 */ 14 */
15 15
16#include <linux/bitops.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/module.h> 18#include <linux/module.h>
18#include <linux/device.h> 19#include <linux/device.h>
@@ -61,9 +62,13 @@ MODULE_ALIAS("platform:pxa2xx-spi");
61 | QUARK_X1000_SSCR1_TFT \ 62 | QUARK_X1000_SSCR1_TFT \
62 | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM) 63 | SSCR1_SPH | SSCR1_SPO | SSCR1_LBM)
63 64
64#define GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24) 65#define LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE BIT(24)
65#define SPI_CS_CONTROL_SW_MODE BIT(0) 66#define LPSS_CS_CONTROL_SW_MODE BIT(0)
66#define SPI_CS_CONTROL_CS_HIGH BIT(1) 67#define LPSS_CS_CONTROL_CS_HIGH BIT(1)
68#define LPSS_CS_CONTROL_CS_SEL_SHIFT 8
69#define LPSS_CS_CONTROL_CS_SEL_MASK (3 << LPSS_CS_CONTROL_CS_SEL_SHIFT)
70#define LPSS_CAPS_CS_EN_SHIFT 9
71#define LPSS_CAPS_CS_EN_MASK (0xf << LPSS_CAPS_CS_EN_SHIFT)
67 72
68struct lpss_config { 73struct lpss_config {
69 /* LPSS offset from drv_data->ioaddr */ 74 /* LPSS offset from drv_data->ioaddr */
@@ -72,6 +77,7 @@ struct lpss_config {
72 int reg_general; 77 int reg_general;
73 int reg_ssp; 78 int reg_ssp;
74 int reg_cs_ctrl; 79 int reg_cs_ctrl;
80 int reg_capabilities;
75 /* FIFO thresholds */ 81 /* FIFO thresholds */
76 u32 rx_threshold; 82 u32 rx_threshold;
77 u32 tx_threshold_lo; 83 u32 tx_threshold_lo;
@@ -85,6 +91,7 @@ static const struct lpss_config lpss_platforms[] = {
85 .reg_general = 0x08, 91 .reg_general = 0x08,
86 .reg_ssp = 0x0c, 92 .reg_ssp = 0x0c,
87 .reg_cs_ctrl = 0x18, 93 .reg_cs_ctrl = 0x18,
94 .reg_capabilities = -1,
88 .rx_threshold = 64, 95 .rx_threshold = 64,
89 .tx_threshold_lo = 160, 96 .tx_threshold_lo = 160,
90 .tx_threshold_hi = 224, 97 .tx_threshold_hi = 224,
@@ -94,6 +101,7 @@ static const struct lpss_config lpss_platforms[] = {
94 .reg_general = 0x08, 101 .reg_general = 0x08,
95 .reg_ssp = 0x0c, 102 .reg_ssp = 0x0c,
96 .reg_cs_ctrl = 0x18, 103 .reg_cs_ctrl = 0x18,
104 .reg_capabilities = -1,
97 .rx_threshold = 64, 105 .rx_threshold = 64,
98 .tx_threshold_lo = 160, 106 .tx_threshold_lo = 160,
99 .tx_threshold_hi = 224, 107 .tx_threshold_hi = 224,
@@ -103,10 +111,21 @@ static const struct lpss_config lpss_platforms[] = {
103 .reg_general = -1, 111 .reg_general = -1,
104 .reg_ssp = 0x20, 112 .reg_ssp = 0x20,
105 .reg_cs_ctrl = 0x24, 113 .reg_cs_ctrl = 0x24,
114 .reg_capabilities = 0xfc,
106 .rx_threshold = 1, 115 .rx_threshold = 1,
107 .tx_threshold_lo = 32, 116 .tx_threshold_lo = 32,
108 .tx_threshold_hi = 56, 117 .tx_threshold_hi = 56,
109 }, 118 },
119 { /* LPSS_BXT_SSP */
120 .offset = 0x200,
121 .reg_general = -1,
122 .reg_ssp = 0x20,
123 .reg_cs_ctrl = 0x24,
124 .reg_capabilities = 0xfc,
125 .rx_threshold = 1,
126 .tx_threshold_lo = 16,
127 .tx_threshold_hi = 48,
128 },
110}; 129};
111 130
112static inline const struct lpss_config 131static inline const struct lpss_config
@@ -121,6 +140,7 @@ static bool is_lpss_ssp(const struct driver_data *drv_data)
121 case LPSS_LPT_SSP: 140 case LPSS_LPT_SSP:
122 case LPSS_BYT_SSP: 141 case LPSS_BYT_SSP:
123 case LPSS_SPT_SSP: 142 case LPSS_SPT_SSP:
143 case LPSS_BXT_SSP:
124 return true; 144 return true;
125 default: 145 default:
126 return false; 146 return false;
@@ -249,7 +269,9 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
249 drv_data->lpss_base = drv_data->ioaddr + config->offset; 269 drv_data->lpss_base = drv_data->ioaddr + config->offset;
250 270
251 /* Enable software chip select control */ 271 /* Enable software chip select control */
252 value = SPI_CS_CONTROL_SW_MODE | SPI_CS_CONTROL_CS_HIGH; 272 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl);
273 value &= ~(LPSS_CS_CONTROL_SW_MODE | LPSS_CS_CONTROL_CS_HIGH);
274 value |= LPSS_CS_CONTROL_SW_MODE | LPSS_CS_CONTROL_CS_HIGH;
253 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); 275 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value);
254 276
255 /* Enable multiblock DMA transfers */ 277 /* Enable multiblock DMA transfers */
@@ -259,7 +281,7 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
259 if (config->reg_general >= 0) { 281 if (config->reg_general >= 0) {
260 value = __lpss_ssp_read_priv(drv_data, 282 value = __lpss_ssp_read_priv(drv_data,
261 config->reg_general); 283 config->reg_general);
262 value |= GENERAL_REG_RXTO_HOLDOFF_DISABLE; 284 value |= LPSS_GENERAL_REG_RXTO_HOLDOFF_DISABLE;
263 __lpss_ssp_write_priv(drv_data, 285 __lpss_ssp_write_priv(drv_data,
264 config->reg_general, value); 286 config->reg_general, value);
265 } 287 }
@@ -269,15 +291,34 @@ static void lpss_ssp_setup(struct driver_data *drv_data)
269static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable) 291static void lpss_ssp_cs_control(struct driver_data *drv_data, bool enable)
270{ 292{
271 const struct lpss_config *config; 293 const struct lpss_config *config;
272 u32 value; 294 u32 value, cs;
273 295
274 config = lpss_get_config(drv_data); 296 config = lpss_get_config(drv_data);
275 297
276 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl); 298 value = __lpss_ssp_read_priv(drv_data, config->reg_cs_ctrl);
277 if (enable) 299 if (enable) {
278 value &= ~SPI_CS_CONTROL_CS_HIGH; 300 cs = drv_data->cur_msg->spi->chip_select;
279 else 301 cs <<= LPSS_CS_CONTROL_CS_SEL_SHIFT;
280 value |= SPI_CS_CONTROL_CS_HIGH; 302 if (cs != (value & LPSS_CS_CONTROL_CS_SEL_MASK)) {
303 /*
304 * When switching another chip select output active
305 * the output must be selected first and wait 2 ssp_clk
306 * cycles before changing state to active. Otherwise
307 * a short glitch will occur on the previous chip
308 * select since output select is latched but state
309 * control is not.
310 */
311 value &= ~LPSS_CS_CONTROL_CS_SEL_MASK;
312 value |= cs;
313 __lpss_ssp_write_priv(drv_data,
314 config->reg_cs_ctrl, value);
315 ndelay(1000000000 /
316 (drv_data->master->max_speed_hz / 2));
317 }
318 value &= ~LPSS_CS_CONTROL_CS_HIGH;
319 } else {
320 value |= LPSS_CS_CONTROL_CS_HIGH;
321 }
281 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value); 322 __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value);
282} 323}
283 324
@@ -734,7 +775,7 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
734 mul = (1 << 24) >> 1; 775 mul = (1 << 24) >> 1;
735 776
736 /* Calculate initial quot */ 777 /* Calculate initial quot */
737 q1 = DIV_ROUND_CLOSEST(fref1, rate); 778 q1 = DIV_ROUND_UP(fref1, rate);
738 779
739 /* Scale q1 if it's too big */ 780 /* Scale q1 if it's too big */
740 if (q1 > 256) { 781 if (q1 > 256) {
@@ -759,7 +800,7 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
759 800
760 /* Case 2 */ 801 /* Case 2 */
761 802
762 q2 = DIV_ROUND_CLOSEST(fref2, rate); 803 q2 = DIV_ROUND_UP(fref2, rate);
763 r2 = abs(fref2 / q2 - rate); 804 r2 = abs(fref2 / q2 - rate);
764 805
765 /* 806 /*
@@ -778,13 +819,13 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
778 mul = (1 << 24) * 2 / 5; 819 mul = (1 << 24) * 2 / 5;
779 } 820 }
780 821
781 /* Check case 3 only If the divisor is big enough */ 822 /* Check case 3 only if the divisor is big enough */
782 if (fref / rate >= 80) { 823 if (fref / rate >= 80) {
783 u64 fssp; 824 u64 fssp;
784 u32 m; 825 u32 m;
785 826
786 /* Calculate initial quot */ 827 /* Calculate initial quot */
787 q1 = DIV_ROUND_CLOSEST(fref, rate); 828 q1 = DIV_ROUND_UP(fref, rate);
788 m = (1 << 24) / q1; 829 m = (1 << 24) / q1;
789 830
790 /* Get the remainder */ 831 /* Get the remainder */
@@ -806,7 +847,7 @@ static unsigned int quark_x1000_get_clk_div(int rate, u32 *dds)
806 847
807static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate) 848static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
808{ 849{
809 unsigned long ssp_clk = drv_data->max_clk_rate; 850 unsigned long ssp_clk = drv_data->master->max_speed_hz;
810 const struct ssp_device *ssp = drv_data->ssp; 851 const struct ssp_device *ssp = drv_data->ssp;
811 852
812 rate = min_t(int, ssp_clk, rate); 853 rate = min_t(int, ssp_clk, rate);
@@ -818,8 +859,9 @@ static unsigned int ssp_get_clk_div(struct driver_data *drv_data, int rate)
818} 859}
819 860
820static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data, 861static unsigned int pxa2xx_ssp_get_clk_div(struct driver_data *drv_data,
821 struct chip_data *chip, int rate) 862 int rate)
822{ 863{
864 struct chip_data *chip = drv_data->cur_chip;
823 unsigned int clk_div; 865 unsigned int clk_div;
824 866
825 switch (drv_data->ssp_type) { 867 switch (drv_data->ssp_type) {
@@ -922,52 +964,55 @@ static void pump_transfers(unsigned long data)
922 drv_data->read = drv_data->rx ? chip->read : null_reader; 964 drv_data->read = drv_data->rx ? chip->read : null_reader;
923 965
924 /* Change speed and bit per word on a per transfer */ 966 /* Change speed and bit per word on a per transfer */
925 cr0 = chip->cr0; 967 bits = transfer->bits_per_word;
926 if (transfer->speed_hz || transfer->bits_per_word) { 968 speed = transfer->speed_hz;
927 969
928 bits = chip->bits_per_word; 970 clk_div = pxa2xx_ssp_get_clk_div(drv_data, speed);
929 speed = chip->speed_hz; 971
930 972 if (bits <= 8) {
931 if (transfer->speed_hz) 973 drv_data->n_bytes = 1;
932 speed = transfer->speed_hz; 974 drv_data->read = drv_data->read != null_reader ?
933 975 u8_reader : null_reader;
934 if (transfer->bits_per_word) 976 drv_data->write = drv_data->write != null_writer ?
935 bits = transfer->bits_per_word; 977 u8_writer : null_writer;
936 978 } else if (bits <= 16) {
937 clk_div = pxa2xx_ssp_get_clk_div(drv_data, chip, speed); 979 drv_data->n_bytes = 2;
938 980 drv_data->read = drv_data->read != null_reader ?
939 if (bits <= 8) { 981 u16_reader : null_reader;
940 drv_data->n_bytes = 1; 982 drv_data->write = drv_data->write != null_writer ?
941 drv_data->read = drv_data->read != null_reader ? 983 u16_writer : null_writer;
942 u8_reader : null_reader; 984 } else if (bits <= 32) {
943 drv_data->write = drv_data->write != null_writer ? 985 drv_data->n_bytes = 4;
944 u8_writer : null_writer; 986 drv_data->read = drv_data->read != null_reader ?
945 } else if (bits <= 16) { 987 u32_reader : null_reader;
946 drv_data->n_bytes = 2; 988 drv_data->write = drv_data->write != null_writer ?
947 drv_data->read = drv_data->read != null_reader ? 989 u32_writer : null_writer;
948 u16_reader : null_reader;
949 drv_data->write = drv_data->write != null_writer ?
950 u16_writer : null_writer;
951 } else if (bits <= 32) {
952 drv_data->n_bytes = 4;
953 drv_data->read = drv_data->read != null_reader ?
954 u32_reader : null_reader;
955 drv_data->write = drv_data->write != null_writer ?
956 u32_writer : null_writer;
957 }
958 /* if bits/word is changed in dma mode, then must check the
959 * thresholds and burst also */
960 if (chip->enable_dma) {
961 if (pxa2xx_spi_set_dma_burst_and_threshold(chip,
962 message->spi,
963 bits, &dma_burst,
964 &dma_thresh))
965 dev_warn_ratelimited(&message->spi->dev,
966 "pump_transfers: DMA burst size reduced to match bits_per_word\n");
967 }
968
969 cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits);
970 } 990 }
991 /*
992 * if bits/word is changed in dma mode, then must check the
993 * thresholds and burst also
994 */
995 if (chip->enable_dma) {
996 if (pxa2xx_spi_set_dma_burst_and_threshold(chip,
997 message->spi,
998 bits, &dma_burst,
999 &dma_thresh))
1000 dev_warn_ratelimited(&message->spi->dev,
1001 "pump_transfers: DMA burst size reduced to match bits_per_word\n");
1002 }
1003
1004 /* NOTE: PXA25x_SSP _could_ use external clocking ... */
1005 cr0 = pxa2xx_configure_sscr0(drv_data, clk_div, bits);
1006 if (!pxa25x_ssp_comp(drv_data))
1007 dev_dbg(&message->spi->dev, "%u Hz actual, %s\n",
1008 drv_data->master->max_speed_hz
1009 / (1 + ((cr0 & SSCR0_SCR(0xfff)) >> 8)),
1010 chip->enable_dma ? "DMA" : "PIO");
1011 else
1012 dev_dbg(&message->spi->dev, "%u Hz actual, %s\n",
1013 drv_data->master->max_speed_hz / 2
1014 / (1 + ((cr0 & SSCR0_SCR(0x0ff)) >> 8)),
1015 chip->enable_dma ? "DMA" : "PIO");
971 1016
972 message->state = RUNNING_STATE; 1017 message->state = RUNNING_STATE;
973 1018
@@ -1111,7 +1156,6 @@ static int setup(struct spi_device *spi)
1111 struct chip_data *chip; 1156 struct chip_data *chip;
1112 const struct lpss_config *config; 1157 const struct lpss_config *config;
1113 struct driver_data *drv_data = spi_master_get_devdata(spi->master); 1158 struct driver_data *drv_data = spi_master_get_devdata(spi->master);
1114 unsigned int clk_div;
1115 uint tx_thres, tx_hi_thres, rx_thres; 1159 uint tx_thres, tx_hi_thres, rx_thres;
1116 1160
1117 switch (drv_data->ssp_type) { 1161 switch (drv_data->ssp_type) {
@@ -1123,6 +1167,7 @@ static int setup(struct spi_device *spi)
1123 case LPSS_LPT_SSP: 1167 case LPSS_LPT_SSP:
1124 case LPSS_BYT_SSP: 1168 case LPSS_BYT_SSP:
1125 case LPSS_SPT_SSP: 1169 case LPSS_SPT_SSP:
1170 case LPSS_BXT_SSP:
1126 config = lpss_get_config(drv_data); 1171 config = lpss_get_config(drv_data);
1127 tx_thres = config->tx_threshold_lo; 1172 tx_thres = config->tx_threshold_lo;
1128 tx_hi_thres = config->tx_threshold_hi; 1173 tx_hi_thres = config->tx_threshold_hi;
@@ -1203,11 +1248,6 @@ static int setup(struct spi_device *spi)
1203 } 1248 }
1204 } 1249 }
1205 1250
1206 clk_div = pxa2xx_ssp_get_clk_div(drv_data, chip, spi->max_speed_hz);
1207 chip->speed_hz = spi->max_speed_hz;
1208
1209 chip->cr0 = pxa2xx_configure_sscr0(drv_data, clk_div,
1210 spi->bits_per_word);
1211 switch (drv_data->ssp_type) { 1251 switch (drv_data->ssp_type) {
1212 case QUARK_X1000_SSP: 1252 case QUARK_X1000_SSP:
1213 chip->threshold = (QUARK_X1000_SSCR1_RxTresh(rx_thres) 1253 chip->threshold = (QUARK_X1000_SSCR1_RxTresh(rx_thres)
@@ -1228,18 +1268,6 @@ static int setup(struct spi_device *spi)
1228 if (spi->mode & SPI_LOOP) 1268 if (spi->mode & SPI_LOOP)
1229 chip->cr1 |= SSCR1_LBM; 1269 chip->cr1 |= SSCR1_LBM;
1230 1270
1231 /* NOTE: PXA25x_SSP _could_ use external clocking ... */
1232 if (!pxa25x_ssp_comp(drv_data))
1233 dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
1234 drv_data->max_clk_rate
1235 / (1 + ((chip->cr0 & SSCR0_SCR(0xfff)) >> 8)),
1236 chip->enable_dma ? "DMA" : "PIO");
1237 else
1238 dev_dbg(&spi->dev, "%ld Hz actual, %s\n",
1239 drv_data->max_clk_rate / 2
1240 / (1 + ((chip->cr0 & SSCR0_SCR(0x0ff)) >> 8)),
1241 chip->enable_dma ? "DMA" : "PIO");
1242
1243 if (spi->bits_per_word <= 8) { 1271 if (spi->bits_per_word <= 8) {
1244 chip->n_bytes = 1; 1272 chip->n_bytes = 1;
1245 chip->read = u8_reader; 1273 chip->read = u8_reader;
@@ -1249,13 +1277,10 @@ static int setup(struct spi_device *spi)
1249 chip->read = u16_reader; 1277 chip->read = u16_reader;
1250 chip->write = u16_writer; 1278 chip->write = u16_writer;
1251 } else if (spi->bits_per_word <= 32) { 1279 } else if (spi->bits_per_word <= 32) {
1252 if (!is_quark_x1000_ssp(drv_data))
1253 chip->cr0 |= SSCR0_EDSS;
1254 chip->n_bytes = 4; 1280 chip->n_bytes = 4;
1255 chip->read = u32_reader; 1281 chip->read = u32_reader;
1256 chip->write = u32_writer; 1282 chip->write = u32_writer;
1257 } 1283 }
1258 chip->bits_per_word = spi->bits_per_word;
1259 1284
1260 spi_set_ctldata(spi, chip); 1285 spi_set_ctldata(spi, chip);
1261 1286
@@ -1279,6 +1304,7 @@ static void cleanup(struct spi_device *spi)
1279 kfree(chip); 1304 kfree(chip);
1280} 1305}
1281 1306
1307#ifdef CONFIG_PCI
1282#ifdef CONFIG_ACPI 1308#ifdef CONFIG_ACPI
1283 1309
1284static const struct acpi_device_id pxa2xx_spi_acpi_match[] = { 1310static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
@@ -1292,6 +1318,23 @@ static const struct acpi_device_id pxa2xx_spi_acpi_match[] = {
1292}; 1318};
1293MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match); 1319MODULE_DEVICE_TABLE(acpi, pxa2xx_spi_acpi_match);
1294 1320
1321static int pxa2xx_spi_get_port_id(struct acpi_device *adev)
1322{
1323 unsigned int devid;
1324 int port_id = -1;
1325
1326 if (adev && adev->pnp.unique_id &&
1327 !kstrtouint(adev->pnp.unique_id, 0, &devid))
1328 port_id = devid;
1329 return port_id;
1330}
1331#else /* !CONFIG_ACPI */
1332static int pxa2xx_spi_get_port_id(struct acpi_device *adev)
1333{
1334 return -1;
1335}
1336#endif
1337
1295/* 1338/*
1296 * PCI IDs of compound devices that integrate both host controller and private 1339 * PCI IDs of compound devices that integrate both host controller and private
1297 * integrated DMA engine. Please note these are not used in module 1340 * integrated DMA engine. Please note these are not used in module
@@ -1304,6 +1347,14 @@ static const struct pci_device_id pxa2xx_spi_pci_compound_match[] = {
1304 /* SPT-H */ 1347 /* SPT-H */
1305 { PCI_VDEVICE(INTEL, 0xa129), LPSS_SPT_SSP }, 1348 { PCI_VDEVICE(INTEL, 0xa129), LPSS_SPT_SSP },
1306 { PCI_VDEVICE(INTEL, 0xa12a), LPSS_SPT_SSP }, 1349 { PCI_VDEVICE(INTEL, 0xa12a), LPSS_SPT_SSP },
1350 /* BXT */
1351 { PCI_VDEVICE(INTEL, 0x0ac2), LPSS_BXT_SSP },
1352 { PCI_VDEVICE(INTEL, 0x0ac4), LPSS_BXT_SSP },
1353 { PCI_VDEVICE(INTEL, 0x0ac6), LPSS_BXT_SSP },
1354 /* APL */
1355 { PCI_VDEVICE(INTEL, 0x5ac2), LPSS_BXT_SSP },
1356 { PCI_VDEVICE(INTEL, 0x5ac4), LPSS_BXT_SSP },
1357 { PCI_VDEVICE(INTEL, 0x5ac6), LPSS_BXT_SSP },
1307 { }, 1358 { },
1308}; 1359};
1309 1360
@@ -1318,7 +1369,7 @@ static bool pxa2xx_spi_idma_filter(struct dma_chan *chan, void *param)
1318} 1369}
1319 1370
1320static struct pxa2xx_spi_master * 1371static struct pxa2xx_spi_master *
1321pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) 1372pxa2xx_spi_init_pdata(struct platform_device *pdev)
1322{ 1373{
1323 struct pxa2xx_spi_master *pdata; 1374 struct pxa2xx_spi_master *pdata;
1324 struct acpi_device *adev; 1375 struct acpi_device *adev;
@@ -1326,18 +1377,18 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
1326 struct resource *res; 1377 struct resource *res;
1327 const struct acpi_device_id *adev_id = NULL; 1378 const struct acpi_device_id *adev_id = NULL;
1328 const struct pci_device_id *pcidev_id = NULL; 1379 const struct pci_device_id *pcidev_id = NULL;
1329 int devid, type; 1380 int type;
1330 1381
1331 if (!ACPI_HANDLE(&pdev->dev) || 1382 adev = ACPI_COMPANION(&pdev->dev);
1332 acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev))
1333 return NULL;
1334 1383
1335 if (dev_is_pci(pdev->dev.parent)) 1384 if (dev_is_pci(pdev->dev.parent))
1336 pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match, 1385 pcidev_id = pci_match_id(pxa2xx_spi_pci_compound_match,
1337 to_pci_dev(pdev->dev.parent)); 1386 to_pci_dev(pdev->dev.parent));
1338 else 1387 else if (adev)
1339 adev_id = acpi_match_device(pdev->dev.driver->acpi_match_table, 1388 adev_id = acpi_match_device(pdev->dev.driver->acpi_match_table,
1340 &pdev->dev); 1389 &pdev->dev);
1390 else
1391 return NULL;
1341 1392
1342 if (adev_id) 1393 if (adev_id)
1343 type = (int)adev_id->driver_data; 1394 type = (int)adev_id->driver_data;
@@ -1371,10 +1422,7 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
1371 ssp->irq = platform_get_irq(pdev, 0); 1422 ssp->irq = platform_get_irq(pdev, 0);
1372 ssp->type = type; 1423 ssp->type = type;
1373 ssp->pdev = pdev; 1424 ssp->pdev = pdev;
1374 1425 ssp->port_id = pxa2xx_spi_get_port_id(adev);
1375 ssp->port_id = -1;
1376 if (adev->pnp.unique_id && !kstrtoint(adev->pnp.unique_id, 0, &devid))
1377 ssp->port_id = devid;
1378 1426
1379 pdata->num_chipselect = 1; 1427 pdata->num_chipselect = 1;
1380 pdata->enable_dma = true; 1428 pdata->enable_dma = true;
@@ -1382,9 +1430,9 @@ pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev)
1382 return pdata; 1430 return pdata;
1383} 1431}
1384 1432
1385#else 1433#else /* !CONFIG_PCI */
1386static inline struct pxa2xx_spi_master * 1434static inline struct pxa2xx_spi_master *
1387pxa2xx_spi_acpi_get_pdata(struct platform_device *pdev) 1435pxa2xx_spi_init_pdata(struct platform_device *pdev)
1388{ 1436{
1389 return NULL; 1437 return NULL;
1390} 1438}
@@ -1397,12 +1445,13 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1397 struct spi_master *master; 1445 struct spi_master *master;
1398 struct driver_data *drv_data; 1446 struct driver_data *drv_data;
1399 struct ssp_device *ssp; 1447 struct ssp_device *ssp;
1448 const struct lpss_config *config;
1400 int status; 1449 int status;
1401 u32 tmp; 1450 u32 tmp;
1402 1451
1403 platform_info = dev_get_platdata(dev); 1452 platform_info = dev_get_platdata(dev);
1404 if (!platform_info) { 1453 if (!platform_info) {
1405 platform_info = pxa2xx_spi_acpi_get_pdata(pdev); 1454 platform_info = pxa2xx_spi_init_pdata(pdev);
1406 if (!platform_info) { 1455 if (!platform_info) {
1407 dev_err(&pdev->dev, "missing platform data\n"); 1456 dev_err(&pdev->dev, "missing platform data\n");
1408 return -ENODEV; 1457 return -ENODEV;
@@ -1436,7 +1485,6 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1436 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP; 1485 master->mode_bits = SPI_CPOL | SPI_CPHA | SPI_CS_HIGH | SPI_LOOP;
1437 1486
1438 master->bus_num = ssp->port_id; 1487 master->bus_num = ssp->port_id;
1439 master->num_chipselect = platform_info->num_chipselect;
1440 master->dma_alignment = DMA_ALIGNMENT; 1488 master->dma_alignment = DMA_ALIGNMENT;
1441 master->cleanup = cleanup; 1489 master->cleanup = cleanup;
1442 master->setup = setup; 1490 master->setup = setup;
@@ -1489,7 +1537,7 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1489 /* Enable SOC clock */ 1537 /* Enable SOC clock */
1490 clk_prepare_enable(ssp->clk); 1538 clk_prepare_enable(ssp->clk);
1491 1539
1492 drv_data->max_clk_rate = clk_get_rate(ssp->clk); 1540 master->max_speed_hz = clk_get_rate(ssp->clk);
1493 1541
1494 /* Load default SSP configuration */ 1542 /* Load default SSP configuration */
1495 pxa2xx_spi_write(drv_data, SSCR0, 0); 1543 pxa2xx_spi_write(drv_data, SSCR0, 0);
@@ -1522,6 +1570,19 @@ static int pxa2xx_spi_probe(struct platform_device *pdev)
1522 if (is_lpss_ssp(drv_data)) 1570 if (is_lpss_ssp(drv_data))
1523 lpss_ssp_setup(drv_data); 1571 lpss_ssp_setup(drv_data);
1524 1572
1573 if (is_lpss_ssp(drv_data)) {
1574 lpss_ssp_setup(drv_data);
1575 config = lpss_get_config(drv_data);
1576 if (config->reg_capabilities >= 0) {
1577 tmp = __lpss_ssp_read_priv(drv_data,
1578 config->reg_capabilities);
1579 tmp &= LPSS_CAPS_CS_EN_MASK;
1580 tmp >>= LPSS_CAPS_CS_EN_SHIFT;
1581 platform_info->num_chipselect = ffz(tmp);
1582 }
1583 }
1584 master->num_chipselect = platform_info->num_chipselect;
1585
1525 tasklet_init(&drv_data->pump_transfers, pump_transfers, 1586 tasklet_init(&drv_data->pump_transfers, pump_transfers,
1526 (unsigned long)drv_data); 1587 (unsigned long)drv_data);
1527 1588
@@ -1614,8 +1675,6 @@ static int pxa2xx_spi_resume(struct device *dev)
1614 struct ssp_device *ssp = drv_data->ssp; 1675 struct ssp_device *ssp = drv_data->ssp;
1615 int status = 0; 1676 int status = 0;
1616 1677
1617 pxa2xx_spi_dma_resume(drv_data);
1618
1619 /* Enable the SSP clock */ 1678 /* Enable the SSP clock */
1620 if (!pm_runtime_suspended(dev)) 1679 if (!pm_runtime_suspended(dev))
1621 clk_prepare_enable(ssp->clk); 1680 clk_prepare_enable(ssp->clk);
diff --git a/drivers/spi/spi-pxa2xx.h b/drivers/spi/spi-pxa2xx.h
index 0a9b6390a817..58efa98313aa 100644
--- a/drivers/spi/spi-pxa2xx.h
+++ b/drivers/spi/spi-pxa2xx.h
@@ -46,9 +46,6 @@ struct driver_data {
46 u32 clear_sr; 46 u32 clear_sr;
47 u32 mask_sr; 47 u32 mask_sr;
48 48
49 /* Maximun clock rate */
50 unsigned long max_clk_rate;
51
52 /* Message Transfer pump */ 49 /* Message Transfer pump */
53 struct tasklet_struct pump_transfers; 50 struct tasklet_struct pump_transfers;
54 51
@@ -86,10 +83,8 @@ struct driver_data {
86}; 83};
87 84
88struct chip_data { 85struct chip_data {
89 u32 cr0;
90 u32 cr1; 86 u32 cr1;
91 u32 dds_rate; 87 u32 dds_rate;
92 u32 psp;
93 u32 timeout; 88 u32 timeout;
94 u8 n_bytes; 89 u8 n_bytes;
95 u32 dma_burst_size; 90 u32 dma_burst_size;
@@ -98,8 +93,6 @@ struct chip_data {
98 u16 lpss_rx_threshold; 93 u16 lpss_rx_threshold;
99 u16 lpss_tx_threshold; 94 u16 lpss_tx_threshold;
100 u8 enable_dma; 95 u8 enable_dma;
101 u8 bits_per_word;
102 u32 speed_hz;
103 union { 96 union {
104 int gpio_cs; 97 int gpio_cs;
105 unsigned int frm; 98 unsigned int frm;
@@ -175,7 +168,6 @@ extern int pxa2xx_spi_dma_prepare(struct driver_data *drv_data, u32 dma_burst);
175extern void pxa2xx_spi_dma_start(struct driver_data *drv_data); 168extern void pxa2xx_spi_dma_start(struct driver_data *drv_data);
176extern int pxa2xx_spi_dma_setup(struct driver_data *drv_data); 169extern int pxa2xx_spi_dma_setup(struct driver_data *drv_data);
177extern void pxa2xx_spi_dma_release(struct driver_data *drv_data); 170extern void pxa2xx_spi_dma_release(struct driver_data *drv_data);
178extern void pxa2xx_spi_dma_resume(struct driver_data *drv_data);
179extern int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, 171extern int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip,
180 struct spi_device *spi, 172 struct spi_device *spi,
181 u8 bits_per_word, 173 u8 bits_per_word,
@@ -196,7 +188,6 @@ static inline int pxa2xx_spi_dma_setup(struct driver_data *drv_data)
196 return 0; 188 return 0;
197} 189}
198static inline void pxa2xx_spi_dma_release(struct driver_data *drv_data) {} 190static inline void pxa2xx_spi_dma_release(struct driver_data *drv_data) {}
199static inline void pxa2xx_spi_dma_resume(struct driver_data *drv_data) {}
200static inline int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip, 191static inline int pxa2xx_spi_set_dma_burst_and_threshold(struct chip_data *chip,
201 struct spi_device *spi, 192 struct spi_device *spi,
202 u8 bits_per_word, 193 u8 bits_per_word,
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index f36bc320a807..4e7d1bfed7e6 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -198,12 +198,12 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
198 if (ret) 198 if (ret)
199 return ret; 199 return ret;
200 200
201 spin_lock(&hw->bitbang.lock); 201 mutex_lock(&hw->bitbang.lock);
202 if (!hw->bitbang.busy) { 202 if (!hw->bitbang.busy) {
203 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE); 203 hw->bitbang.chipselect(spi, BITBANG_CS_INACTIVE);
204 /* need to ndelay for 0.5 clocktick ? */ 204 /* need to ndelay for 0.5 clocktick ? */
205 } 205 }
206 spin_unlock(&hw->bitbang.lock); 206 mutex_unlock(&hw->bitbang.lock);
207 207
208 return 0; 208 return 0;
209} 209}
diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c
index cd1cfac0447f..8e86e7f6663a 100644
--- a/drivers/spi/spi-s3c64xx.c
+++ b/drivers/spi/spi-s3c64xx.c
@@ -32,6 +32,7 @@
32#define MAX_SPI_PORTS 6 32#define MAX_SPI_PORTS 6
33#define S3C64XX_SPI_QUIRK_POLL (1 << 0) 33#define S3C64XX_SPI_QUIRK_POLL (1 << 0)
34#define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1) 34#define S3C64XX_SPI_QUIRK_CS_AUTO (1 << 1)
35#define AUTOSUSPEND_TIMEOUT 2000
35 36
36/* Registers and bit-fields */ 37/* Registers and bit-fields */
37 38
@@ -682,7 +683,7 @@ static int s3c64xx_spi_transfer_one(struct spi_master *master,
682 683
683 /* Only BPW and Speed may change across transfers */ 684 /* Only BPW and Speed may change across transfers */
684 bpw = xfer->bits_per_word; 685 bpw = xfer->bits_per_word;
685 speed = xfer->speed_hz ? : spi->max_speed_hz; 686 speed = xfer->speed_hz;
686 687
687 if (bpw != sdd->cur_bpw || speed != sdd->cur_speed) { 688 if (bpw != sdd->cur_bpw || speed != sdd->cur_speed) {
688 sdd->cur_bpw = bpw; 689 sdd->cur_bpw = bpw;
@@ -859,13 +860,15 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
859 } 860 }
860 } 861 }
861 862
862 pm_runtime_put(&sdd->pdev->dev); 863 pm_runtime_mark_last_busy(&sdd->pdev->dev);
864 pm_runtime_put_autosuspend(&sdd->pdev->dev);
863 if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO)) 865 if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO))
864 writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); 866 writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
865 return 0; 867 return 0;
866 868
867setup_exit: 869setup_exit:
868 pm_runtime_put(&sdd->pdev->dev); 870 pm_runtime_mark_last_busy(&sdd->pdev->dev);
871 pm_runtime_put_autosuspend(&sdd->pdev->dev);
869 /* setup() returns with device de-selected */ 872 /* setup() returns with device de-selected */
870 if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO)) 873 if (!(sdd->port_conf->quirks & S3C64XX_SPI_QUIRK_CS_AUTO))
871 writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL); 874 writel(S3C64XX_SPI_SLAVE_SIG_INACT, sdd->regs + S3C64XX_SPI_SLAVE_SEL);
@@ -1162,6 +1165,12 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1162 goto err2; 1165 goto err2;
1163 } 1166 }
1164 1167
1168 pm_runtime_set_autosuspend_delay(&pdev->dev, AUTOSUSPEND_TIMEOUT);
1169 pm_runtime_use_autosuspend(&pdev->dev);
1170 pm_runtime_set_active(&pdev->dev);
1171 pm_runtime_enable(&pdev->dev);
1172 pm_runtime_get_sync(&pdev->dev);
1173
1165 /* Setup Deufult Mode */ 1174 /* Setup Deufult Mode */
1166 s3c64xx_spi_hwinit(sdd, sdd->port_id); 1175 s3c64xx_spi_hwinit(sdd, sdd->port_id);
1167 1176
@@ -1180,9 +1189,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1180 S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN, 1189 S3C64XX_SPI_INT_TX_OVERRUN_EN | S3C64XX_SPI_INT_TX_UNDERRUN_EN,
1181 sdd->regs + S3C64XX_SPI_INT_EN); 1190 sdd->regs + S3C64XX_SPI_INT_EN);
1182 1191
1183 pm_runtime_set_active(&pdev->dev);
1184 pm_runtime_enable(&pdev->dev);
1185
1186 ret = devm_spi_register_master(&pdev->dev, master); 1192 ret = devm_spi_register_master(&pdev->dev, master);
1187 if (ret != 0) { 1193 if (ret != 0) {
1188 dev_err(&pdev->dev, "cannot register SPI master: %d\n", ret); 1194 dev_err(&pdev->dev, "cannot register SPI master: %d\n", ret);
@@ -1195,9 +1201,16 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
1195 mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1, 1201 mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1,
1196 sdd->rx_dma.dmach, sdd->tx_dma.dmach); 1202 sdd->rx_dma.dmach, sdd->tx_dma.dmach);
1197 1203
1204 pm_runtime_mark_last_busy(&pdev->dev);
1205 pm_runtime_put_autosuspend(&pdev->dev);
1206
1198 return 0; 1207 return 0;
1199 1208
1200err3: 1209err3:
1210 pm_runtime_put_noidle(&pdev->dev);
1211 pm_runtime_disable(&pdev->dev);
1212 pm_runtime_set_suspended(&pdev->dev);
1213
1201 clk_disable_unprepare(sdd->src_clk); 1214 clk_disable_unprepare(sdd->src_clk);
1202err2: 1215err2:
1203 clk_disable_unprepare(sdd->clk); 1216 clk_disable_unprepare(sdd->clk);
@@ -1212,7 +1225,7 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
1212 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev)); 1225 struct spi_master *master = spi_master_get(platform_get_drvdata(pdev));
1213 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); 1226 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
1214 1227
1215 pm_runtime_disable(&pdev->dev); 1228 pm_runtime_get_sync(&pdev->dev);
1216 1229
1217 writel(0, sdd->regs + S3C64XX_SPI_INT_EN); 1230 writel(0, sdd->regs + S3C64XX_SPI_INT_EN);
1218 1231
@@ -1220,6 +1233,10 @@ static int s3c64xx_spi_remove(struct platform_device *pdev)
1220 1233
1221 clk_disable_unprepare(sdd->clk); 1234 clk_disable_unprepare(sdd->clk);
1222 1235
1236 pm_runtime_put_noidle(&pdev->dev);
1237 pm_runtime_disable(&pdev->dev);
1238 pm_runtime_set_suspended(&pdev->dev);
1239
1223 return 0; 1240 return 0;
1224} 1241}
1225 1242
@@ -1233,10 +1250,9 @@ static int s3c64xx_spi_suspend(struct device *dev)
1233 if (ret) 1250 if (ret)
1234 return ret; 1251 return ret;
1235 1252
1236 if (!pm_runtime_suspended(dev)) { 1253 ret = pm_runtime_force_suspend(dev);
1237 clk_disable_unprepare(sdd->clk); 1254 if (ret < 0)
1238 clk_disable_unprepare(sdd->src_clk); 1255 return ret;
1239 }
1240 1256
1241 sdd->cur_speed = 0; /* Output Clock is stopped */ 1257 sdd->cur_speed = 0; /* Output Clock is stopped */
1242 1258
@@ -1248,14 +1264,14 @@ static int s3c64xx_spi_resume(struct device *dev)
1248 struct spi_master *master = dev_get_drvdata(dev); 1264 struct spi_master *master = dev_get_drvdata(dev);
1249 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master); 1265 struct s3c64xx_spi_driver_data *sdd = spi_master_get_devdata(master);
1250 struct s3c64xx_spi_info *sci = sdd->cntrlr_info; 1266 struct s3c64xx_spi_info *sci = sdd->cntrlr_info;
1267 int ret;
1251 1268
1252 if (sci->cfg_gpio) 1269 if (sci->cfg_gpio)
1253 sci->cfg_gpio(); 1270 sci->cfg_gpio();
1254 1271
1255 if (!pm_runtime_suspended(dev)) { 1272 ret = pm_runtime_force_resume(dev);
1256 clk_prepare_enable(sdd->src_clk); 1273 if (ret < 0)
1257 clk_prepare_enable(sdd->clk); 1274 return ret;
1258 }
1259 1275
1260 s3c64xx_spi_hwinit(sdd, sdd->port_id); 1276 s3c64xx_spi_hwinit(sdd, sdd->port_id);
1261 1277
diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index aa6d284131e0..64318fcfacf2 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -39,8 +39,6 @@ struct ti_qspi_regs {
39}; 39};
40 40
41struct ti_qspi { 41struct ti_qspi {
42 struct completion transfer_complete;
43
44 /* list synchronization */ 42 /* list synchronization */
45 struct mutex list_lock; 43 struct mutex list_lock;
46 44
@@ -62,10 +60,6 @@ struct ti_qspi {
62 60
63#define QSPI_PID (0x0) 61#define QSPI_PID (0x0)
64#define QSPI_SYSCONFIG (0x10) 62#define QSPI_SYSCONFIG (0x10)
65#define QSPI_INTR_STATUS_RAW_SET (0x20)
66#define QSPI_INTR_STATUS_ENABLED_CLEAR (0x24)
67#define QSPI_INTR_ENABLE_SET_REG (0x28)
68#define QSPI_INTR_ENABLE_CLEAR_REG (0x2c)
69#define QSPI_SPI_CLOCK_CNTRL_REG (0x40) 63#define QSPI_SPI_CLOCK_CNTRL_REG (0x40)
70#define QSPI_SPI_DC_REG (0x44) 64#define QSPI_SPI_DC_REG (0x44)
71#define QSPI_SPI_CMD_REG (0x48) 65#define QSPI_SPI_CMD_REG (0x48)
@@ -97,7 +91,6 @@ struct ti_qspi {
97#define QSPI_RD_DUAL (3 << 16) 91#define QSPI_RD_DUAL (3 << 16)
98#define QSPI_RD_QUAD (7 << 16) 92#define QSPI_RD_QUAD (7 << 16)
99#define QSPI_INVAL (4 << 16) 93#define QSPI_INVAL (4 << 16)
100#define QSPI_WC_CMD_INT_EN (1 << 14)
101#define QSPI_FLEN(n) ((n - 1) << 0) 94#define QSPI_FLEN(n) ((n - 1) << 0)
102#define QSPI_WLEN_MAX_BITS 128 95#define QSPI_WLEN_MAX_BITS 128
103#define QSPI_WLEN_MAX_BYTES 16 96#define QSPI_WLEN_MAX_BYTES 16
@@ -106,10 +99,6 @@ struct ti_qspi {
106#define BUSY 0x01 99#define BUSY 0x01
107#define WC 0x02 100#define WC 0x02
108 101
109/* INTERRUPT REGISTER */
110#define QSPI_WC_INT_EN (1 << 1)
111#define QSPI_WC_INT_DISABLE (1 << 1)
112
113/* Device Control */ 102/* Device Control */
114#define QSPI_DD(m, n) (m << (3 + n * 8)) 103#define QSPI_DD(m, n) (m << (3 + n * 8))
115#define QSPI_CKPHA(n) (1 << (2 + n * 8)) 104#define QSPI_CKPHA(n) (1 << (2 + n * 8))
@@ -217,6 +206,24 @@ static inline u32 qspi_is_busy(struct ti_qspi *qspi)
217 return stat & BUSY; 206 return stat & BUSY;
218} 207}
219 208
209static inline int ti_qspi_poll_wc(struct ti_qspi *qspi)
210{
211 u32 stat;
212 unsigned long timeout = jiffies + QSPI_COMPLETION_TIMEOUT;
213
214 do {
215 stat = ti_qspi_read(qspi, QSPI_SPI_STATUS_REG);
216 if (stat & WC)
217 return 0;
218 cpu_relax();
219 } while (time_after(timeout, jiffies));
220
221 stat = ti_qspi_read(qspi, QSPI_SPI_STATUS_REG);
222 if (stat & WC)
223 return 0;
224 return -ETIMEDOUT;
225}
226
220static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t) 227static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t)
221{ 228{
222 int wlen, count, xfer_len; 229 int wlen, count, xfer_len;
@@ -275,8 +282,7 @@ static int qspi_write_msg(struct ti_qspi *qspi, struct spi_transfer *t)
275 } 282 }
276 283
277 ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 284 ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
278 if (!wait_for_completion_timeout(&qspi->transfer_complete, 285 if (ti_qspi_poll_wc(qspi)) {
279 QSPI_COMPLETION_TIMEOUT)) {
280 dev_err(qspi->dev, "write timed out\n"); 286 dev_err(qspi->dev, "write timed out\n");
281 return -ETIMEDOUT; 287 return -ETIMEDOUT;
282 } 288 }
@@ -315,8 +321,7 @@ static int qspi_read_msg(struct ti_qspi *qspi, struct spi_transfer *t)
315 return -EBUSY; 321 return -EBUSY;
316 322
317 ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG); 323 ti_qspi_write(qspi, cmd, QSPI_SPI_CMD_REG);
318 if (!wait_for_completion_timeout(&qspi->transfer_complete, 324 if (ti_qspi_poll_wc(qspi)) {
319 QSPI_COMPLETION_TIMEOUT)) {
320 dev_err(qspi->dev, "read timed out\n"); 325 dev_err(qspi->dev, "read timed out\n");
321 return -ETIMEDOUT; 326 return -ETIMEDOUT;
322 } 327 }
@@ -388,9 +393,7 @@ static int ti_qspi_start_transfer_one(struct spi_master *master,
388 qspi->cmd = 0; 393 qspi->cmd = 0;
389 qspi->cmd |= QSPI_EN_CS(spi->chip_select); 394 qspi->cmd |= QSPI_EN_CS(spi->chip_select);
390 qspi->cmd |= QSPI_FLEN(frame_length); 395 qspi->cmd |= QSPI_FLEN(frame_length);
391 qspi->cmd |= QSPI_WC_CMD_INT_EN;
392 396
393 ti_qspi_write(qspi, QSPI_WC_INT_EN, QSPI_INTR_ENABLE_SET_REG);
394 ti_qspi_write(qspi, qspi->dc, QSPI_SPI_DC_REG); 397 ti_qspi_write(qspi, qspi->dc, QSPI_SPI_DC_REG);
395 398
396 mutex_lock(&qspi->list_lock); 399 mutex_lock(&qspi->list_lock);
@@ -410,39 +413,13 @@ static int ti_qspi_start_transfer_one(struct spi_master *master,
410 413
411 mutex_unlock(&qspi->list_lock); 414 mutex_unlock(&qspi->list_lock);
412 415
416 ti_qspi_write(qspi, qspi->cmd | QSPI_INVAL, QSPI_SPI_CMD_REG);
413 m->status = status; 417 m->status = status;
414 spi_finalize_current_message(master); 418 spi_finalize_current_message(master);
415 419
416 ti_qspi_write(qspi, qspi->cmd | QSPI_INVAL, QSPI_SPI_CMD_REG);
417
418 return status; 420 return status;
419} 421}
420 422
421static irqreturn_t ti_qspi_isr(int irq, void *dev_id)
422{
423 struct ti_qspi *qspi = dev_id;
424 u16 int_stat;
425 u32 stat;
426
427 irqreturn_t ret = IRQ_HANDLED;
428
429 int_stat = ti_qspi_read(qspi, QSPI_INTR_STATUS_ENABLED_CLEAR);
430 stat = ti_qspi_read(qspi, QSPI_SPI_STATUS_REG);
431
432 if (!int_stat) {
433 dev_dbg(qspi->dev, "No IRQ triggered\n");
434 ret = IRQ_NONE;
435 goto out;
436 }
437
438 ti_qspi_write(qspi, QSPI_WC_INT_DISABLE,
439 QSPI_INTR_STATUS_ENABLED_CLEAR);
440 if (stat & WC)
441 complete(&qspi->transfer_complete);
442out:
443 return ret;
444}
445
446static int ti_qspi_runtime_resume(struct device *dev) 423static int ti_qspi_runtime_resume(struct device *dev)
447{ 424{
448 struct ti_qspi *qspi; 425 struct ti_qspi *qspi;
@@ -551,22 +528,12 @@ static int ti_qspi_probe(struct platform_device *pdev)
551 } 528 }
552 } 529 }
553 530
554 ret = devm_request_irq(&pdev->dev, irq, ti_qspi_isr, 0,
555 dev_name(&pdev->dev), qspi);
556 if (ret < 0) {
557 dev_err(&pdev->dev, "Failed to register ISR for IRQ %d\n",
558 irq);
559 goto free_master;
560 }
561
562 qspi->fclk = devm_clk_get(&pdev->dev, "fck"); 531 qspi->fclk = devm_clk_get(&pdev->dev, "fck");
563 if (IS_ERR(qspi->fclk)) { 532 if (IS_ERR(qspi->fclk)) {
564 ret = PTR_ERR(qspi->fclk); 533 ret = PTR_ERR(qspi->fclk);
565 dev_err(&pdev->dev, "could not get clk: %d\n", ret); 534 dev_err(&pdev->dev, "could not get clk: %d\n", ret);
566 } 535 }
567 536
568 init_completion(&qspi->transfer_complete);
569
570 pm_runtime_use_autosuspend(&pdev->dev); 537 pm_runtime_use_autosuspend(&pdev->dev);
571 pm_runtime_set_autosuspend_delay(&pdev->dev, QSPI_AUTOSUSPEND_TIMEOUT); 538 pm_runtime_set_autosuspend_delay(&pdev->dev, QSPI_AUTOSUSPEND_TIMEOUT);
572 pm_runtime_enable(&pdev->dev); 539 pm_runtime_enable(&pdev->dev);
@@ -587,18 +554,7 @@ free_master:
587 554
588static int ti_qspi_remove(struct platform_device *pdev) 555static int ti_qspi_remove(struct platform_device *pdev)
589{ 556{
590 struct ti_qspi *qspi = platform_get_drvdata(pdev); 557 pm_runtime_put_sync(&pdev->dev);
591 int ret;
592
593 ret = pm_runtime_get_sync(qspi->dev);
594 if (ret < 0) {
595 dev_err(qspi->dev, "pm_runtime_get_sync() failed\n");
596 return ret;
597 }
598
599 ti_qspi_write(qspi, QSPI_WC_INT_DISABLE, QSPI_INTR_ENABLE_CLEAR_REG);
600
601 pm_runtime_put(qspi->dev);
602 pm_runtime_disable(&pdev->dev); 558 pm_runtime_disable(&pdev->dev);
603 559
604 return 0; 560 return 0;
diff --git a/drivers/spi/spi-tle62x0.c b/drivers/spi/spi-tle62x0.c
index daf5aa1c24c3..c6ae775289e5 100644
--- a/drivers/spi/spi-tle62x0.c
+++ b/drivers/spi/spi-tle62x0.c
@@ -307,7 +307,6 @@ static int tle62x0_remove(struct spi_device *spi)
307static struct spi_driver tle62x0_driver = { 307static struct spi_driver tle62x0_driver = {
308 .driver = { 308 .driver = {
309 .name = "tle62x0", 309 .name = "tle62x0",
310 .owner = THIS_MODULE,
311 }, 310 },
312 .probe = tle62x0_probe, 311 .probe = tle62x0_probe,
313 .remove = tle62x0_remove, 312 .remove = tle62x0_remove,
diff --git a/drivers/spi/spi-txx9.c b/drivers/spi/spi-txx9.c
index 9190124b6d90..d69f8f8f3fa6 100644
--- a/drivers/spi/spi-txx9.c
+++ b/drivers/spi/spi-txx9.c
@@ -181,7 +181,7 @@ static void txx9spi_work_one(struct txx9spi *c, struct spi_message *m)
181 u32 data; 181 u32 data;
182 unsigned int len = t->len; 182 unsigned int len = t->len;
183 unsigned int wsize; 183 unsigned int wsize;
184 u32 speed_hz = t->speed_hz ? : spi->max_speed_hz; 184 u32 speed_hz = t->speed_hz;
185 u8 bits_per_word = t->bits_per_word; 185 u8 bits_per_word = t->bits_per_word;
186 186
187 wsize = bits_per_word >> 3; /* in bytes */ 187 wsize = bits_per_word >> 3; /* in bytes */
diff --git a/drivers/spi/spi-xilinx.c b/drivers/spi/spi-xilinx.c
index a339c1e9997a..3009121173cd 100644
--- a/drivers/spi/spi-xilinx.c
+++ b/drivers/spi/spi-xilinx.c
@@ -270,6 +270,7 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
270 270
271 while (remaining_words) { 271 while (remaining_words) {
272 int n_words, tx_words, rx_words; 272 int n_words, tx_words, rx_words;
273 u32 sr;
273 274
274 n_words = min(remaining_words, xspi->buffer_size); 275 n_words = min(remaining_words, xspi->buffer_size);
275 276
@@ -284,24 +285,33 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
284 if (use_irq) { 285 if (use_irq) {
285 xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET); 286 xspi->write_fn(cr, xspi->regs + XSPI_CR_OFFSET);
286 wait_for_completion(&xspi->done); 287 wait_for_completion(&xspi->done);
287 } else 288 /* A transmit has just completed. Process received data
288 while (!(xspi->read_fn(xspi->regs + XSPI_SR_OFFSET) & 289 * and check for more data to transmit. Always inhibit
289 XSPI_SR_TX_EMPTY_MASK)) 290 * the transmitter while the Isr refills the transmit
290 ; 291 * register/FIFO, or make sure it is stopped if we're
291 292 * done.
292 /* A transmit has just completed. Process received data and 293 */
293 * check for more data to transmit. Always inhibit the
294 * transmitter while the Isr refills the transmit register/FIFO,
295 * or make sure it is stopped if we're done.
296 */
297 if (use_irq)
298 xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT, 294 xspi->write_fn(cr | XSPI_CR_TRANS_INHIBIT,
299 xspi->regs + XSPI_CR_OFFSET); 295 xspi->regs + XSPI_CR_OFFSET);
296 sr = XSPI_SR_TX_EMPTY_MASK;
297 } else
298 sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
300 299
301 /* Read out all the data from the Rx FIFO */ 300 /* Read out all the data from the Rx FIFO */
302 rx_words = n_words; 301 rx_words = n_words;
303 while (rx_words--) 302 while (rx_words) {
304 xilinx_spi_rx(xspi); 303 if ((sr & XSPI_SR_TX_EMPTY_MASK) && (rx_words > 1)) {
304 xilinx_spi_rx(xspi);
305 rx_words--;
306 continue;
307 }
308
309 sr = xspi->read_fn(xspi->regs + XSPI_SR_OFFSET);
310 if (!(sr & XSPI_SR_RX_EMPTY_MASK)) {
311 xilinx_spi_rx(xspi);
312 rx_words--;
313 }
314 }
305 315
306 remaining_words -= n_words; 316 remaining_words -= n_words;
307 } 317 }
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index a5f53de813d3..e2415be209d5 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -123,6 +123,28 @@ SPI_STATISTICS_SHOW(bytes, "%llu");
123SPI_STATISTICS_SHOW(bytes_rx, "%llu"); 123SPI_STATISTICS_SHOW(bytes_rx, "%llu");
124SPI_STATISTICS_SHOW(bytes_tx, "%llu"); 124SPI_STATISTICS_SHOW(bytes_tx, "%llu");
125 125
126#define SPI_STATISTICS_TRANSFER_BYTES_HISTO(index, number) \
127 SPI_STATISTICS_SHOW_NAME(transfer_bytes_histo##index, \
128 "transfer_bytes_histo_" number, \
129 transfer_bytes_histo[index], "%lu")
130SPI_STATISTICS_TRANSFER_BYTES_HISTO(0, "0-1");
131SPI_STATISTICS_TRANSFER_BYTES_HISTO(1, "2-3");
132SPI_STATISTICS_TRANSFER_BYTES_HISTO(2, "4-7");
133SPI_STATISTICS_TRANSFER_BYTES_HISTO(3, "8-15");
134SPI_STATISTICS_TRANSFER_BYTES_HISTO(4, "16-31");
135SPI_STATISTICS_TRANSFER_BYTES_HISTO(5, "32-63");
136SPI_STATISTICS_TRANSFER_BYTES_HISTO(6, "64-127");
137SPI_STATISTICS_TRANSFER_BYTES_HISTO(7, "128-255");
138SPI_STATISTICS_TRANSFER_BYTES_HISTO(8, "256-511");
139SPI_STATISTICS_TRANSFER_BYTES_HISTO(9, "512-1023");
140SPI_STATISTICS_TRANSFER_BYTES_HISTO(10, "1024-2047");
141SPI_STATISTICS_TRANSFER_BYTES_HISTO(11, "2048-4095");
142SPI_STATISTICS_TRANSFER_BYTES_HISTO(12, "4096-8191");
143SPI_STATISTICS_TRANSFER_BYTES_HISTO(13, "8192-16383");
144SPI_STATISTICS_TRANSFER_BYTES_HISTO(14, "16384-32767");
145SPI_STATISTICS_TRANSFER_BYTES_HISTO(15, "32768-65535");
146SPI_STATISTICS_TRANSFER_BYTES_HISTO(16, "65536+");
147
126static struct attribute *spi_dev_attrs[] = { 148static struct attribute *spi_dev_attrs[] = {
127 &dev_attr_modalias.attr, 149 &dev_attr_modalias.attr,
128 NULL, 150 NULL,
@@ -143,6 +165,23 @@ static struct attribute *spi_device_statistics_attrs[] = {
143 &dev_attr_spi_device_bytes.attr, 165 &dev_attr_spi_device_bytes.attr,
144 &dev_attr_spi_device_bytes_rx.attr, 166 &dev_attr_spi_device_bytes_rx.attr,
145 &dev_attr_spi_device_bytes_tx.attr, 167 &dev_attr_spi_device_bytes_tx.attr,
168 &dev_attr_spi_device_transfer_bytes_histo0.attr,
169 &dev_attr_spi_device_transfer_bytes_histo1.attr,
170 &dev_attr_spi_device_transfer_bytes_histo2.attr,
171 &dev_attr_spi_device_transfer_bytes_histo3.attr,
172 &dev_attr_spi_device_transfer_bytes_histo4.attr,
173 &dev_attr_spi_device_transfer_bytes_histo5.attr,
174 &dev_attr_spi_device_transfer_bytes_histo6.attr,
175 &dev_attr_spi_device_transfer_bytes_histo7.attr,
176 &dev_attr_spi_device_transfer_bytes_histo8.attr,
177 &dev_attr_spi_device_transfer_bytes_histo9.attr,
178 &dev_attr_spi_device_transfer_bytes_histo10.attr,
179 &dev_attr_spi_device_transfer_bytes_histo11.attr,
180 &dev_attr_spi_device_transfer_bytes_histo12.attr,
181 &dev_attr_spi_device_transfer_bytes_histo13.attr,
182 &dev_attr_spi_device_transfer_bytes_histo14.attr,
183 &dev_attr_spi_device_transfer_bytes_histo15.attr,
184 &dev_attr_spi_device_transfer_bytes_histo16.attr,
146 NULL, 185 NULL,
147}; 186};
148 187
@@ -168,6 +207,23 @@ static struct attribute *spi_master_statistics_attrs[] = {
168 &dev_attr_spi_master_bytes.attr, 207 &dev_attr_spi_master_bytes.attr,
169 &dev_attr_spi_master_bytes_rx.attr, 208 &dev_attr_spi_master_bytes_rx.attr,
170 &dev_attr_spi_master_bytes_tx.attr, 209 &dev_attr_spi_master_bytes_tx.attr,
210 &dev_attr_spi_master_transfer_bytes_histo0.attr,
211 &dev_attr_spi_master_transfer_bytes_histo1.attr,
212 &dev_attr_spi_master_transfer_bytes_histo2.attr,
213 &dev_attr_spi_master_transfer_bytes_histo3.attr,
214 &dev_attr_spi_master_transfer_bytes_histo4.attr,
215 &dev_attr_spi_master_transfer_bytes_histo5.attr,
216 &dev_attr_spi_master_transfer_bytes_histo6.attr,
217 &dev_attr_spi_master_transfer_bytes_histo7.attr,
218 &dev_attr_spi_master_transfer_bytes_histo8.attr,
219 &dev_attr_spi_master_transfer_bytes_histo9.attr,
220 &dev_attr_spi_master_transfer_bytes_histo10.attr,
221 &dev_attr_spi_master_transfer_bytes_histo11.attr,
222 &dev_attr_spi_master_transfer_bytes_histo12.attr,
223 &dev_attr_spi_master_transfer_bytes_histo13.attr,
224 &dev_attr_spi_master_transfer_bytes_histo14.attr,
225 &dev_attr_spi_master_transfer_bytes_histo15.attr,
226 &dev_attr_spi_master_transfer_bytes_histo16.attr,
171 NULL, 227 NULL,
172}; 228};
173 229
@@ -186,10 +242,15 @@ void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
186 struct spi_master *master) 242 struct spi_master *master)
187{ 243{
188 unsigned long flags; 244 unsigned long flags;
245 int l2len = min(fls(xfer->len), SPI_STATISTICS_HISTO_SIZE) - 1;
246
247 if (l2len < 0)
248 l2len = 0;
189 249
190 spin_lock_irqsave(&stats->lock, flags); 250 spin_lock_irqsave(&stats->lock, flags);
191 251
192 stats->transfers++; 252 stats->transfers++;
253 stats->transfer_bytes_histo[l2len]++;
193 254
194 stats->bytes += xfer->len; 255 stats->bytes += xfer->len;
195 if ((xfer->tx_buf) && 256 if ((xfer->tx_buf) &&
@@ -270,15 +331,24 @@ EXPORT_SYMBOL_GPL(spi_bus_type);
270static int spi_drv_probe(struct device *dev) 331static int spi_drv_probe(struct device *dev)
271{ 332{
272 const struct spi_driver *sdrv = to_spi_driver(dev->driver); 333 const struct spi_driver *sdrv = to_spi_driver(dev->driver);
334 struct spi_device *spi = to_spi_device(dev);
273 int ret; 335 int ret;
274 336
275 ret = of_clk_set_defaults(dev->of_node, false); 337 ret = of_clk_set_defaults(dev->of_node, false);
276 if (ret) 338 if (ret)
277 return ret; 339 return ret;
278 340
341 if (dev->of_node) {
342 spi->irq = of_irq_get(dev->of_node, 0);
343 if (spi->irq == -EPROBE_DEFER)
344 return -EPROBE_DEFER;
345 if (spi->irq < 0)
346 spi->irq = 0;
347 }
348
279 ret = dev_pm_domain_attach(dev, true); 349 ret = dev_pm_domain_attach(dev, true);
280 if (ret != -EPROBE_DEFER) { 350 if (ret != -EPROBE_DEFER) {
281 ret = sdrv->probe(to_spi_device(dev)); 351 ret = sdrv->probe(spi);
282 if (ret) 352 if (ret)
283 dev_pm_domain_detach(dev, true); 353 dev_pm_domain_detach(dev, true);
284 } 354 }
@@ -305,12 +375,15 @@ static void spi_drv_shutdown(struct device *dev)
305} 375}
306 376
307/** 377/**
308 * spi_register_driver - register a SPI driver 378 * __spi_register_driver - register a SPI driver
309 * @sdrv: the driver to register 379 * @sdrv: the driver to register
310 * Context: can sleep 380 * Context: can sleep
381 *
382 * Return: zero on success, else a negative error code.
311 */ 383 */
312int spi_register_driver(struct spi_driver *sdrv) 384int __spi_register_driver(struct module *owner, struct spi_driver *sdrv)
313{ 385{
386 sdrv->driver.owner = owner;
314 sdrv->driver.bus = &spi_bus_type; 387 sdrv->driver.bus = &spi_bus_type;
315 if (sdrv->probe) 388 if (sdrv->probe)
316 sdrv->driver.probe = spi_drv_probe; 389 sdrv->driver.probe = spi_drv_probe;
@@ -320,7 +393,7 @@ int spi_register_driver(struct spi_driver *sdrv)
320 sdrv->driver.shutdown = spi_drv_shutdown; 393 sdrv->driver.shutdown = spi_drv_shutdown;
321 return driver_register(&sdrv->driver); 394 return driver_register(&sdrv->driver);
322} 395}
323EXPORT_SYMBOL_GPL(spi_register_driver); 396EXPORT_SYMBOL_GPL(__spi_register_driver);
324 397
325/*-------------------------------------------------------------------------*/ 398/*-------------------------------------------------------------------------*/
326 399
@@ -359,7 +432,7 @@ static DEFINE_MUTEX(board_lock);
359 * needs to discard the spi_device without adding it, then it should 432 * needs to discard the spi_device without adding it, then it should
360 * call spi_dev_put() on it. 433 * call spi_dev_put() on it.
361 * 434 *
362 * Returns a pointer to the new device, or NULL. 435 * Return: a pointer to the new device, or NULL.
363 */ 436 */
364struct spi_device *spi_alloc_device(struct spi_master *master) 437struct spi_device *spi_alloc_device(struct spi_master *master)
365{ 438{
@@ -418,7 +491,7 @@ static int spi_dev_check(struct device *dev, void *data)
418 * Companion function to spi_alloc_device. Devices allocated with 491 * Companion function to spi_alloc_device. Devices allocated with
419 * spi_alloc_device can be added onto the spi bus with this function. 492 * spi_alloc_device can be added onto the spi bus with this function.
420 * 493 *
421 * Returns 0 on success; negative errno on failure 494 * Return: 0 on success; negative errno on failure
422 */ 495 */
423int spi_add_device(struct spi_device *spi) 496int spi_add_device(struct spi_device *spi)
424{ 497{
@@ -491,7 +564,7 @@ EXPORT_SYMBOL_GPL(spi_add_device);
491 * this is exported so that for example a USB or parport based adapter 564 * this is exported so that for example a USB or parport based adapter
492 * driver could add devices (which it would learn about out-of-band). 565 * driver could add devices (which it would learn about out-of-band).
493 * 566 *
494 * Returns the new device, or NULL. 567 * Return: the new device, or NULL.
495 */ 568 */
496struct spi_device *spi_new_device(struct spi_master *master, 569struct spi_device *spi_new_device(struct spi_master *master,
497 struct spi_board_info *chip) 570 struct spi_board_info *chip)
@@ -563,6 +636,8 @@ static void spi_match_master_to_boardinfo(struct spi_master *master,
563 * 636 *
564 * The board info passed can safely be __initdata ... but be careful of 637 * The board info passed can safely be __initdata ... but be careful of
565 * any embedded pointers (platform_data, etc), they're copied as-is. 638 * any embedded pointers (platform_data, etc), they're copied as-is.
639 *
640 * Return: zero on success, else a negative error code.
566 */ 641 */
567int spi_register_board_info(struct spi_board_info const *info, unsigned n) 642int spi_register_board_info(struct spi_board_info const *info, unsigned n)
568{ 643{
@@ -597,7 +672,7 @@ static void spi_set_cs(struct spi_device *spi, bool enable)
597 if (spi->mode & SPI_CS_HIGH) 672 if (spi->mode & SPI_CS_HIGH)
598 enable = !enable; 673 enable = !enable;
599 674
600 if (spi->cs_gpio >= 0) 675 if (gpio_is_valid(spi->cs_gpio))
601 gpio_set_value(spi->cs_gpio, !enable); 676 gpio_set_value(spi->cs_gpio, !enable);
602 else if (spi->master->set_cs) 677 else if (spi->master->set_cs)
603 spi->master->set_cs(spi, !enable); 678 spi->master->set_cs(spi, !enable);
@@ -1140,6 +1215,8 @@ static int spi_init_queue(struct spi_master *master)
1140 * 1215 *
1141 * If there are more messages in the queue, the next message is returned from 1216 * If there are more messages in the queue, the next message is returned from
1142 * this call. 1217 * this call.
1218 *
1219 * Return: the next message in the queue, else NULL if the queue is empty.
1143 */ 1220 */
1144struct spi_message *spi_get_next_queued_message(struct spi_master *master) 1221struct spi_message *spi_get_next_queued_message(struct spi_master *master)
1145{ 1222{
@@ -1303,6 +1380,8 @@ static int __spi_queued_transfer(struct spi_device *spi,
1303 * spi_queued_transfer - transfer function for queued transfers 1380 * spi_queued_transfer - transfer function for queued transfers
1304 * @spi: spi device which is requesting transfer 1381 * @spi: spi device which is requesting transfer
1305 * @msg: spi message which is to handled is queued to driver queue 1382 * @msg: spi message which is to handled is queued to driver queue
1383 *
1384 * Return: zero on success, else a negative error code.
1306 */ 1385 */
1307static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg) 1386static int spi_queued_transfer(struct spi_device *spi, struct spi_message *msg)
1308{ 1387{
@@ -1433,9 +1512,6 @@ of_register_spi_device(struct spi_master *master, struct device_node *nc)
1433 } 1512 }
1434 spi->max_speed_hz = value; 1513 spi->max_speed_hz = value;
1435 1514
1436 /* IRQ */
1437 spi->irq = irq_of_parse_and_map(nc, 0);
1438
1439 /* Store a pointer to the node in the device structure */ 1515 /* Store a pointer to the node in the device structure */
1440 of_node_get(nc); 1516 of_node_get(nc);
1441 spi->dev.of_node = nc; 1517 spi->dev.of_node = nc;
@@ -1605,12 +1681,13 @@ static struct class spi_master_class = {
1605 * only ones directly touching chip registers. It's how they allocate 1681 * only ones directly touching chip registers. It's how they allocate
1606 * an spi_master structure, prior to calling spi_register_master(). 1682 * an spi_master structure, prior to calling spi_register_master().
1607 * 1683 *
1608 * This must be called from context that can sleep. It returns the SPI 1684 * This must be called from context that can sleep.
1609 * master structure on success, else NULL.
1610 * 1685 *
1611 * The caller is responsible for assigning the bus number and initializing 1686 * The caller is responsible for assigning the bus number and initializing
1612 * the master's methods before calling spi_register_master(); and (after errors 1687 * the master's methods before calling spi_register_master(); and (after errors
1613 * adding the device) calling spi_master_put() to prevent a memory leak. 1688 * adding the device) calling spi_master_put() to prevent a memory leak.
1689 *
1690 * Return: the SPI master structure on success, else NULL.
1614 */ 1691 */
1615struct spi_master *spi_alloc_master(struct device *dev, unsigned size) 1692struct spi_master *spi_alloc_master(struct device *dev, unsigned size)
1616{ 1693{
@@ -1694,6 +1771,8 @@ static int of_spi_register_master(struct spi_master *master)
1694 * success, else a negative error code (dropping the master's refcount). 1771 * success, else a negative error code (dropping the master's refcount).
1695 * After a successful return, the caller is responsible for calling 1772 * After a successful return, the caller is responsible for calling
1696 * spi_unregister_master(). 1773 * spi_unregister_master().
1774 *
1775 * Return: zero on success, else a negative error code.
1697 */ 1776 */
1698int spi_register_master(struct spi_master *master) 1777int spi_register_master(struct spi_master *master)
1699{ 1778{
@@ -1787,6 +1866,8 @@ static void devm_spi_unregister(struct device *dev, void *res)
1787 * 1866 *
1788 * Register a SPI device as with spi_register_master() which will 1867 * Register a SPI device as with spi_register_master() which will
1789 * automatically be unregister 1868 * automatically be unregister
1869 *
1870 * Return: zero on success, else a negative error code.
1790 */ 1871 */
1791int devm_spi_register_master(struct device *dev, struct spi_master *master) 1872int devm_spi_register_master(struct device *dev, struct spi_master *master)
1792{ 1873{
@@ -1892,6 +1973,8 @@ static int __spi_master_match(struct device *dev, const void *data)
1892 * arch init time. It returns a refcounted pointer to the relevant 1973 * arch init time. It returns a refcounted pointer to the relevant
1893 * spi_master (which the caller must release), or NULL if there is 1974 * spi_master (which the caller must release), or NULL if there is
1894 * no such master registered. 1975 * no such master registered.
1976 *
1977 * Return: the SPI master structure on success, else NULL.
1895 */ 1978 */
1896struct spi_master *spi_busnum_to_master(u16 bus_num) 1979struct spi_master *spi_busnum_to_master(u16 bus_num)
1897{ 1980{
@@ -1945,11 +2028,13 @@ static int __spi_validate_bits_per_word(struct spi_master *master, u8 bits_per_w
1945 * that the underlying controller or its driver does not support. For 2028 * that the underlying controller or its driver does not support. For
1946 * example, not all hardware supports wire transfers using nine bit words, 2029 * example, not all hardware supports wire transfers using nine bit words,
1947 * LSB-first wire encoding, or active-high chipselects. 2030 * LSB-first wire encoding, or active-high chipselects.
2031 *
2032 * Return: zero on success, else a negative error code.
1948 */ 2033 */
1949int spi_setup(struct spi_device *spi) 2034int spi_setup(struct spi_device *spi)
1950{ 2035{
1951 unsigned bad_bits, ugly_bits; 2036 unsigned bad_bits, ugly_bits;
1952 int status = 0; 2037 int status;
1953 2038
1954 /* check mode to prevent that DUAL and QUAD set at the same time 2039 /* check mode to prevent that DUAL and QUAD set at the same time
1955 */ 2040 */
@@ -1986,17 +2071,18 @@ int spi_setup(struct spi_device *spi)
1986 if (!spi->bits_per_word) 2071 if (!spi->bits_per_word)
1987 spi->bits_per_word = 8; 2072 spi->bits_per_word = 8;
1988 2073
1989 if (__spi_validate_bits_per_word(spi->master, spi->bits_per_word)) 2074 status = __spi_validate_bits_per_word(spi->master, spi->bits_per_word);
1990 return -EINVAL; 2075 if (status)
2076 return status;
1991 2077
1992 if (!spi->max_speed_hz) 2078 if (!spi->max_speed_hz)
1993 spi->max_speed_hz = spi->master->max_speed_hz; 2079 spi->max_speed_hz = spi->master->max_speed_hz;
1994 2080
1995 spi_set_cs(spi, false);
1996
1997 if (spi->master->setup) 2081 if (spi->master->setup)
1998 status = spi->master->setup(spi); 2082 status = spi->master->setup(spi);
1999 2083
2084 spi_set_cs(spi, false);
2085
2000 dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n", 2086 dev_dbg(&spi->dev, "setup mode %d, %s%s%s%s%u bits/w, %u Hz max --> %d\n",
2001 (int) (spi->mode & (SPI_CPOL | SPI_CPHA)), 2087 (int) (spi->mode & (SPI_CPOL | SPI_CPHA)),
2002 (spi->mode & SPI_CS_HIGH) ? "cs_high, " : "", 2088 (spi->mode & SPI_CS_HIGH) ? "cs_high, " : "",
@@ -2162,6 +2248,8 @@ static int __spi_async(struct spi_device *spi, struct spi_message *message)
2162 * no other spi_message queued to that device will be processed. 2248 * no other spi_message queued to that device will be processed.
2163 * (This rule applies equally to all the synchronous transfer calls, 2249 * (This rule applies equally to all the synchronous transfer calls,
2164 * which are wrappers around this core asynchronous primitive.) 2250 * which are wrappers around this core asynchronous primitive.)
2251 *
2252 * Return: zero on success, else a negative error code.
2165 */ 2253 */
2166int spi_async(struct spi_device *spi, struct spi_message *message) 2254int spi_async(struct spi_device *spi, struct spi_message *message)
2167{ 2255{
@@ -2214,6 +2302,8 @@ EXPORT_SYMBOL_GPL(spi_async);
2214 * no other spi_message queued to that device will be processed. 2302 * no other spi_message queued to that device will be processed.
2215 * (This rule applies equally to all the synchronous transfer calls, 2303 * (This rule applies equally to all the synchronous transfer calls,
2216 * which are wrappers around this core asynchronous primitive.) 2304 * which are wrappers around this core asynchronous primitive.)
2305 *
2306 * Return: zero on success, else a negative error code.
2217 */ 2307 */
2218int spi_async_locked(struct spi_device *spi, struct spi_message *message) 2308int spi_async_locked(struct spi_device *spi, struct spi_message *message)
2219{ 2309{
@@ -2329,7 +2419,7 @@ static int __spi_sync(struct spi_device *spi, struct spi_message *message,
2329 * Also, the caller is guaranteeing that the memory associated with the 2419 * Also, the caller is guaranteeing that the memory associated with the
2330 * message will not be freed before this call returns. 2420 * message will not be freed before this call returns.
2331 * 2421 *
2332 * It returns zero on success, else a negative error code. 2422 * Return: zero on success, else a negative error code.
2333 */ 2423 */
2334int spi_sync(struct spi_device *spi, struct spi_message *message) 2424int spi_sync(struct spi_device *spi, struct spi_message *message)
2335{ 2425{
@@ -2351,7 +2441,7 @@ EXPORT_SYMBOL_GPL(spi_sync);
2351 * SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must 2441 * SPI bus. It has to be preceded by a spi_bus_lock call. The SPI bus must
2352 * be released by a spi_bus_unlock call when the exclusive access is over. 2442 * be released by a spi_bus_unlock call when the exclusive access is over.
2353 * 2443 *
2354 * It returns zero on success, else a negative error code. 2444 * Return: zero on success, else a negative error code.
2355 */ 2445 */
2356int spi_sync_locked(struct spi_device *spi, struct spi_message *message) 2446int spi_sync_locked(struct spi_device *spi, struct spi_message *message)
2357{ 2447{
@@ -2372,7 +2462,7 @@ EXPORT_SYMBOL_GPL(spi_sync_locked);
2372 * exclusive access is over. Data transfer must be done by spi_sync_locked 2462 * exclusive access is over. Data transfer must be done by spi_sync_locked
2373 * and spi_async_locked calls when the SPI bus lock is held. 2463 * and spi_async_locked calls when the SPI bus lock is held.
2374 * 2464 *
2375 * It returns zero on success, else a negative error code. 2465 * Return: always zero.
2376 */ 2466 */
2377int spi_bus_lock(struct spi_master *master) 2467int spi_bus_lock(struct spi_master *master)
2378{ 2468{
@@ -2401,7 +2491,7 @@ EXPORT_SYMBOL_GPL(spi_bus_lock);
2401 * This call releases an SPI bus lock previously obtained by an spi_bus_lock 2491 * This call releases an SPI bus lock previously obtained by an spi_bus_lock
2402 * call. 2492 * call.
2403 * 2493 *
2404 * It returns zero on success, else a negative error code. 2494 * Return: always zero.
2405 */ 2495 */
2406int spi_bus_unlock(struct spi_master *master) 2496int spi_bus_unlock(struct spi_master *master)
2407{ 2497{
@@ -2436,6 +2526,8 @@ static u8 *buf;
2436 * portable code should never use this for more than 32 bytes. 2526 * portable code should never use this for more than 32 bytes.
2437 * Performance-sensitive or bulk transfer code should instead use 2527 * Performance-sensitive or bulk transfer code should instead use
2438 * spi_{async,sync}() calls with dma-safe buffers. 2528 * spi_{async,sync}() calls with dma-safe buffers.
2529 *
2530 * Return: zero on success, else a negative error code.
2439 */ 2531 */
2440int spi_write_then_read(struct spi_device *spi, 2532int spi_write_then_read(struct spi_device *spi,
2441 const void *txbuf, unsigned n_tx, 2533 const void *txbuf, unsigned n_tx,
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index ef008e52f953..91a0fcd72423 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -788,7 +788,6 @@ static int spidev_remove(struct spi_device *spi)
788static struct spi_driver spidev_spi_driver = { 788static struct spi_driver spidev_spi_driver = {
789 .driver = { 789 .driver = {
790 .name = "spidev", 790 .name = "spidev",
791 .owner = THIS_MODULE,
792 .of_match_table = of_match_ptr(spidev_dt_ids), 791 .of_match_table = of_match_ptr(spidev_dt_ids),
793 }, 792 },
794 .probe = spidev_probe, 793 .probe = spidev_probe,
diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h
index 20e69f0b5cb0..3ccdec94fee7 100644
--- a/drivers/staging/fbtft/fbtft.h
+++ b/drivers/staging/fbtft/fbtft.h
@@ -327,7 +327,6 @@ MODULE_DEVICE_TABLE(of, dt_ids); \
327static struct spi_driver fbtft_driver_spi_driver = { \ 327static struct spi_driver fbtft_driver_spi_driver = { \
328 .driver = { \ 328 .driver = { \
329 .name = _name, \ 329 .name = _name, \
330 .owner = THIS_MODULE, \
331 .of_match_table = of_match_ptr(dt_ids), \ 330 .of_match_table = of_match_ptr(dt_ids), \
332 }, \ 331 }, \
333 .probe = fbtft_driver_probe_spi, \ 332 .probe = fbtft_driver_probe_spi, \
diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index 704b78c78f13..ce0d254148e4 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -573,7 +573,6 @@ static int flexfb_remove_pdev(struct platform_device *pdev)
573static struct spi_driver flexfb_spi_driver = { 573static struct spi_driver flexfb_spi_driver = {
574 .driver = { 574 .driver = {
575 .name = DRVNAME, 575 .name = DRVNAME,
576 .owner = THIS_MODULE,
577 }, 576 },
578 .probe = flexfb_probe_spi, 577 .probe = flexfb_probe_spi,
579 .remove = flexfb_remove_spi, 578 .remove = flexfb_remove_spi,
diff --git a/drivers/staging/iio/accel/adis16201_core.c b/drivers/staging/iio/accel/adis16201_core.c
index 10db685813c9..06c0b75ed26a 100644
--- a/drivers/staging/iio/accel/adis16201_core.c
+++ b/drivers/staging/iio/accel/adis16201_core.c
@@ -235,7 +235,6 @@ static int adis16201_remove(struct spi_device *spi)
235static struct spi_driver adis16201_driver = { 235static struct spi_driver adis16201_driver = {
236 .driver = { 236 .driver = {
237 .name = "adis16201", 237 .name = "adis16201",
238 .owner = THIS_MODULE,
239 }, 238 },
240 .probe = adis16201_probe, 239 .probe = adis16201_probe,
241 .remove = adis16201_remove, 240 .remove = adis16201_remove,
diff --git a/drivers/staging/iio/accel/adis16203_core.c b/drivers/staging/iio/accel/adis16203_core.c
index fb593d23d5bc..de5b84ac842b 100644
--- a/drivers/staging/iio/accel/adis16203_core.c
+++ b/drivers/staging/iio/accel/adis16203_core.c
@@ -203,7 +203,6 @@ static int adis16203_remove(struct spi_device *spi)
203static struct spi_driver adis16203_driver = { 203static struct spi_driver adis16203_driver = {
204 .driver = { 204 .driver = {
205 .name = "adis16203", 205 .name = "adis16203",
206 .owner = THIS_MODULE,
207 }, 206 },
208 .probe = adis16203_probe, 207 .probe = adis16203_probe,
209 .remove = adis16203_remove, 208 .remove = adis16203_remove,
diff --git a/drivers/staging/iio/accel/adis16204_core.c b/drivers/staging/iio/accel/adis16204_core.c
index ea0ac2467ac2..20a9df64f1ed 100644
--- a/drivers/staging/iio/accel/adis16204_core.c
+++ b/drivers/staging/iio/accel/adis16204_core.c
@@ -241,7 +241,6 @@ static int adis16204_remove(struct spi_device *spi)
241static struct spi_driver adis16204_driver = { 241static struct spi_driver adis16204_driver = {
242 .driver = { 242 .driver = {
243 .name = "adis16204", 243 .name = "adis16204",
244 .owner = THIS_MODULE,
245 }, 244 },
246 .probe = adis16204_probe, 245 .probe = adis16204_probe,
247 .remove = adis16204_remove, 246 .remove = adis16204_remove,
diff --git a/drivers/staging/iio/accel/adis16209_core.c b/drivers/staging/iio/accel/adis16209_core.c
index d1dc1a3cb3ce..8b42bf8c3f60 100644
--- a/drivers/staging/iio/accel/adis16209_core.c
+++ b/drivers/staging/iio/accel/adis16209_core.c
@@ -235,7 +235,6 @@ static int adis16209_remove(struct spi_device *spi)
235static struct spi_driver adis16209_driver = { 235static struct spi_driver adis16209_driver = {
236 .driver = { 236 .driver = {
237 .name = "adis16209", 237 .name = "adis16209",
238 .owner = THIS_MODULE,
239 }, 238 },
240 .probe = adis16209_probe, 239 .probe = adis16209_probe,
241 .remove = adis16209_remove, 240 .remove = adis16209_remove,
diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c
index e46a91c69a31..d0165218b60c 100644
--- a/drivers/staging/iio/accel/adis16220_core.c
+++ b/drivers/staging/iio/accel/adis16220_core.c
@@ -482,7 +482,6 @@ static int adis16220_remove(struct spi_device *spi)
482static struct spi_driver adis16220_driver = { 482static struct spi_driver adis16220_driver = {
483 .driver = { 483 .driver = {
484 .name = "adis16220", 484 .name = "adis16220",
485 .owner = THIS_MODULE,
486 }, 485 },
487 .probe = adis16220_probe, 486 .probe = adis16220_probe,
488 .remove = adis16220_remove, 487 .remove = adis16220_remove,
diff --git a/drivers/staging/iio/accel/adis16240_core.c b/drivers/staging/iio/accel/adis16240_core.c
index cb074e864408..1b5b685a8691 100644
--- a/drivers/staging/iio/accel/adis16240_core.c
+++ b/drivers/staging/iio/accel/adis16240_core.c
@@ -288,7 +288,6 @@ static int adis16240_remove(struct spi_device *spi)
288static struct spi_driver adis16240_driver = { 288static struct spi_driver adis16240_driver = {
289 .driver = { 289 .driver = {
290 .name = "adis16240", 290 .name = "adis16240",
291 .owner = THIS_MODULE,
292 }, 291 },
293 .probe = adis16240_probe, 292 .probe = adis16240_probe,
294 .remove = adis16240_remove, 293 .remove = adis16240_remove,
diff --git a/drivers/staging/iio/accel/lis3l02dq_core.c b/drivers/staging/iio/accel/lis3l02dq_core.c
index 7a1939a66c93..7939ae6378d7 100644
--- a/drivers/staging/iio/accel/lis3l02dq_core.c
+++ b/drivers/staging/iio/accel/lis3l02dq_core.c
@@ -802,7 +802,6 @@ static int lis3l02dq_remove(struct spi_device *spi)
802static struct spi_driver lis3l02dq_driver = { 802static struct spi_driver lis3l02dq_driver = {
803 .driver = { 803 .driver = {
804 .name = "lis3l02dq", 804 .name = "lis3l02dq",
805 .owner = THIS_MODULE,
806 }, 805 },
807 .probe = lis3l02dq_probe, 806 .probe = lis3l02dq_probe,
808 .remove = lis3l02dq_remove, 807 .remove = lis3l02dq_remove,
diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c
index 03cb22508a5d..02e930c55570 100644
--- a/drivers/staging/iio/accel/sca3000_core.c
+++ b/drivers/staging/iio/accel/sca3000_core.c
@@ -1197,7 +1197,6 @@ MODULE_DEVICE_TABLE(spi, sca3000_id);
1197static struct spi_driver sca3000_driver = { 1197static struct spi_driver sca3000_driver = {
1198 .driver = { 1198 .driver = {
1199 .name = "sca3000", 1199 .name = "sca3000",
1200 .owner = THIS_MODULE,
1201 }, 1200 },
1202 .probe = sca3000_probe, 1201 .probe = sca3000_probe,
1203 .remove = sca3000_remove, 1202 .remove = sca3000_remove,
diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c
index 5b87049cd3f9..bb40f3728742 100644
--- a/drivers/staging/iio/adc/ad7192.c
+++ b/drivers/staging/iio/adc/ad7192.c
@@ -707,7 +707,6 @@ MODULE_DEVICE_TABLE(spi, ad7192_id);
707static struct spi_driver ad7192_driver = { 707static struct spi_driver ad7192_driver = {
708 .driver = { 708 .driver = {
709 .name = "ad7192", 709 .name = "ad7192",
710 .owner = THIS_MODULE,
711 }, 710 },
712 .probe = ad7192_probe, 711 .probe = ad7192_probe,
713 .remove = ad7192_remove, 712 .remove = ad7192_remove,
diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 45df714cc83a..35acb1a4669b 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -974,7 +974,6 @@ MODULE_DEVICE_TABLE(spi, ad7280_id);
974static struct spi_driver ad7280_driver = { 974static struct spi_driver ad7280_driver = {
975 .driver = { 975 .driver = {
976 .name = "ad7280", 976 .name = "ad7280",
977 .owner = THIS_MODULE,
978 }, 977 },
979 .probe = ad7280_probe, 978 .probe = ad7280_probe,
980 .remove = ad7280_remove, 979 .remove = ad7280_remove,
diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/staging/iio/adc/ad7606_spi.c
index b88f8825797d..cbb36317200e 100644
--- a/drivers/staging/iio/adc/ad7606_spi.c
+++ b/drivers/staging/iio/adc/ad7606_spi.c
@@ -103,7 +103,6 @@ MODULE_DEVICE_TABLE(spi, ad7606_id);
103static struct spi_driver ad7606_driver = { 103static struct spi_driver ad7606_driver = {
104 .driver = { 104 .driver = {
105 .name = "ad7606", 105 .name = "ad7606",
106 .owner = THIS_MODULE,
107 .pm = AD7606_SPI_PM_OPS, 106 .pm = AD7606_SPI_PM_OPS,
108 }, 107 },
109 .probe = ad7606_spi_probe, 108 .probe = ad7606_spi_probe,
diff --git a/drivers/staging/iio/adc/ad7780.c b/drivers/staging/iio/adc/ad7780.c
index 618b41faa289..3abc7789237f 100644
--- a/drivers/staging/iio/adc/ad7780.c
+++ b/drivers/staging/iio/adc/ad7780.c
@@ -264,7 +264,6 @@ MODULE_DEVICE_TABLE(spi, ad7780_id);
264static struct spi_driver ad7780_driver = { 264static struct spi_driver ad7780_driver = {
265 .driver = { 265 .driver = {
266 .name = "ad7780", 266 .name = "ad7780",
267 .owner = THIS_MODULE,
268 }, 267 },
269 .probe = ad7780_probe, 268 .probe = ad7780_probe,
270 .remove = ad7780_remove, 269 .remove = ad7780_remove,
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index ccec57c5f70d..c8e156646528 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -432,7 +432,6 @@ MODULE_DEVICE_TABLE(spi, ad7816_id);
432static struct spi_driver ad7816_driver = { 432static struct spi_driver ad7816_driver = {
433 .driver = { 433 .driver = {
434 .name = "ad7816", 434 .name = "ad7816",
435 .owner = THIS_MODULE,
436 }, 435 },
437 .probe = ad7816_probe, 436 .probe = ad7816_probe,
438 .id_table = ad7816_id, 437 .id_table = ad7816_id,
diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c
index e480abb72e4a..5cd22743e140 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -132,7 +132,6 @@ static struct spi_driver adt7316_driver = {
132 .driver = { 132 .driver = {
133 .name = "adt7316", 133 .name = "adt7316",
134 .pm = ADT7316_PM_OPS, 134 .pm = ADT7316_PM_OPS,
135 .owner = THIS_MODULE,
136 }, 135 },
137 .probe = adt7316_spi_probe, 136 .probe = adt7316_spi_probe,
138 .id_table = adt7316_spi_id, 137 .id_table = adt7316_spi_id,
diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index a861fe0149b1..2b65faa6296a 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -339,7 +339,6 @@ MODULE_DEVICE_TABLE(spi, ad9832_id);
339static struct spi_driver ad9832_driver = { 339static struct spi_driver ad9832_driver = {
340 .driver = { 340 .driver = {
341 .name = "ad9832", 341 .name = "ad9832",
342 .owner = THIS_MODULE,
343 }, 342 },
344 .probe = ad9832_probe, 343 .probe = ad9832_probe,
345 .remove = ad9832_remove, 344 .remove = ad9832_remove,
diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index fcffe2c11685..6464f2cbe94b 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -446,7 +446,6 @@ MODULE_DEVICE_TABLE(spi, ad9834_id);
446static struct spi_driver ad9834_driver = { 446static struct spi_driver ad9834_driver = {
447 .driver = { 447 .driver = {
448 .name = "ad9834", 448 .name = "ad9834",
449 .owner = THIS_MODULE,
450 }, 449 },
451 .probe = ad9834_probe, 450 .probe = ad9834_probe,
452 .remove = ad9834_remove, 451 .remove = ad9834_remove,
diff --git a/drivers/staging/iio/gyro/adis16060_core.c b/drivers/staging/iio/gyro/adis16060_core.c
index 981b63f83a7b..ab816a215eb8 100644
--- a/drivers/staging/iio/gyro/adis16060_core.c
+++ b/drivers/staging/iio/gyro/adis16060_core.c
@@ -208,7 +208,6 @@ static int adis16060_w_remove(struct spi_device *spi)
208static struct spi_driver adis16060_r_driver = { 208static struct spi_driver adis16060_r_driver = {
209 .driver = { 209 .driver = {
210 .name = "adis16060_r", 210 .name = "adis16060_r",
211 .owner = THIS_MODULE,
212 }, 211 },
213 .probe = adis16060_r_probe, 212 .probe = adis16060_r_probe,
214}; 213};
@@ -216,7 +215,6 @@ static struct spi_driver adis16060_r_driver = {
216static struct spi_driver adis16060_w_driver = { 215static struct spi_driver adis16060_w_driver = {
217 .driver = { 216 .driver = {
218 .name = "adis16060_w", 217 .name = "adis16060_w",
219 .owner = THIS_MODULE,
220 }, 218 },
221 .probe = adis16060_w_probe, 219 .probe = adis16060_w_probe,
222 .remove = adis16060_w_remove, 220 .remove = adis16060_w_remove,
diff --git a/drivers/staging/iio/magnetometer/hmc5843_spi.c b/drivers/staging/iio/magnetometer/hmc5843_spi.c
index 1549192c0dec..8be198058ea2 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_spi.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_spi.c
@@ -88,7 +88,6 @@ static struct spi_driver hmc5843_driver = {
88 .driver = { 88 .driver = {
89 .name = "hmc5843", 89 .name = "hmc5843",
90 .pm = HMC5843_PM_OPS, 90 .pm = HMC5843_PM_OPS,
91 .owner = THIS_MODULE,
92 }, 91 },
93 .id_table = hmc5843_id, 92 .id_table = hmc5843_id,
94 .probe = hmc5843_spi_probe, 93 .probe = hmc5843_spi_probe,
diff --git a/drivers/staging/iio/meter/ade7753.c b/drivers/staging/iio/meter/ade7753.c
index 188830d7e257..f129039bece3 100644
--- a/drivers/staging/iio/meter/ade7753.c
+++ b/drivers/staging/iio/meter/ade7753.c
@@ -534,7 +534,6 @@ static int ade7753_remove(struct spi_device *spi)
534static struct spi_driver ade7753_driver = { 534static struct spi_driver ade7753_driver = {
535 .driver = { 535 .driver = {
536 .name = "ade7753", 536 .name = "ade7753",
537 .owner = THIS_MODULE,
538 }, 537 },
539 .probe = ade7753_probe, 538 .probe = ade7753_probe,
540 .remove = ade7753_remove, 539 .remove = ade7753_remove,
diff --git a/drivers/staging/iio/meter/ade7754.c b/drivers/staging/iio/meter/ade7754.c
index 664c6e5f76b1..1e950685e12f 100644
--- a/drivers/staging/iio/meter/ade7754.c
+++ b/drivers/staging/iio/meter/ade7754.c
@@ -575,7 +575,6 @@ static int ade7754_remove(struct spi_device *spi)
575static struct spi_driver ade7754_driver = { 575static struct spi_driver ade7754_driver = {
576 .driver = { 576 .driver = {
577 .name = "ade7754", 577 .name = "ade7754",
578 .owner = THIS_MODULE,
579 }, 578 },
580 .probe = ade7754_probe, 579 .probe = ade7754_probe,
581 .remove = ade7754_remove, 580 .remove = ade7754_remove,
diff --git a/drivers/staging/iio/meter/ade7758_core.c b/drivers/staging/iio/meter/ade7758_core.c
index 38838085824f..0db23e4d1852 100644
--- a/drivers/staging/iio/meter/ade7758_core.c
+++ b/drivers/staging/iio/meter/ade7758_core.c
@@ -904,7 +904,6 @@ MODULE_DEVICE_TABLE(spi, ade7758_id);
904static struct spi_driver ade7758_driver = { 904static struct spi_driver ade7758_driver = {
905 .driver = { 905 .driver = {
906 .name = "ade7758", 906 .name = "ade7758",
907 .owner = THIS_MODULE,
908 }, 907 },
909 .probe = ade7758_probe, 908 .probe = ade7758_probe,
910 .remove = ade7758_remove, 909 .remove = ade7758_remove,
diff --git a/drivers/staging/iio/meter/ade7759.c b/drivers/staging/iio/meter/ade7759.c
index 11c1edcc1ed6..684e612a88b9 100644
--- a/drivers/staging/iio/meter/ade7759.c
+++ b/drivers/staging/iio/meter/ade7759.c
@@ -490,7 +490,6 @@ static int ade7759_remove(struct spi_device *spi)
490static struct spi_driver ade7759_driver = { 490static struct spi_driver ade7759_driver = {
491 .driver = { 491 .driver = {
492 .name = "ade7759", 492 .name = "ade7759",
493 .owner = THIS_MODULE,
494 }, 493 },
495 .probe = ade7759_probe, 494 .probe = ade7759_probe,
496 .remove = ade7759_remove, 495 .remove = ade7759_remove,
diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c
index da774866512c..2413052c5bfb 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -314,7 +314,6 @@ MODULE_DEVICE_TABLE(spi, ade7854_id);
314static struct spi_driver ade7854_driver = { 314static struct spi_driver ade7854_driver = {
315 .driver = { 315 .driver = {
316 .name = "ade7854", 316 .name = "ade7854",
317 .owner = THIS_MODULE,
318 }, 317 },
319 .probe = ade7854_spi_probe, 318 .probe = ade7854_spi_probe,
320 .remove = ade7854_spi_remove, 319 .remove = ade7854_spi_remove,
diff --git a/drivers/staging/iio/resolver/ad2s1200.c b/drivers/staging/iio/resolver/ad2s1200.c
index c17893b4918c..595e711d35a6 100644
--- a/drivers/staging/iio/resolver/ad2s1200.c
+++ b/drivers/staging/iio/resolver/ad2s1200.c
@@ -155,7 +155,6 @@ MODULE_DEVICE_TABLE(spi, ad2s1200_id);
155static struct spi_driver ad2s1200_driver = { 155static struct spi_driver ad2s1200_driver = {
156 .driver = { 156 .driver = {
157 .name = DRV_NAME, 157 .name = DRV_NAME,
158 .owner = THIS_MODULE,
159 }, 158 },
160 .probe = ad2s1200_probe, 159 .probe = ad2s1200_probe,
161 .id_table = ad2s1200_id, 160 .id_table = ad2s1200_id,
diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 3bd65f5c9cf5..d97aa2827412 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -735,7 +735,6 @@ MODULE_DEVICE_TABLE(spi, ad2s1210_id);
735static struct spi_driver ad2s1210_driver = { 735static struct spi_driver ad2s1210_driver = {
736 .driver = { 736 .driver = {
737 .name = DRV_NAME, 737 .name = DRV_NAME,
738 .owner = THIS_MODULE,
739 }, 738 },
740 .probe = ad2s1210_probe, 739 .probe = ad2s1210_probe,
741 .remove = ad2s1210_remove, 740 .remove = ad2s1210_remove,
diff --git a/drivers/staging/iio/resolver/ad2s90.c b/drivers/staging/iio/resolver/ad2s90.c
index c57a29616223..5b1c0db33e7f 100644
--- a/drivers/staging/iio/resolver/ad2s90.c
+++ b/drivers/staging/iio/resolver/ad2s90.c
@@ -100,7 +100,6 @@ MODULE_DEVICE_TABLE(spi, ad2s90_id);
100static struct spi_driver ad2s90_driver = { 100static struct spi_driver ad2s90_driver = {
101 .driver = { 101 .driver = {
102 .name = "ad2s90", 102 .name = "ad2s90",
103 .owner = THIS_MODULE,
104 }, 103 },
105 .probe = ad2s90_probe, 104 .probe = ad2s90_probe,
106 .id_table = ad2s90_id, 105 .id_table = ad2s90_id,
diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index 20a3f8eeb264..9dba16f1fac4 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -946,7 +946,6 @@ MODULE_DEVICE_TABLE(of, spinand_dt);
946static struct spi_driver spinand_driver = { 946static struct spi_driver spinand_driver = {
947 .driver = { 947 .driver = {
948 .name = "mt29f", 948 .name = "mt29f",
949 .owner = THIS_MODULE,
950 .of_match_table = spinand_dt, 949 .of_match_table = spinand_dt,
951 }, 950 },
952 .probe = spinand_probe, 951 .probe = spinand_probe,
diff --git a/drivers/tty/serial/ifx6x60.c b/drivers/tty/serial/ifx6x60.c
index 536a33b99be9..88246f7e435a 100644
--- a/drivers/tty/serial/ifx6x60.c
+++ b/drivers/tty/serial/ifx6x60.c
@@ -1362,7 +1362,7 @@ static struct spi_driver ifx_spi_driver = {
1362 .driver = { 1362 .driver = {
1363 .name = DRVNAME, 1363 .name = DRVNAME,
1364 .pm = &ifx_spi_pm, 1364 .pm = &ifx_spi_pm,
1365 .owner = THIS_MODULE}, 1365 },
1366 .probe = ifx_spi_spi_probe, 1366 .probe = ifx_spi_spi_probe,
1367 .shutdown = ifx_spi_spi_shutdown, 1367 .shutdown = ifx_spi_spi_shutdown,
1368 .remove = ifx_spi_spi_remove, 1368 .remove = ifx_spi_spi_remove,
diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
index 077377259a2c..5c4c280b3207 100644
--- a/drivers/tty/serial/max3100.c
+++ b/drivers/tty/serial/max3100.c
@@ -904,7 +904,6 @@ static SIMPLE_DEV_PM_OPS(max3100_pm_ops, max3100_suspend, max3100_resume);
904static struct spi_driver max3100_driver = { 904static struct spi_driver max3100_driver = {
905 .driver = { 905 .driver = {
906 .name = "max3100", 906 .name = "max3100",
907 .owner = THIS_MODULE,
908 .pm = MAX3100_PM_OPS, 907 .pm = MAX3100_PM_OPS,
909 }, 908 },
910 .probe = max3100_probe, 909 .probe = max3100_probe,
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 182549f55904..d45133056f51 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1338,7 +1338,6 @@ MODULE_DEVICE_TABLE(spi, max310x_id_table);
1338static struct spi_driver max310x_uart_driver = { 1338static struct spi_driver max310x_uart_driver = {
1339 .driver = { 1339 .driver = {
1340 .name = MAX310X_NAME, 1340 .name = MAX310X_NAME,
1341 .owner = THIS_MODULE,
1342 .of_match_table = of_match_ptr(max310x_dt_ids), 1341 .of_match_table = of_match_ptr(max310x_dt_ids),
1343 .pm = &max310x_pm_ops, 1342 .pm = &max310x_pm_ops,
1344 }, 1343 },
diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 1ae8aa698fcb..edb5305b9d4d 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1360,7 +1360,6 @@ MODULE_DEVICE_TABLE(spi, sc16is7xx_spi_id_table);
1360static struct spi_driver sc16is7xx_spi_uart_driver = { 1360static struct spi_driver sc16is7xx_spi_uart_driver = {
1361 .driver = { 1361 .driver = {
1362 .name = SC16IS7XX_NAME, 1362 .name = SC16IS7XX_NAME,
1363 .owner = THIS_MODULE,
1364 .of_match_table = of_match_ptr(sc16is7xx_dt_ids), 1363 .of_match_table = of_match_ptr(sc16is7xx_dt_ids),
1365 }, 1364 },
1366 .probe = sc16is7xx_spi_probe, 1365 .probe = sc16is7xx_spi_probe,
diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
index fc1fd403973a..bd98706d1ce9 100644
--- a/drivers/usb/host/max3421-hcd.c
+++ b/drivers/usb/host/max3421-hcd.c
@@ -1944,7 +1944,6 @@ static struct spi_driver max3421_driver = {
1944 .remove = max3421_remove, 1944 .remove = max3421_remove,
1945 .driver = { 1945 .driver = {
1946 .name = "max3421-hcd", 1946 .name = "max3421-hcd",
1947 .owner = THIS_MODULE,
1948 }, 1947 },
1949}; 1948};
1950 1949
diff --git a/drivers/video/backlight/ams369fg06.c b/drivers/video/backlight/ams369fg06.c
index 5f897f99cc9b..5cca8ce45d4d 100644
--- a/drivers/video/backlight/ams369fg06.c
+++ b/drivers/video/backlight/ams369fg06.c
@@ -556,7 +556,6 @@ static void ams369fg06_shutdown(struct spi_device *spi)
556static struct spi_driver ams369fg06_driver = { 556static struct spi_driver ams369fg06_driver = {
557 .driver = { 557 .driver = {
558 .name = "ams369fg06", 558 .name = "ams369fg06",
559 .owner = THIS_MODULE,
560 .pm = &ams369fg06_pm_ops, 559 .pm = &ams369fg06_pm_ops,
561 }, 560 },
562 .probe = ams369fg06_probe, 561 .probe = ams369fg06_probe,
diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index d7c37a8ccd1f..d7c239ea3d09 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -598,7 +598,6 @@ static int corgi_lcd_remove(struct spi_device *spi)
598static struct spi_driver corgi_lcd_driver = { 598static struct spi_driver corgi_lcd_driver = {
599 .driver = { 599 .driver = {
600 .name = "corgi-lcd", 600 .name = "corgi-lcd",
601 .owner = THIS_MODULE,
602 .pm = &corgi_lcd_pm_ops, 601 .pm = &corgi_lcd_pm_ops,
603 }, 602 },
604 .probe = corgi_lcd_probe, 603 .probe = corgi_lcd_probe,
diff --git a/drivers/video/backlight/ili922x.c b/drivers/video/backlight/ili922x.c
index e7f0890cc211..a9e9cef20ed6 100644
--- a/drivers/video/backlight/ili922x.c
+++ b/drivers/video/backlight/ili922x.c
@@ -536,7 +536,6 @@ static int ili922x_remove(struct spi_device *spi)
536static struct spi_driver ili922x_driver = { 536static struct spi_driver ili922x_driver = {
537 .driver = { 537 .driver = {
538 .name = "ili922x", 538 .name = "ili922x",
539 .owner = THIS_MODULE,
540 }, 539 },
541 .probe = ili922x_probe, 540 .probe = ili922x_probe,
542 .remove = ili922x_remove, 541 .remove = ili922x_remove,
diff --git a/drivers/video/backlight/l4f00242t03.c b/drivers/video/backlight/l4f00242t03.c
index 5fa2649c9631..e6054e2492c5 100644
--- a/drivers/video/backlight/l4f00242t03.c
+++ b/drivers/video/backlight/l4f00242t03.c
@@ -255,7 +255,6 @@ static void l4f00242t03_shutdown(struct spi_device *spi)
255static struct spi_driver l4f00242t03_driver = { 255static struct spi_driver l4f00242t03_driver = {
256 .driver = { 256 .driver = {
257 .name = "l4f00242t03", 257 .name = "l4f00242t03",
258 .owner = THIS_MODULE,
259 }, 258 },
260 .probe = l4f00242t03_probe, 259 .probe = l4f00242t03_probe,
261 .remove = l4f00242t03_remove, 260 .remove = l4f00242t03_remove,
diff --git a/drivers/video/backlight/ld9040.c b/drivers/video/backlight/ld9040.c
index f71eaf10c4eb..677f8abba27c 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -797,7 +797,6 @@ static void ld9040_shutdown(struct spi_device *spi)
797static struct spi_driver ld9040_driver = { 797static struct spi_driver ld9040_driver = {
798 .driver = { 798 .driver = {
799 .name = "ld9040", 799 .name = "ld9040",
800 .owner = THIS_MODULE,
801 .pm = &ld9040_pm_ops, 800 .pm = &ld9040_pm_ops,
802 }, 801 },
803 .probe = ld9040_probe, 802 .probe = ld9040_probe,
diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
index 14590c54aedf..4237aaa7f269 100644
--- a/drivers/video/backlight/lms283gf05.c
+++ b/drivers/video/backlight/lms283gf05.c
@@ -192,7 +192,6 @@ static int lms283gf05_probe(struct spi_device *spi)
192static struct spi_driver lms283gf05_driver = { 192static struct spi_driver lms283gf05_driver = {
193 .driver = { 193 .driver = {
194 .name = "lms283gf05", 194 .name = "lms283gf05",
195 .owner = THIS_MODULE,
196 }, 195 },
197 .probe = lms283gf05_probe, 196 .probe = lms283gf05_probe,
198}; 197};
diff --git a/drivers/video/backlight/lms501kf03.c b/drivers/video/backlight/lms501kf03.c
index 7e3810308c3e..8aa3e7662496 100644
--- a/drivers/video/backlight/lms501kf03.c
+++ b/drivers/video/backlight/lms501kf03.c
@@ -422,7 +422,6 @@ static void lms501kf03_shutdown(struct spi_device *spi)
422static struct spi_driver lms501kf03_driver = { 422static struct spi_driver lms501kf03_driver = {
423 .driver = { 423 .driver = {
424 .name = "lms501kf03", 424 .name = "lms501kf03",
425 .owner = THIS_MODULE,
426 .pm = &lms501kf03_pm_ops, 425 .pm = &lms501kf03_pm_ops,
427 }, 426 },
428 .probe = lms501kf03_probe, 427 .probe = lms501kf03_probe,
diff --git a/drivers/video/backlight/ltv350qv.c b/drivers/video/backlight/ltv350qv.c
index 383f550e165e..885612cc1008 100644
--- a/drivers/video/backlight/ltv350qv.c
+++ b/drivers/video/backlight/ltv350qv.c
@@ -295,7 +295,6 @@ static void ltv350qv_shutdown(struct spi_device *spi)
295static struct spi_driver ltv350qv_driver = { 295static struct spi_driver ltv350qv_driver = {
296 .driver = { 296 .driver = {
297 .name = "ltv350qv", 297 .name = "ltv350qv",
298 .owner = THIS_MODULE,
299 .pm = &ltv350qv_pm_ops, 298 .pm = &ltv350qv_pm_ops,
300 }, 299 },
301 300
diff --git a/drivers/video/backlight/s6e63m0.c b/drivers/video/backlight/s6e63m0.c
index 28bfa127fee4..3c4a22a3063a 100644
--- a/drivers/video/backlight/s6e63m0.c
+++ b/drivers/video/backlight/s6e63m0.c
@@ -842,7 +842,6 @@ static void s6e63m0_shutdown(struct spi_device *spi)
842static struct spi_driver s6e63m0_driver = { 842static struct spi_driver s6e63m0_driver = {
843 .driver = { 843 .driver = {
844 .name = "s6e63m0", 844 .name = "s6e63m0",
845 .owner = THIS_MODULE,
846 .pm = &s6e63m0_pm_ops, 845 .pm = &s6e63m0_pm_ops,
847 }, 846 },
848 .probe = s6e63m0_probe, 847 .probe = s6e63m0_probe,
diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index 30afce33ef2a..eab1f842f9c0 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -437,7 +437,6 @@ static void tdo24m_shutdown(struct spi_device *spi)
437static struct spi_driver tdo24m_driver = { 437static struct spi_driver tdo24m_driver = {
438 .driver = { 438 .driver = {
439 .name = "tdo24m", 439 .name = "tdo24m",
440 .owner = THIS_MODULE,
441 .pm = &tdo24m_pm_ops, 440 .pm = &tdo24m_pm_ops,
442 }, 441 },
443 .probe = tdo24m_probe, 442 .probe = tdo24m_probe,
diff --git a/drivers/video/backlight/tosa_lcd.c b/drivers/video/backlight/tosa_lcd.c
index f08d641ccd01..6a41ea92737a 100644
--- a/drivers/video/backlight/tosa_lcd.c
+++ b/drivers/video/backlight/tosa_lcd.c
@@ -263,7 +263,6 @@ static SIMPLE_DEV_PM_OPS(tosa_lcd_pm_ops, tosa_lcd_suspend, tosa_lcd_resume);
263static struct spi_driver tosa_lcd_driver = { 263static struct spi_driver tosa_lcd_driver = {
264 .driver = { 264 .driver = {
265 .name = "tosa-lcd", 265 .name = "tosa-lcd",
266 .owner = THIS_MODULE,
267 .pm = &tosa_lcd_pm_ops, 266 .pm = &tosa_lcd_pm_ops,
268 }, 267 },
269 .probe = tosa_lcd_probe, 268 .probe = tosa_lcd_probe,
diff --git a/drivers/video/backlight/vgg2432a4.c b/drivers/video/backlight/vgg2432a4.c
index d538947a67d3..242a9948f57f 100644
--- a/drivers/video/backlight/vgg2432a4.c
+++ b/drivers/video/backlight/vgg2432a4.c
@@ -251,7 +251,6 @@ static SIMPLE_DEV_PM_OPS(vgg2432a4_pm_ops, vgg2432a4_suspend, vgg2432a4_resume);
251static struct spi_driver vgg2432a4_driver = { 251static struct spi_driver vgg2432a4_driver = {
252 .driver = { 252 .driver = {
253 .name = "VGG2432A4", 253 .name = "VGG2432A4",
254 .owner = THIS_MODULE,
255 .pm = &vgg2432a4_pm_ops, 254 .pm = &vgg2432a4_pm_ops,
256 }, 255 },
257 .probe = vgg2432a4_probe, 256 .probe = vgg2432a4_probe,
diff --git a/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c b/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c
index 998978b08f5e..f7e85d1c9f9c 100644
--- a/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c
+++ b/drivers/video/fbdev/mmp/panel/tpo_tj032md01bw.c
@@ -175,7 +175,6 @@ static int tpohvga_probe(struct spi_device *spi)
175static struct spi_driver panel_tpohvga_driver = { 175static struct spi_driver panel_tpohvga_driver = {
176 .driver = { 176 .driver = {
177 .name = "tpo-hvga", 177 .name = "tpo-hvga",
178 .owner = THIS_MODULE,
179 }, 178 },
180 .probe = tpohvga_probe, 179 .probe = tpohvga_probe,
181}; 180};
diff --git a/drivers/video/fbdev/omap/lcd_mipid.c b/drivers/video/fbdev/omap/lcd_mipid.c
index 803fee618d57..0e4cee9a8d79 100644
--- a/drivers/video/fbdev/omap/lcd_mipid.c
+++ b/drivers/video/fbdev/omap/lcd_mipid.c
@@ -603,7 +603,6 @@ static int mipid_spi_remove(struct spi_device *spi)
603static struct spi_driver mipid_spi_driver = { 603static struct spi_driver mipid_spi_driver = {
604 .driver = { 604 .driver = {
605 .name = MIPID_MODULE_NAME, 605 .name = MIPID_MODULE_NAME,
606 .owner = THIS_MODULE,
607 }, 606 },
608 .probe = mipid_spi_probe, 607 .probe = mipid_spi_probe,
609 .remove = mipid_spi_remove, 608 .remove = mipid_spi_remove,
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
index 6a1b6a89a928..18eb60e9c9ec 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-lgphilips-lb035q02.c
@@ -391,7 +391,6 @@ static struct spi_driver lb035q02_spi_driver = {
391 .remove = lb035q02_panel_spi_remove, 391 .remove = lb035q02_panel_spi_remove,
392 .driver = { 392 .driver = {
393 .name = "panel_lgphilips_lb035q02", 393 .name = "panel_lgphilips_lb035q02",
394 .owner = THIS_MODULE,
395 .of_match_table = lb035q02_of_match, 394 .of_match_table = lb035q02_of_match,
396 .suppress_bind_attrs = true, 395 .suppress_bind_attrs = true,
397 }, 396 },
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
index ccf3f4f3c703..8a928c9a2fc9 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-nec-nl8048hl11.c
@@ -421,7 +421,6 @@ MODULE_DEVICE_TABLE(of, nec_8048_of_match);
421static struct spi_driver nec_8048_driver = { 421static struct spi_driver nec_8048_driver = {
422 .driver = { 422 .driver = {
423 .name = "panel-nec-nl8048hl11", 423 .name = "panel-nec-nl8048hl11",
424 .owner = THIS_MODULE,
425 .pm = NEC_8048_PM_OPS, 424 .pm = NEC_8048_PM_OPS,
426 .of_match_table = nec_8048_of_match, 425 .of_match_table = nec_8048_of_match,
427 .suppress_bind_attrs = true, 426 .suppress_bind_attrs = true,
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
index c581231c74a5..31efcca801bd 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-sony-acx565akm.c
@@ -903,7 +903,6 @@ MODULE_DEVICE_TABLE(of, acx565akm_of_match);
903static struct spi_driver acx565akm_driver = { 903static struct spi_driver acx565akm_driver = {
904 .driver = { 904 .driver = {
905 .name = "acx565akm", 905 .name = "acx565akm",
906 .owner = THIS_MODULE,
907 .of_match_table = acx565akm_of_match, 906 .of_match_table = acx565akm_of_match,
908 .suppress_bind_attrs = true, 907 .suppress_bind_attrs = true,
909 }, 908 },
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
index 9edc51133c59..4d657f3ab679 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td028ttec1.c
@@ -498,7 +498,6 @@ static struct spi_driver td028ttec1_spi_driver = {
498 498
499 .driver = { 499 .driver = {
500 .name = "panel-tpo-td028ttec1", 500 .name = "panel-tpo-td028ttec1",
501 .owner = THIS_MODULE,
502 .of_match_table = td028ttec1_of_match, 501 .of_match_table = td028ttec1_of_match,
503 .suppress_bind_attrs = true, 502 .suppress_bind_attrs = true,
504 }, 503 },
diff --git a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
index 79e4a029aab9..68e3b68a2920 100644
--- a/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
+++ b/drivers/video/fbdev/omap2/displays-new/panel-tpo-td043mtea1.c
@@ -670,7 +670,6 @@ MODULE_DEVICE_TABLE(of, tpo_td043_of_match);
670static struct spi_driver tpo_td043_spi_driver = { 670static struct spi_driver tpo_td043_spi_driver = {
671 .driver = { 671 .driver = {
672 .name = "panel-tpo-td043mtea1", 672 .name = "panel-tpo-td043mtea1",
673 .owner = THIS_MODULE,
674 .pm = &tpo_td043_spi_pm, 673 .pm = &tpo_td043_spi_pm,
675 .of_match_table = tpo_td043_of_match, 674 .of_match_table = tpo_td043_of_match,
676 .suppress_bind_attrs = true, 675 .suppress_bind_attrs = true,
diff --git a/include/linux/pxa2xx_ssp.h b/include/linux/pxa2xx_ssp.h
index 92273776bce6..c2f2574ff61c 100644
--- a/include/linux/pxa2xx_ssp.h
+++ b/include/linux/pxa2xx_ssp.h
@@ -198,6 +198,7 @@ enum pxa_ssp_type {
198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */ 198 LPSS_LPT_SSP, /* Keep LPSS types sorted with lpss_platforms[] */
199 LPSS_BYT_SSP, 199 LPSS_BYT_SSP,
200 LPSS_SPT_SSP, 200 LPSS_SPT_SSP,
201 LPSS_BXT_SSP,
201}; 202};
202 203
203struct ssp_device { 204struct ssp_device {
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 6b00f18f5e6b..cce80e6dc7d1 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -51,6 +51,8 @@ extern struct bus_type spi_bus_type;
51 * @bytes_tx: number of bytes sent to device 51 * @bytes_tx: number of bytes sent to device
52 * @bytes_rx: number of bytes received from device 52 * @bytes_rx: number of bytes received from device
53 * 53 *
54 * @transfer_bytes_histo:
55 * transfer bytes histogramm
54 */ 56 */
55struct spi_statistics { 57struct spi_statistics {
56 spinlock_t lock; /* lock for the whole structure */ 58 spinlock_t lock; /* lock for the whole structure */
@@ -68,6 +70,8 @@ struct spi_statistics {
68 unsigned long long bytes_rx; 70 unsigned long long bytes_rx;
69 unsigned long long bytes_tx; 71 unsigned long long bytes_tx;
70 72
73#define SPI_STATISTICS_HISTO_SIZE 17
74 unsigned long transfer_bytes_histo[SPI_STATISTICS_HISTO_SIZE];
71}; 75};
72 76
73void spi_statistics_add_transfer_stats(struct spi_statistics *stats, 77void spi_statistics_add_transfer_stats(struct spi_statistics *stats,
@@ -250,7 +254,7 @@ static inline struct spi_driver *to_spi_driver(struct device_driver *drv)
250 return drv ? container_of(drv, struct spi_driver, driver) : NULL; 254 return drv ? container_of(drv, struct spi_driver, driver) : NULL;
251} 255}
252 256
253extern int spi_register_driver(struct spi_driver *sdrv); 257extern int __spi_register_driver(struct module *owner, struct spi_driver *sdrv);
254 258
255/** 259/**
256 * spi_unregister_driver - reverse effect of spi_register_driver 260 * spi_unregister_driver - reverse effect of spi_register_driver
@@ -263,6 +267,10 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
263 driver_unregister(&sdrv->driver); 267 driver_unregister(&sdrv->driver);
264} 268}
265 269
270/* use a define to avoid include chaining to get THIS_MODULE */
271#define spi_register_driver(driver) \
272 __spi_register_driver(THIS_MODULE, driver)
273
266/** 274/**
267 * module_spi_driver() - Helper macro for registering a SPI driver 275 * module_spi_driver() - Helper macro for registering a SPI driver
268 * @__spi_driver: spi_driver struct 276 * @__spi_driver: spi_driver struct
@@ -843,8 +851,10 @@ extern int spi_bus_unlock(struct spi_master *master);
843 * @len: data buffer size 851 * @len: data buffer size
844 * Context: can sleep 852 * Context: can sleep
845 * 853 *
846 * This writes the buffer and returns zero or a negative error code. 854 * This function writes the buffer @buf.
847 * Callable only from contexts that can sleep. 855 * Callable only from contexts that can sleep.
856 *
857 * Return: zero on success, else a negative error code.
848 */ 858 */
849static inline int 859static inline int
850spi_write(struct spi_device *spi, const void *buf, size_t len) 860spi_write(struct spi_device *spi, const void *buf, size_t len)
@@ -867,8 +877,10 @@ spi_write(struct spi_device *spi, const void *buf, size_t len)
867 * @len: data buffer size 877 * @len: data buffer size
868 * Context: can sleep 878 * Context: can sleep
869 * 879 *
870 * This reads the buffer and returns zero or a negative error code. 880 * This function reads the buffer @buf.
871 * Callable only from contexts that can sleep. 881 * Callable only from contexts that can sleep.
882 *
883 * Return: zero on success, else a negative error code.
872 */ 884 */
873static inline int 885static inline int
874spi_read(struct spi_device *spi, void *buf, size_t len) 886spi_read(struct spi_device *spi, void *buf, size_t len)
@@ -895,7 +907,7 @@ spi_read(struct spi_device *spi, void *buf, size_t len)
895 * 907 *
896 * For more specific semantics see spi_sync(). 908 * For more specific semantics see spi_sync().
897 * 909 *
898 * It returns zero on success, else a negative error code. 910 * Return: Return: zero on success, else a negative error code.
899 */ 911 */
900static inline int 912static inline int
901spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers, 913spi_sync_transfer(struct spi_device *spi, struct spi_transfer *xfers,
@@ -919,9 +931,10 @@ extern int spi_write_then_read(struct spi_device *spi,
919 * @cmd: command to be written before data is read back 931 * @cmd: command to be written before data is read back
920 * Context: can sleep 932 * Context: can sleep
921 * 933 *
922 * This returns the (unsigned) eight bit number returned by the 934 * Callable only from contexts that can sleep.
923 * device, or else a negative error code. Callable only from 935 *
924 * contexts that can sleep. 936 * Return: the (unsigned) eight bit number returned by the
937 * device, or else a negative error code.
925 */ 938 */
926static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd) 939static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
927{ 940{
@@ -940,12 +953,13 @@ static inline ssize_t spi_w8r8(struct spi_device *spi, u8 cmd)
940 * @cmd: command to be written before data is read back 953 * @cmd: command to be written before data is read back
941 * Context: can sleep 954 * Context: can sleep
942 * 955 *
943 * This returns the (unsigned) sixteen bit number returned by the
944 * device, or else a negative error code. Callable only from
945 * contexts that can sleep.
946 *
947 * The number is returned in wire-order, which is at least sometimes 956 * The number is returned in wire-order, which is at least sometimes
948 * big-endian. 957 * big-endian.
958 *
959 * Callable only from contexts that can sleep.
960 *
961 * Return: the (unsigned) sixteen bit number returned by the
962 * device, or else a negative error code.
949 */ 963 */
950static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd) 964static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
951{ 965{
@@ -964,13 +978,13 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
964 * @cmd: command to be written before data is read back 978 * @cmd: command to be written before data is read back
965 * Context: can sleep 979 * Context: can sleep
966 * 980 *
967 * This returns the (unsigned) sixteen bit number returned by the device in cpu
968 * endianness, or else a negative error code. Callable only from contexts that
969 * can sleep.
970 *
971 * This function is similar to spi_w8r16, with the exception that it will 981 * This function is similar to spi_w8r16, with the exception that it will
972 * convert the read 16 bit data word from big-endian to native endianness. 982 * convert the read 16 bit data word from big-endian to native endianness.
973 * 983 *
984 * Callable only from contexts that can sleep.
985 *
986 * Return: the (unsigned) sixteen bit number returned by the device in cpu
987 * endianness, or else a negative error code.
974 */ 988 */
975static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd) 989static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)
976 990
diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h
index 85578d4be034..154788ed218c 100644
--- a/include/linux/spi/spi_bitbang.h
+++ b/include/linux/spi/spi_bitbang.h
@@ -4,7 +4,7 @@
4#include <linux/workqueue.h> 4#include <linux/workqueue.h>
5 5
6struct spi_bitbang { 6struct spi_bitbang {
7 spinlock_t lock; 7 struct mutex lock;
8 u8 busy; 8 u8 busy;
9 u8 use_dma; 9 u8 use_dma;
10 u8 flags; /* extra spi->mode support */ 10 u8 flags; /* extra spi->mode support */
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index 95f0bec26a1b..e2ce6c4d7ece 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -404,7 +404,6 @@ MODULE_DEVICE_TABLE(spi, ad1836_ids);
404static struct spi_driver ad1836_spi_driver = { 404static struct spi_driver ad1836_spi_driver = {
405 .driver = { 405 .driver = {
406 .name = "ad1836", 406 .name = "ad1836",
407 .owner = THIS_MODULE,
408 }, 407 },
409 .probe = ad1836_spi_probe, 408 .probe = ad1836_spi_probe,
410 .remove = ad1836_spi_remove, 409 .remove = ad1836_spi_remove,
diff --git a/sound/soc/codecs/ad193x-spi.c b/sound/soc/codecs/ad193x-spi.c
index 390cef9b9dc2..8199a3de0024 100644
--- a/sound/soc/codecs/ad193x-spi.c
+++ b/sound/soc/codecs/ad193x-spi.c
@@ -36,7 +36,6 @@ static int ad193x_spi_remove(struct spi_device *spi)
36static struct spi_driver ad193x_spi_driver = { 36static struct spi_driver ad193x_spi_driver = {
37 .driver = { 37 .driver = {
38 .name = "ad193x", 38 .name = "ad193x",
39 .owner = THIS_MODULE,
40 }, 39 },
41 .probe = ad193x_spi_probe, 40 .probe = ad193x_spi_probe,
42 .remove = ad193x_spi_remove, 41 .remove = ad193x_spi_remove,
diff --git a/sound/soc/codecs/adau1761-spi.c b/sound/soc/codecs/adau1761-spi.c
index cce2f11f1ffb..8bc1fbd25fcc 100644
--- a/sound/soc/codecs/adau1761-spi.c
+++ b/sound/soc/codecs/adau1761-spi.c
@@ -64,7 +64,6 @@ MODULE_DEVICE_TABLE(spi, adau1761_spi_id);
64static struct spi_driver adau1761_spi_driver = { 64static struct spi_driver adau1761_spi_driver = {
65 .driver = { 65 .driver = {
66 .name = "adau1761", 66 .name = "adau1761",
67 .owner = THIS_MODULE,
68 }, 67 },
69 .probe = adau1761_spi_probe, 68 .probe = adau1761_spi_probe,
70 .remove = adau1761_spi_remove, 69 .remove = adau1761_spi_remove,
diff --git a/sound/soc/codecs/adau1781-spi.c b/sound/soc/codecs/adau1781-spi.c
index 194686716bbe..33a73ff78de4 100644
--- a/sound/soc/codecs/adau1781-spi.c
+++ b/sound/soc/codecs/adau1781-spi.c
@@ -62,7 +62,6 @@ MODULE_DEVICE_TABLE(spi, adau1781_spi_id);
62static struct spi_driver adau1781_spi_driver = { 62static struct spi_driver adau1781_spi_driver = {
63 .driver = { 63 .driver = {
64 .name = "adau1781", 64 .name = "adau1781",
65 .owner = THIS_MODULE,
66 }, 65 },
67 .probe = adau1781_spi_probe, 66 .probe = adau1781_spi_probe,
68 .remove = adau1781_spi_remove, 67 .remove = adau1781_spi_remove,
diff --git a/sound/soc/codecs/adau1977-spi.c b/sound/soc/codecs/adau1977-spi.c
index b05cf5da3a94..0b46d88b481c 100644
--- a/sound/soc/codecs/adau1977-spi.c
+++ b/sound/soc/codecs/adau1977-spi.c
@@ -63,7 +63,6 @@ MODULE_DEVICE_TABLE(spi, adau1977_spi_ids);
63static struct spi_driver adau1977_spi_driver = { 63static struct spi_driver adau1977_spi_driver = {
64 .driver = { 64 .driver = {
65 .name = "adau1977", 65 .name = "adau1977",
66 .owner = THIS_MODULE,
67 }, 66 },
68 .probe = adau1977_spi_probe, 67 .probe = adau1977_spi_probe,
69 .remove = adau1977_spi_remove, 68 .remove = adau1977_spi_remove,
diff --git a/sound/soc/codecs/adav801.c b/sound/soc/codecs/adav801.c
index 790fce33ab10..055f1228c2b4 100644
--- a/sound/soc/codecs/adav801.c
+++ b/sound/soc/codecs/adav801.c
@@ -39,7 +39,6 @@ static int adav80x_spi_remove(struct spi_device *spi)
39static struct spi_driver adav80x_spi_driver = { 39static struct spi_driver adav80x_spi_driver = {
40 .driver = { 40 .driver = {
41 .name = "adav801", 41 .name = "adav801",
42 .owner = THIS_MODULE,
43 }, 42 },
44 .probe = adav80x_spi_probe, 43 .probe = adav80x_spi_probe,
45 .remove = adav80x_spi_remove, 44 .remove = adav80x_spi_remove,
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index 1fd7f72b2a62..595d02d7602c 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -344,7 +344,6 @@ MODULE_DEVICE_TABLE(spi, ak4104_id_table);
344static struct spi_driver ak4104_spi_driver = { 344static struct spi_driver ak4104_spi_driver = {
345 .driver = { 345 .driver = {
346 .name = "ak4104", 346 .name = "ak4104",
347 .owner = THIS_MODULE,
348 .of_match_table = ak4104_of_match, 347 .of_match_table = ak4104_of_match,
349 }, 348 },
350 .id_table = ak4104_id_table, 349 .id_table = ak4104_id_table,
diff --git a/sound/soc/codecs/cs4271-spi.c b/sound/soc/codecs/cs4271-spi.c
index acd49d86e706..1ff5f520196a 100644
--- a/sound/soc/codecs/cs4271-spi.c
+++ b/sound/soc/codecs/cs4271-spi.c
@@ -42,7 +42,6 @@ static int cs4271_spi_remove(struct spi_device *spi)
42static struct spi_driver cs4271_spi_driver = { 42static struct spi_driver cs4271_spi_driver = {
43 .driver = { 43 .driver = {
44 .name = "cs4271", 44 .name = "cs4271",
45 .owner = THIS_MODULE,
46 .of_match_table = of_match_ptr(cs4271_dt_ids), 45 .of_match_table = of_match_ptr(cs4271_dt_ids),
47 }, 46 },
48 .probe = cs4271_spi_probe, 47 .probe = cs4271_spi_probe,
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index 7dc52fe67c80..af23a61b7b28 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -1339,7 +1339,6 @@ static int da7210_spi_remove(struct spi_device *spi)
1339static struct spi_driver da7210_spi_driver = { 1339static struct spi_driver da7210_spi_driver = {
1340 .driver = { 1340 .driver = {
1341 .name = "da7210", 1341 .name = "da7210",
1342 .owner = THIS_MODULE,
1343 }, 1342 },
1344 .probe = da7210_spi_probe, 1343 .probe = da7210_spi_probe,
1345 .remove = da7210_spi_remove 1344 .remove = da7210_spi_remove
diff --git a/sound/soc/codecs/pcm1792a.c b/sound/soc/codecs/pcm1792a.c
index 57b0c94a710b..08bb4863e96f 100644
--- a/sound/soc/codecs/pcm1792a.c
+++ b/sound/soc/codecs/pcm1792a.c
@@ -257,7 +257,6 @@ MODULE_DEVICE_TABLE(spi, pcm1792a_spi_ids);
257static struct spi_driver pcm1792a_codec_driver = { 257static struct spi_driver pcm1792a_codec_driver = {
258 .driver = { 258 .driver = {
259 .name = "pcm1792a", 259 .name = "pcm1792a",
260 .owner = THIS_MODULE,
261 .of_match_table = of_match_ptr(pcm1792a_of_match), 260 .of_match_table = of_match_ptr(pcm1792a_of_match),
262 }, 261 },
263 .id_table = pcm1792a_spi_ids, 262 .id_table = pcm1792a_spi_ids,
diff --git a/sound/soc/codecs/pcm512x-spi.c b/sound/soc/codecs/pcm512x-spi.c
index 7b64a9cef704..712ed6598c48 100644
--- a/sound/soc/codecs/pcm512x-spi.c
+++ b/sound/soc/codecs/pcm512x-spi.c
@@ -64,7 +64,6 @@ static struct spi_driver pcm512x_spi_driver = {
64 .id_table = pcm512x_spi_id, 64 .id_table = pcm512x_spi_id,
65 .driver = { 65 .driver = {
66 .name = "pcm512x", 66 .name = "pcm512x",
67 .owner = THIS_MODULE,
68 .of_match_table = pcm512x_of_match, 67 .of_match_table = pcm512x_of_match,
69 .pm = &pcm512x_pm_ops, 68 .pm = &pcm512x_pm_ops,
70 }, 69 },
diff --git a/sound/soc/codecs/rt5677-spi.c b/sound/soc/codecs/rt5677-spi.c
index 3505aafbade4..91879ea95415 100644
--- a/sound/soc/codecs/rt5677-spi.c
+++ b/sound/soc/codecs/rt5677-spi.c
@@ -232,7 +232,6 @@ static int rt5677_spi_probe(struct spi_device *spi)
232static struct spi_driver rt5677_spi_driver = { 232static struct spi_driver rt5677_spi_driver = {
233 .driver = { 233 .driver = {
234 .name = "rt5677", 234 .name = "rt5677",
235 .owner = THIS_MODULE,
236 }, 235 },
237 .probe = rt5677_spi_probe, 236 .probe = rt5677_spi_probe,
238}; 237};
diff --git a/sound/soc/codecs/ssm2602-spi.c b/sound/soc/codecs/ssm2602-spi.c
index b5df14fbe3ad..842f373045c6 100644
--- a/sound/soc/codecs/ssm2602-spi.c
+++ b/sound/soc/codecs/ssm2602-spi.c
@@ -35,7 +35,6 @@ MODULE_DEVICE_TABLE(of, ssm2602_of_match);
35static struct spi_driver ssm2602_spi_driver = { 35static struct spi_driver ssm2602_spi_driver = {
36 .driver = { 36 .driver = {
37 .name = "ssm2602", 37 .name = "ssm2602",
38 .owner = THIS_MODULE,
39 .of_match_table = ssm2602_of_match, 38 .of_match_table = ssm2602_of_match,
40 }, 39 },
41 .probe = ssm2602_spi_probe, 40 .probe = ssm2602_spi_probe,
diff --git a/sound/soc/codecs/tlv320aic23-spi.c b/sound/soc/codecs/tlv320aic23-spi.c
index 3b387e41d75d..f801ae051658 100644
--- a/sound/soc/codecs/tlv320aic23-spi.c
+++ b/sound/soc/codecs/tlv320aic23-spi.c
@@ -43,7 +43,6 @@ static int aic23_spi_remove(struct spi_device *spi)
43static struct spi_driver aic23_spi = { 43static struct spi_driver aic23_spi = {
44 .driver = { 44 .driver = {
45 .name = "tlv320aic23", 45 .name = "tlv320aic23",
46 .owner = THIS_MODULE,
47 }, 46 },
48 .probe = aic23_spi_probe, 47 .probe = aic23_spi_probe,
49 .remove = aic23_spi_remove, 48 .remove = aic23_spi_remove,
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index 620ab9ea1ef0..2c904d7150ad 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -373,7 +373,6 @@ static int aic26_spi_remove(struct spi_device *spi)
373static struct spi_driver aic26_spi = { 373static struct spi_driver aic26_spi = {
374 .driver = { 374 .driver = {
375 .name = "tlv320aic26-codec", 375 .name = "tlv320aic26-codec",
376 .owner = THIS_MODULE,
377 }, 376 },
378 .probe = aic26_spi_probe, 377 .probe = aic26_spi_probe,
379 .remove = aic26_spi_remove, 378 .remove = aic26_spi_remove,
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index 581ec1502228..e3c34bdc2772 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -998,7 +998,6 @@ static int wm0010_spi_remove(struct spi_device *spi)
998static struct spi_driver wm0010_spi_driver = { 998static struct spi_driver wm0010_spi_driver = {
999 .driver = { 999 .driver = {
1000 .name = "wm0010", 1000 .name = "wm0010",
1001 .owner = THIS_MODULE,
1002 }, 1001 },
1003 .probe = wm0010_spi_probe, 1002 .probe = wm0010_spi_probe,
1004 .remove = wm0010_spi_remove, 1003 .remove = wm0010_spi_remove,
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index b098a83a44d8..99e40e629cca 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -644,7 +644,6 @@ static int wm8510_spi_remove(struct spi_device *spi)
644static struct spi_driver wm8510_spi_driver = { 644static struct spi_driver wm8510_spi_driver = {
645 .driver = { 645 .driver = {
646 .name = "wm8510", 646 .name = "wm8510",
647 .owner = THIS_MODULE,
648 .of_match_table = wm8510_of_match, 647 .of_match_table = wm8510_of_match,
649 }, 648 },
650 .probe = wm8510_spi_probe, 649 .probe = wm8510_spi_probe,
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 44b9e0ae7451..c759ec068e97 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -431,7 +431,6 @@ static int wm8711_spi_remove(struct spi_device *spi)
431static struct spi_driver wm8711_spi_driver = { 431static struct spi_driver wm8711_spi_driver = {
432 .driver = { 432 .driver = {
433 .name = "wm8711", 433 .name = "wm8711",
434 .owner = THIS_MODULE,
435 .of_match_table = wm8711_of_match, 434 .of_match_table = wm8711_of_match,
436 }, 435 },
437 .probe = wm8711_spi_probe, 436 .probe = wm8711_spi_probe,
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index cd7b02413ccf..1564e6926527 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -272,7 +272,6 @@ static int wm8728_spi_remove(struct spi_device *spi)
272static struct spi_driver wm8728_spi_driver = { 272static struct spi_driver wm8728_spi_driver = {
273 .driver = { 273 .driver = {
274 .name = "wm8728", 274 .name = "wm8728",
275 .owner = THIS_MODULE,
276 .of_match_table = wm8728_of_match, 275 .of_match_table = wm8728_of_match,
277 }, 276 },
278 .probe = wm8728_spi_probe, 277 .probe = wm8728_spi_probe,
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index ace8645245a0..15bd547e3c84 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -718,7 +718,6 @@ static int wm8731_spi_remove(struct spi_device *spi)
718static struct spi_driver wm8731_spi_driver = { 718static struct spi_driver wm8731_spi_driver = {
719 .driver = { 719 .driver = {
720 .name = "wm8731", 720 .name = "wm8731",
721 .owner = THIS_MODULE,
722 .of_match_table = wm8731_of_match, 721 .of_match_table = wm8731_of_match,
723 }, 722 },
724 .probe = wm8731_spi_probe, 723 .probe = wm8731_spi_probe,
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index e4a03d98aed4..e7807601e675 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -707,7 +707,6 @@ static int wm8737_spi_remove(struct spi_device *spi)
707static struct spi_driver wm8737_spi_driver = { 707static struct spi_driver wm8737_spi_driver = {
708 .driver = { 708 .driver = {
709 .name = "wm8737", 709 .name = "wm8737",
710 .owner = THIS_MODULE,
711 .of_match_table = wm8737_of_match, 710 .of_match_table = wm8737_of_match,
712 }, 711 },
713 .probe = wm8737_spi_probe, 712 .probe = wm8737_spi_probe,
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index de42c0388772..36ef91fe0511 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -657,7 +657,6 @@ static int wm8741_spi_remove(struct spi_device *spi)
657static struct spi_driver wm8741_spi_driver = { 657static struct spi_driver wm8741_spi_driver = {
658 .driver = { 658 .driver = {
659 .name = "wm8741", 659 .name = "wm8741",
660 .owner = THIS_MODULE,
661 .of_match_table = wm8741_of_match, 660 .of_match_table = wm8741_of_match,
662 }, 661 },
663 .probe = wm8741_spi_probe, 662 .probe = wm8741_spi_probe,
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 873933a7966f..bd9dcd2161bc 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -777,7 +777,6 @@ MODULE_DEVICE_TABLE(spi, wm8750_spi_ids);
777static struct spi_driver wm8750_spi_driver = { 777static struct spi_driver wm8750_spi_driver = {
778 .driver = { 778 .driver = {
779 .name = "wm8750", 779 .name = "wm8750",
780 .owner = THIS_MODULE,
781 .of_match_table = wm8750_of_match, 780 .of_match_table = wm8750_of_match,
782 }, 781 },
783 .id_table = wm8750_spi_ids, 782 .id_table = wm8750_spi_ids,
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index a801c6d75436..61299ca372ff 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1549,7 +1549,6 @@ static int wm8753_spi_remove(struct spi_device *spi)
1549static struct spi_driver wm8753_spi_driver = { 1549static struct spi_driver wm8753_spi_driver = {
1550 .driver = { 1550 .driver = {
1551 .name = "wm8753", 1551 .name = "wm8753",
1552 .owner = THIS_MODULE,
1553 .of_match_table = wm8753_of_match, 1552 .of_match_table = wm8753_of_match,
1554 }, 1553 },
1555 .probe = wm8753_spi_probe, 1554 .probe = wm8753_spi_probe,
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index 66c1f151071d..df6178464b00 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -703,7 +703,6 @@ static int wm8770_spi_remove(struct spi_device *spi)
703static struct spi_driver wm8770_spi_driver = { 703static struct spi_driver wm8770_spi_driver = {
704 .driver = { 704 .driver = {
705 .name = "wm8770", 705 .name = "wm8770",
706 .owner = THIS_MODULE,
707 .of_match_table = wm8770_of_match, 706 .of_match_table = wm8770_of_match,
708 }, 707 },
709 .probe = wm8770_spi_probe, 708 .probe = wm8770_spi_probe,
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index 183c9a4966c5..5af44f9a8cf2 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -488,7 +488,6 @@ static int wm8776_spi_remove(struct spi_device *spi)
488static struct spi_driver wm8776_spi_driver = { 488static struct spi_driver wm8776_spi_driver = {
489 .driver = { 489 .driver = {
490 .name = "wm8776", 490 .name = "wm8776",
491 .owner = THIS_MODULE,
492 .of_match_table = wm8776_of_match, 491 .of_match_table = wm8776_of_match,
493 }, 492 },
494 .probe = wm8776_spi_probe, 493 .probe = wm8776_spi_probe,
diff --git a/sound/soc/codecs/wm8804-spi.c b/sound/soc/codecs/wm8804-spi.c
index 407a3cf391e5..9998c78a2325 100644
--- a/sound/soc/codecs/wm8804-spi.c
+++ b/sound/soc/codecs/wm8804-spi.c
@@ -42,7 +42,6 @@ MODULE_DEVICE_TABLE(of, wm8804_of_match);
42static struct spi_driver wm8804_spi_driver = { 42static struct spi_driver wm8804_spi_driver = {
43 .driver = { 43 .driver = {
44 .name = "wm8804", 44 .name = "wm8804",
45 .owner = THIS_MODULE,
46 .pm = &wm8804_pm, 45 .pm = &wm8804_pm,
47 .of_match_table = wm8804_of_match, 46 .of_match_table = wm8804_of_match,
48 }, 47 },
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 98900aa66dc3..5d8dca88d612 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -1266,7 +1266,6 @@ static int wm8900_spi_remove(struct spi_device *spi)
1266static struct spi_driver wm8900_spi_driver = { 1266static struct spi_driver wm8900_spi_driver = {
1267 .driver = { 1267 .driver = {
1268 .name = "wm8900", 1268 .name = "wm8900",
1269 .owner = THIS_MODULE,
1270 }, 1269 },
1271 .probe = wm8900_spi_probe, 1270 .probe = wm8900_spi_probe,
1272 .remove = wm8900_spi_remove, 1271 .remove = wm8900_spi_remove,
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c
index f3193fb751cc..7350ff654bbf 100644
--- a/sound/soc/codecs/wm8983.c
+++ b/sound/soc/codecs/wm8983.c
@@ -1033,7 +1033,6 @@ static int wm8983_spi_remove(struct spi_device *spi)
1033static struct spi_driver wm8983_spi_driver = { 1033static struct spi_driver wm8983_spi_driver = {
1034 .driver = { 1034 .driver = {
1035 .name = "wm8983", 1035 .name = "wm8983",
1036 .owner = THIS_MODULE,
1037 }, 1036 },
1038 .probe = wm8983_spi_probe, 1037 .probe = wm8983_spi_probe,
1039 .remove = wm8983_spi_remove 1038 .remove = wm8983_spi_remove
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index 9c3c1517a4f3..9918152a03c7 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -1096,7 +1096,6 @@ static int wm8985_spi_remove(struct spi_device *spi)
1096static struct spi_driver wm8985_spi_driver = { 1096static struct spi_driver wm8985_spi_driver = {
1097 .driver = { 1097 .driver = {
1098 .name = "wm8985", 1098 .name = "wm8985",
1099 .owner = THIS_MODULE,
1100 }, 1099 },
1101 .probe = wm8985_spi_probe, 1100 .probe = wm8985_spi_probe,
1102 .remove = wm8985_spi_remove 1101 .remove = wm8985_spi_remove
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index c88ce99ce9e1..895721a256f0 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -871,7 +871,6 @@ static int wm8988_spi_remove(struct spi_device *spi)
871static struct spi_driver wm8988_spi_driver = { 871static struct spi_driver wm8988_spi_driver = {
872 .driver = { 872 .driver = {
873 .name = "wm8988", 873 .name = "wm8988",
874 .owner = THIS_MODULE,
875 }, 874 },
876 .probe = wm8988_spi_probe, 875 .probe = wm8988_spi_probe,
877 .remove = wm8988_spi_remove, 876 .remove = wm8988_spi_remove,
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index eda52a96c1fa..24500bafb0a8 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2246,7 +2246,6 @@ static int wm8995_spi_remove(struct spi_device *spi)
2246static struct spi_driver wm8995_spi_driver = { 2246static struct spi_driver wm8995_spi_driver = {
2247 .driver = { 2247 .driver = {
2248 .name = "wm8995", 2248 .name = "wm8995",
2249 .owner = THIS_MODULE,
2250 }, 2249 },
2251 .probe = wm8995_spi_probe, 2250 .probe = wm8995_spi_probe,
2252 .remove = wm8995_spi_remove 2251 .remove = wm8995_spi_remove