Skip to contentSkip to conversation

keystone2: generalize navigator driver usage

PATCH Superseded Ivan Khoronzhuk 2 participants 11 messages Sep 5, 2014 – Oct 23, 2014

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover keystone2: generalize navigator driver usage

This series generalize keystone_nav driver usage in order to add keystone2 K2E/K2L SoCs support.

Based on u-boot-ti/master

v2..v1:
rebased on top of u-boot-ti/master, no functional changes

Ivan Khoronzhuk (4):
keystone2: keystone_nav: don't use hard addresses in qm_config
keystone2: keystone_nav: don't use hard addresses in netcp_pktdma
dma: keystone_nav: move keystone_nav driver to driver/dma/
dma: keystone_nav: generalize driver usage

 arch/arm/cpu/armv7/keystone/Makefile               |   1 -
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  13 ++
 arch/arm/include/asm/arch-keystone/hardware.h      |  13 +-
 .../{arch-keystone => ti-common}/keystone_nav.h    |  16 +-
 drivers/dma/Makefile                               |   1 +
 .../armv7/keystone => drivers/dma}/keystone_nav.c  | 196 ++++++++-------------
 drivers/dma/keystone_nav_cfg.c                     |  27 +++
 drivers/net/keystone_net.c                         |  15 +-
 include/configs/k2hk_evm.h                         |   2 +
 include/configs/ks2_evm.h                          |  29 +++
 10 files changed, 174 insertions(+), 139 deletions(-)
 rename arch/arm/include/asm/{arch-keystone => ti-common}/keystone_nav.h (91%)
 rename {arch/arm/cpu/armv7/keystone => drivers/dma}/keystone_nav.c (53%)
 create mode 100644 drivers/dma/keystone_nav_cfg.c
Signature · 1 line
1.8.3.2
#1 lore raw

PATCH v2 1/4 keystone2: keystone_nav: don't use hard addresses in qm_config

Use definitions in qm_config. The definitions can be set specifically for SoC, so there is no reason to check SoC type while initialization.

---
 arch/arm/cpu/armv7/keystone/keystone_nav.c    | 49 +++++++++++----------------
 arch/arm/include/asm/arch-keystone/hardware.h | 13 +++++--
 2 files changed, 30 insertions(+), 32 deletions(-)
arch/arm/cpu/armv7/keystone/keystone_nav.c +19 -30
index 39d6f99..5219f84 100644
@@ -15,21 +15,21 @@ static int soc_type =
 	k2hk;
 #endif
 
-struct qm_config k2hk_qm_memmap = {
-	.stat_cfg	= 0x02a40000,
-	.queue		= (struct qm_reg_queue *)0x02a80000,
-	.mngr_vbusm	= 0x23a80000,
-	.i_lram		= 0x00100000,
-	.proxy		= (struct qm_reg_queue *)0x02ac0000,
-	.status_ram	= 0x02a06000,
-	.mngr_cfg	= (struct qm_cfg_reg *)0x02a02000,
-	.intd_cfg	= 0x02a0c000,
-	.desc_mem	= (struct descr_mem_setup_reg *)0x02a03000,
-	.region_num	= 64,
-	.pdsp_cmd	= 0x02a20000,
-	.pdsp_ctl	= 0x02a0f000,
-	.pdsp_iram	= 0x02a10000,
-	.qpool_num	= 4000,
+struct qm_config qm_memmap = {
+	.stat_cfg	= KS2_QM_QUEUE_STATUS_BASE,
+	.queue		= (void *)KS2_QM_MANAGER_QUEUES_BASE,
+	.mngr_vbusm	= KS2_QM_BASE_ADDRESS,
+	.i_lram		= KS2_QM_LINK_RAM_BASE,
+	.proxy		= (void *)KS2_QM_MANAGER_Q_PROXY_BASE,
+	.status_ram	= KS2_QM_STATUS_RAM_BASE,
+	.mngr_cfg	= (void *)KS2_QM_CONF_BASE,
+	.intd_cfg	= KS2_QM_INTD_CONF_BASE,
+	.desc_mem	= (void *)KS2_QM_DESC_SETUP_BASE,
+	.region_num	= KS2_QM_REGION_NUM,
+	.pdsp_cmd	= KS2_QM_PDSP1_CMD_BASE,
+	.pdsp_ctl	= KS2_QM_PDSP1_CTRL_BASE,
+	.pdsp_iram	= KS2_QM_PDSP1_IRAM_BASE,
+	.qpool_num	= KS2_QM_QPOOL_NUM,
 };
 
 /*
@@ -52,12 +52,9 @@ inline int num_of_desc_to_reg(int num_descr)
 	return 15;
 }
 
-static int _qm_init(struct qm_config *cfg)
+int _qm_init(struct qm_config *cfg)
 {
-	u32	j;
-
-	if (cfg == NULL)
-		return QM_ERR;
+	u32 j;
 
 	qm_cfg = cfg;
 
@@ -82,12 +79,7 @@ static int _qm_init(struct qm_config *cfg)
 
 int qm_init(void)
 {
-	switch (soc_type) {
-	case k2hk:
-		return _qm_init(&k2hk_qm_memmap);
-	}
-
-	return QM_ERR;
+	return _qm_init(&qm_memmap);
 }
 
 void qm_close(void)
@@ -294,11 +286,8 @@ static int _netcp_init(struct pktdma_cfg *netcp_cfg,
 	/* Disable loopback in the tx direction */
 	writel(0, &netcp->global->emulation_control);
 
-/* TODO: make it dependend on a soc type variable */
-#ifdef CONFIG_SOC_K2HK
 	/* Set QM base address, only for K2x devices */
-	writel(0x23a80000, &netcp->global->qm_base_addr[0]);
-#endif
+	writel(KS2_QM_BASE_ADDRESS, &netcp->global->qm_base_addr[0]);
 
 	/* Enable all channels. The current state isn't important */
 	for (j = 0; j < netcp->tx_ch_num; j++)  {
arch/arm/include/asm/arch-keystone/hardware.h +11 -2
index d6726a1..c3f0f46 100644
@@ -143,11 +143,20 @@ typedef volatile unsigned int   *dv_reg_p;
 #define KS2_EFUSE_BOOTROM		(KS2_DEVICE_STATE_CTRL_BASE + 0xc90)
 
 /* Queue manager */
-#define KS2_QM_MANAGER_BASE		0x02a02000
+#define KS2_QM_BASE_ADDRESS		0x23a80000
+#define KS2_QM_CONF_BASE		0x02a02000
 #define KS2_QM_DESC_SETUP_BASE		0x02a03000
-#define KS2_QM_MANAGER_QUEUES_BASEi	0x02a80000
+#define KS2_QM_STATUS_RAM_BASE		0x02a06000
+#define KS2_QM_INTD_CONF_BASE		0x02a0c000
+#define KS2_QM_PDSP1_CMD_BASE		0x02a20000
+#define KS2_QM_PDSP1_CTRL_BASE		0x02a0f000
+#define KS2_QM_PDSP1_IRAM_BASE		0x02a10000
+#define KS2_QM_MANAGER_QUEUES_BASE	0x02a80000
 #define KS2_QM_MANAGER_Q_PROXY_BASE	0x02ac0000
 #define KS2_QM_QUEUE_STATUS_BASE	0x02a40000
+#define KS2_QM_LINK_RAM_BASE		0x00100000
+#define KS2_QM_REGION_NUM		64
+#define KS2_QM_QPOOL_NUM		4000
 
 /* MSMC control */
 #define KS2_MSMC_CTRL_BASE		0x0bc00000
Signature · 1 line
1.8.3.2
#2 lore raw

PATCH v2 1/4 keystone2: keystone_nav: don't use hard addresses in qm_config

Quoted 5 lines · Ivan

Use definitions in qm_config. The definitions can be set specifically for SoC, so there is no reason to check SoC type while initialization.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/67cfcacf/attachment.pgp>
#3 lore raw

PATCH v2 2/4 keystone2: keystone_nav: don't use hard addresses in netcp_pktdma

In reply to Ivan Khoronzhuk

Use definitions in netcp_pktdma instead direct addresses. The definitions can be set specifically for SoC, so there is no reason to check SoC type while initialization.

---
 arch/arm/cpu/armv7/keystone/keystone_nav.c         | 39 ++++++++--------------
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h | 13 ++++++++
 arch/arm/include/asm/arch-keystone/keystone_nav.h  |  4 ---
 3 files changed, 27 insertions(+), 29 deletions(-)
arch/arm/cpu/armv7/keystone/keystone_nav.c +14 -25
index 5219f84..46483b1 100644
@@ -10,11 +10,6 @@
 #include <asm/io.h>
 #include <asm/arch/keystone_nav.h>
 
-static int soc_type =
-#ifdef CONFIG_SOC_K2HK
-	k2hk;
-#endif
-
 struct qm_config qm_memmap = {
 	.stat_cfg	= KS2_QM_QUEUE_STATUS_BASE,
 	.queue		= (void *)KS2_QM_MANAGER_QUEUES_BASE,
@@ -158,22 +153,21 @@ void queue_close(u32 qnum)
 		;
 }
 
-/*
+/**
  * DMA API
  */
-
-struct pktdma_cfg k2hk_netcp_pktdma = {
-	.global		= (struct global_ctl_regs *)0x02004000,
-	.tx_ch		= (struct tx_chan_regs *)0x02004400,
-	.tx_ch_num	= 9,
-	.rx_ch		= (struct rx_chan_regs *)0x02004800,
-	.rx_ch_num	= 26,
-	.tx_sched	= (u32 *)0x02004c00,
-	.rx_flows	= (struct rx_flow_regs *)0x02005000,
-	.rx_flow_num	= 32,
-	.rx_free_q	= 4001,
-	.rx_rcv_q	= 4002,
-	.tx_snd_q	= 648,
+struct pktdma_cfg netcp_pktdma = {
+	.global		= (void *)KS2_NETCP_PDMA_CTRL_BASE,
+	.tx_ch		= (void *)KS2_NETCP_PDMA_TX_BASE,
+	.tx_ch_num	= KS2_NETCP_PDMA_TX_CH_NUM,
+	.rx_ch		= (void *)KS2_NETCP_PDMA_RX_BASE,
+	.rx_ch_num	= KS2_NETCP_PDMA_RX_CH_NUM,
+	.tx_sched	= (u32 *)KS2_NETCP_PDMA_SCHED_BASE,
+	.rx_flows	= (void *)KS2_NETCP_PDMA_RX_FLOW_BASE,
+	.rx_flow_num	= KS2_NETCP_PDMA_RX_FLOW_NUM,
+	.rx_free_q	= KS2_NETCP_PDMA_RX_FREE_QUEUE,
+	.rx_rcv_q	= KS2_NETCP_PDMA_RX_RCV_QUEUE,
+	.tx_snd_q	= KS2_NETCP_PDMA_TX_SND_QUEUE,
 };
 
 struct pktdma_cfg *netcp;
@@ -300,12 +294,7 @@ static int _netcp_init(struct pktdma_cfg *netcp_cfg,
 
 int netcp_init(struct rx_buff_desc *rx_buffers)
 {
-	switch (soc_type) {
-	case k2hk:
-		_netcp_init(&k2hk_netcp_pktdma, rx_buffers);
-		return QM_OK;
-	}
-	return QM_ERR;
+	return _netcp_init(&netcp_pktdma, rx_buffers);
 }
 
 int netcp_close(void)
arch/arm/include/asm/arch-keystone/hardware-k2hk.h +13 -0
index eb132f7..43c2c42 100644
@@ -84,4 +84,17 @@
 /* Number of DSP cores */
 #define KS2_NUM_DSPS			8
 
+/* NETCP pktdma */
+#define KS2_NETCP_PDMA_CTRL_BASE	0x02004000
+#define KS2_NETCP_PDMA_TX_BASE		0x02004400
+#define KS2_NETCP_PDMA_TX_CH_NUM	9
+#define KS2_NETCP_PDMA_RX_BASE		0x02004800
+#define KS2_NETCP_PDMA_RX_CH_NUM	26
+#define KS2_NETCP_PDMA_SCHED_BASE	0x02004c00
+#define KS2_NETCP_PDMA_RX_FLOW_BASE	0x02005000
+#define KS2_NETCP_PDMA_RX_FLOW_NUM	32
+#define KS2_NETCP_PDMA_RX_FREE_QUEUE	4001
+#define KS2_NETCP_PDMA_RX_RCV_QUEUE	4002
+#define KS2_NETCP_PDMA_TX_SND_QUEUE	648
+
 #endif /* __ASM_ARCH_HARDWARE_H */
arch/arm/include/asm/arch-keystone/keystone_nav.h +0 -4
index ab81eaf..646c2f3 100644
@@ -13,10 +13,6 @@
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 
-enum soc_type_t {
-	k2hk
-};
-
 #define QM_OK                    0
 #define QM_ERR                  -1
 #define QM_DESC_TYPE_HOST        0
Signature · 1 line
1.8.3.2
#4 lore raw

PATCH v2 2/4 keystone2: keystone_nav: don't use hard addresses in netcp_pktdma

Quoted 6 lines · Ivan

Use definitions in netcp_pktdma instead direct addresses. The definitions can be set specifically for SoC, so there is no reason to check SoC type while initialization.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/99b74b4c/attachment.pgp>
#5 lore raw

PATCH v2 3/4 dma: keystone_nav: move keystone_nav driver to driver/dma/

In reply to Ivan Khoronzhuk

The keystone_nav is used by drivers/net/keystone_net.c driver to send and receive packets, but currently it's placed at keystone arch sources. So it should be in the drivers directory also. It's separate driver that can be used for sending and receiving pktdma packets by others drivers also.

This patch just move this driver to appropriate directory and doesn't add any functional changes.

---
 arch/arm/cpu/armv7/keystone/Makefile               |  1 -
 .../{arch-keystone => ti-common}/keystone_nav.h    |  0
 drivers/dma/Makefile                               |  1 +
 .../armv7/keystone => drivers/dma}/keystone_nav.c  | 54 +++++++++++-----------
 drivers/net/keystone_net.c                         |  2 +-
 include/configs/k2hk_evm.h                         |  1 +
 include/configs/ks2_evm.h                          | 29 ++++++++++++
 7 files changed, 59 insertions(+), 29 deletions(-)
 rename arch/arm/include/asm/{arch-keystone => ti-common}/keystone_nav.h (100%)
 rename {arch/arm/cpu/armv7/keystone => drivers/dma}/keystone_nav.c (83%)
arch/arm/cpu/armv7/keystone/Makefile +0 -1
index f8519c0..3d8fb70 100644
@@ -12,7 +12,6 @@ obj-$(CONFIG_SOC_K2HK) += clock-k2hk.o
 obj-$(CONFIG_SOC_K2E) += clock-k2e.o
 obj-y	+= cmd_clock.o
 obj-y	+= cmd_mon.o
-obj-$(CONFIG_DRIVER_TI_KEYSTONE_NET) += keystone_nav.o
 obj-y	+= msmc.o
 obj-$(CONFIG_SPL_BUILD)	+= spl.o
 obj-y	+= ddr3.o
arch/arm/include/asm/ti-common/keystone_nav.h renamed from arch/arm/include/asm/arch-keystone/keystone_nav.h +0 -0
similarity index 100%
rename from arch/arm/include/asm/arch-keystone/keystone_nav.h
rename to arch/arm/include/asm/ti-common/keystone_nav.h
drivers/dma/Makefile +1 -0
index a79c391..519dd0d 100644
@@ -8,3 +8,4 @@
 obj-$(CONFIG_FSLDMAFEC) += MCD_tasksInit.o MCD_dmaApi.o MCD_tasks.o
 obj-$(CONFIG_APBH_DMA) += apbh_dma.o
 obj-$(CONFIG_FSL_DMA) += fsl_dma.o
+obj-$(CONFIG_TI_KSNAV) += keystone_nav.o
drivers/dma/keystone_nav.c renamed from arch/arm/cpu/armv7/keystone/keystone_nav.c +27 -27

74 lines not on this page · raw message

drivers/net/keystone_net.c +1 -1
index d22b722..1cfe654 100644
@@ -14,7 +14,7 @@
 #include <malloc.h>
 #include <asm/arch/emac_defs.h>
 #include <asm/arch/psc_defs.h>
-#include <asm/arch/keystone_nav.h>
+#include <asm/ti-common/keystone_nav.h>
 
 unsigned int emac_dbg;
 
include/configs/k2hk_evm.h +1 -0
index 8aa616d..c313907 100644
@@ -36,5 +36,6 @@
 
 /* Network */
 #define CONFIG_DRIVER_TI_KEYSTONE_NET
+#define CONFIG_TI_KSNAV
 
 #endif /* __CONFIG_K2HK_EVM_H */
include/configs/ks2_evm.h +29 -0
index 43db581..ef513d4 100644
@@ -106,6 +106,35 @@
 #define CONFIG_SYS_SGMII_LINERATE_MHZ	1250
 #define CONFIG_SYS_SGMII_RATESCALE	2
 
+/* Keyston Navigator Configuration */
+#define CONFIG_KSNAV_QM_BASE_ADDRESS		KS2_QM_BASE_ADDRESS
+#define CONFIG_KSNAV_QM_CONF_BASE		KS2_QM_CONF_BASE
+#define CONFIG_KSNAV_QM_DESC_SETUP_BASE		KS2_QM_DESC_SETUP_BASE
+#define CONFIG_KSNAV_QM_STATUS_RAM_BASE		KS2_QM_STATUS_RAM_BASE
+#define CONFIG_KSNAV_QM_INTD_CONF_BASE		KS2_QM_INTD_CONF_BASE
+#define CONFIG_KSNAV_QM_PDSP1_CMD_BASE		KS2_QM_PDSP1_CMD_BASE
+#define CONFIG_KSNAV_QM_PDSP1_CTRL_BASE		KS2_QM_PDSP1_CTRL_BASE
+#define CONFIG_KSNAV_QM_PDSP1_IRAM_BASE		KS2_QM_PDSP1_IRAM_BASE
+#define CONFIG_KSNAV_QM_MANAGER_QUEUES_BASE	KS2_QM_MANAGER_QUEUES_BASE
+#define CONFIG_KSNAV_QM_MANAGER_Q_PROXY_BASE	KS2_QM_MANAGER_Q_PROXY_BASE
+#define CONFIG_KSNAV_QM_QUEUE_STATUS_BASE	KS2_QM_QUEUE_STATUS_BASE
+#define CONFIG_KSNAV_QM_LINK_RAM_BASE		KS2_QM_LINK_RAM_BASE
+#define CONFIG_KSNAV_QM_REGION_NUM		KS2_QM_REGION_NUM
+#define CONFIG_KSNAV_QM_QPOOL_NUM		KS2_QM_QPOOL_NUM
+
+/* NETCP pktdma */
+#define CONFIG_KSNAV_NETCP_PDMA_CTRL_BASE	KS2_NETCP_PDMA_CTRL_BASE
+#define CONFIG_KSNAV_NETCP_PDMA_TX_BASE		KS2_NETCP_PDMA_TX_BASE
+#define CONFIG_KSNAV_NETCP_PDMA_TX_CH_NUM	KS2_NETCP_PDMA_TX_CH_NUM
+#define CONFIG_KSNAV_NETCP_PDMA_RX_BASE		KS2_NETCP_PDMA_RX_BASE
+#define CONFIG_KSNAV_NETCP_PDMA_RX_CH_NUM	KS2_NETCP_PDMA_RX_CH_NUM
+#define CONFIG_KSNAV_NETCP_PDMA_SCHED_BASE	KS2_NETCP_PDMA_SCHED_BASE
+#define CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_BASE	KS2_NETCP_PDMA_RX_FLOW_BASE
+#define CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_NUM	KS2_NETCP_PDMA_RX_FLOW_NUM
+#define CONFIG_KSNAV_NETCP_PDMA_RX_FREE_QUEUE	KS2_NETCP_PDMA_RX_FREE_QUEUE
+#define CONFIG_KSNAV_NETCP_PDMA_RX_RCV_QUEUE	KS2_NETCP_PDMA_RX_RCV_QUEUE
+#define CONFIG_KSNAV_NETCP_PDMA_TX_SND_QUEUE	KS2_NETCP_PDMA_TX_SND_QUEUE
+
 /* AEMIF */
 #define CONFIG_TI_AEMIF
 #define CONFIG_AEMIF_CNTRL_BASE		KS2_AEMIF_CNTRL_BASE
Signature · 1 line
1.8.3.2
#6 lore raw

PATCH v2 3/4 dma: keystone_nav: move keystone_nav driver to driver/dma/

Quoted 7 lines · Ivan

The keystone_nav is used by drivers/net/keystone_net.c driver to

send and receive packets, but currently it's placed at keystone arch sources. So it should be in the drivers directory also. It's separate driver that can be used for sending and receiving pktdma packets by others drivers also.

Quoted 5 lines

This patch just move this driver to appropriate directory and doesn't add any functional changes.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/6a3357e4/attachment.pgp>
#7 lore raw

PATCH v2 4/4 dma: keystone_nav: generalize driver usage

In reply to Ivan Khoronzhuk

The keystone_nav driver is general driver intended to be used for working with queue manager and pktdma for different IPs like NETCP, AIF, FFTC, etc. So the it's API shouldn't be named like it works only with one of them, it should be general names. The names with prefix like netcp_* rather do for drivers/net/keystone_net.c driver. So it's good to generalize this driver to be used for different IP's and delete confusion with real NETCP driver.

The current netcp_* functions of keystone navigator can be used for other settings of pktdma, not only for NETCP. The API of this driver is used by the keystone_net driver to work with NETCP, so net driver also should be corrected. For convenience collect pkdma configurations in drivers/dma/keystone_nav_cfg.c.

---
 arch/arm/include/asm/ti-common/keystone_nav.h |  12 ++-
 drivers/dma/Makefile                          |   2 +-
 drivers/dma/keystone_nav.c                    | 132 +++++++++++---------------
 drivers/dma/keystone_nav_cfg.c                |  27 ++++++
 drivers/net/keystone_net.c                    |  13 +--
 include/configs/k2hk_evm.h                    |   1 +
 6 files changed, 98 insertions(+), 89 deletions(-)
 create mode 100644 drivers/dma/keystone_nav_cfg.c
arch/arm/include/asm/ti-common/keystone_nav.h +7 -5
index 646c2f3..696d8c6 100644
@@ -169,6 +169,8 @@ struct pktdma_cfg {
 	u32			rx_flow; /* flow that is used for RX */
 };
 
+extern struct pktdma_cfg netcp_pktdma;
+
 /*
  * packet dma user allocates memory for rx buffers
  * and describe it in the following structure
@@ -180,10 +182,10 @@ struct rx_buff_desc {
 	u32	rx_flow;
 };
 
-int netcp_close(void);
-int netcp_init(struct rx_buff_desc *rx_buffers);
-int netcp_send(u32 *pkt, int num_bytes, u32 swinfo2);
-void *netcp_recv(u32 **pkt, int *num_bytes);
-void netcp_release_rxhd(void *hd);
+int ksnav_close(struct pktdma_cfg *pktdma);
+int ksnav_init(struct pktdma_cfg *pktdma, struct rx_buff_desc *rx_buffers);
+int ksnav_send(struct pktdma_cfg *pktdma, u32 *pkt, int num_bytes, u32 swinfo2);
+void *ksnav_recv(struct pktdma_cfg *pktdma, u32 **pkt, int *num_bytes);
+void ksnav_release_rxhd(struct pktdma_cfg *pktdma, void *hd);
 
 #endif  /* _KEYSTONE_NAV_H_ */
drivers/dma/Makefile +1 -1
index 519dd0d..15b0780 100644
@@ -8,4 +8,4 @@
 obj-$(CONFIG_FSLDMAFEC) += MCD_tasksInit.o MCD_dmaApi.o MCD_tasks.o
 obj-$(CONFIG_APBH_DMA) += apbh_dma.o
 obj-$(CONFIG_FSL_DMA) += fsl_dma.o
-obj-$(CONFIG_TI_KSNAV) += keystone_nav.o
+obj-$(CONFIG_TI_KSNAV) += keystone_nav.o keystone_nav_cfg.o
drivers/dma/keystone_nav.c +55 -77

239 lines not on this page · raw message

drivers/dma/keystone_nav_cfg.c new file +27 -0
new file mode 100644
index 0000000..bdd30a0
@@ -0,0 +1,27 @@
+/*
+ * Multicore Navigator driver for TI Keystone 2 devices.
+ *
+ * (C) Copyright 2012-2014
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <asm/ti-common/keystone_nav.h>
+
+#ifdef CONFIG_KSNAV_PKTDMA_NETCP
+/* NETCP Pktdma */
+struct pktdma_cfg netcp_pktdma = {
+	.global		= (void *)CONFIG_KSNAV_NETCP_PDMA_CTRL_BASE,
+	.tx_ch		= (void *)CONFIG_KSNAV_NETCP_PDMA_TX_BASE,
+	.tx_ch_num	= CONFIG_KSNAV_NETCP_PDMA_TX_CH_NUM,
+	.rx_ch		= (void *)CONFIG_KSNAV_NETCP_PDMA_RX_BASE,
+	.rx_ch_num	= CONFIG_KSNAV_NETCP_PDMA_RX_CH_NUM,
+	.tx_sched	= (u32 *)CONFIG_KSNAV_NETCP_PDMA_SCHED_BASE,
+	.rx_flows	= (void *)CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_BASE,
+	.rx_flow_num	= CONFIG_KSNAV_NETCP_PDMA_RX_FLOW_NUM,
+	.rx_free_q	= CONFIG_KSNAV_NETCP_PDMA_RX_FREE_QUEUE,
+	.rx_rcv_q	= CONFIG_KSNAV_NETCP_PDMA_RX_RCV_QUEUE,
+	.tx_snd_q	= CONFIG_KSNAV_NETCP_PDMA_TX_SND_QUEUE,
+};
+#endif
drivers/net/keystone_net.c +7 -6
index 1cfe654..66532ee 100644
@@ -393,7 +393,8 @@ int32_t cpmac_drv_send(u32 *buffer, int num_bytes, int slave_port_num)
 	if (num_bytes < EMAC_MIN_ETHERNET_PKT_SIZE)
 		num_bytes = EMAC_MIN_ETHERNET_PKT_SIZE;
 
-	return netcp_send(buffer, num_bytes, (slave_port_num) << 16);
+	return ksnav_send(&netcp_pktdma, buffer,
+			  num_bytes, (slave_port_num) << 16);
 }
 
 /* Eth device open */
@@ -431,7 +432,7 @@ static int keystone2_eth_open(struct eth_device *dev, bd_t *bis)
 		printf("ERROR: qm_init()\n");
 		return -1;
 	}
-	if (netcp_init(&net_rx_buffs)) {
+	if (ksnav_init(&netcp_pktdma, &net_rx_buffs)) {
 		qm_close();
 		printf("ERROR: netcp_init()\n");
 		return -1;
@@ -456,7 +457,7 @@ static int keystone2_eth_open(struct eth_device *dev, bd_t *bis)
 
 		link = keystone_get_link_status(dev);
 		if (link == 0) {
-			netcp_close();
+			ksnav_close(&netcp_pktdma);
 			qm_close();
 			return -1;
 		}
@@ -483,7 +484,7 @@ void keystone2_eth_close(struct eth_device *dev)
 
 	ethss_stop();
 
-	netcp_close();
+	ksnav_close(&netcp_pktdma);
 	qm_close();
 
 	emac_open = 0;
@@ -530,13 +531,13 @@ static int keystone2_eth_rcv_packet(struct eth_device *dev)
 	int  pkt_size;
 	u32  *pkt;
 
-	hd = netcp_recv(&pkt, &pkt_size);
+	hd = ksnav_recv(&netcp_pktdma, &pkt, &pkt_size);
 	if (hd == NULL)
 		return 0;
 
 	NetReceive((uchar *)pkt, pkt_size);
 
-	netcp_release_rxhd(hd);
+	ksnav_release_rxhd(&netcp_pktdma, hd);
 
 	return pkt_size;
 }
include/configs/k2hk_evm.h +1 -0
index c313907..d0c5ff1 100644
@@ -37,5 +37,6 @@
 /* Network */
 #define CONFIG_DRIVER_TI_KEYSTONE_NET
 #define CONFIG_TI_KSNAV
+#define CONFIG_KSNAV_PKTDMA_NETCP
 
 #endif /* __CONFIG_K2HK_EVM_H */
Signature · 1 line
1.8.3.2
#8 lore raw

PATCH v2 4/4 dma: keystone_nav: generalize driver usage

Quoted 8 lines · Ivan

The keystone_nav driver is general driver intended to be used for working with queue manager and pktdma for different IPs like NETCP, AIF, FFTC, etc. So the it's API shouldn't be named like it works only with one of them, it should be general names. The names with prefix like netcp_* rather do for drivers/net/keystone_net.c driver. So it's good to generalize this driver to be used for different IP's and delete confusion with real NETCP driver.

Quoted 8 lines

The current netcp_* functions of keystone navigator can be used for other settings of pktdma, not only for NETCP. The API of this driver is used by the keystone_net driver to work with NETCP, so net driver also should be corrected. For convenience collect pkdma configurations in drivers/dma/keystone_nav_cfg.c.

Applied to u-boot-ti/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141023/8f033642/attachment.pgp>
#9 lore raw

v2 cover keystone2: generalize navigator driver usage

In reply to Ivan Khoronzhuk
Quoted 25 lines · Ivan Khoronzhuk

This series generalize keystone_nav driver usage in order to add keystone2 K2E/K2L SoCs support.

Based on u-boot-ti/master

v2..v1:
rebased on top of u-boot-ti/master, no functional changes

Ivan Khoronzhuk (4):
keystone2: keystone_nav: don't use hard addresses in qm_config
keystone2: keystone_nav: don't use hard addresses in netcp_pktdma
dma: keystone_nav: move keystone_nav driver to driver/dma/
dma: keystone_nav: generalize driver usage

  arch/arm/cpu/armv7/keystone/Makefile               |   1 -
  arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  13 ++
  arch/arm/include/asm/arch-keystone/hardware.h      |  13 +-
  .../{arch-keystone => ti-common}/keystone_nav.h    |  16 +-
  drivers/dma/Makefile                               |   1 +
  .../armv7/keystone => drivers/dma}/keystone_nav.c  | 196 ++++++++-------------
  drivers/dma/keystone_nav_cfg.c                     |  27 +++
  drivers/net/keystone_net.c                         |  15 +-
  include/configs/k2hk_evm.h                         |   2 +
  include/configs/ks2_evm.h                          |  29 +++
  10 files changed, 174 insertions(+), 139 deletions(-)
Quoted 4 lines

rename arch/arm/include/asm/{arch-keystone => ti-common}/keystone_nav.h (91%) rename {arch/arm/cpu/armv7/keystone => drivers/dma}/keystone_nav.c (53%) create mode 100644 drivers/dma/keystone_nav_cfg.c

Tom,

Could you please pickup subj series?

Signature · 2 lines
Regards,
Ivan Khoronzhuk
#10 lore raw

v2 cover keystone2: generalize navigator driver usage

Quoted 31 lines · Ivan Khoronzhuk
Quoted 14 lines · Ivan Khoronzhuk

This series generalize keystone_nav driver usage in order to add keystone2 K2E/K2L SoCs support.

Based on u-boot-ti/master

v2..v1:
rebased on top of u-boot-ti/master, no functional changes

Ivan Khoronzhuk (4):
keystone2: keystone_nav: don't use hard addresses in qm_config
keystone2: keystone_nav: don't use hard addresses in netcp_pktdma
dma: keystone_nav: move keystone_nav driver to driver/dma/
dma: keystone_nav: generalize driver usage

Quoted 15 lines
 arch/arm/cpu/armv7/keystone/Makefile               |   1 -
 arch/arm/include/asm/arch-keystone/hardware-k2hk.h |  13 ++
 arch/arm/include/asm/arch-keystone/hardware.h      |  13 +-
 .../{arch-keystone => ti-common}/keystone_nav.h    |  16 +-
 drivers/dma/Makefile                               |   1 +
 .../armv7/keystone => drivers/dma}/keystone_nav.c  | 196 ++++++++-------------
 drivers/dma/keystone_nav_cfg.c                     |  27 +++
 drivers/net/keystone_net.c                         |  15 +-
 include/configs/k2hk_evm.h                         |   2 +
 include/configs/ks2_evm.h                          |  29 +++
 10 files changed, 174 insertions(+), 139 deletions(-)
 rename arch/arm/include/asm/{arch-keystone => ti-common}/keystone_nav.h (91%)
 rename {arch/arm/cpu/armv7/keystone => drivers/dma}/keystone_nav.c (53%)
 create mode 100644 drivers/dma/keystone_nav_cfg.c
Quoted 3 lines

Tom,

Could you please pickup subj series?

During the next merge window yes, I don't think this part was posted in time for this release.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20141008/a47895eb/attachment.pgp>