Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-22 Thread Prafulla Wadaskar
 

 -Original Message-
 From: u-boot-boun...@lists.denx.de 
 [mailto:u-boot-boun...@lists.denx.de] On Behalf Of Prafulla Wadaskar
 Sent: Wednesday, May 20, 2009 2:30 PM
 To: Wolfgang Denk
 Cc: u-boot@lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; 
 Ronen Shitrit
 Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support
 
 Dear Wolfgand Denk
 
 Thanks for your review comments 
 
  -Original Message-
  From: Wolfgang Denk [mailto:w...@denx.de]
  Sent: Wednesday, May 20, 2009 3:29 AM
  To: Prafulla Wadaskar
  Cc: u-boot@lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Ronen 
  Shitrit
  Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support
  
  Dear Prafulla Wadaskar,
  
  In message
  1242763678-13724-1-git-send-email-prafu...@marvell.com you wrote:
   
   Kirkwood family controllers are highly integrated SOCs based on
   Feroceon-88FR131/Sheeva-88SV131 cpu core.
  ...
   +/*
   + * Window Size
   + * Used with the Base register to set the address window
  size and location.
   + * Must be programmed from LSB to MSB as sequence of 1’s
  followed
   +by
   + * sequence of 0’s. The number of 1’s specifies the
  size of the
   +window in
   + * 64 KByte granularity (e.g., a value of 0x00FF specifies
  256 = 16 MByte).
   + * NOTE: A value of 0x0 specifies 64-KByte size.
   + */
  
  You have a number of strange special characters here. 
 Please try and 
  restrict yourself to plain ASCII text in normal C comments.
 I checked the patch that I send across and associated source code too.
 I didn’t find the above special chars in it I am using 
 git-send-email to send the patches and vim as my editor I 
 wonder how these special characters appeared in the patch 
 I will check this issue with my system admin
Hi Wolfgang Denk
We have discovered the root cause of this problem
I was using apostrophes, those were getting converted to weird 
characters by the mailer software (just a guess).
I have replaced then with strings (i.e. 1's with ones and 0's with 
zeros)
Of course I will not release a new patch (V11) for this :-)
but I have corrected at my end and will reflect in next patch after review 
feedback for V10

Thanks for pointing this...

Regards..
Prafulla . .
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Prafulla Wadaskar
Dear Wolfgand Denk

Thanks for your review comments 

 -Original Message-
 From: Wolfgang Denk [mailto:w...@denx.de] 
 Sent: Wednesday, May 20, 2009 3:29 AM
 To: Prafulla Wadaskar
 Cc: u-boot@lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; 
 Ronen Shitrit
 Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support
 
 Dear Prafulla Wadaskar,
 
 In message 
 1242763678-13724-1-git-send-email-prafu...@marvell.com you wrote:
  
  Kirkwood family controllers are highly integrated SOCs based on 
  Feroceon-88FR131/Sheeva-88SV131 cpu core.
 ...
  +/*
  + * Window Size
  + * Used with the Base register to set the address window 
 size and location.
  + * Must be programmed from LSB to MSB as sequence of 1’s 
 followed 
  +by
  + * sequence of 0’s. The number of 1’s specifies the 
 size of the 
  +window in
  + * 64 KByte granularity (e.g., a value of 0x00FF specifies 
 256 = 16 MByte).
  + * NOTE: A value of 0x0 specifies 64-KByte size.
  + */
 
 You have a number of strange special characters here. Please 
 try and restrict yourself to plain ASCII text in normal C comments.
I checked the patch that I send across and associated source code too.
I didn’t find the above special chars in it
I am using git-send-email to send the patches and vim as my editor
I wonder how these special characters appeared in the patch 
I will check this issue with my system admin

 
  +   for (i = 0; i  (sizeval / 0x1); i++) {
  +   j |= (1  i);
  +   }
 
 No curly braces for single line statements, please.
Sorry missed this one, corrected..

  +   struct kwwin_registers *winregs = (struct kwwin_registers 
  +*)KW_CPU_WIN_BASE;
 
 Line too long.
 
  +/*
  + * kw_config_gpio - GPIO configuration  */ void kw_config_gpio(u32 
  +gpp0_oe_val, u32 gpp1_oe_val, u32 gpp0_oe, u32 gpp1_oe) {
  +   struct kwgpio_registers *gpio0reg = (struct 
 kwgpio_registers *)KW_GPIO0_BASE;
  +   struct kwgpio_registers *gpio1reg = (struct kwgpio_registers 
  +*)KW_GPIO1_BASE;
 
 More too long lines. Pleasse check everywhere.
Generally I execute Lindent, I missed it this time, I will do it

  +   writel(gpp0_oe, (u32)gpio0reg-oe);
  +   writel(gpp1_oe, (u32)gpio1reg-oe);
 
 Why are you using these casts here? The whole purpose of 
 using a C struct to access device registers is to enable type 
 checking by the C compiler, but you sabotage this with these 
 casts. Please don't do that. This comment applies to the whole patch.
This was done to remove build warnings in some context
I will remove them

 
 ...
  +   cntmrctrl = readl(CNTMR_CTRL_REG);
  +   cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR); /* 
 enable cnt\timer */
 
 Are you sure you want to have a TAB character in this comment? What's
 cnt  imer ? :-)
Not really :-) it was for counter/timer, slash was a confusion. Removed

 
  diff --git a/drivers/serial/serial.c 
 b/drivers/serial/serial.c index 
  966df9a..dd5f332 100644
  --- a/drivers/serial/serial.c
  +++ b/drivers/serial/serial.c
  @@ -27,6 +27,9 @@
   #ifdef CONFIG_NS87308
   #include ns87308.h
   #endif
  +#ifdef CONFIG_KIRKWOOD
  +#include asm/arch/kirkwood.h
  +#endif
 
 What exactly is this needed for?
CONFIG_SYS_NS16550_CLK is defined as CONFIG_SYS_TCLK
which defined in the soc specific header file

In my earlier versions I had included arch specific header file in board_config 
header file
But in the review comments it has asked to remove
Hence above include is done
 
  +   writel(0x0002, KW_REG_SPI_CTRL);
  +   /* program spi clock prescaller using max_hz */
  +   data = ((CONFIG_SYS_TCLK / 2) / max_hz)  0x000f;
  +   debug(data = 0x%08x \n, data);
  +   writel(0x0210 | data, KW_REG_SPI_CONFIG);
  +   writel(0x0001, KW_REG_SPI_IRQ_CAUSE);
  +   writel(0x, KW_REG_SPI_IRQ_MASK);
 
 What does these magic constants mean?
 
  +   /* program mpp registers to select  SPI_CSn */
  +   if (cs)
  +   writel((readl((u32)mppreg[0])  0x0fff) |
  +  0x2000, (u32)mppreg[0]);
  +   else
  +   writel((readl((u32)mppreg[0])  0xfff0) |
  +  0x0002, (u32)mppreg[0]);
 
 Ot these?
I will provide definitions for magic numbers

 
  +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, 
 const void *dout,
  +void *din, unsigned long flags)
 ...
  +   for (tm = 0, isread = 0; tm  KW_SPI_TIMEOUT; ++tm) {
  +   if (readl(KW_REG_SPI_IRQ_CAUSE)) {
  +   isread = 1;
  +   tmpdin = readl(KW_REG_SPI_DATA_IN);
  +   debug
  +   (*** spi_xfer: din %08X 
 ... %08x read\n,
  +din, tmpdin);
 
 Indentation by TABs only, please.
Indentation is done by Lindent.
Do you mean to do it manually?

 
  +#define INTREG_BASE0xd000
  +#define KW_REGISTER(x) (KW_REGS_PHY_BASE + x)
  +#define KW_OFFSET_REG  (INTREG_BASE

Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Stefan Roese
Hi Prafulla,

On Tuesday 19 May 2009 22:07:58 Prafulla Wadaskar wrote:
 Kirkwood family controllers are highly integrated SOCs
 based on Feroceon-88FR131/Sheeva-88SV131 cpu core.

I would like to give your Kirkwood support a try and start compiling the 
latest version before trying to port a custom board. Now I'm failing to 
compile the latest version posted on the list. Most likely I missed some 
patches or applied them to the wrong git repository.

I tried it on u-boot/next and on u-boot-arm/next. Both failed. I applied those 
patches:

[PATCH v8] Marvell Kirkwood family SOC support
[PATCH v9] Marvell MV88F6281GTW_GE Board support
[PATCH v3] Gbe Controller driver support for kirkwood SOCs

It would be great if you could tell me what I am missing here (additional 
patches or wrong repository?).

Here the error messages from building with those 3 patches on top of u-boot-
arm/next:

[ste...@stefan-desktop u-boot-arm (kirkwood)]$ ./MAKEALL mv88f6281gtw_ge
Configuring for mv88f6281gtw_ge board...
mpp.c: In function 'kirkwood_mpp_conf':
mpp.c:53: warning: unused variable 'gpio_mode'
kirkwood_egiga.c: In function 'smi_reg_read':
kirkwood_egiga.c:66: warning: implicit declaration of function 'readl'
kirkwood_egiga.c:98: warning: implicit declaration of function 'writel'
kirkwood_egiga.c: In function 'set_dram_access':
kirkwood_egiga.c:451: warning: implicit declaration of function 'kw_sdram_bar'
kirkwood_egiga.c:452: warning: implicit declaration of function 'kw_sdram_bs'
kirkwood_egiga.c: In function 'kirkwood_egiga_initialize':
kirkwood_egiga.c:1593: error: 'KW_EGIGA0_BASE' undeclared (first use in this 
function)
kirkwood_egiga.c:1593: error: (Each undeclared identifier is reported only 
once
kirkwood_egiga.c:1593: error: for each function it appears in.)
kirkwood_egiga.c:1597: error: 'KW_EGIGA1_BASE' undeclared (first use in this 
function)
kirkwood_egiga.c:1610: warning: implicit declaration of function 
'get_random_hex'


Thanks.

Best regards,
Stefan

=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Prafulla Wadaskar
 

 -Original Message-
 From: Stefan Roese [mailto:s...@denx.de] 
 Sent: Wednesday, May 20, 2009 5:40 PM
 To: u-boot@lists.denx.de
 Cc: Prafulla Wadaskar; Ashish Karkare; Prabhanjan Sarnaik; 
 Ronen Shitrit
 Subject: Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support
 
 Hi Prafulla,
 
 On Tuesday 19 May 2009 22:07:58 Prafulla Wadaskar wrote:
  Kirkwood family controllers are highly integrated SOCs based on 
  Feroceon-88FR131/Sheeva-88SV131 cpu core.
 
 I would like to give your Kirkwood support a try and start 
 compiling the latest version before trying to port a custom 
 board. Now I'm failing to compile the latest version posted 
 on the list. Most likely I missed some patches or applied 
 them to the wrong git repository.

Thanks Stefan, your efforts will help me a lot

 
 I tried it on u-boot/next and on u-boot-arm/next. Both 
I have used u-boot-arm/next pls use the same.

 failed. I applied those
 patches:
 
 [PATCH v8] Marvell Kirkwood family SOC support [PATCH v9] 
 Marvell MV88F6281GTW_GE Board support [PATCH v3] Gbe 
 Controller driver support for kirkwood SOCs
 
 It would be great if you could tell me what I am missing here 
 (additional patches or wrong repository?).
You will need additional two patches as mentioned below
http://git.denx.de/?p=u-boot/u-boot-blackfin.git;a=commit;h=12cedeb9589ef1203e3308e80b11e5ee73261ced
http://lists.denx.de/pipermail/u-boot/2009-May/052905.html

Apart from this pls add below line to drivers/net/kirkwood_egiga.c remove below 
mentioned errors
#include asm/arch/kirkwood.h

I hope build will be through... Best of Luck

Regards..
Prafulla . .

 
 Here the error messages from building with those 3 patches on 
 top of u-boot-
 arm/next:
 
 [ste...@stefan-desktop u-boot-arm (kirkwood)]$ ./MAKEALL 
 mv88f6281gtw_ge Configuring for mv88f6281gtw_ge board...
 mpp.c: In function 'kirkwood_mpp_conf':
 mpp.c:53: warning: unused variable 'gpio_mode'
 kirkwood_egiga.c: In function 'smi_reg_read':
 kirkwood_egiga.c:66: warning: implicit declaration of function 'readl'
 kirkwood_egiga.c:98: warning: implicit declaration of 
 function 'writel'
 kirkwood_egiga.c: In function 'set_dram_access':
 kirkwood_egiga.c:451: warning: implicit declaration of 
 function 'kw_sdram_bar'
 kirkwood_egiga.c:452: warning: implicit declaration of 
 function 'kw_sdram_bs'
 kirkwood_egiga.c: In function 'kirkwood_egiga_initialize':
 kirkwood_egiga.c:1593: error: 'KW_EGIGA0_BASE' undeclared 
 (first use in this
 function)
 kirkwood_egiga.c:1593: error: (Each undeclared identifier is 
 reported only once
 kirkwood_egiga.c:1593: error: for each function it appears in.)
 kirkwood_egiga.c:1597: error: 'KW_EGIGA1_BASE' undeclared 
 (first use in this
 function)
 kirkwood_egiga.c:1610: warning: implicit declaration of 
 function 'get_random_hex'
 
 
 Thanks.
 
 Best regards,
 Stefan
 
 =
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: 
 off...@denx.de 
 =
 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Stefan Roese
On Wednesday 20 May 2009 15:40:00 Prafulla Wadaskar wrote:
  I would like to give your Kirkwood support a try and start
  compiling the latest version before trying to port a custom
  board. Now I'm failing to compile the latest version posted
  on the list. Most likely I missed some patches or applied
  them to the wrong git repository.

 Thanks Stefan, your efforts will help me a lot

Sure. I'll try to help out if possible. But I'm only starting into this 
project right now. So please don't expect any real output soon. But I 
definitely can give some feedback...

  I tried it on u-boot/next and on u-boot-arm/next. Both

 I have used u-boot-arm/next pls use the same.

OK, understood.

  failed. I applied those
  patches:
 
  [PATCH v8] Marvell Kirkwood family SOC support [PATCH v9]
  Marvell MV88F6281GTW_GE Board support [PATCH v3] Gbe
  Controller driver support for kirkwood SOCs
 
  It would be great if you could tell me what I am missing here
  (additional patches or wrong repository?).

 You will need additional two patches as mentioned below
 http://git.denx.de/?p=u-boot/u-boot-blackfin.git;a=commit;h=12cedeb9589ef12
03e3308e80b11e5ee73261ced
 http://lists.denx.de/pipermail/u-boot/2009-May/052905.html

 Apart from this pls add below line to drivers/net/kirkwood_egiga.c remove
 below mentioned errors #include asm/arch/kirkwood.h

 I hope build will be through... Best of Luck

Yes, this works. Thanks a lot.

Best regards,
Stefan

=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Prafulla Wadaskar
  
   +#define INTREG_BASE  0xd000
   +#define KW_REGISTER(x)   (KW_REGS_PHY_BASE + x)
   +#define KW_OFFSET_REG(INTREG_BASE + 0x20080)
   +
   +/* undocumented registers */
   +#define KW_REG_UNDOC_0x1470  (KW_REGISTER(0x1470))
   +#define KW_REG_UNDOC_0x1478  (KW_REGISTER(0x1478))
   +
   +#define KW_UART0_BASE(KW_REGISTER(0x12000))
   +#define KW_UART1_BASE(KW_REGISTER(0x13000))
   +#define KW_MPP_BASE  (KW_REGISTER(0x1))
   +#define KW_GPIO0_BASE(KW_REGISTER(0x10100))
   +#define KW_GPIO1_BASE(KW_REGISTER(0x10140))
   +#define KW_CPU_WIN_BASE  (KW_REGISTER(0x2))
   +#define KW_CPU_REG_BASE  (KW_REGISTER(0x20100))
   +#define KW_TIMER_BASE(KW_REGISTER(0x20300))
   +#define KW_REG_PCIE_BASE (KW_REGISTER(0x4))
   +#define KW_EGIGA0_BASE   (KW_REGISTER(0x72000))
   +#define KW_EGIGA1_BASE   (KW_REGISTER(0x76000))
  
  Use a C struct?
 These are the Base address referred by register structures.
 Generally this type of declaration used for other cpu/socs.
 May you point any reference for this?

Hi Wolfgang Denk
I have almost done with other changes except this one
Do this really need to be converted C struct?
I will have to put some efforts to get it done :-(.

Regards..
Prafulla . .

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Wolfgang Denk
Dear Prafulla,

In message 73173d32e9439e4abb5151606c3e19e201cf9e6...@sc-vexch1.marvell.com 
you wrote:
 
...
+#define KW_EGIGA0_BASE (KW_REGISTER(0x72000))
+#define KW_EGIGA1_BASE (KW_REGISTER(0x76000))
   
   Use a C struct?
  These are the Base address referred by register structures.

I am aware of this.

  Generally this type of declaration used for other cpu/socs.

Well, generally is a weak argument - you find examples for both.
Coming from the PowerPC world, and haveing been using the code these
sinde  10 years, I'm more accustomed to see something like a big IMMR
sturcture here.

 I have almost done with other changes except this one
 Do this really need to be converted C struct?

No, you do not *have* to. That's why I asked it as a question. If I
had to write the code, I would use a C struct, and I think it would be
easier to read.

But I don't insist on such a change. You can find arguments for both
solutions, so decide what deems best for you.

 I will have to put some efforts to get it done :-(.

Well, changing it would actually be trivial. But as mentioned above: I
don't insist. It's largely a matter of taste, I think.

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
If people are good only because they fear punishment, and  hope  for
reward, then we are a sorry lot indeed.- Albert Einstein
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Prafulla Wadaskar
 ...
 +#define KW_EGIGA0_BASE   
 (KW_REGISTER(0x72000))
 +#define KW_EGIGA1_BASE   
 (KW_REGISTER(0x76000))

Use a C struct?
   These are the Base address referred by register structures.
 
 I am aware of this.
 
   Generally this type of declaration used for other cpu/socs.
 
 Well, generally is a weak argument - you find examples for both.
 Coming from the PowerPC world, and haveing been using the 
 code these sinde  10 years, I'm more accustomed to see 
 something like a big IMMR sturcture here.
 
  I have almost done with other changes except this one Do 
 this really 
  need to be converted C struct?
 
 No, you do not *have* to. That's why I asked it as a 
 question. If I had to write the code, I would use a C struct, 
 and I think it would be easier to read.
 
 But I don't insist on such a change. You can find arguments 
 for both solutions, so decide what deems best for you.
Hi Wolfgang
There is always scope for improvements and one should do it.
Just to sync current kirkwood code with other arm architectures,
I will keep the registers offset definitions as it is.

I appreciate your suggestions, I will take care for future coding

Thanks and regards...
Prafulla . .
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Wolfgang Denk
Dear Prafulla Wadaskar,

In message 73173d32e9439e4abb5151606c3e19e201cf9e6...@sc-vexch1.marvell.com 
you wrote:
 
   + tmpdin = readl(KW_REG_SPI_DATA_IN);
   + debug
   + (*** spi_xfer: din %08X 
  ... %08x read\n,
   +  din, tmpdin);
  
  Indentation by TABs only, please.
 Indentation is done by Lindent.
 Do you mean to do it manually?

Yes, please, if Lindent does it wrong ...

Best regards,

Wolfgang Denk

-- 
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: w...@denx.de
Our business is run on trust.  We trust you will pay in advance.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-20 Thread Prafulla Wadaskar

   Indentation by TABs only, please.
  Indentation is done by Lindent.
  Do you mean to do it manually?
 
 Yes, please, if Lindent does it wrong ...
Done in V9 :-) 

Regards..
Prafulla . .
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v8] Marvell Kirkwood family SOC support

2009-05-19 Thread Wolfgang Denk
Dear Prafulla Wadaskar,

In message 1242763678-13724-1-git-send-email-prafu...@marvell.com you wrote:
 
 Kirkwood family controllers are highly integrated SOCs
 based on Feroceon-88FR131/Sheeva-88SV131 cpu core.
...
 +/*
 + * Window Size
 + * Used with the Base register to set the address window size and location.
 + * Must be programmed from LSB to MSB as sequence of 1’s followed by
 + * sequence of 0’s. The number of 1’s specifies the size of the window in
 + * 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte).
 + * NOTE: A value of 0x0 specifies 64-KByte size.
 + */

You have a number of strange special characters here. Please try and
restrict yourself to plain ASCII text in normal C comments.

 + for (i = 0; i  (sizeval / 0x1); i++) {
 + j |= (1  i);
 + }

No curly braces for single line statements, please.

 +}
 +
 +/* prepares data to be loaded in win_Ctrl register */
 +#define KWCPU_WIN_CTRL_DATA(size, target, attr, en)  (en | (target  4) 
 \
 + | (attr  8) | (kw_winctrl_calcsize(size)  16))
 +
 +/*
 + * kw_config_adr_windows - Configure address Windows
 + *
 + * There are 7 address windows supported by Kirkwood Soc to addess different
 + * devices. Each window can be configured for size, BAR and remap addr
 + * Below configuration is standard for most of the cases
 + *
 + * Reference Documentation:
 + * Mbus-L to Mbus Bridge Registers Configuration.
 + * (Sec 25.1 and 25.3 of Datasheet)
 + */
 +int kw_config_adr_windows(void)
 +{
 + struct kwwin_registers *winregs = (struct kwwin_registers 
 *)KW_CPU_WIN_BASE;

Line too long.

 +/*
 + * kw_config_gpio - GPIO configuration
 + */
 +void kw_config_gpio(u32 gpp0_oe_val, u32 gpp1_oe_val, u32 gpp0_oe, u32 
 gpp1_oe)
 +{
 + struct kwgpio_registers *gpio0reg = (struct kwgpio_registers 
 *)KW_GPIO0_BASE;
 + struct kwgpio_registers *gpio1reg = (struct kwgpio_registers 
 *)KW_GPIO1_BASE;

More too long lines. Pleasse check everywhere.

 + /* Init GPIOS to default values as per board requirement */
 + writel(gpp0_oe_val, (u32)gpio0reg-dout);
 + writel(gpp1_oe_val, (u32)gpio1reg-dout);
 + writel(gpp0_oe, (u32)gpio0reg-oe);
 + writel(gpp1_oe, (u32)gpio1reg-oe);

Why are you using these casts here? The whole purpose of using a C
struct to access device registers is to enable type checking by the C
compiler, but you sabotage this with these casts. Please don't do
that.

Why are you using these casts here? The whole purpose of using a C
struct to access device registers is to enable type checking by the C
compiler, but you sabotage this with these casts. Please don't do
that. This comment applies to the whole patch.

...
 + cntmrctrl = readl(CNTMR_CTRL_REG);
 + cntmrctrl |= CTCR_ARM_TIMER_EN(UBOOT_CNTR); /* enable cnt\timer */

Are you sure you want to have a TAB character in this comment? What's
cntimer ? :-)

 diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
 index 966df9a..dd5f332 100644
 --- a/drivers/serial/serial.c
 +++ b/drivers/serial/serial.c
 @@ -27,6 +27,9 @@
  #ifdef CONFIG_NS87308
  #include ns87308.h
  #endif
 +#ifdef CONFIG_KIRKWOOD
 +#include asm/arch/kirkwood.h
 +#endif

What exactly is this needed for?


  #if defined (CONFIG_SERIAL_MULTI)
  #include serial.h
 diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
 index 1350f3e..7ffa47d 100644
 --- a/drivers/spi/Makefile
 +++ b/drivers/spi/Makefile
 @@ -28,6 +28,7 @@ LIB := $(obj)libspi.a
  COBJS-$(CONFIG_ATMEL_DATAFLASH_SPI) += atmel_dataflash_spi.o
  COBJS-$(CONFIG_ATMEL_SPI) += atmel_spi.o
  COBJS-$(CONFIG_BFIN_SPI) += bfin_spi.o
 +COBJS-$(CONFIG_KIRKWOOD_SPI) += kirkwood_spi.o
  COBJS-$(CONFIG_MPC8XXX_SPI) += mpc8xxx_spi.o
  COBJS-$(CONFIG_MXC_SPI) += mxc_spi.o
  COBJS-$(CONFIG_SOFT_SPI) += soft_spi.o
 diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
 new file mode 100644
 index 000..e0c4f0a
 --- /dev/null
 +++ b/drivers/spi/kirkwood_spi.c
 @@ -0,0 +1,169 @@
 +/*
 + * (C) Copyright 2009
 + * Marvell Semiconductor www.marvell.com
 + * Prafulla Wadaskar prafu...@marvell.com
 + *
 + * Derived from drivers/spi/mpc8xxx_spi.c
 + *
 + * 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., 51 Franklin Street, Fifth Floor, Boston,
 + * MA