[U-Boot] [PATCH] MTD:NAND Enable nand lock, unlock feature

2008-12-13 Thread Nishanth Menon
Enable nand lock, unlock and status of lock feature.
Not every device and platform requires this, hence,
it is under define for CONFIG_CMD_NAND_LOCK_UNLOCK

Nand unlock and status operate on block boundary instead
of page boundary. Details in:
http://www.micron.com/products/partdetail?part=MT29C2G24MAKLAJG-6%20IT

Intial solution provided by Vikram Pandita 
Includes preliminary suggestions from Scott Wood

Signed-off-by: Nishanth Menon 
---
 common/cmd_nand.c|   96 +
 drivers/mtd/nand/nand_util.c |   79 +++
 2 files changed, 92 insertions(+), 83 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 0a366d3..a240c37 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -164,6 +164,47 @@ out:
return 0;
 }
 
+#ifdef CONFIG_CMD_NAND_LOCK_UNLOCK
+static void print_status(ulong start, ulong end, ulong erasesize, int status)
+{
+   printf("%08lx - %08lx: %08lx blocks %s%s%s\n",
+   start,
+   end - 1,
+   (end - start) / erasesize,
+   ((status & NAND_LOCK_STATUS_TIGHT) ?  "TIGHT " : ""),
+   ((status & NAND_LOCK_STATUS_LOCK) ?  "LOCK " : ""),
+   ((status & NAND_LOCK_STATUS_UNLOCK) ?  "UNLOCK " : ""));
+}
+
+static void do_nand_status(nand_info_t *nand)
+{
+   ulong block_start = 0;
+   ulong off;
+   int last_status = -1;
+
+   struct nand_chip *nand_chip = nand->priv;
+   /* check the WP bit */
+   nand_chip->cmdfunc(nand, NAND_CMD_STATUS, -1, -1);
+   printf("device is %swrite protected\n",
+   (nand_chip->read_byte(nand) & 0x80 ?
+   "NOT " : ""));
+
+   for (off = 0; off < nand->size; off += nand->erasesize) {
+   int s = nand_get_lock_status(nand, off);
+
+   /* print message only if status has changed */
+   if (s != last_status && off != 0) {
+   print_status(block_start, off, nand->erasesize,
+   last_status);
+   block_start = off;
+   }
+   last_status = s;
+   }
+   /* Print the last block info */
+   print_status(block_start, off, nand->erasesize, last_status);
+}
+#endif
+
 int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
int i, dev, ret = 0;
@@ -383,8 +424,9 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
return 1;
}
 
+#ifdef CONFIG_CMD_NAND_LOCK_UNLOCK
if (strcmp(cmd, "lock") == 0) {
-   int tight  = 0;
+   int tight = 0;
int status = 0;
if (argc == 3) {
if (!strcmp("tight", argv[2]))
@@ -392,44 +434,8 @@ int do_nand(cmd_tbl_t * cmdtp, int flag, int argc, char 
*argv[])
if (!strcmp("status", argv[2]))
status = 1;
}
-/*
- * ! BROKEN !
- *
- * TODO: must be implemented and tested by someone with HW
- */
-#if 0
if (status) {
-   ulong block_start = 0;
-   ulong off;
-   int last_status = -1;
-
-   struct nand_chip *nand_chip = nand->priv;
-   /* check the WP bit */
-   nand_chip->cmdfunc (nand, NAND_CMD_STATUS, -1, -1);
-   printf("device is %swrite protected\n",
-  (nand_chip->read_byte(nand) & 0x80 ?
-  "NOT " : ""));
-
-   for (off = 0; off < nand->size; off += nand->writesize) 
{
-   int s = nand_get_lock_status(nand, off);
-
-   /* print message only if status has changed
-* or at end of chip
-*/
-   if (off == nand->size - nand->writesize
-   || (s != last_status && off != 0))  {
-
-   printf("%08lx - %08lx: %8d pages 
%s%s%s\n",
-  block_start,
-  off-1,
-  
(off-block_start)/nand->writesize,
-  ((last_status & 
NAND_LOCK_STATUS_TIGHT) ? "TIGHT " : ""),
-  ((last_status & 
NAND_LOCK_STATUS_LOCK) ? "LOCK " : ""),
-  ((last_status & 
NAND_LOCK_STATUS_UNLOCK) ? "UNLOCK " : ""));
-   }
-
-   last_status = s;
-   }
+   do_nand_status(nand);
} else {
if (!nand_lock(nand, tight)) {
puts("NAND flash successfully locked\n");

[U-Boot] Warning in ffs2_1pass.c

2008-12-13 Thread Dirk Behme

Just fyi: Using git head (89d56f5503eed351efe5ab0b4dd0f1e888fd2336: 
Merge branch 'master' of git://git.denx.de/u-boot-ppc4xx) I get warning:

-- cut --
ffs2_1pass.c:1411:1: warning: "min_t" redefined
In file include/nand.h:30,
  from jffs2_1pass.c:151:
include/linux/mtd/compat.h:34:1: warning: this is the location of the 
previous definition
-- cut --

Best regards

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


Re: [U-Boot] [PATCH] cmd_sf: rename "speed" to "hz"

2008-12-13 Thread Jerry Van Baren
Mike Frysinger wrote:
> On Thursday 11 December 2008 18:59:46 Wolfgang Denk wrote:
>> In message Mike Frysinger you wrote:
>>> The term "hz" is used everywhere else when talking about the frequency of
>>> the SPI bus, so have the sf command use it as well to stay consistent. 
>>> It even presents itself as "hz" when showing user help.
>>>
>>> Signed-off-by: Mike Frysinger 
>>> ---
>>>  common/cmd_sf.c |   10 +-
>>>  1 files changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
>>> index 8c0a751..902e51d 100644
>>> --- a/common/cmd_sf.c
>>> +++ b/common/cmd_sf.c
>>> @@ -8,8 +8,8 @@
>>>
>>>  #include 
>>>
>>> -#ifndef CONFIG_SF_DEFAULT_SPEED
>>> -# define CONFIG_SF_DEFAULT_SPEED   100
>>> +#ifndef CONFIG_SF_DEFAULT_HZ
>>> +# define CONFIG_SF_DEFAULT_HZ  100
>> I consider "FREQ" (and even "SPEED) a much better name than "HZ".
>>
>> "HZ" is the unit of what you are measuring, not a name for what you
>> are measuring.
> 
> then they should all be converted.  not 90% using hz and 10% using something 
> else.  "speed" is bad as it doesnt convey the unit while "hz" is pretty clear.
> -mike

Maybe I'm being pedantic or have drunk too much coffee, but "clk" (clock 
rate, _expressed_ in Hz) is better than "speed" IMHO.  "bps" (bits per 
second) is another alternative, although it has its own problems if the 
data rate is different when sending "0" bits vs. "1" bits (e.g. 1-wire).

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


Re: [U-Boot] reducing u-boot.bin size

2008-12-13 Thread Wolfgang Denk
Dear Fahd Abidi,

In message <71dea556544d7a4f9c6848402d818434036...@usi01.ultsol.local> you 
wrote:
> 
> I am trying to reduce the size of the u-boot.bin file so that it fits
> into a 256KB promjet. I disabled all the drivers that I didn't need and
> have just kept the NOR driver but the binary size is still 512KB, it
> seems to be a hard number coded in somewhere. I would have thought this
> was the size of the .data section set somewhere in the linker script but
> it does not appear to be so. Does anyone know where the image size can
> be altered from?

Well, it would have been helpful if you had told us which board you
are talking about.

Some processors have a fixed reset vector address at  0xFFFC,  so
the  U-Boot  image  has  to include that address, i. e. it covers the
full range from the start address to the end of the  32  bit  address
space.  In such a case, the start address must be changed - check the
setting of TEXT_BASE in your board//config.mk file.

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
An expert is a person who avoids the small errors while  sweeping  on
to the grand fallacy.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] usb: fix wait_ms declaration

2008-12-13 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 

diff --git a/common/usb.c b/common/usb.c
index ee18152..3ed2e34 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -83,16 +83,6 @@ void usb_hub_reset(void);
 static int hub_port_reset(struct usb_device *dev, int port,
  unsigned short *portstat);
 
-/***
- * wait_ms
- */
-
-inline void wait_ms(unsigned long ms)
-{
-   while (ms-- > 0)
-   udelay(1000);
-}
-
 /***
  * Init USB Device
  */
diff --git a/include/usb.h b/include/usb.h
index 510df95..f97c58a 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -240,6 +240,12 @@ int usb_get_configuration_no(struct usb_device *dev, 
unsigned char *buffer,
int cfgno);
 int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type,
unsigned char id, void *buf, int size);
+static void __inline__ wait_ms(unsigned long ms)
+{
+   while(ms-->0)
+   udelay(1000);
+}
+
 int usb_get_class_descriptor(struct usb_device *dev, int ifnum,
unsigned char type, unsigned char id, void *buf,
int size);
-- 
1.5.6.5

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


[U-Boot] [PATCH] integratorap: fix PCI support

2008-12-13 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 

diff --git a/include/configs/integratorap.h b/include/configs/integratorap.h
index 6ce3b4d..d7f617f 100644
--- a/include/configs/integratorap.h
+++ b/include/configs/integratorap.h
@@ -143,7 +143,7 @@
  * PCI definitions
  */
 
-/*#define CONFIG_PCI   /--* include pci support*/
+#ifdef CONFIG_PCI  /* pci support  */
 #undef CONFIG_PCI_PNP
 #define CONFIG_PCI_SCAN_SHOW   1   /* show pci devices on startup  */
 #define DEBUG
@@ -151,7 +151,6 @@
 #define CONFIG_EEPRO100
 #define CONFIG_SYS_RX_ETH_BUFFER   8   /* use 8 rx buffer on eepro100  
*/
 
-
 #define INTEGRATOR_BOOT_ROM_BASE   0x2000
 #define INTEGRATOR_HDR0_SDRAM_BASE 0x8000
 
@@ -279,6 +278,7 @@
 #define INTEGRATOR_SC_PCIENABLE \
(INTEGRATOR_SC_BASE + INTEGRATOR_SC_PCIENABLE_OFFSET)
 
+#endif /* CONFIG_PCI */
 /*---
  * There are various dependencies on the core module (CM) fitted
  * Users should refer to their CM user guide
-- 
1.5.6.5

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


[U-Boot] [PATCH] move ARM Ltd. to verdor dir

2008-12-13 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
---
 Makefile   |6 +++---
 board/armltd/.gitignore|2 ++
 board/{ => armltd}/integratorap/Makefile   |0 
 board/{ => armltd}/integratorap/config.mk  |0 
 board/{ => armltd}/integratorap/flash.c|0 
 board/{ => armltd}/integratorap/integratorap.c |0 
 board/{ => armltd}/integratorap/lowlevel_init.S|0 
 .../{ => armltd}/integratorap/split_by_variant.sh  |6 +++---
 .../{ => armltd}/integratorap/u-boot.lds.template  |0 
 board/{ => armltd}/integratorcp/Makefile   |0 
 board/{ => armltd}/integratorcp/config.mk  |0 
 board/{ => armltd}/integratorcp/flash.c|0 
 board/{ => armltd}/integratorcp/integratorcp.c |0 
 board/{ => armltd}/integratorcp/lowlevel_init.S|0 
 .../{ => armltd}/integratorcp/split_by_variant.sh  |6 +++---
 .../{ => armltd}/integratorcp/u-boot.lds.template  |0 
 board/{ => armltd}/versatile/Makefile  |0 
 board/{ => armltd}/versatile/config.mk |0 
 board/{ => armltd}/versatile/lowlevel_init.S   |0 
 board/{ => armltd}/versatile/split_by_variant.sh   |2 +-
 board/{ => armltd}/versatile/u-boot.lds|0 
 board/{ => armltd}/versatile/versatile.c   |0 
 22 files changed, 12 insertions(+), 10 deletions(-)
 create mode 100644 board/armltd/.gitignore
 rename board/{ => armltd}/integratorap/Makefile (100%)
 rename board/{ => armltd}/integratorap/config.mk (100%)
 rename board/{ => armltd}/integratorap/flash.c (100%)
 rename board/{ => armltd}/integratorap/integratorap.c (100%)
 rename board/{ => armltd}/integratorap/lowlevel_init.S (100%)
 rename board/{ => armltd}/integratorap/split_by_variant.sh (92%)
 rename board/{ => armltd}/integratorap/u-boot.lds.template (100%)
 rename board/{ => armltd}/integratorcp/Makefile (100%)
 rename board/{ => armltd}/integratorcp/config.mk (100%)
 rename board/{ => armltd}/integratorcp/flash.c (100%)
 rename board/{ => armltd}/integratorcp/integratorcp.c (100%)
 rename board/{ => armltd}/integratorcp/lowlevel_init.S (100%)
 rename board/{ => armltd}/integratorcp/split_by_variant.sh (92%)
 rename board/{ => armltd}/integratorcp/u-boot.lds.template (100%)
 rename board/{ => armltd}/versatile/Makefile (100%)
 rename board/{ => armltd}/versatile/config.mk (100%)
 rename board/{ => armltd}/versatile/lowlevel_init.S (100%)
 rename board/{ => armltd}/versatile/split_by_variant.sh (94%)
 rename board/{ => armltd}/versatile/u-boot.lds (100%)
 rename board/{ => armltd}/versatile/versatile.c (100%)

diff --git a/Makefile b/Makefile
index 3c55457..f3b6235 100644
--- a/Makefile
+++ b/Makefile
@@ -2660,7 +2660,7 @@ ap720t_config \
 ap920t_config  \
 ap926ejs_config\
 ap946es_config: unconfig
-   @board/integratorap/split_by_variant.sh $@
+   @board/armltd/integratorap/split_by_variant.sh $@
 
 integratorcp_config\
 cp_config  \
@@ -2672,7 +2672,7 @@ cp966_config  \
 cp922_config   \
 cp922_XA10_config  \
 cp1026_config: unconfig
-   @board/integratorcp/split_by_variant.sh $@
+   @board/armltd/integratorcp/split_by_variant.sh $@
 
 davinci_dvevm_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm926ejs dvevm davinci davinci
@@ -2822,7 +2822,7 @@ cm41xx_config :   unconfig
 versatile_config   \
 versatileab_config \
 versatilepb_config :   unconfig
-   @board/versatile/split_by_variant.sh $@
+   @board/armltd/versatile/split_by_variant.sh $@
 
 voiceblue_config:  unconfig
@$(MKCONFIG) $(@:_config=) arm arm925t voiceblue
diff --git a/board/armltd/.gitignore b/board/armltd/.gitignore
new file mode 100644
index 000..a3df156
--- /dev/null
+++ b/board/armltd/.gitignore
@@ -0,0 +1,2 @@
+/integratorap/u-boot.lds
+/integratorcp/u-boot.lds
diff --git a/board/integratorap/Makefile b/board/armltd/integratorap/Makefile
similarity index 100%
rename from board/integratorap/Makefile
rename to board/armltd/integratorap/Makefile
diff --git a/board/integratorap/config.mk b/board/armltd/integratorap/config.mk
similarity index 100%
rename from board/integratorap/config.mk
rename to board/armltd/integratorap/config.mk
diff --git a/board/integratorap/flash.c b/board/armltd/integratorap/flash.c
similarity index 100%
rename from board/integratorap/flash.c
rename to board/armltd/integratorap/flash.c
diff --git a/board/integratorap/integratorap.c 
b/board/armltd/integratorap/integratorap.c
similarity index 100%
rename from board/integratorap/integratorap.c
rename to board/armltd/integratorap/integratorap.c
diff --git a/board/integratorap/lowlevel_init.S 
b/board/armltd/integratorap/lowlevel_init.S
similarity index 100%
rename from board/integratorap/lowlevel_init.S
rename to board/armltd/integratorap/lowlevel_init.S
diff --git a/board/integratorap/split_by_var

Re: [U-Boot] [PATCH] usb: fix wait_ms declaration

2008-12-13 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1229198787-24017-1-git-send-email-plagn...@jcrosoft.com> you wrote:
...
> +static void __inline__ wait_ms(unsigned long ms)
> +{
> + while(ms-->0)

White space before and after the '>', please.

And should we not check for a '0' argument first? Of course, you can
argument that the caller will just get what he asked for (i. e. a
nearly 50 days delay), but anyway.


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
It is much easier to suggest solutions when you know nothing
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] move ARM Ltd. to verdor dir

2008-12-13 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1229199118-24844-1-git-send-email-plagn...@jcrosoft.com> you wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 

Please fix the subject (s/verdor/vendor/) before checking in this
patch.



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
Always borrow money from a pessimist; they don't expect  to  be  paid
back.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] usb: fix wait_ms declaration

2008-12-13 Thread Magnus Lilja
2008/12/13 Wolfgang Denk :
> Dear Jean-Christophe PLAGNIOL-VILLARD,
>
> In message <1229198787-24017-1-git-send-email-plagn...@jcrosoft.com> you 
> wrote:
> ...
>> +static void __inline__ wait_ms(unsigned long ms)
>> +{
>> + while(ms-->0)
>
> White space before and after the '>', please.

And white space between while and '(' I assume.


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


Re: [U-Boot] FPGA programming driver architecture

2008-12-13 Thread Wolfgang Denk
Dear Hugo Villeneuve,

In message <20081212205916.5404fe43.h...@hugovil.com> you wrote:
>
> You probably have missed the email I sent 30 seconds after having sent
> the first one stating it was the wrong list. Please read your emails
> carefully next time.

I can read them only as fast as they get delivered.

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
Only a fool fights in a burning house.
-- Kank the Klingon, "Day of the Dove", stardate unknown
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC USB PATCH V2] USB ehci fix and test on ixp4xx hardware

2008-12-13 Thread Remy Bohmer
Hello Michael,

2008/12/12 Michael Trimarchi :
> EHCI fix code and ixp4xx test.
> USB ehci configuration parameter:
>
> #define CONFIG_CMD_USB  1
> #define CONFIG_USB_STORAGE  1
> #define CONFIG_USB_EHCI
> #define CONFIG_USB_EHCI_IXP4XX  1
> #define CONFIG_EHCI_IS_TDI  1
> #define CONFIG_EHCI_DESC_BIG_ENDIAN 1
> #define CONFIG_EHCI_MMIO_BIG_ENDIAN 1
> #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2
> #define CONFIG_LEGACY_USB_INIT_SEQ  1
>
> 2 USB Device(s) found
>   scanning bus for storage devices... 0 Storage Device(s) found
> => usb tree
>
> Device Tree:
>  1  Hub (1.5MBit/s, 0mA)
>  |  u-boot EHCI Host Controller
>  |
>  |+-2  Mass Storage (12MBit/s, 100mA)
>   Sony Storage Media 0C07040930296
>
> =>
>
> Signed-off-by: Michael Trimarchi 
> ---
>  drivers/usb/usb_ehci.h  |   51 ++
>  drivers/usb/usb_ehci_core.c |  127 
> ++-
>  2 files changed, 106 insertions(+), 72 deletions(-)

Applied to u-boot-usb (next)

I had some weird problems re-basing your patches, it looked like git
choked on the [PATCH] keyword in the headers, resulting in different
patch titles and it was complaining about empty commits. Can you
please review if the next-tree is still as you expect? (I believe I
fixed it all, so I expect no real problems)

Thanks,

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


[U-Boot] fat.c:707: warning: array subscript is above array bounds

2008-12-13 Thread Wolfgang Denk
Hello,

building U-Boot with recent toolchains (like GCC-4.3.2) results in
this warning:

fat.c: In function 'read_bootsectandvi':
fat.c:707: warning: array subscript is above array bounds

The respective code looks like this:

fs/fat/fat.c:

 705 /* Terminate fs_type string. Writing past the end of vistart
 706is ok - it's just the buffer. */
 707 vistart->fs_type[8] = '\0';

fs_type[] is declared in "include/fat.h":

143 typedef struct volume_info
144 {
145 __u8 drive_number;  /* BIOS drive number */
146 __u8 reserved;  /* Unused */
147 __u8 ext_boot_sign; /* 0x29 if fields below exist (DOS 3.3+) */
148 __u8 volume_id[4];  /* Volume ID number */
149 char volume_label[11];  /* Volume label */
150 char fs_type[8];/* Typically FAT12, FAT16, or FAT32 */
151 /* Boot code comes next, all but 2 bytes to fill up sector */
152 /* Boot sign comes last, 2 bytes */
153 } volume_info;

So the comment in fs/fat/fat.c is actually  correct,  writing  beyond
the end of the string is indeed uncritical here, but it is definitely
not really nice either.

I want to get rid of this warning message.

Any ideas how to deal with this?


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
"Am besten betrachten Sie Fehlermeldungen als eine  Art  Psycho-Test,
mit  dem  herausgefunden  werden soll, wie belastbar Sie sind."
 - Dr. R. Wonneberger, Kompaktführer LaTeX, Kap. 1.6: Fehlermeldungen
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] fat.c:707: warning: array subscript is above array bounds

2008-12-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 23:13 Sat 13 Dec , Wolfgang Denk wrote:
> Hello,
> 
> building U-Boot with recent toolchains (like GCC-4.3.2) results in
> this warning:
> 
> fat.c: In function 'read_bootsectandvi':
> fat.c:707: warning: array subscript is above array bounds
> 
> The respective code looks like this:
> 
> fs/fat/fat.c:
> 
>  705 /* Terminate fs_type string. Writing past the end of vistart
>  706is ok - it's just the buffer. */
>  707 vistart->fs_type[8] = '\0';

why not do something like this

*(vistart + sizeof(volume_info)) = '\0';

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


Re: [U-Boot] [PATCH] Remove compiler warning: target CPU does not support interworking

2008-12-13 Thread Wolfgang Denk
Dear Sergei,

In message <200811011312.ma1dc7bt008...@wooster.emcraft.com> you wrote:
> From 7fd5e5aaf0c61f47c89bf59f2b37cc987e97849a Mon Sep 17 00:00:00 2001
> From: Sergei Poselenov 
> Date: Fri, 19 Sep 2008 12:07:34 +0200
> Subject: [PATCH] Remove compiler warning: target CPU does not support 
> interworking
>  (This warning is issued by modern ARM-EABI GCC on non-thumb targets)
> 
> Signed-off-by: Vladimir Panfilov 
> Signed-off-by: Sergei Poselenov 
> ---
>  cpu/arm720t/config.mk   |1 +
>  cpu/arm920t/config.mk   |1 +
>  cpu/arm925t/config.mk   |1 +
>  cpu/arm926ejs/config.mk |1 +
>  cpu/arm946es/config.mk  |1 +
>  cpu/arm_intcm/config.mk |1 +
>  cpu/lh7a40x/config.mk   |1 +
>  cpu/pxa/config.mk   |1 +
>  cpu/s3c44b0/config.mk   |1 +
>  cpu/sa1100/config.mk|1 +
>  10 files changed, 10 insertions(+), 0 deletions(-)

Applied, thanks.

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
Men will always be men -- no matter where they are.
-- Harry Mudd, "Mudd's Women", stardate 1329.8
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V3] Fix FIT and fdt blob support to have CONFIG_OF_LIBFDT and CONFIG_FIT independant

2008-12-13 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <1227530031-15268-1-git-send-email-plagn...@jcrosoft.com> you wrote:
> FDT support is used for both FIT style images and architectures (ppc, m68k, 
> sparc)
> that can pass a fdt blob to an OS..
> 
> For other arch and board which do not pass a fdt blob to an OS but want to use
> the new uImage format, we just need FIT support (ex : ARM).
> 
> Now we can have the 4 following configurations :
> 
> 1) FIT only CONFIG_FIT
> 2) fdt blob onlyCONFIG_OF_LIBFDT
> 3) both CONFIG_OF_LIBFDT & CONFIG_FIT
> 4) none none
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
> ---
> actually not clean integration have been found to avoid
> defined(CONFIG_PPC) || defined(CONFIG_M68K) || defined(CONFIG_SPARC)
> by replacing it with the 2 news macro.
> 
> removing arch macro ifdef and use 2 new config for the functionnality to 
> enable
> so we introduce these :
>   CONFIG_BOOT_INIT_RAMDISK
> 
>   Define this if you want support for relocating init ramdisk
> 
>   CONFIG_BOOT_INIT_RAMDISK
> 
>   Define this if you want support for allocate and initialize kernel
>   information for booting
> 
> if someone have a good idea please send a patch
> 
> Best Regards,
> J.
>  common/image.c  |2 ++
>  include/image.h |4 
>  libfdt/Makefile |8 ++--
>  3 files changed, 8 insertions(+), 6 deletions(-)

Aplied, thanks.

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
I am pleased to see that we have differences.  May we together become
greater than the sum of both of us.
-- Surak of Vulcan, "The Savage Curtain", stardate 5906.4
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] fat.c:707: warning: array subscript is above array bounds

2008-12-13 Thread Wolfgang Denk
Dear Jean-Christophe PLAGNIOL-VILLARD,

In message <2008121325.gn15...@game.jcrosoft.org> you wrote:
>
> >  705 /* Terminate fs_type string. Writing past the end of vistart
> >  706is ok - it's just the buffer. */
> >  707 vistart->fs_type[8] = '\0';
> 
> why not do something like this
> 
>   *(vistart + sizeof(volume_info)) = '\0';

Because that would be terribly wrong - sizeof(volume_info)  is  >  23
(probably  24),  and  vistart  is a pointer volume_info, so you would
probably write some 500+ bytes beyond the end of the buffer.

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
People seldom know what they want until you give them what  they  ask
for.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC][PATCH] Code Clean-up (weak functions)

2008-12-13 Thread Remy Bohmer
Hello Graeme,

2008/12/13 Graeme Russ :
> This patch makes all definitions, declarations and usages of weak functions
> consistent.
>
> Signed-off-by: Graeme Russ 

Just curious:
What is the relation of this patch to the problem discussed earlier:
http://www.mail-archive.com/u-boot@lists.denx.de/msg05367.html
Does this patch repair anything, or could it maybe break things?
I ask this because the weak linking seemed not work as many expected,
and I guess you cannot test all architectures/boards...

> - If the weak alias decleration exceeds 80 columns, the __attribute__ is 
> placed
>  on the following line, indented by one tab

The benefit on 1 line would be that it is easy recognisable with grep
which instance of a function is actually being used (or in fact should
be used due to the fuzzy behaviour of weak in U-boot...) without
having to go through all the code. That benefit is gone when it is
moved across different lines.

Maybe it is an idea to move the attribute(weak,...) construction to a
macro, like in Linux:
#define __weak __attribute__((weak))

In that case it can be changed easier when a non-GCC compiler is being
used, and would keep the lines shorter, such that it still fits on 1
line?

>  All instances have been replaced by empty functions with an alias. e.g.
> void __do_something (args) {}
> do_something(args) __atttribute__((weak, alias("__do_something")));

Notice that in Linux, the 'alias' construction is not being used
massively. Can it be removed here also, or is it somehow mandatory
here?
Removing it would keep the lines short as well...

Kind Regards,

Remy

>
> - There is no purely weak functions and therfore no longer code like:
>if (do_something)
>  do_somthing();
>
>  board/incaip/incaip.c  |2 +-
>  board/purple/purple.c  |2 +-
>  board/tb0229/tb0229.c  |2 +-
>  .../xilinx/ppc405-generic/xilinx_ppc405_generic.c  |1 -
>  common/cmd_boot.c  |6 ++--
>  common/cmd_bootm.c |6 +++-
>  common/cmd_elf.c   |4 +-
>  common/cmd_ide.c   |6 ++--
>  common/cmd_log.c   |3 +-
>  common/main.c  |3 +-
>  common/serial.c|3 +-
>  cpu/at32ap/cpu.c   |6 +++-
>  cpu/blackfin/cpu.h |2 +-
>  cpu/blackfin/reset.c   |6 +++-
>  cpu/mips/cpu.c |8 +++---
>  cpu/mpc8xxx/ddr/util.c |5 ++-
>  cpu/ppc4xx/44x_spd_ddr.c   |3 +-
>  cpu/ppc4xx/44x_spd_ddr2.c  |3 +-
>  cpu/ppc4xx/4xx_pci.c   |3 +-
>  cpu/ppc4xx/4xx_pcie.c  |2 +-
>  cpu/ppc4xx/fdt.c   |3 +-
>  drivers/mtd/cfi_flash.c|   24 +--
>  drivers/net/mcfmii.c   |3 +-
>  include/asm-avr32/arch-at32ap700x/clk.h|2 +-
>  include/asm-mips/reboot.h  |2 +-
>  include/common.h   |2 +-
>  lib_arm/board.c|   21 +++-
>  lib_ppc/board.c|6 +++-
>  lib_ppc/interrupts.c   |4 +-
>  29 files changed, 86 insertions(+), 57 deletions(-)
>
> diff --git a/board/incaip/incaip.c b/board/incaip/incaip.c
> index 3b30970..3ee3ac9 100644
> --- a/board/incaip/incaip.c
> +++ b/board/incaip/incaip.c
> @@ -31,7 +31,7 @@
>
>  extern uint incaip_get_cpuclk(void);
>
> -void _machine_restart(void)
> +void machine_restart(void)
>  {
>*INCA_IP_WDT_RST_REQ = 0x3f;
>  }
> diff --git a/board/purple/purple.c b/board/purple/purple.c
> index 54bef65..c243487 100644
> --- a/board/purple/purple.c
> +++ b/board/purple/purple.c
> @@ -54,7 +54,7 @@ extern intasc_serial_getc (void);
>  extern int asc_serial_tstc (void);
>  extern voidasc_serial_setbrg   (void);
>
> -void _machine_restart(void)
> +void machine_restart(void)
>  {
>void (*f)(void) = (void *) 0xbfc0;
>
> diff --git a/board/tb0229/tb0229.c b/board/tb0229/tb0229.c
> index d3f05b2..f74573b 100644
> --- a/board/tb0229/tb0229.c
> +++ b/board/tb0229/tb0229.c
> @@ -16,7 +16,7 @@
>  #include 
>  #include 
>
> -void _machine_restart(void)
> +void machine_restart(void)
>  {
>void (*f)(void) = (void *) 0xbfc0;
>
> diff --git a/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c 
> b/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c
> index 9bd1770..57ffdc8 100644
> --- a/board/xilinx/ppc405-generic/xilinx_ppc405_generic.c
> +++ b/bo

Re: [U-Boot] fat.c:707: warning: array subscript is above array bounds

2008-12-13 Thread David Hawkins
Wolfgang Denk wrote:
> Dear Jean-Christophe PLAGNIOL-VILLARD,
> 
> In message <2008121325.gn15...@game.jcrosoft.org> you wrote:
>>>  705 /* Terminate fs_type string. Writing past the end of vistart
>>>  706is ok - it's just the buffer. */
>>>  707 vistart->fs_type[8] = '\0';
>> why not do something like this
>>
>>  *(vistart + sizeof(volume_info)) = '\0';
> 
> Because that would be terribly wrong - sizeof(volume_info)  is  >  23
> (probably  24),  and  vistart  is a pointer volume_info, so you would
> probably write some 500+ bytes beyond the end of the buffer.

How about something in the same vein then

char *c = vistart->fstype;
c[8] = '\0';

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


[U-Boot] [PATCH v4 2/4] Introduce addr_map library

2008-12-13 Thread Kumar Gala
Add a library that helps in translating between virtual and physical
addresses.  This library can be useful as a simple means to implement
map_physmem() and virt_to_phys() for platforms that need functionality
beyond the simple 1:1 mapping.

Signed-off-by: Kumar Gala 
---
* Folded in Becky's phys_size_t changes

 include/addr_map.h |   29 +
 lib_generic/Makefile   |1 +
 lib_generic/addr_map.c |   81 
 3 files changed, 111 insertions(+), 0 deletions(-)
 create mode 100644 include/addr_map.h
 create mode 100644 lib_generic/addr_map.c

diff --git a/include/addr_map.h b/include/addr_map.h
new file mode 100644
index 000..d55f5f6
--- /dev/null
+++ b/include/addr_map.h
@@ -0,0 +1,29 @@
+#ifndef __ADDR_MAP_H
+#define __ADDR_MAP_H
+
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ *
+ * 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 
+
+extern phys_addr_t addrmap_virt_to_phys(void *vaddr);
+extern unsigned long addrmap_phys_to_virt(phys_addr_t paddr);
+extern void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr,
+   phys_size_t size, int idx);
+
+#endif
diff --git a/lib_generic/Makefile b/lib_generic/Makefile
index d62c39b..3f04022 100644
--- a/lib_generic/Makefile
+++ b/lib_generic/Makefile
@@ -25,6 +25,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)libgeneric.a
 
+COBJS-$(CONFIG_ADDR_MAP) += addr_map.o
 COBJS-y += bzlib.o
 COBJS-y += bzlib_crctable.o
 COBJS-y += bzlib_decompress.o
diff --git a/lib_generic/addr_map.c b/lib_generic/addr_map.c
new file mode 100644
index 000..ff8532c
--- /dev/null
+++ b/lib_generic/addr_map.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * Version 2 as published by the Free Software Foundation.
+ *
+ * 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 
+#include 
+
+static struct {
+   phys_addr_t paddr;
+   phys_size_t size;
+   unsigned long vaddr;
+} address_map[CONFIG_SYS_NUM_ADDR_MAP];
+
+phys_addr_t addrmap_virt_to_phys(void * vaddr)
+{
+   int i;
+
+   for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
+   u64 base, upper, addr;
+
+   if (address_map[i].size == 0)
+   continue;
+
+   addr = (u64)((u32)vaddr);
+   base = (u64)(address_map[i].vaddr);
+   upper = (u64)(address_map[i].size) + base - 1;
+
+   if (addr >= base && addr <= upper) {
+   return addr - address_map[i].vaddr + 
address_map[i].paddr;
+   }
+   }
+
+   return (phys_addr_t)(~0);
+}
+
+unsigned long addrmap_phys_to_virt(phys_addr_t paddr)
+{
+   int i;
+
+   for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
+   u64 base, upper, addr;
+
+   if (address_map[i].size == 0)
+   continue;
+
+   addr = (u64)paddr;
+   base = (u64)(address_map[i].paddr);
+   upper = (u64)(address_map[i].size) + base - 1;
+
+   if (addr >= base && addr <= upper) {
+   return paddr - address_map[i].paddr + 
address_map[i].vaddr;
+   }
+   }
+
+   return (unsigned long)(~0);
+}
+
+void addrmap_set_entry(unsigned long vaddr, phys_addr_t paddr,
+   phys_size_t size, int idx)
+{
+   if (idx > CONFIG_SYS_NUM_ADDR_MAP)
+   return;
+
+   address_map[idx].vaddr = vaddr;
+   address_map[idx].paddr = paddr;
+   address_map[idx].size  = size;
+}
-- 
1.5.6.5

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


[U-Boot] [PATCH v4 1/4] Introduce virt_to_phys()

2008-12-13 Thread Kumar Gala
virt_to_phys() returns the physical address given a virtual.  In most cases
this will just the input value as the vast majority of systems run in a 1:1
mode.

However in systems that are not running this way it should report the
physical address or ~0 if no mapping exists for the given virtual address.

Signed-off-by: Kumar Gala 
---

* No change, just reposting as part of the sequence

- k

 include/asm-arm/io.h|5 +
 include/asm-avr32/io.h  |5 +
 include/asm-blackfin/io.h   |5 +
 include/asm-i386/io.h   |5 +
 include/asm-m68k/io.h   |5 +
 include/asm-microblaze/io.h |5 +
 include/asm-mips/io.h   |2 +-
 include/asm-nios/io.h   |5 +
 include/asm-nios2/io.h  |5 +
 include/asm-ppc/io.h|5 +
 include/asm-sh/io.h |5 +
 include/asm-sparc/io.h  |5 +
 12 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/include/asm-arm/io.h b/include/asm-arm/io.h
index f4ae307..fec3a7e 100644
--- a/include/asm-arm/io.h
+++ b/include/asm-arm/io.h
@@ -57,6 +57,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 /*
  * Generic virtual read/write.  Note that we don't support half-word
  * read/writes.  We define __arch_*[bl] here, and leave __arch_*w
diff --git a/include/asm-avr32/io.h b/include/asm-avr32/io.h
index 06e52b1..d22cd35 100644
--- a/include/asm-avr32/io.h
+++ b/include/asm-avr32/io.h
@@ -125,4 +125,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
len)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_AVR32_IO_H */
diff --git a/include/asm-blackfin/io.h b/include/asm-blackfin/io.h
index da58914..6806494 100644
--- a/include/asm-blackfin/io.h
+++ b/include/asm-blackfin/io.h
@@ -64,6 +64,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 /*
  * These are for ISA/PCI shared memory _only_ and should never be used
  * on any other type of memory, including Zorro memory. They are meant to
diff --git a/include/asm-i386/io.h b/include/asm-i386/io.h
index 2c57140..9b757d4 100644
--- a/include/asm-i386/io.h
+++ b/include/asm-i386/io.h
@@ -229,4 +229,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 #endif
diff --git a/include/asm-m68k/io.h b/include/asm-m68k/io.h
index 1fccc12..50ea087 100644
--- a/include/asm-m68k/io.h
+++ b/include/asm-m68k/io.h
@@ -251,4 +251,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_M68K_IO_H__ */
diff --git a/include/asm-microblaze/io.h b/include/asm-microblaze/io.h
index 8804724..7e190d1 100644
--- a/include/asm-microblaze/io.h
+++ b/include/asm-microblaze/io.h
@@ -155,4 +155,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 #endif /* __MICROBLAZE_IO_H__ */
diff --git a/include/asm-mips/io.h b/include/asm-mips/io.h
index 3a0f33f..031186d 100644
--- a/include/asm-mips/io.h
+++ b/include/asm-mips/io.h
@@ -118,7 +118,7 @@ static inline void set_io_port_base(unsigned long base)
  * Change virtual addresses to physical addresses and vv.
  * These are trivial on the 1:1 Linux/MIPS mapping
  */
-extern inline unsigned long virt_to_phys(volatile void * address)
+extern inline phys_addr_t virt_to_phys(void * address)
 {
return CPHYSADDR(address);
 }
diff --git a/include/asm-nios/io.h b/include/asm-nios/io.h
index 8b78806..899682c 100644
--- a/include/asm-nios/io.h
+++ b/include/asm-nios/io.h
@@ -133,4 +133,9 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 #endif /* __ASM_NIOS_IO_H_ */
diff --git a/include/asm-nios2/io.h b/include/asm-nios2/io.h
index 2f1ec26..01d11ef 100644
--- a/include/asm-nios2/io.h
+++ b/include/asm-nios2/io.h
@@ -53,6 +53,11 @@ static inline void unmap_physmem(void *vaddr, unsigned long 
flags)
 
 }
 
+static inline phys_addr_t virt_to_phys(void * vaddr)
+{
+   return (phys_addr_t)(vaddr);
+}
+
 extern unsigned char inb (unsigned char *port);
 extern unsigned short inw (unsigned short *port);
 extern unsigned inl (unsigned port);
diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index c349681..c00de45 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -298,4 +298,9 @@ static inline void unmap_physmem(void *vaddr, u

[U-Boot] [PATCH v4 4/4] ppc: Use addrmap in virt_to_phys and map_physmem.

2008-12-13 Thread Kumar Gala
If we have addr map support enabled use the mapping functions to
implement virt_to_phys() and map_physmem().

Signed-off-by: Kumar Gala 
---
* No change, just reposting as part of the sequence

 include/asm-ppc/io.h |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h
index c00de45..a8003ef 100644
--- a/include/asm-ppc/io.h
+++ b/include/asm-ppc/io.h
@@ -10,6 +10,10 @@
 #include 
 #include 
 
+#ifdef CONFIG_ADDR_MAP
+#include 
+#endif
+
 #define SIO_CONFIG_RA   0x398
 #define SIO_CONFIG_RD   0x399
 
@@ -287,7 +291,11 @@ extern inline void out_be32(volatile unsigned __iomem 
*addr, int val)
 static inline void *
 map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
 {
+#ifdef CONFIG_ADDR_MAP
+   return (void *)(addrmap_phys_to_virt(paddr));
+#else
return (void *)((unsigned long)paddr);
+#endif
 }
 
 /*
@@ -300,7 +308,11 @@ static inline void unmap_physmem(void *vaddr, unsigned 
long flags)
 
 static inline phys_addr_t virt_to_phys(void * vaddr)
 {
+#ifdef CONFIG_ADDR_MAP
+   return addrmap_virt_to_phys(vaddr);
+#else
return (phys_addr_t)(vaddr);
+#endif
 }
 
 #endif
-- 
1.5.6.5

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


[U-Boot] [PATCH v4 3/4] 85xx: Add support to populate addr map based on TLB settings

2008-12-13 Thread Kumar Gala
Signed-off-by: Kumar Gala 
---
* Folded in Becky's phys_size_t changes

 cpu/mpc85xx/tlb.c |   34 ++
 include/asm-ppc/mmu.h |3 +++
 lib_ppc/board.c   |8 
 3 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/cpu/mpc85xx/tlb.c b/cpu/mpc85xx/tlb.c
index a2d16ae..5b5f791 100644
--- a/cpu/mpc85xx/tlb.c
+++ b/cpu/mpc85xx/tlb.c
@@ -26,6 +26,11 @@
 #include 
 #include 
 #include 
+#ifdef CONFIG_ADDR_MAP
+#include 
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
 
 void set_tlb(u8 tlb, u32 epn, u64 rpn,
 u8 perms, u8 wimge,
@@ -47,6 +52,11 @@ void set_tlb(u8 tlb, u32 epn, u64 rpn,
mtspr(MAS7, _mas7);
 #endif
asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+   if ((tlb == 1) && (gd->flags & GD_FLG_RELOC))
+   addrmap_set_entry(epn, rpn, (1UL << ((tsize * 2) + 10)), esel);
+#endif
 }
 
 void disable_tlb(u8 esel)
@@ -67,6 +77,11 @@ void disable_tlb(u8 esel)
mtspr(MAS7, _mas7);
 #endif
asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+   if (gd->flags & GD_FLG_RELOC)
+   addrmap_set_entry(0, 0, 0, esel);
+#endif
 }
 
 void invalidate_tlb(u8 tlb)
@@ -91,6 +106,25 @@ void init_tlbs(void)
return ;
 }
 
+#ifdef CONFIG_ADDR_MAP
+void init_addr_map(void)
+{
+   int i;
+
+   for (i = 0; i < num_tlb_entries; i++) {
+   if (tlb_table[i].tlb == 0)
+   continue;
+
+   addrmap_set_entry(tlb_table[i].epn,
+   tlb_table[i].rpn,
+   (1UL << ((tlb_table[i].tsize * 2) + 10)),
+   tlb_table[i].esel);
+   }
+
+   return ;
+}
+#endif
+
 unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg)
 {
unsigned int tlb_size;
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h
index 8975e6c..6d942d0 100644
--- a/include/asm-ppc/mmu.h
+++ b/include/asm-ppc/mmu.h
@@ -431,6 +431,9 @@ extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
 extern void disable_tlb(u8 esel);
 extern void invalidate_tlb(u8 tlb);
 extern void init_tlbs(void);
+#ifdef CONFIG_ADDR_MAP
+extern void init_addr_map(void);
+#endif
 extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 
 #define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, 
_iprot) \
diff --git a/lib_ppc/board.c b/lib_ppc/board.c
index 289a32a..61c29b5 100644
--- a/lib_ppc/board.c
+++ b/lib_ppc/board.c
@@ -75,6 +75,10 @@
 #include 
 #endif
 
+#ifdef CONFIG_ADDR_MAP
+#include 
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -694,6 +698,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
 */
trap_init (dest_addr);
 
+#if defined(CONFIG_ADDR_MAP) && defined(CONFIG_E500)
+   init_addr_map();
+#endif
+
 #if defined(CONFIG_BOARD_EARLY_INIT_R)
board_early_init_r ();
 #endif
-- 
1.5.6.5

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


Re: [U-Boot] [PATCH 05/11] lib_generic/addr_map: Change size to phys_size_t from ulong

2008-12-13 Thread Kumar Gala

On Dec 3, 2008, at 11:04 PM, Becky Bruce wrote:

> Some parts can support large physical mappings; so make the
> size argument to addrmap_set_entry a phys_size_t.  Also update
> the 85xx tlb code to be sure the size quantity is unsigned.
>
> Signed-off-by: Becky Bruce 
> ---
> cpu/mpc85xx/tlb.c  |4 ++--
> include/addr_map.h |2 +-
> lib_generic/addr_map.c |4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)

I reposted my patches (v4) and folded this into those patches.

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