From: Deokgyu Yang Date: Fri, 30 Oct 2020 06:46:07 +0000 (+0900) Subject: ODROID-COMMON: drivers/spi: Set the 64 bits per word by default X-Git-Tag: hardkernel-4.9.236-104~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=98774b14800f028b86288b18262227af623559b7;p=platform%2Fkernel%2Flinux-amlogic.git ODROID-COMMON: drivers/spi: Set the 64 bits per word by default The existing force64b routine might not work properly under specific conditions. This patch fixes that bug of 64 bits per word and forces use that option. It will improve SPI performance significantly. Signed-off-by: Deokgyu Yang Change-Id: I85a58d425303ea1765b7b83ee5dd5f0a7f4203fc --- diff --git a/drivers/spi/spi-meson-spicc.c b/drivers/spi/spi-meson-spicc.c index fd5e9f42c834..ee3f26ff4633 100644 --- a/drivers/spi/spi-meson-spicc.c +++ b/drivers/spi/spi-meson-spicc.c @@ -42,12 +42,6 @@ * to have a CS go down over the full transfer */ -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) -static unsigned int force64b; -module_param(force64b, uint, 0000); -MODULE_PARM_DESC(force64b, "force 64bits fb data"); -#endif - /* Register Map */ #define SPICC_RXDATA 0x00 @@ -485,22 +479,10 @@ static inline void meson_spicc_tx(struct meson_spicc_device *spicc) static void meson_spicc_setup_pio_burst(struct meson_spicc_device *spicc) { - unsigned int burst_len; - -#if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - if (force64b) - burst_len = min_t(unsigned int, - spicc->xfer_remain / spicc->bytes_per_word, - spicc->data->fifo_size << 1); - else - burst_len = min_t(unsigned int, - spicc->xfer_remain / spicc->bytes_per_word, - spicc->data->fifo_size); -#else - burst_len = min_t(unsigned int, + unsigned int burst_len = min_t(unsigned int, spicc->xfer_remain / spicc->bytes_per_word, spicc->data->fifo_size); -#endif + /* Setup Xfer variables */ spicc->tx_remain = burst_len; spicc->rx_remain = burst_len; @@ -606,9 +588,15 @@ static int meson_spicc_transfer_one(struct spi_master *master, spicc->xfer_remain = xfer->len; #if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) - if (force64b && (xfer->len >= 64)) { - if ((xfer->bits_per_word == 8) && ((xfer->len % 8) == 0)) - xfer->bits_per_word = 64; + if ((xfer->len >= 64) && (xfer->bits_per_word == 8) && ((xfer->len % 8) == 0)) { + int cnt = xfer->len / 8; + int i; + + u64 *tx_buf = (u64 *) &spicc->tx_buf[0]; + for (i = 0; i < cnt; i++) + tx_buf[i] = __swab64p((__u64 *) &spicc->tx_buf[i * 8]); + + xfer->bits_per_word = 64; } #endif /* Pre-calculate word size */ @@ -1118,8 +1106,6 @@ static int meson_spicc_probe(struct platform_device *pdev) spicc->pinctrl = NULL; dev_err(&pdev->dev, "spi pinmux : can't get spicc_pins\n"); } - if (force64b) - dev_info(&pdev->dev, "*** force64b flags is true ***\n"); #endif device_reset_optional(&pdev->dev);