qe_lib and ucc_geth: switch to the cpm_muram implementation
Subsystems (3)
This is very trivial patch, mostly bunch of renames and deletes.
Less trivial changes:
- BD_SC_* defines were also defined in the cpm.h, so to avoid redefines we remove BD_SC from the qe.h and use the cpm.h along with cpm_muram_* prototypes;
- qe_muram_dump was unused and thus removed;
- added some code to the cpm_common.c to support legacy QE bindings (data-only node name).
---
Quoted 8 lines · Scott Wood
Quoted 5 lines · Anton Vorontsov
qe_muram_offsetis the reverse of theqe_muram_addr, will be used for the Freescale QE USB Host Controller driver.This patch also moves
qe_muram_addrinto theqe.hheader, plus adds__iomemhints to use with sparse.We should really switch QE over to using the muram code in
cpm_common.c...
Here it is. I'm not sure about Makefile changes, any better ideas?
arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/cpm_common.c | 12 +++- arch/powerpc/sysdev/qe_lib/qe.c | 102 +-------------------------------- arch/powerpc/sysdev/qe_lib/ucc_fast.c | 8 +- arch/powerpc/sysdev/qe_lib/ucc_slow.c | 18 +++--- drivers/net/ucc_geth.c | 96 +++++++++++++++--------------- include/asm-powerpc/qe.h | 20 +------ 7 files changed, 73 insertions(+), 184 deletions(-)
arch/powerpc/sysdev/Makefile +1 -0
@@ -38,6 +38,7 @@ endif # Temporary hack until we have migrated to asm-powerpc ifeq ($(ARCH),powerpc) obj-$(CONFIG_CPM) += cpm_common.o +obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o obj-$(CONFIG_PPC_DCR) += dcr.o obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o
arch/powerpc/sysdev/cpm_common.c +8 -4
@@ -58,7 +58,7 @@ void __init udbg_init_cpm(void) }#endif -#ifdef CONFIG_PPC_CPM_NEW_BINDING +#if defined(CONFIG_PPC_CPM_NEW_BINDING ) || defined(CONFIG_QUICC_ENGINE )static spinlock_t cpm_muram_lock;static rh_block_t cpm_boot_muram_rh_block[16 ];static rh_info_t cpm_muram_info;
@@ -86,9 +86,13 @@ int __init cpm_muram_init(void) np =of_find_compatible_node (NULL ,NULL ,"fsl,cpm-muram-data" );if (!np) { -printk (KERN_ERR "Cannot find CPM muram data node" ); - ret = -ENODEV ; - goto out; +/* try legacy bindings */ + np =of_find_node_by_name (NULL ,"data-only" ); +if (!np) { +printk (KERN_ERR "Cannot find CPM muram data node" ); + ret = -ENODEV ; + goto out; + } } muram_pbase =of_translate_address (np, zero);
arch/powerpc/sysdev/qe_lib/qe.c +2 -100
126 lines not on this page · raw message
arch/powerpc/sysdev/qe_lib/ucc_fast.c +4 -4
@@ -267,7 +267,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Tx Virtual Fifo */ uccf->ucc_fast_tx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT ); +cpm_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_tx_virtual_fifo_base_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for TX FIFO\n" , __func__);
@@ -278,7 +278,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Rx Virtual Fifo */ uccf->ucc_fast_rx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->urfs + +cpm_muram_alloc (uf_info->urfs +UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR ,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
@@ -350,10 +350,10 @@ void ucc_fast_free(struct ucc_fast_private * uccf)return ;if (uccf->ucc_fast_tx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset);if (uccf->ucc_fast_rx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset);kfree (uccf); }
arch/powerpc/sysdev/qe_lib/ucc_slow.c +9 -9
@@ -187,7 +187,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Get PRAM base */ uccs->us_pram_offset = -qe_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM ); +cpm_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM );if (IS_ERR_VALUE (uccs->us_pram_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for PRAM" , __func__);ucc_slow_free (uccs);
@@ -197,7 +197,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_issue_cmd (QE_ASSIGN_PAGE_TO_DEVICE , id, us_info->protocol, uccs->us_pram_offset); - uccs->us_pram =qe_muram_addr (uccs->us_pram_offset); + uccs->us_pram =cpm_muram_addr (uccs->us_pram_offset);/* Set UCC to slow type */ ret =ucc_set_type (us_info->ucc_num,UCC_SPEED_TYPE_SLOW );
@@ -213,7 +213,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Allocate BDs. */ uccs->rx_base_offset = -qe_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->rx_base_offset)) { printk(KERN_ERR "%s: cannot allocate %u RX BDs\n", __func__,
@@ -224,7 +224,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc } uccs->tx_base_offset = -qe_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->tx_base_offset)) {printk (KERN_ERR "%s: cannot allocate TX BDs" , __func__);
@@ -234,7 +234,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc }/* Init Tx bds */ - bd = uccs->confBd = uccs->tx_bd =qe_muram_addr (uccs->tx_base_offset); + bd = uccs->confBd = uccs->tx_bd =cpm_muram_addr (uccs->tx_base_offset);for (i =0 ; i < us_info->tx_bd_ring_len -1 ; i++) {/* clear bd buffer */ out_be32 (&bd->buf,0 );
@@ -247,7 +247,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccout_be32 ((u32 *) bd,cpu_to_be32 (T_W ));/* Init Rx bds */ - bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset); + bd = uccs->rx_bd =cpm_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ out_be32 ((u32 *)bd,0 );
@@ -362,13 +362,13 @@ void ucc_slow_free(struct ucc_slow_private * uccs)return ;if (uccs->rx_base_offset) -qe_muram_free (uccs->rx_base_offset); +cpm_muram_free (uccs->rx_base_offset);if (uccs->tx_base_offset) -qe_muram_free (uccs->tx_base_offset); +cpm_muram_free (uccs->tx_base_offset);if (uccs->us_pram) { -qe_muram_free (uccs->us_pram_offset); +cpm_muram_free (uccs->us_pram_offset); uccs->us_pram =NULL ; }
drivers/net/ucc_geth.c +48 -48
339 lines not on this page · raw message
include/asm-powerpc/qe.h +1 -19
@@ -16,6 +16,7 @@#define _ASM_POWERPC_QE_H#ifdef __KERNEL__ +#include <asm/cpm.h> #include <asm/immap_qe.h> #define QE_NUM_OF_SNUM 28
@@ -88,11 +89,6 @@ enum qe_clock qe_clock_source(const char *source);int qe_setbrg (enum qe_clock brg,unsigned int rate,unsigned int multiplier);int qe_get_snum (void );void qe_put_snum (u8 snum); -unsigned long qe_muram_alloc (int size,int align); -int qe_muram_free (unsigned long offset); -unsigned long qe_muram_alloc_fixed (unsigned long offset,int size); -void qe_muram_dump (void ); -void *qe_muram_addr (unsigned long offset);/* Structure that defines QE firmware binary files. *
@@ -156,20 +152,6 @@ struct qe_bd {#define BD_STATUS_MASK 0xffff0000#define BD_LENGTH_MASK 0x0000ffff -#define BD_SC_EMPTY 0x8000/* Receive is empty */ -#define BD_SC_READY 0x8000/* Transmit is ready */ -#define BD_SC_WRAP 0x2000/* Last buffer descriptor */ -#define BD_SC_INTRPT 0x1000/* Interrupt on change */ -#define BD_SC_LAST 0x0800/* Last buffer in frame */ -#define BD_SC_CM 0x0200/* Continous mode */ -#define BD_SC_ID 0x0100/* Rec'd too many idles */ -#define BD_SC_P 0x0100/* xmt preamble */ -#define BD_SC_BR 0x0020/* Break received */ -#define BD_SC_FR 0x0010/* Framing error */ -#define BD_SC_PR 0x0008/* Parity error */ -#define BD_SC_OV 0x0002/* Overrun */ -#define BD_SC_CD 0x0001/* ?? */ -/* Alignment */ #define QE_INTR_TABLE_ALIGN 16/* ??? */ #define QE_ALIGNMENT_OF_BD 8
Signature · 1 line
1.5.2.2
PATCH 1/1 qe_lib and ucc_geth: switch to the cpm_muram implementation
This is very trivial patch. We're transitioning to the cpm_muram_* calls. That's it.
Less trivial changes:
- BD_SC_* defines were defined in the cpm.h and qe.h, so to avoid redefines we remove BD_SC from the qe.h and use cpm.h along with cpm_muram_* prototypes;
- qe_muram_dump was unused and thus removed;
- added some code to the cpm_common.c to support legacy QE bindings (data-only node name).
---
Rebased on top of today's galak/powerpc.git.
arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/cpm_common.c | 16 +++++- arch/powerpc/sysdev/qe_lib/qe.c | 96 +-------------------------------- arch/powerpc/sysdev/qe_lib/ucc_fast.c | 8 ++-- arch/powerpc/sysdev/qe_lib/ucc_slow.c | 18 +++--- drivers/net/ucc_geth.c | 96 ++++++++++++++++---------------- include/asm-powerpc/cpm.h | 1 + include/asm-powerpc/qe.h | 29 +---------- 8 files changed, 79 insertions(+), 186 deletions(-)
arch/powerpc/sysdev/Makefile +1 -0
@@ -40,6 +40,7 @@ endif ifeq ($(ARCH),powerpc) obj-$(CONFIG_CPM) += cpm_common.o obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o +obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o obj-$(CONFIG_PPC_DCR) += dcr.o obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o obj-$(CONFIG_UCODE_PATCH) += micropatch.o
arch/powerpc/sysdev/cpm_common.c +13 -3
@@ -85,9 +85,13 @@ int __init cpm_muram_init(void) np =of_find_compatible_node (NULL ,NULL ,"fsl,cpm-muram-data" );if (!np) { -printk (KERN_ERR "Cannot find CPM muram data node" ); - ret = -ENODEV ; - goto out; +/* try legacy bindings */ + np =of_find_node_by_name (NULL ,"data-only" ); +if (!np) { +printk (KERN_ERR "Cannot find CPM muram data node" ); + ret = -ENODEV ; + goto out; + } } muram_pbase =of_translate_address (np, zero);
@@ -189,6 +193,12 @@ void __iomem *cpm_muram_addr(unsigned long offset) }EXPORT_SYMBOL (cpm_muram_addr); +unsigned long cpm_muram_offset (void __iomem *addr) +{ +return addr - muram_vbase; +} +EXPORT_SYMBOL (cpm_muram_offset); +/** * cpm_muram_dma - turn a muram virtual address into a DMA address * @offset: virtual address from cpm_muram_addr() to convert
arch/powerpc/sysdev/qe_lib/qe.c +2 -94
120 lines not on this page · raw message
arch/powerpc/sysdev/qe_lib/ucc_fast.c +4 -4
@@ -267,7 +267,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Tx Virtual Fifo */ uccf->ucc_fast_tx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT ); +cpm_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_tx_virtual_fifo_base_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for TX FIFO\n" , __func__);
@@ -278,7 +278,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Rx Virtual Fifo */ uccf->ucc_fast_rx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->urfs + +cpm_muram_alloc (uf_info->urfs +UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR ,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
@@ -350,10 +350,10 @@ void ucc_fast_free(struct ucc_fast_private * uccf)return ;if (uccf->ucc_fast_tx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset);if (uccf->ucc_fast_rx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset);kfree (uccf); }
arch/powerpc/sysdev/qe_lib/ucc_slow.c +9 -9
@@ -187,7 +187,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Get PRAM base */ uccs->us_pram_offset = -qe_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM ); +cpm_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM );if (IS_ERR_VALUE (uccs->us_pram_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for PRAM" , __func__);ucc_slow_free (uccs);
@@ -197,7 +197,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_issue_cmd (QE_ASSIGN_PAGE_TO_DEVICE , id, us_info->protocol, uccs->us_pram_offset); - uccs->us_pram =qe_muram_addr (uccs->us_pram_offset); + uccs->us_pram =cpm_muram_addr (uccs->us_pram_offset);/* Set UCC to slow type */ ret =ucc_set_type (us_info->ucc_num,UCC_SPEED_TYPE_SLOW );
@@ -213,7 +213,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Allocate BDs. */ uccs->rx_base_offset = -qe_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->rx_base_offset)) { printk(KERN_ERR "%s: cannot allocate %u RX BDs\n", __func__,
@@ -224,7 +224,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc } uccs->tx_base_offset = -qe_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->tx_base_offset)) {printk (KERN_ERR "%s: cannot allocate TX BDs" , __func__);
@@ -234,7 +234,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc }/* Init Tx bds */ - bd = uccs->confBd = uccs->tx_bd =qe_muram_addr (uccs->tx_base_offset); + bd = uccs->confBd = uccs->tx_bd =cpm_muram_addr (uccs->tx_base_offset);for (i =0 ; i < us_info->tx_bd_ring_len -1 ; i++) {/* clear bd buffer */ out_be32 (&bd->buf,0 );
@@ -247,7 +247,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccout_be32 ((u32 *) bd,cpu_to_be32 (T_W ));/* Init Rx bds */ - bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset); + bd = uccs->rx_bd =cpm_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ out_be32 ((u32 *)bd,0 );
@@ -362,13 +362,13 @@ void ucc_slow_free(struct ucc_slow_private * uccs)return ;if (uccs->rx_base_offset) -qe_muram_free (uccs->rx_base_offset); +cpm_muram_free (uccs->rx_base_offset);if (uccs->tx_base_offset) -qe_muram_free (uccs->tx_base_offset); +cpm_muram_free (uccs->tx_base_offset);if (uccs->us_pram) { -qe_muram_free (uccs->us_pram_offset); +cpm_muram_free (uccs->us_pram_offset); uccs->us_pram =NULL ; }
drivers/net/ucc_geth.c +48 -48
339 lines not on this page · raw message
include/asm-powerpc/cpm.h +1 -0
@@ -96,6 +96,7 @@ unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);int cpm_muram_free (unsigned long offset);unsigned long cpm_muram_alloc_fixed (unsigned long offset,unsigned long size);void __iomem *cpm_muram_addr (unsigned long offset); +unsigned long cpm_muram_offset (void __iomem *addr);dma_addr_t cpm_muram_dma (void __iomem *addr);int cpm_command (u32 command,u8 opcode);
include/asm-powerpc/qe.h +1 -28
@@ -16,6 +16,7 @@#define _ASM_POWERPC_QE_H#ifdef __KERNEL__ +#include <asm/cpm.h> #include <asm/immap_qe.h> #define QE_NUM_OF_SNUM 28
@@ -89,20 +90,6 @@ unsigned int qe_get_brg_clk(void);int qe_setbrg (enum qe_clock brg,unsigned int rate,unsigned int multiplier);int qe_get_snum (void );void qe_put_snum (u8 snum); -unsigned long qe_muram_alloc (int size,int align); -int qe_muram_free (unsigned long offset); -unsigned long qe_muram_alloc_fixed (unsigned long offset,int size); -void qe_muram_dump (void ); - -static inline void __iomem *qe_muram_addr (unsigned long offset) -{ -return (void __iomem *)&qe_immr->muram[offset]; -} - -static inline unsigned long qe_muram_offset (void __iomem *addr) -{ -return addr - (void __iomem *)qe_immr->muram; -}/* Structure that defines QE firmware binary files. *
@@ -166,20 +153,6 @@ struct qe_bd {#define BD_STATUS_MASK 0xffff0000#define BD_LENGTH_MASK 0x0000ffff -#define BD_SC_EMPTY 0x8000/* Receive is empty */ -#define BD_SC_READY 0x8000/* Transmit is ready */ -#define BD_SC_WRAP 0x2000/* Last buffer descriptor */ -#define BD_SC_INTRPT 0x1000/* Interrupt on change */ -#define BD_SC_LAST 0x0800/* Last buffer in frame */ -#define BD_SC_CM 0x0200/* Continous mode */ -#define BD_SC_ID 0x0100/* Rec'd too many idles */ -#define BD_SC_P 0x0100/* xmt preamble */ -#define BD_SC_BR 0x0020/* Break received */ -#define BD_SC_FR 0x0010/* Framing error */ -#define BD_SC_PR 0x0008/* Parity error */ -#define BD_SC_OV 0x0002/* Overrun */ -#define BD_SC_CD 0x0001/* ?? */ -/* Alignment */ #define QE_INTR_TABLE_ALIGN 16/* ??? */ #define QE_ALIGNMENT_OF_BD 8
Signature · 1 line
1.5.5
PATCH v2 1/1 qe_lib and ucc_geth: switch to the cpm_muram implementation
This is very trivial patch. We're transitioning to the cpm_muram_* calls. That's it.
Less trivial changes:
- BD_SC_* defines were defined in the cpm.h and qe.h, so to avoid redefines we remove BD_SC from the qe.h and use cpm.h along with cpm_muram_* prototypes;
- qe_muram_dump was unused and thus removed;
- added some code to the cpm_common.c to support legacy QE bindings (data-only node name).
---
Oops, this small hunk wormed into the other patch in my series:
arch/powerpc/sysdev/cpm_common.c EXPORT_SYMBOL(cpm_muram_addr); · line 200
Quoted 10 lines
arch/powerpc/sysdev/cpm_common.c +1
-1@@ -195,7 +195,7 @@ EXPORT_SYMBOL(cpm_muram_addr);unsigned long cpm_muram_offset (void __iomem *addr) { -return addr - muram_vbase; +return addr - (void __iomem *)muram_vbase; }EXPORT_SYMBOL (cpm_muram_offset);
Without it compile will break:
arch/powerpc/sysdev/cpm_common.c: In function ‘cpm_muram_offset’:arch/powerpc/sysdev/cpm_common.c:198: error: invalid operands to binary -
Fixed patch down below.
arch/powerpc/sysdev/Makefile | 1 + arch/powerpc/sysdev/cpm_common.c | 16 +++++- arch/powerpc/sysdev/qe_lib/qe.c | 96 +-------------------------------- arch/powerpc/sysdev/qe_lib/ucc_fast.c | 8 ++-- arch/powerpc/sysdev/qe_lib/ucc_slow.c | 18 +++--- drivers/net/ucc_geth.c | 96 ++++++++++++++++---------------- include/asm-powerpc/cpm.h | 1 + include/asm-powerpc/qe.h | 29 +---------- 8 files changed, 79 insertions(+), 186 deletions(-)
arch/powerpc/sysdev/Makefile +1 -0
@@ -40,6 +40,7 @@ endif ifeq ($(ARCH),powerpc) obj-$(CONFIG_CPM) += cpm_common.o obj-$(CONFIG_CPM2) += cpm2.o cpm2_pic.o +obj-$(CONFIG_QUICC_ENGINE) += cpm_common.o obj-$(CONFIG_PPC_DCR) += dcr.o obj-$(CONFIG_8xx) += mpc8xx_pic.o cpm1.o obj-$(CONFIG_UCODE_PATCH) += micropatch.o
arch/powerpc/sysdev/cpm_common.c +13 -3
@@ -85,9 +85,13 @@ int __init cpm_muram_init(void) np =of_find_compatible_node (NULL ,NULL ,"fsl,cpm-muram-data" );if (!np) { -printk (KERN_ERR "Cannot find CPM muram data node" ); - ret = -ENODEV ; - goto out; +/* try legacy bindings */ + np =of_find_node_by_name (NULL ,"data-only" ); +if (!np) { +printk (KERN_ERR "Cannot find CPM muram data node" ); + ret = -ENODEV ; + goto out; + } } muram_pbase =of_translate_address (np, zero);
@@ -189,6 +193,12 @@ void __iomem *cpm_muram_addr(unsigned long offset) }EXPORT_SYMBOL (cpm_muram_addr); +unsigned long cpm_muram_offset (void __iomem *addr) +{ +return addr - (void __iomem *)muram_vbase; +} +EXPORT_SYMBOL (cpm_muram_offset); +/** * cpm_muram_dma - turn a muram virtual address into a DMA address * @offset: virtual address from cpm_muram_addr() to convert
arch/powerpc/sysdev/qe_lib/qe.c +2 -94
120 lines not on this page · raw message
arch/powerpc/sysdev/qe_lib/ucc_fast.c +4 -4
@@ -267,7 +267,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Tx Virtual Fifo */ uccf->ucc_fast_tx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT ); +cpm_muram_alloc (uf_info->utfs,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_tx_virtual_fifo_base_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for TX FIFO\n" , __func__);
@@ -278,7 +278,7 @@ int ucc_fast_init(struct ucc_fast_info * uf_info, struct ucc_fast_private ** ucc/* Allocate memory for Rx Virtual Fifo */ uccf->ucc_fast_rx_virtual_fifo_base_offset = -qe_muram_alloc (uf_info->urfs + +cpm_muram_alloc (uf_info->urfs +UCC_FAST_RECEIVE_VIRTUAL_FIFO_SIZE_FUDGE_FACTOR ,UCC_FAST_VIRT_FIFO_REGS_ALIGNMENT );if (IS_ERR_VALUE (uccf->ucc_fast_rx_virtual_fifo_base_offset)) {
@@ -350,10 +350,10 @@ void ucc_fast_free(struct ucc_fast_private * uccf)return ;if (uccf->ucc_fast_tx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_tx_virtual_fifo_base_offset);if (uccf->ucc_fast_rx_virtual_fifo_base_offset) -qe_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset); +cpm_muram_free (uccf->ucc_fast_rx_virtual_fifo_base_offset);kfree (uccf); }
arch/powerpc/sysdev/qe_lib/ucc_slow.c +9 -9
@@ -187,7 +187,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Get PRAM base */ uccs->us_pram_offset = -qe_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM ); +cpm_muram_alloc (UCC_SLOW_PRAM_SIZE ,ALIGNMENT_OF_UCC_SLOW_PRAM );if (IS_ERR_VALUE (uccs->us_pram_offset)) {printk (KERN_ERR "%s: cannot allocate MURAM for PRAM" , __func__);ucc_slow_free (uccs);
@@ -197,7 +197,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccqe_issue_cmd (QE_ASSIGN_PAGE_TO_DEVICE , id, us_info->protocol, uccs->us_pram_offset); - uccs->us_pram =qe_muram_addr (uccs->us_pram_offset); + uccs->us_pram =cpm_muram_addr (uccs->us_pram_offset);/* Set UCC to slow type */ ret =ucc_set_type (us_info->ucc_num,UCC_SPEED_TYPE_SLOW );
@@ -213,7 +213,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc/* Allocate BDs. */ uccs->rx_base_offset = -qe_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->rx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->rx_base_offset)) { printk(KERN_ERR "%s: cannot allocate %u RX BDs\n", __func__,
@@ -224,7 +224,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc } uccs->tx_base_offset = -qe_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ), +cpm_muram_alloc (us_info->tx_bd_ring_len *sizeof (struct qe_bd ),QE_ALIGNMENT_OF_BD );if (IS_ERR_VALUE (uccs->tx_base_offset)) {printk (KERN_ERR "%s: cannot allocate TX BDs" , __func__);
@@ -234,7 +234,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** ucc }/* Init Tx bds */ - bd = uccs->confBd = uccs->tx_bd =qe_muram_addr (uccs->tx_base_offset); + bd = uccs->confBd = uccs->tx_bd =cpm_muram_addr (uccs->tx_base_offset);for (i =0 ; i < us_info->tx_bd_ring_len -1 ; i++) {/* clear bd buffer */ out_be32 (&bd->buf,0 );
@@ -247,7 +247,7 @@ int ucc_slow_init(struct ucc_slow_info * us_info, struct ucc_slow_private ** uccout_be32 ((u32 *) bd,cpu_to_be32 (T_W ));/* Init Rx bds */ - bd = uccs->rx_bd =qe_muram_addr (uccs->rx_base_offset); + bd = uccs->rx_bd =cpm_muram_addr (uccs->rx_base_offset);for (i =0 ; i < us_info->rx_bd_ring_len -1 ; i++) {/* set bd status and length */ out_be32 ((u32 *)bd,0 );
@@ -362,13 +362,13 @@ void ucc_slow_free(struct ucc_slow_private * uccs)return ;if (uccs->rx_base_offset) -qe_muram_free (uccs->rx_base_offset); +cpm_muram_free (uccs->rx_base_offset);if (uccs->tx_base_offset) -qe_muram_free (uccs->tx_base_offset); +cpm_muram_free (uccs->tx_base_offset);if (uccs->us_pram) { -qe_muram_free (uccs->us_pram_offset); +cpm_muram_free (uccs->us_pram_offset); uccs->us_pram =NULL ; }
drivers/net/ucc_geth.c +48 -48
339 lines not on this page · raw message
include/asm-powerpc/cpm.h +1 -0
@@ -96,6 +96,7 @@ unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);int cpm_muram_free (unsigned long offset);unsigned long cpm_muram_alloc_fixed (unsigned long offset,unsigned long size);void __iomem *cpm_muram_addr (unsigned long offset); +unsigned long cpm_muram_offset (void __iomem *addr);dma_addr_t cpm_muram_dma (void __iomem *addr);int cpm_command (u32 command,u8 opcode);
include/asm-powerpc/qe.h +1 -28
@@ -16,6 +16,7 @@#define _ASM_POWERPC_QE_H#ifdef __KERNEL__ +#include <asm/cpm.h> #include <asm/immap_qe.h> #define QE_NUM_OF_SNUM 28
@@ -89,20 +90,6 @@ unsigned int qe_get_brg_clk(void);int qe_setbrg (enum qe_clock brg,unsigned int rate,unsigned int multiplier);int qe_get_snum (void );void qe_put_snum (u8 snum); -unsigned long qe_muram_alloc (int size,int align); -int qe_muram_free (unsigned long offset); -unsigned long qe_muram_alloc_fixed (unsigned long offset,int size); -void qe_muram_dump (void ); - -static inline void __iomem *qe_muram_addr (unsigned long offset) -{ -return (void __iomem *)&qe_immr->muram[offset]; -} - -static inline unsigned long qe_muram_offset (void __iomem *addr) -{ -return addr - (void __iomem *)qe_immr->muram; -}/* Structure that defines QE firmware binary files. *
@@ -166,20 +153,6 @@ struct qe_bd {#define BD_STATUS_MASK 0xffff0000#define BD_LENGTH_MASK 0x0000ffff -#define BD_SC_EMPTY 0x8000/* Receive is empty */ -#define BD_SC_READY 0x8000/* Transmit is ready */ -#define BD_SC_WRAP 0x2000/* Last buffer descriptor */ -#define BD_SC_INTRPT 0x1000/* Interrupt on change */ -#define BD_SC_LAST 0x0800/* Last buffer in frame */ -#define BD_SC_CM 0x0200/* Continous mode */ -#define BD_SC_ID 0x0100/* Rec'd too many idles */ -#define BD_SC_P 0x0100/* xmt preamble */ -#define BD_SC_BR 0x0020/* Break received */ -#define BD_SC_FR 0x0010/* Framing error */ -#define BD_SC_PR 0x0008/* Parity error */ -#define BD_SC_OV 0x0002/* Overrun */ -#define BD_SC_CD 0x0001/* ?? */ -/* Alignment */ #define QE_INTR_TABLE_ALIGN 16/* ??? */ #define QE_ALIGNMENT_OF_BD 8
Signature · 1 line
1.5.5
Quoted 5 lines
-----Original Message-----
From: [email protected]=20 [mailto:[email protected]]=20 On Behalf Of Anton Vorontsov
Sent: Thursday, April 17, 2008 2:22 AM
Quoted 8 lines
To: Kumar Gala
Cc: Wood Scott; [email protected]; Jeff Garzik; Tabi=20 Timur; [email protected]
Subject: [PATCH v2][POWERPC]qe_libanducc_geth: switch to=20 thecpm_muramimplementation
=20
This is very trivial patch. We're transitioning to the=20 cpm_muram_* calls. That's it.
Hi Anoton,
It is a good thing to unify the CPM dpram operation and QE muram = operation. But I'm having concerns about the naming as CPM is an = obsolete block. Can we change to use the new name QE instead?
- Leo
Quoted 11 lines · Li Yang
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Anton Vorontsov
Sent: Thursday, April 17, 2008 2:22 AM
To: Kumar Gala
Cc: Wood Scott; [email protected]; Jeff Garzik; Tabi Timur; [email protected]
Subject: [PATCH v2][POWERPC]qe_libanducc_geth: switch to thecpm_muramimplementation
Quoted 6 lines
Quoted 2 lines
This is very trivial patch. We're transitioning to the cpm_muram_* calls. That's it.
Hi Anoton,
It is a good thing to unify the CPM dpram operation and QE muram operation. But I'm having concerns about the naming as CPM is an obsolete block. Can we change to use the new name QE instead?
or at least provide both names by a simple:
#define qe_muram_addr cpm_muram_addr
- k
Quoted 3 lines · Li Yang
It is a good thing to unify the CPM dpram operation and QE muram operation. But I'm having concerns about the naming as CPM is an obsolete block. Can we change to use the new name QE instead?
And then change it again when marketing decides that CPM4 will be called something other than QE2? :-P
-Scott
Quoted 2 lines · Scott Wood
And then change it again when marketing decides that CPM4 will be called something other than QE2? :-P
I agree with Scott. The QE is really just CPM3.
Signature · 2 lines
Timur Tabi Linux kernel developer at Freescale
Quoted 11 lines
-----Original Message-----
From: Wood Scott=20
Sent: Thursday, April 17, 2008 10:11 PM
To: Li Yang
Cc: [email protected]; Kumar Gala;=20 [email protected]; Jeff Garzik; Tabi Timur;=20 [email protected]
Subject: Re: [PATCH v2][POWERPC]qe_libanducc_geth: switch=20 to thecpm_muramimplementation
=20
On Wed, Apr 16, 2008 at 08:38:19PM -0700, Li Yang wrote:
Quoted 6 lines
Quoted 3 lines
It is a good thing to unify the CPM dpram operation and QE muram=20 operation. But I'm having concerns about the naming as CPM is an=20 obsolete block. Can we change to use the new name QE instead?
=20
And then change it again when marketing decides that CPM4=20 will be called something other than QE2? :-P
It's a good point. :) Technically they are quite similar. But they are not so well known as Pentium to x86. The change will cause confusion especially when both of the terms of CPM and QE are used in one file. I agree with Kumar's suggestion that we keep both names.
- Leo