···11+Qualcomm Universal Peripheral (QUP) Serial Peripheral Interface (SPI)22+33+The QUP core is an AHB slave that provides a common data path (an output FIFO44+and an input FIFO) for serial peripheral interface (SPI) mini-core.55+66+SPI in master mode supports up to 50MHz, up to four chip selects, programmable77+data path from 4 bits to 32 bits and numerous protocol variants.88+99+Required properties:1010+- compatible: Should contain "qcom,spi-qup-v2.1.1" or "qcom,spi-qup-v2.2.1"1111+- reg: Should contain base register location and length1212+- interrupts: Interrupt number used by this controller1313+1414+- clocks: Should contain the core clock and the AHB clock.1515+- clock-names: Should be "core" for the core clock and "iface" for the1616+ AHB clock.1717+1818+- #address-cells: Number of cells required to define a chip select1919+ address on the SPI bus. Should be set to 1.2020+- #size-cells: Should be zero.2121+2222+Optional properties:2323+- spi-max-frequency: Specifies maximum SPI clock frequency,2424+ Units - Hz. Definition as per2525+ Documentation/devicetree/bindings/spi/spi-bus.txt2626+2727+SPI slave nodes must be children of the SPI master node and can contain2828+properties described in Documentation/devicetree/bindings/spi/spi-bus.txt2929+3030+Example:3131+3232+ spi_8: spi@f9964000 { /* BLSP2 QUP2 */3333+3434+ compatible = "qcom,spi-qup-v2";3535+ #address-cells = <1>;3636+ #size-cells = <0>;3737+ reg = <0xf9964000 0x1000>;3838+ interrupts = <0 102 0>;3939+ spi-max-frequency = <19200000>;4040+4141+ clocks = <&gcc GCC_BLSP2_QUP2_SPI_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>;4242+ clock-names = "core", "iface";4343+4444+ pinctrl-names = "default";4545+ pinctrl-0 = <&spi8_default>;4646+4747+ device@0 {4848+ compatible = "arm,pl022-dummy";4949+ #address-cells = <1>;5050+ #size-cells = <1>;5151+ reg = <0>; /* Chip select 0 */5252+ spi-max-frequency = <19200000>;5353+ spi-cpol;5454+ };5555+5656+ device@1 {5757+ compatible = "arm,pl022-dummy";5858+ #address-cells = <1>;5959+ #size-cells = <1>;6060+ reg = <1>; /* Chip select 1 */6161+ spi-max-frequency = <9600000>;6262+ spi-cpha;6363+ };6464+6565+ device@2 {6666+ compatible = "arm,pl022-dummy";6767+ #address-cells = <1>;6868+ #size-cells = <1>;6969+ reg = <2>; /* Chip select 2 */7070+ spi-max-frequency = <19200000>;7171+ spi-cpol;7272+ spi-cpha;7373+ };7474+7575+ device@3 {7676+ compatible = "arm,pl022-dummy";7777+ #address-cells = <1>;7878+ #size-cells = <1>;7979+ reg = <3>; /* Chip select 3 */8080+ spi-max-frequency = <19200000>;8181+ spi-cpol;8282+ spi-cpha;8383+ spi-cs-high;8484+ };8585+ };
···11+Device tree configuration for Renesas RSPI/QSPI driver22+33+Required properties:44+- compatible : For Renesas Serial Peripheral Interface on legacy SH:55+ "renesas,rspi-<soctype>", "renesas,rspi" as fallback.66+ For Renesas Serial Peripheral Interface on RZ/A1H:77+ "renesas,rspi-<soctype>", "renesas,rspi-rz" as fallback.88+ For Quad Serial Peripheral Interface on R-Car Gen2:99+ "renesas,qspi-<soctype>", "renesas,qspi" as fallback.1010+ Examples with soctypes are:1111+ - "renesas,rspi-sh7757" (SH)1212+ - "renesas,rspi-r7s72100" (RZ/A1H)1313+ - "renesas,qspi-r8a7790" (R-Car H2)1414+ - "renesas,qspi-r8a7791" (R-Car M2)1515+- reg : Address start and address range size of the device1616+- interrupts : A list of interrupt-specifiers, one for each entry in1717+ interrupt-names.1818+ If interrupt-names is not present, an interrupt specifier1919+ for a single muxed interrupt.2020+- interrupt-names : A list of interrupt names. Should contain (if present):2121+ - "error" for SPEI,2222+ - "rx" for SPRI,2323+ - "tx" to SPTI,2424+ - "mux" for a single muxed interrupt.2525+- interrupt-parent : The phandle for the interrupt controller that2626+ services interrupts for this device.2727+- num-cs : Number of chip selects. Some RSPI cores have more than 1.2828+- #address-cells : Must be <1>2929+- #size-cells : Must be <0>3030+3131+Optional properties:3232+- clocks : Must contain a reference to the functional clock.3333+3434+Pinctrl properties might be needed, too. See3535+Documentation/devicetree/bindings/pinctrl/renesas,*.3636+3737+Examples:3838+3939+ spi0: spi@e800c800 {4040+ compatible = "renesas,rspi-r7s72100", "renesas,rspi-rz";4141+ reg = <0xe800c800 0x24>;4242+ interrupts = <0 238 IRQ_TYPE_LEVEL_HIGH>,4343+ <0 239 IRQ_TYPE_LEVEL_HIGH>,4444+ <0 240 IRQ_TYPE_LEVEL_HIGH>;4545+ interrupt-names = "error", "rx", "tx";4646+ interrupt-parent = <&gic>;4747+ num-cs = <1>;4848+ #address-cells = <1>;4949+ #size-cells = <0>;5050+ };5151+5252+ spi: spi@e6b10000 {5353+ compatible = "renesas,qspi-r8a7791", "renesas,qspi";5454+ reg = <0 0xe6b10000 0 0x2c>;5555+ interrupt-parent = <&gic>;5656+ interrupts = <0 184 IRQ_TYPE_LEVEL_HIGH>;5757+ clocks = <&mstp9_clks R8A7791_CLK_QSPI_MOD>;5858+ num-cs = <1>;5959+ #address-cells = <1>;6060+ #size-cells = <0>;6161+ };
···1313#include <trace/events/rpm.h>1414#include "power.h"15151616+#define RPM_GET_CALLBACK(dev, cb) \1717+({ \1818+ int (*__rpm_cb)(struct device *__d); \1919+ \2020+ if (dev->pm_domain) \2121+ __rpm_cb = dev->pm_domain->ops.cb; \2222+ else if (dev->type && dev->type->pm) \2323+ __rpm_cb = dev->type->pm->cb; \2424+ else if (dev->class && dev->class->pm) \2525+ __rpm_cb = dev->class->pm->cb; \2626+ else if (dev->bus && dev->bus->pm) \2727+ __rpm_cb = dev->bus->pm->cb; \2828+ else \2929+ __rpm_cb = NULL; \3030+ \3131+ if (!__rpm_cb && dev->driver && dev->driver->pm) \3232+ __rpm_cb = dev->driver->pm->cb; \3333+ \3434+ __rpm_cb; \3535+})3636+3737+static int (*rpm_get_suspend_cb(struct device *dev))(struct device *)3838+{3939+ return RPM_GET_CALLBACK(dev, runtime_suspend);4040+}4141+4242+static int (*rpm_get_resume_cb(struct device *dev))(struct device *)4343+{4444+ return RPM_GET_CALLBACK(dev, runtime_resume);4545+}4646+4747+#ifdef CONFIG_PM_RUNTIME4848+static int (*rpm_get_idle_cb(struct device *dev))(struct device *)4949+{5050+ return RPM_GET_CALLBACK(dev, runtime_idle);5151+}5252+1653static int rpm_resume(struct device *dev, int rpmflags);1754static int rpm_suspend(struct device *dev, int rpmflags);1855···347310348311 dev->power.idle_notification = true;349312350350- if (dev->pm_domain)351351- callback = dev->pm_domain->ops.runtime_idle;352352- else if (dev->type && dev->type->pm)353353- callback = dev->type->pm->runtime_idle;354354- else if (dev->class && dev->class->pm)355355- callback = dev->class->pm->runtime_idle;356356- else if (dev->bus && dev->bus->pm)357357- callback = dev->bus->pm->runtime_idle;358358- else359359- callback = NULL;360360-361361- if (!callback && dev->driver && dev->driver->pm)362362- callback = dev->driver->pm->runtime_idle;313313+ callback = rpm_get_idle_cb(dev);363314364315 if (callback)365316 retval = __rpm_callback(callback, dev);···517492518493 __update_runtime_status(dev, RPM_SUSPENDING);519494520520- if (dev->pm_domain)521521- callback = dev->pm_domain->ops.runtime_suspend;522522- else if (dev->type && dev->type->pm)523523- callback = dev->type->pm->runtime_suspend;524524- else if (dev->class && dev->class->pm)525525- callback = dev->class->pm->runtime_suspend;526526- else if (dev->bus && dev->bus->pm)527527- callback = dev->bus->pm->runtime_suspend;528528- else529529- callback = NULL;530530-531531- if (!callback && dev->driver && dev->driver->pm)532532- callback = dev->driver->pm->runtime_suspend;495495+ callback = rpm_get_suspend_cb(dev);533496534497 retval = rpm_callback(callback, dev);535498 if (retval)···737724738725 __update_runtime_status(dev, RPM_RESUMING);739726740740- if (dev->pm_domain)741741- callback = dev->pm_domain->ops.runtime_resume;742742- else if (dev->type && dev->type->pm)743743- callback = dev->type->pm->runtime_resume;744744- else if (dev->class && dev->class->pm)745745- callback = dev->class->pm->runtime_resume;746746- else if (dev->bus && dev->bus->pm)747747- callback = dev->bus->pm->runtime_resume;748748- else749749- callback = NULL;750750-751751- if (!callback && dev->driver && dev->driver->pm)752752- callback = dev->driver->pm->runtime_resume;727727+ callback = rpm_get_resume_cb(dev);753728754729 retval = rpm_callback(callback, dev);755730 if (retval) {···14021401 if (dev->power.irq_safe && dev->parent)14031402 pm_runtime_put(dev->parent);14041403}14041404+#endif14051405+14061406+/**14071407+ * pm_runtime_force_suspend - Force a device into suspend state if needed.14081408+ * @dev: Device to suspend.14091409+ *14101410+ * Disable runtime PM so we safely can check the device's runtime PM status and14111411+ * if it is active, invoke it's .runtime_suspend callback to bring it into14121412+ * suspend state. Keep runtime PM disabled to preserve the state unless we14131413+ * encounter errors.14141414+ *14151415+ * Typically this function may be invoked from a system suspend callback to make14161416+ * sure the device is put into low power state.14171417+ */14181418+int pm_runtime_force_suspend(struct device *dev)14191419+{14201420+ int (*callback)(struct device *);14211421+ int ret = 0;14221422+14231423+ pm_runtime_disable(dev);14241424+14251425+ /*14261426+ * Note that pm_runtime_status_suspended() returns false while14271427+ * !CONFIG_PM_RUNTIME, which means the device will be put into low14281428+ * power state.14291429+ */14301430+ if (pm_runtime_status_suspended(dev))14311431+ return 0;14321432+14331433+ callback = rpm_get_suspend_cb(dev);14341434+14351435+ if (!callback) {14361436+ ret = -ENOSYS;14371437+ goto err;14381438+ }14391439+14401440+ ret = callback(dev);14411441+ if (ret)14421442+ goto err;14431443+14441444+ pm_runtime_set_suspended(dev);14451445+ return 0;14461446+err:14471447+ pm_runtime_enable(dev);14481448+ return ret;14491449+}14501450+EXPORT_SYMBOL_GPL(pm_runtime_force_suspend);14511451+14521452+/**14531453+ * pm_runtime_force_resume - Force a device into resume state.14541454+ * @dev: Device to resume.14551455+ *14561456+ * Prior invoking this function we expect the user to have brought the device14571457+ * into low power state by a call to pm_runtime_force_suspend(). Here we reverse14581458+ * those actions and brings the device into full power. We update the runtime PM14591459+ * status and re-enables runtime PM.14601460+ *14611461+ * Typically this function may be invoked from a system resume callback to make14621462+ * sure the device is put into full power state.14631463+ */14641464+int pm_runtime_force_resume(struct device *dev)14651465+{14661466+ int (*callback)(struct device *);14671467+ int ret = 0;14681468+14691469+ callback = rpm_get_resume_cb(dev);14701470+14711471+ if (!callback) {14721472+ ret = -ENOSYS;14731473+ goto out;14741474+ }14751475+14761476+ ret = callback(dev);14771477+ if (ret)14781478+ goto out;14791479+14801480+ pm_runtime_set_active(dev);14811481+ pm_runtime_mark_last_busy(dev);14821482+out:14831483+ pm_runtime_enable(dev);14841484+ return ret;14851485+}14861486+EXPORT_SYMBOL_GPL(pm_runtime_force_resume);
+14-1
drivers/spi/Kconfig
···307307308308config SPI_OMAP24XX309309 tristate "McSPI driver for OMAP"310310- depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SH310310+ depends on ARM || ARM64 || AVR32 || HEXAGON || MIPS || SUPERH311311 depends on ARCH_OMAP2PLUS || COMPILE_TEST312312 help313313 SPI master controller for OMAP24XX and later Multichannel SPI···380380 depends on (SUPERH && SH_DMAE_BASE) || ARCH_SHMOBILE381381 help382382 SPI driver for Renesas RSPI and QSPI blocks.383383+384384+config SPI_QUP385385+ tristate "Qualcomm SPI controller with QUP interface"386386+ depends on ARCH_MSM_DT || (ARM && COMPILE_TEST)387387+ help388388+ Qualcomm Universal Peripheral (QUP) core is an AHB slave that389389+ provides a common data path (an output FIFO and an input FIFO)390390+ for serial peripheral interface (SPI) mini-core. SPI in master391391+ mode supports up to 50MHz, up to four chip selects, programmable392392+ data path from 4 bits to 32 bits and numerous protocol variants.393393+394394+ This driver can also be built as a module. If so, the module395395+ will be called spi_qup.383396384397config SPI_S3C24XX385398 tristate "Samsung S3C24XX series SPI"