* [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() @ 2022-04-11 11:31 Mika Westerberg 2022-04-11 11:31 ` [PATCH 2/2] spi: intel: Implement dirmap hooks Mika Westerberg 2022-04-19 22:45 ` [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mark Brown 0 siblings, 2 replies; 5+ messages in thread From: Mika Westerberg @ 2022-04-11 11:31 UTC (permalink / raw) To: Mark Brown Cc: Tudor Ambarus, Boris Brezillon, Michael Walle, Pratyush Yadav, Hongli Li, Mika Westerberg, linux-spi, linux-mtd Should be 'specific' not 'spefific'. Fix this. Reported-by: Hongli Li <hongli.li@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> --- drivers/spi/spi-intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index e937cfe85559..1bdb227e0ca2 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -1205,7 +1205,7 @@ static int intel_spi_populate_chip(struct intel_spi *ispi) * intel_spi_probe() - Probe the Intel SPI flash controller * @dev: Pointer to the parent device * @mem: MMIO resource - * @info: Platform spefific information + * @info: Platform specific information * * Probes Intel SPI flash controller and creates the flash chip device. * Returns %0 on success and negative errno in case of failure. -- 2.35.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] spi: intel: Implement dirmap hooks 2022-04-11 11:31 [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mika Westerberg @ 2022-04-11 11:31 ` Mika Westerberg 2022-04-19 12:12 ` Mark Brown 2022-04-19 22:45 ` [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mark Brown 1 sibling, 1 reply; 5+ messages in thread From: Mika Westerberg @ 2022-04-11 11:31 UTC (permalink / raw) To: Mark Brown Cc: Tudor Ambarus, Boris Brezillon, Michael Walle, Pratyush Yadav, Hongli Li, Mika Westerberg, linux-spi, linux-mtd Currently the driver goes over the supported opcodes list each time ->exec_op() is called and finds the suitable for the given operation. This consumes unnecessary amount of CPU cycles because the operation is always the same. For this reason populate dirmap hooks for the driver so that we cache the selected operation and then simply call it on each read/write. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> --- drivers/spi/spi-intel.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/spi/spi-intel.c b/drivers/spi/spi-intel.c index 1bdb227e0ca2..43c3ddced86d 100644 --- a/drivers/spi/spi-intel.c +++ b/drivers/spi/spi-intel.c @@ -779,10 +779,59 @@ static const char *intel_spi_get_name(struct spi_mem *mem) return dev_name(ispi->dev); } +static int intel_spi_dirmap_create(struct spi_mem_dirmap_desc *desc) +{ + struct intel_spi *ispi = spi_master_get_devdata(desc->mem->spi->master); + const struct intel_spi_mem_op *iop; + + iop = intel_spi_match_mem_op(ispi, &desc->info.op_tmpl); + if (!iop) + return -EOPNOTSUPP; + + desc->priv = (void *)iop; + return 0; +} + +static ssize_t intel_spi_dirmap_read(struct spi_mem_dirmap_desc *desc, u64 offs, + size_t len, void *buf) +{ + struct intel_spi *ispi = spi_master_get_devdata(desc->mem->spi->master); + const struct intel_spi_mem_op *iop = desc->priv; + struct spi_mem_op op = desc->info.op_tmpl; + int ret; + + /* Fill in the gaps */ + op.addr.val = offs; + op.data.nbytes = len; + op.data.buf.in = buf; + + ret = iop->exec_op(ispi, desc->mem, iop, &op); + return ret ? ret : len; +} + +static ssize_t intel_spi_dirmap_write(struct spi_mem_dirmap_desc *desc, u64 offs, + size_t len, const void *buf) +{ + struct intel_spi *ispi = spi_master_get_devdata(desc->mem->spi->master); + const struct intel_spi_mem_op *iop = desc->priv; + struct spi_mem_op op = desc->info.op_tmpl; + int ret; + + op.addr.val = offs; + op.data.nbytes = len; + op.data.buf.out = buf; + + ret = iop->exec_op(ispi, desc->mem, iop, &op); + return ret ? ret : len; +} + static const struct spi_controller_mem_ops intel_spi_mem_ops = { .supports_op = intel_spi_supports_mem_op, .exec_op = intel_spi_exec_mem_op, .get_name = intel_spi_get_name, + .dirmap_create = intel_spi_dirmap_create, + .dirmap_read = intel_spi_dirmap_read, + .dirmap_write = intel_spi_dirmap_write, }; #define INTEL_SPI_OP_ADDR(__nbytes) \ -- 2.35.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] spi: intel: Implement dirmap hooks 2022-04-11 11:31 ` [PATCH 2/2] spi: intel: Implement dirmap hooks Mika Westerberg @ 2022-04-19 12:12 ` Mark Brown 2022-04-20 6:25 ` Mika Westerberg 0 siblings, 1 reply; 5+ messages in thread From: Mark Brown @ 2022-04-19 12:12 UTC (permalink / raw) To: Mika Westerberg Cc: Tudor Ambarus, Boris Brezillon, Michael Walle, Pratyush Yadav, Hongli Li, linux-spi, linux-mtd [-- Attachment #1: Type: text/plain, Size: 3382 bytes --] On Mon, Apr 11, 2022 at 02:31:58PM +0300, Mika Westerberg wrote: > Currently the driver goes over the supported opcodes list each time > ->exec_op() is called and finds the suitable for the given operation. > This consumes unnecessary amount of CPU cycles because the operation is > always the same. For this reason populate dirmap hooks for the driver so > that we cache the selected operation and then simply call it on each > read/write. This breaks an x86 allmodconfig build: /build/stage/linux/drivers/spi/spi-intel.c: In function ‘intel_spi_dirmap_read’: /build/stage/linux/drivers/spi/spi-intel.c:808:38: error: passing argument 2 of ‘iop->exec_op’ from incompatible pointer type [-Werror=incompatible-pointer-types] 808 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ~~~~^~~~~ | | | struct spi_mem * /build/stage/linux/drivers/spi/spi-intel.c:808:38: note: expected ‘const struct intel_spi_mem_op *’ but argument is of type ‘struct spi_mem *’ /build/stage/linux/drivers/spi/spi-intel.c:808:45: error: passing argument 3 of ‘iop->exec_op’ from incompatible pointer type [-Werror=incompatible-pointer-types] 808 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ^~~ | | | const struct intel_spi_mem_op * /build/stage/linux/drivers/spi/spi-intel.c:808:45: note: expected ‘const struct spi_mem_op *’ but argument is of type ‘const struct intel_spi_mem_op *’ /build/stage/linux/drivers/spi/spi-intel.c:808:15: error: too many arguments to function ‘iop->exec_op’ 808 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ^~~ /build/stage/linux/drivers/spi/spi-intel.c: In function ‘intel_spi_dirmap_write’: /build/stage/linux/drivers/spi/spi-intel.c:824:38: error: passing argument 2 of ‘iop->exec_op’ from incompatible pointer type [-Werror=incompatible-pointer-types] 824 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ~~~~^~~~~ | | | struct spi_mem * /build/stage/linux/drivers/spi/spi-intel.c:824:38: note: expected ‘const struct intel_spi_mem_op *’ but argument is of type ‘struct spi_mem *’ /build/stage/linux/drivers/spi/spi-intel.c:824:45: error: passing argument 3 of ‘iop->exec_op’ from incompatible pointer type [-Werror=incompatible-pointer-types] 824 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ^~~ | | | const struct intel_spi_mem_op * /build/stage/linux/drivers/spi/spi-intel.c:824:45: note: expected ‘const struct spi_mem_op *’ but argument is of type ‘const struct intel_spi_mem_op *’ /build/stage/linux/drivers/spi/spi-intel.c:824:15: error: too many arguments to function ‘iop->exec_op’ 824 | ret = iop->exec_op(ispi, desc->mem, iop, &op); | ^~~ cc1: all warnings being treated as errors [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] spi: intel: Implement dirmap hooks 2022-04-19 12:12 ` Mark Brown @ 2022-04-20 6:25 ` Mika Westerberg 0 siblings, 0 replies; 5+ messages in thread From: Mika Westerberg @ 2022-04-20 6:25 UTC (permalink / raw) To: Mark Brown Cc: Tudor Ambarus, Boris Brezillon, Michael Walle, Pratyush Yadav, Hongli Li, linux-spi, linux-mtd Hi Mark, On Tue, Apr 19, 2022 at 01:12:59PM +0100, Mark Brown wrote: > On Mon, Apr 11, 2022 at 02:31:58PM +0300, Mika Westerberg wrote: > > Currently the driver goes over the supported opcodes list each time > > ->exec_op() is called and finds the suitable for the given operation. > > This consumes unnecessary amount of CPU cycles because the operation is > > always the same. For this reason populate dirmap hooks for the driver so > > that we cache the selected operation and then simply call it on each > > read/write. > > This breaks an x86 allmodconfig build: > > /build/stage/linux/drivers/spi/spi-intel.c: In function ‘intel_spi_dirmap_read’: > /build/stage/linux/drivers/spi/spi-intel.c:808:38: error: passing argument 2 of ‘iop->exec_op’ from incompatible pointer type [-Werror=incompatible-pointer-types] > 808 | ret = iop->exec_op(ispi, desc->mem, iop, &op); > | ~~~~^~~~~ > | | > | struct spi_mem * Oh, indeed :( I have another patch adding second chip select support that adds the parameter and then I changed the ordering, and of course forgot to reflect that to this patch. I will fix this up and re-send. Sorry about this. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() 2022-04-11 11:31 [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mika Westerberg 2022-04-11 11:31 ` [PATCH 2/2] spi: intel: Implement dirmap hooks Mika Westerberg @ 2022-04-19 22:45 ` Mark Brown 1 sibling, 0 replies; 5+ messages in thread From: Mark Brown @ 2022-04-19 22:45 UTC (permalink / raw) To: mika.westerberg Cc: tudor.ambarus, linux-spi, p.yadav, linux-mtd, michael, boris.brezillon, hongli.li On Mon, 11 Apr 2022 14:31:57 +0300, Mika Westerberg wrote: > Should be 'specific' not 'spefific'. Fix this. > > Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next Thanks! [1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() commit: 4bbaa857e9af76d8cc346bd57fbaa50d357ae132 [2/2] spi: intel: Implement dirmap hooks (no commit info) All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-04-20 6:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-11 11:31 [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mika Westerberg 2022-04-11 11:31 ` [PATCH 2/2] spi: intel: Implement dirmap hooks Mika Westerberg 2022-04-19 12:12 ` Mark Brown 2022-04-20 6:25 ` Mika Westerberg 2022-04-19 22:45 ` [PATCH 1/2] spi: intel: Fix typo in kernel-doc of intel_spi_probe() Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).