[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#494010: patch for building dsp56k firmware



tags 494010 patch
thanks

Hi,

I'm attaching a patch for building the dsp56k firmware from source.

Note: the dsp56k_bootstrap.asm in this patch includes fixes provided separately
(and explained) in this bug log.  I will send them to upstream as well.

-- 
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
--- dsp56k.c~	2008-10-27 22:03:26.000000000 +0100
+++ dsp56k.c	2008-10-27 22:05:13.000000000 +0100
@@ -94,44 +94,7 @@
 
 /* DSP56001 bootstrap code */
 static char bootstrap[] = {
-	0x0c, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x60, 0xf4, 0x00, 0x00, 0x00, 0x4f, 0x61, 0xf4,
-	0x00, 0x00, 0x7e, 0xa9, 0x06, 0x2e, 0x80, 0x00, 0x00, 0x47,
-	0x07, 0xd8, 0x84, 0x07, 0x59, 0x84, 0x08, 0xf4, 0xa8, 0x00,
-	0x00, 0x04, 0x08, 0xf4, 0xbf, 0x00, 0x0c, 0x00, 0x00, 0xfe,
-	0xb8, 0x0a, 0xf0, 0x80, 0x00, 0x7e, 0xa9, 0x08, 0xf4, 0xa0,
-	0x00, 0x00, 0x01, 0x08, 0xf4, 0xbe, 0x00, 0x00, 0x00, 0x0a,
-	0xa9, 0x80, 0x00, 0x7e, 0xad, 0x08, 0x4e, 0x2b, 0x44, 0xf4,
-	0x00, 0x00, 0x00, 0x03, 0x44, 0xf4, 0x45, 0x00, 0x00, 0x01,
-	0x0e, 0xa0, 0x00, 0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xb5, 0x08,
-	0x50, 0x2b, 0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xb8, 0x08, 0x46,
-	0x2b, 0x44, 0xf4, 0x45, 0x00, 0x00, 0x02, 0x0a, 0xf0, 0xaa,
-	0x00, 0x7e, 0xc9, 0x20, 0x00, 0x45, 0x0a, 0xf0, 0xaa, 0x00,
-	0x7e, 0xd0, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xc6, 0x0a, 0xa9,
-	0x80, 0x00, 0x7e, 0xc4, 0x08, 0x58, 0x6b, 0x0a, 0xf0, 0x80,
-	0x00, 0x7e, 0xad, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xcd, 0x0a,
-	0xa9, 0x80, 0x00, 0x7e, 0xcb, 0x08, 0x58, 0xab, 0x0a, 0xf0,
-	0x80, 0x00, 0x7e, 0xad, 0x06, 0xc6, 0x00, 0x00, 0x7e, 0xd4,
-	0x0a, 0xa9, 0x80, 0x00, 0x7e, 0xd2, 0x08, 0x58, 0xeb, 0x0a,
-	0xf0, 0x80, 0x00, 0x7e, 0xad};
+};
 static int sizeof_bootstrap = 375;
 
 
diff -Nur linux-2.6-2.6.26/debian/templates/control.source.in linux-2.6-2.6.26.new/debian/templates/control.source.in
--- linux-2.6-2.6.26/debian/templates/control.source.in	2008-10-04 22:40:12.000000000 +0200
+++ linux-2.6-2.6.26.new/debian/templates/control.source.in	2008-10-27 22:20:37.000000000 +0100
@@ -3,6 +3,6 @@
 Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
 Uploaders: Bastian Blank <waldi@debian.org>, Frederik Schüler <fs@debian.org>, maximilian attems <maks@debian.org>
 Standards-Version: 3.7.3.0
-Build-Depends: debhelper (>= 4.1.0), module-init-tools, dpkg-dev (>= 1.10.23), sparc-utils [sparc], kernel-package (>= 10.063), python
+Build-Depends: debhelper (>= 4.1.0), module-init-tools, dpkg-dev (>= 1.10.23), sparc-utils [sparc], kernel-package (>= 10.063), python, a56 (>= 1.3-5)
 Build-Depends-Indep: bzip2, findutils (>= 4.2.12), python-central, xmlto
 XS-Python-Version: current
diff -Nur linux-2.6-2.6.26/drivers/char/dsp56k_bootstrap.asm linux-2.6-2.6.26.new/drivers/char/dsp56k_bootstrap.asm
--- linux-2.6-2.6.26/drivers/char/dsp56k_bootstrap.asm	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6-2.6.26.new/drivers/char/dsp56k_bootstrap.asm	2008-10-27 22:25:16.000000000 +0100
@@ -0,0 +1,98 @@
+; Author: Frederik Noring <noring@nocrew.org>
+;
+; This file is subject to the terms and conditions of the GNU General Public
+; License.  See the file COPYING in the main directory of this archive
+; for more details.
+
+; DSP56k loader
+
+; Host Interface
+M_BCR   EQU     $FFFE           ; Port A Bus Control Register
+M_PBC   EQU     $FFE0           ; Port B Control Register
+M_PBDDR EQU     $FFE2           ; Port B Data Direction Register
+M_PBD   EQU     $FFE4           ; Port B Data Register
+M_PCC   EQU     $FFE1           ; Port C Control Register
+M_PCDDR EQU     $FFE3           ; Port C Data Direction Register
+M_PCD   EQU     $FFE5           ; Port C Data Register
+
+M_HCR   EQU     $FFE8           ; Host Control Register
+M_HSR   EQU     $FFE9           ; Host Status Register
+M_HRX   EQU     $FFEB           ; Host Receive Data Register
+M_HTX   EQU     $FFEB           ; Host Transmit Data Register
+
+; SSI, Synchronous Serial Interface
+M_RX    EQU     $FFEF           ; Serial Receive Data Register
+M_TX    EQU     $FFEF           ; Serial Transmit Data Register
+M_CRA   EQU     $FFEC           ; SSI Control Register A
+M_CRB   EQU     $FFED           ; SSI Control Register B
+M_SR    EQU     $FFEE           ; SSI Status Register
+M_TSR   EQU     $FFEE           ; SSI Time Slot Register
+
+; Exception Processing
+M_IPR   EQU     $FFFF           ; Interrupt Priority Register
+
+        org     P:$0
+start   jmp     <$40
+
+        org     P:$40
+;       ; Zero 16384 DSP X and Y words
+;       clr     A #0,r0
+;       clr     B #0,r4
+;       do      #64,<_block1
+;       rep     #256
+;       move    A,X:(r0)+ B,Y:(r4)+
+;_block1        ; Zero (32768-512) Program words
+;       clr     A #512,r0
+;       do      #126,<_block2
+;       rep     #256
+;       move    A,P:(r0)+
+;_block2
+
+        ; Copy DSP program control
+        move    #real,r0
+        move    #upload,r1
+        do      #upload_end-upload,_copy
+        movem    P:(r0)+,x0
+        movem    x0,P:(r1)+
+_copy   movep   #4,X:<<M_HCR
+        movep   #$c00,X:<<M_IPR
+        and     #<$fe,mr
+        jmp     upload
+
+real
+        org     P:$7ea9
+upload
+        movep   #1,X:<<M_PBC
+        movep   #0,X:<<M_BCR
+
+next    jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,A
+        move    #>3,x0
+        cmp     x0,A #>1,x0
+        jeq     <$0
+_get_address
+        jclr    #0,X:<<M_HSR,_get_address
+        movep   X:<<M_HRX,r0
+_get_length
+        jclr    #0,X:<<M_HSR,_get_length
+        movep   X:<<M_HRX,y0
+        cmp     x0,A #>2,x0
+        jeq     load_X
+        cmp     x0,A
+        jeq     load_Y
+
+load_P  do      y0,_load_P
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,P:(r0)+
+_load_P jmp     next
+load_X  do      y0,_load_X
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,X:(r0)+
+_load_X jmp     next
+load_Y  do      y0,_load_Y
+        jclr    #0,X:<<M_HSR,*
+        movep   X:<<M_HRX,Y:(r0)+
+_load_Y jmp     next
+
+upload_end
+        end
diff -Nur linux-2.6-2.6.26/drivers/char/dsp56k.c linux-2.6-2.6.26.new/drivers/char/dsp56k.c
--- linux-2.6-2.6.26/drivers/char/dsp56k.c	2008-10-27 22:27:25.000000000 +0100
+++ linux-2.6-2.6.26.new/drivers/char/dsp56k.c	2008-10-27 22:19:26.000000000 +0100
@@ -94,8 +94,8 @@
 
 /* DSP56001 bootstrap code */
 static char bootstrap[] = {
+#include "dsp56k_bootstrap.h"
 };
-static int sizeof_bootstrap = 375;
 
 
 static struct dsp56k_device {
@@ -133,7 +133,7 @@
 	dsp56k_reset();
   
 	p = bootstrap;
-	for (i = 0; i < sizeof_bootstrap/3; i++) {
+	for (i = 0; i < sizeof(bootstrap)/3; i++) {
 		/* tx_wait(10); */
 		dsp56k_host_interface.data.b[1] = *p++;
 		dsp56k_host_interface.data.b[2] = *p++;
diff -Nur linux-2.6-2.6.26/drivers/char/Makefile linux-2.6-2.6.26.new/drivers/char/Makefile
--- linux-2.6-2.6.26/drivers/char/Makefile	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6-2.6.26.new/drivers/char/Makefile	2008-10-27 22:23:31.000000000 +0100
@@ -137,3 +137,14 @@
 	rm $@.tmp
 
 endif
+
+$(obj)/dsp56k_bootstrap.tmp: $(src)/dsp56k_bootstrap.asm
+	a56 -o $@ $<
+
+$(obj)/dsp56k_bootstrap.bin: $(obj)/dsp56k_bootstrap.tmp
+	a56-tobin $@ < $<
+
+$(obj)/dsp56k_bootstrap.h: $(obj)/dsp56k_bootstrap.bin
+	bin2h 10 < $< | sed -e "s/^/\t/g" > $@
+
+$(obj)/dsp56k.o: $(obj)/dsp56k_bootstrap.h

Reply to: