Re: [U-Boot] [PATCH 5/7 V4] SPI: Add SPI Driver for EXYNOS.

2012-08-19 Thread Joonyoung Shim
Hi,

2012/8/2 Rajeshwari Shinde :
> This patch adds SPI driver for EXYNOS.
>
> Signed-off-by: Simon Glass 
> Signed-off-by: Padmavathi Venna 
> Signed-off-by: Gabe Black 
> Signed-off-by: Rajeshwari Shinde 
> ---
> Changes in V2:
> - None.
> Changes in V3:
> - Removed SPI_SLAVE flag.
> Changes in V4:
> - Rebased on Mainline u-boot.git.
> - Removed variable bus_count and DECLARE_GLOBAL_DATA_PTR;
> - Function spi_flush_fifo made static.
>  arch/arm/include/asm/arch-exynos/spi.h |   78 +++
>  drivers/spi/Makefile   |1 +
>  drivers/spi/exynos_spi.c   |  364 
> 
>  3 files changed, 443 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/include/asm/arch-exynos/spi.h
>  create mode 100644 drivers/spi/exynos_spi.c
>

I tested this driver is working at the exynos5250

Tested-by: jy0922.s...@samsung.com


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


[U-Boot] [PATCH 1/4] spiflash: at25: using common spi flash operation

2012-08-19 Thread Bo Shen
Using common spi flash operation function to replace private operation
funtion

This patch is based on http://patchwork.ozlabs.org/patch/177896/
which has been merged by Mike frysinger

Signed-off-by: Bo Shen 
---
 drivers/mtd/spi/atmel.c |   11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c
index 89ebe9d..006f6d5 100644
--- a/drivers/mtd/spi/atmel.c
+++ b/drivers/mtd/spi/atmel.c
@@ -518,13 +518,19 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave 
*spi, u8 *idcode)
asf->flash.erase = dataflash_erase_p2;
}
 
+   asf->flash.page_size = page_size;
+   asf->flash.sector_size = page_size;
break;
 
case DF_FAMILY_AT26F:
case DF_FAMILY_AT26DF:
asf->flash.read = spi_flash_cmd_read_fast;
-   asf->flash.write = dataflash_write_p2;
-   asf->flash.erase = dataflash_erase_p2;
+   asf->flash.write = spi_flash_cmd_write_multi;
+   asf->flash.erase = spi_flash_cmd_erase;
+   asf->flash.page_size = page_size;
+   asf->flash.sector_size = 4096;
+   /* clear SPRL# bit for locked flash */
+   spi_flash_cmd_write_status(&asf->flash, 0);
break;
 
default:
@@ -532,7 +538,6 @@ struct spi_flash *spi_flash_probe_atmel(struct spi_slave 
*spi, u8 *idcode)
goto err;
}
 
-   asf->flash.sector_size = page_size;
asf->flash.size = page_size * params->pages_per_block
* params->blocks_per_sector
* params->nr_sectors;
-- 
1.7.9.5

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


[U-Boot] [PATCH 4/4] atmel: at91sam9x5: add spi flash boot support

2012-08-19 Thread Bo Shen
Add at91sam9x5 series spi flash boot support

Using at91sam9x5ek_spiflash to configure, then it can boot from at25df321
serial flash

SPI mater work in 30Mhz speed, while not 1Mhz speed. This will base on
atmel_spi patch, or else, it will occur receive overrun

Signed-off-by: Bo Shen 
---
 boards.cfg |1 +
 include/configs/at91sam9x5ek.h |   20 
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/boards.cfg b/boards.cfg
index edd750c..343ff0c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -91,6 +91,7 @@ at91sam9m10g45ek_nandflash   arm arm926ejs   
at91sam9m10g45ekatmel
 at91sam9rlek_dataflash   arm arm926ejs   at91sam9rlekatmel 
 at91at91sam9rlek:AT91SAM9RL,SYS_USE_DATAFLASH
 at91sam9rlek_nandflash   arm arm926ejs   at91sam9rlekatmel 
 at91at91sam9rlek:AT91SAM9RL,SYS_USE_NANDFLASH
 at91sam9x5ek_nandflash   arm arm926ejs   at91sam9x5ekatmel 
 at91at91sam9x5ek:AT91SAM9X5,SYS_USE_NANDFLASH
+at91sam9x5ek_spiflasharm arm926ejs   at91sam9x5ekatmel 
 at91at91sam9x5ek:AT91SAM9X5,SYS_USE_SPIFLASH
 at91sam9xeek_dataflash_cs0   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS0
 at91sam9xeek_dataflash_cs1   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_DATAFLASH_CS1
 at91sam9xeek_nandflash   arm arm926ejs   at91sam9260ek   atmel 
 at91at91sam9260ek:AT91SAM9XE,SYS_USE_NANDFLASH
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h
index 82f6b48..5cae6bd 100644
--- a/include/configs/at91sam9x5ek.h
+++ b/include/configs/at91sam9x5ek.h
@@ -86,6 +86,7 @@
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_DHCP
 #define CONFIG_CMD_NAND
+#define CONFIG_CMD_SF
 
 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS   1
@@ -96,12 +97,11 @@
(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
-#ifdef CONFIG_ATMEL_SPI
-#define CONFIG_CMD_SF
-#define CONFIG_CMD_SPI
+#ifdef CONFIG_CMD_SF
+#define CONFIG_ATMEL_SPI
 #define CONFIG_SPI_FLASH
 #define CONFIG_SPI_FLASH_ATMEL
-#define CONFIG_SYS_MAX_DATAFLASH_BANKS
+#define CONFIG_SF_DEFAULT_SPEED3000
 #endif
 
 /* no NOR flash */
@@ -149,6 +149,18 @@
 #define CONFIG_BOOTCOMMAND "nand read " \
"0x2200 0x20 0x30; " \
"bootm 0x2200"
+#else
+#ifdef CONFIG_SYS_USE_SPIFLASH
+/* bootstrap + u-boot + env + linux in spi flash */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
+#define CONFIG_ENV_OFFSET  0x5000
+#define CONFIG_ENV_SIZE0x3000
+#define CONFIG_ENV_SECT_SIZE   0x1000
+#define CONFIG_ENV_SPI_MAX_HZ  3000
+#define CONFIG_BOOTCOMMAND "sf probe 0; " \
+   "sf read 0x2200 0x10 0x30; " \
+   "bootm 0x2200"
+#endif
 #endif
 
 #define CONFIG_BOOTARGS"mem=128M console=ttyS0,115200 " \
-- 
1.7.9.5

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


[U-Boot] [PATCH 3/4] atmel: at91sam9x5: fix name error for spi

2012-08-19 Thread Bo Shen
Fix the name error

Signed-off-by: Bo Shen 
---
 arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 
b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 7558ca2..6d77219 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -121,7 +121,7 @@ void at91_serial2_hw_init(void)
 #ifdef CONFIG_ATMEL_SPI
 void at91_spi0_hw_init(unsigned long cs_mask)
 {
-   at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+   at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
at91_set_a_periph(AT91_PIO_PORTA, 11, 0);   /* SPI0_MISO */
at91_set_a_periph(AT91_PIO_PORTA, 12, 0);   /* SPI0_MOSI */
@@ -150,7 +150,7 @@ void at91_spi0_hw_init(unsigned long cs_mask)
 
 void at91_spi1_hw_init(unsigned long cs_mask)
 {
-   at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_PMC_BASE;
+   at91_pmc_t *pmc = (at91_pmc_t *) ATMEL_BASE_PMC;
 
at91_set_b_periph(AT91_PIO_PORTA, 21, 0);   /* SPI1_MISO */
at91_set_b_periph(AT91_PIO_PORTA, 22, 0);   /* SPI1_MOSI */
-- 
1.7.9.5

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


[U-Boot] [PATCH 2/4] spi: atmel: add WDRBT bit to avoid receive overrun

2012-08-19 Thread Bo Shen
The atmel at91sam9x5 series spi has feature to avoid receive overren

Using the patch to enable it

Signed-off-by: Bo Shen 
---
 drivers/spi/atmel_spi.c |3 +++
 drivers/spi/atmel_spi.h |1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c
index 83ef8e8..c7a51f7 100644
--- a/drivers/spi/atmel_spi.c
+++ b/drivers/spi/atmel_spi.c
@@ -92,6 +92,9 @@ struct spi_slave *spi_setup_slave(unsigned int bus, unsigned 
int cs,
as->slave.cs = cs;
as->regs = regs;
as->mr = ATMEL_SPI_MR_MSTR | ATMEL_SPI_MR_MODFDIS
+#if defined(CONFIG_AT91SAM9X5)
+   | ATMEL_SPI_MR_WDRBT
+#endif
| ATMEL_SPI_MR_PCS(~(1 << cs) & 0xf);
spi_writel(as, CSR(cs), csrx);
 
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
index 8b69a6d..057de9a 100644
--- a/drivers/spi/atmel_spi.h
+++ b/drivers/spi/atmel_spi.h
@@ -26,6 +26,7 @@
 #define ATMEL_SPI_MR_PCSDEC(1 << 2)
 #define ATMEL_SPI_MR_FDIV  (1 << 3)
 #define ATMEL_SPI_MR_MODFDIS   (1 << 4)
+#define ATMEL_SPI_MR_WDRBT (1 << 5)
 #define ATMEL_SPI_MR_LLB   (1 << 7)
 #define ATMEL_SPI_MR_PCS(x)(((x) & 15) << 16)
 #define ATMEL_SPI_MR_DLYBCS(x) ((x) << 24)
-- 
1.7.9.5

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


Re: [U-Boot] [PATCH V3 0/4] common/lcd cleanup

2012-08-19 Thread Nikita Kiryanov

Gentle ping.

On 08/09/2012 01:14 PM, Nikita Kiryanov wrote:

This patch series attempts to simplify #ifdef complexity in common/lcd.c.

It was compile tested on Arm and PowerPC using MAKEALL

Changes in V3:
- Rebased on latest u-boot-video
- Removed volatile qualifiers in patch 3 since the use of volatile is
discouraged and it looks like it is safe to remove them.

Changes in V2:
- Rebased on u-boot-video
- patches 2 and 3 of original patchset dropped because I'm not sure
what to do about them
- simplify lcd_logo: used bitmap_display() to further simplify code
- simplify lcd_display_bitmap: fixed pointer increment error
- simplify lcd_display_bitmap: change to simplify lcd_logo breaks
MCC200 board because it does not #define CONFIG_CMD_BMP. Added a local
implementation of bitmap_display().

Nikita Kiryanov (4):
   common lcd: simplify lcd_logo
   common lcd: simplify lcd_display
   common lcd: simplify core functions
   common lcd: simplify lcd_display_bitmap

  board/mcc200/lcd.c |   20 +++
  common/lcd.c   |  145 +++-
  2 files changed, 96 insertions(+), 69 deletions(-)



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


Re: [U-Boot] [PATCH] common/lcd: add protection from null bmp pointer

2012-08-19 Thread Nikita Kiryanov

On 08/18/2012 02:09 PM, Jeroen Hofstee wrote:

Hi,

On 08/16/2012 12:43 PM, Nikita Kiryanov wrote:

If the bmp pointer is null (for example because the environment
variable "splashimage" was not defined) then U-Boot will get stuck
when trying to load the image.

Which branch is this? At [1] there is a check for this..

1600 s = getenv("splashimage");
1601 if (s != NULL) {
...

Regards,
Jeroen

[1]  drivers/video/cfb_console.c.

Just ignore above, since there are apparently more BMP drawing routines,
and I mentioned the wrong one. The same check is in lcd.c though:

822: if (do_splash && (s = getenv("splashimage")) != NULL) {


You are right; the null splashimage scenario was apparently a bad choice of
example. However, lcd_display_bitmap is not a static function, and it 
appears
in lcd.h. This means that someone might use it outside of common/lcd.c 
context,

and for that reason it should be made more fault tolerant.

I'll resubmit the patch without the splashimage example in the commit 
message.

Regards,
Jeroen



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


Re: [U-Boot] [U-Boot-DM] [PATCH 3/3] dm: mips: Fix warnings in lb60 board

2012-08-19 Thread Xiangfu Liu

Thanks Marek Vasu, Daniel Schwierzeck,

Xiangfu

On 08/20/2012 02:19 AM, Daniel Schwierzeck wrote:

2012/7/27 Marek Vasut :

The lb60 board accesses the clkgr register, which is 32bit via
16bit IO ops. This causes malfunction. Fix this.

qi_lb60.c: In function ‘cpm_init’:
qi_lb60.c:72:2: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]
qi_lb60.c:84:2: warning: dereferencing type-punned pointer will break 
strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Marek Vasut 
Cc: Daniel 
Cc: Shinya Kuribayashi 
Cc: Xiangfu Liu 
---
  board/qi/qi_lb60/qi_lb60.c |4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)


applied to u-boot-mips/master, thanks



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


[U-Boot] [PATCH V2] common/lcd: add protection from null bmp pointer

2012-08-19 Thread Nikita Kiryanov
If the bmp pointer is null then U-Boot will get stuck when trying
to load the image.
What's worse, it will get stuck before the U-Boot shell becomes
available to the user, thus making it difficult to correct the
situation.

To protect from the above scenario, check if the pointer is valid.

Signed-off-by: Nikita Kiryanov 
---
This patch depends on the following patch:
patchwork.ozlabs.org/patch/176058/
Changes in V2:
- Previous commit message gave an incorrect example of when bmp pointer
could be null, and was therefore removed.
 common/lcd.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index 88dfa51..fcc09ac 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -674,7 +674,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
unsigned long pwidth = panel_info.vl_col;
unsigned colors, bpix, bmp_bpix;
 
-   if (!((bmp->header.signature[0] == 'B') &&
+   if (!bmp || !((bmp->header.signature[0] == 'B') &&
(bmp->header.signature[1] == 'M'))) {
printf("Error: no valid bmp image at %lx\n", bmp_image);
 
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH v5] arm: rmobile: Add support Renesas SH73A0

2012-08-19 Thread Mike Frysinger
On Sunday 19 August 2012 10:40:05 Nobuhiro Iwamatsu wrote:
> --- /dev/null
> +++ b/arch/arm/cpu/armv7/rmobile/board.c
>
> +#ifdef CONFIG_DISPLAY_BOARDINFO
> +int checkboard(void)
> +{
> + printf("Board: %s\n", sysinfo.board_string);
> + return 0;
> +}
> +#endif /* CONFIG_DISPLAY_BOARDINFO */

seems like you could have the makefile do:
COBJS-$(CONFIG_DISPLAY_BOARDINFO) += board.o

then you wouldn't need these ifdefs in this file

> --- /dev/null
> +++ b/arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c
>
> +#ifdef CONFIG_DISPLAY_CPUINFO
> +u32 rmobile_get_cpu_type(void)
> +{
> + u32 id;
> + u32 type;
> + struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
> +
> + id = readl(hpb->cccr);
> + type = (id >> 8) & 0xFF;
> +
> + return type;
> +}
> +
> +u32 get_cpu_rev(void)
> +{
> + u32 id;
> + u32 rev;
> + struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
> +
> + id = readl(hpb->cccr);
> + rev = (id >> 4) & 0xF;
> +
> + return rev;
> +}
> +#endif /* CONFIG_DISPLAY_CPUINFO */

seems like you could have the makefile do:
COBJS-$(CONFIG_DISPLAY_CPUINFO) += board.o

then you wouldn't need these ifdefs in this file
-mike


signature.asc
Description: This is a digitally signed message part.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] rmobile: Add README

2012-08-19 Thread Nobuhiro Iwamatsu
On Sat, Aug 11, 2012 at 12:07 AM, Tom Rini  wrote:
> On 08/10/2012 12:19 AM, Nobuhiro Iwamatsu wrote:
>> Hi,
>>
>> On Fri, Aug 10, 2012 at 2:03 AM, Tom Rini  wrote:
>>> On Thu, Aug 09, 2012 at 11:30:24PM +0900, Nobuhiro Iwamatsu wrote:
 This add README of Renesas RMOBILE.
 Based doc/README.omap3.

 Signed-off-by: Nobuhiro Iwamatsu 
 ---
  doc/README.rmobile |   46 ++
  1 file changed, 46 insertions(+)
  create mode 100644 doc/README.rmobile

 diff --git a/doc/README.rmobile b/doc/README.rmobile
 new file mode 100644
 index 000..b6acb28
 --- /dev/null
 +++ b/doc/README.rmobile
 @@ -0,0 +1,46 @@
 +Summary
 +===
 +
 +This README is about U-Boot support for Renesas's ARM Cortex-A9 based 
 RMOBILE[1]
 +family of SoCs. Renesas's RMOBILE SoC family contains an ARM Cortex-A9.
 +
 +Currently the following boards are supported:
 +
 +* KMC KZM-A9-GT [2]
 +
 +* Atmark-Techno Armadillo-800-EVA [3]
 +
 +Toolchain
 +=
 +
 +While ARM Cortex-A9 support ARM v7 instruction set (-march=armv7a) we 
 compile
 +with -march=armv5 to allow more compilers to work. For U-Boot code this 
 has
 +no performance impact.
>>>
>>> Is this really an issue today?  Between ELDK, Linaro and CodeSourcey
>>> (and many other options too) it's really easy to get a v7 toolchain.
>>>
>>
>> You are right. I will fix this sentence.
>
> Was the doc wrong or do you mean you'll change the Makefile as well? :)
>  Thanks!

No, I don' t change Makefile. I will add infomation about how to get compiler.

Nobuhiro


-- 
Nobuhiro Iwamatsu
   iwamatsu at {nigauri.org / debian.org}
   GPG ID: 40AD1FA6
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Early malloc() summary

2012-08-19 Thread Graeme Russ
Hi Tomas,

On Sun, Aug 19, 2012 at 11:21 PM, Tomas Hlavacek  wrote:
> Hello Graeme!
>
> On Fri, Aug 17, 2012 at 3:15 AM, Graeme Russ  wrote:
>> dm_malloc(bytes, driver *)
>>   |
>>   +-> early_malloc(bytes, reloc_helper *)  /* Pre-Relocation */
>>   | |
>>   | +->register_helper(reloc_helper *)
>>   | |
>>   | +->pre_reloc_malloc(size_t bytes)
>>   |
>>   +-> malloc(bytes)/* Post-Relocation */
>>
>>
>> Drivers call dm_malloc(), helper functions call early_malloc()
>>
>> dm_malloc() is implemented in the DM core code and checks for whether the
>> call is pre- or post- relocation. If pre-relocation, it checks for the
>> driver having a relocation helper (or the 'I don't need one' flag)
>>
>> early_malloc() is implemented in the early malloc code seperate from the
>> DM code.
>>
>>  WARNING!!! STOP READING NOW!!! 
>>
>> early_malloc() registers a relocation function (if provided) which will be
>> called during relocation. DM core will strip this out as it will (for the
>> time being) handle the calling of the relocation helper for each of the
>> registered drivers. In the long term, I think that responsibility might be
>> able to be taken away from DM core (but there may be call-order issues that
>> might make that impossible)
>>
>> The way I imagine it in the future, any code that might possible allocate
>> memory prior to relocation would do something like:
>>
>> static int my_relocator(void *data)
>> {
>>   struct foo *new_bar;
>>
>>   new_bar = malloc(sizeof(struct foo));
>>   mem_cpy(new_bar, data, sizeof(struct foo));
>>
>>   /* Tweak internal new_bar members */
>>
>>   return 0;
>> }
>>
>> int some_function()
>> {
>>   struct foo *bar;
>>
>>   bar = malloc(sizeof(struct foo));
>>   register_helper(bar, my_relocator);
>>
>>   return 0;
>> }
>>
>>
>> And behind the scenes we have:
>>
>> data = malloc(bytes);
>>   |
>>   +->data = pre_reloc_malloc(size_t bytes)   /* Pre-Relocation */
>>   | |
>>   | +->add_to_reloc_list(data)
>>   | |
>>   | +->return data;
>>   |
>>   +->malloc(size_t bytes);   /* Post-Relocation */
>>
>> register_helper(data, reloc_helper *)
>>   |
>>   +->update_reloc_list(data, reloc_helper *) /* Pre-Relocation */
>>   |
>>   +->Do Nothing  /* Post-Relocation */
>>
>> During relocation, the 'reloc list' is processed. Each 'data' entry with no
>> 'reloc_helper' will elicite a (debug) warning to let you know about data
>> that was allocated but will not be relocated.
>
> OK, I got this. It seems to me that everything starts with
> pre_reloc_malloc(). And I think that this is roughly equivalent to my
> void *early_malloc(size_t) function in previous experimental patches.

Correct

> But I am not sure that the identifier pre_reloc_malloc() is proper for
> this function because on archs without strict separation of
> board_init_f and board_init_r, where the U-Boot is running in RAM from
> the very beginning and no relocation is needed (microblaze, nios2,
> openrisc, sh) it does not reflect the actual use - it is the function

Good point, which also highlights why wrapping malloc() might be a good
approach. Architectures which already have SDRAM initialised (either by the
Soc's IPL or the board's SPL for example) prior to U-Boot being loaded
should be allowed to initialise the malloc heap 'extremely early' (perhaps
before even console output). In such cases, there would not be a need to
perform any kind of malloc chunk relocations

> used to obtain allocation from early_heap. And I think that in case of
> that architectures we still need early_heap and working dm_malloc()

Yes, but as above, in some cases early heap may be one and the same as
'late' heap

> before the true malloc() is initialized. (It is because we might still
> need to create the DM tree before malloc is initialized to facilitate
> DM part of actual memory and malloc initialization.)

I think it may be a good exercise (later, not now) to look at these 'U-Boot
already running in RAM' cases and see if 'late' malloc can be initialised
before DM...

> I am thinking about a way to obtain some space for the first
> early_heap (assuming that I have the heap header you suggested some
> time ago that has void *next_early_heap for future expansion with
> arch-specific or CPU/board-specific ways to grab non-contiguous
> early_heap). Do you know some elegant way to obtain some early_heap
> space that would work on each architectures in question? It came to my

No - it is very arch specific. Some may allocate from locked cach lines,
others from SRAM - Who knows. That is why I suggested a brk() function
that would do the allocation in the background.

> mind that I can steal the space from the early stack by something like
> this:
>
> #define DECLARE_EARLY_HEAP_ON_STACK char
> __early_heap[CONFIG_SYS_EARLY_HEAP_SIZE]; \
>   

[U-Boot] Ethernet-USB adapter

2012-08-19 Thread Daniel Ścisłowski
Hello,

using U-Boot 2012.07 how I can run ethernet via USB. I have Moschip
Semiconductor UA0025C and USB Hub. But how to set MAC address? When board
starts U-Boot shows "No ethernet found". My board is Beagleboard C4.

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


Re: [U-Boot] [PATCH V2] dm: mips: Import libgcc components from Linux

2012-08-19 Thread Daniel Schwierzeck
2012/7/27 Marek Vasut :
> Import ashldr3, ashrdi3 and lshrdi3 to squash possible libgcc fp mismatch,
> resulting in the following warning:
>
> mips-linux-gnu-ld: Warning: 
> /usr/lib/gcc/mips-linux-gnu/4.7/libgcc.a(_lshrdi3.o) uses hard float, u-boot 
> uses soft float
> mips-linux-gnu-ld: Warning: 
> /usr/lib/gcc/mips-linux-gnu/4.7/libgcc.a(_ashldi3.o) uses hard float, u-boot 
> uses soft float
>
> Imported from Linux (linux-next 20120723) as of commit:
>
> commit 72fbfb260197a52c2bc2583f3e8f15d261d0f924
> Author: Ralf Baechle 
> Date:   Wed Jun 7 13:25:37 2006 +0100
>
> [MIPS] Fix optimization for size build.
>
> It took a while longer than on other architectures but gcc has finally
> started to strike us as well ...
>
> This also fixes the damage by 6edfba1b33c701108717f4e036320fc39abe1912.
>
> Signed-off-by: Ralf Baechle 
>
> Signed-off-by: Marek Vasut 
> Cc: Daniel Schwierzeck 
> ---
>  arch/mips/config.mk |2 ++
>  arch/mips/lib/Makefile  |   20 
>  arch/mips/lib/ashldi3.c |   25 +
>  arch/mips/lib/ashrdi3.c |   27 +++
>  arch/mips/lib/libgcc.h  |   25 +
>  arch/mips/lib/lshrdi3.c |   25 +
>  6 files changed, 124 insertions(+)
>  create mode 100644 arch/mips/lib/ashldi3.c
>  create mode 100644 arch/mips/lib/ashrdi3.c
>  create mode 100644 arch/mips/lib/libgcc.h
>  create mode 100644 arch/mips/lib/lshrdi3.c
>
> V2: Wrap this into USE_PRIVATE_LIBGCC
>
> diff --git a/arch/mips/config.mk b/arch/mips/config.mk
> index 6ab8acd..4dd1805 100644
> --- a/arch/mips/config.mk
> +++ b/arch/mips/config.mk
> @@ -52,3 +52,5 @@ PLATFORM_CPPFLAGS += -msoft-float
>  PLATFORM_LDFLAGS   += -G 0 -static -n -nostdlib
>  PLATFORM_RELFLAGS  += -ffunction-sections -fdata-sections
>  LDFLAGS_FINAL  += --gc-sections
> +
> +USE_PRIVATE_LIBGCC = yes

I removed that last line as demanded by Wolfgang.

applied to u-boot-mips/master, thanks

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


Re: [U-Boot] [U-Boot-DM] [PATCH 3/3] dm: mips: Fix warnings in lb60 board

2012-08-19 Thread Daniel Schwierzeck
2012/7/27 Marek Vasut :
> The lb60 board accesses the clkgr register, which is 32bit via
> 16bit IO ops. This causes malfunction. Fix this.
>
> qi_lb60.c: In function ‘cpm_init’:
> qi_lb60.c:72:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> qi_lb60.c:84:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
>
> Signed-off-by: Marek Vasut 
> Cc: Daniel 
> Cc: Shinya Kuribayashi 
> Cc: Xiangfu Liu 
> ---
>  board/qi/qi_lb60/qi_lb60.c |4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

applied to u-boot-mips/master, thanks

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


Re: [U-Boot] [U-Boot-DM] [PATCH 2/3] dm: mips: Fix lb60 timer code

2012-08-19 Thread Daniel Schwierzeck
2012/7/27 Marek Vasut :
> The timer code contains more halfword writes which trigger gcc errors.
> The registers are again 32bit, yet written by 16bit writes, fix this:
>
> timer.c: In function ‘reset_timer_masked’:
> timer.c:37:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> timer.c: In function ‘get_timer_masked’:
> timer.c:43:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> timer.c: In function ‘timer_init’:
> timer.c:86:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> timer.c:88:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> timer.c:89:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
> timer.c:90:2: warning: dereferencing type-punned pointer will break 
> strict-aliasing rules [-Wstrict-aliasing]
>
> Signed-off-by: Marek Vasut 
> Cc: Daniel 
> Cc: Shinya Kuribayashi 
> Cc: Xiangfu Liu 
> ---
>  arch/mips/cpu/xburst/timer.c |   12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

applied to u-boot-mips/master, thanks

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


Re: [U-Boot] [PATCH 1/3] dm: mips: Fix lb60 WDT control

2012-08-19 Thread Daniel Schwierzeck
2012/7/27 Marek Vasut :
> Write the TSCR register via 32bit write instead of 16bit one.
> The register is 32bit wide and bit 16 is being set, triggering
> gcc overflow error and making the code broken.
>
> Signed-off-by: Marek Vasut 
> Cc: Daniel 
> Cc: Shinya Kuribayashi 
> Cc: Xiangfu Liu 
> ---
>  arch/mips/cpu/xburst/cpu.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied to u-boot-mips/master, thanks

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


[U-Boot] [PATCH] tegra20: rework UART GPIO handling

2012-08-19 Thread Lucas Stach
Rename board provided gpio_config_uart() to
gpio_early_init_uart() as it does the same thing as the equally
called function provided by the uart-switch code. This allows
to simply call this function in early board init whether or not
we are building with CONFIG_UART_SWITCH defined.

Also provide a weak symbol for this function, to avoid the
need to provide this function for boards that don't need any
fixup.

This patch supersedes the earlier posted
"tegra: convert gpio_config_uart to weak symbol".
Build tested with MAKEALL -s tegra20

Signed-off-by: Lucas Stach 
---
 arch/arm/cpu/arm720t/tegra20/board.h   |  2 +-
 arch/arm/cpu/arm720t/tegra20/spl.c |  4 
 board/avionic-design/common/tamonten.c |  7 ---
 board/compal/paz00/paz00.c |  7 ---
 board/compulab/trimslice/trimslice.c   |  7 ---
 board/nvidia/common/board.c| 10 ++
 board/nvidia/harmony/harmony.c |  7 ---
 board/nvidia/seaboard/seaboard.c   |  2 +-
 board/nvidia/whistler/whistler.c   |  7 ---
 9 Dateien geändert, 8 Zeilen hinzugefügt(+), 45 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/arm720t/tegra20/board.h 
b/arch/arm/cpu/arm720t/tegra20/board.h
index 61b91c0..260767d 100644
--- a/arch/arm/cpu/arm720t/tegra20/board.h
+++ b/arch/arm/cpu/arm720t/tegra20/board.h
@@ -22,4 +22,4 @@
  */
 
 void board_init_uart_f(void);
-void gpio_config_uart(void);
+void gpio_early_init_uart(void);
diff --git a/arch/arm/cpu/arm720t/tegra20/spl.c 
b/arch/arm/cpu/arm720t/tegra20/spl.c
index da723ef..183a2e1 100644
--- a/arch/arm/cpu/arm720t/tegra20/spl.c
+++ b/arch/arm/cpu/arm720t/tegra20/spl.c
@@ -65,11 +65,7 @@ void board_init_f(ulong dummy)
board_init_uart_f();
 
/* Initialize periph GPIOs */
-#ifdef CONFIG_SPI_UART_SWITCH
gpio_early_init_uart();
-#else
-   gpio_config_uart();
-#endif
 
/*
 * We call relocate_code() with relocation target same as the
diff --git a/board/avionic-design/common/tamonten.c 
b/board/avionic-design/common/tamonten.c
index a0a4d1d..f5e6f6d 100644
--- a/board/avionic-design/common/tamonten.c
+++ b/board/avionic-design/common/tamonten.c
@@ -41,13 +41,6 @@
 #include 
 #endif
 
-/*
- * Routine: gpio_config_uart
- * Description: Does nothing on Tamonten - no conflict w/SPI.
- */
-void gpio_config_uart(void)
-{
-}
 
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 void gpio_early_init(void)
diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c
index cd684f2..59cf41b 100644
--- a/board/compal/paz00/paz00.c
+++ b/board/compal/paz00/paz00.c
@@ -24,13 +24,6 @@
 #include 
 #endif
 
-/*
- * Routine: gpio_config_uart
- * Description: Does nothing on Paz00 - no conflict w/SPI.
- */
-void gpio_config_uart(void)
-{
-}
 
 #ifdef CONFIG_TEGRA_MMC
 /*
diff --git a/board/compulab/trimslice/trimslice.c 
b/board/compulab/trimslice/trimslice.c
index 5dae15b..f6de19e 100644
--- a/board/compulab/trimslice/trimslice.c
+++ b/board/compulab/trimslice/trimslice.c
@@ -34,13 +34,6 @@
 #include 
 #endif
 
-/*
- * Routine: gpio_config_uart
- * Description: Does nothing on TrimSlice - no UART-related GPIOs.
- */
-void gpio_config_uart(void)
-{
-}
 
 void pin_mux_spi(void)
 {
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 7ab2040..78e136a 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -72,6 +72,11 @@ void __pin_mux_spi(void)
 
 void pin_mux_spi(void) __attribute__((weak, alias("__pin_mux_spi")));
 
+void __gpio_early_init_uart(void)
+{
+}
+
+void gpio_early_init_uart(void) __attribute__((weak, 
alias("__gpio_early_init_uart")));
 /*
  * Routine: power_det_init
  * Description: turn off power detects
@@ -156,11 +161,8 @@ int board_early_init_f(void)
 
/* Initialize periph GPIOs */
gpio_early_init();
-#ifdef CONFIG_SPI_UART_SWITCH
gpio_early_init_uart();
-#else
-   gpio_config_uart();
-#endif
+
return 0;
 }
 #endif /* EARLY_INIT */
diff --git a/board/nvidia/harmony/harmony.c b/board/nvidia/harmony/harmony.c
index 44977c7..5b75230 100644
--- a/board/nvidia/harmony/harmony.c
+++ b/board/nvidia/harmony/harmony.c
@@ -33,13 +33,6 @@
 #include 
 #endif
 
-/*
- * Routine: gpio_config_uart
- * Description: Does nothing on Harmony - no conflict w/SPI.
- */
-void gpio_config_uart(void)
-{
-}
 
 #ifdef CONFIG_TEGRA_MMC
 /*
diff --git a/board/nvidia/seaboard/seaboard.c b/board/nvidia/seaboard/seaboard.c
index 3298a6b..7c4ff1b 100644
--- a/board/nvidia/seaboard/seaboard.c
+++ b/board/nvidia/seaboard/seaboard.c
@@ -46,7 +46,7 @@ static void gpio_config_uart_seaboard(void)
gpio_direction_output(GPIO_PI3, 0);
 }
 
-void gpio_config_uart(void)
+void gpio_early_init_uart(void)
 {
if (machine_is_ventana())
return;
diff --git a/board/nvidia/whistler/whistler.c b/board/nvidia/whistler/whistler.c
index c0a114d..cad7c48 100644
--- a/board/nvidia/whistler/whistler.c
+++ b/board/nvidia/whistler/whistler.c
@@ -34,13 +34,6 @@
 #include 
 #endif
 
-/*
- * Rout

Re: [U-Boot] [PATCH 2/2] tegra: convert gpio_config_uart to weak symbol

2012-08-19 Thread Lucas Stach
Hi Stephen,

Am Dienstag, den 07.08.2012, 11:09 -0600 schrieb Stephen Warren:
> On 08/06/2012 07:18 PM, Lucas Stach wrote:
> > Most boards don't need this fixup hook. To avoid a lot of empty
> > implementations in board files convert it to a weak symbol.
> 
> This seems OK on the surface, but I think there may be more opportunity
> for cleanup here.
> 
I looked a bit deeper into this and it seems that in fact the logic of
all those calls are correct and none them could be removed.

To clarify what's going on:
if we are building without CONFIG_SPI_UART_SWITCH the board file has to
provide a function gpio_config_uart() to ensure correct GPIO setting and
it's correct to call this in early_init.

Now, if we build with CONFIG_SPI_UART_SWITCH set, the board file stops
providing the gpio_config_uart() and the UART switch provides a
gpio_early_init_uart() function which does essentially the same, so we
call this instead in early init.

The confusing part is that the UART switch now provides a function also
named gpio_config_uart(), which redoes the GPIO setting after relocation
and does some internal state setting.

Now while explaining all this in this email I see how we should make
this more clear with some reasonable renaming, but we won't get around
the weak symbol if we want to keep the possibility for boards to build
without CONFIG_SPI_UART_SWITCH. I'll spin a new patch to untangle this
mess a bit.

Thanks,
Lucas

> In board/nvidia/common/board.c, I see both of the following:
> 
> board_init:
> 
> #ifdef CONFIG_SPI_UART_SWITCH
> gpio_config_uart();
> #endif
> 
> 
> board_early_init_f:
> 
> /* Initialize periph GPIOs */
> gpio_early_init();
> #ifdef CONFIG_SPI_UART_SWITCH
> gpio_early_init_uart();
> #else
> gpio_config_uart();
> #endif
> 
> and in arch/arm/cpu/arm720t/tegra20/spl.c:
> 
> board_init_f:
> 
> #ifdef CONFIG_SPI_UART_SWITCH
> gpio_early_init_uart();
> #else
> gpio_config_uart();
> #endif
> 
> It sure seems like we don't need to call those two init function all
> those times. Perhaps we can clarify which of the functions are actually
> needed at all, and when they should be called.
> 


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


Re: [U-Boot] [PATCH] usb: fix ulpi_set_vbus prototype

2012-08-19 Thread Marek Vasut
Dear Lucas Stach,

> Match the name of the header prototype with the actual
> implementation.

Applied, thanks

> Signed-off-by: Lucas Stach 
> ---
>  include/usb/ulpi.h | 2 +-
>  1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)
> 
> diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
> index 4a23fd2..9a75c24 100644
> --- a/include/usb/ulpi.h
> +++ b/include/usb/ulpi.h
> @@ -61,7 +61,7 @@ int ulpi_select_transceiver(struct ulpi_viewport
> *ulpi_vp, unsigned speed); *
>   * returns 0 on success, ULPI_ERROR on failure.
>   */
> -int ulpi_enable_vbus(struct ulpi_viewport *ulpi_vp,
> +int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp,
>   int on, int ext_power, int ext_ind);
> 
>  /*

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


Re: [U-Boot] [PATCH v3] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread stefano babic
Am 19/08/2012 15:30, schrieb Benoît Thébaudeau:
> Hi Stefano,
> 
> Your detailed description from v1 is gone.
> 

I will add it again

>> Signed-off-by: Stefano Babic 
> 
> Your Cc's from v1 are gone.

This is ok - I used patman this time, and CC are automatically handled
by the tool and discharged from the patch header.

Regards,
Stefano

-- 
=
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


[U-Boot] [PATCH] usb: fix ulpi_set_vbus prototype

2012-08-19 Thread Lucas Stach
Match the name of the header prototype with the actual
implementation.

Signed-off-by: Lucas Stach 
---
 include/usb/ulpi.h | 2 +-
 1 Datei geändert, 1 Zeile hinzugefügt(+), 1 Zeile entfernt(-)

diff --git a/include/usb/ulpi.h b/include/usb/ulpi.h
index 4a23fd2..9a75c24 100644
--- a/include/usb/ulpi.h
+++ b/include/usb/ulpi.h
@@ -61,7 +61,7 @@ int ulpi_select_transceiver(struct ulpi_viewport *ulpi_vp, 
unsigned speed);
  *
  * returns 0 on success, ULPI_ERROR on failure.
  */
-int ulpi_enable_vbus(struct ulpi_viewport *ulpi_vp,
+int ulpi_set_vbus(struct ulpi_viewport *ulpi_vp,
int on, int ext_power, int ext_ind);
 
 /*
-- 
1.7.11.4

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


[U-Boot] [PATCH 3/3] tegra20: add USB ULPI init code

2012-08-19 Thread Lucas Stach
This adds the required code to set up a ULPI USB port. It is
mostly a port of the Linux ULPI setup code with some tweaks
added for more correctness, discovered along the way of
debugging this.

To use this both CONFIG_USB_ULPI and CONFIG_USB_ULPI_VIEWPORT
have to be set in the board configuration file.

Signed-off-by: Lucas Stach 
---
 arch/arm/cpu/armv7/tegra20/usb.c| 131 +---
 arch/arm/include/asm/arch-tegra20/usb.h |  29 +--
 2 Dateien geändert, 145 Zeilen hinzugefügt(+), 15 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/armv7/tegra20/usb.c b/arch/arm/cpu/armv7/tegra20/usb.c
index 77966e5..2ae1244 100644
--- a/arch/arm/cpu/armv7/tegra20/usb.c
+++ b/arch/arm/cpu/armv7/tegra20/usb.c
@@ -32,9 +32,17 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
+#ifdef CONFIG_USB_ULPI
+   #ifndef CONFIG_USB_ULPI_VIEWPORT
+   #error "To use CONFIG_USB_ULPI on Tegra Boards you have to also \
+  define CONFIG_USB_ULPI_VIEWPORT"
+   #endif
+#endif
+
 enum {
USB_PORTS_MAX   = 4,/* Maximum ports we allow */
 };
@@ -68,11 +76,13 @@ enum dr_mode {
 struct fdt_usb {
struct usb_ctlr *reg;   /* address of registers in physical memory */
unsigned utmi:1;/* 1 if port has external tranceiver, else 0 */
+   unsigned ulpi:1;/* 1 if port has external ULPI transceiver */
unsigned enabled:1; /* 1 to enable, 0 to disable */
unsigned has_legacy_mode:1; /* 1 if this port has legacy mode */
enum dr_mode dr_mode;   /* dual role mode */
enum periph_id periph_id;/* peripheral id */
struct fdt_gpio_state vbus_gpio;/* GPIO for vbus enable */
+   struct fdt_gpio_state phy_reset_gpio; /* GPIO to reset ULPI phy */
 };
 
 static struct fdt_usb port[USB_PORTS_MAX]; /* List of valid USB ports */
@@ -187,8 +197,8 @@ static void usbf_reset_controller(struct fdt_usb *config,
 */
 }
 
-/* set up the USB controller with the parameters provided */
-static int init_usb_controller(struct fdt_usb *config,
+/* set up the UTMI USB controller with the parameters provided */
+static int init_utmi_usb_controller(struct fdt_usb *config,
struct usb_ctlr *usbctlr, const u32 timing[])
 {
u32 val;
@@ -300,6 +310,83 @@ static int init_usb_controller(struct fdt_usb *config,
return 0;
 }
 
+#ifdef CONFIG_USB_ULPI
+/* set up the ULPI USB controller with the parameters provided */
+static int init_ulpi_usb_controller(struct fdt_usb *config,
+struct usb_ctlr *usbctlr)
+{
+   u32 val;
+   int loop_count;
+   struct ulpi_regs *ulpi_reg = (struct ulpi_regs *)0;
+   struct ulpi_viewport ulpi_vp;
+
+   /* reset ULPI phy */
+   if (fdt_gpio_isvalid(&config->phy_reset_gpio)) {
+   fdtdec_setup_gpio(&config->phy_reset_gpio);
+   gpio_direction_output(config->phy_reset_gpio.gpio, 0);
+   mdelay(5);
+   gpio_set_value(config->phy_reset_gpio.gpio, 1);
+   }
+
+   /* Reset the usb controller */
+   clock_enable(config->periph_id);
+   usbf_reset_controller(config, usbctlr);
+
+   /* enable pinmux bypass */
+   setbits_le32(&usbctlr->ulpi_timing_ctrl_0,
+ULPI_CLKOUT_PINMUX_BYP | ULPI_OUTPUT_PINMUX_BYP);
+
+   /* Select ULPI parallel interface */
+   clrsetbits_le32(&usbctlr->port_sc1, PTS_MASK, PTS_ULPI << PTS_SHIFT);
+
+   /* enable ULPI transceiver */
+   setbits_le32(&usbctlr->susp_ctrl, ULPI_PHY_ENB);
+
+   /* configure ULPI transceiver timings */
+   val = 0;
+   writel(val, &usbctlr->ulpi_timing_ctrl_1);
+
+   val |= ULPI_DATA_TRIMMER_SEL(4);
+   val |= ULPI_STPDIRNXT_TRIMMER_SEL(4);
+   val |= ULPI_DIR_TRIMMER_SEL(4);
+   writel(val, &usbctlr->ulpi_timing_ctrl_1);
+   udelay(10);
+
+   val |= ULPI_DATA_TRIMMER_LOAD;
+   val |= ULPI_STPDIRNXT_TRIMMER_LOAD;
+   val |= ULPI_DIR_TRIMMER_LOAD;
+   writel(val, &usbctlr->ulpi_timing_ctrl_1);
+
+   /* set up phy for host operation with external vbus supply */
+   ulpi_vp.port_num = 0;
+   ulpi_vp.viewport_addr = (u32)&usbctlr->ulpi_viewport;
+
+   if (ulpi_init(&ulpi_vp)) {
+   debug("Tegra ULPI viewport init failed\n");
+   return -1;
+   }
+
+   ulpi_write(&ulpi_vp, &ulpi_reg->iface_ctrl_set, ULPI_IFACE_PASSTHRU);
+   ulpi_write(&ulpi_vp, &ulpi_reg->otg_ctrl_set, ULPI_OTG_EXTVBUSIND);
+
+   /* enable wakeup events */
+   setbits_le32(&usbctlr->port_sc1, WKCN | WKDS | WKOC);
+
+   setbits_le32(&usbctlr->susp_ctrl, USB_SUSP_CLR);
+   /* Wait for the phy clock to become valid in 100 ms */
+   for (loop_count = 10; loop_count != 0; loop_count--) {
+   if (readl(&usbctlr->susp_ctrl) & USB_PHY_CLK_VALID)
+   break;
+   udelay(1);
+   }
+   if (!loo

[U-Boot] [PATCH 0/3] Tegra 2 USB ULPI series

2012-08-19 Thread Lucas Stach
With this series we are able to initialize USB controllers
using an external ULPI phy AKA USB2 on Tegra 2 devices.

This was tested to work on a Toradex Colibri T20 board,
where USB2 is used to access the ASIX ethernet chipset.
Testing was done with "tegra20: usb: rework set_host_mode"
applied. I did not spot any regressions on the UTMI ports.

Patchset is based on top of u-boot-tegra/next

Lucas Stach (3):
  tegra20: complete periph_id enum
  tegra20: add clock_set_pllout function
  tegra20: add USB ULPI init code

 arch/arm/cpu/armv7/tegra20/usb.c| 131 +---
 arch/arm/cpu/tegra20-common/clock.c |  26 ++
 arch/arm/cpu/tegra20-common/warmboot_avp.c  |   2 +-
 arch/arm/include/asm/arch-tegra20/clk_rst.h |  11 ++-
 arch/arm/include/asm/arch-tegra20/clock.h   |  25 ++
 arch/arm/include/asm/arch-tegra20/usb.h |  29 --
 6 Dateien geändert, 206 Zeilen hinzugefügt(+), 18 Zeilen entfernt(-)

-- 
1.7.11.2

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


[U-Boot] [PATCH 2/3] tegra20: add clock_set_pllout function

2012-08-19 Thread Lucas Stach
Common practice on Tegra 2 boards is to use the pllp_out4 FO
to generate the ULPI reference clock. For this to work we have
to override the default hardware generated output divider.

This function adds a clean way to do so.

Signed-off-by: Lucas Stach 
---
 arch/arm/cpu/tegra20-common/clock.c | 25 +
 arch/arm/cpu/tegra20-common/warmboot_avp.c  |  2 +-
 arch/arm/include/asm/arch-tegra20/clk_rst.h | 11 +--
 arch/arm/include/asm/arch-tegra20/clock.h   | 19 +++
 4 Dateien geändert, 54 Zeilen hinzugefügt(+), 3 Zeilen entfernt(-)

diff --git a/arch/arm/cpu/tegra20-common/clock.c 
b/arch/arm/cpu/tegra20-common/clock.c
index d9bb851..068b552 100644
--- a/arch/arm/cpu/tegra20-common/clock.c
+++ b/arch/arm/cpu/tegra20-common/clock.c
@@ -604,6 +604,31 @@ unsigned long clock_get_periph_rate(enum periph_id 
periph_id,
(readl(reg) & OUT_CLK_DIVISOR_MASK) >> OUT_CLK_DIVISOR_SHIFT);
 }
 
+int clock_set_pllout(enum clock_id clkid, enum pll_out_id pllout, unsigned 
rate)
+{
+   struct clk_pll *pll = get_pll(clkid);
+   int data = 0, div = 0, offset = 0;
+
+   if (!clock_id_is_pll(clkid))
+   return -1;
+
+   div = clk_get_divider(8, pll_rate[clkid], rate);
+
+   if (div < 0)
+   return -1;
+
+   /* out2 and out4 are in the high part of the register */
+   if (pllout == PLL_OUT2 || pllout == PLL_OUT4)
+   offset = 16;
+
+   data = (div << PLL_OUT_RATIO_SHIFT) |
+  PLL_OUT_OVRRIDE | PLL_OUT_CLKEN | PLL_OUT_RSTN;
+   clrsetbits_le32(&pll->pll_out[pllout >> 1],
+   PLL_OUT_RATIO_MASK << offset, data << offset);
+
+   return 0;
+}
+
 /**
  * Find the best available 7.1 format divisor given a parent clock rate and
  * required child clock rate. This function assumes that a second-stage
diff --git a/arch/arm/cpu/tegra20-common/warmboot_avp.c 
b/arch/arm/cpu/tegra20-common/warmboot_avp.c
index cd01908..f6c71cb 100644
--- a/arch/arm/cpu/tegra20-common/warmboot_avp.c
+++ b/arch/arm/cpu/tegra20-common/warmboot_avp.c
@@ -214,7 +214,7 @@ void wb_start(void)
 
reg = PLLM_OUT1_RSTN_RESET_DISABLE | PLLM_OUT1_CLKEN_ENABLE |
  PLLM_OUT1_RATIO_VAL_8;
-   writel(reg, &clkrst->crc_pll[CLOCK_ID_MEMORY].pll_out);
+   writel(reg, &clkrst->crc_pll[CLOCK_ID_MEMORY].pll_out[0]);
 
reg = SCLK_SWAKE_FIQ_SRC_PLLM_OUT1 | SCLK_SWAKE_IRQ_SRC_PLLM_OUT1 |
  SCLK_SWAKE_RUN_SRC_PLLM_OUT1 | SCLK_SWAKE_IDLE_SRC_PLLM_OUT1 |
diff --git a/arch/arm/include/asm/arch-tegra20/clk_rst.h 
b/arch/arm/include/asm/arch-tegra20/clk_rst.h
index 8c3be91..7b548c2 100644
--- a/arch/arm/include/asm/arch-tegra20/clk_rst.h
+++ b/arch/arm/include/asm/arch-tegra20/clk_rst.h
@@ -27,8 +27,7 @@
 /* PLL registers - there are several PLLs in the clock controller */
 struct clk_pll {
uint pll_base;  /* the control register */
-   uint pll_out;   /* output control */
-   uint reserved;
+   uint pll_out[2];/* output control */
uint pll_misc;  /* other misc things */
 };
 
@@ -112,6 +111,14 @@ struct clk_rst_ctlr {
 #define PLL_DIVM_SHIFT 0
 #define PLL_DIVM_MASK  (0x1f << PLL_DIVM_SHIFT)
 
+/* CLK_RST_CONTROLLER_PLLx_OUTx_0 */
+#define PLL_OUT_RSTN   (1 << 0)
+#define PLL_OUT_CLKEN  (1 << 1)
+#define PLL_OUT_OVRRIDE(1 << 2)
+
+#define PLL_OUT_RATIO_SHIFT8
+#define PLL_OUT_RATIO_MASK (0xffU << PLL_OUT_RATIO_SHIFT)
+
 /* CLK_RST_CONTROLLER_PLLx_MISC_0 */
 #define PLL_CPCON_SHIFT8
 #define PLL_CPCON_MASK (15U << PLL_CPCON_SHIFT)
diff --git a/arch/arm/include/asm/arch-tegra20/clock.h 
b/arch/arm/include/asm/arch-tegra20/clock.h
index 20db9e6..dfef51e 100644
--- a/arch/arm/include/asm/arch-tegra20/clock.h
+++ b/arch/arm/include/asm/arch-tegra20/clock.h
@@ -186,6 +186,13 @@ enum periph_id {
PERIPH_ID_NONE = -1,
 };
 
+enum pll_out_id {
+   PLL_OUT1,
+   PLL_OUT2,
+   PLL_OUT3,
+   PLL_OUT4
+};
+
 /* Converts a clock number to a clock register: 0=L, 1=H, 2=U */
 #define PERIPH_REG(id) ((id) >> 5)
 
@@ -218,6 +225,18 @@ unsigned long clock_start_pll(enum clock_id id, u32 divm, 
u32 divn,
u32 divp, u32 cpcon, u32 lfcon);
 
 /**
+ * Set PLL output frequency
+ *
+ * @param clkidclock id
+ * @param pllout   pll output id (
+ * @param rate desired output rate
+ *
+ * @return 0 if ok, -1 on error (invalid clock id or no suitable divider)
+ */
+int clock_set_pllout(enum clock_id clkid, enum pll_out_id pllout,
+ unsigned rate);
+
+/**
  * Read low-level parameters of a PLL.
  *
  * @param id   clock id to read (note: USB is not supported)
-- 
1.7.11.2

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


[U-Boot] [PATCH 1/3] tegra20: complete periph_id enum

2012-08-19 Thread Lucas Stach
Most Tegra boards output the ULPI reference clock on pad DEV2.

Complete the periph_id enum so that we are able to enable this
clock output circuit.

Signed-off-by: Lucas Stach 
---
 arch/arm/cpu/tegra20-common/clock.c   | 1 +
 arch/arm/include/asm/arch-tegra20/clock.h | 6 ++
 2 Dateien geändert, 7 Zeilen hinzugefügt(+)

diff --git a/arch/arm/cpu/tegra20-common/clock.c 
b/arch/arm/cpu/tegra20-common/clock.c
index 2403874..d9bb851 100644
--- a/arch/arm/cpu/tegra20-common/clock.c
+++ b/arch/arm/cpu/tegra20-common/clock.c
@@ -502,6 +502,7 @@ static int clock_periph_id_isvalid(enum periph_id id)
case PERIPH_ID_RESERVED81:
case PERIPH_ID_RESERVED82:
case PERIPH_ID_RESERVED83:
+   case PERIPH_ID_RESERVED91:
printf("Peripheral id %d is reserved\n", id);
break;
default:
diff --git a/arch/arm/include/asm/arch-tegra20/clock.h 
b/arch/arm/include/asm/arch-tegra20/clock.h
index ff83bbf..20db9e6 100644
--- a/arch/arm/include/asm/arch-tegra20/clock.h
+++ b/arch/arm/include/asm/arch-tegra20/clock.h
@@ -175,6 +175,12 @@ enum periph_id {
 
/* 88 */
PERIPH_ID_CRAM2,
+   PERIPH_ID_SYNC_CLK_DOUBLER,
+   PERIPH_ID_CLK_M_DOUBLER,
+   PERIPH_ID_RESERVED91,
+   PERIPH_ID_SUS_OUT,
+   PERIPH_ID_DEV2_OUT,
+   PERIPH_ID_DEV1_OUT,
 
PERIPH_ID_COUNT,
PERIPH_ID_NONE = -1,
-- 
1.7.11.2

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


Re: [U-Boot] [PATCH 2/2] mxs: Use correct function name to initialize dram

2012-08-19 Thread Otavio Salvador
On Sun, Aug 19, 2012 at 12:36 PM, Fabio Estevam  wrote:
> On Sun, Aug 19, 2012 at 12:33 PM, Fabio Estevam  wrote:
>
>> Please discard this patch.
>>
>> Otavio fixed it in another patch related to mx23 series.
>
> Ops, sorry. Otavio based his patch on top of mine, so this one needs
> to be applied.

It shouldn't  matter; GIT will do a 3way merge and apply I think.

-- 
Otavio Salvador O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854  http://projetos.ossystems.com.br
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] mxs: Use correct function name to initialize dram

2012-08-19 Thread Fabio Estevam
On Sun, Aug 19, 2012 at 12:33 PM, Fabio Estevam  wrote:

> Please discard this patch.
>
> Otavio fixed it in another patch related to mx23 series.

Ops, sorry. Otavio based his patch on top of mine, so this one needs
to be applied.

Thanks,

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


Re: [U-Boot] [PATCH 2/2] mxs: Use correct function name to initialize dram

2012-08-19 Thread Fabio Estevam
Hi Stefano,

On Sat, Aug 18, 2012 at 8:28 PM, Fabio Estevam  wrote:
> From: Fabio Estevam 
>
> commit d92591a (mxs: Convert sys_proto.h prefixes to 'mxs') introduced
> a mxs_dram_init() function, which is not used anywhere.
>
> Fix it, so that the following warning goes away:
>
> mx28evk.c: In function ‘dram_init’:
> mx28evk.c:67:2: warning: implicit declaration of function ‘mx28_dram_init’ 
> [-Wimplicit-function-declaration]
>
> Signed-off-by: Fabio Estevam 

Please discard this patch.

Otavio fixed it in another patch related to mx23 series.

Regards,

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


Re: [U-Boot] [PATCH 25/37] arm: rmobile: Add support TMU base timer function

2012-08-19 Thread Nobuhiro Iwamatsu
Hi,

Thanks for your review.

On Tue, Aug 14, 2012 at 8:26 AM, Kim Phillips
 wrote:
> patch 25/37 showing up in an otherwise unnumbered patchseries of 6,
> and with the cover letter set to 'v3' where all 6 patches are at v2
> makes for a highly confusing patchset.

Sorry, this is my mistake.

>
> On Fri, 10 Aug 2012 16:16:12 +0900
> Nobuhiro Iwamatsu  wrote:
>
>> Some rmobile SoC has TMU base timer function. This supports TMU.
>>
>> Signed-off-by: Nobuhiro Iwamatsu 
>> ---
>>  V2: Set COBJS one object per line, and sort the list.
>>
>>  arch/arm/cpu/armv7/rmobile/Makefile   |4 +-
>>  arch/arm/cpu/armv7/rmobile/timer_tmu.c|  161 
>> +
>
> this is a copy of arch/sh/lib/time.c but with proper struct tmu_regs
> instead of #defines; is it not possible to refactor & merge the two?

I am going to merge next work.

>
>> +int timer_init(void)
>> +{
>> + /* Divide clock by CONFIG_SYS_TMU_CLK_DIV */
>> + u16 bit = 0;
>> +
>> + switch (CONFIG_SYS_TMU_CLK_DIV) {
>> + case 1024:
>> + bit = 4;
>> + break;
>> + case 256:
>> + bit = 3;
>> + break;
>> + case 64:
>> + bit = 2;
>> + break;
>> + case 16:
>> + bit = 1;
>> + break;
>> + case 4:
>> + default:
>> + break;
>> + }
>
> Can this be broken down into a shift operation?
>

Sorry, I can not understand this.
This means not using swtich but using shift operation?

Best regards,
  Nobuhiro


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


Re: [U-Boot] [PATCH 3/3] mxs: Rename 'mx28_dram_init' to 'mxs_dram_init'

2012-08-19 Thread Marek Vasut
Dear Otavio Salvador,

> The DRAM initialization, after SPL has complete, is exactly the same
> for all mxs SoCs so we should name it accordinly.

Acked-by: Marek Vasut 

> The following boards has been changed:
> 
>  * apx4devkit
>  * m28evk
>  * mx28evk
>  * sc_sps_1
> 
> Signed-off-by: Otavio Salvador 
> ---
>  arch/arm/cpu/arm926ejs/mxs/mxs.c  |4 ++--
>  arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
>  board/bluegiga/apx4devkit/apx4devkit.c|2 +-
>  board/denx/m28evk/m28evk.c|2 +-
>  board/freescale/mx28evk/mx28evk.c |2 +-
>  board/schulercontrol/sc_sps_1/sc_sps_1.c  |2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> b/arch/arm/cpu/arm926ejs/mxs/mxs.c index a1769fd..c8cda6a 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -320,13 +320,13 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char
> *mac) }
>  #endif
> 
> -int mx28_dram_init(void)
> +int mxs_dram_init(void)
>  {
>   struct mxs_spl_data *data = (struct mxs_spl_data *)
>   ((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf);
> 
>   if (data->mem_dram_size == 0) {
> - printf("MX28:\n"
> + printf("MXS:\n"
>   "Error, the RAM size passed up from SPL is 0!\n");
>   hang();
>   }
> diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h
> b/arch/arm/include/asm/arch-mxs/sys_proto.h index 9e4a4c9..fc84808 100644
> --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
> @@ -69,6 +69,6 @@ struct mxs_spl_data {
>   uint32_tmem_dram_size;
>  };
> 
> -int mx28_dram_init(void);
> +int mxs_dram_init(void);
> 
>  #endif   /* __SYS_PROTO_H__ */
> diff --git a/board/bluegiga/apx4devkit/apx4devkit.c
> b/board/bluegiga/apx4devkit/apx4devkit.c index 5a1042e..ae48ab5 100644
> --- a/board/bluegiga/apx4devkit/apx4devkit.c
> +++ b/board/bluegiga/apx4devkit/apx4devkit.c
> @@ -55,7 +55,7 @@ int board_early_init_f(void)
> 
>  int dram_init(void)
>  {
> - return mx28_dram_init();
> + return mxs_dram_init();
>  }
> 
>  int board_init(void)
> diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
> index 74da3ea..9473d10 100644
> --- a/board/denx/m28evk/m28evk.c
> +++ b/board/denx/m28evk/m28evk.c
> @@ -72,7 +72,7 @@ int board_init(void)
> 
>  int dram_init(void)
>  {
> - return mx28_dram_init();
> + return mxs_dram_init();
>  }
> 
>  #ifdef   CONFIG_CMD_MMC
> diff --git a/board/freescale/mx28evk/mx28evk.c
> b/board/freescale/mx28evk/mx28evk.c index 1320277..867d3c8 100644
> --- a/board/freescale/mx28evk/mx28evk.c
> +++ b/board/freescale/mx28evk/mx28evk.c
> @@ -64,7 +64,7 @@ int board_early_init_f(void)
> 
>  int dram_init(void)
>  {
> - return mx28_dram_init();
> + return mxs_dram_init();
>  }
> 
>  int board_init(void)
> diff --git a/board/schulercontrol/sc_sps_1/sc_sps_1.c
> b/board/schulercontrol/sc_sps_1/sc_sps_1.c index 5f58e0b..fda191a 100644
> --- a/board/schulercontrol/sc_sps_1/sc_sps_1.c
> +++ b/board/schulercontrol/sc_sps_1/sc_sps_1.c
> @@ -72,7 +72,7 @@ int board_init(void)
> 
>  int dram_init(void)
>  {
> - return mx28_dram_init();
> + return mxs_dram_init();
>  }
> 
>  #ifdef   CONFIG_CMD_MMC
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] mxs: Replace i.MX233 by i.MX23 on copyright header

2012-08-19 Thread Otavio Salvador
On Sun, Aug 19, 2012 at 12:05 PM, Marek Vasut  wrote:
> Dear Otavio Salvador,
>
>> All other header are going to use i.MX23 so we change this for
>> consistency.
>>
>> Signed-off-by: Otavio Salvador 
>> ---
>>  arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h
>> b/arch/arm/include/asm/arch-mxs/sys_proto.h index 4610363..9e4a4c9 100644
>> --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
>> +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
>> @@ -1,5 +1,5 @@
>>  /*
>> - * Freescale i.MX233/i.MX28 specific functions
>> + * Freescale i.MX23/i.MX28 specific functions
>
> It's MX233 though, no?

Yes but Fabio has asked me to use MX23 as done for the others (we
don't use MX535 or so ... just to be consistent.

>>   * Copyright (C) 2011 Marek Vasut 
>>   * on behalf of DENX Software Engineering GmbH
>
> Best regards,
> Marek Vasut



-- 
Otavio Salvador O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854  http://projetos.ossystems.com.br
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] mxs: Only build internal Ethernet controller for i.MX28

2012-08-19 Thread Marek Vasut
Dear Otavio Salvador,

> The internal Ethernet controller is only available on i.MX28
> processors so it needs to use CONFIG_MX28 guardian to avoid having
> this code called in others.
> 
> Signed-off-by: Otavio Salvador 
> ---
>  arch/arm/cpu/arm926ejs/mxs/mxs.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> b/arch/arm/cpu/arm926ejs/mxs/mxs.c index c028e5e..a1769fd 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -246,7 +246,7 @@ int do_mx28_showclocks(cmd_tbl_t *cmdtp, int flag, int
> argc, char *const argv[]) /*
>   * Initializes on-chip ethernet controllers.
>   */
> -#ifdef   CONFIG_CMD_NET
> +#if defined(CONFIG_MX28) && defined(CONFIG_CMD_NET)
>  int cpu_eth_init(bd_t *bis)
>  {
>   struct mxs_clkctrl_regs *clkctrl_regs =

Acked-by: Marek Vasut 

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


Re: [U-Boot] [PATCH 1/3] mxs: Replace i.MX233 by i.MX23 on copyright header

2012-08-19 Thread Marek Vasut
Dear Otavio Salvador,

> All other header are going to use i.MX23 so we change this for
> consistency.
> 
> Signed-off-by: Otavio Salvador 
> ---
>  arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h
> b/arch/arm/include/asm/arch-mxs/sys_proto.h index 4610363..9e4a4c9 100644
> --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
> @@ -1,5 +1,5 @@
>  /*
> - * Freescale i.MX233/i.MX28 specific functions
> + * Freescale i.MX23/i.MX28 specific functions

It's MX233 though, no?

>   * Copyright (C) 2011 Marek Vasut 
>   * on behalf of DENX Software Engineering GmbH

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


[U-Boot] [PATCH 3/3] mxs: Rename 'mx28_dram_init' to 'mxs_dram_init'

2012-08-19 Thread Otavio Salvador
The DRAM initialization, after SPL has complete, is exactly the same
for all mxs SoCs so we should name it accordinly.

The following boards has been changed:

 * apx4devkit
 * m28evk
 * mx28evk
 * sc_sps_1

Signed-off-by: Otavio Salvador 
---
 arch/arm/cpu/arm926ejs/mxs/mxs.c  |4 ++--
 arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
 board/bluegiga/apx4devkit/apx4devkit.c|2 +-
 board/denx/m28evk/m28evk.c|2 +-
 board/freescale/mx28evk/mx28evk.c |2 +-
 board/schulercontrol/sc_sps_1/sc_sps_1.c  |2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
index a1769fd..c8cda6a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -320,13 +320,13 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 }
 #endif
 
-int mx28_dram_init(void)
+int mxs_dram_init(void)
 {
struct mxs_spl_data *data = (struct mxs_spl_data *)
((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf);
 
if (data->mem_dram_size == 0) {
-   printf("MX28:\n"
+   printf("MXS:\n"
"Error, the RAM size passed up from SPL is 0!\n");
hang();
}
diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h 
b/arch/arm/include/asm/arch-mxs/sys_proto.h
index 9e4a4c9..fc84808 100644
--- a/arch/arm/include/asm/arch-mxs/sys_proto.h
+++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
@@ -69,6 +69,6 @@ struct mxs_spl_data {
uint32_tmem_dram_size;
 };
 
-int mx28_dram_init(void);
+int mxs_dram_init(void);
 
 #endif /* __SYS_PROTO_H__ */
diff --git a/board/bluegiga/apx4devkit/apx4devkit.c 
b/board/bluegiga/apx4devkit/apx4devkit.c
index 5a1042e..ae48ab5 100644
--- a/board/bluegiga/apx4devkit/apx4devkit.c
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -55,7 +55,7 @@ int board_early_init_f(void)
 
 int dram_init(void)
 {
-   return mx28_dram_init();
+   return mxs_dram_init();
 }
 
 int board_init(void)
diff --git a/board/denx/m28evk/m28evk.c b/board/denx/m28evk/m28evk.c
index 74da3ea..9473d10 100644
--- a/board/denx/m28evk/m28evk.c
+++ b/board/denx/m28evk/m28evk.c
@@ -72,7 +72,7 @@ int board_init(void)
 
 int dram_init(void)
 {
-   return mx28_dram_init();
+   return mxs_dram_init();
 }
 
 #ifdef CONFIG_CMD_MMC
diff --git a/board/freescale/mx28evk/mx28evk.c 
b/board/freescale/mx28evk/mx28evk.c
index 1320277..867d3c8 100644
--- a/board/freescale/mx28evk/mx28evk.c
+++ b/board/freescale/mx28evk/mx28evk.c
@@ -64,7 +64,7 @@ int board_early_init_f(void)
 
 int dram_init(void)
 {
-   return mx28_dram_init();
+   return mxs_dram_init();
 }
 
 int board_init(void)
diff --git a/board/schulercontrol/sc_sps_1/sc_sps_1.c 
b/board/schulercontrol/sc_sps_1/sc_sps_1.c
index 5f58e0b..fda191a 100644
--- a/board/schulercontrol/sc_sps_1/sc_sps_1.c
+++ b/board/schulercontrol/sc_sps_1/sc_sps_1.c
@@ -72,7 +72,7 @@ int board_init(void)
 
 int dram_init(void)
 {
-   return mx28_dram_init();
+   return mxs_dram_init();
 }
 
 #ifdef CONFIG_CMD_MMC
-- 
1.7.10.4

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


[U-Boot] [PATCH 2/3] mxs: Only build internal Ethernet controller for i.MX28

2012-08-19 Thread Otavio Salvador
The internal Ethernet controller is only available on i.MX28
processors so it needs to use CONFIG_MX28 guardian to avoid having
this code called in others.

Signed-off-by: Otavio Salvador 
---
 arch/arm/cpu/arm926ejs/mxs/mxs.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
index c028e5e..a1769fd 100644
--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -246,7 +246,7 @@ int do_mx28_showclocks(cmd_tbl_t *cmdtp, int flag, int 
argc, char *const argv[])
 /*
  * Initializes on-chip ethernet controllers.
  */
-#ifdef CONFIG_CMD_NET
+#if defined(CONFIG_MX28) && defined(CONFIG_CMD_NET)
 int cpu_eth_init(bd_t *bis)
 {
struct mxs_clkctrl_regs *clkctrl_regs =
-- 
1.7.10.4

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


[U-Boot] [PATCH 1/3] mxs: Replace i.MX233 by i.MX23 on copyright header

2012-08-19 Thread Otavio Salvador
All other header are going to use i.MX23 so we change this for
consistency.

Signed-off-by: Otavio Salvador 
---
 arch/arm/include/asm/arch-mxs/sys_proto.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h 
b/arch/arm/include/asm/arch-mxs/sys_proto.h
index 4610363..9e4a4c9 100644
--- a/arch/arm/include/asm/arch-mxs/sys_proto.h
+++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
@@ -1,5 +1,5 @@
 /*
- * Freescale i.MX233/i.MX28 specific functions
+ * Freescale i.MX23/i.MX28 specific functions
  *
  * Copyright (C) 2011 Marek Vasut 
  * on behalf of DENX Software Engineering GmbH
-- 
1.7.10.4

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


[U-Boot] [PATCH v5] arm: rmobile: Add support Renesas SH73A0

2012-08-19 Thread Nobuhiro Iwamatsu
From: Nobuhiro Iwamatsu 

Renesas SH73A0 is CPU with Cortex-A9.
This supports the basic register definition and GPIO.

Signed-off-by: Nobuhiro Iwamatsu 
Signed-off-by: Nobuhiro Iwamatsu 
---
 V5: Remove dead code.
 V4: Revert ICCICR.
 V3: Set COBJS one object per line, and sort the list.
 Remove ICCICR and ICCPMR.
 Remove white space.
 v2: Remove white space.
 Code which can be communalized was moved to lowlevel_init.

 arch/arm/cpu/armv7/rmobile/Makefile |   14 +-
 arch/arm/cpu/armv7/rmobile/board.c  |   33 ++
 arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c|   50 ++
 arch/arm/cpu/armv7/rmobile/cpu_info.c   |   36 +-
 arch/arm/cpu/armv7/rmobile/lowlevel_init.S  |   95 
 arch/arm/include/asm/arch-rmobile/rmobile.h |4 +
 arch/arm/include/asm/arch-rmobile/sh73a0-gpio.h |  553 +++
 arch/arm/include/asm/arch-rmobile/sh73a0.h  |  281 
 arch/arm/include/asm/arch-rmobile/sys_proto.h   |   29 ++
 9 files changed, 1071 insertions(+), 24 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/rmobile/board.c
 create mode 100644 arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c
 create mode 100644 arch/arm/cpu/armv7/rmobile/lowlevel_init.S
 create mode 100644 arch/arm/include/asm/arch-rmobile/sh73a0-gpio.h
 create mode 100644 arch/arm/include/asm/arch-rmobile/sh73a0.h
 create mode 100644 arch/arm/include/asm/arch-rmobile/sys_proto.h

diff --git a/arch/arm/cpu/armv7/rmobile/Makefile 
b/arch/arm/cpu/armv7/rmobile/Makefile
index e7eb90f..b27d143 100644
--- a/arch/arm/cpu/armv7/rmobile/Makefile
+++ b/arch/arm/cpu/armv7/rmobile/Makefile
@@ -25,11 +25,17 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(SOC).o
 
-COBJS += cpu_info.o
-COBJS += timer.o
+SOBJS = lowlevel_init.o
+COBJS-y += board.o
+COBJS-y += cpu_info.o
+COBJS-y += timer.o
 
-SRCS   := $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
-OBJS   := $(addprefix $(obj),$(COBJS) $(COBJS-y))
+COBJS-$(CONFIG_SH73A0) += cpu_info-sh73a0.o
+
+COBJS  := $(COBJS-y)
+SRCS:= $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
 START  := $(addprefix $(obj),$(START))
 
 all:   $(obj).depend $(LIB)
diff --git a/arch/arm/cpu/armv7/rmobile/board.c 
b/arch/arm/cpu/armv7/rmobile/board.c
new file mode 100644
index 000..55dc6be
--- /dev/null
+++ b/arch/arm/cpu/armv7/rmobile/board.c
@@ -0,0 +1,33 @@
+/*
+ * (C) Copyright 2012 Nobuhiro Iwamatsu 
+ * (C) Copyright 2012 Renesas Solutions Corp.
+ *
+ * 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 
+#include 
+#include 
+
+#ifdef CONFIG_DISPLAY_BOARDINFO
+int checkboard(void)
+{
+   printf("Board: %s\n", sysinfo.board_string);
+   return 0;
+}
+#endif /* CONFIG_DISPLAY_BOARDINFO */
diff --git a/arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c 
b/arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c
new file mode 100644
index 000..f5273cf
--- /dev/null
+++ b/arch/arm/cpu/armv7/rmobile/cpu_info-sh73a0.c
@@ -0,0 +1,50 @@
+/*
+ * (C) Copyright 2012 Nobuhiro Iwamatsu 
+ * (C) Copyright 2012 Renesas Solutions Corp.
+ *
+ * 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 
+#include 
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+u32 rmobile_get_cpu_type(void)
+{
+   u32 id;
+   u32 type;
+   struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
+
+   id = readl(hpb->cccr);
+   type = (id >> 8) & 0xFF;
+
+   return type;
+}
+
+u32 get_cpu_rev(void)
+{
+  

Re: [U-Boot] [PATCH v3] arm: rmobile: Add support Renesas SH73A0

2012-08-19 Thread Nobuhiro Iwamatsu
Hi,

Thanks for your review.

On Sat, Aug 11, 2012 at 12:52 AM, Mike Frysinger  wrote:
> On Friday 10 August 2012 03:41:17 Nobuhiro Iwamatsu wrote:
>> --- a/arch/arm/cpu/armv7/rmobile/Makefile
>> +++ b/arch/arm/cpu/armv7/rmobile/Makefile
>>
>> +clean:
>> + rm -f $(SOBJS) $(OBJS)
>> +
>
> dead code -> delete
> -mike

Thanks. I will remove these line.

Best regards,
  Nobuhiro

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


Re: [U-Boot] [PATCH 2/2] mxs: Use correct function name to initialize dram

2012-08-19 Thread Otavio Salvador
On Sat, Aug 18, 2012 at 8:28 PM, Fabio Estevam  wrote:
> From: Fabio Estevam 
>
> commit d92591a (mxs: Convert sys_proto.h prefixes to 'mxs') introduced
> a mxs_dram_init() function, which is not used anywhere.
>
> Fix it, so that the following warning goes away:
>
> mx28evk.c: In function ‘dram_init’:
> mx28evk.c:67:2: warning: implicit declaration of function ‘mx28_dram_init’ 
> [-Wimplicit-function-declaration]
>
> Signed-off-by: Fabio Estevam 

Acked-by: Otavio Salvador 

-- 
Otavio Salvador O.S. Systems
E-mail: ota...@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854  http://projetos.ossystems.com.br
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [[Patch V2] mips: 15/16] add configs/qemu-mips64.h

2012-08-19 Thread Daniel Schwierzeck
2012/8/17 Zhizhou Zhang :
> Signed-off-by: Zhizhou Zhang 
> ---
>  include/configs/qemu-mips64.h |  171 
> +
>  1 file changed, 171 insertions(+)
>  create mode 100644 include/configs/qemu-mips64.h

you should merge this patch with patch 13 with a commit message like

MIPS: add board support for qemu_mips64

>
> diff --git a/include/configs/qemu-mips64.h b/include/configs/qemu-mips64.h
> new file mode 100644
> index 000..2f39494
> --- /dev/null
> +++ b/include/configs/qemu-mips64.h
> @@ -0,0 +1,171 @@
> +/*
> + * (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
> + */
> +
> +/*
> + * This file contains the configuration parameters for qemu-mips64 target.
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#define CONFIG_MIPS64  1   /* MIPS64 CPU core */
> +#define CONFIG_64BIT   1
> +#define CONFIG_QEMU_MIPS   1
> +#define CONFIG_MISC_INIT_R
> +
> +/*IP address is default used by Qemu*/
> +#define CONFIG_IPADDR  10.0.2.15   /* Our IP address */
> +#define CONFIG_SERVERIP10.0.2.2/* Server IP address 
> */
> +
> +#define CONFIG_BOOTDELAY   10  /* autoboot after 10 seconds */
> +
> +#define CONFIG_BAUDRATE115200
> +
> +/* valid baudrates */
> +#define CONFIG_SYS_BAUDRATE_TABLE  { 9600, 19200, 38400, 57600, 115200 }
> +
> +#define CONFIG_TIMESTAMP   /* Print image info with timestamp */
> +#undef CONFIG_BOOTARGS
> +
> +#define CONFIG_EXTRA_ENV_SETTINGS  \
> +   "addmisc=setenv bootargs ${bootargs} "  \
> +   "console=ttyS0,${baudrate} "\
> +   "panic=1\0" \
> +   "bootfile=/tftpboot/vmlinux\0"  \
> +   "load=tftp 8050 ${u-boot}\0"\
> +   ""
> +
> +#define CONFIG_BOOTCOMMAND ""
> +
> +/*
> + * BOOTP options
> + */
> +#define CONFIG_BOOTP_BOOTFILESIZE
> +#define CONFIG_BOOTP_BOOTPATH
> +#define CONFIG_BOOTP_GATEWAY
> +#define CONFIG_BOOTP_HOSTNAME
> +
> +/*
> + * Command line configuration.
> + */
> +#include 
> +#define CONFIG_DP83902A
> +
> +#define CONFIG_CMD_FAT
> +#define CONFIG_CMD_EXT2
> +#undef CONFIG_CMD_LOADB
> +#undef CONFIG_CMD_LOADS
> +#define CONFIG_CMD_DHCP
> +
> +#define CONFIG_DRIVER_NE2000
> +#define CONFIG_DRIVER_NE2000_BASE (0xb4000300)
> +
> +#define CONFIG_SYS_NS16550
> +#define CONFIG_SYS_NS16550_SERIAL
> +#define CONFIG_SYS_NS16550_REG_SIZE1
> +#define CONFIG_SYS_NS16550_CLK 115200
> +#define CONFIG_SYS_NS16550_COM1(0xb40003f8)
> +#define CONFIG_CONS_INDEX  1
> +
> +#define CONFIG_CMD_IDE
> +#define CONFIG_DOS_PARTITION
> +
> +#define CONFIG_SYS_IDE_MAXBUS  2
> +#define CONFIG_SYS_ATA_IDE0_OFFSET (0x1f0)
> +#define CONFIG_SYS_ATA_IDE1_OFFSET (0x170)
> +#define CONFIG_SYS_ATA_DATA_OFFSET (0)
> +#define CONFIG_SYS_ATA_REG_OFFSET  (0)
> +#define CONFIG_SYS_ATA_BASE_ADDR   (0xb400)
> +
> +#define CONFIG_SYS_IDE_MAXDEVICE   (4)
> +
> +#define CONFIG_CMD_RARP
> +
> +/*
> + * Miscellaneous configurable options
> + */
> +#define CONFIG_SYS_LONGHELP/* undef to save 
> memory */
> +
> +#define CONFIG_SYS_PROMPT  "qemu-mips64 # "/* Monitor 
> Command Prompt */
> +
> +#define CONFIG_AUTO_COMPLETE
> +#define CONFIG_CMDLINE_EDITING
> +#define CONFIG_SYS_HUSH_PARSER
> +#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
> +
> +#define CONFIG_SYS_CBSIZE  256 /* Console I/O Buffer 
> Size */
> +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)  
> /* Print Buffer Size */
> +#define CONFIG_SYS_MAXARGS 16  /* max number of 
> command args */
> +
> +#define CONFIG_SYS_MALLOC_LEN  128*1024
> +
> +#define CONFIG_SYS_BOOTPARAMS_LEN  128*1024
> +
> +#define CONFIG_SYS_MHZ 132
> +
> +#define CONFIG_SYS_MIPS_TIMER_FREQ (CONFIG_SYS_MHZ * 10

Re: [U-Boot] [[Patch V2] mips: 16/16] modify qemu-mips/config.mk

2012-08-19 Thread Daniel Schwierzeck
2012/8/17 Zhizhou Zhang :
> Though I defined CONFIG_SYS_TEXT_BASE in configs/qemu-mips64.h,
> but the value is still affected by this file.

you should delete all CONFIG_SYS_TEXT_BASE definitions from this file.
The board specific config header file is the only right place.

> Signed-off-by: Zhizhou Zhang 
> ---
>  board/qemu-mips/config.mk |3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/board/qemu-mips/config.mk b/board/qemu-mips/config.mk
> index 27cd34a..a1514a0 100644
> --- a/board/qemu-mips/config.mk
> +++ b/board/qemu-mips/config.mk
> @@ -2,9 +2,10 @@
>  # Qemu -M mips system emulator
>  # See http://fabrice.bellard.free.fr/qemu
>  #
> -
> +ifeq "$(CPU)" "mips"
>  # ROM version
>  CONFIG_SYS_TEXT_BASE = 0xbfc0
>
>  # RAM version
>  #CONFIG_SYS_TEXT_BASE = 0x80001000
> +endif
> --
> 1.7.9.5
>



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


Re: [U-Boot] [[Patch V2] mips: 14/16] add mips64 standalone link script

2012-08-19 Thread Daniel Schwierzeck
2012/8/18 Zhi-zhou Zhang :
> On Sat, Aug 18, 2012 at 1:08 AM, Andrew Dyer  wrote:
>
>> I think the OUTPUT_FORMAT line if wrong.  This will produce little endian
>> output even if explicitly told by command line switch -EB to make big
>> endian.
>>
> Yes,  But if I want make it configureable, I should modify a lot in
> standalone/Makefile. I'm afraid that it will affect other boards' build.
> actually, I want disable mips64's standalone example in top Makefile.

no, this is not necessary. Endianess handling for MIPS u-boot and
standalone binaries
is fixed since commit 6cb461b4f1531dbae5c0bae857f649b7943114ec

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



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


Re: [U-Boot] [PATCH v3] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread Benoît Thébaudeau
Hi Stefano,

Your detailed description from v1 is gone.

> Signed-off-by: Stefano Babic 

Your Cc's from v1 are gone.

> ---
> Changes in v2:
> - please ignore this version, it is broken
> 
> Changes in v3:
> - call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
> - change psr in gpio_psr (Benoit Thebaudeau)
> - drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)
> 
>  arch/arm/include/asm/arch-mx25/gpio.h |   17 +--
>  arch/arm/include/asm/arch-mx31/gpio.h |7 +
>  arch/arm/include/asm/arch-mx35/gpio.h |   12 +---
>  arch/arm/include/asm/arch-mx5/gpio.h  |7 +
>  arch/arm/include/asm/arch-mx6/gpio.h  |7 +
>  arch/arm/include/asm/arch-mx6/imx-regs.h  |2 --
>  arch/arm/include/asm/imx-common/gpio.h|   39
>  +
>  board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28
>  +-
>  board/karo/tx25/tx25.c|   10 +++
>  board/syteco/zmx25/zmx25.c|   26
>  -
>  include/configs/mx6qsabrelite.h   |3 +-
>  11 files changed, 78 insertions(+), 80 deletions(-)
>  create mode 100644 arch/arm/include/asm/imx-common/gpio.h
> 
> diff --git a/arch/arm/include/asm/arch-mx25/gpio.h
> b/arch/arm/include/asm/arch-mx25/gpio.h
> index dc6edc7..61c0b0d 100644
> --- a/arch/arm/include/asm/arch-mx25/gpio.h
> +++ b/arch/arm/include/asm/arch-mx25/gpio.h
> @@ -25,21 +25,6 @@
>  #ifndef __ASM_ARCH_MX25_GPIO_H
>  #define __ASM_ARCH_MX25_GPIO_H
>  
> -/* Converts a GPIO port number and the internal bit position
> - * to the GPIO number
> - */
> -#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit &
> 0x1f))
> -
> -/* GPIO registers */
> -struct gpio_regs {
> - u32 gpio_dr;/* data */
> - u32 gpio_dir;   /* direction */
> - u32 psr;/* pad satus */
> - u32 icr1;   /* interrupt config 1 */
> - u32 icr2;   /* interrupt config 2 */
> - u32 imr;/* interrupt mask */
> - u32 isr;/* interrupt status */
> - u32 edge_sel;   /* edge select */
> -};
> +#include 
>  
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx31/gpio.h
> b/arch/arm/include/asm/arch-mx31/gpio.h
> index 95b73bf..55c0afa 100644
> --- a/arch/arm/include/asm/arch-mx31/gpio.h
> +++ b/arch/arm/include/asm/arch-mx31/gpio.h
> @@ -25,11 +25,6 @@
>  #ifndef __ASM_ARCH_MX31_GPIO_H
>  #define __ASM_ARCH_MX31_GPIO_H
>  
> -/* GPIO Registers */
> -struct gpio_regs {
> - u32 gpio_dr;
> - u32 gpio_dir;
> - u32 gpio_psr;
> -};
> +#include 
>  
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx35/gpio.h
> b/arch/arm/include/asm/arch-mx35/gpio.h
> index 7bcc3e8..1deb292 100644
> --- a/arch/arm/include/asm/arch-mx35/gpio.h
> +++ b/arch/arm/include/asm/arch-mx35/gpio.h
> @@ -25,16 +25,6 @@
>  #ifndef __ASM_ARCH_MX35_GPIO_H
>  #define __ASM_ARCH_MX35_GPIO_H
>  
> -/* GPIO registers */
> -struct gpio_regs {
> - u32 gpio_dr;/* data */
> - u32 gpio_dir;   /* direction */
> - u32 psr;/* pad satus */
> - u32 icr1;   /* interrupt config 1 */
> - u32 icr2;   /* interrupt config 2 */
> - u32 imr;/* interrupt mask */
> - u32 isr;/* interrupt status */
> - u32 edge_sel;   /* edge select */
> -};
> +#include 
>  
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx5/gpio.h
> b/arch/arm/include/asm/arch-mx5/gpio.h
> index 1dc34e9..b1b1218 100644
> --- a/arch/arm/include/asm/arch-mx5/gpio.h
> +++ b/arch/arm/include/asm/arch-mx5/gpio.h
> @@ -25,11 +25,6 @@
>  #ifndef __ASM_ARCH_MX5_GPIO_H
>  #define __ASM_ARCH_MX5_GPIO_H
>  
> -/* GPIO registers */
> -struct gpio_regs {
> - u32 gpio_dr;
> - u32 gpio_dir;
> - u32 gpio_psr;
> -};
> +#include 
>  
>  #endif
> diff --git a/arch/arm/include/asm/arch-mx6/gpio.h
> b/arch/arm/include/asm/arch-mx6/gpio.h
> index 20c4e57..24c10f8 100644
> --- a/arch/arm/include/asm/arch-mx6/gpio.h
> +++ b/arch/arm/include/asm/arch-mx6/gpio.h
> @@ -25,11 +25,6 @@
>  #ifndef __ASM_ARCH_MX6_GPIO_H
>  #define __ASM_ARCH_MX6_GPIO_H
>  
> -/* GPIO registers */
> -struct gpio_regs {
> - u32 gpio_dr;
> - u32 gpio_dir;
> - u32 gpio_psr;
> -};
> +#include 
>  
>  #endif   /* __ASM_ARCH_MX6_GPIO_H */
> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h
> b/arch/arm/include/asm/arch-mx6/imx-regs.h
> index 5d77603..f3e58b5 100644
> --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
> @@ -172,8 +172,6 @@
>  #define IMX_IIM_BASE OCOTP_BASE_ADDR
>  #define FEC_QUIRK_ENET_MAC
>  
> -#define GPIO_NUMBER(port, index) port)-1)*32)+((index)&31))
> -
>  #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
>  #include 
>  
> diff --git a/arch/arm/include/asm/imx-common/gpio.h
> b/arch/arm/include/asm/imx-common/gpio.h
> new file mode 100644
> index 000..65226d9
> --- /dev/nul

[U-Boot] U-boot confused - flashing

2012-08-19 Thread Daniel Ścisłowski
Hi,

I use BeagleBoard rev C4. I would like to prepare u-boot from source
myself, one of the newest. I tried to build first X-Loader MLO file and
then U-Boot 2012.07. But X-Loader didn't loaded u-boot.bin file. I tried
many versions and it only worked with some old.
Then after many hours I realized that all wiki, books and other tutorials
are out of date, U-Boot creates MLO file. So I tried 2012.07 again and it
works :). X-Loader(MLO) and U-Boot (img, not bin) were loaded from SD card
( there were other problems later because of missing kernel files... I
suppose I need to reconfigure omap3_beagle.h file, true?). Ok, then I
wanted to flash NAND and. I tried to do it like on many wiki pages and
finally I have "Error: Bad compare! failed " when I run Beagle without SD
card. Why? Is it because I should not flash *.img file ? It can be only
*.bin file (I have never seen on any page flashing img) ?  But X-loader
want *.img file...

Other question is, do I need new U-Boot? What are the advantages of using
that new version of software? If old loads kernel and then kernel rules and
bootloaders are not important...
Maybe old can not deal with new kernels?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [[Patch V2] mips: 14/16] add mips64 standalone link script

2012-08-19 Thread Daniel Schwierzeck
2012/8/17 Zhizhou Zhang :
> Signed-off-by: Zhizhou Zhang 
> ---
>  examples/standalone/mips64.lds |   59 
> 
>  1 file changed, 59 insertions(+)
>  create mode 100644 examples/standalone/mips64.lds
>
> diff --git a/examples/standalone/mips64.lds b/examples/standalone/mips64.lds
> new file mode 100644
> index 000..00b96da
> --- /dev/null
> +++ b/examples/standalone/mips64.lds
> @@ -0,0 +1,59 @@
> +/*
> + * (C) Copyright 2003
> + * Wolfgang Denk Engineering, 
> + *
> + * 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
> + */
> +
> +/*
> +OUTPUT_FORMAT("elf32-bigmips", "elf32-bigmips", "elf32-bigmips")
> +*/
> +OUTPUT_FORMAT("elf64-tradlittlemips", "elf64-tradlittlemips", 
> "elf64-tradlittlemips")

this should be
OUTPUT_FORMAT("elf64-tradbigmips", "elf64-tradbigmips", "elf64-tradlittlemips")

anyway you should add this line to the existing mips.lds and wrap it
with #ifdef CONFIG_64BIT

> +OUTPUT_ARCH(mips)
> +SECTIONS
> +{
> +   .text   :
> +   {
> + *(.text*)
> +   }
> +
> +   . = ALIGN(4);
> +   .rodata  : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
> +
> +   . = ALIGN(4);
> +   .data  : { *(.data*) }
> +
> +   . = .;
> +   _gp = ALIGN(16) + 0x7ff0;
> +
> +   .got : {
> + __got_start = .;
> + *(.got)
> + __got_end = .;
> +   }
> +
> +   .sdata  : { *(.sdata*) }
> +
> +   . = ALIGN(4);
> +   __bss_start = .;
> +   .sbss (NOLOAD) : { *(.sbss*) }
> +   .bss (NOLOAD)  : { *(.bss*) . = ALIGN(4); }
> +
> +   _end = .;
> +}
> --
> 1.7.9.5
>



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


Re: [U-Boot] Early malloc() summary

2012-08-19 Thread Tomas Hlavacek
Hello Graeme!

On Fri, Aug 17, 2012 at 3:15 AM, Graeme Russ  wrote:
> dm_malloc(bytes, driver *)
>   |
>   +-> early_malloc(bytes, reloc_helper *)  /* Pre-Relocation */
>   | |
>   | +->register_helper(reloc_helper *)
>   | |
>   | +->pre_reloc_malloc(size_t bytes)
>   |
>   +-> malloc(bytes)/* Post-Relocation */
>
>
> Drivers call dm_malloc(), helper functions call early_malloc()
>
> dm_malloc() is implemented in the DM core code and checks for whether the
> call is pre- or post- relocation. If pre-relocation, it checks for the
> driver having a relocation helper (or the 'I don't need one' flag)
>
> early_malloc() is implemented in the early malloc code seperate from the
> DM code.
>
>  WARNING!!! STOP READING NOW!!! 
>
> early_malloc() registers a relocation function (if provided) which will be
> called during relocation. DM core will strip this out as it will (for the
> time being) handle the calling of the relocation helper for each of the
> registered drivers. In the long term, I think that responsibility might be
> able to be taken away from DM core (but there may be call-order issues that
> might make that impossible)
>
> The way I imagine it in the future, any code that might possible allocate
> memory prior to relocation would do something like:
>
> static int my_relocator(void *data)
> {
>   struct foo *new_bar;
>
>   new_bar = malloc(sizeof(struct foo));
>   mem_cpy(new_bar, data, sizeof(struct foo));
>
>   /* Tweak internal new_bar members */
>
>   return 0;
> }
>
> int some_function()
> {
>   struct foo *bar;
>
>   bar = malloc(sizeof(struct foo));
>   register_helper(bar, my_relocator);
>
>   return 0;
> }
>
>
> And behind the scenes we have:
>
> data = malloc(bytes);
>   |
>   +->data = pre_reloc_malloc(size_t bytes)   /* Pre-Relocation */
>   | |
>   | +->add_to_reloc_list(data)
>   | |
>   | +->return data;
>   |
>   +->malloc(size_t bytes);   /* Post-Relocation */
>
> register_helper(data, reloc_helper *)
>   |
>   +->update_reloc_list(data, reloc_helper *) /* Pre-Relocation */
>   |
>   +->Do Nothing  /* Post-Relocation */
>
> During relocation, the 'reloc list' is processed. Each 'data' entry with no
> 'reloc_helper' will elicite a (debug) warning to let you know about data
> that was allocated but will not be relocated.

OK, I got this. It seems to me that everything starts with
pre_reloc_malloc(). And I think that this is roughly equivalent to my
void *early_malloc(size_t) function in previous experimental patches.
But I am not sure that the identifier pre_reloc_malloc() is proper for
this function because on archs without strict separation of
board_init_f and board_init_r, where the U-Boot is running in RAM from
the very beginning and no relocation is needed (microblaze, nios2,
openrisc, sh) it does not reflect the actual use - it is the function
used to obtain allocation from early_heap. And I think that in case of
that architectures we still need early_heap and working dm_malloc()
before the true malloc() is initialized. (It is because we might still
need to create the DM tree before malloc is initialized to facilitate
DM part of actual memory and malloc initialization.)

I am thinking about a way to obtain some space for the first
early_heap (assuming that I have the heap header you suggested some
time ago that has void *next_early_heap for future expansion with
arch-specific or CPU/board-specific ways to grab non-contiguous
early_heap). Do you know some elegant way to obtain some early_heap
space that would work on each architectures in question? It came to my
mind that I can steal the space from the early stack by something like
this:

#define DECLARE_EARLY_HEAP_ON_STACK char
__early_heap[CONFIG_SYS_EARLY_HEAP_SIZE]; \
gd->early_heap_first = (void 
*)__early_heap

void board_init_f()
{
...
memset(gd) here
...
DECLARE_EARLY_HEAP_ON_STACK;

Although it is somehow architecture independent (except the fact that
we need sensible value of CONFIG_SYS_EARLY_HEAP_SIZE and it is perhaps
not feasible for x86 which has 3 init stages - board_init_f,
board_init_f_r and board_init_r, the stack is lost in between
board_init_f and board_init_f_r, but true malloc() is initialized as
late as in board_init_r, if I understand it well), but I am not sure
whether it is acceptable way to grab early_heap space like that.

My intention is to keep the prospective patch with early_heap and
pre_reloc_malloc() relatively low-profile and do it without
unnecessary architecture/CPU/ board specific code when possible.
Anyway I think we are going to need only as low as 20B of early_heap
for the root DM node on wast majority boards and therefore we could go
forward with really small early_heap in the beginning.

What do you think?

Tomas


-- 
Tomáš Hlaváček 
___

Re: [U-Boot] [[Patch V2] mips: 00/16] add mips64 support to U-Boot

2012-08-19 Thread Daniel Schwierzeck
Hi,

2012/8/17 Zhizhou Zhang :
>
> This patch add mips64 support.
> ---
> Change log for V2:
>   - move mips64 build flags to cpu/mips64.mk
>   - add cache size probe
>   - remove cache.S

please add changelogs to the patches which you have changed since the
previous submission

>
> Zhizhou Zhang (16):
>   add mips64 standalone support

please add the prefix "MIPS:" to all commit messages. That is what
I actually meant in the other mail. Then you can simply do a
git format-patches --subject-prefix "PATCH vN" ...

>   add cpu/mips64/Makefile
>   add cpu/mips64/config.mk
>   add cpu/mips64/cpu.c
>   add cpu/mips64/interrupts.c
>   add cpu/mips64/start.S
>   add cpu/mips64/time.c

I think those patches could be squashed to a single patch with a
commit message like:

MIPS: add support for MIPS64 CPUs

>   Let UNCACHED_SDRAM be available to mips64
>   add cache description struct
>   modify io operation for mips64
>   Make size_t equaled to unsigned long
>   modify u-boot.lds for mips64
>   add board define in boards.cfg
>   add mips64 standalone link script
>   add configs/qemu-mips64.h
>   modify qemu-mips/config.mk

please use more descriptive commit messages for your changes.
It should be clear what you have changed and why.

>
>  arch/mips/config.mk |4 +
>  arch/mips/cpu/mips64/Makefile   |   47 +
>  arch/mips/cpu/mips64/config.mk  |   39 
>  arch/mips/cpu/mips64/cpu.c  |  133 +
>  arch/mips/cpu/mips64/interrupts.c   |   39 
>  arch/mips/cpu/mips64/start.S|  373 
> +++
>  arch/mips/cpu/mips64/time.c |   86 
>  arch/mips/include/asm/addrspace.h   |2 +-
>  arch/mips/include/asm/cache.h   |   11 ++
>  arch/mips/include/asm/io.h  |   18 +-
>  arch/mips/include/asm/posix_types.h |   12 +-
>  board/qemu-mips/config.mk   |3 +-
>  board/qemu-mips/u-boot.lds  |8 +
>  boards.cfg  |1 +
>  examples/standalone/mips64.lds  |   59 ++
>  include/configs/qemu-mips64.h   |  171 
>  16 files changed, 1000 insertions(+), 6 deletions(-)
>  create mode 100644 arch/mips/cpu/mips64/Makefile
>  create mode 100644 arch/mips/cpu/mips64/config.mk
>  create mode 100644 arch/mips/cpu/mips64/cpu.c
>  create mode 100644 arch/mips/cpu/mips64/interrupts.c
>  create mode 100644 arch/mips/cpu/mips64/start.S
>  create mode 100644 arch/mips/cpu/mips64/time.c
>  create mode 100644 examples/standalone/mips64.lds
>  create mode 100644 include/configs/qemu-mips64.h
>
> --
> 1.7.9.5
>

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


[U-Boot] [PATCH v3] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread Stefano Babic
Signed-off-by: Stefano Babic 
---
Changes in v2:
- please ignore this version, it is broken

Changes in v3:
- call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
- change psr in gpio_psr (Benoit Thebaudeau)
- drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)

 arch/arm/include/asm/arch-mx25/gpio.h |   17 +--
 arch/arm/include/asm/arch-mx31/gpio.h |7 +
 arch/arm/include/asm/arch-mx35/gpio.h |   12 +---
 arch/arm/include/asm/arch-mx5/gpio.h  |7 +
 arch/arm/include/asm/arch-mx6/gpio.h  |7 +
 arch/arm/include/asm/arch-mx6/imx-regs.h  |2 --
 arch/arm/include/asm/imx-common/gpio.h|   39 +
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28 +-
 board/karo/tx25/tx25.c|   10 +++
 board/syteco/zmx25/zmx25.c|   26 -
 include/configs/mx6qsabrelite.h   |3 +-
 11 files changed, 78 insertions(+), 80 deletions(-)
 create mode 100644 arch/arm/include/asm/imx-common/gpio.h

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
b/arch/arm/include/asm/arch-mx25/gpio.h
index dc6edc7..61c0b0d 100644
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ b/arch/arm/include/asm/arch-mx25/gpio.h
@@ -25,21 +25,6 @@
 #ifndef __ASM_ARCH_MX25_GPIO_H
 #define __ASM_ARCH_MX25_GPIO_H
 
-/* Converts a GPIO port number and the internal bit position
- * to the GPIO number
- */
-#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit & 0x1f))
-
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;/* data */
-   u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
-   u32 icr1;   /* interrupt config 1 */
-   u32 icr2;   /* interrupt config 2 */
-   u32 imr;/* interrupt mask */
-   u32 isr;/* interrupt status */
-   u32 edge_sel;   /* edge select */
-};
+#include 
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx31/gpio.h 
b/arch/arm/include/asm/arch-mx31/gpio.h
index 95b73bf..55c0afa 100644
--- a/arch/arm/include/asm/arch-mx31/gpio.h
+++ b/arch/arm/include/asm/arch-mx31/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX31_GPIO_H
 #define __ASM_ARCH_MX31_GPIO_H
 
-/* GPIO Registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include 
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx35/gpio.h 
b/arch/arm/include/asm/arch-mx35/gpio.h
index 7bcc3e8..1deb292 100644
--- a/arch/arm/include/asm/arch-mx35/gpio.h
+++ b/arch/arm/include/asm/arch-mx35/gpio.h
@@ -25,16 +25,6 @@
 #ifndef __ASM_ARCH_MX35_GPIO_H
 #define __ASM_ARCH_MX35_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;/* data */
-   u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
-   u32 icr1;   /* interrupt config 1 */
-   u32 icr2;   /* interrupt config 2 */
-   u32 imr;/* interrupt mask */
-   u32 isr;/* interrupt status */
-   u32 edge_sel;   /* edge select */
-};
+#include 
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx5/gpio.h 
b/arch/arm/include/asm/arch-mx5/gpio.h
index 1dc34e9..b1b1218 100644
--- a/arch/arm/include/asm/arch-mx5/gpio.h
+++ b/arch/arm/include/asm/arch-mx5/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX5_GPIO_H
 #define __ASM_ARCH_MX5_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include 
 
 #endif
diff --git a/arch/arm/include/asm/arch-mx6/gpio.h 
b/arch/arm/include/asm/arch-mx6/gpio.h
index 20c4e57..24c10f8 100644
--- a/arch/arm/include/asm/arch-mx6/gpio.h
+++ b/arch/arm/include/asm/arch-mx6/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX6_GPIO_H
 #define __ASM_ARCH_MX6_GPIO_H
 
-/* GPIO registers */
-struct gpio_regs {
-   u32 gpio_dr;
-   u32 gpio_dir;
-   u32 gpio_psr;
-};
+#include 
 
 #endif /* __ASM_ARCH_MX6_GPIO_H */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 5d77603..f3e58b5 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -172,8 +172,6 @@
 #define IMX_IIM_BASE OCOTP_BASE_ADDR
 #define FEC_QUIRK_ENET_MAC
 
-#define GPIO_NUMBER(port, index)   port)-1)*32)+((index)&31))
-
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include 
 
diff --git a/arch/arm/include/asm/imx-common/gpio.h 
b/arch/arm/include/asm/imx-common/gpio.h
new file mode 100644
index 000..65226d9
--- /dev/null
+++ b/arch/arm/include/asm/imx-common/gpio.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2011
+ * Stefano Babic, DENX Software Engineering, 
+ *
+ * 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 Pub

Re: [U-Boot] [PATCH 1/2] mx28evk: Remove unneeded 'undef'

2012-08-19 Thread Stefano Babic
On 19/08/2012 01:28, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> There is no need to undef an option that is not enabled by default.
> 
> Signed-off-by: Fabio Estevam 
> ---
>  include/configs/mx28evk.h |1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
> index 4e70617..b677e51 100644
> --- a/include/configs/mx28evk.h
> +++ b/include/configs/mx28evk.h
> @@ -215,7 +215,6 @@
>  #define CONFIG_SF_DEFAULT_SPEED  2400
>  
>  /* (redundant) environemnt in SPI flash */
> -#undef CONFIG_ENV_IS_IN_SPI_FLASH
>  #ifdef CONFIG_ENV_IS_IN_SPI_FLASH
>  #define CONFIG_SYS_REDUNDAND_ENVIRONMENT
>  #define CONFIG_ENV_SIZE  0x1000  /* 4KB */
> 

Acked-by: Stefano Babic 

Regards,
Stefano

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


[U-Boot] [PATCH v2] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread Stefano Babic
Signed-off-by: Stefano Babic 
---
Changes in v2:
- call the macro IMX_GPIO_NR  as in kernel (Fabio Estevam)
- change psr in gpio_psr (Benoit Thebaudeau)
- drop MXC_GPIO_PORT_TO_NUM and use common macro (Benoit Thebaudeau)

 arch/arm/include/asm/arch-mx25/gpio.h |5 -
 arch/arm/include/asm/imx-common/gpio.h|4 ++--
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |   28 -
 board/karo/tx25/tx25.c|   10 -
 board/syteco/zmx25/zmx25.c|   26 +++
 include/configs/mx6qsabrelite.h   |2 +-
 6 files changed, 35 insertions(+), 40 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx25/gpio.h 
b/arch/arm/include/asm/arch-mx25/gpio.h
index 5ab1f6d..61c0b0d 100644
--- a/arch/arm/include/asm/arch-mx25/gpio.h
+++ b/arch/arm/include/asm/arch-mx25/gpio.h
@@ -25,11 +25,6 @@
 #ifndef __ASM_ARCH_MX25_GPIO_H
 #define __ASM_ARCH_MX25_GPIO_H
 
-/* Converts a GPIO port number and the internal bit position
- * to the GPIO number
- */
-#define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit & 0x1f))
-
 #include 
 
 #endif
diff --git a/arch/arm/include/asm/imx-common/gpio.h 
b/arch/arm/include/asm/imx-common/gpio.h
index fcc25e8..65226d9 100644
--- a/arch/arm/include/asm/imx-common/gpio.h
+++ b/arch/arm/include/asm/imx-common/gpio.h
@@ -30,10 +30,10 @@
 struct gpio_regs {
u32 gpio_dr;/* data */
u32 gpio_dir;   /* direction */
-   u32 psr;/* pad satus */
+   u32 gpio_psr;   /* pad satus */
 };
 #endif
 
-#define GPIO_NUMBER(port, index)   port)-1)*32)+((index)&31))
+#define IMX_GPIO_NR(port, index)   port)-1)*32)+((index)&31))
 
 #endif
diff --git a/board/freescale/mx6qsabrelite/mx6qsabrelite.c 
b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
index 01e5083..72f4294 100644
--- a/board/freescale/mx6qsabrelite/mx6qsabrelite.c
+++ b/board/freescale/mx6qsabrelite/mx6qsabrelite.c
@@ -85,12 +85,12 @@ struct i2c_pads_info i2c_pad_info0 = {
.scl = {
.i2c_mode = MX6Q_PAD_EIM_D21__I2C1_SCL | PC,
.gpio_mode = MX6Q_PAD_EIM_D21__GPIO_3_21 | PC,
-   .gp = GPIO_NUMBER(3, 21)
+   .gp = IMX_GPIO_NR(3, 21)
},
.sda = {
.i2c_mode = MX6Q_PAD_EIM_D28__I2C1_SDA | PC,
.gpio_mode = MX6Q_PAD_EIM_D28__GPIO_3_28 | PC,
-   .gp = GPIO_NUMBER(3, 28)
+   .gp = IMX_GPIO_NR(3, 28)
}
 };
 
@@ -99,12 +99,12 @@ struct i2c_pads_info i2c_pad_info1 = {
.scl = {
.i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC,
.gpio_mode = MX6Q_PAD_KEY_COL3__GPIO_4_12 | PC,
-   .gp = GPIO_NUMBER(4, 12)
+   .gp = IMX_GPIO_NR(4, 12)
},
.sda = {
.i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC,
.gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO_4_13 | PC,
-   .gp = GPIO_NUMBER(4, 13)
+   .gp = IMX_GPIO_NR(4, 13)
}
 };
 
@@ -113,12 +113,12 @@ struct i2c_pads_info i2c_pad_info2 = {
.scl = {
.i2c_mode = MX6Q_PAD_GPIO_5__I2C3_SCL | PC,
.gpio_mode = MX6Q_PAD_GPIO_5__GPIO_1_5 | PC,
-   .gp = GPIO_NUMBER(1, 5)
+   .gp = IMX_GPIO_NR(1, 5)
},
.sda = {
.i2c_mode = MX6Q_PAD_GPIO_16__I2C3_SDA | PC,
.gpio_mode = MX6Q_PAD_GPIO_16__GPIO_7_11 | PC,
-   .gp = GPIO_NUMBER(7, 11)
+   .gp = IMX_GPIO_NR(7, 11)
}
 };
 
@@ -227,9 +227,9 @@ int board_ehci_hcd_init(int port)
imx_iomux_v3_setup_multiple_pads(usb_pads, ARRAY_SIZE(usb_pads));
 
/* Reset USB hub */
-   gpio_direction_output(GPIO_NUMBER(7, 12), 0);
+   gpio_direction_output(IMX_GPIO_NR(7, 12), 0);
mdelay(2);
-   gpio_set_value(GPIO_NUMBER(7, 12), 1);
+   gpio_set_value(IMX_GPIO_NR(7, 12), 1);
 
return 0;
 }
@@ -411,12 +411,12 @@ struct button_key {
 };
 
 static struct button_key const buttons[] = {
-   {"back",GPIO_NUMBER(2, 2),  'B'},
-   {"home",GPIO_NUMBER(2, 4),  'H'},
-   {"menu",GPIO_NUMBER(2, 1),  'M'},
-   {"search",  GPIO_NUMBER(2, 3),  'S'},
-   {"volup",   GPIO_NUMBER(7, 13), 'V'},
-   {"voldown", GPIO_NUMBER(4, 5),  'v'},
+   {"back",IMX_GPIO_NR(2, 2),  'B'},
+   {"home",IMX_GPIO_NR(2, 4),  'H'},
+   {"menu",IMX_GPIO_NR(2, 1),  'M'},
+   {"search",  IMX_GPIO_NR(2, 3),  'S'},
+   {"volup",   IMX_GPIO_NR(7, 13), 'V'},
+   {"voldown", IMX_GPIO_NR(4, 5),  'v'},
 };
 
 /*
diff --git a/board/karo/tx25/tx25.c b/board/karo/tx25/tx25.c
index 07fd98d..0fd41c7 100644
--- a/board/karo/tx25/tx25.c
+++ b/board/karo/tx25/tx25.c
@@ -34,8 +34,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef CONFIG_FEC_MXC
-#define GPIO_FEC_RESET_B   MXC_GPI

Re: [U-Boot] [PATCH] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread Stefano Babic
On 19/08/2012 02:25, Benoît Thébaudeau wrote:
> Hi Stefano,
> 
  #define MXC_GPIO_PORT_TO_NUM(port, bit) (((port - 1) << 5) + (bit
  &
  0x1f))
>>>
>>> Keeping this is also useless. GPIO_NUMBER() from the new
>>> 
>>> can be used instead everywhere needed.
>>
>> That is right - I drop it.
> 
> I don't know if you are aware of it, but just to let you know, I've seen the
> following patch that will interfere:
> http://patchwork.ozlabs.org/patch/165311/
> http://git.denx.de/?p=u-boot/u-boot-staging.git;a=commitdiff;h=72739219a12bf02820d29a89cb2b7fdc4d0e840f

Thanks, I cherry-pick it and I rebase on it.

Best regards,
Stefano

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


Re: [U-Boot] [PATCH] MX: Set a common gpio.h for all i.MX

2012-08-19 Thread stefano babic
Am 19/08/2012 00:59, schrieb Fabio Estevam:
> Hi Stefano,
> 
> On Sat, Aug 18, 2012 at 12:26 PM, Stefano Babic  wrote:
> 
>> +#define GPIO_NUMBER(port, index)   
>> port)-1)*32)+((index)&31))
> 
> What about calling this macro IMX_GPIO_NR instead?
> 
> This way we can have the same macro name in U-boot and in the kernel.

Right, agree, fix in V2.

Regards,
Stefano


-- 
=
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