[U-Boot] [PATCH] spi: Zap armada100_spi.c and env

armada100_spi.c and related env is zapping becuase of "no DM conversion".
Cc: Ajay Bhargav ajay.bhargav@einfochips.com Signed-off-by: Jagan Teki jagan@openedev.com --- Note: If someone want this to present, just respond with proper timeline.
configs/gplugd_defconfig | 5 -- drivers/spi/Makefile | 1 - drivers/spi/armada100_spi.c | 203 ------------------------------------------- include/configs/gplugd.h | 9 +- scripts/config_whitelist.txt | 1 - 5 files changed, 1 insertion(+), 218 deletions(-) delete mode 100644 drivers/spi/armada100_spi.c
diff --git a/configs/gplugd_defconfig b/configs/gplugd_defconfig index 59c9fdf..3d98f8d 100644 --- a/configs/gplugd_defconfig +++ b/configs/gplugd_defconfig @@ -4,9 +4,7 @@ CONFIG_IDENT_STRING="\nMarvell-gplugD" CONFIG_BOOTDELAY=3 # CONFIG_DISPLAY_BOARDINFO is not set # CONFIG_CMD_IMLS is not set -CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set -CONFIG_CMD_SF=y CONFIG_CMD_I2C=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set @@ -16,9 +14,6 @@ CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y -CONFIG_SPI_FLASH=y -CONFIG_SPI_FLASH_ATMEL=y -CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_STORAGE=y diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 247c5f6..9e1f8df 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o endif
obj-$(CONFIG_ALTERA_SPI) += altera_spi.o -obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o diff --git a/drivers/spi/armada100_spi.c b/drivers/spi/armada100_spi.c deleted file mode 100644 index 53aaf95..0000000 --- a/drivers/spi/armada100_spi.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (C) Copyright 2011 - * eInfochips Ltd. <www.einfochips.com> - * Written-by: Ajay Bhargav ajay.bhargav@einfochips.com - * - * (C) Copyright 2009 - * Marvell Semiconductor <www.marvell.com> - * Based on SSP driver - * Written-by: Lei Wen leiwen@marvell.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - - -#include <common.h> -#include <malloc.h> -#include <spi.h> - -#include <asm/io.h> -#include <asm/arch/spi.h> -#include <asm/gpio.h> - -#define to_armd_spi_slave(s) container_of(s, struct armd_spi_slave, slave) - -struct armd_spi_slave { - struct spi_slave slave; - struct ssp_reg *spi_reg; - u32 cr0, cr1; - u32 int_cr1; - u32 clear_sr; - const void *tx; - void *rx; - int gpio_cs_inverted; -}; - -static int spi_armd_write(struct armd_spi_slave *pss) -{ - int wait_timeout = SSP_FLUSH_NUM; - while (--wait_timeout && !(readl(&pss->spi_reg->sssr) & SSSR_TNF)) - ; - if (!wait_timeout) { - debug("%s: timeout error\n", __func__); - return -1; - } - - if (pss->tx != NULL) { - writel(*(u8 *)pss->tx, &pss->spi_reg->ssdr); - ++pss->tx; - } else { - writel(0, &pss->spi_reg->ssdr); - } - return 0; -} - -static int spi_armd_read(struct armd_spi_slave *pss) -{ - int wait_timeout = SSP_FLUSH_NUM; - while (--wait_timeout && !(readl(&pss->spi_reg->sssr) & SSSR_RNE)) - ; - if (!wait_timeout) { - debug("%s: timeout error\n", __func__); - return -1; - } - - if (pss->rx != NULL) { - *(u8 *)pss->rx = readl(&pss->spi_reg->ssdr); - ++pss->rx; - } else { - readl(&pss->spi_reg->ssdr); - } - return 0; -} - -static int spi_armd_flush(struct armd_spi_slave *pss) -{ - unsigned long limit = SSP_FLUSH_NUM; - - do { - while (readl(&pss->spi_reg->sssr) & SSSR_RNE) - readl(&pss->spi_reg->ssdr); - } while ((readl(&pss->spi_reg->sssr) & SSSR_BSY) && limit--); - - writel(SSSR_ROR, &pss->spi_reg->sssr); - - return limit; -} - -void spi_cs_activate(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - gpio_set_value(slave->cs, pss->gpio_cs_inverted); -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - gpio_set_value(slave->cs, !pss->gpio_cs_inverted); -} - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct armd_spi_slave *pss; - - pss = spi_alloc_slave(struct armd_spi_slave, bus, cs); - if (!pss) - return NULL; - - pss->spi_reg = (struct ssp_reg *)SSP_REG_BASE(CONFIG_SYS_SSP_PORT); - - pss->cr0 = SSCR0_MOTO | SSCR0_DATASIZE(DEFAULT_WORD_LEN) | SSCR0_SSE; - - pss->cr1 = (SSCR1_RXTRESH(RX_THRESH_DEF) & SSCR1_RFT) | - (SSCR1_TXTRESH(TX_THRESH_DEF) & SSCR1_TFT); - pss->cr1 &= ~(SSCR1_SPO | SSCR1_SPH); - pss->cr1 |= (((mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0) - | (((mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0); - - pss->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; - pss->clear_sr = SSSR_ROR | SSSR_TINT; - - pss->gpio_cs_inverted = mode & SPI_CS_HIGH; - gpio_set_value(cs, !pss->gpio_cs_inverted); - - return &pss->slave; -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - free(pss); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs); - if (spi_armd_flush(pss) == 0) - return -1; - - return 0; -} - -void spi_release_bus(struct spi_slave *slave) -{ -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, - void *din, unsigned long flags) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - uint bytes = bitlen / 8; - unsigned long limit; - int ret = 0; - - if (bitlen == 0) - goto done; - - /* we can only do 8 bit transfers */ - if (bitlen % 8) { - flags |= SPI_XFER_END; - goto done; - } - - pss->tx = dout; - pss->rx = din; - - if (flags & SPI_XFER_BEGIN) { - spi_cs_activate(slave); - writel(pss->cr1 | pss->int_cr1, &pss->spi_reg->sscr1); - writel(TIMEOUT_DEF, &pss->spi_reg->ssto); - writel(pss->cr0, &pss->spi_reg->sscr0); - } - - while (bytes--) { - limit = SSP_FLUSH_NUM; - ret = spi_armd_write(pss); - if (ret) - break; - - while ((readl(&pss->spi_reg->sssr) & SSSR_BSY) && limit--) - udelay(1); - - ret = spi_armd_read(pss); - if (ret) - break; - } - - done: - if (flags & SPI_XFER_END) { - /* Stop SSP */ - writel(pss->clear_sr, &pss->spi_reg->sssr); - clrbits_le32(&pss->spi_reg->sscr1, pss->int_cr1); - writel(0, &pss->spi_reg->ssto); - spi_cs_deactivate(slave); - } - - return ret; -} diff --git a/include/configs/gplugd.h b/include/configs/gplugd.h index c1b43fd..92e2117 100644 --- a/include/configs/gplugd.h +++ b/include/configs/gplugd.h @@ -72,11 +72,6 @@ /* GPIO Configuration for PHY */ #define CONFIG_SYS_GPIO_PHY_RST 104 /* GPIO104 */
-/* SPI Support */ -#define CONFIG_ARMADA100_SPI -#define CONFIG_ENV_SPI_CS 110 -#define CONFIG_SYS_SSP_PORT 2 - /* Flash Support */
/* @@ -95,10 +90,8 @@ /* * Environment variables configurations */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_SECT_SIZE 0x4000 +#define CONFIG_ENV_IS_NOWHERE #define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_ENV_OFFSET 0x07C000
#ifdef CONFIG_CMD_USB #define CONFIG_USB_EHCI diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 9851251..6c7f8e0 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -178,7 +178,6 @@ CONFIG_ARIA_FPGA CONFIG_ARM926EJS CONFIG_ARMADA100 CONFIG_ARMADA100_FEC -CONFIG_ARMADA100_SPI CONFIG_ARMADA168 CONFIG_ARMADA_39X CONFIG_ARMCORTEXA9

I will update driver and submit. Thanks for notification.
Regards,
Ajay Bhargav
________________________________ From: Jagan Teki jagan@openedev.com Sent: Friday, November 25, 2016 12:58:58 AM To: u-boot@lists.denx.de Cc: Jagan Teki; Ajay Bhargav Subject: [PATCH] spi: Zap armada100_spi.c and env
armada100_spi.c and related env is zapping becuase of "no DM conversion".
Cc: Ajay Bhargav ajay.bhargav@einfochips.com Signed-off-by: Jagan Teki jagan@openedev.com --- Note: If someone want this to present, just respond with proper timeline.
configs/gplugd_defconfig | 5 -- drivers/spi/Makefile | 1 - drivers/spi/armada100_spi.c | 203 ------------------------------------------- include/configs/gplugd.h | 9 +- scripts/config_whitelist.txt | 1 - 5 files changed, 1 insertion(+), 218 deletions(-) delete mode 100644 drivers/spi/armada100_spi.c
diff --git a/configs/gplugd_defconfig b/configs/gplugd_defconfig index 59c9fdf..3d98f8d 100644 --- a/configs/gplugd_defconfig +++ b/configs/gplugd_defconfig @@ -4,9 +4,7 @@ CONFIG_IDENT_STRING="\nMarvell-gplugD" CONFIG_BOOTDELAY=3 # CONFIG_DISPLAY_BOARDINFO is not set # CONFIG_CMD_IMLS is not set -CONFIG_CMD_ASKENV=y # CONFIG_CMD_FLASH is not set -CONFIG_CMD_SF=y CONFIG_CMD_I2C=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set @@ -16,9 +14,6 @@ CONFIG_CMD_MII=y CONFIG_CMD_PING=y CONFIG_CMD_EXT2=y CONFIG_CMD_FAT=y -CONFIG_SPI_FLASH=y -CONFIG_SPI_FLASH_ATMEL=y -CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SYS_NS16550=y CONFIG_USB=y CONFIG_USB_STORAGE=y diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile index 247c5f6..9e1f8df 100644 --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile @@ -16,7 +16,6 @@ obj-$(CONFIG_SOFT_SPI) += soft_spi_legacy.o endif
obj-$(CONFIG_ALTERA_SPI) += altera_spi.o -obj-$(CONFIG_ARMADA100_SPI) += armada100_spi.o obj-$(CONFIG_ATH79_SPI) += ath79_spi.o obj-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o obj-$(CONFIG_ATMEL_SPI) += atmel_spi.o diff --git a/drivers/spi/armada100_spi.c b/drivers/spi/armada100_spi.c deleted file mode 100644 index 53aaf95..0000000 --- a/drivers/spi/armada100_spi.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * (C) Copyright 2011 - * eInfochips Ltd. <www.einfochips.comhttp://www.einfochips.com> - * Written-by: Ajay Bhargav ajay.bhargav@einfochips.com - * - * (C) Copyright 2009 - * Marvell Semiconductor <www.marvell.comhttp://www.marvell.com> - * Based on SSP driver - * Written-by: Lei Wen leiwen@marvell.com - * - * SPDX-License-Identifier: GPL-2.0+ - */ - - -#include <common.h> -#include <malloc.h> -#include <spi.h> - -#include <asm/io.h> -#include <asm/arch/spi.h> -#include <asm/gpio.h> - -#define to_armd_spi_slave(s) container_of(s, struct armd_spi_slave, slave) - -struct armd_spi_slave { - struct spi_slave slave; - struct ssp_reg *spi_reg; - u32 cr0, cr1; - u32 int_cr1; - u32 clear_sr; - const void *tx; - void *rx; - int gpio_cs_inverted; -}; - -static int spi_armd_write(struct armd_spi_slave *pss) -{ - int wait_timeout = SSP_FLUSH_NUM; - while (--wait_timeout && !(readl(&pss->spi_reg->sssr) & SSSR_TNF)) - ; - if (!wait_timeout) { - debug("%s: timeout error\n", __func__); - return -1; - } - - if (pss->tx != NULL) { - writel(*(u8 *)pss->tx, &pss->spi_reg->ssdr); - ++pss->tx; - } else { - writel(0, &pss->spi_reg->ssdr); - } - return 0; -} - -static int spi_armd_read(struct armd_spi_slave *pss) -{ - int wait_timeout = SSP_FLUSH_NUM; - while (--wait_timeout && !(readl(&pss->spi_reg->sssr) & SSSR_RNE)) - ; - if (!wait_timeout) { - debug("%s: timeout error\n", __func__); - return -1; - } - - if (pss->rx != NULL) { - *(u8 *)pss->rx = readl(&pss->spi_reg->ssdr); - ++pss->rx; - } else { - readl(&pss->spi_reg->ssdr); - } - return 0; -} - -static int spi_armd_flush(struct armd_spi_slave *pss) -{ - unsigned long limit = SSP_FLUSH_NUM; - - do { - while (readl(&pss->spi_reg->sssr) & SSSR_RNE) - readl(&pss->spi_reg->ssdr); - } while ((readl(&pss->spi_reg->sssr) & SSSR_BSY) && limit--); - - writel(SSSR_ROR, &pss->spi_reg->sssr); - - return limit; -} - -void spi_cs_activate(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - gpio_set_value(slave->cs, pss->gpio_cs_inverted); -} - -void spi_cs_deactivate(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - gpio_set_value(slave->cs, !pss->gpio_cs_inverted); -} - -struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct armd_spi_slave *pss; - - pss = spi_alloc_slave(struct armd_spi_slave, bus, cs); - if (!pss) - return NULL; - - pss->spi_reg = (struct ssp_reg *)SSP_REG_BASE(CONFIG_SYS_SSP_PORT); - - pss->cr0 = SSCR0_MOTO | SSCR0_DATASIZE(DEFAULT_WORD_LEN) | SSCR0_SSE; - - pss->cr1 = (SSCR1_RXTRESH(RX_THRESH_DEF) & SSCR1_RFT) | - (SSCR1_TXTRESH(TX_THRESH_DEF) & SSCR1_TFT); - pss->cr1 &= ~(SSCR1_SPO | SSCR1_SPH); - pss->cr1 |= (((mode & SPI_CPHA) != 0) ? SSCR1_SPH : 0) - | (((mode & SPI_CPOL) != 0) ? SSCR1_SPO : 0); - - pss->int_cr1 = SSCR1_TIE | SSCR1_RIE | SSCR1_TINTE; - pss->clear_sr = SSSR_ROR | SSSR_TINT; - - pss->gpio_cs_inverted = mode & SPI_CS_HIGH; - gpio_set_value(cs, !pss->gpio_cs_inverted); - - return &pss->slave; -} - -void spi_free_slave(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - free(pss); -} - -int spi_claim_bus(struct spi_slave *slave) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - - debug("%s: bus:%i cs:%i\n", __func__, slave->bus, slave->cs); - if (spi_armd_flush(pss) == 0) - return -1; - - return 0; -} - -void spi_release_bus(struct spi_slave *slave) -{ -} - -int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, - void *din, unsigned long flags) -{ - struct armd_spi_slave *pss = to_armd_spi_slave(slave); - uint bytes = bitlen / 8; - unsigned long limit; - int ret = 0; - - if (bitlen == 0) - goto done; - - /* we can only do 8 bit transfers */ - if (bitlen % 8) { - flags |= SPI_XFER_END; - goto done; - } - - pss->tx = dout; - pss->rx = din; - - if (flags & SPI_XFER_BEGIN) { - spi_cs_activate(slave); - writel(pss->cr1 | pss->int_cr1, &pss->spi_reg->sscr1); - writel(TIMEOUT_DEF, &pss->spi_reg->ssto); - writel(pss->cr0, &pss->spi_reg->sscr0); - } - - while (bytes--) { - limit = SSP_FLUSH_NUM; - ret = spi_armd_write(pss); - if (ret) - break; - - while ((readl(&pss->spi_reg->sssr) & SSSR_BSY) && limit--) - udelay(1); - - ret = spi_armd_read(pss); - if (ret) - break; - } - - done: - if (flags & SPI_XFER_END) { - /* Stop SSP */ - writel(pss->clear_sr, &pss->spi_reg->sssr); - clrbits_le32(&pss->spi_reg->sscr1, pss->int_cr1); - writel(0, &pss->spi_reg->ssto); - spi_cs_deactivate(slave); - } - - return ret; -} diff --git a/include/configs/gplugd.h b/include/configs/gplugd.h index c1b43fd..92e2117 100644 --- a/include/configs/gplugd.h +++ b/include/configs/gplugd.h @@ -72,11 +72,6 @@ /* GPIO Configuration for PHY */ #define CONFIG_SYS_GPIO_PHY_RST 104 /* GPIO104 */
-/* SPI Support */ -#define CONFIG_ARMADA100_SPI -#define CONFIG_ENV_SPI_CS 110 -#define CONFIG_SYS_SSP_PORT 2 - /* Flash Support */
/* @@ -95,10 +90,8 @@ /* * Environment variables configurations */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_SECT_SIZE 0x4000 +#define CONFIG_ENV_IS_NOWHERE #define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_ENV_OFFSET 0x07C000
#ifdef CONFIG_CMD_USB #define CONFIG_USB_EHCI diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 9851251..6c7f8e0 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -178,7 +178,6 @@ CONFIG_ARIA_FPGA CONFIG_ARM926EJS CONFIG_ARMADA100 CONFIG_ARMADA100_FEC -CONFIG_ARMADA100_SPI CONFIG_ARMADA168 CONFIG_ARMADA_39X CONFIG_ARMCORTEXA9 -- 1.9.1
************************************************************************************************************************************************************* eInfochips Business Disclaimer: This e-mail message and all attachments transmitted with it are intended solely for the use of the addressee and may contain legally privileged and confidential information. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution, copying, or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by replying to this message and please delete it from your computer. Any views expressed in this message are those of the individual sender unless otherwise stated. Company has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email. *************************************************************************************************************************************************************

On Fri, Nov 25, 2016 at 6:06 AM, Ajay Bhargav ajay.bhargav@einfochips.com wrote:
I will update driver and submit. Thanks for notification.
Any further update? I'm going with this and submit the dm driver whenever possible.
thanks!

On Wed, Dec 21, 2016 at 12:18 PM, Jagan Teki jagan@openedev.com wrote:
On Fri, Nov 25, 2016 at 6:06 AM, Ajay Bhargav ajay.bhargav@einfochips.com wrote:
I will update driver and submit. Thanks for notification.
Any further update? I'm going with this and submit the dm driver whenever possible.
Applied to u-boot-spi/master
thanks!
participants (2)
-
Ajay Bhargav
-
Jagan Teki