From 72022a5b2e142d4696964ffd354a01b67eb4fa72 Mon Sep 17 00:00:00 2001 From: Ashok Reddy Soma Date: Fri, 20 Aug 2021 07:43:16 -0600 Subject: spi: zynqmp_gqspi: Switch genfifo start to manual mode Current implementation uses auto mode for starting generic FIFO. The recommendation from IP designers is to use manual mode, hence change to manual start mode. In fill genfifo first write to genfio and then trigger manual start. Also enable and check for genfifo empty interrupt status in place of genfifo not full interrupt. Signed-off-by: Ashok Reddy Soma Tested-by: Michal Simek Signed-off-by: Michal Simek --- drivers/spi/zynqmp_gqspi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index fc81b07343..93ba7a0ff5 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -202,9 +202,8 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi_priv *priv) config_reg = readl(®s->confr); config_reg &= ~(GQSPI_GFIFO_STRT_MODE_MASK | GQSPI_CONFIG_MODE_EN_MASK); - config_reg |= GQSPI_CONFIG_DMA_MODE | - GQSPI_GFIFO_WP_HOLD | - GQSPI_DFLT_BAUD_RATE_DIV; + config_reg |= GQSPI_CONFIG_DMA_MODE | GQSPI_GFIFO_WP_HOLD | + GQSPI_DFLT_BAUD_RATE_DIV | GQSPI_GFIFO_STRT_MODE_MASK; writel(config_reg, ®s->confr); writel(GQSPI_ENABLE_ENABLE_MASK, ®s->enbr); @@ -242,6 +241,8 @@ static void zynqmp_qspi_fill_gen_fifo(struct zynqmp_qspi_priv *priv, u32 config_reg, ier; int ret = 0; + writel(gqspi_fifo_reg, ®s->genfifo); + config_reg = readl(®s->confr); /* Manual start if needed */ config_reg |= GQSPI_STRT_GEN_FIFO; @@ -249,16 +250,15 @@ static void zynqmp_qspi_fill_gen_fifo(struct zynqmp_qspi_priv *priv, /* Enable interrupts */ ier = readl(®s->ier); - ier |= GQSPI_IXR_GFNFULL_MASK; + ier |= GQSPI_IXR_GFEMTY_MASK; writel(ier, ®s->ier); - /* Wait until the fifo is not full to write the new command */ - ret = wait_for_bit_le32(®s->isr, GQSPI_IXR_GFNFULL_MASK, 1, + /* Wait until the gen fifo is empty to write the new command */ + ret = wait_for_bit_le32(®s->isr, GQSPI_IXR_GFEMTY_MASK, 1, GQSPI_TIMEOUT, 1); if (ret) printf("%s Timeout\n", __func__); - writel(gqspi_fifo_reg, ®s->genfifo); } static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv *priv, int is_on) -- cgit v1.2.3 From 020b353be9e6c12ebf49333a81e02d582578f560 Mon Sep 17 00:00:00 2001 From: Ashok Reddy Soma Date: Fri, 20 Aug 2021 07:43:17 -0600 Subject: spi: zynqmp_gqspi: Fix dma alignment issue DMA is aligned to ARCH_DMA_MINALIGN(64 bytes), but as per spec, alignment required is 4bytes only. Change DMA alignment from ARCH_DMA_MINALIGN to GQSPI_DMA_ALIGN. Remove alignment of data length in non-exponential case. Some minor improvements in the initialization to initialize gen_fifo threshold and disable qspi controller while setting config register. Signed-off-by: Ashok Reddy Soma Tested-by: Michal Simek Signed-off-by: Michal Simek --- drivers/spi/zynqmp_gqspi.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'drivers/spi') diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index 93ba7a0ff5..2db4ae20f1 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -77,6 +77,7 @@ #define GQSPI_GFIFO_SELECT BIT(0) #define GQSPI_FIFO_THRESHOLD 1 +#define GQSPI_GENFIFO_THRESHOLD 31 #define SPI_XFER_ON_BOTH 0 #define SPI_XFER_ON_LOWER 1 @@ -197,7 +198,9 @@ static void zynqmp_qspi_init_hw(struct zynqmp_qspi_priv *priv) writel(GQSPI_GFIFO_ALL_INT_MASK, ®s->idisr); writel(GQSPI_FIFO_THRESHOLD, ®s->txftr); writel(GQSPI_FIFO_THRESHOLD, ®s->rxftr); + writel(GQSPI_GENFIFO_THRESHOLD, ®s->gqfthr); writel(GQSPI_GFIFO_ALL_INT_MASK, ®s->isr); + writel(~GQSPI_ENABLE_ENABLE_MASK, ®s->enbr); config_reg = readl(®s->confr); config_reg &= ~(GQSPI_GFIFO_STRT_MODE_MASK | @@ -572,25 +575,20 @@ static int zynqmp_qspi_start_dma(struct zynqmp_qspi_priv *priv, u32 gen_fifo_cmd, u32 *buf) { u32 addr; - u32 size, len; + u32 size; u32 actuallen = priv->len; int ret = 0; struct zynqmp_qspi_dma_regs *dma_regs = priv->dma_regs; writel((unsigned long)buf, &dma_regs->dmadst); - writel(roundup(priv->len, ARCH_DMA_MINALIGN), &dma_regs->dmasize); + writel(roundup(priv->len, GQSPI_DMA_ALIGN), &dma_regs->dmasize); writel(GQSPI_DMA_DST_I_STS_MASK, &dma_regs->dmaier); addr = (unsigned long)buf; - size = roundup(priv->len, ARCH_DMA_MINALIGN); + size = roundup(priv->len, GQSPI_DMA_ALIGN); flush_dcache_range(addr, addr + size); while (priv->len) { - len = zynqmp_qspi_calc_exp(priv, &gen_fifo_cmd); - if (!(gen_fifo_cmd & GQSPI_GFIFO_EXP_MASK) && - (len % ARCH_DMA_MINALIGN)) { - gen_fifo_cmd &= ~GENMASK(7, 0); - gen_fifo_cmd |= roundup(len, ARCH_DMA_MINALIGN); - } + zynqmp_qspi_calc_exp(priv, &gen_fifo_cmd); zynqmp_qspi_fill_gen_fifo(priv, gen_fifo_cmd); debug("GFIFO_CMD_RX:0x%x\n", gen_fifo_cmd); -- cgit v1.2.3 From 3232bdf0b30b057ace64f192bc55a0bed4199770 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sun, 1 Aug 2021 18:54:44 -0600 Subject: pci: Drop DM_PCI This option has not effect now. Drop it, using PCI instead where needed. Signed-off-by: Simon Glass --- arch/Kconfig | 1 - arch/arm/Kconfig | 2 +- arch/arm/mach-imx/mx6/Kconfig | 2 +- arch/mips/Kconfig | 2 +- board/emulation/qemu-riscv/Kconfig | 1 - board/socionext/developerbox/Kconfig | 1 - common/Kconfig | 1 - drivers/gpio/Kconfig | 2 +- drivers/i2c/Makefile | 2 +- drivers/net/Kconfig | 6 ++---- drivers/net/mscc_eswitch/Kconfig | 2 +- drivers/pci/Kconfig | 40 +++--------------------------------- drivers/spi/Kconfig | 2 +- drivers/virtio/Kconfig | 2 +- test/dm/Makefile | 2 +- 15 files changed, 14 insertions(+), 54 deletions(-) (limited to 'drivers/spi') diff --git a/arch/Kconfig b/arch/Kconfig index b6f9e177b6..8f8daadcf9 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -182,7 +182,6 @@ config X86 select SUPPORT_TPL select CREATE_ARCH_SYMLINK select DM - select DM_PCI select HAVE_ARCH_IOMAP select HAVE_PRIVATE_LIBGCC select OF_CONTROL diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 2d59562665..b5bd3284cd 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1681,7 +1681,7 @@ config TARGET_SL28 select DM_SPI_FLASH select DM_ETH select DM_MDIO - select DM_PCI + select PCI select DM_RNG select DM_RTC select DM_SCSI diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index 789a50d4e9..515c3020fa 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -237,7 +237,7 @@ config TARGET_KOSAGI_NOVENA select DM_ETH select DM_GPIO select DM_MMC - select DM_PCI + select PCI select DM_SCSI select DM_VIDEO select OF_CONTROL diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig index 6b1f10d9a0..a5cec387a0 100644 --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig @@ -17,7 +17,7 @@ config TARGET_MALTA select BOARD_EARLY_INIT_R select DM select DM_SERIAL - select DM_PCI + select PCI select DM_ETH select DYNAMIC_IO_PORT_BASE select MIPS_CM diff --git a/board/emulation/qemu-riscv/Kconfig b/board/emulation/qemu-riscv/Kconfig index a7de82d3bf..1bbf1bc84a 100644 --- a/board/emulation/qemu-riscv/Kconfig +++ b/board/emulation/qemu-riscv/Kconfig @@ -51,7 +51,6 @@ config BOARD_SPECIFIC_OPTIONS # dummy imply E1000 imply NVME imply PCI - imply DM_PCI imply PCIE_ECAM_GENERIC imply SCSI imply DM_SCSI diff --git a/board/socionext/developerbox/Kconfig b/board/socionext/developerbox/Kconfig index 706b8dc0f1..c181d26a44 100644 --- a/board/socionext/developerbox/Kconfig +++ b/board/socionext/developerbox/Kconfig @@ -7,7 +7,6 @@ choice config TARGET_DEVELOPERBOX bool "Socionext DeveloperBox" select PCI - select DM_PCI select PCIE_ECAM_SYNQUACER select SYS_DISABLE_DCACHE_OPS select OF_BOARD_SETUP diff --git a/common/Kconfig b/common/Kconfig index 2ab20a6c85..ee14d3ad5b 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -551,7 +551,6 @@ config MISC_INIT_R config PCI_INIT_R bool "Enumerate PCI buses during init" depends on PCI - default y if !DM_PCI help With this option U-Boot will call pci_init() soon after relocation, which will enumerate PCI buses. This is needed, for instance, in the diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 4a89c1a62b..e37ac9f494 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -358,7 +358,7 @@ config PIC32_GPIO config OCTEON_GPIO bool "Octeon II/III/TX/TX2 GPIO driver" - depends on DM_GPIO && DM_PCI && (ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2) + depends on DM_GPIO && PCI && (ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2) default y help Add support for the Marvell Octeon GPIO driver. This is used with diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile index c2eb24e0f7..c16ebb2491 100644 --- a/drivers/i2c/Makefile +++ b/drivers/i2c/Makefile @@ -18,7 +18,7 @@ obj-$(CONFIG_SYS_I2C_CADENCE) += i2c-cdns.o obj-$(CONFIG_SYS_I2C_CA) += i2c-cortina.o obj-$(CONFIG_SYS_I2C_DAVINCI) += davinci_i2c.o obj-$(CONFIG_SYS_I2C_DW) += designware_i2c.o -ifdef CONFIG_DM_PCI +ifdef CONFIG_PCI obj-$(CONFIG_SYS_I2C_DW) += designware_i2c_pci.o endif obj-$(CONFIG_SYS_I2C_FSL) += fsl_i2c.o diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index 32f2708dc3..d4dc72046c 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig @@ -222,7 +222,6 @@ config DWC_ETH_QOS_TEGRA186 config E1000 bool "Intel PRO/1000 Gigabit Ethernet support" - depends on (DM_ETH && DM_PCI) || !DM_ETH help This driver supports Intel(R) PRO/1000 gigabit ethernet family of adapters. For more information on how to identify your adapter, go @@ -506,7 +505,7 @@ config OCTEONTX2_CGX_INTF config PCH_GBE bool "Intel Platform Controller Hub EG20T GMAC driver" - depends on DM_ETH && DM_PCI + depends on DM_ETH select PHYLIB help This MAC is present in Intel Platform Controller Hub EG20T. It @@ -606,7 +605,6 @@ source "drivers/net/ti/Kconfig" config TULIP bool "DEC Tulip DC2114x Ethernet support" - depends on (DM_ETH && DM_PCI) || !DM_ETH help This driver supports DEC DC2114x Fast ethernet chips. @@ -791,7 +789,7 @@ config HIGMACV300_ETH config FSL_ENETC bool "NXP ENETC Ethernet controller" - depends on DM_PCI && DM_ETH && DM_MDIO + depends on DM_ETH && DM_MDIO help This driver supports the NXP ENETC Ethernet controller found on some of the NXP SoCs. diff --git a/drivers/net/mscc_eswitch/Kconfig b/drivers/net/mscc_eswitch/Kconfig index ccf7822dbe..930d2ef113 100644 --- a/drivers/net/mscc_eswitch/Kconfig +++ b/drivers/net/mscc_eswitch/Kconfig @@ -39,7 +39,7 @@ config MSCC_SERVAL_SWITCH config MSCC_FELIX_SWITCH bool "Felix switch driver" - depends on DM_DSA && DM_PCI + depends on DM_DSA select FSL_ENETC help This driver supports the Ethernet switch integrated in the diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig index 2ef4d46797..e4123ba820 100644 --- a/drivers/pci/Kconfig +++ b/drivers/pci/Kconfig @@ -2,35 +2,26 @@ menuconfig PCI bool "PCI support" depends on DM default y if PPC - select DM_PCI help Enable support for PCI (Peripheral Interconnect Bus), a type of bus used on some devices to allow the CPU to communicate with its peripherals. -config DM_PCI - bool - help - Use driver model for PCI. Driver model is the new method for - orgnising devices in U-Boot. For PCI, driver model keeps track of - available PCI devices, allows scanning of PCI buses and provides - device configuration support. + This subsystem requires driver model. if PCI config DM_PCI_COMPAT bool "Enable compatible functions for PCI" - depends on DM_PCI help Enable compatibility functions for PCI so that old code can be used - with CONFIG_DM_PCI enabled. This should be used as an interim + with CONFIG_PCI enabled. This should be used as an interim measure when porting a board to use driver model for PCI. Once the board is fully supported, this option should be disabled. config PCI_AARDVARK bool "Enable Aardvark PCIe driver" default n - depends on DM_PCI depends on DM_GPIO depends on ARMADA_3700 help @@ -40,14 +31,12 @@ config PCI_AARDVARK config PCI_PNP bool "Enable Plug & Play support for PCI" - depends on PCI || DM_PCI default y help Enable PCI memory and I/O space resource allocation and assignment. config PCI_REGION_MULTI_ENTRY bool "Enable Multiple entries of region type MEMORY in ranges for PCI" - depends on PCI || DM_PCI default n help Enable PCI memory regions to be of multiple entry. Multiple entry @@ -57,7 +46,6 @@ config PCI_REGION_MULTI_ENTRY config PCI_MAP_SYSTEM_MEMORY bool "Map local system memory from a virtual base address" - depends on PCI || DM_PCI depends on MIPS default n help @@ -70,7 +58,6 @@ config PCI_MAP_SYSTEM_MEMORY config PCI_SRIOV bool "Enable Single Root I/O Virtualization support for PCI" - depends on PCI || DM_PCI default n help Say Y here if you want to enable PCI Single Root I/O Virtualization @@ -80,7 +67,6 @@ config PCI_SRIOV config PCI_ARID bool "Enable Alternate Routing-ID support for PCI" - depends on PCI || DM_PCI default n help Say Y here if you want to enable Alternate Routing-ID capability @@ -90,7 +76,6 @@ config PCI_ARID config PCIE_ECAM_GENERIC bool "Generic ECAM-based PCI host controller support" default n - depends on DM_PCI help Say Y here if you want to enable support for generic ECAM-based PCIe host controllers, such as the one emulated by QEMU. @@ -98,7 +83,6 @@ config PCIE_ECAM_GENERIC config PCIE_ECAM_SYNQUACER bool "SynQuacer ECAM-based PCI host controller support" default n - depends on DM_PCI select PCI_INIT_R select PCI_REGION_MULTI_ENTRY help @@ -109,14 +93,12 @@ config PCIE_ECAM_SYNQUACER config PCI_PHYTIUM bool "Phytium PCIe support" - depends on DM_PCI help Say Y here if you want to enable PCIe controller support on Phytium SoCs. config PCIE_DW_MVEBU bool "Enable Armada-8K PCIe driver (DesignWare core)" - depends on DM_PCI depends on ARMADA_8K help Say Y here if you want to enable PCIe controller support on @@ -135,7 +117,6 @@ config PCIE_DW_SIFIVE config PCIE_FSL bool "FSL PowerPC PCIe support" - depends on DM_PCI help Say Y here if you want to enable PCIe controller support on FSL PowerPC MPC85xx, MPC86xx, B series, P series and T series SoCs. @@ -143,14 +124,12 @@ config PCIE_FSL config PCI_MPC85XX bool "MPC85XX PowerPC PCI support" - depends on DM_PCI help Say Y here if you want to enable PCI controller support on FSL PowerPC MPC85xx SoC. config PCI_RCAR_GEN2 bool "Renesas RCar Gen2 PCIe driver" - depends on DM_PCI depends on RCAR_32 help Say Y here if you want to enable PCIe controller support on @@ -159,7 +138,6 @@ config PCI_RCAR_GEN2 config PCI_RCAR_GEN3 bool "Renesas RCar Gen3 PCIe driver" - depends on DM_PCI depends on RCAR_GEN3 help Say Y here if you want to enable PCIe controller support on @@ -167,7 +145,7 @@ config PCI_RCAR_GEN3 config PCI_SANDBOX bool "Sandbox PCI support" - depends on SANDBOX && DM_PCI + depends on SANDBOX help Support PCI on sandbox, as an emulated bus. This permits testing of PCI feature such as bus scanning, device configuration and device @@ -202,7 +180,6 @@ config PCIE_OCTEON config PCI_XILINX bool "Xilinx AXI Bridge for PCI Express" - depends on DM_PCI help Enable support for the Xilinx AXI bridge for PCI express, an IP block which can be used on some generations of Xilinx FPGAs. @@ -213,7 +190,6 @@ config PCIE_LAYERSCAPE config PCIE_LAYERSCAPE_RC bool "Layerscape PCIe Root Complex mode support" - depends on DM_PCI select PCIE_LAYERSCAPE help Enable Layerscape PCIe Root Complex mode driver support. The Layerscape @@ -235,7 +211,6 @@ config PCI_IOMMU_EXTRA_MAPPINGS config PCIE_LAYERSCAPE_EP bool "Layerscape PCIe Endpoint mode support" - depends on DM_PCI select PCIE_LAYERSCAPE select PCI_ENDPOINT help @@ -246,7 +221,6 @@ config PCIE_LAYERSCAPE_EP config PCIE_LAYERSCAPE_GEN4 bool "Layerscape Gen4 PCIe support" - depends on DM_PCI help Support PCIe Gen4 on NXP Layerscape SoCs, which may have one or several PCIe controllers. The PCIe controller can work in RC or @@ -279,14 +253,12 @@ config FSL_PCIE_EP_COMPAT config PCIE_INTEL_FPGA bool "Intel FPGA PCIe support" - depends on DM_PCI help Say Y here if you want to enable PCIe controller support on Intel FPGA, example Stratix 10. config PCIE_IPROC bool "Iproc PCIe support" - depends on DM_PCI help Broadcom iProc PCIe controller driver. Say Y here if you want to enable Broadcom iProc PCIe controller, @@ -294,7 +266,6 @@ config PCIE_IPROC config PCI_MVEBU bool "Enable Armada XP/38x PCIe driver" depends on ARCH_MVEBU - select DM_PCI select MISC help Say Y here if you want to enable PCIe controller support on @@ -302,7 +273,6 @@ config PCI_MVEBU config PCIE_DW_COMMON bool - select DM_PCI config PCI_KEYSTONE bool "TI Keystone PCIe controller" @@ -312,7 +282,6 @@ config PCI_KEYSTONE config PCIE_MEDIATEK bool "MediaTek PCIe Gen2 controller" - depends on DM_PCI depends on ARCH_MEDIATEK help Say Y here if you want to enable Gen2 PCIe controller, @@ -329,7 +298,6 @@ config PCIE_DW_MESON config PCIE_ROCKCHIP bool "Enable Rockchip PCIe driver" depends on ARCH_ROCKCHIP - select DM_PCI select PHY_ROCKCHIP_PCIE default y if ROCKCHIP_RK3399 help @@ -347,7 +315,6 @@ config PCIE_DW_ROCKCHIP config PCI_BRCMSTB bool "Broadcom STB PCIe controller" - depends on DM_PCI depends on ARCH_BCM283X help Say Y here if you want to enable support for PCIe controller @@ -357,7 +324,6 @@ config PCI_BRCMSTB config PCIE_UNIPHIER bool "Socionext UniPhier PCIe driver" - depends on DM_PCI depends on ARCH_UNIPHIER select PHY_UNIPHIER_PCIE help diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index e12699bec7..d07e9a28af 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig @@ -271,7 +271,7 @@ config NXP_FSPI config OCTEON_SPI bool "Octeon SPI driver" - depends on DM_PCI && (ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2) + depends on ARCH_OCTEON || ARCH_OCTEONTX || ARCH_OCTEONTX2 help Enable the Octeon SPI driver. This driver can be used to access the SPI NOR flash on Octeon II/III and OcteonTX/TX2 diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig index 1835607083..863c3fbe02 100644 --- a/drivers/virtio/Kconfig +++ b/drivers/virtio/Kconfig @@ -31,7 +31,7 @@ config VIRTIO_MMIO config VIRTIO_PCI bool "PCI driver for virtio devices" - depends on DM_PCI + depends on PCI select VIRTIO help This driver provides support for virtio based paravirtual device diff --git a/test/dm/Makefile b/test/dm/Makefile index 516f69d61c..55162e9499 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -65,7 +65,7 @@ obj-y += of_extra.o obj-$(CONFIG_OSD) += osd.o obj-$(CONFIG_DM_VIDEO) += panel.o obj-$(CONFIG_EFI_PARTITION) += part.o -obj-$(CONFIG_DM_PCI) += pci.o +obj-$(CONFIG_PCI) += pci.o obj-$(CONFIG_P2SB) += p2sb.o obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o obj-$(CONFIG_PCH) += pch.o -- cgit v1.2.3