Re: [U-Boot] [PATCH v6 1/7] those files are jz4740 base files

2011-03-22 Thread Xiangfu Liu
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/15/2011 10:38 AM, Shinya Kuribayashi wrote:
 Please pay more attention to coding style issues.
 - Comments with multiple lines
 - Trailing whitespaces
 - Inconsistent tab and space usages
 - Follow the basic Linux CodingStyle guide
 
 and so on.

thanks for your patch. I will fix the others.
by the way is there a tools can check those things?

- -- 
Best Regards
Xiangfu Liu
http://www.openmobilefree.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2IWFYACgkQRRAEFRxkgLRD6gCdHkGTEkkR3yRPDwUBIr6xzGnq
7sgAmQFtIiOHuXlJ5iIkZLM7tIOL6H62
=OrTO
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] those files are jz4740 base files

2011-03-22 Thread Xiangfu Liu
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 03/15/2011 10:26 AM, Shinya Kuribayashi wrote:
 +++ b/arch/mips/cpu/xburst/jz_serial.c
 [...]
  +/*
  + * serial_init - initialize a channel
  + *
  + * This routine initializes the number of data bits, parity
  + * and set the selected baud rate. Interrupts are disabled.
  + * Set the modem control signals if the option is selected.
  + *
  + * RETURNS: N/A
  + */
  +struct jz4740_uart *uart = (struct jz4740_uart *) CONFIG_SYS_UART_BASE;
  +
 Can we make this static?

yes. sure. thanks for point out

- -- 
Best Regards
Xiangfu Liu
http://www.openmobilefree.net
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2IWHcACgkQRRAEFRxkgLRs5wCfftxO5qxhizl9V//tIKZu7qZz
F68AnjWK9zwRCKcH1jtGlMF5bblGNZDJ
=CxrY
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] those files are jz4740 base files

2011-03-14 Thread Shinya Kuribayashi
On 02/28/2011 03:57 PM, Xiangfu Liu wrote:
 diff --git a/arch/mips/cpu/xburst/jz_serial.c 
 b/arch/mips/cpu/xburst/jz_serial.c
 new file mode 100644
 index 000..65ce993
 --- /dev/null
 +++ b/arch/mips/cpu/xburst/jz_serial.c
[...]
 +/*
 + * serial_init - initialize a channel
 + *
 + * This routine initializes the number of data bits, parity
 + * and set the selected baud rate. Interrupts are disabled.
 + * Set the modem control signals if the option is selected.
 + *
 + * RETURNS: N/A
 + */
 +struct jz4740_uart *uart = (struct jz4740_uart *) CONFIG_SYS_UART_BASE;
 +

Can we make this static?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 1/7] those files are jz4740 base files

2011-03-14 Thread Shinya Kuribayashi
On 02/28/2011 03:57 PM, Xiangfu Liu wrote:
  arch/mips/cpu/xburst/Makefile|   50 +++
  arch/mips/cpu/xburst/config.mk   |   33 ++
  arch/mips/cpu/xburst/cpu.c   |  160 
  arch/mips/cpu/xburst/jz4740.c|  264 
  arch/mips/cpu/xburst/jz_serial.c |  114 +
  arch/mips/cpu/xburst/start.S |  160 
  arch/mips/cpu/xburst/start_spl.S |   63 +++
  arch/mips/cpu/xburst/timer.c |  167 
  arch/mips/cpu/xburst/usbboot.S   |  841 
 ++
  9 files changed, 1852 insertions(+), 0 deletions(-)
  create mode 100644 arch/mips/cpu/xburst/Makefile
  create mode 100644 arch/mips/cpu/xburst/config.mk
  create mode 100644 arch/mips/cpu/xburst/cpu.c
  create mode 100644 arch/mips/cpu/xburst/jz4740.c
  create mode 100644 arch/mips/cpu/xburst/jz_serial.c
  create mode 100644 arch/mips/cpu/xburst/start.S
  create mode 100644 arch/mips/cpu/xburst/start_spl.S
  create mode 100644 arch/mips/cpu/xburst/timer.c
  create mode 100644 arch/mips/cpu/xburst/usbboot.S

Please pay more attention to coding style issues.
- Comments with multiple lines
- Trailing whitespaces
- Inconsistent tab and space usages
- Follow the basic Linux CodingStyle guide

and so on.

Here's quick fixes on 1/7 part.  2/7..7/7 should be checked as well.

diff --git a/arch/mips/cpu/xburst/Makefile b/arch/mips/cpu/xburst/Makefile
index a9a6e77..6d6ffb7 100644
--- a/arch/mips/cpu/xburst/Makefile
+++ b/arch/mips/cpu/xburst/Makefile
@@ -26,8 +26,8 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)lib$(CPU).o
 
 START  = start.o
-SOBJS-y= 
-COBJS-y = cpu.o timer.o jz_serial.o 
+SOBJS-y=
+COBJS-y= cpu.o timer.o jz_serial.o
 
 COBJS-$(CONFIG_JZ4740) += jz4740.o
 
diff --git a/arch/mips/cpu/xburst/cpu.c b/arch/mips/cpu/xburst/cpu.c
index 5eb047d..43e8c3d 100644
--- a/arch/mips/cpu/xburst/cpu.c
+++ b/arch/mips/cpu/xburst/cpu.c
@@ -40,7 +40,7 @@
:   \
: i (op), R (*(unsigned char *)(addr)))
 
-#if !defined (CONFIG_NAND_SPL)  !defined (CONFIG_MSC_SPL) 
+#if !defined (CONFIG_NAND_SPL)  !defined (CONFIG_MSC_SPL)
 
 void __attribute__((weak)) _machine_restart(void)
 {
@@ -79,7 +79,7 @@ void flush_cache(ulong start_addr, ulong size)
unsigned long addr = start_addr  ~(lsize - 1);
unsigned long aend = (start_addr + size - 1)  ~(lsize - 1);
 
-   for (;addr = aend;addr += lsize) {
+   for (;addr = aend; addr += lsize) {
cache_op(Hit_Writeback_Inv_D, addr);
cache_op(Hit_Invalidate_I, addr);
}
@@ -91,7 +91,7 @@ void flush_dcache_range(ulong start_addr, ulong stop)
unsigned long addr = start_addr  ~(lsize - 1);
unsigned long aend = (stop - 1)  ~(lsize - 1);
 
-   for (;addr = aend;addr += lsize)
+   for (;addr = aend; addr += lsize)
cache_op(Hit_Writeback_Inv_D, addr);
 }
 
@@ -101,7 +101,7 @@ void invalidate_dcache_range(ulong start_addr, ulong stop)
unsigned long addr = start_addr  ~(lsize - 1);
unsigned long aend = (stop - 1)  ~(lsize - 1);
 
-   for (;addr = aend;addr += lsize)
+   for (;addr = aend; addr += lsize)
cache_op(Hit_Invalidate_D, addr);
 }
 
@@ -145,7 +145,7 @@ void flush_dcache_all(void)
 {
u32 addr;
 
-   for (addr = KSEG0; addr  KSEG0 + CONFIG_SYS_DCACHE_SIZE; 
+   for (addr = KSEG0; addr  KSEG0 + CONFIG_SYS_DCACHE_SIZE;
 addr += CONFIG_SYS_CACHELINE_SIZE) {
cache_op(Index_Writeback_Inv_D, addr);
}
diff --git a/arch/mips/cpu/xburst/jz4740.c b/arch/mips/cpu/xburst/jz4740.c
index aedee52..63952b7 100644
--- a/arch/mips/cpu/xburst/jz4740.c
+++ b/arch/mips/cpu/xburst/jz4740.c
@@ -27,18 +27,19 @@ void enable_interrupts(void)
 {
 }
 
-int disable_interrupts(void) 
+int disable_interrupts(void)
 {
return 0;
 }
 
-/* PLL output clock = EXTAL * NF / (NR * NO)
+/*
+ * PLL output clock = EXTAL * NF / (NR * NO)
  * NF = FD + 2, NR = RD + 2
  * NO = 1 (if OD = 0), NO = 2 (if OD = 1 or 2), NO = 4 (if OD = 3)
  */
 void pll_init(void)
 {
-   struct jz4740_cpm * cpm = (struct jz4740_cpm *) JZ4740_CPM_BASE;
+   struct jz4740_cpm *cpm = (struct jz4740_cpm *) JZ4740_CPM_BASE;
 
register unsigned int cfcr, plcr1;
int n2FR[33] = {
@@ -56,7 +57,7 @@ void pll_init(void)
(n2FR[div[3]]  CPM_CPCCR_MDIV_BIT) |
(n2FR[div[4]]  CPM_CPCCR_LDIV_BIT);
 
-   pllout2 = (cfcr  CPM_CPCCR_PCS) ? 
+   pllout2 = (cfcr  CPM_CPCCR_PCS) ?
CONFIG_SYS_CPU_SPEED : (CONFIG_SYS_CPU_SPEED / 2);
 
/* Init USB Host clock, pllout2 must be n*48MHz */
@@ -65,9 +66,9 @@ void pll_init(void)
nf = CONFIG_SYS_CPU_SPEED * 2 / CONFIG_SYS_EXTAL;
plcr1 = ((nf - 2)  CPM_CPPCR_PLLM_BIT) | /* FD */
(0  CPM_CPPCR_PLLN_BIT) | /* RD=0, NR=2 */
-   (0  CPM_CPPCR_PLLOD_BIT) |/* OD=0, NO=1 */
-   (0x20  

[U-Boot] [PATCH v6 1/7] those files are jz4740 base files

2011-02-27 Thread Xiangfu Liu
those files are jz4740 base files

  this xburst jz4740 cpu have one feature is Boot From USB, there is a 
  small rom in jz4740, the cpu can boot to this small rom, then init cpu 
  and USB module, then we can send 8KB bin file to the cpu cache by using 
  'xbboot' or 'usbboot', Debian package named xburst-tools.

for more info about Ingenic Xburst JZ4740
  http://www.ingenic.cn/eng/default.aspx
  http://www.linux-mips.org/wiki/Ingenic
  http://en.qi-hardware.com

Signed-off-by: Xiangfu Liu xian...@openmobilefree.net
Acked-by: Daniel z...@ingenic.cn
---
Changes for v2:
   - add jz4740 soc description

Changes for v3:
   - remove the ENDIANNESS in config.mk
   - don't breaks the 80-charcter-wide rule
   - get rid of #if 0
   - use proper I/O accessors to access registers.
   - remove C++ comments, cleanup code style.

Changes for v6:
   - delete all base + offset. using C struct and proper I/O accressors

 arch/mips/cpu/xburst/Makefile|   50 +++
 arch/mips/cpu/xburst/config.mk   |   33 ++
 arch/mips/cpu/xburst/cpu.c   |  160 
 arch/mips/cpu/xburst/jz4740.c|  264 
 arch/mips/cpu/xburst/jz_serial.c |  114 +
 arch/mips/cpu/xburst/start.S |  160 
 arch/mips/cpu/xburst/start_spl.S |   63 +++
 arch/mips/cpu/xburst/timer.c |  167 
 arch/mips/cpu/xburst/usbboot.S   |  841 ++
 9 files changed, 1852 insertions(+), 0 deletions(-)
 create mode 100644 arch/mips/cpu/xburst/Makefile
 create mode 100644 arch/mips/cpu/xburst/config.mk
 create mode 100644 arch/mips/cpu/xburst/cpu.c
 create mode 100644 arch/mips/cpu/xburst/jz4740.c
 create mode 100644 arch/mips/cpu/xburst/jz_serial.c
 create mode 100644 arch/mips/cpu/xburst/start.S
 create mode 100644 arch/mips/cpu/xburst/start_spl.S
 create mode 100644 arch/mips/cpu/xburst/timer.c
 create mode 100644 arch/mips/cpu/xburst/usbboot.S

diff --git a/arch/mips/cpu/xburst/Makefile b/arch/mips/cpu/xburst/Makefile
new file mode 100644
index 000..a9a6e77
--- /dev/null
+++ b/arch/mips/cpu/xburst/Makefile
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2000-2006
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(CPU).o
+
+START  = start.o
+SOBJS-y= 
+COBJS-y = cpu.o timer.o jz_serial.o 
+
+COBJS-$(CONFIG_JZ4740) += jz4740.o
+
+SRCS   := $(START:.o=.S) $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
+START  := $(addprefix $(obj),$(START))
+
+all:   $(obj).depend $(START) $(LIB)
+
+$(LIB):$(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/arch/mips/cpu/xburst/config.mk b/arch/mips/cpu/xburst/config.mk
new file mode 100644
index 000..fc9b255
--- /dev/null
+++ b/arch/mips/cpu/xburst/config.mk
@@ -0,0 +1,33 @@
+#
+# (C) Copyright 2003
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | 
cut -d. -f2)
+MIPSFLAGS:=$(shell \
+if [ $v -lt 14 ]; then \
+   echo -mcpu=4kc; \
+else \
+   echo -march=4kc -mtune=4kc; \
+fi)
+
+MIPSFLAGS += -mabicalls -mips32
+
+PLATFORM_CPPFLAGS +=