Loading Documentation/devicetree/bindings/spi/spi_qsd.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ Optional properties: - qcom,rt-priority : whether spi message queue is set to run as a realtime task. With this spi transaction message pump with high (realtime) priority to reduce the transfer latency on the bus by minimising the delay between a transfer request - qcom,shared : whether this qup is shared with other ee's Optional properties which are required for support of BAM-mode: - qcom,ver-reg-exists : Boolean. When present, allows driver to verify if HW Loading drivers/spi/spi_qsd.c +42 −20 Original line number Diff line number Diff line /* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1854,6 +1854,7 @@ static int msm_spi_transfer_one_message(struct spi_master *master, * get local resources for each transfer to ensure we're in a good * state and not interfering with other EE's using this device */ if (dd->pdata->is_shared) { if (get_local_resources(dd)) { mutex_unlock(&dd->core_lock); return -EINVAL; Loading @@ -1866,6 +1867,7 @@ static int msm_spi_transfer_one_message(struct spi_master *master, msm_spi_bam_pipe_connect(dd, &dd->bam.cons, &dd->bam.cons.config); } } if (dd->suspended || !msm_spi_is_valid_state(dd)) { dev_err(dd->dev, "%s: SPI operational state not valid\n", Loading @@ -1891,11 +1893,13 @@ static int msm_spi_transfer_one_message(struct spi_master *master, * different context since we're running in the spi kthread here) to * prevent race conditions between us and any other EE's using this hw. */ if (dd->pdata->is_shared) { if (dd->use_dma) { msm_spi_bam_pipe_disconnect(dd, &dd->bam.prod); msm_spi_bam_pipe_disconnect(dd, &dd->bam.cons); } put_local_resources(dd); } mutex_unlock(&dd->core_lock); if (dd->suspended) wake_up_interruptible(&dd->continue_suspend); Loading Loading @@ -1985,9 +1989,11 @@ static int msm_spi_setup(struct spi_device *spi) goto err_setup_exit; } if (dd->pdata->is_shared) { rc = get_local_resources(dd); if (rc) goto no_resources; } spi_ioc = readl_relaxed(dd->base + SPI_IO_CONTROL); mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; Loading @@ -2006,6 +2012,7 @@ static int msm_spi_setup(struct spi_device *spi) /* Ensure previous write completed before disabling the clocks */ mb(); if (dd->pdata->is_shared) put_local_resources(dd); /* Counter-part of system-resume when runtime-pm is not enabled. */ if (!pm_runtime_enabled(dd->dev)) Loading Loading @@ -2421,6 +2428,8 @@ struct msm_spi_platform_data *msm_spi_dt_to_pdata( &dd->cs_gpios[3].gpio_num, DT_OPT, DT_GPIO, -1}, {"qcom,rt-priority", &pdata->rt_priority, DT_OPT, DT_BOOL, 0}, {"qcom,shared", &pdata->is_shared, DT_OPT, DT_BOOL, 0}, {NULL, NULL, 0, 0, 0}, }; Loading Loading @@ -2800,9 +2809,14 @@ static int msm_spi_pm_suspend_runtime(struct device *device) wait_event_interruptible(dd->continue_suspend, !dd->transfer_pending); if (dd->pdata && !dd->pdata->is_shared && dd->use_dma) { msm_spi_bam_pipe_disconnect(dd, &dd->bam.prod); msm_spi_bam_pipe_disconnect(dd, &dd->bam.cons); } if (dd->pdata && !dd->pdata->active_only) msm_spi_clk_path_unvote(dd); if (dd->pdata && !dd->pdata->is_shared) put_local_resources(dd); suspend_exit: return 0; } Loading Loading @@ -2830,9 +2844,17 @@ static int msm_spi_pm_resume_runtime(struct device *device) else dd->is_init_complete = true; } if (!dd->pdata->is_shared) get_local_resources(dd); msm_spi_clk_path_init(dd); if (!dd->pdata->active_only) msm_spi_clk_path_vote(dd); if (!dd->pdata->is_shared && dd->use_dma) { msm_spi_bam_pipe_connect(dd, &dd->bam.prod, &dd->bam.prod.config); msm_spi_bam_pipe_connect(dd, &dd->bam.cons, &dd->bam.cons.config); } dd->suspended = 0; resume_exit: Loading include/linux/qcom-spi.h +15 −4 Original line number Diff line number Diff line /* Copyright (c) 2014 The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -17,14 +17,24 @@ /** * msm_spi_platform_data: msm spi-controller's configuration data * * @max_clock_speed max spi clock speed * @active_only when set, votes when system active and removes the vote when * system goes idle (optimises for performance). When unset, voting using * runtime pm (optimizes for power). * @master_id master id number of the controller's wrapper (BLSP or GSBI). * When zero, clock path voting is disabled. * @rt when set, spi will pump transaction messages with high (realtime) * priority to reduce the transfer latency on the bus by minimising * the delay between a transfer request. * @gpio_config pointer to function for configuring gpio * @gpio_release pointer to function for releasing gpio pins * @dma_config function poniter for configuring dma engine * @pm_lat power management latency * @infinite_mode use FIFO mode in infinite mode * @ver_reg_exists if the version register exists * @use_beam true if BAM is available * @bam_consumer_pipe_index BAM conusmer pipe * @bam_producer_pipe_index BAM producer pipe * @rt_priority true if RT thread * @use_pinctrl true if pinctrl library is used * @is_shared true when qup is shared between ee's */ struct msm_spi_platform_data { u32 max_clock_speed; Loading @@ -42,4 +52,5 @@ struct msm_spi_platform_data { u32 bam_producer_pipe_index; bool rt_priority; bool use_pinctrl; bool is_shared; }; Loading
Documentation/devicetree/bindings/spi/spi_qsd.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ Optional properties: - qcom,rt-priority : whether spi message queue is set to run as a realtime task. With this spi transaction message pump with high (realtime) priority to reduce the transfer latency on the bus by minimising the delay between a transfer request - qcom,shared : whether this qup is shared with other ee's Optional properties which are required for support of BAM-mode: - qcom,ver-reg-exists : Boolean. When present, allows driver to verify if HW Loading
drivers/spi/spi_qsd.c +42 −20 Original line number Diff line number Diff line /* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved. /* Copyright (c) 2008-2015, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading Loading @@ -1854,6 +1854,7 @@ static int msm_spi_transfer_one_message(struct spi_master *master, * get local resources for each transfer to ensure we're in a good * state and not interfering with other EE's using this device */ if (dd->pdata->is_shared) { if (get_local_resources(dd)) { mutex_unlock(&dd->core_lock); return -EINVAL; Loading @@ -1866,6 +1867,7 @@ static int msm_spi_transfer_one_message(struct spi_master *master, msm_spi_bam_pipe_connect(dd, &dd->bam.cons, &dd->bam.cons.config); } } if (dd->suspended || !msm_spi_is_valid_state(dd)) { dev_err(dd->dev, "%s: SPI operational state not valid\n", Loading @@ -1891,11 +1893,13 @@ static int msm_spi_transfer_one_message(struct spi_master *master, * different context since we're running in the spi kthread here) to * prevent race conditions between us and any other EE's using this hw. */ if (dd->pdata->is_shared) { if (dd->use_dma) { msm_spi_bam_pipe_disconnect(dd, &dd->bam.prod); msm_spi_bam_pipe_disconnect(dd, &dd->bam.cons); } put_local_resources(dd); } mutex_unlock(&dd->core_lock); if (dd->suspended) wake_up_interruptible(&dd->continue_suspend); Loading Loading @@ -1985,9 +1989,11 @@ static int msm_spi_setup(struct spi_device *spi) goto err_setup_exit; } if (dd->pdata->is_shared) { rc = get_local_resources(dd); if (rc) goto no_resources; } spi_ioc = readl_relaxed(dd->base + SPI_IO_CONTROL); mask = SPI_IO_C_CS_N_POLARITY_0 << spi->chip_select; Loading @@ -2006,6 +2012,7 @@ static int msm_spi_setup(struct spi_device *spi) /* Ensure previous write completed before disabling the clocks */ mb(); if (dd->pdata->is_shared) put_local_resources(dd); /* Counter-part of system-resume when runtime-pm is not enabled. */ if (!pm_runtime_enabled(dd->dev)) Loading Loading @@ -2421,6 +2428,8 @@ struct msm_spi_platform_data *msm_spi_dt_to_pdata( &dd->cs_gpios[3].gpio_num, DT_OPT, DT_GPIO, -1}, {"qcom,rt-priority", &pdata->rt_priority, DT_OPT, DT_BOOL, 0}, {"qcom,shared", &pdata->is_shared, DT_OPT, DT_BOOL, 0}, {NULL, NULL, 0, 0, 0}, }; Loading Loading @@ -2800,9 +2809,14 @@ static int msm_spi_pm_suspend_runtime(struct device *device) wait_event_interruptible(dd->continue_suspend, !dd->transfer_pending); if (dd->pdata && !dd->pdata->is_shared && dd->use_dma) { msm_spi_bam_pipe_disconnect(dd, &dd->bam.prod); msm_spi_bam_pipe_disconnect(dd, &dd->bam.cons); } if (dd->pdata && !dd->pdata->active_only) msm_spi_clk_path_unvote(dd); if (dd->pdata && !dd->pdata->is_shared) put_local_resources(dd); suspend_exit: return 0; } Loading Loading @@ -2830,9 +2844,17 @@ static int msm_spi_pm_resume_runtime(struct device *device) else dd->is_init_complete = true; } if (!dd->pdata->is_shared) get_local_resources(dd); msm_spi_clk_path_init(dd); if (!dd->pdata->active_only) msm_spi_clk_path_vote(dd); if (!dd->pdata->is_shared && dd->use_dma) { msm_spi_bam_pipe_connect(dd, &dd->bam.prod, &dd->bam.prod.config); msm_spi_bam_pipe_connect(dd, &dd->bam.cons, &dd->bam.cons.config); } dd->suspended = 0; resume_exit: Loading
include/linux/qcom-spi.h +15 −4 Original line number Diff line number Diff line /* Copyright (c) 2014 The Linux Foundation. All rights reserved. /* Copyright (c) 2014-2015 The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and Loading @@ -17,14 +17,24 @@ /** * msm_spi_platform_data: msm spi-controller's configuration data * * @max_clock_speed max spi clock speed * @active_only when set, votes when system active and removes the vote when * system goes idle (optimises for performance). When unset, voting using * runtime pm (optimizes for power). * @master_id master id number of the controller's wrapper (BLSP or GSBI). * When zero, clock path voting is disabled. * @rt when set, spi will pump transaction messages with high (realtime) * priority to reduce the transfer latency on the bus by minimising * the delay between a transfer request. * @gpio_config pointer to function for configuring gpio * @gpio_release pointer to function for releasing gpio pins * @dma_config function poniter for configuring dma engine * @pm_lat power management latency * @infinite_mode use FIFO mode in infinite mode * @ver_reg_exists if the version register exists * @use_beam true if BAM is available * @bam_consumer_pipe_index BAM conusmer pipe * @bam_producer_pipe_index BAM producer pipe * @rt_priority true if RT thread * @use_pinctrl true if pinctrl library is used * @is_shared true when qup is shared between ee's */ struct msm_spi_platform_data { u32 max_clock_speed; Loading @@ -42,4 +52,5 @@ struct msm_spi_platform_data { u32 bam_producer_pipe_index; bool rt_priority; bool use_pinctrl; bool is_shared; };