<div>Hi Sascha,</div><div><br></div><div>2011/3/16 Sascha Hauer <span dir="ltr"><<a href="mailto:s.hauer@pengutronix.de">s.hauer@pengutronix.de</a>></span></div><div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Julien,<br>
<br></blockquote><div><br></div><div>Well....it's Franck ;) I know that's a bit confusing......</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
The patch looks mostly ok. Only a few comments inline and some coding<br>
style nitpicks:<br>
<br>
- several trailing whitespaces<br>
- return is not a function (should be return 0 instead of return (0)<br>
- there should be no braces between a function and its arguments<br>
<br>
I think the included checkpatch script should catch most of them.<br>
<div class="im"><br>
<br>
> +<br>
> diff --git a/nios2/configs/generic_defconfig b/nios2/configs/generic_defconfig<br>
> new file mode 100644<br>
> index 0000000..76b69da<br>
> --- /dev/null<br>
> +++ b/nios2/configs/generic_defconfig<br>
<br>
</div>Please generate the config with make savedefconfig<br>
<div><div></div><div class="h5"><br>
> diff --git a/nios2/include/asm/barebox.h b/nios2/include/asm/barebox.h<br>
> new file mode 100644<br>
> index 0000000..2fcf31c<br>
> --- /dev/null<br>
> +++ b/nios2/include/asm/barebox.h<br>
> @@ -0,0 +1,47 @@<br>
> +/*<br>
> + * barebox - barebox.h Structure declarations for board specific data<br>
> + *<br>
> + * Copyright (c) 2005 <a href="http://blackfin.uclinux.org" target="_blank">blackfin.uclinux.org</a><br>
> + *<br>
> + * (C) Copyright 2000-2004<br>
> + * Wolfgang Denk, DENX Software Engineering, <a href="mailto:wd@denx.de">wd@denx.de</a>.<br>
> + *<br>
> + * See file CREDITS for list of people who contributed to this<br>
> + * project.<br>
> + *<br>
> + * This program is free software; you can redistribute it and/or<br>
> + * modify it under the terms of the GNU General Public License as<br>
> + * published by the Free Software Foundation; either version 2 of<br>
> + * the License, or (at your option) any later version.<br>
> + *<br>
> + * This program is distributed in the hope that it will be useful,<br>
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
> + * GNU General Public License for more details.<br>
> + *<br>
> + * You should have received a copy of the GNU General Public License<br>
> + * along with this program; if not, write to the Free Software<br>
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,<br>
> + * MA 02111-1307 USA<br>
> + */<br>
> +<br>
> +#ifndef _BAREBOX_H_<br>
> +#define _BAREBOX_H_ 1<br>
> +<br>
> +typedef struct bd_info {<br>
> + int bi_baudrate; /* serial console baudrate */<br>
> + unsigned long bi_ip_addr; /* IP Address */<br>
> + unsigned char bi_enetaddr[6]; /* Ethernet adress */<br>
> + unsigned long bi_arch_number; /* unique id for this board */<br>
> + unsigned long bi_boot_params; /* where this board expects params */<br>
> + unsigned long bi_memstart; /* start of DRAM memory */<br>
> + unsigned long bi_memsize; /* size of DRAM memory in bytes */<br>
> + unsigned long bi_flashstart; /* start of FLASH memory */<br>
> + unsigned long bi_flashsize; /* size of FLASH memory */<br>
> + unsigned long bi_flashoffset; /* reserved area for startup monitor */<br>
> +} bd_t;<br>
<br>
</div></div>This isn't used anywhere in this patch. Is it needed for passing data to<br>
Linux? If yes, ok, otherwise please remove it.<br></blockquote><div><br></div><div>This file is included bu include/common.h</div><div>Should I provide an empty file ?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
> diff --git a/nios2/include/asm/io.h b/nios2/include/asm/io.h<br>
> new file mode 100644<br>
> index 0000000..121405c<br>
> --- /dev/null<br>
> +++ b/nios2/include/asm/io.h<br>
> @@ -0,0 +1,130 @@<br>
> +/*<br>
> + * (C) Copyright 2004, Psyent Corporation <<a href="http://www.psyent.com" target="_blank">www.psyent.com</a>><br>
> + * Scott McNutt <<a href="mailto:smcnutt@psyent.com">smcnutt@psyent.com</a>><br>
> + *<br>
> + * See file CREDITS for list of people who contributed to this<br>
> + * project.<br>
> + *<br>
> + * This program is free software; you can redistribute it and/or<br>
> + * modify it under the terms of the GNU General Public License as<br>
> + * published by the Free Software Foundation; either version 2 of<br>
> + * the License, or (at your option) any later version.<br>
> + *<br>
> + * This program is distributed in the hope that it will be useful,<br>
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
> + * GNU General Public License for more details.<br>
> + *<br>
> + * You should have received a copy of the GNU General Public License<br>
> + * along with this program; if not, write to the Free Software<br>
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,<br>
> + * MA 02111-1307 USA<br>
> + */<br>
> +<br>
> +#ifndef __ASM_NIOS2_IO_H_<br>
> +#define __ASM_NIOS2_IO_H_<br>
> +<br>
> +static inline void sync(void)<br>
> +{<br>
> + __asm__ __volatile__ ("sync" : : : "memory");<br>
> +}<br>
> +<br>
> +/*<br>
> + * Given a physical address and a length, return a virtual address<br>
> + * that can be used to access the memory range with the caching<br>
> + * properties specified by "flags".<br>
> + */<br>
> +#define MAP_NOCACHE (0)<br>
> +#define MAP_WRCOMBINE (0)<br>
> +#define MAP_WRBACK (0)<br>
> +#define MAP_WRTHROUGH (0)<br>
> +<br>
> +static inline void *<br>
> +map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)<br>
> +{<br>
> + return (void *)paddr;<br>
> +}<br>
> +<br>
> +/*<br>
> + * Take down a mapping set up by map_physmem().<br>
> + */<br>
> +static inline void unmap_physmem(void *vaddr, unsigned long flags)<br>
> +{<br>
> +<br>
> +}<br>
> +<br>
> +static inline phys_addr_t virt_to_phys(void * vaddr)<br>
> +{<br>
> + return (phys_addr_t)(vaddr);<br>
> +}<br>
> +<br>
> +extern unsigned char inb (unsigned char *port);<br>
> +extern unsigned short inw (unsigned short *port);<br>
> +extern unsigned inl (unsigned port);<br>
> +<br>
> +#define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v))<br>
> +#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))<br>
> +#define __raw_writel(v,a) (*(volatile unsigned int *)(a) = (v))<br>
> +<br>
> +#define __raw_readb(a) (*(volatile unsigned char *)(a))<br>
> +#define __raw_readw(a) (*(volatile unsigned short *)(a))<br>
> +#define __raw_readl(a) (*(volatile unsigned int *)(a))<br>
> +<br>
> +#define readb(addr)\<br>
> + ({unsigned char val;\<br>
> + asm volatile( "ldbio %0, 0(%1)" :"=r"(val) : "r" (addr)); val;})<br>
> +#define readw(addr)\<br>
> + ({unsigned short val;\<br>
> + asm volatile( "ldhio %0, 0(%1)" :"=r"(val) : "r" (addr)); val;})<br>
> +#define readl(addr)\<br>
> + ({unsigned long val;\<br>
> + asm volatile( "ldwio %0, 0(%1)" :"=r"(val) : "r" (addr)); val;})<br>
> +<br>
> +#define writeb(val,addr)\<br>
> + asm volatile ("stbio %0, 0(%1)" : : "r" (val), "r" (addr))<br>
> +#define writew(val,addr)\<br>
> + asm volatile ("sthio %0, 0(%1)" : : "r" (val), "r" (addr))<br>
> +#define writel(val,addr)\<br>
> + asm volatile ("stwio %0, 0(%1)" : : "r" (val), "r" (addr))<br>
> +<br>
> +#define inb(addr) readb(addr)<br>
> +#define inw(addr) readw(addr)<br>
> +#define inl(addr) readl(addr)<br>
> +#define outb(val, addr) writeb(val,addr)<br>
> +#define outw(val, addr) writew(val,addr)<br>
> +#define outl(val, addr) writel(val,addr)<br>
<br>
</div></div>We won't need this in barebox environment. We should just stick to<br>
read*/write*<br></blockquote><div><br></div><div>done.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
> diff --git a/nios2/include/asm/nios2-io.h b/nios2/include/asm/nios2-io.h<br>
> new file mode 100644<br>
> index 0000000..c20885b<br>
> --- /dev/null<br>
> +++ b/nios2/include/asm/nios2-io.h<br>
> @@ -0,0 +1,182 @@<br>
> +/*<br>
> + * (C) Copyright 2004, Psyent Corporation <<a href="http://www.psyent.com" target="_blank">www.psyent.com</a>><br>
> + * Scott McNutt <<a href="mailto:smcnutt@psyent.com">smcnutt@psyent.com</a>><br>
> + *<br>
> + * See file CREDITS for list of people who contributed to this<br>
> + * project.<br>
> + *<br>
> + * This program is free software; you can redistribute it and/or<br>
> + * modify it under the terms of the GNU General Public License as<br>
> + * published by the Free Software Foundation; either version 2 of<br>
> + * the License, or (at your option) any later version.<br>
> + *<br>
> + * This program is distributed in the hope that it will be useful,<br>
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>
> + * GNU General Public License for more details.<br>
> + *<br>
> + * You should have received a copy of the GNU General Public License<br>
> + * along with this program; if not, write to the Free Software<br>
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,<br>
> + * MA 02111-1307 USA<br>
> + */<br>
> +<br>
> +/*************************************************************************<br>
> + * Altera Nios2 Standard Peripherals<br>
> + ************************************************************************/<br>
> +<br>
> +#ifndef __NIOS2IO_H__<br>
> +#define __NIOS2IO_H__<br>
> +<br>
> +/*------------------------------------------------------------------------<br>
> + * UART (<a href="http://www.altera.com/literature/ds/ds_nios_uart.pdf" target="_blank">http://www.altera.com/literature/ds/ds_nios_uart.pdf</a>)<br>
> + *----------------------------------------------------------------------*/<br>
> +typedef volatile struct nios_uart_t {<br>
> + unsigned rxdata; /* Rx data reg */<br>
> + unsigned txdata; /* Tx data reg */<br>
> + unsigned status; /* Status reg */<br>
> + unsigned control; /* Control reg */<br>
> + unsigned divisor; /* Baud rate divisor reg */<br>
> + unsigned endofpacket; /* End-of-packet reg */<br>
> +}nios_uart_t;<br>
<br>
</div></div>Please do not typedef struct types. Also, the volatile is unnecessary.<br>
<font color="#888888"><br></font></blockquote><div><br></div><div>done.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><font color="#888888">
--<br>
Pengutronix e.K. | |<br>
Industrial Linux Solutions | <a href="http://www.pengutronix.de/" target="_blank">http://www.pengutronix.de/</a> |<br>
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |<br>
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |<br></font></blockquote><div><br></div><div>Franck.</div></div><br></div>