Skip to contentSkip to conversation

Cortina Access Drivers Package 2

PATCH Superseded Alex Nemirovsky 4 participants 16 messages Mar 30, 2020 – Apr 8, 2020

Subsystems (6)

v4 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v4 cover Cortina Access Drivers Package 2

This release adds the following drivers and
integrates support into the Cortina Access
Presidio Engineering Board:

CAxxxx SoC eMMC/SD controller
CAxxxx SoC I2C controller
CAxxxx Soc LED controller
CAxxxx SPI NAND and NOR controller

Changes in v4:
- Rename DT compatible name
- Remove uneccessary if-statement to support 8-bit buswidth
- Remove redundant error msg
- Use symbolic constants in switch statement
- Change DT compatiblity name to match change in driver's name
- Remove unused io_ds and fifo_mode fields from DT
- Utilize standard I2C macros from <i2c.h>
- Return ETIMEDOUT in funcs that can timeout
- Return i2c_xfer_init() result to caller of i2c_read() if it fails within i2c_read() execution
- Fix misc. style guide conformance issues
- Use printf() to report i2c_xfer() runtime errors instead of debug()
- remove unused macros
- remove cortina prefix from macros
- remove use BSS variable
- further cleanup to meet code style guidelines
- add additinal struct comments
- rename DT blink rate symbol
- rename DT blink rate symbol

Changes in v3:
- Fixup syntax issues related to checkpatch.pl cleanup

Changes in v2:
- Add I2C controller
- Add LED controller
- Add SPI NAND and NOR controller

Alex Nemirovsky (3):
board: presidio-asic: Add eMMC board support
board: presidio-asic: Add I2C support
board: presidio-asic: Add SPI NAND and NOR support

Arthur Li (2):
mmc: ca_dw_mmc: add DesignWare based DM support for CAxxxx SoCs
i2c: i2c-cortina: added CAxxxx I2C support

Jway Lin (2):
led: led_cortina: Add CAxxx LED support
board: presidio: add LED support

Pengpeng Chen (1):
spi: ca_sflash: Add CAxxxx SPI Flash Controller

 MAINTAINERS                                      |  10 +
 arch/arm/dts/ca-presidio-engboard.dts            |  43 +-
 board/cortina/presidio-asic/presidio.c           |  16 +-
 configs/cortina_presidio-asic-emmc_defconfig     |  38 ++
 configs/cortina_presidio-asic-spi-nand_defconfig |  48 ++
 configs/cortina_presidio-asic-spi-nor_defconfig  |  59 +++
 drivers/i2c/Kconfig                              |   7 +
 drivers/i2c/Makefile                             |   1 +
 drivers/i2c/i2c-cortina.c                        | 346 ++++++++++++++
 drivers/i2c/i2c-cortina.h                        |  84 ++++
 drivers/led/Kconfig                              |   8 +
 drivers/led/Makefile                             |   1 +
 drivers/led/led_cortina.c                        | 268 +++++++++++
 drivers/mmc/Kconfig                              |  11 +
 drivers/mmc/Makefile                             |   1 +
 drivers/mmc/ca_dw_mmc.c                          | 171 +++++++
 drivers/spi/Kconfig                              |   8 +
 drivers/spi/Makefile                             |   1 +
 drivers/spi/ca_sflash.c                          | 576 +++++++++++++++++++++++
 19 files changed, 1688 insertions(+), 9 deletions(-)
 create mode 100644 configs/cortina_presidio-asic-emmc_defconfig
 create mode 100644 configs/cortina_presidio-asic-spi-nand_defconfig
 create mode 100644 configs/cortina_presidio-asic-spi-nor_defconfig
 create mode 100644 drivers/i2c/i2c-cortina.c
 create mode 100644 drivers/i2c/i2c-cortina.h
 create mode 100644 drivers/led/led_cortina.c
 create mode 100644 drivers/mmc/ca_dw_mmc.c
 create mode 100644 drivers/spi/ca_sflash.c
Signature · 1 line
2.7.4
#1 lore raw

PATCH v4 1/8 mmc: ca_dw_mmc: add DesignWare based DM support for CAxxxx SoCs

From: Arthur Li <[email protected]>

Initial DesignWare based DM support for Cortina Access CAxxxx SoCs.

---

Changes in v4:
- Rename DT compatible name
- Remove uneccessary if-statement to support 8-bit buswidth
- Remove redundant error msg
- Use symbolic constants in switch statement

Changes in v3: None
Changes in v2:
- Add I2C controller
- Add LED controller
- Add SPI NAND and NOR controller

 MAINTAINERS             |   2 +
 drivers/mmc/Kconfig     |  11 ++++
 drivers/mmc/Makefile    |   1 +
 drivers/mmc/ca_dw_mmc.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 185 insertions(+)
 create mode 100644 drivers/mmc/ca_dw_mmc.c
MAINTAINERS +2 -0
index 82e4159..bb45d3c 100644
@@ -180,6 +180,7 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mmc/ca_dw_mmc.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -670,6 +671,7 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mmc/ca_dw_mmc.c
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/mmc/Kconfig +11 -0
index 2f0eedc..bb38787 100644
@@ -205,6 +205,17 @@ config MMC_DW
 	  block, this provides host support for SD and MMC interfaces, in both
 	  PIO, internal DMA mode and external DMA mode.
 
+config MMC_DW_CORTINA
+	bool "Cortina specific extensions for Synopsys DW Memory Card Interface"
+	depends on DM_MMC
+	depends on MMC_DW
+	depends on BLK
+	default n
+	help
+	  This selects support for Cortina SoC specific extensions to the
+	  Synopsys DesignWare Memory Card Interface driver. Select this option
+	  for platforms based on Cortina CAxxxx Soc's.
+
 config MMC_DW_EXYNOS
 	bool "Exynos specific extensions for Synopsys DW Memory Card Interface"
 	depends on ARCH_EXYNOS
drivers/mmc/Makefile +1 -0
index 9c1f8e5..615b724 100644
@@ -20,6 +20,7 @@ endif
 obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
 obj-$(CONFIG_MMC_DAVINCI)		+= davinci_mmc.o
 obj-$(CONFIG_MMC_DW)			+= dw_mmc.o
+obj-$(CONFIG_MMC_DW_CORTINA)		+= ca_dw_mmc.o
 obj-$(CONFIG_MMC_DW_EXYNOS)		+= exynos_dw_mmc.o
 obj-$(CONFIG_MMC_DW_K3)			+= hi6220_dw_mmc.o
 obj-$(CONFIG_MMC_DW_ROCKCHIP)		+= rockchip_dw_mmc.o
drivers/mmc/ca_dw_mmc.c new file +171 -0

171 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v4 1/8 mmc: ca_dw_mmc: add DesignWare based DM support for CAxxxx SoCs

Hi,

Quoted 7 lines · Alex Nemirovsky

From: Arthur Li <[email protected]>

Initial DesignWare based DM support for Cortina Access CAxxxx SoCs.

It seems that it has already applied to u-boot?
If i missed something, let me know, plz.

Best Regards,
Jaehoon Chung

Quoted 254 lines

---

Changes in v4:
- Rename DT compatible name
- Remove uneccessary if-statement to support 8-bit buswidth
- Remove redundant error msg
- Use symbolic constants in switch statement

Changes in v3: None
Changes in v2:
- Add I2C controller
- Add LED controller
- Add SPI NAND and NOR controller

 MAINTAINERS             |   2 +
 drivers/mmc/Kconfig     |  11 ++++
 drivers/mmc/Makefile    |   1 +
 drivers/mmc/ca_dw_mmc.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 185 insertions(+)
 create mode 100644 drivers/mmc/ca_dw_mmc.c
MAINTAINERS +2 -0
index 82e4159..bb45d3c 100644
@@ -180,6 +180,7 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mmc/ca_dw_mmc.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -670,6 +671,7 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mmc/ca_dw_mmc.c
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/mmc/Kconfig +11 -0
index 2f0eedc..bb38787 100644
@@ -205,6 +205,17 @@ config MMC_DW
 	  block, this provides host support for SD and MMC interfaces, in both
 	  PIO, internal DMA mode and external DMA mode.
 
+config MMC_DW_CORTINA
+	bool "Cortina specific extensions for Synopsys DW Memory Card Interface"
+	depends on DM_MMC
+	depends on MMC_DW
+	depends on BLK
+	default n
+	help
+	  This selects support for Cortina SoC specific extensions to the
+	  Synopsys DesignWare Memory Card Interface driver. Select this option
+	  for platforms based on Cortina CAxxxx Soc's.
+
 config MMC_DW_EXYNOS
 	bool "Exynos specific extensions for Synopsys DW Memory Card Interface"
 	depends on ARCH_EXYNOS
drivers/mmc/Makefile +1 -0
index 9c1f8e5..615b724 100644
@@ -20,6 +20,7 @@ endif
 obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
 obj-$(CONFIG_MMC_DAVINCI)		+= davinci_mmc.o
 obj-$(CONFIG_MMC_DW)			+= dw_mmc.o
+obj-$(CONFIG_MMC_DW_CORTINA)		+= ca_dw_mmc.o
 obj-$(CONFIG_MMC_DW_EXYNOS)		+= exynos_dw_mmc.o
 obj-$(CONFIG_MMC_DW_K3)			+= hi6220_dw_mmc.o
 obj-$(CONFIG_MMC_DW_ROCKCHIP)		+= rockchip_dw_mmc.o
drivers/mmc/ca_dw_mmc.c new file +171 -0
new file mode 100644
index 0000000..198c41f
@@ -0,0 +1,171 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Cortina Access
+ * Arthur Li <[email protected]>
+ */
+
+#include <common.h>
+#include <dwmmc.h>
+#include <fdtdec.h>
+#include <linux/libfdt.h>
+#include <malloc.h>
+#include <errno.h>
+#include <dm.h>
+#include <mapmem.h>
+
+#define SD_CLK_SEL_MASK (0x3)
+#define SD_DLL_DEFAULT  (0x143000)
+#define SD_SCLK_MAX (200000000)
+
+#define SD_CLK_SEL_200MHZ (0x2)
+#define SD_CLK_SEL_100MHZ (0x1)
+#define SD_CLK_SEL_50MHZ (0x0)
+
+#define IO_DRV_SD_DS_OFFSET (16)
+#define IO_DRV_SD_DS_MASK   (0xff << IO_DRV_SD_DS_OFFSET)
+
+#define MIN_FREQ (400000)
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ca_mmc_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
+struct ca_dwmmc_priv_data {
+	struct dwmci_host host;
+	void __iomem *sd_dll_reg;
+	void __iomem *io_drv_reg;
+	u8 ds;
+};
+
+static void ca_dwmci_clksel(struct dwmci_host *host)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u32 val = readl(priv->sd_dll_reg);
+
+	val &= ~SD_CLK_SEL_MASK;
+	if (host->bus_hz >= 200000000)
+		val |= SD_CLK_SEL_200MHZ;
+	else if (host->bus_hz >= 100000000)
+		val |= SD_CLK_SEL_100MHZ;
+
+	writel(val, priv->sd_dll_reg);
+}
+
+static void ca_dwmci_board_init(struct dwmci_host *host)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u32 val = readl(priv->io_drv_reg);
+
+	writel(SD_DLL_DEFAULT, priv->sd_dll_reg);
+
+	val &= ~IO_DRV_SD_DS_MASK;
+	if (priv && priv->ds)
+		val |= priv->ds << IO_DRV_SD_DS_OFFSET;
+	writel(val, priv->io_drv_reg);
+}
+
+unsigned int ca_dwmci_get_mmc_clock(struct dwmci_host *host, uint freq)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u8 sd_clk_sel = readl(priv->sd_dll_reg) & SD_CLK_SEL_MASK;
+	u8 clk_div;
+
+	switch (sd_clk_sel) {
+	case SD_CLK_SEL_50MHZ:
+		clk_div = 4;
+		break;
+	case SD_CLK_SEL_100MHZ:
+		clk_div = 2;
+		break;
+	default:
+		clk_div = 1;
+	}
+
+	return SD_SCLK_MAX / clk_div / (host->div + 1);
+}
+
+static int ca_dwmmc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct ca_dwmmc_priv_data *priv = dev_get_priv(dev);
+	struct dwmci_host *host = &priv->host;
+	u32 tmp;
+
+	host->name = dev->name;
+	host->dev_index = 0;
+
+	host->buswidth = dev_read_u32_default(dev, "bus-width", 1);
+	host->bus_hz = dev_read_u32_default(dev, "max-frequency", 50000000);
+	priv->ds = dev_read_u32_default(dev, "io_ds", 0x33);
+	host->fifo_mode = dev_read_bool(dev, "fifo-mode");
+
+	dev_read_u32(dev, "sd_dll_ctrl", &tmp);
+	priv->sd_dll_reg = map_sysmem((uintptr_t)tmp, sizeof(uintptr_t));
+	if (!priv->sd_dll_reg)
+		return -EINVAL;
+
+	dev_read_u32(dev, "io_drv_ctrl", &tmp);
+	priv->io_drv_reg = map_sysmem((uintptr_t)tmp, sizeof(uintptr_t));
+	if (!priv->io_drv_reg)
+		return -EINVAL;
+
+	host->ioaddr = dev_read_addr_ptr(dev);
+	if (!host->ioaddr)
+		return -EINVAL;
+
+	host->priv = priv;
+
+	return 0;
+}
+
+struct dm_mmc_ops ca_dwmci_dm_ops;
+
+static int ca_dwmmc_probe(struct udevice *dev)
+{
+	struct ca_mmc_plat *plat = dev_get_platdata(dev);
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct ca_dwmmc_priv_data *priv = dev_get_priv(dev);
+	struct dwmci_host *host = &priv->host;
+
+	memcpy(&ca_dwmci_dm_ops, &dm_dwmci_ops, sizeof(struct dm_mmc_ops));
+
+	dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, MIN_FREQ);
+	if (host->buswidth == 1)
+		(&plat->cfg)->host_caps &= ~(MMC_MODE_8BIT | MMC_MODE_4BIT);
+
+	host->mmc = &plat->mmc;
+	host->mmc->priv = &priv->host;
+	upriv->mmc = host->mmc;
+	host->mmc->dev = dev;
+	host->clksel = ca_dwmci_clksel;
+	host->board_init = ca_dwmci_board_init;
+	host->get_mmc_clk = ca_dwmci_get_mmc_clock;
+
+	return dwmci_probe(dev);
+}
+
+static int ca_dwmmc_bind(struct udevice *dev)
+{
+	struct ca_mmc_plat *plat = dev_get_platdata(dev);
+
+	return dwmci_bind(dev, &plat->mmc, &plat->cfg);
+}
+
+static const struct udevice_id ca_dwmmc_ids[] = {
+	{ .compatible = "cortina,ca-mmc" },
+	{ }
+};
+
+U_BOOT_DRIVER(ca_dwmmc_drv) = {
+	.name		= "cortina_dwmmc",
+	.id		= UCLASS_MMC,
+	.of_match	= ca_dwmmc_ids,
+	.ofdata_to_platdata = ca_dwmmc_ofdata_to_platdata,
+	.bind		= ca_dwmmc_bind,
+	.ops		= &ca_dwmci_dm_ops,
+	.probe		= ca_dwmmc_probe,
+	.priv_auto_alloc_size	= sizeof(struct ca_dwmmc_priv_data),
+	.platdata_auto_alloc_size = sizeof(struct ca_mmc_plat),
+};
#3 lore raw

PATCH v4 1/8 mmc: ca_dw_mmc: add DesignWare based DM support for CAxxxx SoCs

That?s odd. I didn?t get the memo. :)

Quoted 274 lines · Jaehoon Chung

Hi,

Quoted 7 lines · Alex Nemirovsky

From: Arthur Li <[email protected]>

Initial DesignWare based DM support for Cortina Access CAxxxx SoCs.

It seems that it has already applied to u-boot?
If i missed something, let me know, plz.

Best Regards,
Jaehoon Chung

Quoted 254 lines

---

Changes in v4:
- Rename DT compatible name
- Remove uneccessary if-statement to support 8-bit buswidth
- Remove redundant error msg
- Use symbolic constants in switch statement

Changes in v3: None
Changes in v2:
- Add I2C controller
- Add LED controller
- Add SPI NAND and NOR controller

MAINTAINERS             |   2 +
drivers/mmc/Kconfig     |  11 ++++
drivers/mmc/Makefile    |   1 +
drivers/mmc/ca_dw_mmc.c | 171 ++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 185 insertions(+)

create mode 100644 drivers/mmc/ca_dw_mmc.c

MAINTAINERS +0 -0
index 82e4159..bb45d3c 100644
@@ -180,6 +180,7 @@ F:	board/cortina/common/

F: drivers/gpio/cortina_gpio.c
F: drivers/watchdog/cortina_wdt.c
F: drivers/serial/serial_cortina.c
+F: drivers/mmc/ca_dw_mmc.c

ARM/CZ.NIC TURRIS MOX SUPPORT
M: Marek Behun <[email protected]>

MAINTAINERS +0 -0
@@ -670,6 +671,7 @@ F:	board/cortina/common/

F: drivers/gpio/cortina_gpio.c
F: drivers/watchdog/cortina_wdt.c
F: drivers/serial/serial_cortina.c
+F: drivers/mmc/ca_dw_mmc.c

MIPS MSCC
M: Gregory CLEMENT <[email protected]>

drivers/mmc/Kconfig +11 -0
index 2f0eedc..bb38787 100644
@@ -205,6 +205,17 @@ config MMC_DW
 	  block, this provides host support for SD and MMC interfaces, in both
 	  PIO, internal DMA mode and external DMA mode.
 
+config MMC_DW_CORTINA
+	bool "Cortina specific extensions for Synopsys DW Memory Card Interface"
+	depends on DM_MMC
+	depends on MMC_DW
+	depends on BLK
+	default n
+	help
+	  This selects support for Cortina SoC specific extensions to the
+	  Synopsys DesignWare Memory Card Interface driver. Select this option
+	  for platforms based on Cortina CAxxxx Soc's.
+

config MMC_DW_EXYNOS
bool "Exynos specific extensions for Synopsys DW Memory Card Interface" depends on ARCH_EXYNOS

drivers/mmc/Makefile +0 -0
index 9c1f8e5..615b724 100644
@@ -20,6 +20,7 @@ endif

obj-$(CONFIG_ARM_PL180_MMCI) += arm_pl180_mmci.o
obj-$(CONFIG_MMC_DAVINCI) += davinci_mmc.o
obj-$(CONFIG_MMC_DW) += dw_mmc.o
+obj-$(CONFIG_MMC_DW_CORTINA) += ca_dw_mmc.o
obj-$(CONFIG_MMC_DW_EXYNOS) += exynos_dw_mmc.o
obj-$(CONFIG_MMC_DW_K3) += hi6220_dw_mmc.o
obj-$(CONFIG_MMC_DW_ROCKCHIP) += rockchip_dw_mmc.o

drivers/mmc/ca_dw_mmc.c new file +171 -0
new file mode 100644
index 0000000..198c41f
@@ -0,0 +1,171 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2019 Cortina Access
+ * Arthur Li <[email protected]>
+ */
+
+#include <common.h>
+#include <dwmmc.h>
+#include <fdtdec.h>
+#include <linux/libfdt.h>
+#include <malloc.h>
+#include <errno.h>
+#include <dm.h>
+#include <mapmem.h>
+
+#define SD_CLK_SEL_MASK (0x3)
+#define SD_DLL_DEFAULT  (0x143000)
+#define SD_SCLK_MAX (200000000)
+
+#define SD_CLK_SEL_200MHZ (0x2)
+#define SD_CLK_SEL_100MHZ (0x1)
+#define SD_CLK_SEL_50MHZ (0x0)
+
+#define IO_DRV_SD_DS_OFFSET (16)
+#define IO_DRV_SD_DS_MASK   (0xff << IO_DRV_SD_DS_OFFSET)
+
+#define MIN_FREQ (400000)
+
+DECLARE_GLOBAL_DATA_PTR;
+
+struct ca_mmc_plat {
+	struct mmc_config cfg;
+	struct mmc mmc;
+};
+
+struct ca_dwmmc_priv_data {
+	struct dwmci_host host;
+	void __iomem *sd_dll_reg;
+	void __iomem *io_drv_reg;
+	u8 ds;
+};
+
+static void ca_dwmci_clksel(struct dwmci_host *host)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u32 val = readl(priv->sd_dll_reg);
+
+	val &= ~SD_CLK_SEL_MASK;
+	if (host->bus_hz >= 200000000)
+		val |= SD_CLK_SEL_200MHZ;
+	else if (host->bus_hz >= 100000000)
+		val |= SD_CLK_SEL_100MHZ;
+
+	writel(val, priv->sd_dll_reg);
+}
+
+static void ca_dwmci_board_init(struct dwmci_host *host)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u32 val = readl(priv->io_drv_reg);
+
+	writel(SD_DLL_DEFAULT, priv->sd_dll_reg);
+
+	val &= ~IO_DRV_SD_DS_MASK;
+	if (priv && priv->ds)
+		val |= priv->ds << IO_DRV_SD_DS_OFFSET;
+	writel(val, priv->io_drv_reg);
+}
+
+unsigned int ca_dwmci_get_mmc_clock(struct dwmci_host *host, uint freq)
+{
+	struct ca_dwmmc_priv_data *priv = host->priv;
+	u8 sd_clk_sel = readl(priv->sd_dll_reg) & SD_CLK_SEL_MASK;
+	u8 clk_div;
+
+	switch (sd_clk_sel) {
+	case SD_CLK_SEL_50MHZ:
+		clk_div = 4;
+		break;
+	case SD_CLK_SEL_100MHZ:
+		clk_div = 2;
+		break;
+	default:
+		clk_div = 1;
+	}
+
+	return SD_SCLK_MAX / clk_div / (host->div + 1);
+}
+
+static int ca_dwmmc_ofdata_to_platdata(struct udevice *dev)
+{
+	struct ca_dwmmc_priv_data *priv = dev_get_priv(dev);
+	struct dwmci_host *host = &priv->host;
+	u32 tmp;
+
+	host->name = dev->name;
+	host->dev_index = 0;
+
+	host->buswidth = dev_read_u32_default(dev, "bus-width", 1);
+	host->bus_hz = dev_read_u32_default(dev, "max-frequency", 50000000);
+	priv->ds = dev_read_u32_default(dev, "io_ds", 0x33);
+	host->fifo_mode = dev_read_bool(dev, "fifo-mode");
+
+	dev_read_u32(dev, "sd_dll_ctrl", &tmp);
+	priv->sd_dll_reg = map_sysmem((uintptr_t)tmp, sizeof(uintptr_t));
+	if (!priv->sd_dll_reg)
+		return -EINVAL;
+
+	dev_read_u32(dev, "io_drv_ctrl", &tmp);
+	priv->io_drv_reg = map_sysmem((uintptr_t)tmp, sizeof(uintptr_t));
+	if (!priv->io_drv_reg)
+		return -EINVAL;
+
+	host->ioaddr = dev_read_addr_ptr(dev);
+	if (!host->ioaddr)
+		return -EINVAL;
+
+	host->priv = priv;
+
+	return 0;
+}
+
+struct dm_mmc_ops ca_dwmci_dm_ops;
+
+static int ca_dwmmc_probe(struct udevice *dev)
+{
+	struct ca_mmc_plat *plat = dev_get_platdata(dev);
+	struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev);
+	struct ca_dwmmc_priv_data *priv = dev_get_priv(dev);
+	struct dwmci_host *host = &priv->host;
+
+	memcpy(&ca_dwmci_dm_ops, &dm_dwmci_ops, sizeof(struct dm_mmc_ops));
+
+	dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, MIN_FREQ);
+	if (host->buswidth == 1)
+		(&plat->cfg)->host_caps &= ~(MMC_MODE_8BIT | MMC_MODE_4BIT);
+
+	host->mmc = &plat->mmc;
+	host->mmc->priv = &priv->host;
+	upriv->mmc = host->mmc;
+	host->mmc->dev = dev;
+	host->clksel = ca_dwmci_clksel;
+	host->board_init = ca_dwmci_board_init;
+	host->get_mmc_clk = ca_dwmci_get_mmc_clock;
+
+	return dwmci_probe(dev);
+}
+
+static int ca_dwmmc_bind(struct udevice *dev)
+{
+	struct ca_mmc_plat *plat = dev_get_platdata(dev);
+
+	return dwmci_bind(dev, &plat->mmc, &plat->cfg);
+}
+
+static const struct udevice_id ca_dwmmc_ids[] = {
+	{ .compatible = "cortina,ca-mmc" },
+	{ }
+};
+
+U_BOOT_DRIVER(ca_dwmmc_drv) = {
+	.name		= "cortina_dwmmc",
+	.id		= UCLASS_MMC,
+	.of_match	= ca_dwmmc_ids,
+	.ofdata_to_platdata = ca_dwmmc_ofdata_to_platdata,
+	.bind		= ca_dwmmc_bind,
+	.ops		= &ca_dwmci_dm_ops,
+	.probe		= ca_dwmmc_probe,
+	.priv_auto_alloc_size	= sizeof(struct ca_dwmmc_priv_data),
+	.platdata_auto_alloc_size = sizeof(struct ca_mmc_plat),
+};
#4 lore raw

PATCH 1/2 mtd: rawnand: ca_nand: add Cortina Access Parallel NAND controller support

In reply to Alex Nemirovsky

From: Jason Li <[email protected]>

Supports all CAxxxx SoCs which support a parallel nand controller. It should be noted that some CAxxxx Soc also support an separate SPI serial NAND controller.

This driver only supports the parallel NAND controller. A different driver supports the SPI NAND interface controller.

CC Miquel Raynal <[email protected]>
CC Simon Glass <[email protected]>

---

 MAINTAINERS                    |    4 +
 drivers/mtd/nand/raw/Kconfig   |   30 +
 drivers/mtd/nand/raw/Makefile  |    1 +
 drivers/mtd/nand/raw/ca_nand.c | 4914 ++++++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/raw/ca_nand.h | 3899 +++++++++++++++++++++++++++++++
 5 files changed, 8848 insertions(+)
 create mode 100644 drivers/mtd/nand/raw/ca_nand.c
 create mode 100644 drivers/mtd/nand/raw/ca_nand.h
MAINTAINERS +4 -0
index 82e4159..914f151 100644
@@ -180,6 +180,8 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mtd/nand/raw/ca_nand.c
+F:	drivers/mtd/nand/raw/ca_nand.h
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -670,6 +672,8 @@ F:	board/cortina/common/
 F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
+F:	drivers/mtd/nand/raw/ca_nand.c
+F:	drivers/mtd/nand/raw/ca_nand.h
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/mtd/nand/raw/Kconfig +30 -0
index 23201ca..493aff6 100644
@@ -102,6 +102,36 @@ config NAND_BRCMNAND_63158
        help
          Enable support for broadcom nand driver on bcm63158.
 
+config NAND_CORTINA
+        tristate "Support Cortina-Access Parallel NAND cntlr."
+	select SYS_NAND_SELF_INIT
+        help
+          This enables the driver for the Cortina-Access Soc
+
+config NAND_CORTINA_ECC_LEVEL
+        int "Cortina-Access Parallel Nand driver HW ECC algorithm"
+        default 3
+        range 0 5
+        depends on NAND_CORTINA
+        help
+          NAND Flash ECC algorithm. Value range from 0 to 5.
+          The default value is 3.
+
+          0: Hamming algorithm. Correct 3 bad bits in 256 btyes.
+          1: Hamming algorithm. Correct 3 bad bits in 512 btyes.
+          2: BCH algorithm. Correct 8 bad bits in 1K btyes.
+          3: BCH algorithm. Correct 16 bad bits in 1K btyes.
+          4: BCH algorithm. Correct 24 bad bits in 1K btyes.
+          5: BCH algorithm. Correct 40 bad bits in 1K btyes.
+
+config NAND_CORTINA_ECC_HW_BCH
+     bool
+     default y
+     depends on NAND_CORTINA_ECC_LEVEL=2 \
+             || NAND_CORTINA_ECC_LEVEL=3 \
+             || NAND_CORTINA_ECC_LEVEL=4 \
+             || NAND_CORTINA_ECC_LEVEL=5
+
 config NAND_DAVINCI
 	bool "Support TI Davinci NAND controller"
 	help
drivers/mtd/nand/raw/Makefile +1 -0
index 9337f64..572e9e6 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_NAND_ECC_BCH) += nand_bch.o
 obj-$(CONFIG_NAND_ATMEL) += atmel_nand.o
 obj-$(CONFIG_NAND_ARASAN) += arasan_nfc.o
 obj-$(CONFIG_NAND_BRCMNAND) += brcmnand/
+obj-$(CONFIG_NAND_CORTINA) += ca_nand.o
 obj-$(CONFIG_NAND_DAVINCI) += davinci_nand.o
 obj-$(CONFIG_NAND_DENALI) += denali.o
 obj-$(CONFIG_NAND_DENALI_DT) += denali_dt.o
drivers/mtd/nand/raw/ca_nand.c new file +4914 -0

2,941 lines not on this page · raw message

drivers/mtd/nand/raw/ca_nand.h new file +3899 -0

3,899 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH v4 2/8 board: presidio-asic: Add eMMC board support

In reply to Alex Nemirovsky

Add initial eMMC support for Cortina Access Presidio Engineering Board

---

Changes in v4:
- Change DT compatiblity name to match change in driver's name
- Remove unused io_ds and fifo_mode fields from DT

Changes in v3: None
Changes in v2: None

 arch/arm/dts/ca-presidio-engboard.dts        |  4 +---
 configs/cortina_presidio-asic-emmc_defconfig | 33 ++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 3 deletions(-)
 create mode 100644 configs/cortina_presidio-asic-emmc_defconfig
arch/arm/dts/ca-presidio-engboard.dts +1 -3
index c03dacc..40c93d7 100644
@@ -10,11 +10,9 @@
    #size-cells = <1>;
 
 	mmc0: mmc at f4400000 {
-		compatible = "snps,dw-cortina";
+		compatible = "cortina,ca-mmc";
 		reg = <0x0 0xf4400000 0x1000>;
 		bus-width = <4>;
-		io_ds = <0x77>;
-		fifo-mode;
 		sd_dll_ctrl = <0xf43200e8>;
 		io_drv_ctrl = <0xf432004c>;
 	};
configs/cortina_presidio-asic-emmc_defconfig new file +33 -0
new file mode 100644
index 0000000..e10008a
@@ -0,0 +1,33 @@
+CONFIG_ARM=y
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_TARGET_PRESIDIO_ASIC=y
+CONFIG_SYS_TEXT_BASE=0x04000000
+CONFIG_ENV_SIZE=0x20000
+CONFIG_DM_GPIO=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="Presidio-SoC"
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_WDT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_EXT2=y
+CONFIG_CMD_EXT4=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_CORTINA_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_CORTINA=y
+CONFIG_DM_SERIAL=y
+CONFIG_CORTINA_UART=y
+CONFIG_WDT=y
+CONFIG_WDT_CORTINA=y
Signature · 1 line
2.7.4
#6 lore raw

PATCH 2/2 board: presidio-asic: Add RAW Parallel NAND support

In reply to Alex Nemirovsky

Add Parallel NAND CAxxxx support to Cortina Access Presidio Engineering Board support

CC Miquel Raynal <[email protected]>
CC Simon Glass <[email protected]>

---

 configs/cortina_presidio-asic-bch16_defconfig | 35 ++++++++++++++++++++++++++
 configs/cortina_presidio-asic-bch24_defconfig | 36 +++++++++++++++++++++++++++
 configs/cortina_presidio-asic-bch40_defconfig | 36 +++++++++++++++++++++++++++
 configs/cortina_presidio-asic-bch8_defconfig  | 36 +++++++++++++++++++++++++++
 include/configs/presidio_asic.h               | 15 +++++++++++
 5 files changed, 158 insertions(+)
 create mode 100644 configs/cortina_presidio-asic-bch16_defconfig
 create mode 100644 configs/cortina_presidio-asic-bch24_defconfig
 create mode 100644 configs/cortina_presidio-asic-bch40_defconfig
 create mode 100644 configs/cortina_presidio-asic-bch8_defconfig
configs/cortina_presidio-asic-bch16_defconfig new file +35 -0
new file mode 100644
index 0000000..57ef98f
@@ -0,0 +1,35 @@
+CONFIG_ARM=y
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_TARGET_PRESIDIO_ASIC=y
+CONFIG_SYS_TEXT_BASE=0x04000000
+CONFIG_ENV_SIZE=0x20000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_DM_GPIO=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="Presidio-SoC"
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_NAND=y
+CONFIG_CMD_WDT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
+CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_CORTINA_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_CORTINA=y
+CONFIG_DM_SERIAL=y
+CONFIG_CORTINA_UART=y
+CONFIG_WDT=y
+CONFIG_WDT_CORTINA=y
configs/cortina_presidio-asic-bch24_defconfig new file +36 -0
new file mode 100644
index 0000000..d22eae7
@@ -0,0 +1,36 @@
+CONFIG_ARM=y
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_TARGET_PRESIDIO_ASIC=y
+CONFIG_SYS_TEXT_BASE=0x04000000
+CONFIG_ENV_SIZE=0x20000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_DM_GPIO=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="Presidio-SoC"
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_NAND=y
+CONFIG_CMD_WDT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
+CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_CORTINA_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_CORTINA=y
+CONFIG_NAND_CORTINA_ECC_LEVEL=4
+CONFIG_DM_SERIAL=y
+CONFIG_CORTINA_UART=y
+CONFIG_WDT=y
+CONFIG_WDT_CORTINA=y
configs/cortina_presidio-asic-bch40_defconfig new file +36 -0
new file mode 100644
index 0000000..3c39415
@@ -0,0 +1,36 @@
+CONFIG_ARM=y
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_TARGET_PRESIDIO_ASIC=y
+CONFIG_SYS_TEXT_BASE=0x04000000
+CONFIG_ENV_SIZE=0x20000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_DM_GPIO=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="Presidio-SoC"
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_NAND=y
+CONFIG_CMD_WDT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
+CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_CORTINA_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_CORTINA=y
+CONFIG_NAND_CORTINA_ECC_LEVEL=5
+CONFIG_DM_SERIAL=y
+CONFIG_CORTINA_UART=y
+CONFIG_WDT=y
+CONFIG_WDT_CORTINA=y
configs/cortina_presidio-asic-bch8_defconfig new file +36 -0
new file mode 100644
index 0000000..8cda753
@@ -0,0 +1,36 @@
+CONFIG_ARM=y
+# CONFIG_SYS_ARCH_TIMER is not set
+CONFIG_TARGET_PRESIDIO_ASIC=y
+CONFIG_SYS_TEXT_BASE=0x04000000
+CONFIG_ENV_SIZE=0x20000
+CONFIG_ENV_OFFSET=0x400000
+CONFIG_DM_GPIO=y
+CONFIG_NR_DRAM_BANKS=1
+CONFIG_IDENT_STRING="Presidio-SoC"
+CONFIG_SHOW_BOOT_PROGRESS=y
+CONFIG_BOOTDELAY=3
+CONFIG_BOARD_EARLY_INIT_R=y
+CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_NAND=y
+CONFIG_CMD_WDT=y
+CONFIG_CMD_CACHE=y
+CONFIG_CMD_TIMER=y
+CONFIG_CMD_SMC=y
+CONFIG_CMD_MTDPARTS=y
+CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
+CONFIG_ENV_IS_IN_NAND=y
+# CONFIG_NET is not set
+CONFIG_DM=y
+CONFIG_CORTINA_GPIO=y
+# CONFIG_MMC is not set
+CONFIG_MTD=y
+CONFIG_MTD_RAW_NAND=y
+CONFIG_NAND_CORTINA=y
+CONFIG_NAND_CORTINA_ECC_LEVEL=2
+CONFIG_DM_SERIAL=y
+CONFIG_CORTINA_UART=y
+CONFIG_WDT=y
+CONFIG_WDT_CORTINA=y
include/configs/presidio_asic.h +15 -0
index 023092e..096aa07 100644
@@ -36,6 +36,8 @@
 
 #define CONFIG_SYS_TIMER_BASE		0xf4321000
 
+#define GLOBAL_SOFTWARE2		0xf43200c4
+
 /* Use external clock source */
 #define PRESIDIO_APB_CLK		125000000
 #define CORTINA_PER_IO_FREQ		PRESIDIO_APB_CLK
@@ -72,4 +74,17 @@
 #define CONFIG_SYS_MAXARGS		64
 #define CONFIG_EXTRA_ENV_SETTINGS	"silent=y\0"
 
+/* Macros for Flash */
+#define CORTINA_FLASH_CTRL_BASE	  	0xf4324000
+#define CORTINA_DMA_GLB_BASE		0xf7001000
+#define CORTINA_DMA_SSP_BASE		0xf7001a00
+#define CONFIG_SYS_FLASH_BASE		0xe0000000
+
+#ifdef CONFIG_NAND_CORTINA
+	#define CONFIG_SYS_MAX_NAND_DEVICE	1
+	#define CONFIG_SYS_NAND_MAX_CHIPS	1
+	#define CONFIG_SYS_NAND_BASE		CONFIG_SYS_FLASH_BASE
+	#define CONFIG_SYS_NAND_BASE_LIST	{ CONFIG_SYS_NAND_BASE }
+#endif
+
 #endif /* __PRESIDIO_ASIC_H */
Signature · 1 line
2.7.4
#7 lore raw

PATCH v4 3/8 i2c: i2c-cortina: added CAxxxx I2C support

In reply to Alex Nemirovsky

From: Arthur Li <[email protected]>

Add I2C controller support for Cortina Access CAxxxx SoCs

---

Changes in v4:
- Utilize standard I2C macros from <i2c.h>
- Return ETIMEDOUT in funcs that can timeout
- Return i2c_xfer_init() result to caller of i2c_read() if it fails within i2c_read() execution
- Fix misc. style guide conformance issues
- Use printf() to report i2c_xfer() runtime errors instead of debug()

Changes in v3: None
Changes in v2: None

 MAINTAINERS               |   4 +
 drivers/i2c/Kconfig       |   7 +
 drivers/i2c/Makefile      |   1 +
 drivers/i2c/i2c-cortina.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++
 drivers/i2c/i2c-cortina.h |  84 +++++++++++
 5 files changed, 442 insertions(+)
 create mode 100644 drivers/i2c/i2c-cortina.c
 create mode 100644 drivers/i2c/i2c-cortina.h
MAINTAINERS +4 -0
index bb45d3c..b147faa 100644
@@ -181,6 +181,8 @@ F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
+F:	drivers/i2c/i2c-cortina.c
+F:	drivers/i2c/i2c-cortina.h
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -672,6 +674,8 @@ F:	drivers/gpio/cortina_gpio.c
 F:	drivers/watchdog/cortina_wdt.c
 F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
+F:	drivers/i2c/i2c-cortina.c
+F:	drivers/i2c/i2c-cortina.h
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/i2c/Kconfig +7 -0
index 03d2fed..b98a4aa 100644
@@ -85,6 +85,13 @@ config SYS_I2C_CADENCE
 	  Say yes here to select Cadence I2C Host Controller. This controller is
 	  e.g. used by Xilinx Zynq.
 
+config SYS_I2C_CA
+	tristate "Cortina-Access I2C Controller"
+	depends on DM_I2C && CORTINA_PLATFORM
+	default n
+	help
+	  Say yes here to select Cortina-Access I2C Host Controller.
+
 config SYS_I2C_DAVINCI
 	bool "Davinci I2C Controller"
 	depends on (ARCH_KEYSTONE || ARCH_DAVINCI)
drivers/i2c/Makefile +1 -0
index f5a471f..5d18cf7 100644
@@ -12,6 +12,7 @@ obj-$(CONFIG_SYS_I2C) += i2c_core.o
 obj-$(CONFIG_SYS_I2C_ASPEED) += ast_i2c.o
 obj-$(CONFIG_SYS_I2C_AT91) += at91_i2c.o
 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
drivers/i2c/i2c-cortina.c new file +346 -0

346 lines not on this page · raw message

drivers/i2c/i2c-cortina.h new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH v4 3/8 i2c: i2c-cortina: added CAxxxx I2C support

Hello Alex,

Am 31.03.2020 um 01:51 schrieb Alex Nemirovsky:

Quoted 22 lines

From: Arthur Li <[email protected]>

Add I2C controller support for Cortina Access CAxxxx SoCs

---

Changes in v4:
- Utilize standard I2C macros from <i2c.h>
- Return ETIMEDOUT in funcs that can timeout
- Return i2c_xfer_init() result to caller of i2c_read() if it fails within i2c_read() execution
- Fix misc. style guide conformance issues
- Use printf() to report i2c_xfer() runtime errors instead of debug()

Changes in v3: None
Changes in v2: None

Quoted 8 lines
  MAINTAINERS               |   4 +
  drivers/i2c/Kconfig       |   7 +
  drivers/i2c/Makefile      |   1 +
  drivers/i2c/i2c-cortina.c | 346 ++++++++++++++++++++++++++++++++++++++++++++++
  drivers/i2c/i2c-cortina.h |  84 +++++++++++
  5 files changed, 442 insertions(+)

create mode 100644 drivers/i2c/i2c-cortina.c
create mode 100644 drivers/i2c/i2c-cortina.h

As this in a patchseries already assigned to Tom, I do not pick up this patch.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#9 lore raw

PATCH v4 4/8 board: presidio-asic: Add I2C support

In reply to Alex Nemirovsky

Add I2C board support for Cortina Access Presidio Engineering Board

---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 configs/cortina_presidio-asic-emmc_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/cortina_presidio-asic-emmc_defconfig +3 -0
index e10008a..e45e23c 100644
@@ -10,6 +10,7 @@ CONFIG_SHOW_BOOT_PROGRESS=y
 CONFIG_BOOTDELAY=3
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="G3#"
+CONFIG_CMD_I2C=y
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_WDT=y
@@ -24,6 +25,8 @@ CONFIG_DEFAULT_DEVICE_TREE="ca-presidio-engboard"
 # CONFIG_NET is not set
 CONFIG_DM=y
 CONFIG_CORTINA_GPIO=y
+CONFIG_DM_I2C=y
+CONFIG_SYS_I2C_CA=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_CORTINA=y
Signature · 1 line
2.7.4
#10 lore raw

PATCH v4 4/8 board: presidio-asic: Add I2C support

Hello Alex,

Am 31.03.2020 um 01:51 schrieb Alex Nemirovsky:

Quoted 4 lines

Add I2C board support for Cortina Access Presidio Engineering Board

Quoted 8 lines

---

Changes in v4: None
Changes in v3: None
Changes in v2: None

  configs/cortina_presidio-asic-emmc_defconfig | 3 +++
  1 file changed, 3 insertions(+)

As this in a patchseries already assigned to Tom, I do not pick up this patch.

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de
#11 lore raw

PATCH v4 5/8 led: led_cortina: Add CAxxx LED support

In reply to Alex Nemirovsky

From: Jway Lin <[email protected]>

Add Cortina Access LED controller support for CAxxxx SOCs

---

Changes in v4:
- remove unused macros
- remove cortina prefix from macros
- remove use BSS variable
- further cleanup to meet code style guidelines
- add additinal struct comments
- rename DT blink rate symbol

Changes in v3: None
Changes in v2: None

 MAINTAINERS               |   2 +
 drivers/led/Kconfig       |   8 ++
 drivers/led/Makefile      |   1 +
 drivers/led/led_cortina.c | 268 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 279 insertions(+)
 create mode 100644 drivers/led/led_cortina.c
MAINTAINERS +2 -0
index b147faa..24a2655 100644
@@ -183,6 +183,7 @@ F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
+F:	drivers/led/led_cortina.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -676,6 +677,7 @@ F:	drivers/serial/serial_cortina.c
 F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
+F:	drivers/led/led_cortina.c
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/led/Kconfig +8 -0
index 6675934..cc87fbf 100644
@@ -35,6 +35,14 @@ config LED_BCM6858
 	  This option enables support for LEDs connected to the BCM6858
 	  HW has blinking capabilities and up to 32 LEDs can be controlled.
 
+config LED_CORTINA
+	bool "LED Support for Cortina Access CAxxxx SoCs"
+	depends on LED && (CORTINA_PLATFORM)
+	help
+	  This option enables support for LEDs connected to the Cortina
+	  Access CAxxxx SOCs.
+
+
 config LED_BLINK
 	bool "Support LED blinking"
 	depends on LED
drivers/led/Makefile +1 -0
index 3654dd3..8e3ae7f 100644
@@ -8,3 +8,4 @@ obj-$(CONFIG_LED_BCM6328) += led_bcm6328.o
 obj-$(CONFIG_LED_BCM6358) += led_bcm6358.o
 obj-$(CONFIG_LED_BCM6858) += led_bcm6858.o
 obj-$(CONFIG_$(SPL_)LED_GPIO) += led_gpio.o
+obj-$(CONFIG_LED_CORTINA) += led_cortina.o
drivers/led/led_cortina.c new file +268 -0

268 lines not on this page · raw message

Signature · 1 line
2.7.4
#12 lore raw

PATCH v4 6/8 board: presidio: add LED support

In reply to Alex Nemirovsky

From: Jway Lin <[email protected]>

Add LED support for Cortina Access Presidio Engineering Board

CC Simon Glass <[email protected]>

---

Changes in v4:
- rename DT blink rate symbol

Changes in v3: None
Changes in v2: None

 arch/arm/dts/ca-presidio-engboard.dts        | 31 ++++++++++++++++++++++++++++
 configs/cortina_presidio-asic-emmc_defconfig |  2 ++
 2 files changed, 33 insertions(+)
arch/arm/dts/ca-presidio-engboard.dts +31 -0
index 40c93d7..eef433e 100644
@@ -64,4 +64,35 @@
 			spi-max-frequency = <108000000>;
 		};
 	};
+
+	leds: led-controller at f43200f0 {
+		compatible = "cortina,ca-leds";
+		reg = <0x0 0xf43200f0 0x40>;
+
+		cortina,blink-rate1 = <256>;
+		cortina,blink-rate2 = <512>;
+
+		led at 0 {
+			pin = <0>;
+			active-low;
+			blink-sel =<0>;
+			port = <0>;
+			off-event = <0>;
+			label = "led0";
+		};
+
+		led at 1 {
+			pin = <1>;
+			active-low;
+			blink-sel =<1>;
+			label = "led1";
+		};
+
+		led at 2 {
+			pin = <2>;
+			active-low;
+			label = "led2";
+		};
+
+	};
 };
configs/cortina_presidio-asic-emmc_defconfig +2 -0
index e45e23c..3c6bd6b 100644
@@ -27,6 +27,8 @@ CONFIG_DM=y
 CONFIG_CORTINA_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_CA=y
+CONFIG_LED=y
+CONFIG_LED_CORTINA=y
 CONFIG_DM_MMC=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_CORTINA=y
Signature · 1 line
2.7.4
#13 lore raw

PATCH v4 7/8 spi: ca_sflash: Add CAxxxx SPI Flash Controller

In reply to Alex Nemirovsky

From: Pengpeng Chen <[email protected]>

Add SPI Flash controller driver for Cortina Access CAxxxx SoCs

---

Changes in v4: None
Changes in v3:
- Fixup syntax issues related to checkpatch.pl cleanup

Changes in v2: None

 MAINTAINERS             |   2 +
 drivers/spi/Kconfig     |   8 +
 drivers/spi/Makefile    |   1 +
 drivers/spi/ca_sflash.c | 576 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 587 insertions(+)
 create mode 100644 drivers/spi/ca_sflash.c
MAINTAINERS +2 -0
index 24a2655..8509779 100644
@@ -184,6 +184,7 @@ F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
 F:	drivers/led/led_cortina.c
+F:	drivers/spi/ca_sflash.c
 
 ARM/CZ.NIC TURRIS MOX SUPPORT
 M:	Marek Behun <[email protected]>
@@ -678,6 +679,7 @@ F:	drivers/mmc/ca_dw_mmc.c
 F:	drivers/i2c/i2c-cortina.c
 F:	drivers/i2c/i2c-cortina.h
 F:	drivers/led/led_cortina.c
+F:	drivers/spi/ca_sflash.c
 
 MIPS MSCC
 M:	Gregory CLEMENT <[email protected]>
drivers/spi/Kconfig +8 -0
index 4166c61..8a244f1 100644
@@ -106,6 +106,14 @@ config BCMSTB_SPI
 	  be used to access the SPI flash on platforms embedding this
 	  Broadcom SPI core.
 
+config CORTINA_SFLASH
+	bool "Cortina-Access Serial Flash controller driver"
+	depends on DM_SPI && SPI_MEM
+	help
+	  Enable the Cortina-Access Serial Flash controller driver. This driver
+	  can be used to access the SPI NOR/NAND flash on platforms embedding this
+	  Cortina-Access IP core.
+
 config CADENCE_QSPI
 	bool "Cadence QSPI driver"
 	help
drivers/spi/Makefile +1 -0
index 52462e1..32b98b4 100644
@@ -25,6 +25,7 @@ obj-$(CONFIG_BCM63XX_SPI) += bcm63xx_spi.o
 obj-$(CONFIG_BCMSTB_SPI) += bcmstb_spi.o
 obj-$(CONFIG_CADENCE_QSPI) += cadence_qspi.o cadence_qspi_apb.o
 obj-$(CONFIG_CF_SPI) += cf_spi.o
+obj-$(CONFIG_CORTINA_SFLASH) += ca_sflash.o
 obj-$(CONFIG_DAVINCI_SPI) += davinci_spi.o
 obj-$(CONFIG_DESIGNWARE_SPI) += designware_spi.o
 obj-$(CONFIG_EXYNOS_SPI) += exynos_spi.o
drivers/spi/ca_sflash.c new file +576 -0

576 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

PATCH v4 8/8 board: presidio-asic: Add SPI NAND and NOR support

In reply to Alex Nemirovsky

Add SPI NAND and NOR support for Cortina Access
Presidio Engineering Board

---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/dts/ca-presidio-engboard.dts            |  8 ++--
 board/cortina/presidio-asic/presidio.c           | 16 ++++++-
 configs/cortina_presidio-asic-spi-nand_defconfig | 48 +++++++++++++++++++
 configs/cortina_presidio-asic-spi-nor_defconfig  | 59 ++++++++++++++++++++++++
 4 files changed, 125 insertions(+), 6 deletions(-)
 create mode 100644 configs/cortina_presidio-asic-spi-nand_defconfig
 create mode 100644 configs/cortina_presidio-asic-spi-nor_defconfig
arch/arm/dts/ca-presidio-engboard.dts +3 -5
index eef433e..50e1b29 100644
@@ -53,15 +53,13 @@
 	};
 
 	sflash: sflash-controller at f4324000 {
-		#address-cells = <2>;
-		#size-cells = <1>;
 		compatible = "cortina,ca-sflash";
 		reg = <0x0 0xf4324000 0x50>;
 		reg-names = "sflash-regs";
 		flash at 0 {
-			compatible = "jedec,spi-nor";
-			spi-rx-bus-width = <1>;
-			spi-max-frequency = <108000000>;
+			compatible = "spi-nand", "jedec,spi-nor";
+			spi-rx-bus-width = <4>;
+			spi-tx-bus-width = <4>;
 		};
 	};
 
board/cortina/presidio-asic/presidio.c +15 -1
index b4fa01f..d547b60 100644
@@ -14,7 +14,7 @@
 #include <asm/psci.h>
 #include <cpu_func.h>
 #include <asm/armv8/mmu.h>
-
+#include <dm/uclass.h>
 DECLARE_GLOBAL_DATA_PTR;
 
 #define CA_PERIPH_BASE                  0xE0000000UL
@@ -70,9 +70,23 @@ static noinline int invoke_psci_fn_smc(u64 function_id, u64 arg0, u64 arg1,
 	return function_id;
 }
 
+#ifdef CONFIG_CORTINA_SFLASH
+static int init_sflash(void)
+{
+	struct udevice *dev;
+
+	uclass_first_device(UCLASS_SPI, &dev);
+
+	return 0;
+}
+#endif
+
 int board_early_init_r(void)
 {
 	dcache_disable();
+#ifdef CONFIG_CORTINA_SFLASH
+	init_sflash();
+#endif
 	return 0;
 }
 
configs/cortina_presidio-asic-spi-nand_defconfig new file +48 -0

48 lines not on this page · raw message

configs/cortina_presidio-asic-spi-nor_defconfig new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.7.4
#15 lore raw

PATCH v4 8/8 board: presidio-asic: Add SPI NAND and NOR support

Quoted 28 lines · Alex Nemirovsky

Add SPI NAND and NOR support for Cortina Access
Presidio Engineering Board

---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm/dts/ca-presidio-engboard.dts            |  8 ++--
 board/cortina/presidio-asic/presidio.c           | 16 ++++++-
 configs/cortina_presidio-asic-spi-nand_defconfig | 48 +++++++++++++++++++
 configs/cortina_presidio-asic-spi-nor_defconfig  | 59 ++++++++++++++++++++++++
 4 files changed, 125 insertions(+), 6 deletions(-)
 create mode 100644 configs/cortina_presidio-asic-spi-nand_defconfig
 create mode 100644 configs/cortina_presidio-asic-spi-nor_defconfig
arch/arm/dts/ca-presidio-engboard.dts +0 -0
index eef433e..50e1b29 100644
@@ -53,15 +53,13 @@
 	};
 
 	sflash: sflash-controller at f4324000 {

arch/arm/dts/ca-presidio-engboard.dts line 60

Quoted 10 lines
arch/arm/dts/ca-presidio-engboard.dts +1 -5
-		#address-cells = <2>;
-		#size-cells = <1>;
 		compatible = "cortina,ca-sflash";
 		reg = <0x0 0xf4324000 0x50>;
 		reg-names = "sflash-regs";
 		flash at 0 {
-			compatible = "jedec,spi-nor";
-			spi-rx-bus-width = <1>;
-			spi-max-frequency = <108000000>;
+			compatible = "spi-nand", "jedec,spi-nor";

This does not make sense. Flash cannot be NAND and NOR at the same time? compatible should be set to either one of them but not both

Quoted 4 lines
arch/arm/dts/ca-presidio-engboard.dts +2 -0
+			spi-rx-bus-width = <4>;
+			spi-tx-bus-width = <4>;
 		};
 	};