Re: [U-Boot] [PATCH] mx1: add mx1/l support for mxc_i2c

2011-09-20 Thread Eric Jarrige
Hi Stafano,

On 19 sept. 2011, at 22:59, stefano babic wrote:
 Am 19/09/2011 22:34, schrieb Eric Jarrige:
 On 19 sept. 2011, at 09:26, Stefano Babic wrote:
 On 09/19/2011 08:57 AM, Marek Vasut wrote:
 On Monday, August 22, 2011 10:56:43 PM Eric Jarrige wrote:
 #define mxc_get_clock(a)(get_HCLK())
 I agree with you to get rid of all these #ifdef and my current patch does 
 not help at all.
 I can update the imx-regs.h with the change you propose but that won't help 
 for the
 future iMX CPU.
 IMHO the problem comes from all the hard coded constants in the driver such 
 as
 mxc_get_clock(MXC_IPG_PERCLK)
 ...I see the clock name is not so generic, and it is not related to the
 interface..

Right, IMHO that's the point.

 
 We have already this mechanism - this is the goal of the mxc_get_clock()
 function: a common way to get clocks for all i.MX processors.
 We have for example MXC_CSPI_CLK (SPI), MXC_UART_CLK, and so on. The
 line should become:
 
 freq = mxc_get_clock(MXC_I2C_CLK)
 
 and then each processor can return its own value. This already works for the 
 other interfaces (FEC, UART, SPI,..)
 
 
 that can be defined in clock.h with the correct definition for each chipset?
 We need only to extend the mxc_clock enumeration type. The
 implementation of mxc_get_clock() is SOC specific.
 Using a macro would clarify that is chipset dependent as each CPU use
 its own clock.h
 
 For the mx1, I can add a clock.h with the correct implementation of the
 macro:
 #define MXC_GET_I2C_CLOCK() get_HCLK()
 or any other solution that avoid any new ifdef.
 
 Does it makes sense?
 
 Yes, it makes sense to change, check my proposal 

Your proposal looks good and should be easy to implement for all new iMX CPU.

What is the main added values of the unique method mxc_get_clock compared
to the other model? 
On PowerPC the frequencies are saved in the gd- structure whereas the iMX 
legacy
principle used one accessor method for each clock but that lacks of a common
naming convention.
I can imagine that using the gd- structure optimize the memory footprint on 
PowerPC.

What is your strategy regarding the legacy SOCs? 
Do you have a refactoring plan to update the other CPU to the new interface
mxc_get_clock() ? 

A wrapping #define mxc_get_clock(a)(get_HCLK()) in clock.h should do the 
job for
the mx1 but is it a common rule or a kind of exception for the mx1?

Sorry still few questions regarding some remaining open points?
What are your plan/ideas to remove the list of #ifdef that provides the i2C_BASE
and CLOCK_OFFSET for each SOC?

Same question for the hard coded table of clock dividers  u16 div[] as this 
table may
change from CPU to CPU ?

Thanks and best regards,
Eric

 



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


Re: [U-Boot] [PATCH] mx1: add mx1/l support for mxc_i2c

2011-09-19 Thread Eric Jarrige
Hi Stefano,

On 19 sept. 2011, at 09:26, Stefano Babic wrote:

 On 09/19/2011 08:57 AM, Marek Vasut wrote:
 On Monday, August 22, 2011 10:56:43 PM Eric Jarrige wrote:
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 Cc: Stefano Babic sba...@denx.de
 Cc: Heiko Schocher h...@denx.de
 @@ -94,6 +98,8 @@ void i2c_init(int speed, int unused)
 /* start the required I2C clock */
 writel(readl(sc_regs-cgr0) | (3  I2C_CLK_OFFSET),
 sc_regs-cgr0);
 +#elif defined(CONFIG_IMX)
 +   freq = get_HCLK();
 #else
 freq = mxc_get_clock(MXC_IPG_PERCLK);
 #endif
 
 Please, no more ifdefs -- can't you actually modify your header files or add 
 some which would define mxc_get_clock() ? That'd make this way much more 
 clean.
 
 In principl, I agree completely with Marek, and we have tried to get rid
 as much of possible of #ifdef in drivers. I know we have already
 discussed about the opportunity to fix the whole IMX stuff, and I agreed
 with you that this processor is obsolete and make no sense to invest a
 lot of time for it. However, what about to define mxc_get_clock() as
 simple macro ? Maybe in imx-regs.h, as exceptiion for this processor
 (normally the imx-regs.h contains only defines and structures for the
 internal registers) ? Something like:
 
   #define mxc_get_clock(a)(get_HCLK())

I agree with you to get rid of all these #ifdef and my current patch does not 
help at all.
I can update the imx-regs.h with the change you propose but that won't help for 
the
future iMX CPU.
IMHO the problem comes from all the hard coded constants in the driver such as
mxc_get_clock(MXC_IPG_PERCLK)  and others I2C_BASE...
Every chipset use a different root clock for its i2c controller.

Why not changing the line
freq = mxc_get_clock(MXC_IPG_PERCLK);

by something more generic such as  a macro:

freq = MXC_GET_I2C_CLOCK(); /* or GET_MXC_I2C_CLOCK() */


that can be defined in clock.h with the correct definition for each chipset?
Using a macro would clarify that is chipset dependent as each CPU use
its own clock.h

For the mx1, I can add a clock.h with the correct implementation of the
macro:
#define MXC_GET_I2C_CLOCK() get_HCLK()
or any other solution that avoid any new ifdef.

Does it makes sense?

With all these constants moved to header files it would be easier and faster to 
support
new CPU as the final hardware abstraction layer moved to header file specific 
for each
CPU.

Best regards,
Eric









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


Re: [U-Boot] [PATCH v2] add dm9000 eeprom read/write command

2011-08-31 Thread Eric Jarrige

On 31 août 2011, at 15:01, Stefano Babic wrote:
 Hi Eric,
 
 Sorry for the confusion, I did not understood that your remark was
 not related to the compilation flags.
 Now, I've checked how to have this U-Boot commands in the driver
 itself. I think it's doable if  I can have a compilation
 CONFIG_CMD_XXX to enable the command line feature.
 
 You could add a CONFIG_DM9000_* switch. This set a switch only for the
 DM9000 driver and the name remembers that it is used only inside the
 driver itself, such as CONFIG_DM9000_DEBUG and CONFIG_DM9000_BASE that
 are currently used in the driver.

In such a case MAKEALL fails to compile the trizepsiv board with a double 
definition
of  'do_dm9000_eeprom'.  

 
 Without this option, there is a direct impact one memory footprint for
 every board featuring the DM9000 controller and I failed to find any
 model of driver with an optional command line interface in a driver.
 
 Or you can reuse CONFIG_DM9000_NO_SROM (already in driver) and enable
 your command if this switch is not defined. If the eeprom is present, it
 makes sense to have this command enabled.

That makes sense but there is still a compilation failure and some impact on
7 other boards.

 
 
 Why do you recommend to put the command interface in drivers
 as it is seems to be something quite unusual in U-Boot ? 
 
 Not sure it is so unusual. I see that all commands under common/* are
 general commands, and they are not related to a specific driver. There
 are then two commands in drivers, drivers/misc/fsl_pmic.c and
 drivers/qe/qe.c. These commands are only related to these drivers and
 make no sense without the driver. I see then a lot of board related
 commands stored in the board directories.
 
 If I understand well the concept, each command resides where it is
 thought: general commands in common, board commands in board
 directories, driver commands in the driver itself. If your command is in
 the driver file, there is also no need to check if CONFIG_DRIVER_DM9000
 is set, because the file is simply not compiled if it is unset.


I understand your point of view but I am not sure at all that board maintainers 
will
want to give a command interface to modify  the content of the DM9000 eeprom.

Best regards,
Eric


 

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


Re: [U-Boot] [PATCH v2] add dm9000 eeprom read/write command

2011-08-30 Thread Eric Jarrige
Hi Stefano,

On 30 août 2011, at 11:47, Stefano Babic wrote:

 On 08/28/2011 11:47 PM, Eric Jarrige wrote:
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 Signed-off-by: Stefano Babic sba...@denx.de
 Cc: Wolfgang Denk w...@denx.de
 Cc: Detlev Zundel d...@denx.de
 
 Changes for v2:
  - remove DM9000 driver dependant compilation flag
 ---
 
 Hi Eric,
 
 why should this code put in a separate file and not inserted in the
 driver itself ? I think this remains an open point from our previous
 discussion.
 

Sorry for the confusion, I did not understood that your remark was
not related to the compilation flags.
Now, I've checked how to have this U-Boot commands in the driver
itself. I think it's doable if  I can have a compilation
CONFIG_CMD_XXX to enable the command line feature.
Without this option, there is a direct impact one memory footprint for
every board featuring the DM9000 controller and I failed to find any
model of driver with an optional command line interface in a driver.

Why do you recommend to put the command interface in drivers
as it is seems to be something quite unusual in U-Boot ? 

Best regards,
Eric
 





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


[U-Boot] [PATCH 8/9 v2] DM9000: change some printf to use debug instead

2011-08-28 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Wolfgang Denk w...@denx.de
Cc: Detlev Zundel d...@denx.de

Changes for v2:
- Remove DM9000_ DEBUG macros and use debug() instead
---
 drivers/net/dm9000x.c |   97 +++--
 1 files changed, 46 insertions(+), 51 deletions(-)

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b5c5573..7fe7e46 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -66,27 +66,6 @@ TODO: external MII is not functional, only internal at the 
moment.
 
 #include dm9000x.h
 
-/* Board/System/Debug information/definition  */
-
-/* #define CONFIG_DM9000_DEBUG */
-
-#ifdef CONFIG_DM9000_DEBUG
-#define DM9000_DBG(fmt,args...) printf(fmt, ##args)
-#define DM9000_DMP_PACKET(func,packet,length)  \
-   do { \
-   int i;  \
-   printf(%s: length: %d\n, func, length);   \
-   for (i = 0; i  length; i++) {  \
-   if (i % 8 == 0) \
-   printf(\n%s: %02x: , func, i);\
-   printf(%02x , ((unsigned char *) packet)[i]); \
-   } printf(\n); \
-   } while(0)
-#else
-#define DM9000_DBG(fmt,args...)
-#define DM9000_DMP_PACKET(func,packet,length)
-#endif
-
 /* Structure/enum declaration --- */
 typedef struct board_info {
u32 runt_length_counter;/* counter: RX length  64byte */
@@ -124,21 +103,37 @@ static void DM9000_iow(int reg, u8 value);
 #define DM9000_inw(r) readw((volatile u16 *)(r))
 #define DM9000_inl(r) readl((volatile u32 *)(r))
 
-#ifdef CONFIG_DM9000_DEBUG
+#ifdef DEBUG
 static void
 dump_regs(void)
 {
-   DM9000_DBG(\n);
-   DM9000_DBG(NCR   (0x00): %02x\n, DM9000_ior(0));
-   DM9000_DBG(NSR   (0x01): %02x\n, DM9000_ior(1));
-   DM9000_DBG(TCR   (0x02): %02x\n, DM9000_ior(2));
-   DM9000_DBG(TSRI  (0x03): %02x\n, DM9000_ior(3));
-   DM9000_DBG(TSRII (0x04): %02x\n, DM9000_ior(4));
-   DM9000_DBG(RCR   (0x05): %02x\n, DM9000_ior(5));
-   DM9000_DBG(RSR   (0x06): %02x\n, DM9000_ior(6));
-   DM9000_DBG(ISR   (0xFE): %02x\n, DM9000_ior(DM9000_ISR));
-   DM9000_DBG(\n);
+   debug(\n);
+   debug(NCR   (0x00): %02x\n, DM9000_ior(0));
+   debug(NSR   (0x01): %02x\n, DM9000_ior(1));
+   debug(TCR   (0x02): %02x\n, DM9000_ior(2));
+   debug(TSRI  (0x03): %02x\n, DM9000_ior(3));
+   debug(TSRII (0x04): %02x\n, DM9000_ior(4));
+   debug(RCR   (0x05): %02x\n, DM9000_ior(5));
+   debug(RSR   (0x06): %02x\n, DM9000_ior(6));
+   debug(ISR   (0xFE): %02x\n, DM9000_ior(DM9000_ISR));
+   debug(\n);
+}
+
+static void dm9000_dmp_packet(char *func, unsigned char *packet, int length)
+{
+   int i;
+   do {
+   printf(%s: length: %d\n, func, length);
+   for (i = 0; i  length; i++) {
+   if (i % 8 == 0)
+   printf(\n%s: %02x: , func, i);
+   printf(%02x , ((unsigned char *) packet)[i]);
+   }
+   printf(\n);
+   } while (0);
 }
+#else
+#define dm9000_dmp_packet(func, packet, length)
 #endif
 
 static void dm9000_outblk_8bit(volatile void *data_ptr, int count)
@@ -232,7 +227,7 @@ dm9000_probe(void)
id_val |= DM9000_ior(DM9000_PIDL)  16;
id_val |= DM9000_ior(DM9000_PIDH)  24;
if (id_val == DM9000_ID) {
-   printf(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
+   debug(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
   id_val);
return 0;
} else {
@@ -246,7 +241,7 @@ dm9000_probe(void)
 static void
 dm9000_reset(void)
 {
-   DM9000_DBG(resetting DM9000\n);
+   debug(resetting DM9000\n);
 
/* Reset DM9000,
   see DM9000 Application Notes V1.22 Jun 11, 2004 page 29 */
@@ -259,7 +254,7 @@ dm9000_reset(void)
DM9000_iow(DM9000_NCR, (NCR_LBK_INT_MAC | NCR_RST));
 
do {
-   DM9000_DBG(resetting the DM9000, 1st reset\n);
+   debug(resetting the DM9000, 1st reset\n);
udelay(25); /* Wait at least 20 us */
} while (DM9000_ior(DM9000_NCR)  1);
 
@@ -267,7 +262,7 @@ dm9000_reset(void)
DM9000_iow(DM9000_NCR, (NCR_LBK_INT_MAC | NCR_RST)); /* Issue a second 
reset */
 
do {
-   DM9000_DBG(resetting the DM9000, 2nd reset\n);
+   debug(resetting the DM9000, 2nd reset\n);
udelay(25); /* Wait at least 20 us */
} while (DM9000_ior(DM9000_NCR)  1);
 
@@ -285,7 +280,7 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
u8 io_mode;
struct board_info *db = dm9000_info;
 
-   DM9000_DBG(%s\n, __func__);
+   debug(%s\n, __func__

[U-Boot] [PATCH v2] add dm9000 eeprom read/write command

2011-08-28 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Signed-off-by: Stefano Babic sba...@denx.de
Cc: Wolfgang Denk w...@denx.de
Cc: Detlev Zundel d...@denx.de

Changes for v2:
- remove DM9000 driver dependant compilation flag
---
 README|1 +
 common/Makefile   |1 +
 common/cmd_dm9000ee.c |   82 +
 3 files changed, 84 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_dm9000ee.c

diff --git a/README b/README
index 0886987..c6981bf 100644
--- a/README
+++ b/README
@@ -707,6 +707,7 @@ The following options need to be configured:
CONFIG_CMD_DATE * support for RTC, date/time...
CONFIG_CMD_DHCP * DHCP support
CONFIG_CMD_DIAG * Diagnostics
+   CONFIG_CMD_DM9000EE   DM9000 external EEPROM support
CONFIG_CMD_DS4510   * ds4510 I2C gpio commands
CONFIG_CMD_DS4510_INFO  * ds4510 I2C info command
CONFIG_CMD_DS4510_MEM   * ds4510 I2C eeprom/sram commansd
diff --git a/common/Makefile b/common/Makefile
index d662468..d22cbac 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -81,6 +81,7 @@ ifdef CONFIG_POST
 COBJS-$(CONFIG_CMD_DIAG) += cmd_diag.o
 endif
 COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o
+COBJS-$(CONFIG_CMD_DM9000EE) += cmd_dm9000ee.o
 COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o
 COBJS-$(CONFIG_CMD_ECHO) += cmd_echo.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o
diff --git a/common/cmd_dm9000ee.c b/common/cmd_dm9000ee.c
new file mode 100644
index 000..788e3bd
--- /dev/null
+++ b/common/cmd_dm9000ee.c
@@ -0,0 +1,82 @@
+/*
+ * (C) Copyright 2008-2011 Armadeus Project
+ * (C) Copyright 2007
+ * Stefano Babic, DENX Software Engineering, sba...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include command.h
+#include dm9000.h
+
+static int do_read_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc,
+char *const argv[])
+{
+   unsigned int i;
+   u8 data[2];
+
+   for (i = 0; i  0x40; i++) {
+   if (!(i % 0x10))
+   printf(\n%08x:, i);
+   dm9000_read_srom_word(i, data);
+   printf( %02x%02x, data[1], data[0]);
+   }
+   printf(\n);
+   return 0;
+}
+
+static int do_write_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+   unsigned long offset, value;
+
+   if (argc  4)
+   return cmd_usage(cmdtp);
+
+   strict_strtoul(argv[2], 16, offset);
+   strict_strtoul(argv[3], 16, value);
+   if (offset  0x40) {
+   printf(Wrong offset : 0x%lx\n, offset);
+   return cmd_usage(cmdtp);
+   }
+   dm9000_write_srom_word(offset, value);
+   return 0;
+}
+
+int do_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+   if (argc  2)
+   return cmd_usage(cmdtp);
+
+   if (strcmp(argv[1], read) == 0)
+   return do_read_dm9000_eeprom(cmdtp, flag, argc, argv);
+   else if (strcmp(argv[1], write) == 0)
+   return do_write_dm9000_eeprom(cmdtp, flag, argc, argv);
+   else
+   return cmd_usage(cmdtp);
+}
+
+U_BOOT_CMD(dm9000ee, 4, 1, do_dm9000_eeprom,
+  Read/Write eeprom connected to Ethernet Controller,
+  \ndm9000ee write word offset value \n
+  \tdm9000ee read \n
+  \tword:\t\t00-02 : MAC Address\n
+  \t\t\t03-07 : DM9000 Configuration\n \t\t\t08-63 : User data);
+

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


Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-24 Thread Eric Jarrige
Dear Wolfgang, Dear Stefano,

On 23 août 2011, at 13:26, Wolfgang Denk wrote:

 Dear Eric Jarrige,
 
 can you please mind your line length?  It is strongly recommended that
 text lines should not exceed 70 characters or so.  Thanks.

I will take care of that. I do apologize for the inconvenient.

 
 In message 1fad4112-2a57-415d-9cdf-8fc7a9edb...@armadeus.org you wrote:
 
 +#define CONFIG_EXTRA_ENV_SETTINGS \
 +  env_version=  CONFIG_ENV_VERSION  \0\
 +  fileaddr= MK_STR(CONFIG_SYS_LOAD_ADDR)\0\
 +  filesize= MK_STR(CONFIG_SYS_MONITOR_LEN)  \0\
 
 filesize is dynamically computed, you should not add it
 
 We need this variable already initialized at boot time to support the 
 specific imx boot mode from serial port when the user lost the full content 
 of the flash.
 
 Stefano is right.  filesize and fileaddr are dynamic variables,
 thet get created and updated on the fly. It makes no sense to
 pre-define them to any specific value. [Actually I have some changes
 in mind that avoid to save such variables with the environment at
 all.]

I understand - It make sense for me to wait for the new interface. 

 
 In such case (that is a stressing situation for the user) he can push U-Boot 
 through the serial port and use directly the script flash_uboot to recover 
 the original content of the flash. In such a use case this variable is not 
 dynamically computed.
 
 What do you mean by push U-Boot through the serial port?  Any of the
 respective commands in U-Boot (loads, loadb, loady) will
 automatically update the respective variables.

I meant  to boot using the iMX internal bootstrap loader as U-Boot is not
yet running. Alternatively I can download U-Boot a second time to have
the environment variables initialized. 
It is just a longer process than the original one.

 
 +#define CONFIG_NETMASK255.255.255.0
 +#define CONFIG_IPADDR 192.168.000.10
 
 Please drop fix ip address. They should not be part of mainline,
 
 Here, I have a problem as our documentation on the wiki armadeus.org is 
 based on this default IP addresses.
 
 Then fix the documentation?

That is something we will do in any case.

 
 It is a somewhat bad idea to publish documentation to end users before
 the code has passed even the inital code review...

Thanks for the recommendation.

 
 We really need a set of default IP addresses for private network to simplify 
 as much as possible the life of the armadeus project developers. 
 
 And what makes you think that 192.168.0.10 might be a free IP address
 in my network?  Or assume that 255.255.255.0 is the right netmask in
 this network?

http://tools.ietf.org/html/rfc1918#page-4

 
 These addresses may work for you, but they will not work for others,
 and thus it makes no sense to use them as defaults.

The armadeus BSP provide a user interface to customize the network
parameters according to end user network environment.

 
 If you need a reasonable default, then configure the board to use
 DHCP.
 
 I never seen such a restriction in U-Boot doc and moreover there is a set 
 CONFIG_XXIP documented in U-BOOT that confusing me,
 
 There are situations where this cannot be avoided - like when U-Boot
 is installed in a ROM, where the environment cannot be changed at all,
 and where for some reason DHCP or similar is not possible.  But that
 does not mean that this makes sense for the generic case.
 
 Is there another solution for a complete usable default configuration?
 
 Use DHCP?

Sure, DHCP is the best *technical* solution.
I meant for static IP address?

 
 Why do we need such a stuff when your configuration is fixed at compile
 time with CONFIG_SYS_SDRAM_MBYTE_SYZE 16 ?
 
 16MiB is the regular configuration but there are many configurations of 
 boards with different size of memory.
 This set of parameters enables to support every boards at compilation by 
 just changing the value of CONFIG_SYS_SDRAM_MBYTE_SYZE.
 So that the binary generated is fully optimized for each board.
 
 That's a maintenance nightmage for everybody and not needed at all.
 
 Please use get_ram_size() to have U-Boot auto-adjust to the actual RAM
 size of your board and forget about all such static optimizations.

Thanks for the update. 

 
 +#define CONFIG_SYS_INIT_SP_ADDR   (CONFIG_SYS_SDRAM_BASE  \
 +  + CONFIG_SYS_SDRAM_1_SIZE - 0x010)
 
 You do not use U_Boot macro here (GENERATED_GBL_DATA_SIZE), as it is
 usual. Stack pointer is already in RAM before relocation. Is it correct ?
 
 Correct. I do have to optimize the location of the initial Stack pointer  
 for my board so I put the init SP at any safe place in RAM.
 
 I find your answers not really helpful and constructive.  You write
 you have to optimize the location, but you fail to explain why you
 think so.  I consider it likely that you are wrong about the optimize
 part.  And you are definitely wrong about the rest, as you obviously
 did not understand Stefano's

Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-24 Thread Eric Jarrige
Dear Wolfgang,

On 24 août 2011, at 07:49, Wolfgang Denk wrote:

 Dear Eric Jarrige,
 
 In message d25738a8-8a7a-475a-95f5-8408c6463...@armadeus.org you wrote:
 
 Stefano is right.  filesize and fileaddr are dynamic variables,
 thet get created and updated on the fly. It makes no sense to
 pre-define them to any specific value. [Actually I have some changes
 in mind that avoid to save such variables with the environment at
 all.]
 
 I understand - It make sense for me to wait for the new interface. 
 
 Which new interface do you mean?  And why would waiting for it help
 you?

By interface I mean the changes you mentioned to avoid to have filesize
and fileaddr with the environment variables.


 
 What do you mean by push U-Boot through the serial port?  Any of the
 respective commands in U-Boot (loads, loadb, loady) will
 automatically update the respective variables.
 
 I meant  to boot using the iMX internal bootstrap loader as U-Boot is
 not
 yet running. Alternatively I can download U-Boot a second time to have
 the environment variables initialized. 
 It is just a longer process than the original one.
 
 Are you aware of things like env import etc.?

That could be the solution. I have to check it.
Thanks for the update.

 
 And what makes you think that 192.168.0.10 might be a free IP address
 in my network?  Or assume that 255.255.255.0 is the right netmask in
 this network?
 
 http://tools.ietf.org/html/rfc1918#page-4
 
 This page lists 192.168/16 prefix, i. e. a 255.255.0.0 netmask.
 I know many development environments, and 192.168.x.x is used very,
 very often there. often with a /24 netmask, sometimes differently (at
 DENX we're using it with a /16 netmast, for example).  

192.168/16 prefix is only the prefix of the class C private networks.
IMHO that means there are 256 class C networks  (255.255.255.0)  reserved
for private networks as mentioned on the same RFC page by
..and third block is a set of 256 contiguous class C network numbers

In the same way, there is another address range 172.16 - 172.31 dedicated class 
B
private networks for the organization who need /16 netmask.

 
 And there is absolutely NO guarantee that 192.168.0.10 is free, or
 that multiple users of your boards will boot simultaneously, or ...
 
 The _concept_ of such a default address is broken.
 
 These addresses may work for you, but they will not work for others,
 and thus it makes no sense to use them as defaults.
 
 The armadeus BSP provide a user interface to customize the network
 parameters according to end user network environment.
 
 Do you know the amount of efforts needed in any bigger organization
 to set up additional or to change existing network configurations?

I meant our BSP enable to change U-Boot default configuration of the
board to fit the existing networks of the end users/developpers -
not to change the network configuration of any organization. 

 
 Use DHCP?
 
 Sure, DHCP is the best *technical* solution.
 I meant for static IP address?
 
 Why does anybody need static IP addresses for the default case, i. e.
 for system bring up?

Well, may be things can be easier to explain with static IP than explaining
how to setup a DHCP server, DNS server

Anyway we will work more on the DHCP solution if this solution is
acceptable.

Best regards,
Eric



 


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


Re: [U-Boot] [PATCH 8/9] DM9000: change some printf to use debug instead

2011-08-24 Thread Eric Jarrige
Dear Wolfgang,

On 24 août 2011, at 22:20, Wolfgang Denk wrote:

 Dear Eric Jarrige,
 
 In message 2b613989-addb-43d6-a8c3-a30d52452...@armadeus.org you wrote:
 
 I'am just wondering: I see that DM9000_DBG is used all over dm9000 code 
 - do you know the reason why not just use debug()?
 
 dm9000 does not use debug() at all.
 That's the reason to fix the printf issues as a first priority by using the 
 DM9000_DBG.
 
 NAK.
 
 If you touch that, then please do it right: us debug() instead, and
 remove DM9000_DBG.  Thanks.

Do you mean both changes in one patch?

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


Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-24 Thread Eric Jarrige
Dear Wolfgang,

On 24 août 2011, at 08:34, Wolfgang Denk wrote:

 Dear Eric,
 
 In message 20110824054915.0860711f9...@gemini.denx.de I wrote:
 
 Sure, DHCP is the best *technical* solution.
 I meant for static IP address?
 
 Why does anybody need static IP addresses for the default case, i. e.
 for system bring up?
 
 And if you need one, what is the issue with using setenv ipaddr at
 the serial console?
 

The hobbyists working on U-Boot  will ask to have this command
in a their default configuration to simplify their development
process. I will be the first of them to request a user friendly solution.
I will check the 2 solutions: DHCP and env import when DHCP
is not applicable.

Thanks for your suggestion.

Best regards,
Eric

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


Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-24 Thread Eric Jarrige
Hi Stefano,

On 24 août 2011, at 08:22, Stefano Babic wrote:

 On 08/24/2011 06:56 AM, Eric Jarrige wrote:
 Dear Wolfgang, Dear Stefano,
 
 Hi Eric,
 
 We really need a set of default IP addresses for private network to 
 simplify as much as possible the life of the armadeus project developers. 
 
 And what makes you think that 192.168.0.10 might be a free IP address
 in my network?  Or assume that 255.255.255.0 is the right netmask in
 this network?
 
 http://tools.ietf.org/html/rfc1918#page-4
 
 Really RFC1918 reservs only IP addresses for private use, but there is
 nothing regarding a default IP address. And nothing different as usual
 how to assign the addresses to the hosts.
 
 To set a static IP address when DHCP is not available (a sort of
 autoconfiguration without DHCP server), the link-local address range
 should be used (169.254.0.0/16), described in
 http://tools.ietf.org/html/rfc3927.
 It sets a random IP in the range and checks with ARP that the address is
 not already used in the network. However, it is outside the goals of a
 bootloader ;-)

Correct, U-Boot does not support this protocol that is moreover limited
to devices directly connected to the same physical/logical link.

Best regards,
Eric

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


Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-23 Thread Eric Jarrige
Hi Stefano,

On 23 août 2011, at 11:46, Stefano Babic wrote:

 
 
 sorry for my late answer. I have missed a point.

No problem on my side - my answers are sometime even longer.

 
 Please drop fix ip address. They should not be part of mainline,
 
 Here, I have a problem as our documentation on the wiki armadeus.org is 
 based on this default IP addresses.
 We really need a set of default IP addresses for private network to simplify 
 as much as possible the life of the armadeus project developers. 
 I never seen such a restriction in U-Boot doc and moreover there is a set 
 CONFIG_XXIP documented in U-BOOT that confusing me,
 Is there another solution for a complete usable default configuration?
 
 Well, you will find a lot of NAK for patches that set fix IP addresses
 in the ML. Even if this default address is described in your
 documentation, what happens if two users of yours, as you say they are
 newbies, attach their board to the same LAN using the same default
 address ?

Ok, I missed these threads regarding IP address.
My recommendation for two or more developer is (was) to use each one its
own private network for the development using a dedicated
ethernet interface.

 Is it not better to explain them they need a *correct* ip
 address ?

Sure - That's the reason DHCP is also enable

Cheers,
Eric

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


Re: [U-Boot] [PATCH] add dm9000 eeprom read/write command

2011-08-23 Thread Eric Jarrige

On 23 août 2011, at 16:21, Stefano Babic wrote:

 On 08/23/2011 03:42 PM, Mike Frysinger wrote:
 On Tuesday, August 23, 2011 01:15:25 Eric Jarrige wrote:
 On 22 août 2011, at 23:55, Mike Frysinger wrote:
 On Monday, August 22, 2011 17:37:42 Eric Jarrige wrote:
 +#if (!defined(CONFIG_DM9000_NO_SROM)  defined(CONFIG_DRIVER_DM9000))
 
 why is this necessary ?
 
 the methods dm9000_read_srom_word()/dm9000_write_srom_word() need these
 conditions to be compiled in dm9000x.c Therefore this avoid dead code
 and/or compilation failure if these conditions are not met.
 
 my point is that it is user error to select CONFIG_CMD_DM9000EE but not 
 select 
 the DM9000 settings.  in your case, the user silently gets a build that 
 makes 
 no sense.  in my case, they're forced to fix things.
 
 Agree. This is also my point to move this code inside the driver itself,
 where CONFIG_DRIVER_DM9000 is set (or it is not compiled).
 

That makes sense - I can remove this line.

Best regards,
Eric

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


[U-Boot] [PATCH] mx1: add mx1/l support for mxc_i2c

2011-08-22 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Stefano Babic sba...@denx.de
Cc: Heiko Schocher h...@denx.de
---
 drivers/i2c/mxc_i2c.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 89d1973..597e9ee 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -27,7 +27,9 @@
 
 #if defined(CONFIG_HARD_I2C)
 
+#ifndef CONFIG_IMX
 #include asm/arch/clock.h
+#endif
 #include asm/arch/imx-regs.h
 
 #define IADR   0x00
@@ -63,6 +65,8 @@
 #define I2C_BASEI2C2_BASE_ADDR
 #elif defined(CONFIG_SYS_I2C_MX35_PORT1)
 #define I2C_BASE   I2C_BASE_ADDR
+#elif defined(CONFIG_SYS_I2C_MX1_PORT1)
+#define I2C_BASE   IMX_I2C_BASE
 #else
 #error define CONFIG_SYS_I2C_MXProcessor_PORTx to use the mx I2C driver
 #endif
@@ -94,6 +98,8 @@ void i2c_init(int speed, int unused)
/* start the required I2C clock */
writel(readl(sc_regs-cgr0) | (3  I2C_CLK_OFFSET),
sc_regs-cgr0);
+#elif defined(CONFIG_IMX)
+   freq = get_HCLK();
 #else
freq = mxc_get_clock(MXC_IPG_PERCLK);
 #endif

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


[U-Boot] [PATCH] add dm9000 eeprom read/write command

2011-08-22 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Signed-off-by: Stefano Babic sba...@denx.de
CC: Ben Warren biggerbadder...@gmail.com
---
 README|1 +
 common/Makefile   |1 +
 common/cmd_dm9000ee.c |   84 +
 3 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_dm9000ee.c

diff --git a/README b/README
index 0886987..c6981bf 100644
--- a/README
+++ b/README
@@ -707,6 +707,7 @@ The following options need to be configured:
CONFIG_CMD_DATE * support for RTC, date/time...
CONFIG_CMD_DHCP * DHCP support
CONFIG_CMD_DIAG * Diagnostics
+   CONFIG_CMD_DM9000EE   DM9000 external EEPROM support
CONFIG_CMD_DS4510   * ds4510 I2C gpio commands
CONFIG_CMD_DS4510_INFO  * ds4510 I2C info command
CONFIG_CMD_DS4510_MEM   * ds4510 I2C eeprom/sram commansd
diff --git a/common/Makefile b/common/Makefile
index d662468..d22cbac 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -81,6 +81,7 @@ ifdef CONFIG_POST
 COBJS-$(CONFIG_CMD_DIAG) += cmd_diag.o
 endif
 COBJS-$(CONFIG_CMD_DISPLAY) += cmd_display.o
+COBJS-$(CONFIG_CMD_DM9000EE) += cmd_dm9000ee.o
 COBJS-$(CONFIG_CMD_DTT) += cmd_dtt.o
 COBJS-$(CONFIG_CMD_ECHO) += cmd_echo.o
 COBJS-$(CONFIG_ENV_IS_IN_EEPROM) += cmd_eeprom.o
diff --git a/common/cmd_dm9000ee.c b/common/cmd_dm9000ee.c
new file mode 100644
index 000..0d53c70
--- /dev/null
+++ b/common/cmd_dm9000ee.c
@@ -0,0 +1,84 @@
+/*
+ * (C) Copyright 2008-2011 Armadeus Project
+ * (C) Copyright 2007
+ * Stefano Babic, DENX Software Engineering, sba...@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include common.h
+#include command.h
+#include dm9000.h
+
+#if (!defined(CONFIG_DM9000_NO_SROM)  defined(CONFIG_DRIVER_DM9000))
+
+static int do_read_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc,
+char *const argv[])
+{
+   unsigned int i;
+   u8 data[2];
+
+   for (i = 0; i  0x40; i++) {
+   if (!(i % 0x10))
+   printf(\n%08x:, i);
+   dm9000_read_srom_word(i, data);
+   printf( %02x%02x, data[1], data[0]);
+   }
+   printf(\n);
+   return 0;
+}
+
+static int do_write_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
+{
+   unsigned long offset, value;
+
+   if (argc  4)
+   return cmd_usage(cmdtp);
+
+   strict_strtoul(argv[2], 16, offset);
+   strict_strtoul(argv[3], 16, value);
+   if (offset  0x40) {
+   printf(Wrong offset : 0x%lx\n, offset);
+   return cmd_usage(cmdtp);
+   }
+   dm9000_write_srom_word(offset, value);
+   return 0;
+}
+
+int do_dm9000_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+{
+   if (argc  2)
+   return cmd_usage(cmdtp);
+
+   if (strcmp(argv[1], read) == 0)
+   return do_read_dm9000_eeprom(cmdtp, flag, argc, argv);
+   else if (strcmp(argv[1], write) == 0)
+   return do_write_dm9000_eeprom(cmdtp, flag, argc, argv);
+   else
+   return cmd_usage(cmdtp);
+}
+
+U_BOOT_CMD(dm9000ee, 4, 1, do_dm9000_eeprom,
+  Read/Write eeprom connected to Ethernet Controller,
+  \ndm9000ee write word offset value \n
+  \tdm9000ee read \n
+  \tword:\t\t00-02 : MAC Address\n
+  \t\t\t03-07 : DM9000 Configuration\n \t\t\t08-63 : User data);
+#endif /* !CONFIG_DM9000_NO_SROM  CONFIG_DRIVER_DM9000 */

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


Re: [U-Boot] [PATCH] add dm9000 eeprom read/write command

2011-08-22 Thread Eric Jarrige
Hi Mike,

On 22 août 2011, at 23:55, Mike Frysinger wrote:

 On Monday, August 22, 2011 17:37:42 Eric Jarrige wrote:
 +#if (!defined(CONFIG_DM9000_NO_SROM)  defined(CONFIG_DRIVER_DM9000))
 
 why is this necessary ?
 -mike

the methods dm9000_read_srom_word()/dm9000_write_srom_word() need these 
conditions to be compiled in dm9000x.c
Therefore this avoid dead code and/or compilation failure if these conditions 
are not met.

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


Re: [U-Boot] [PATCH 3/9] apf9328: Add Armadeus Project board APF9328

2011-08-17 Thread Eric Jarrige
Hi Higor, Hi Stefano,

On 17 août 2011, at 09:31, Igor Grinberg wrote:

 
 On 08/12/11 09:49, Stefano Babic wrote:
 On 08/12/2011 01:41 AM, Eric Jarrige wrote:
 
 Hi Eric,
 
 +int board_init(void) +{ +gd-bd-bi_arch_number =
 CONFIG_MACH_TYPE;
 Is there no MACH_TYPE for this board ? It is uncommon for an ARM
 board. Should this board run Linux ?
 The MACH_TYPE for this board is 906. This board runs linux and the
 integration in linux is on going.
 Ok, I have understood. The only thing you can directly set
 MACH_TYPE_APF9328 here. IMHO it is more readable.
 
 You should not do this here unless you support multiple mach types in a 
 single file.
 Please, see the CONFIG_MACH_TYPE in the U-Boot documentation (README file).

Here is the README sentence regarding CONFIG_MACH_TYPE:

 CONFIG_MACH_TYPE[relevant for ARM only][mandatory]

 This setting is mandatory for all boards that have only one
 machine type and must be used to specify the machine type
 number as it appears in the ARM machine registry
 (see http://www.arm.linux.org.uk/developer/machines/).
 Only boards that have multiple machine types supported
 in a single configuration file and the machine type is
 runtime discoverable, do not have to use this setting.

My understanding is:
1) CONFIG_MACH_TYPE has to be defined in apf9328.h
2) as gd-bd-bi_arch_number is already initialize in board.c i should 
completely remove this second initialization from the apf9382.c

arch/arm/lib/board.c:
 262 void board_init_f(ulong bootflag)
 ..
 277 
 278 #ifdef CONFIG_MACH_TYPE
 279 gd-bd-bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
 280 #endif 

Please let me know if missed something.

Thx and best regards,
Eric

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


Re: [U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-15 Thread Eric Jarrige
Hi Stefano,
On 11 août 2011, at 11:21, Stefano Babic wrote:

 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 ---
 include/configs/apf9328.h | 1034 
 +
 1 files changed, 1034 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/apf9328.h
 
 Hi Eric,
 
 +
 +#ifndef __CONFIG_H
 +#define __CONFIG_H
 +
 +#define CONFIG_VERSION_VARIABLE
 +#define CONFIG_ENV_VERSION  4.0
 +#define CONFIG_IDENT_STRING  apf9328 patch 4.0
 
 You add CONFIG_ without documenting them. If they are specific for your
 board, you should use another name, or please add documentation to make
 them available for other boards, too.

Good point. I propose to use a prefix like APF_ for macros specifics to this 
board and I will update the documentation to make the generic config available 
for the other boards.

 
 +
 +#define CONFIG_ARM920T  1   /* this is an ARM920T CPU */
 
 It is enough to #define a switch, without setting the value. This should
 be only:
 
 #define CONFIG_ARM920T/* this is an ARM920T CPU */
 
 This must be fixed globally.
 
 +#define CONFIG_IMX  1   /* in a Motorola MC9328MXL Chip */
 
 Ditto, and so on..
 
 +/*
 + * Definition of u-boot build in commands. Check out CONFIG_CMD_DFL if
 + * neccessary in include/cmd_confdefs.h file. (Un)comment for getting
 + * functionality or size of u-boot code.
 + */
 +
 +#include config_cmd_default.h
 +
 +#define CONFIG_CMD_ASKENV   /* ask for env variable */
 +#define CONFIG_CMD_BSP  /* Board Specific functions */
 +#define CONFIG_CMD_CACHE/* icache, dcache   */
 +#define CONFIG_CMD_DATE /* support for RTC, date/time.. */
 +#define CONFIG_CMD_DHCP /* DHCP Support */
 +#define CONFIG_CMD_DIAG /* Diagnostics  */
 +#define CONFIG_CMD_EEPROM   /* EEPROM read/write support*/
 +#define CONFIG_CMD_FLASH/* flinfo, erase, protect   */
 +#define CONFIG_CMD_I2C  /* I2C serial bus support   */
 +#define CONFIG_CMD_IMLS /* List all found images*/
 
 IMLS is already part of default commands
 
 +#define CONFIG_CMD_IMMAP/* IMMR dump support*/
 
 Is this not specific for PowerQuick processor ?

Thx, I ll remove it.

 
 +#define CONFIG_EXTRA_ENV_SETTINGS \
 +env_version=  CONFIG_ENV_VERSION  \0\
 +fileaddr= MK_STR(CONFIG_SYS_LOAD_ADDR)\0\
 +filesize= MK_STR(CONFIG_SYS_MONITOR_LEN)  \0\
 
 filesize is dynamically computed, you should not add it

We need this variable already initialized at boot time to support the specific 
imx boot mode from serial port when the user lost the full content of the flash.
In such case (that is a stressing situation for the user) he can push U-Boot 
through the serial port and use directly the script flash_uboot to recover 
the original content of the flash. In such a use case this variable is not 
dynamically computed.

 
 +ntpserverip=217.147.208.1\0   \
 
 No fixed IP address, please, even if they are related to known NTP servers.
 
 +#define CONFIG_MACH_TYPE MACH_TYPE_APF9328
 
 Why do you need it ? Is it not enough to use directly MACH_TYPE_APF9328 ?

The idea is to have most of the configuration parameters in the config.h files.
So that it become possible to factorize the initialization of the mach_type in 
a common place.
For the time being it is not needed it and I will remove it.

 
 +#define CONFIG_ETHADDR
 
 Not required, right ?

Right.

 
 +#define CONFIG_NETMASK  255.255.255.0
 +#define CONFIG_IPADDR   192.168.000.10
 
 Please drop fix ip address. They should not be part of mainline,

Here, I have a problem as our documentation on the wiki armadeus.org is based 
on this default IP addresses.
We really need a set of default IP addresses for private network to simplify as 
much as possible the life of the armadeus project developers. 
I never seen such a restriction in U-Boot doc and moreover there is a set 
CONFIG_XXIP documented in U-BOOT that confusing me,
Is there another solution for a complete usable default configuration?


 
 +#define CONFIG_BOARD_NAME   apf9328
 +#define CONFIG_HOSTNAME apf9328
 +#define CONFIG_GATEWAYIP192.168.000.1
 +#define CONFIG_SERVERIP 192.168.000.2
 
 Ditto
 
 +/*
 + * Malloc pool need to host env + 128 Kb reserve for other allocations.
 + */
 +#define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + (12810))
 
 I Think checkpatch will complain about missing spaces before and after 

checkpatch did not complain.  and  do not require extra spaces.

 
 +#define CONFIG_STACKSIZE(12010)   /* stack size   */
 +
 +#ifdef CONFIG_USE_IRQ
 +#define CONFIG_STACKSIZE_IRQ(410) /* IRQ stack*/
 +#define CONFIG_STACKSIZE_FIQ(410) /* FIQ

Re: [U-Boot] [PATCH 8/9] DM9000: change some printf to use debug instead

2011-08-11 Thread Eric Jarrige
Hi Simon, Hi Detlev,

 Hi Simon,
 
 Dear Eric Jarrige,
 
 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Signed-off-by: Eric Jarrigeeric.jarr...@armadeus.org
 Cc: Ben Warrenbiggerbadder...@gmail.com
 ---
  drivers/net/dm9000x.c |8 
  1 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
 index b5c5573..9cd0195 100644
 --- a/drivers/net/dm9000x.c
 +++ b/drivers/net/dm9000x.c
 @@ -232,7 +232,7 @@ dm9000_probe(void)
 id_val |= DM9000_ior(DM9000_PIDL)  16;
 id_val |= DM9000_ior(DM9000_PIDH)  24;
 if (id_val == DM9000_ID) {
 -   printf(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
 +   DM9000_DBG(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
id_val);
 return 0;
 } else {
 @@ -298,19 +298,19 @@ static int dm9000_init(struct eth_device *dev, bd_t 
 *bd)
 
 switch (io_mode) {
 case 0x0:  /* 16-bit mode */
 -   printf(DM9000: running in 16 bit mode\n);
 +   DM9000_DBG(DM9000: running in 16 bit mode\n);
 snip
 
 I'am just wondering: I see that DM9000_DBG is used all over dm9000 code 
 - do you know the reason why not just use debug()?

dm9000 does not use debug() at all.
That's the reason to fix the printf issues as a first priority by using the 
DM9000_DBG.

 
 Very likely only historical reasons as the code predates the DEBUG best
 practice.  Bow that you've identified it, we should change it ;)
 
Cheers,
Eric

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


Re: [U-Boot] [PATCH 6/9] mx1: improve PLL freq computation

2011-08-11 Thread Eric Jarrige
Hi Stefano,

On 11 août 2011, at 11:22, Stefano Babic wrote:

 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Improve PLL freq computation by using the full resolution of the PLL 
 registers
 
 Hi Eric,
 
 +return (2*(u64)sys_clk_freq * (mfi*(mfd+1) + mfn))/((mfd+1)*(pd+1));
 +}
 
 -return (2*(CONFIG_SYSPLL_CLK_FREQ10)*( (mfi10) + 
 (mfn10)/(mfd+1)))/(pd+1);
 
 Please run checkpatch on your patches for V2. I have not yet done, but
 this line will report missing spaces.
 
I did it and had no error and no warning:

Here is the ourput of checkpatch.pl:

armadeus/buildroot/output/build/linux-3.0.1/scripts/checkpatch.pl 
../../../target/u-boot/git/09-arm920t-relocation.patch 
total: 0 errors, 0 warnings, 10 lines checked

../../../target/u-boot/git/09-arm920t-relocation.patch has no obvious style 
problems and is ready for submission.

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


Re: [U-Boot] [PATCH 2/9] mx1: add i2c registers

2011-08-11 Thread Eric Jarrige
Hi Stefano,

On 11 août 2011, at 10:52, Stefano Babic wrote:

 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Add i2c registers for Freescale imx1/L/S
 
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 Cc: Stefano Babic sba...@denx.de
 ---
 arch/arm/include/asm/arch-imx/imx-regs.h |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)
 
 
 Hi Eric,
 
 
 +/*
 + * I2C module
 + */
 +#define IADR   __REG(IMX_I2C_BASE + 0x000) /* I2C Address Register */
 +#define IFDR   __REG(IMX_I2C_BASE + 0x004) /* I2C Frequency Divider 
 Register*/
 +#define I2CR   __REG(IMX_I2C_BASE + 0x008) /* I2C Control Register */
 +#define I2SR   __REG(IMX_I2C_BASE + 0x00C) /* I2C Status Register */
 +#define I2DR   __REG(IMX_I2C_BASE + 0x010) /* I2C Data I/O Register */
 
 See my comments on your [PATCH 3/9] apf9328: Add Armadeus Project board
 APF9328. Access to registers must be done via accessors and __REG macro
 should be removed.

Ok, I remove the i2c driver from the apf9328 set of patches
change the __REG macro to C struct and submit the i2c driver in a separate set 
of patches according to your comment in the [PATCH 3/9]

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


Re: [U-Boot] [PATCH 6/9] mx1: improve PLL freq computation

2011-08-11 Thread Eric Jarrige
Hi Stefano,
 
 On 11 août 2011, at 11:22, Stefano Babic wrote:
 
 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Improve PLL freq computation by using the full resolution of the PLL 
 registers
 
 Hi Eric,
 
 +   return (2*(u64)sys_clk_freq * (mfi*(mfd+1) + mfn))/((mfd+1)*(pd+1));
 +}
 
 -   return (2*(CONFIG_SYSPLL_CLK_FREQ10)*( (mfi10) + 
 (mfn10)/(mfd+1)))/(pd+1);
 
 Please run checkpatch on your patches for V2. I have not yet done, but
 this line will report missing spaces.
 
 I did it and had no error and no warning:
 


Here is the report of checkpatch.pl on [PATCH 6/9] this time :

armadeus/buildroot/output/build/linux-3.0.1/scripts/checkpatch.pl 
../../../target/u-boot/git/06-mx1-pllclk.patch 
total: 0 errors, 0 warnings, 44 lines checked

../../../target/u-boot/git/06-mx1-pllclk.patch has no obvious style problems 
and is ready for submission.


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


Re: [U-Boot] [PATCH 3/9] apf9328: Add Armadeus Project board APF9328

2011-08-11 Thread Eric Jarrige
Hi Stefano,

 On 08/10/2011 10:33 PM, Eric Jarrige wrote:
 Add Armadeus Project board APF9328
 
 Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
 Signed-off-by: Nicolas Colombain nicolas.colomb...@armadeus.com
 
 Hi Eric,
 
 
 diff --git a/board/armadeus/apf9328/apf9328.c 
 b/board/armadeus/apf9328/apf9328.c
 new file mode 100644
 index 000..2250221
 --- /dev/null
 +++ b/board/armadeus/apf9328/apf9328.c
 @@ -0,0 +1,91 @@
 +/*
 + * (C) Copyright 2005-2011
 + * Nicolas Colombin tho...@users.sourceforge.net
 + * Eric Jarrige eric.jarr...@armadeus.org
 + * Copyright (C) 2004 Sascha Hauer, Synertronixx GmbH
 + *
 + * 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 common.h
 +#include asm/arch/imx-regs.h
 +#include flash.h
 +#include netdev.h
 +#include apf9328fpga.h
 +
 +DECLARE_GLOBAL_DATA_PTR;
 +
 +int board_init(void)
 +{
 +gd-bd-bi_arch_number = CONFIG_MACH_TYPE;
 
 Is there no MACH_TYPE for this board ? It is uncommon for an ARM board.
 Should this board run Linux ?
The MACH_TYPE for this board is 906. This board runs linux and the integration 
in linux is on going.
 
 +void dram_init_banksize(void)
 +{
 +#if (CONFIG_NR_DRAM_BANKS  0)
 
 I think you can get rid of this #ifdef, if you have no RAM at all you
 cannot simply run u-boot.
Good point. I will fix it.

 
 + * Miscellaneous intialization
 + */
 +int misc_init_r(void)
 +{
 +char *s;
 +
 +#if (CONFIG_FPGA)
 +apf9328_init_fpga();
 +#endif
 +
 +#if (CONFIG_DRIVER_DM9000)
 +imx_gpio_mode(GPIO_PORTB | GPIO_DR | GPIO_IN | 14);
 
 Is there a reason to put this code here and not in board_eth_init ? It
 is related to Ethernet and I am supposing this setup should be done
 before dm9000_initialize.
The idea is to keep the configuration  of the CPU pins at one place and to keep 
the initialization of the ethernet controller in a separate function. 
Here this principle of segregation is not obvious as there is only one GPIO pin 
to configure.

 
 
 +
 +void show_boot_progress(int status)
 +{
 +return;
 +}
 
 This function seems to me not very useful. Is it not better to drop it ?
 It is not strictly required.
 You set also #undef CONFIG_SHOW_BOOT_PROGRESS in the configuration file.
Well I choosed to keep it in place in empty state to be the template for the 
final user to add their own debug method if needed.
If it is an issue I would prefer to define the CONFIG_SHOW_BOOT_PROGRESS in the 
configuration file than removing this empty show_boot_progress as the main 
purpose of the board is education and trainings on embedded developments.

 
 
 +#if (CONFIG_FPGA)
 +DECLARE_GLOBAL_DATA_PTR;
 +/* Note that these are pointers to code that is in Flash.  They will be
 + * relocated at runtime.
 + * Spartan3 code is used to download our Spartan 3 :) code is compatible.
 + * Just take care about the file size
 +*/
 +Xilinx_Spartan3_Slave_Serial_fns fpga_fns = {
 +fpga_pre_fn,
 +fpga_pgm_fn,
 +fpga_clk_fn,
 +fpga_init_fn,
 +fpga_done_fn,
 +fpga_wr_fn,
 +};
 +
 +Xilinx_desc fpga[CONFIG_FPGA_COUNT] = {
 
 Do you have more as one FPGA on your board ? And if this is true, they
 share the same firmware ? (I see only one CONFIG_FIRMWARE_ADDR..)
The APF9328 is a SOM therefore it possible to connect some other FPGA to the 
board. In such a situation the idea is to concatenate all the bitstream files 
in the firmware partition.
During the download process to the FPGAs the end of one FPGA download starts 
the download of the next one using the FPGA signal PRG_DONE.
So that it possible to have all firmware in only one partition and save memory 
space by using bitstream files.
To be honest I do not remember if someone use this feature on this board but 
that is . 

 
 +/*
 + * Initialize the fpga.  Return 1 on success, 0 on failure.
 + */
 +int apf9328_init_fpga(void)
 +{
 +char *autoload = getenv(firmware_autoload);
 +int i, lout = 1;
 +
 +debug(%s:%d: Initialize FPGA interface (relocation offset= 0x%.8lx)\n,
 +__func__, __LINE__, gd-reloc_off);
 +
 +fpga_init();
 +
 +for (i = 0; i  CONFIG_FPGA_COUNT; i++) {
 +debug(%s:%d: Adding fpga %d\n, __func__, __LINE__, i);
 +fpga_add(fpga_xilinx, fpga[i]);
 +}
 +
 +if ((autoload)  (0 == strcmp(autoload, 1

[U-Boot] [PATCH 8/9] DM9000: change some printf to use debug instead

2011-08-10 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Ben Warren biggerbadder...@gmail.com
---
 drivers/net/dm9000x.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index b5c5573..9cd0195 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -232,7 +232,7 @@ dm9000_probe(void)
id_val |= DM9000_ior(DM9000_PIDL)  16;
id_val |= DM9000_ior(DM9000_PIDH)  24;
if (id_val == DM9000_ID) {
-   printf(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
+   DM9000_DBG(dm9000 i/o: 0x%x, id: 0x%x \n, CONFIG_DM9000_BASE,
   id_val);
return 0;
} else {
@@ -298,19 +298,19 @@ static int dm9000_init(struct eth_device *dev, bd_t *bd)
 
switch (io_mode) {
case 0x0:  /* 16-bit mode */
-   printf(DM9000: running in 16 bit mode\n);
+   DM9000_DBG(DM9000: running in 16 bit mode\n);
db-outblk= dm9000_outblk_16bit;
db-inblk = dm9000_inblk_16bit;
db-rx_status = dm9000_rx_status_16bit;
break;
case 0x01:  /* 32-bit mode */
-   printf(DM9000: running in 32 bit mode\n);
+   DM9000_DBG(DM9000: running in 32 bit mode\n);
db-outblk= dm9000_outblk_32bit;
db-inblk = dm9000_inblk_32bit;
db-rx_status = dm9000_rx_status_32bit;
break;
case 0x02: /* 8 bit mode */
-   printf(DM9000: running in 8 bit mode\n);
+   DM9000_DBG(DM9000: running in 8 bit mode\n);
db-outblk= dm9000_outblk_8bit;
db-inblk = dm9000_inblk_8bit;
db-rx_status = dm9000_rx_status_8bit;

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


[U-Boot] [PATCH 6/9] mx1: improve PLL freq computation

2011-08-10 Thread Eric Jarrige
Improve PLL freq computation by using the full resolution of the PLL registers

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/cpu/arm920t/imx/speed.c |   29 +++--
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/arch/arm/cpu/arm920t/imx/speed.c b/arch/arm/cpu/arm920t/imx/speed.c
index 1e29698..b1c2bd6 100644
--- a/arch/arm/cpu/arm920t/imx/speed.c
+++ b/arch/arm/cpu/arm920t/imx/speed.c
@@ -36,33 +36,26 @@
  * the specified bus in HZ.
  */
 /* - */
-
-ulong get_systemPLLCLK(void)
+static ulong get_PLLCLK(u32 sys_clk_freq, u32 pllctl0)
 {
/* FIXME: We assume System_SEL = 0 here */
-   u32 spctl0 = SPCTL0;
-   u32 mfi = (spctl0  10)  0xf;
-   u32 mfn = spctl0  0x3f;
-   u32 mfd = (spctl0  16)  0x3f;
-   u32 pd =  (spctl0  26)  0xf;
+   u32 mfi = (pllctl0  10)  0xf;
+   u32 mfn = pllctl0  0x3ff;
+   u32 mfd = (pllctl0  16)  0x3ff;
+   u32 pd =  (pllctl0  26)  0xf;
 
mfi = mfi=5 ? 5 : mfi;
+   return (2*(u64)sys_clk_freq * (mfi*(mfd+1) + mfn))/((mfd+1)*(pd+1));
+}
 
-   return (2*(CONFIG_SYSPLL_CLK_FREQ10)*( (mfi10) + 
(mfn10)/(mfd+1)))/(pd+1);
+ulong get_systemPLLCLK(void)
+{
+   return get_PLLCLK(CONFIG_SYSPLL_CLK_FREQ, SPCTL0);
 }
 
 ulong get_mcuPLLCLK(void)
 {
-   /* FIXME: We assume System_SEL = 0 here */
-   u32 mpctl0 = MPCTL0;
-   u32 mfi = (mpctl0  10)  0xf;
-   u32 mfn = mpctl0  0x3f;
-   u32 mfd = (mpctl0  16)  0x3f;
-   u32 pd =  (mpctl0  26)  0xf;
-
-   mfi = mfi=5 ? 5 : mfi;
-
-   return (2*(CONFIG_SYS_CLK_FREQ10)*( (mfi10) + 
(mfn10)/(mfd+1)))/(pd+1);
+   return get_PLLCLK(CONFIG_SYS_CLK_FREQ, MPCTL0);
 }
 
 ulong get_FCLK(void)

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


[U-Boot] [PATCH 9/9] arm920t: Fix jump to the relocated board_init_r

2011-08-10 Thread Eric Jarrige
Jump to the relocated board_init_r according to the initial computation
and remove computation against current PC addr as relocated address is
already known and fixed.
This helps to support CPU that miror flash to different address at
power on boot such as Freescale iMX1/L

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Albert Aribaud albert.u.b...@aribaud.net
---
 arch/arm/cpu/arm920t/start.S |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/arm920t/start.S b/arch/arm/cpu/arm920t/start.S
index c308420..5c75289 100644
--- a/arch/arm/cpu/arm920t/start.S
+++ b/arch/arm/cpu/arm920t/start.S
@@ -292,9 +292,7 @@ _nand_boot_ofs:
.word nand_boot
 #else
ldr r0, _board_init_r_ofs
-   adr r1, _start
-   add lr, r0, r1
-   add lr, lr, r9
+   add lr, r0, r6
/* setup parameters for board_init_r */
mov r0, r5  /* gd_t */
mov r1, r6  /* dest_addr */

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


[U-Boot] [PATCH 7/9] mx1: change a printf in speed.c to use debug instead

2011-08-10 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/cpu/arm920t/imx/speed.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm920t/imx/speed.c b/arch/arm/cpu/arm920t/imx/speed.c
index b1c2bd6..b8e42bf 100644
--- a/arch/arm/cpu/arm920t/imx/speed.c
+++ b/arch/arm/cpu/arm920t/imx/speed.c
@@ -67,7 +67,7 @@ ulong get_FCLK(void)
 ulong get_HCLK(void)
 {
u32 bclkdiv = (( CSCR  10 )  0xf) + 1;
-   printf(bclkdiv: %d\n, bclkdiv);
+   debug(bclkdiv: %d\n, bclkdiv);
return get_systemPLLCLK() / bclkdiv;
 }
 

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


[U-Boot] [PATCH 2/9] mx1: add i2c registers

2011-08-10 Thread Eric Jarrige
Add i2c registers for Freescale imx1/L/S

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/include/asm/arch-imx/imx-regs.h |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-imx/imx-regs.h 
b/arch/arm/include/asm/arch-imx/imx-regs.h
index 0c26a36..a7b3404 100644
--- a/arch/arm/include/asm/arch-imx/imx-regs.h
+++ b/arch/arm/include/asm/arch-imx/imx-regs.h
@@ -638,4 +638,27 @@ extern void imx_gpio_mode(int gpio_mode);
 #define TSTAT_CAPT (11)  /* Capture event */
 #define TSTAT_COMP (1) /* Compare event */
 
+/*
+ * I2C module
+ */
+#define IADR   __REG(IMX_I2C_BASE + 0x000) /* I2C Address Register */
+#define IFDR   __REG(IMX_I2C_BASE + 0x004) /* I2C Frequency Divider Register*/
+#define I2CR   __REG(IMX_I2C_BASE + 0x008) /* I2C Control Register */
+#define I2SR   __REG(IMX_I2C_BASE + 0x00C) /* I2C Status Register */
+#define I2DR   __REG(IMX_I2C_BASE + 0x010) /* I2C Data I/O Register */
+/* I2C Control Register Bit Fields */
+#define I2CR_IEN   (17)  /* I2C Enable */
+#define I2CR_IIEN  (16)  /* I2C Interrupt Enable */
+#define I2CR_MSTA  (15)  /* I2C Master/Slave Mode Select */
+#define I2CR_MTX   (14)  /* I2C Transmit/Receive Mode Select */
+#define I2CR_TXAK  (13)  /* I2C Transmit Acknowledge Enable */
+#define I2CR_RSTA  (12)  /* I2C Repeated START */
+#define I2SR_ICF   (17)  /* I2C Data Transfer */
+#define I2SR_IAAS  (16)  /* I2C Addressed As a Slave */
+#define I2SR_IBB   (15)  /* I2C Bus Busy */
+#define I2SR_IAL   (14)  /* I2C Arbitration Lost */
+#define I2SR_SRW   (12)  /* I2C Slave Read/Write */
+#define I2SR_IIF   (11)  /* I2C interrupt */
+#define I2SR_RXAK  (10)  /* I2C Received Acknowledge */
+
 #endif /* _IMX_REGS_H */

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


[U-Boot] [PATCH 5/9] apf9328: add default board configuration file

2011-08-10 Thread Eric Jarrige
Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
---
 include/configs/apf9328.h | 1034 +
 1 files changed, 1034 insertions(+), 0 deletions(-)
 create mode 100644 include/configs/apf9328.h

diff --git a/include/configs/apf9328.h b/include/configs/apf9328.h
new file mode 100644
index 000..b609887
--- /dev/null
+++ b/include/configs/apf9328.h
@@ -0,0 +1,1034 @@
+/*
+ * (C) Copyright 2005-2011 ej Armadeus Project eric.jarr...@armadeus.org
+ *
+ * Configuration settings for the Armadeus Project motherboard 9328.
+ *
+ * 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
+ *
+ * 2005/01/14 Initial version taken from the scb9328 configuration file
+ * 2005/03/10 apf9328 configuration file and trial to improve of
+ * hardware register control.
+ * 2005/08/16 added APF9328 fpgas and ethernet
+ * 2005/12/02 added filesystem boot over NFS
+ * 2006/11/26 added filesystem boot over NFS
+ * 2010/03/28 U-Boot 2010.03 migration + change timer unit to ms (fixme)
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define CONFIG_VERSION_VARIABLE
+#define CONFIG_ENV_VERSION 4.0
+#define CONFIG_IDENT_STRING apf9328 patch 4.0
+
+#define CONFIG_ARM920T 1   /* this is an ARM920T CPU */
+#define CONFIG_IMX 1   /* in a Motorola MC9328MXL Chip */
+#define CONFIG_apf9328 1   /* on a Armadeus project board */
+#undef CONFIG_USE_IRQ  /* don't need use IRQ/FIQ */
+#define CONFIG_SYS_DCACHE_OFF  /* fix kernel 2.6.29 boot crash */
+/*
+ * Enable the call to misc_init_r() for miscellaneous platform
+ * dependent initialization.
+ */
+
+#define CONFIG_MISC_INIT_R
+
+/*
+ * BOOTP options
+ */
+#define CONFIG_BOOTP_BOOTFILESIZE
+#define CONFIG_BOOTP_BOOTPATH
+#define CONFIG_BOOTP_GATEWAY
+#define CONFIG_BOOTP_HOSTNAME
+
+#define CONFIG_BOOTP_SUBNETMASK
+#define CONFIG_BOOTP_DNS
+#define CONFIG_BOOTP_DNS2
+
+/*
+ * Select serial console configuration
+ */
+#define CONFIG_IMX_SERIAL
+#define CONFIG_IMX_SERIAL1
+#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
+#define CONFIG_BAUDRATE115200
+
+/*
+ * Definition of u-boot build in commands. Check out CONFIG_CMD_DFL if
+ * neccessary in include/cmd_confdefs.h file. (Un)comment for getting
+ * functionality or size of u-boot code.
+ */
+
+#include config_cmd_default.h
+
+#define CONFIG_CMD_ASKENV  /* ask for env variable */
+#define CONFIG_CMD_BSP /* Board Specific functions */
+#define CONFIG_CMD_CACHE   /* icache, dcache   */
+#define CONFIG_CMD_DATE/* support for RTC, date/time.. */
+#define CONFIG_CMD_DHCP/* DHCP Support */
+#define CONFIG_CMD_DIAG/* Diagnostics  */
+#define CONFIG_CMD_EEPROM  /* EEPROM read/write support*/
+#define CONFIG_CMD_FLASH   /* flinfo, erase, protect   */
+#define CONFIG_CMD_I2C /* I2C serial bus support   */
+#define CONFIG_CMD_IMLS/* List all found images*/
+#define CONFIG_CMD_IMMAP   /* IMMR dump support*/
+#define CONFIG_CMD_JFFS2   /* JFFS2 Support*/
+#define CONFIG_CMD_MTDPARTS/* MTD partition support*/
+#define CONFIG_CMD_PING/* ping support */
+#define CONFIG_CMD_SAVES   /* save S record dump   */
+#define CONFIG_CMD_SETEXPR /* setexpr support  */
+#define CONFIG_CMD_SNTP/* SNTP support */
+#define CONFIG_CMD_NFS
+#define CONFIG_CMD_DNS
+
+#undef CONFIG_DISPLAY_BOARDINFO
+#undef CONFIG_DISPLAY_CPUINFO
+
+/*
+ * Select some advanced features of the commande line parser
+ */
+#define CONFIG_AUTO_COMPLETE   1   /* Enable auto completion of */
+   /* commands using TAB */
+#define CONFIG_SYS_HUSH_PARSER 1   /* enable the hush shell */
+#define CONFIG_SYS_PROMPT_HUSH_PS2  /* secondary prompt string */
+#define CONFIG_CMDLINE_EDITING 1
+
+#define CONFIG_MTD_DEVICE
+#define CONFIG_MTD_PARTITIONS
+/*
+ * Boot options. Setting delay to -1 stops autostart count down.
+ */
+#define

[U-Boot] [PATCH 0/9] Series short description

2011-08-10 Thread Eric Jarrige
The following series adds support for the Armadeus Project
board apf9328 and also fixes some driver issues or improvements
concerning the Freescale iMX1 cpu, DM9000 ethernet controler and
the final call to the relocated board_init_r for the arm920t.
The last arm920t patch should be applicable to the whole arm cpu family
if some other CPU have the same behavior of mirroring the flash
memory to a different address at power on reset.

---

Eric Jarrige (9):
  mx1: export imx_gpio_mode() function
  mx1: add i2c registers
  apf9328: Add Armadeus Project board APF9328
  apf9328: add apf9328 board in Makefile
  apf9328: add default board configuration file
  mx1: improve PLL freq computation
  mx1: change a printf in speed.c to use debug instead
  DM9000: change some printf to use debug instead
  arm920t: Fix jump to the relocated board_init_r


 MAINTAINERS  |4 
 MAKEALL  |1 
 arch/arm/cpu/arm920t/imx/speed.c |   31 -
 arch/arm/cpu/arm920t/start.S |4 
 arch/arm/include/asm/arch-imx/imx-regs.h |   30 +
 board/armadeus/apf9328/Makefile  |   51 +
 board/armadeus/apf9328/apf9328.c |   91 +++
 board/armadeus/apf9328/apf9328fpga.c |   89 +++
 board/armadeus/apf9328/apf9328fpga.h |   31 +
 board/armadeus/apf9328/eeprom.c  |   88 +++
 board/armadeus/apf9328/fpga.c|  121 
 board/armadeus/apf9328/fpga.h|   30 +
 board/armadeus/apf9328/i2c.c |  276 
 board/armadeus/apf9328/lowlevel_init.S   |  469 ++
 boards.cfg   |1 
 drivers/net/dm9000x.c|8 
 include/configs/apf9328.h| 1034 ++
 17 files changed, 2333 insertions(+), 26 deletions(-)
 create mode 100644 board/armadeus/apf9328/Makefile
 create mode 100644 board/armadeus/apf9328/apf9328.c
 create mode 100644 board/armadeus/apf9328/apf9328fpga.c
 create mode 100644 board/armadeus/apf9328/apf9328fpga.h
 create mode 100644 board/armadeus/apf9328/eeprom.c
 create mode 100644 board/armadeus/apf9328/fpga.c
 create mode 100644 board/armadeus/apf9328/fpga.h
 create mode 100644 board/armadeus/apf9328/i2c.c
 create mode 100644 board/armadeus/apf9328/lowlevel_init.S
 create mode 100644 include/configs/apf9328.h

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


[U-Boot] [PATCH 4/9] apf9328: add apf9328 board in Makefile

2011-08-10 Thread Eric Jarrige
add apf9328 board definition in makefile, MAKEALL and MAINTAINERS list

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
---
 MAINTAINERS |4 
 MAKEALL |1 +
 boards.cfg  |1 +
 3 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f895e9a..48807fe 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -686,6 +686,10 @@ Grazvydas Ignotas nota...@gmail.com
 
omap3_pandora   ARM ARMV7 (OMAP3xx SoC)
 
+Eric Jarrige eric.jarr...@armadeus.org
+
+   apf9328 ARM920T (iMX1)
+
 Gary Jennejohn ga...@denx.de
 
smdk2400ARM920T
diff --git a/MAKEALL b/MAKEALL
index 3b98f03..f1aa6fc 100755
--- a/MAKEALL
+++ b/MAKEALL
@@ -320,6 +320,7 @@ LIST_ARM7= \
 
 LIST_ARM9=\
a320evb \
+   apf9328 \
ap920t  \
ap922_XA10  \
ap926ejs\
diff --git a/boards.cfg b/boards.cfg
index 6827cf3..1b4da54 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -49,6 +49,7 @@ lpc2292sodimmarm arm720t -
   -
 SMN42arm arm720t -   
siemenslpc2292
 evb4510  arm arm720t -   - 
 s3c4510b
 a320evb  arm arm920t -   
faradaya320
+apf9328  arm arm920t apf9328 
armadeus   imx
 at91rm9200ek arm arm920t at91rm9200ekatmel 
 at91at91rm9200ek
 at91rm9200ek_ram arm arm920t at91rm9200ekatmel 
 at91at91rm9200ek:RAMBOOT
 eb_cpux9k2   arm arm920t -   BuS   
 at91

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


[U-Boot] [PATCH 1/9] mx1: export imx_gpio_mode() function

2011-08-10 Thread Eric Jarrige
Add imx_gpio_mode() to Freescale imx1/L/S public functions

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/include/asm/arch-imx/imx-regs.h |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-imx/imx-regs.h 
b/arch/arm/include/asm/arch-imx/imx-regs.h
index ec94ba9..0c26a36 100644
--- a/arch/arm/include/asm/arch-imx/imx-regs.h
+++ b/arch/arm/include/asm/arch-imx/imx-regs.h
@@ -1,5 +1,12 @@
 #ifndef _IMX_REGS_H
 #define _IMX_REGS_H
+
+#ifndef __ASSEMBLY__
+
+extern void imx_gpio_mode(int gpio_mode);
+
+#endif /* __ASSEMBLY__ */
+
 /* 
  *  Motorola IMX system registers
  * 

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


[U-Boot] [PATCH 3/9] apf9328: Add Armadeus Project board APF9328

2011-08-10 Thread Eric Jarrige
Add Armadeus Project board APF9328

Signed-off-by: Eric Jarrige eric.jarr...@armadeus.org
Signed-off-by: Nicolas Colombain nicolas.colomb...@armadeus.com
---
 board/armadeus/apf9328/Makefile|   51 +++
 board/armadeus/apf9328/apf9328.c   |   91 ++
 board/armadeus/apf9328/apf9328fpga.c   |   89 ++
 board/armadeus/apf9328/apf9328fpga.h   |   31 ++
 board/armadeus/apf9328/eeprom.c|   88 ++
 board/armadeus/apf9328/fpga.c  |  121 
 board/armadeus/apf9328/fpga.h  |   30 ++
 board/armadeus/apf9328/i2c.c   |  276 +++
 board/armadeus/apf9328/lowlevel_init.S |  469 
 9 files changed, 1246 insertions(+), 0 deletions(-)
 create mode 100644 board/armadeus/apf9328/Makefile
 create mode 100644 board/armadeus/apf9328/apf9328.c
 create mode 100644 board/armadeus/apf9328/apf9328fpga.c
 create mode 100644 board/armadeus/apf9328/apf9328fpga.h
 create mode 100644 board/armadeus/apf9328/eeprom.c
 create mode 100644 board/armadeus/apf9328/fpga.c
 create mode 100644 board/armadeus/apf9328/fpga.h
 create mode 100644 board/armadeus/apf9328/i2c.c
 create mode 100644 board/armadeus/apf9328/lowlevel_init.S

diff --git a/board/armadeus/apf9328/Makefile b/board/armadeus/apf9328/Makefile
new file mode 100644
index 000..0f097cd
--- /dev/null
+++ b/board/armadeus/apf9328/Makefile
@@ -0,0 +1,51 @@
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS  := apf9328.o i2c.o apf9328fpga.o fpga.o eeprom.o
+SOBJS  := lowlevel_init.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+clean:
+   rm -f $(SOBJS) $(OBJS)
+
+distclean: clean
+   rm -f $(LIB) core *.bak .depend
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/armadeus/apf9328/apf9328.c b/board/armadeus/apf9328/apf9328.c
new file mode 100644
index 000..2250221
--- /dev/null
+++ b/board/armadeus/apf9328/apf9328.c
@@ -0,0 +1,91 @@
+/*
+ * (C) Copyright 2005-2011
+ * Nicolas Colombin tho...@users.sourceforge.net
+ * Eric Jarrige eric.jarr...@armadeus.org
+ * Copyright (C) 2004 Sascha Hauer, Synertronixx GmbH
+ *
+ * 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 common.h
+#include asm/arch/imx-regs.h
+#include flash.h
+#include netdev.h
+#include apf9328fpga.h
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+   gd-bd-bi_arch_number = CONFIG_MACH_TYPE;
+   gd-bd-bi_boot_params = CONFIG_BOOT_PARAMS_ADDR;
+
+   return 0;
+}
+
+int dram_init(void)
+{
+   /* dram_init must store complete ramsize in gd-ram_size */
+   gd-ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_1_BASE,
+   CONFIG_SYS_SDRAM_1_SIZE);
+   return 0;
+}
+
+void dram_init_banksize(void)
+{
+#if (CONFIG_NR_DRAM_BANKS  0)
+   gd-bd-bi_dram[0].start = CONFIG_SYS_SDRAM_1_BASE;
+   gd-bd-bi_dram[0].size = CONFIG_SYS_SDRAM_1_SIZE;
+#endif
+}
+
+/*
+ * Miscellaneous intialization
+ */
+int misc_init_r(void)
+{
+   char *s;
+
+#if (CONFIG_FPGA)
+   apf9328_init_fpga();
+#endif

[U-Boot] [PATCH] fec_mx.c: Fix MX27 FEC logic to check validity of the MAC address in fuse

2010-04-15 Thread Eric Jarrige
Fix MX27 FEC logic to check validity of the MAC address in fuse.
Only null (empty fuse) or invalid MAC address was retrieved from mx27 fuses 
before this change.

Signed-off-by:  Eric Jarrige jora...@armadeus.org
---
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 8c4ade5..d7706b5 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -325,7 +325,7 @@ static int fec_get_hwaddr(struct eth_device *dev, unsigned 
char *mac)
for (i = 0; i  6; i++)
mac[6-1-i] = readl(iim-iim_bank_area0[IIM0_MAC + i]);

-   return is_valid_ether_addr(mac);
+   return !is_valid_ether_addr(mac);
 #endif
 }


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