Microblaze changes
Michal Simek
maintainerHi,
I am sending some Microblaze changes.
Thanks for your comments,
Michal
Michal Simek
maintainerPATCH 1/10 microblaze: Fix in/out_be8/16/32 functions
Use inline functions instead of macros because
of typechecking.
--- arch/microblaze/include/asm/io.h | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-)
arch/microblaze/include/asm/io.h +27 -6
@@ -46,14 +46,35 @@#define outl (x, addr) ((void) writel (x, addr))/* Some #definitions to keep strange Xilinx code happy */ -#define in_8 (addr) readb (addr) -#define in_be16 (addr) readw (addr) -#define in_be32 (addr) readl (addr) +extern inline int in_8 (volatile unsigned char *addr) +{ +return readb (addr); +} + +extern inline int in_be16 (volatile unsigned short *addr) +{ +return readw (addr); +} -#define out_8 (addr,x ) outb (x,addr) -#define out_be16 (addr,x ) outw (x,addr) -#define out_be32 (addr,x ) outl (x,addr) +extern inline int in_be32 (volatile unsigned int *addr) +{ +return readl (addr); +} +extern inline void out_8 (volatile unsigned char *addr,char val) +{ +outb (val, addr); +} + +extern inline void out_be16 (volatile unsigned short *addr,short val) +{ +outw (val, addr); +} + +extern inline void out_be32 (volatile unsigned int *addr,int val) +{ +outl (val, addr); +}#define inb_p (port) inb((port))#define outb_p (val, port) outb((val), (port))
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 2/10 microblaze: Support CTRL+C when tftp is running
--- arch/microblaze/lib/board.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/microblaze/lib/board.c +1 -0
@@ -68,6 +68,7 @@ typedef int (init_fnc_t) (void);init_fnc_t *init_sequence[] = { env_init, serial_init, + console_init_f, #ifdef CONFIG_SYS_GPIO_0 gpio_init, #endif
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 3/10 microblaze: Support flashes on lower addresses
--- arch/microblaze/lib/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/microblaze/lib/board.c +6 -0
@@ -84,6 +84,10 @@ init_fnc_t *init_sequence[] = { NULL, }; +unsigned long monitor_flash_len; +extern char *__end; +extern char *__text_start; +void board_init (void ) {bd_t *bd;
@@ -105,6 +109,8 @@ void board_init (void) bd->bi_memsize =CONFIG_SYS_SDRAM_SIZE ; gd->flags |=GD_FLG_RELOC ;/* tell others: relocation done */ + monitor_flash_len = __end - __text_start; +/* * The Malloc area is immediately below the monitor copy in DRAM * aka CONFIG_SYS_MONITOR_BASE - Note there is no need for reloc_off
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 4/10 microblaze: Add netconsole support
--- arch/microblaze/lib/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/microblaze/lib/board.c +6 -0
@@ -167,6 +167,12 @@ void board_init (void)/* Initialize stdio devices */ stdio_init (); +/* Initialize the jump table for applications */ +jumptable_init (); + +/* Initialize the console (after the relocation and devices init) */ +console_init_r (); +if ((s =getenv ("loadaddr" )) !=NULL ) { load_addr =simple_strtoul (s,NULL ,16 ); }
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 5/10 microblaze: Fix unaligned.h for endians
Based on ARM unaligned.h.
--- arch/microblaze/include/asm/unaligned.h | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
arch/microblaze/include/asm/unaligned.h +9 -9
@@ -1,16 +1,16 @@#ifndef _ASM_MICROBLAZE_UNALIGNED_H#define _ASM_MICROBLAZE_UNALIGNED_H -#ifdef __KERNEL__ - -/* -* The Microblaze can do unaligned accesses itself in big endian mode. -*/ -#include <linux/unaligned/access_ok.h> +#include <linux/unaligned/le_byteshift.h> +#include <linux/unaligned/be_byteshift.h> #include <linux/unaligned/generic.h> -#define get_unaligned __get_unaligned_be -#define put_unaligned __put_unaligned_be +#ifdef __MICROBLAZEEL__ +# define get_unaligned __get_unaligned_le +# define put_unaligned __put_unaligned_le +#else +# define get_unaligned __get_unaligned_be +# define put_unaligned __put_unaligned_be +#endif -#endif /* __KERNEL__ */ #endif /* _ASM_MICROBLAZE_UNALIGNED_H */
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 6/10 microblaze: Copy bootfile from variables
Setup bootfile.
--- arch/microblaze/lib/board.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/microblaze/lib/board.c +4 -0
@@ -187,6 +187,10 @@ void board_init (void)uchar enetaddr[6 ];eth_getenv_enetaddr ("ethaddr" , enetaddr);printf ("MAC: %pM\n" , enetaddr); + +if ((s =getenv ("bootfile" )) !=NULL ) { +copy_filename (BootFile, s,sizeof (BootFile)); + }#endif /* main_loop */
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 7/10 microblaze: Remove debug saving value
Forget to remove debug code.
--- arch/microblaze/cpu/start.S | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/microblaze/cpu/start.S +0 -2
@@ -46,8 +46,6 @@ _start: addik r6, r0, 0x2 /* BIG/LITTLE endian offset */ swi r6, r0, 0 lbui r10, r0, 0 - swi r6, r0, 0x40 - swi r10, r0, 0x50 /* add opcode instruction for 32bit jump - 2 instruction imm & brai*/ addi r6, r0, 0xb0000000 /* hex b000 opcode imm */
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 8/10 microblaze: Setup MB vectors if feature is enable for u-boot
For example: Setup reset vectors if reset address is setup. Setup user exception vector if user exception is enabled
--- arch/microblaze/cpu/start.S | 33 +++++++++++++++++++++------------ 1 files changed, 21 insertions(+), 12 deletions(-)
arch/microblaze/cpu/start.S +21 -12
@@ -30,6 +30,12 @@ .text .global _start _start: + /* reserve registers: + * r10: Stores little/big endian offset for vectors + * r2: Stores imm opcode + * r3: Stores brai opcode + */ + mts rmsr, r0 /* disable cache */ addi r1, r0, CONFIG_SYS_INIT_SP_OFFSET addi r1, r1, -4 /* Decrement SP to top of memory */
@@ -47,21 +53,15 @@ _start: swi r6, r0, 0 lbui r10, r0, 0 - /* add opcode instruction for 32bit jump - 2 instruction imm & brai*/ - addi r6, r0, 0xb0000000 /* hex b000 opcode imm */ - swi r6, r0, 0x0 /* reset address */ - swi r6, r0, 0x8 /* user vector exception */ - swi r6, r0, 0x10 /* interrupt */ - swi r6, r0, 0x20 /* hardware exception */ - - addi r6, r0, 0xb8080000 /* hew b808 opcode brai*/ - swi r6, r0, 0x4 /* reset address */ - swi r6, r0, 0xC /* user vector exception */ - swi r6, r0, 0x14 /* interrupt */ - swi r6, r0, 0x24 /* hardware exception */ + /* add opcode instruction for 32bit jump - 2 instruction imm & brai */ + addi r2, r0, 0xb0000000 /* hex b000 opcode imm */ + addi r3, r0, 0xb8080000 /* hew b808 opcode brai */ #ifdef CONFIG_SYS_RESET_ADDRESS /* reset address */ + swi r2, r0, 0x0 /* reset address - imm opcode */ + swi r3, r0, 0x4 /* reset address - brai opcode */ + addik r6, r0, CONFIG_SYS_RESET_ADDRESS sw r6, r1, r0 lhu r7, r1, r0
@@ -88,6 +88,9 @@ _start: #ifdef CONFIG_SYS_USR_EXCEP /* user_vector_exception */ + swi r2, r0, 0x8 /* user vector exception - imm opcode */ + swi r3, r0, 0xC /* user vector exception - brai opcode */ + addik r6, r0, _exception_handler sw r6, r1, r0 /*
@@ -119,6 +122,9 @@ _start: #ifdef CONFIG_SYS_INTC_0 /* interrupt_handler */ + swi r2, r0, 0x10 /* interrupt - imm opcode */ + swi r3, r0, 0x14 /* interrupt - brai opcode */ + addik r6, r0, _interrupt_handler sw r6, r1, r0 lhu r7, r1, r10
@@ -129,6 +135,9 @@ _start: #endif /* hardware exception */ + swi r2, r0, 0x20 /* hardware exception - imm opcode */ + swi r3, r0, 0x24 /* hardware exception - brai opcode */ + addik r6, r0, _hw_exception_handler sw r6, r1, r0 lhu r7, r1, r10
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 9/10 microblaze: Save and restore first unused vector
Use one memory space to detect little/big endian platforms.
The first unused address(0x28) is used instead 0x0 address (reset vectors). Detection rewrited reset vector setup from first stage bootloader.
Workflow:
1. Store 0x28 to r7
2. Do little/big endian test
3. Restore r7 to 0x28
--- arch/microblaze/cpu/start.S | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/microblaze/cpu/start.S +4 -2
@@ -50,8 +50,10 @@ _start: * 4b) BIG endian - r10 contains 0x0 because 0x2 offset is on addr 0x3 */ addik r6, r0, 0x2 /* BIG/LITTLE endian offset */ - swi r6, r0, 0 - lbui r10, r0, 0 + lwi r7, r0, 0x28 + swi r6, r0, 0x28 /* used first unused MB vector */ + lbui r10, r0, 0x28 /* used first unused MB vector */ + swi r7, r0, 0x28 /* add opcode instruction for 32bit jump - 2 instruction imm & brai */ addi r2, r0, 0xb0000000 /* hex b000 opcode imm */
Signature · 1 line
1.5.5.6
Michal Simek
maintainerPATCH 10/10 microblaze: Clean up reset asm code
- Remove code copying
- Reset address is setup from first stage bootloader
- Support reset vector setup on little endian
--- arch/microblaze/cpu/start.S | 25 +++++-------------------- 1 files changed, 5 insertions(+), 20 deletions(-)
arch/microblaze/cpu/start.S +5 -20
@@ -66,26 +66,11 @@ _start: addik r6, r0, CONFIG_SYS_RESET_ADDRESS sw r6, r1, r0 - lhu r7, r1, r0 - shi r7, r0, 0x2 - shi r6, r0, 0x6 -/* - * Copy U-Boot code to CONFIG_SYS_TEXT_BASE - * solve problem with sbrk_base - */ -#if (CONFIG_SYS_RESET_ADDRESS != CONFIG_SYS_TEXT_BASE) - addi r4, r0, __end - addi r5, r0, __text_start - rsub r4, r5, r4 /* size = __end - __text_start */ - addi r6, r0, CONFIG_SYS_RESET_ADDRESS /* source address */ - addi r7, r0, 0 /* counter */ -4: - lw r8, r6, r7 - sw r8, r5, r7 - addi r7, r7, 0x4 - cmp r8, r4, r7 - blti r8, 4b -#endif + lhu r7, r1, r10 + rsubi r8, r10, 0x2 + sh r7, r0, r8 + rsubi r8, r10, 0x6 + sh r6, r0, r8 #endif #ifdef CONFIG_SYS_USR_EXCEP
Signature · 1 line
1.5.5.6
PATCH 5/10 microblaze: Fix unaligned.h for endians
In reply to Michal SimekQuoted 1 line · On Wednesday, August 31, 2011 04:35:16 Michal Simek wrote:
Based on ARM
unaligned.h.
can't you just include asm-generic/unaligned.h ? the ARM peeps are just being lazy at this point :P.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/4b9d5fea/attachment.pgp
Michal Simek
maintainerPATCH 5/10 microblaze: Fix unaligned.h for endians
Quoted 5 lines · Mike Frysinger
Quoted 1 line · On Wednesday, August 31, 2011 04:35:16 Michal Simek wrote:
Based on ARM
unaligned.h.can't you just include
asm-generic/unaligned.h? the ARM peeps are just being lazy at this point :P.
Can.
Thanks,
Michal
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian
PATCH 4/10 microblaze: Add netconsole support
In reply to Michal SimekQuoted 5 lines · On Wednesday, August 31, 2011 04:35:15 Michal Simek wrote:
arch/microblaze/lib/board.c +0
-0@@ -167,6 +167,12 @@ void board_init (void)/* Initialize stdio devices */ stdio_init ();
arch/microblaze/lib/board.c void board_init (void) · line 178
Quoted 10 lines
arch/microblaze/lib/board.c +6
-0+/* Initialize the jump table for applications */ +jumptable_init (); + +/* Initialize the console (after the relocation and devices init) */ +console_init_r (); +if ((s =getenv ("loadaddr" )) !=NULL ) { load_addr =simple_strtoul (s,NULL ,16 ); }
your summary doesnt seem to match what you're changing. the two things you're doing here should always be done regardless of netconsole.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/b019c7e2/attachment.pgp
Michal Simek
maintainerPATCH 4/10 microblaze: Add netconsole support
Quoted 7 lines · Mike Frysinger
Quoted 6 lines · On Wednesday, August 31, 2011 04:35:15 Michal Simek wrote:
arch/microblaze/lib/board.c +0
-0@@ -167,6 +167,12 @@ void board_init (void)/* Initialize stdio devices */ stdio_init ();
Quoted 12 lines
arch/microblaze/lib/board.c void board_init (void) · line 178
Quoted 9 lines
arch/microblaze/lib/board.c +6
-0+/* Initialize the jump table for applications */ +jumptable_init (); + +/* Initialize the console (after the relocation and devices init) */ +console_init_r (); +if ((s =getenv ("loadaddr" )) !=NULL ) { load_addr =simple_strtoul (s,NULL ,16 ); }your summary doesnt seem to match what you're changing. the two things you're doing here should always be done regardless of netconsole.
It is really old patch where the point was to get netconsole work. It is just initialize jumptable and setup correct console.
Fixed.
Thanks,
Michal
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian
PATCH 4/10 microblaze: Add netconsole support
In reply to Michal SimekDear Michal Simek,
Quoted 10 lines · In message <[email protected]> you wrote:
Signed-off-by Michal Simek <[email protected]>--- arch/microblaze/lib/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/microblaze/lib/board.c +0
-0
arch/microblaze/lib/board.c void board_init (void) · line 174
Quoted 8 lines
arch/microblaze/lib/board.c +5
-0@@ -167,6 +167,12 @@ void board_init (void)/* Initialize stdio devices */ stdio_init (); +/* Initialize the jump table for applications */ +jumptable_init (); + +/* Initialize the console (after the relocation and devices init) */ +console_init_r ();
2 x WARNING: space prohibited between function name and open parenthesis '('
Stop review here. Will you please run your patches through ckeckpatch _before_ submitting? Thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The IQ of the group is the lowest IQ of a member of the group divided by the number of people in the group.
PATCH 3/10 microblaze: Support flashes on lower addresses
In reply to Michal Simekarch/microblaze/lib/board.c init_fnc_t *init_sequence[] = { · line 89
Quoted 2 lines · On Wednesday, August 31, 2011 04:35:14 Michal Simek wrote:
arch/microblaze/lib/board.c +2
-0+extern char *__end; +extern char *__text_start;
if you're referring to symbols provided by a linker script, you should do:
extern char __end[];
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20110831/a2b56309/attachment.pgp
Michal Simek
maintainerPATCH 3/10 microblaze: Support flashes on lower addresses
Quoted 6 lines · Mike Frysinger
arch/microblaze/lib/board.c init_fnc_t *init_sequence[] = { · line 89
Quoted 2 lines · On Wednesday, August 31, 2011 04:35:14 Michal Simek wrote:
arch/microblaze/lib/board.c +2
-0+extern char *__end; +extern char *__text_start;if you're referring to symbols provided by a linker script, you should do:
extern char __end[];
fixed.
Thanks,
Michal
Signature · 4 lines
Michal Simek, Ing. (M.Eng) w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/ Microblaze U-BOOT custodian
PATCH 3/10 microblaze: Support flashes on lower addresses
In reply to Michal SimekDear Michal Simek,
Quoted 10 lines · In message <[email protected]> you wrote:
Signed-off-by Michal Simek <[email protected]>--- arch/microblaze/lib/board.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/microblaze/lib/board.c +0
-0
arch/microblaze/lib/board.c init_fnc_t *init_sequence[] = { · line 89
Quoted 6 lines
arch/microblaze/lib/board.c +3
-0@@ -84,6 +84,10 @@ init_fnc_t *init_sequence[] = { NULL, }; +unsigned long monitor_flash_len; +extern char *__end; +extern char *__text_start;
WARNING: externs should be avoided in .c files
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Q: Why do PCs have a reset button on the front? A: Because they are expected to run Microsoft operating systems.
PATCH 1/10 microblaze: Fix in/out_be8/16/32 functions
In reply to Michal SimekDear Michal Simek,
Quoted 2 lines · In message <[email protected]> you wrote:
Use inline functions instead of macros because
of typechecking.
I don't understand the rationale of this change.
arch/microblaze/include/asm/io.h line 52
Quoted 7 lines
arch/microblaze/include/asm/io.h +4
-3-#define in_8 (addr) readb (addr) -#define in_be16 (addr) readw (addr) -#define in_be32 (addr) readl (addr) +extern inline int in_8 (volatile unsigned char *addr) +{ +return readb (addr); +}
What;s the difference wether the type checking occurs for the in_8() call or for the readb() call?
Quoted 1 line
+extern inline int
in_be16(volatile unsigned short *addr)
Also, checkpatch says:
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #106: FILE: arch/microblaze/include/asm/io.h:49:
+extern inline int in_8(volatile unsigned char *addr)
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #111: FILE: arch/microblaze/include/asm/io.h:54:
+extern inline int in_be16(volatile unsigned short *addr)
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #119: FILE: arch/microblaze/include/asm/io.h:59:
+extern inline int in_be32(volatile unsigned int *addr)
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #124: FILE: arch/microblaze/include/asm/io.h:64:
+extern inline void out_8(volatile unsigned char *addr, char val)
WARNING: space prohibited between function name and open parenthesis '(' #126: FILE: arch/microblaze/include/asm/io.h:66:
+ outb (val, addr);
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #129: FILE: arch/microblaze/include/asm/io.h:69:
+extern inline void out_be16(volatile unsigned short *addr, short val)
WARNING: space prohibited between function name and open parenthesis '(' #131: FILE: arch/microblaze/include/asm/io.h:71:
+ outw (val, addr);
WARNING: Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt #134: FILE: arch/microblaze/include/asm/io.h:74:
+extern inline void out_be32(volatile unsigned int *addr, int val)
WARNING: space prohibited between function name and open parenthesis '(' #136: FILE: arch/microblaze/include/asm/io.h:76:
+ outl (val, addr);
total: 0 errors, 9 warnings, 41 lines checked
Please fix.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I believe you find life such a problem because you think there are the good people and the bad people. You're wrong, of course. There are, always and only, the bad people, but some of them are on oppo- site sides. - Terry Pratchett, _Guards! Guards!_