Skip to contentSkip to conversation

powerpc/5200: make BestComm gen_bd microcode exchangeable

PATCH In review Albrecht Dreß 2 participants 5 messages Oct 1, 2009 – Oct 3, 2009 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/5200: make BestComm gen_bd microcode exchangeable

This patch adds a method for defining different microcodes than the pe-defined ones for the MPC52xx processor'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().

---

arch/powerpc/sysdev/bestcomm/gen_bd.c +15 -3
diff -uprN -X linux-2.6.30.3/Documentation/dontdiff linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.c linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.c
@@ -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,16 @@ 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

*/

arch/powerpc/sysdev/bestcomm/gen_bd.h +3 -0
diff -uprN -X linux-2.6.30.3/Documentation/dontdiff linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.h linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.h
@@ -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,

#1 lore raw

Hi Albrecht,

you wrote your own microcode? :)
approach looks ok to me in general, but this patch is line-wrapped.

Quoted 2 lines · Albrecht Dreß

This patch adds a method for defining different microcodes than the pe-defined ones for the MPC52xx processor's BestComm General Buffer

pre-defined

Quoted 19 lines

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().

---

diff -uprN -X linux-2.6.30.3/Documentation/dontdiff linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.c linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.c
--- linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.c 2009-07-24
23:47:51.000000000 +0200
+++ linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.c 2009-10-01
14:26:33.000000000 +0200

arch/powerpc/sysdev/bestcomm/gen_bd.c struct bcom_gen_bd_priv { · line 81

Quoted 4 lines
arch/powerpc/sysdev/bestcomm/gen_bd.c +1 -0
@@ -78,6 +78,7 @@ struct bcom_gen_bd_priv {
 	int		initiator;
 	int		ipr;
 	int		maxbufsize;
+	u32    *microcode;

spaces instead of tabs

Quoted 41 lines
arch/powerpc/sysdev/bestcomm/gen_bd.c +4 -2
 };
 
 
@@ -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,16 @@ bcom_gen_bd_tx_release(struct bcom_task
 }
 EXPORT_SYMBOL_GPL(bcom_gen_bd_tx_release);
 

arch/powerpc/sysdev/bestcomm/gen_bd.c bcom_gen_bd_tx_release(struct bcom_task · line 268

Quoted 10 lines
arch/powerpc/sysdev/bestcomm/gen_bd.c +10 -0
+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);
+
+

Two empty lines.

Quoted 23 lines
arch/powerpc/sysdev/bestcomm/gen_bd.c +0 -1
 /*  
---------------------------------------------------------------------
  * PSC support code
  */

diff -uprN -X linux-2.6.30.3/Documentation/dontdiff linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.h linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.h
--- linux-2.6.30.3.orig/arch/powerpc/sysdev/bestcomm/gen_bd.h 2009-07-24
23:47:51.000000000 +0200
+++ linux-2.6.30.3/arch/powerpc/sysdev/bestcomm/gen_bd.h 2009-10-01
14:26:50.000000000 +0200

arch/powerpc/sysdev/bestcomm/gen_bd.h +3 -0
@@ -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,

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw

Hi Wolfram:

Am 03.10.09 11:44 schrieb(en) Wolfram Sang:

Quoted 1 line

you wrote your own microcode? :)

I modified the bcom_gen_bd_rx_task for a LPB peripheral as to perform Endianess swapping during the transfer (works meanwhile :-). Modifying the standard kernel code for testing seemed to be the wrong approach for me, so I wrote that patch...

If possible, I would also like to have a crc32 calculation performed by BestComm, but unfortunately there is no documentation and Freescale doesn't give any support, so it's all trial and error and error and error... If you have any idea, pointers would be appreciated!

Quoted 1 line

approach looks ok to me in general, but this patch is line-wrapped.

I don't think so - the message body is a "format=flowed" (RFC 3676) text/plain part. Maybe your MUA doesn't display that format correctly (Outlook?)? Or is '3676 in general not acceptable for patches?

[snip]

Quoted 1 line

spaces instead of tabs

[snip]

Quoted 1 line

Two empty lines.

Thanks - will submit a fixed patch next week, stay tuned...

Cheers, Albrecht.

P.S.: Did your mtd-ram/physmap_of patch you submitted a while ago make it into the stock kernel? I have some pending extra work (16-bit LPB RAM access) building on top of it...

#3 lore raw
Quoted 3 lines

doesn't give any support, so it's all trial and error and error and error... If you have any idea, pointers would be appreciated!

Sorry, I hardly know anything about the microcode. From what I know, it shouldn't be much fun due to various bugs in the Bestcomm engine.

Quoted 3 lines

I don't think so - the message body is a "format=flowed" (RFC 3676) text/plain part. Maybe your MUA doesn't display that format correctly (Outlook?)?

Hey! No need for insults! ;)

Have to check if my MUA (see headers) supports it. The archives seem to have split it as well:

http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-October/076236.html

I recall a similar problem, where some archives had the patch correct and some didn't.

Quoted 1 line

Or is '3676 in general not acceptable for patches?

Maybe. Could you try without next time, and we will see if it works better?

Quoted 3 lines

P.S.: Did your mtd-ram/physmap_of patch you submitted a while ago make it into the stock kernel? I have some pending extra work (16-bit LPB RAM access) building on top of it...

Yup, since -rc1. (git log --grep=mtd-ram)

Regards,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw

Am 03.10.09 16:40 schrieb(en) Wolfram Sang:

Quoted 1 line

Sorry, I hardly know anything about the microcode. From what I know, it shouldn't be much fun due to various bugs in the Bestcomm engine.

Ummm. That's not encouraging! :-/

Quoted 1 line

Hey! No need for insults! ;)

Sorry, that wasn't my intention, but it's a MUA I *know* it doesn't understand it... most OSS clients do (like Balsa, Thunderbird, kmail, etc.).

Quoted 3 lines
Quoted 1 line

Or is '3676 in general not acceptable for patches?

Maybe. Could you try without next time, and we will see if it works better?

Actually, it's in Documentation/email-clients.txt - '3676 must not be used. Sorry, should have read that before! (However, messages *without* folding *and* with lines > 78 characters violate RFC2822...)

Quoted 1 line

Yup, since -rc1. (git log --grep=mtd-ram)

Thanks!

Cheers, Albrecht.