/linux/drivers/spi/ |
H A D | Makefile | 3 # Makefile for kernel SPI drivers. 10 obj-$(CONFIG_SPI_MASTER) += spi.o 11 obj-$(CONFIG_SPI_MEM) += spi-mem.o 12 obj-$(CONFIG_SPI_MUX) += spi-mux.o 13 obj-$(CONFIG_SPI_OFFLOAD) += spi-offload.o 15 obj-$(CONFIG_SPI_LOOPBACK_TEST) += spi-loopback-test.o 17 # SPI master controller drivers (bus) 18 obj-$(CONFIG_SPI_AIROHA_SNFI) += spi-airoha-snfi.o 19 obj-$(CONFIG_SPI_ALTERA) += spi-altera-platform.o 20 obj-$(CONFIG_SPI_ALTERA_CORE) += spi-altera-core.o [all …]
|
H A D | Kconfig | 3 # SPI driver configuration 5 menuconfig SPI config 6 bool "SPI support" 10 protocol. Chips that support SPI can have data transfer rates 12 controller and a chipselect. Most SPI slaves don't support 15 SPI is widely used by microcontrollers to talk with sensors, 18 MMC and SD cards can be accessed using SPI protocol; and for 19 DataFlash cards used in MMC sockets, SPI must always be used. 21 SPI is one of a family of similar protocols using a four wire 26 if SPI [all …]
|
H A D | spi-microchip-core.c | 3 * Microchip CoreSPI SPI controller driver 21 #include <linux/spi/spi.h> 107 u32 clk_gen; /* divider for spi output clock generated by the controller */ 116 static inline u32 mchp_corespi_read(struct mchp_corespi *spi, unsigned int reg) in mchp_corespi_read() argument 118 return readl(spi->regs + reg); in mchp_corespi_read() 121 static inline void mchp_corespi_write(struct mchp_corespi *spi, unsigned int reg, u32 val) in mchp_corespi_write() argument 123 writel(val, spi->regs + reg); in mchp_corespi_write() 126 static inline void mchp_corespi_disable(struct mchp_corespi *spi) in mchp_corespi_disable() argument 128 u32 control = mchp_corespi_read(spi, REG_CONTROL); in mchp_corespi_disable() 132 mchp_corespi_write(spi, REG_CONTROL, control); in mchp_corespi_disable() [all …]
|
H A D | spi-apple.c | 3 // Apple SoC SPI device driver 7 // Based on spi-sifive.c, Copyright 2018 SiFive, Inc. 18 #include <linux/spi/spi.h> 129 static inline void reg_write(struct apple_spi *spi, int offset, u32 value) in reg_write() argument 131 writel_relaxed(value, spi->regs + offset); in reg_write() 134 static inline u32 reg_read(struct apple_spi *spi, int offset) in reg_read() argument 136 return readl_relaxed(spi->regs + offset); in reg_read() 139 static inline void reg_mask(struct apple_spi *spi, int offset, u32 clear, u32 set) in reg_mask() argument 141 u32 val = reg_read(spi, offset); in reg_mask() 145 reg_write(spi, offset, val); in reg_mask() [all …]
|
H A D | spi-gpio.c | 3 * SPI host driver using generic bitbanged GPIO 15 #include <linux/spi/spi.h> 16 #include <linux/spi/spi_bitbang.h> 17 #include <linux/spi/spi_gpio.h> 20 * This bitbanging SPI host driver should help make systems usable 21 * when a native hardware SPI engine is not available, perhaps because 27 * spi->controller_state ... reserved for bitbang framework code 29 * spi->controller->dev.driver_data ... points to spi_gpio->bitbang 47 spi_to_spi_gpio(const struct spi_device *spi) in spi_to_spi_gpio() argument 52 bang = spi_controller_get_devdata(spi->controller); in spi_to_spi_gpio() [all …]
|
H A D | spi.c | 2 // SPI init/core code 34 #include <linux/spi/offload/types.h> 35 #include <linux/spi/spi.h> 36 #include <linux/spi/spi-mem.h> 40 #include <trace/events/spi.h> 50 struct spi_device *spi = to_spi_device(dev); in spidev_release() local 52 spi_controller_put(spi->controller); in spidev_release() 53 kfree(spi->driver_override); in spidev_release() 54 free_percpu(spi->pcpu_statistics); in spidev_release() 55 kfree(spi); in spidev_release() [all …]
|
H A D | spi-omap2-mcspi.c | 28 #include <linux/spi/spi.h> 32 #include <linux/platform_data/spi-omap2-mcspi.h> 165 static inline void mcspi_write_cs_reg(const struct spi_device *spi, in mcspi_write_cs_reg() argument 168 struct omap2_mcspi_cs *cs = spi->controller_state; in mcspi_write_cs_reg() 173 static inline u32 mcspi_read_cs_reg(const struct spi_device *spi, int idx) in mcspi_read_cs_reg() argument 175 struct omap2_mcspi_cs *cs = spi->controller_state; in mcspi_read_cs_reg() 180 static inline u32 mcspi_cached_chconf0(const struct spi_device *spi) in mcspi_cached_chconf0() argument 182 struct omap2_mcspi_cs *cs = spi->controller_state; in mcspi_cached_chconf0() 187 static inline void mcspi_write_chconf0(const struct spi_device *spi, u32 val) in mcspi_write_chconf0() argument 189 struct omap2_mcspi_cs *cs = spi->controller_state; in mcspi_write_chconf0() [all …]
|
H A D | spi-loongson-core.c | 2 // Loongson SPI Support 15 #include <linux/spi/spi.h> 17 #include "spi-loongson.h" 19 static inline void loongson_spi_write_reg(struct loongson_spi *spi, unsigned char reg, in loongson_spi_write_reg() argument 22 writeb(data, spi->base + reg); in loongson_spi_write_reg() 25 static inline char loongson_spi_read_reg(struct loongson_spi *spi, unsigned char reg) in loongson_spi_read_reg() argument 27 return readb(spi->base + reg); in loongson_spi_read_reg() 30 static void loongson_spi_set_cs(struct spi_device *spi, bool en) in loongson_spi_set_cs() argument 33 unsigned char mask = (BIT(4) | BIT(0)) << spi_get_chipselect(spi, 0); in loongson_spi_set_cs() 34 unsigned char val = en ? mask : (BIT(0) << spi_get_chipselect(spi, 0)); in loongson_spi_set_cs() [all …]
|
/linux/drivers/video/backlight/ |
H A D | ili922x.c | 7 * controller. The interface to the display is SPI and the display's 19 #include <linux/spi/spi.h> 104 * for the SPI transfer. According to the datasheet, the controller 109 * @s: pointer to an SPI device 138 struct spi_device *spi; member 145 * @spi: spi device 148 static int ili922x_read_status(struct spi_device *spi, u16 *rs) in ili922x_read_status() argument 161 CHECK_FREQ_REG(spi, &xfer); in ili922x_read_status() 175 ret = spi_sync(spi, &msg); in ili922x_read_status() 177 dev_dbg(&spi->dev, "Error sending SPI message 0x%x", ret); in ili922x_read_status() [all …]
|
H A D | l4f00242t03.c | 21 #include <linux/spi/spi.h> 24 struct spi_device *spi; member 46 static void l4f00242t03_lcd_init(struct spi_device *spi) in l4f00242t03_lcd_init() argument 48 struct l4f00242t03_priv *priv = spi_get_drvdata(spi); in l4f00242t03_lcd_init() 52 dev_dbg(&spi->dev, "initializing LCD\n"); in l4f00242t03_lcd_init() 56 dev_err(&spi->dev, "failed to set the IO regulator voltage.\n"); in l4f00242t03_lcd_init() 61 dev_err(&spi->dev, "failed to enable the IO regulator.\n"); in l4f00242t03_lcd_init() 67 dev_err(&spi->dev, "failed to set the core regulator voltage.\n"); in l4f00242t03_lcd_init() 73 dev_err(&spi->dev, "failed to enable the core regulator.\n"); in l4f00242t03_lcd_init() 82 spi_write(spi, (const u8 *)cmd, ARRAY_SIZE(cmd) * sizeof(u16)); in l4f00242t03_lcd_init() [all …]
|
/linux/drivers/staging/greybus/ |
H A D | spilib.c | 3 * Greybus SPI library 14 #include <linux/spi/spi.h> 45 static struct spi_controller *get_controller_from_spi(struct gb_spilib *spi) in get_controller_from_spi() argument 47 return gb_connection_get_data(spi->connection); in get_controller_from_spi() 95 static void clean_xfer_state(struct gb_spilib *spi) in clean_xfer_state() argument 97 spi->first_xfer = NULL; in clean_xfer_state() 98 spi->last_xfer = NULL; in clean_xfer_state() 99 spi->rx_xfer_offset = 0; in clean_xfer_state() 100 spi->tx_xfer_offset = 0; in clean_xfer_state() 101 spi->last_xfer_size = 0; in clean_xfer_state() [all …]
|
/linux/drivers/net/wan/ |
H A D | slic_ds26522.c | 16 #include <linux/spi/spi.h> 38 static void slic_write(struct spi_device *spi, u16 addr, in slic_write() argument 49 /* write spi addr and value */ in slic_write() 50 spi_write(spi, &temp[0], SLIC_THREE_LEN); in slic_write() 53 static u8 slic_read(struct spi_device *spi, u16 addr) in slic_read() argument 62 spi_write_then_read(spi, &temp[0], SLIC_TWO_LEN, &data, in slic_read() 69 static bool get_slic_product_code(struct spi_device *spi) in get_slic_product_code() argument 73 device_id = slic_read(spi, DS26522_IDR_ADDR); in get_slic_product_code() 80 static void ds26522_e1_spec_config(struct spi_device *spi) in ds26522_e1_spec_config() argument 83 slic_write(spi, DS26522_RMMR_ADDR, DS26522_RMMR_E1); in ds26522_e1_spec_config() [all …]
|
/linux/drivers/net/can/spi/ |
H A D | mcp251x.c | 2 /* CAN bus driver for Microchip 251x/25625 CAN Controller with SPI Interface 42 #include <linux/spi/spi.h> 45 /* SPI interface instruction set */ 196 /* Buffer size required for the largest SPI transfer (i.e., reading a 230 struct spi_device *spi; member 233 struct mutex mcp_lock; /* SPI device lock */ 263 static inline int mcp251x_is_##_model(struct spi_device *spi) \ 265 struct mcp251x_priv *priv = spi_get_drvdata(spi); \ 285 * registers via SPI is not really different conceptually than using 296 static int mcp251x_spi_trans(struct spi_device *spi, int len) in mcp251x_spi_trans() argument [all …]
|
H A D | hi311x.c | 2 /* CAN bus driver for Holt HI3110 CAN Controller with SPI Interface 35 #include <linux/spi/spi.h> 147 struct spi_device *spi; member 150 struct mutex hi3110_lock; /* SPI device lock */ 189 * registers via SPI is not really different conceptually than using 200 static int hi3110_spi_trans(struct spi_device *spi, int len) in hi3110_spi_trans() argument 202 struct hi3110_priv *priv = spi_get_drvdata(spi); in hi3110_spi_trans() 215 ret = spi_sync(spi, &m); in hi3110_spi_trans() 218 dev_err(&spi->dev, "spi transfer failed: ret = %d\n", ret); in hi3110_spi_trans() 222 static int hi3110_cmd(struct spi_device *spi, u8 command) in hi3110_cmd() argument [all …]
|
/linux/drivers/misc/ |
H A D | gehc-achc.c | 15 #include <linux/spi/spi.h> 59 static int ezport_start_programming(struct spi_device *spi, struct gpio_desc *reset) in ezport_start_programming() argument 68 spi_bus_lock(spi->controller); in ezport_start_programming() 73 ret = spi_sync_locked(spi, &msg); in ezport_start_programming() 85 ret = spi_sync_locked(spi, &msg); in ezport_start_programming() 88 spi_bus_unlock(spi->controller); in ezport_start_programming() 92 static void ezport_stop_programming(struct spi_device *spi, struct gpio_desc *reset) in ezport_stop_programming() argument 95 spi_bus_lock(spi->controller); in ezport_stop_programming() 97 spi_bus_unlock(spi->controller); in ezport_stop_programming() 100 static int ezport_get_status_register(struct spi_device *spi) in ezport_get_status_register() argument [all …]
|
H A D | lattice-ecp3-config.c | 11 #include <linux/spi/spi.h> 36 * (LatticeECP3 Slave SPI Port User's Guide) 67 struct spi_device *spi = (struct spi_device *)context; in firmware_load() local 68 struct fpga_data *data = spi_get_drvdata(spi); in firmware_load() 78 dev_err(&spi->dev, "Cannot load firmware, aborting\n"); in firmware_load() 83 dev_err(&spi->dev, "Error: Firmware size is 0!\n"); in firmware_load() 92 /* Trying to speak with the FPGA via SPI... */ in firmware_load() 94 spi_write_then_read(spi, txbuf, 8, rxbuf, rx_len); in firmware_load() 96 dev_dbg(&spi->dev, "FPGA JTAG ID=%08x\n", jedec_id); in firmware_load() 103 dev_err(&spi->dev, in firmware_load() [all …]
|
/linux/Documentation/devicetree/bindings/spi/ |
H A D | brcm,spi-bcm-qspi.yaml | 4 $id: http://devicetree.org/schemas/spi/brcm,spi-bcm-qspi.yaml# 7 title: Broadcom SPI controller 14 The Broadcom SPI controller is a SPI master found on various SOCs, including 15 BRCMSTB (BCM7XXX), Cygnus, NSP and NS2. The Broadcom Master SPI hw IP consists 17 MSPI : SPI master controller can read and write to a SPI slave device 18 BSPI : Broadcom SPI in combination with the MSPI hw IP provides acceleration 25 use SPI protocol. 28 - $ref: spi-controller.yaml# 36 - brcm,spi-bcm7425-qspi 37 - brcm,spi-bcm7429-qspi [all …]
|
H A D | snps,dw-apb-ssi.yaml | 4 $id: http://devicetree.org/schemas/spi/snps,dw-apb-ssi.yaml# 13 - $ref: spi-controller.yaml# 19 - mscc,ocelot-spi 20 - mscc,jaguar2-spi 44 const: amd,pensando-elba-spi 55 - description: Generic DW SPI Controller 59 - description: Microchip Sparx5 SoC SPI Controller 60 const: microchip,sparx5-spi 61 - description: Amazon Alpine SPI Controller 66 - mscc,ocelot-spi [all …]
|
H A D | spi-rockchip.yaml | 4 $id: http://devicetree.org/schemas/spi/spi-rockchip.yaml# 7 title: Rockchip SPI Controller 10 The Rockchip SPI controller is used to interface with various devices such 11 as flash and display controllers using the SPI communication interface. 14 - $ref: spi-controller.yaml# 23 - const: rockchip,rk3036-spi 24 - const: rockchip,rk3066-spi 25 - const: rockchip,rk3228-spi 26 - const: rockchip,rv1108-spi 29 - rockchip,px30-spi [all …]
|
H A D | samsung,spi.yaml | 4 $id: http://devicetree.org/schemas/spi/samsung,spi.yaml# 7 title: Samsung S3C/S5P/Exynos SoC SPI controller 13 All the SPI controller nodes should be represented in the aliases node using 14 the following format 'spi{n}' where n is a unique number for the alias. 20 - google,gs101-spi 21 - samsung,s3c2443-spi # for S3C2443, S3C2416 and S3C2450 22 - samsung,s3c6410-spi 23 - samsung,s5pv210-spi # for S5PV210 and S5PC110 24 - samsung,exynos4210-spi 25 - samsung,exynos5433-spi [all …]
|
/linux/drivers/media/dvb-frontends/cxd2880/ |
H A D | cxd2880_spi_device.c | 5 * SPI access functions 10 #include <linux/spi/spi.h> 14 static int cxd2880_spi_device_write(struct cxd2880_spi *spi, in cxd2880_spi_device_write() argument 22 if (!spi || !spi->user || !data || size == 0) in cxd2880_spi_device_write() 25 spi_device = spi->user; in cxd2880_spi_device_write() 33 result = spi_sync(spi_device->spi, &msg); in cxd2880_spi_device_write() 41 static int cxd2880_spi_device_write_read(struct cxd2880_spi *spi, in cxd2880_spi_device_write_read() argument 50 if (!spi || !spi->user || !tx_data || in cxd2880_spi_device_write_read() 54 spi_device = spi->user; in cxd2880_spi_device_write_read() 56 result = spi_write_then_read(spi_device->spi, tx_data, in cxd2880_spi_device_write_read() [all …]
|
/linux/drivers/video/fbdev/omap2/omapfb/displays/ |
H A D | panel-lgphilips-lb035q02.c | 12 #include <linux/spi/spi.h> 43 struct spi_device *spi; member 54 static int lb035q02_write_reg(struct spi_device *spi, u8 reg, u16 val) in lb035q02_write_reg() argument 82 return spi_sync(spi, &msg); in lb035q02_write_reg() 85 static void init_lb035q02_panel(struct spi_device *spi) in init_lb035q02_panel() argument 88 lb035q02_write_reg(spi, 0x01, 0x6300); in init_lb035q02_panel() 89 lb035q02_write_reg(spi, 0x02, 0x0200); in init_lb035q02_panel() 90 lb035q02_write_reg(spi, 0x03, 0x0177); in init_lb035q02_panel() 91 lb035q02_write_reg(spi, 0x04, 0x04c7); in init_lb035q02_panel() 92 lb035q02_write_reg(spi, 0x05, 0xffc0); in init_lb035q02_panel() [all …]
|
/linux/drivers/iio/common/st_sensors/ |
H A D | st_sensors_spi.c | 3 * STMicroelectronics sensors spi library driver 15 #include <linux/spi/spi.h> 33 * st_sensors_is_spi_3_wire() - check if SPI 3-wire mode has been selected 34 * @spi: spi device reference. 36 * Return: true if SPI 3-wire mode is selected, false otherwise. 38 static bool st_sensors_is_spi_3_wire(struct spi_device *spi) in st_sensors_is_spi_3_wire() argument 41 struct device *dev = &spi->dev; in st_sensors_is_spi_3_wire() 43 if (device_property_read_bool(dev, "spi-3wire")) in st_sensors_is_spi_3_wire() 54 * st_sensors_configure_spi_3_wire() - configure SPI 3-wire if needed 55 * @spi: spi device reference. [all …]
|
/linux/Documentation/spi/ |
H A D | spi-summary.rst | 2 Overview of Linux kernel SPI support 7 What is SPI? 9 The "Serial Peripheral Interface" (SPI) is a synchronous four wire serial 12 standardization body. SPI uses a host/target configuration. 22 SPI hosts use a fourth "chip select" line to activate a given SPI target 24 in parallel. All SPI targets support chipselects; they are usually active 29 SPI target functions are usually not interoperable between vendors 30 (except for commodities like SPI memory chips). 32 - SPI may be used for request/response style device protocols, as with 44 - Sometimes SPI is used to daisy-chain devices, like shift registers. [all …]
|
/linux/drivers/net/dsa/b53/ |
H A D | b53_spi.c | 2 * B53 register access through SPI 24 #include <linux/spi/spi.h> 42 static inline int b53_spi_read_reg(struct spi_device *spi, u8 reg, u8 *val, in b53_spi_read_reg() argument 50 return spi_write_then_read(spi, txbuf, 2, val, len); in b53_spi_read_reg() 53 static inline int b53_spi_clear_status(struct spi_device *spi) in b53_spi_clear_status() argument 60 ret = b53_spi_read_reg(spi, B53_SPI_STATUS, &rxbuf, 1); in b53_spi_clear_status() 76 static inline int b53_spi_set_page(struct spi_device *spi, u8 page) in b53_spi_set_page() argument 84 return spi_write(spi, txbuf, sizeof(txbuf)); in b53_spi_set_page() 87 static inline int b53_prepare_reg_access(struct spi_device *spi, u8 page) in b53_prepare_reg_access() argument 89 int ret = b53_spi_clear_status(spi); in b53_prepare_reg_access() [all …]
|