[PATCH/v2] powerpc/5200: make BestComm gen_bd microcode exchangeable

Albrecht Dreß albrecht.dress at arcor.de
Tue Oct 6 04:41:07 EST 2009


This patch adds a method for defining different microcodes than the pe-defined ones for the MPC52xx's BestComm General Buffer Descriptor (gen_db) tasks.  The default microcode is still the one from bcom_gen_bd_[rt]x_task, but it can be replaced by calling bcom_gen_bd_set_microcode() which is more efficient than explicitly loading it via bcom_load_image() after each bcom_gen_bd_[rt]x_reset().

Except for a fixed tab vs. space formatting and the transfer format, there are no diffierences to the initial attempt.

Signed-off-by: Albrecht Dreß <albrecht.dress at arcor.de>


---


diff -uprN -X linux-2.6.32-rc3/Documentation/dontdiff linux-2.6.32-rc3-orig/arch/powerpc/sysdev/bestcomm/gen_bd.c linux-2.6.32-rc3/arch/powerpc/sysdev/bestcomm/gen_bd.c
--- linux-2.6.32-rc3-orig/arch/powerpc/sysdev/bestcomm/gen_bd.c	2009-10-05 02:12:30.000000000 +0200
+++ linux-2.6.32-rc3/arch/powerpc/sysdev/bestcomm/gen_bd.c	2009-10-05 14:52:31.000000000 +0200
@@ -78,6 +78,7 @@ struct bcom_gen_bd_priv {
 	int		initiator;
 	int		ipr;
 	int		maxbufsize;
+	u32		*microcode;
 };
 
 
@@ -104,6 +105,7 @@ bcom_gen_bd_rx_init(int queue_len, phys_
 	priv->initiator	= initiator;
 	priv->ipr	= ipr;
 	priv->maxbufsize = maxbufsize;
+	priv->microcode = bcom_gen_bd_rx_task;
 
 	if (bcom_gen_bd_rx_reset(tsk)) {
 		bcom_task_free(tsk);
@@ -128,7 +130,7 @@ bcom_gen_bd_rx_reset(struct bcom_task *t
 	var = (struct bcom_gen_bd_rx_var *) bcom_task_var(tsk->tasknum);
 	inc = (struct bcom_gen_bd_rx_inc *) bcom_task_inc(tsk->tasknum);
 
-	if (bcom_load_image(tsk->tasknum, bcom_gen_bd_rx_task))
+	if (bcom_load_image(tsk->tasknum, priv->microcode))
 		return -1;
 
 	var->enable	= bcom_eng->regs_base +
@@ -188,6 +190,7 @@ bcom_gen_bd_tx_init(int queue_len, phys_
 	priv->fifo	= fifo;
 	priv->initiator	= initiator;
 	priv->ipr	= ipr;
+	priv->microcode = bcom_gen_bd_tx_task;
 
 	if (bcom_gen_bd_tx_reset(tsk)) {
 		bcom_task_free(tsk);
@@ -212,7 +215,7 @@ bcom_gen_bd_tx_reset(struct bcom_task *t
 	var = (struct bcom_gen_bd_tx_var *) bcom_task_var(tsk->tasknum);
 	inc = (struct bcom_gen_bd_tx_inc *) bcom_task_inc(tsk->tasknum);
 
-	if (bcom_load_image(tsk->tasknum, bcom_gen_bd_tx_task))
+	if (bcom_load_image(tsk->tasknum, priv->microcode))
 		return -1;
 
 	var->enable	= bcom_eng->regs_base +
@@ -253,6 +256,15 @@ bcom_gen_bd_tx_release(struct bcom_task 
 }
 EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release);
 
+void
+bcom_gen_bd_set_microcode(struct bcom_task *tsk, u32 *microcode)
+{
+	struct bcom_gen_bd_priv *priv = tsk->priv;
+
+	priv->microcode = microcode;
+}
+EXPORT_SYMBOL_GPL(bcom_gen_bd_set_microcode);
+
 /* ---------------------------------------------------------------------
  * PSC support code
  */
diff -uprN -X linux-2.6.32-rc3/Documentation/dontdiff linux-2.6.32-rc3-orig/arch/powerpc/sysdev/bestcomm/gen_bd.h linux-2.6.32-rc3/arch/powerpc/sysdev/bestcomm/gen_bd.h
--- linux-2.6.32-rc3-orig/arch/powerpc/sysdev/bestcomm/gen_bd.h	2009-10-05 02:12:30.000000000 +0200
+++ linux-2.6.32-rc3/arch/powerpc/sysdev/bestcomm/gen_bd.h	2009-10-05 14:52:31.000000000 +0200
@@ -43,6 +43,9 @@ bcom_gen_bd_tx_reset(struct bcom_task *t
 extern void
 bcom_gen_bd_tx_release(struct bcom_task *tsk);
 
+extern void
+bcom_gen_bd_set_microcode(struct bcom_task *tsk, u32 *microcode);
+
 
 /* PSC support utility wrappers */
 struct bcom_task * bcom_psc_gen_bd_rx_init(unsigned psc_num, int queue_len,


More information about the Linuxppc-dev mailing list