···11Renesas HSPI.2233Required properties:44-- compatible : "renesas,hspi"55-- reg : Offset and length of the register set for the device66-- interrupts : interrupt line used by HSPI44+- compatible : "renesas,hspi-<soctype>", "renesas,hspi" as fallback.55+ Examples with soctypes are:66+ - "renesas,hspi-r8a7778" (R-Car M1)77+ - "renesas,hspi-r8a7779" (R-Car H1)88+- reg : Offset and length of the register set for the device99+- interrupt-parent : The phandle for the interrupt controller that1010+ services interrupts for this device1111+- interrupts : Interrupt specifier1212+- #address-cells : Must be <1>1313+- #size-cells : Must be <0>1414+1515+Pinctrl properties might be needed, too. See1616+Documentation/devicetree/bindings/pinctrl/renesas,*.1717+1818+Example:1919+2020+ hspi0: spi@fffc7000 {2121+ compatible = "renesas,hspi-r8a7778", "renesas,hspi";2222+ reg = <0xfffc7000 0x18>;2323+ interrupt-parent = <&gic>;2424+ interrupts = <0 63 IRQ_TYPE_LEVEL_HIGH>;2525+ #address-cells = <1>;2626+ #size-cells = <0>;2727+ status = "disabled";2828+ };729
···11Renesas MSIOF spi controller2233Required properties:44-- compatible : "renesas,sh-msiof" for SuperH or55- "renesas,sh-mobile-msiof" for SH Mobile series66-- reg : Offset and length of the register set for the device77-- interrupts : interrupt line used by MSIOF44+- compatible : "renesas,msiof-<soctype>" for SoCs,55+ "renesas,sh-msiof" for SuperH, or66+ "renesas,sh-mobile-msiof" for SH Mobile series.77+ Examples with soctypes are:88+ "renesas,msiof-r8a7790" (R-Car H2)99+ "renesas,msiof-r8a7791" (R-Car M2)1010+- reg : Offset and length of the register set for the device1111+- interrupt-parent : The phandle for the interrupt controller that1212+ services interrupts for this device1313+- interrupts : Interrupt specifier1414+- #address-cells : Must be <1>1515+- #size-cells : Must be <0>816917Optional properties:1010-- num-cs : total number of chip-selects1111-- renesas,tx-fifo-size : Overrides the default tx fifo size given in words1212-- renesas,rx-fifo-size : Overrides the default rx fifo size given in words1818+- clocks : Must contain a reference to the functional clock.1919+- num-cs : Total number of chip-selects (default is 1)2020+2121+Optional properties, deprecated for soctype-specific bindings:2222+- renesas,tx-fifo-size : Overrides the default tx fifo size given in words2323+ (default is 64)2424+- renesas,rx-fifo-size : Overrides the default rx fifo size given in words2525+ (default is 64, or 256 on R-Car H2 and M2)2626+2727+Pinctrl properties might be needed, too. See2828+Documentation/devicetree/bindings/pinctrl/renesas,*.2929+3030+Example:3131+3232+ msiof0: spi@e6e20000 {3333+ compatible = "renesas,msiof-r8a7791";3434+ reg = <0 0xe6e20000 0 0x0064>;3535+ interrupts = <0 156 IRQ_TYPE_LEVEL_HIGH>;3636+ clocks = <&mstp0_clks R8A7791_CLK_MSIOF0>;3737+ #address-cells = <1>;3838+ #size-cells = <0>;3939+ status = "disabled";4040+ };
+6
Documentation/spi/spidev
···8585 SPI_MODE_0..SPI_MODE_3; or if you prefer you can combine SPI_CPOL8686 (clock polarity, idle high iff this is set) or SPI_CPHA (clock phase,8787 sample on trailing edge iff this is set) flags.8888+ Note that this request is limited to SPI mode flags that fit in a8989+ single byte.9090+9191+ SPI_IOC_RD_MODE32, SPI_IOC_WR_MODE32 ... pass a pointer to a uin32_t9292+ which will return (RD) or assign (WR) the full SPI transfer mode,9393+ not limited to the bits that fit in one byte.88948995 SPI_IOC_RD_LSB_FIRST, SPI_IOC_WR_LSB_FIRST ... pass a pointer to a byte9096 which will return (RD) or assign (WR) the bit justification used to
···3030}31313232static const char *device = "/dev/spidev1.1";3333-static uint8_t mode;3333+static uint32_t mode;3434static uint8_t bits = 8;3535static uint32_t speed = 500000;3636static uint16_t delay;···5757 .bits_per_word = bits,5858 };59596060+ if (mode & SPI_TX_QUAD)6161+ tr.tx_nbits = 4;6262+ else if (mode & SPI_TX_DUAL)6363+ tr.tx_nbits = 2;6464+ if (mode & SPI_RX_QUAD)6565+ tr.rx_nbits = 4;6666+ else if (mode & SPI_RX_DUAL)6767+ tr.rx_nbits = 2;6868+ if (!(mode & SPI_LOOP)) {6969+ if (mode & (SPI_TX_QUAD | SPI_TX_DUAL))7070+ tr.rx_buf = 0;7171+ else if (mode & (SPI_RX_QUAD | SPI_RX_DUAL))7272+ tr.tx_buf = 0;7373+ }7474+6075 ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);6176 if (ret < 1)6277 pabort("can't send spi message");···9681 " -O --cpol clock polarity\n"9782 " -L --lsb least significant bit first\n"9883 " -C --cs-high chip select active high\n"9999- " -3 --3wire SI/SO signals shared\n");8484+ " -3 --3wire SI/SO signals shared\n"8585+ " -N --no-cs no chip select\n"8686+ " -R --ready slave pulls low to pause\n"8787+ " -2 --dual dual transfer\n"8888+ " -4 --quad quad transfer\n");10089 exit(1);10190}10291···120101 { "3wire", 0, 0, '3' },121102 { "no-cs", 0, 0, 'N' },122103 { "ready", 0, 0, 'R' },104104+ { "dual", 0, 0, '2' },105105+ { "quad", 0, 0, '4' },123106 { NULL, 0, 0, 0 },124107 };125108 int c;126109127127- c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR", lopts, NULL);110110+ c = getopt_long(argc, argv, "D:s:d:b:lHOLC3NR24", lopts, NULL);128111129112 if (c == -1)130113 break;···168147 case 'R':169148 mode |= SPI_READY;170149 break;150150+ case '2':151151+ mode |= SPI_TX_DUAL;152152+ break;153153+ case '4':154154+ mode |= SPI_TX_QUAD;155155+ break;171156 default:172157 print_usage(argv[0]);173158 break;174159 }160160+ }161161+ if (mode & SPI_LOOP) {162162+ if (mode & SPI_TX_DUAL)163163+ mode |= SPI_RX_DUAL;164164+ if (mode & SPI_TX_QUAD)165165+ mode |= SPI_RX_QUAD;175166 }176167}177168···201168 /*202169 * spi mode203170 */204204- ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);171171+ ret = ioctl(fd, SPI_IOC_WR_MODE32, &mode);205172 if (ret == -1)206173 pabort("can't set spi mode");207174208208- ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);175175+ ret = ioctl(fd, SPI_IOC_RD_MODE32, &mode);209176 if (ret == -1)210177 pabort("can't get spi mode");211178···231198 if (ret == -1)232199 pabort("can't get max speed hz");233200234234- printf("spi mode: %d\n", mode);201201+ printf("spi mode: 0x%x\n", mode);235202 printf("bits per word: %d\n", bits);236203 printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);237204
-1
drivers/spi/Kconfig
···429429 tristate "SuperH MSIOF SPI controller"430430 depends on HAVE_CLK431431 depends on SUPERH || ARCH_SHMOBILE || COMPILE_TEST432432- select SPI_BITBANG433432 help434433 SPI driver for SuperH and SH Mobile MSIOF blocks.435434