Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Stefan Roese
On 09/18/2012 11:51 PM, Scott Wood wrote:
>>> (and then see if we can change since
>>> as Scott notes, this needs to work for 4kb boards and that is  
>> tight).
>>
>> What exactly are the 4k boards?
> 
> Anything that uses fsl_elbc_nand is 4K.  I think most (all?) of the ppc  
> 4xx boards are 4K.

Yes. All ppc4xx boards with "old" nand_spl support are 4KiB. And they
don't use serial at all right now.

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


[U-Boot] [PATCH] mx6qsabresd: Add Ethernet support

2012-09-18 Thread Fabio Estevam
From: Fabio Estevam 

mx6qsabresd has a AR8031 Gigabit PHY.

Add support for it. 

Also increase CONFIG_SYS_MALLOC_LEN so that FEC buffer allocation does not fail.

Tested on 1Gbp and 100Mbps networks.

Suggested-by: Kim Phillips 
Signed-off-by: Fabio Estevam 
---
 board/freescale/mx6qsabresd/mx6qsabresd.c |   76 +
 include/configs/mx6qsabresd.h |   17 ++-
 2 files changed, 91 insertions(+), 2 deletions(-)

diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c 
b/board/freescale/mx6qsabresd/mx6qsabresd.c
index c86b51b..c0ea956 100644
--- a/board/freescale/mx6qsabresd/mx6qsabresd.c
+++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
@@ -56,6 +56,36 @@ iomux_v3_cfg_t uart1_pads[] = {
MX6Q_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
 };
 
+iomux_v3_cfg_t enet_pads[] = {
+   MX6Q_PAD_ENET_MDIO__ENET_MDIO   | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   /* AR8031 PHY Reset */
+   MX6Q_PAD_ENET_CRS_DV__GPIO_1_25 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+static void setup_iomux_enet(void)
+{
+   imx_iomux_v3_setup_multiple_pads(enet_pads, ARRAY_SIZE(enet_pads));
+
+   /* Reset AR8031 PHY */
+   gpio_direction_output(IMX_GPIO_NR(1, 25) , 0);
+   udelay(500);
+   gpio_set_value(IMX_GPIO_NR(1, 25), 1);
+}
+
 iomux_v3_cfg_t usdhc3_pads[] = {
MX6Q_PAD_SD3_CLK__USDHC3_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6Q_PAD_SD3_CMD__USDHC3_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
@@ -90,6 +120,52 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+int mx6_rgmii_rework(struct phy_device *phydev)
+{
+   unsigned short val;
+
+   /* To enable AR8031 ouput a 125MHz clk from CLK_25M */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x7);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0xe, 0x8016);
+   phy_write(phydev, MDIO_DEVAD_NONE, 0xd, 0x4007);
+
+   val = phy_read(phydev, MDIO_DEVAD_NONE, 0xe);
+   val &= 0xffe3;
+   val |= 0x18;
+   phy_write(phydev, MDIO_DEVAD_NONE, 0xe, val);
+
+   /* introduce tx clock delay */
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x5);
+   val = phy_read(phydev, MDIO_DEVAD_NONE, 0x1e);
+   val |= 0x0100;
+   phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, val);
+
+   return 0;
+}
+
+int board_phy_config(struct phy_device *phydev)
+{
+   mx6_rgmii_rework(phydev);
+
+   if (phydev->drv->config)
+   phydev->drv->config(phydev);
+
+   return 0;
+}
+
+int board_eth_init(bd_t *bis)
+{
+   int ret;
+
+   setup_iomux_enet();
+
+   ret = cpu_eth_init(bis);
+   if (ret)
+   printf("FEC MXC: %s:failed\n", __func__);
+
+   return 0;
+}
+
 u32 get_board_rev(void)
 {
return 0x63000;
diff --git a/include/configs/mx6qsabresd.h b/include/configs/mx6qsabresd.h
index 448ce28..a2d2c65 100644
--- a/include/configs/mx6qsabresd.h
+++ b/include/configs/mx6qsabresd.h
@@ -33,9 +33,8 @@
 #define CONFIG_REVISION_TAG
 
 /* Size of malloc() pool */
-#define CONFIG_SYS_MALLOC_LEN  CONFIG_ENV_SIZE
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 2 * 1024 * 1024)
 
-#define CONFIG_ARCH_CPU_INIT
 #define CONFIG_BOARD_EARLY_INIT_F
 #define CONFIG_MXC_GPIO
 
@@ -55,6 +54,20 @@
 #define CONFIG_CMD_FAT
 #define CONFIG_DOS_PARTITION
 
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_MII
+#define CONFIG_CMD_NET
+#define CONFIG_FEC_MXC
+#define CONFIG_MII
+#define IMX_FEC_BASE   ENET_BASE_ADDR
+#define CONFIG_FEC_XCV_TYPERGMII
+#define CONFIG_ETHPRIME"FEC"
+#define CONFIG_FEC_MXC_PHYADDR 1
+
+#define CONFIG_PHYLIB
+#define CONFIG_PHY_ATHEROS
+
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_CONS_INDEX  1
-- 
1.7.9.5

___
U-Boot mailing list
U-Boot@lists.denx

Re: [U-Boot] [RFC] mx6qsabresd: Add Ethernet support

2012-09-18 Thread Fabio Estevam
Hi Kim,

On Tue, Sep 18, 2012 at 9:20 PM, Kim Phillips
 wrote:

> I managed to get it working a while back, at least on 1Gb links.
> The following hack is based on the original version of your sabresd
> support patch and the fsl bsp's.  AFAICT, the largest difference is
> how it taps into PHYLIB for some phy config stuff:

Excellent! It works :-)

Would you like to submit your patch or want me to do it?

Please let me know what you prefer.

Thanks,

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


Re: [U-Boot] [PATCH] Exynos5250: Enable PXE Support

2012-09-18 Thread Minkyu Kang
On 18 September 2012 15:22, Chander Kashyap  wrote:
> ping
>
> On 5 September 2012 16:08, Chander Kashyap  wrote:
>> Add PXE support for the Exynos5250.
>>
>> Signed-off-by: Chander Kashyap 
>> ---
>>  include/configs/smdk5250.h |6 ++
>>  1 file changed, 6 insertions(+)
>>

applied to u-boot-samsung.

Thanks.
Minkyu Kang.
-- 
from. prom.
www.promsoft.net
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 11/11] RFC mx6qsabrelite: imximage.cfg: enable plugin mode

2012-09-18 Thread Troy Kisky

On 9/18/2012 5:03 PM, Troy Kisky wrote:

Don't apply this patch yet, because although u-boot
will boot, Linux won't

The other CPU's won't come online, and L2 cache
initialization crashes

Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys cpuacct
CPU: Testing write buffer coherency: ok
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
CPU1: failed to come online
CPU2: failed to come online
CPU3: failed to come online
Brought up 1 CPUs
SMP: Total of 1 processors activated (1581.05 BogoMIPS).
print_constraints: dummy:
NET: Registered protocol family 16
print_constraints: vddpu: 725 <--> 1300 mV at 1100 mV fast normal
print_constraints: vddcore: 725 <--> 1300 mV at 1100 mV fast normal
print_constraints: vddsoc: 725 <--> 1300 mV at 1200 mV fast normal
print_constraints: vdd2p5: 2000 <--> 2775 mV at 2400 mV fast normal
print_constraints: vdd1p1: 800 <--> 1400 mV at 1100 mV fast normal
print_constraints: vdd3p0: 2800 <--> 3150 mV at 3000 mV fast normal
 Board type Nitrogen6X/W
hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
hw-breakpoint: 1 breakpoint(s) reserved for watchpoint single-step.
hw-breakpoint: maximum watchpoint size is 4 bytes.
Unhandled fault: imprecise external abort (0x1c06) at 0x1d4c07b4
Internal error: : 1c06 [#1] PREEMPT SMP
Modules linked in:
CPU: 0Not tainted  (3.0.35-1968-gd3f7f36-03060-ga3844c7 #1)
PC is at mxc_init_l2x0+0x50/0x120

Anyone have a clue?

The same thing under freescale's imx-android-r13.3
works fine. Only mainline doesn't work

Signed-off-by: Troy Kisky 
---
  board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg 
b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
index eea8d3a..2af4265 100644
--- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
+++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
@@ -26,7 +26,7 @@
   * The syntax is taken as close as possible with the kwbimage
   */
  #define FOR_MX6Q
-
+#define USE_PLUGIN
  #include 
  
  /* image version */
Never mind. I found the issue. I need to disable the L2 cache before 
returning from plugin.



Thanks
Troy

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


Re: [U-Boot] [PATCH] i.MX6: get rid of redundant struct src_regs (dupe of struct src)

2012-09-18 Thread Troy Kisky

On 9/18/2012 6:26 PM, Eric Nelson wrote:

Signed-off-by: Eric Nelson 
---
  arch/arm/cpu/armv7/mx6/soc.c |2 +-
  arch/arm/include/asm/arch-mx6/imx-regs.h |   21 -
  2 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 7380ffe..bc65767 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -146,7 +146,7 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
  void boot_mode_apply(unsigned cfg_val)
  {
unsigned reg;
-   struct src_regs *psrc = (struct src_regs *)SRC_BASE_ADDR;
+   struct src *psrc = (struct src *)SRC_BASE_ADDR;
writel(cfg_val, &psrc->gpr9);
reg = readl(&psrc->gpr10);
if (cfg_val)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 8834c59..3651cdf 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -448,26 +448,5 @@ struct iomuxc_base_regs {
u32 daisy[104]; /* 0x7b0..94c */
  };
  
-struct src_regs {

-   u32 scr;/* 0x00 */
-   u32 sbmr1;  /* 0x04 */
-   u32 srsr;   /* 0x08 */
-   u32 reserved1;  /* 0x0c */
-   u32 reserved2;  /* 0x10 */
-   u32 sisr;   /* 0x14 */
-   u32 simr;   /* 0x18 */
-   u32 sbmr2;  /* 0x1c */
-   u32 gpr1;   /* 0x20 */
-   u32 gpr2;   /* 0x24 */
-   u32 gpr3;   /* 0x28 */
-   u32 gpr4;   /* 0x2c */
-   u32 gpr5;   /* 0x30 */
-   u32 gpr6;   /* 0x34 */
-   u32 gpr7;   /* 0x38 */
-   u32 gpr8;   /* 0x3c */
-   u32 gpr9;   /* 0x40 */
-   u32 gpr10;  /* 0x44 */
-};
-
  #endif /* __ASSEMBLER__*/
  #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */

Good catch!!
Don't know how I missed that.

Thanks
Troy

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


Re: [U-Boot] [PATCH 08/11] mx6: add plugin file for use with imximage.cfg

2012-09-18 Thread Troy Kisky

On 9/18/2012 5:03 PM, Troy Kisky wrote:

The "plugin" command of mkimage can take this
file as an argument.

Signed-off-by: Troy Kisky 
---
  arch/arm/cpu/armv7/mx6/Makefile |5 +-
  arch/arm/cpu/armv7/mx6/plugin.S |  141 +++
  2 files changed, 145 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm/cpu/armv7/mx6/plugin.S


Ok, I found the issue with Linux not booting, and I'll need to change 
this patch to add

disabling of L2 cache and a cache clean.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] i.MX6: get rid of redundant struct src_regs (dupe of struct src)

2012-09-18 Thread Eric Nelson
Signed-off-by: Eric Nelson 
---
 arch/arm/cpu/armv7/mx6/soc.c |2 +-
 arch/arm/include/asm/arch-mx6/imx-regs.h |   21 -
 2 files changed, 1 insertions(+), 22 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 7380ffe..bc65767 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -146,7 +146,7 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
 void boot_mode_apply(unsigned cfg_val)
 {
unsigned reg;
-   struct src_regs *psrc = (struct src_regs *)SRC_BASE_ADDR;
+   struct src *psrc = (struct src *)SRC_BASE_ADDR;
writel(cfg_val, &psrc->gpr9);
reg = readl(&psrc->gpr10);
if (cfg_val)
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h 
b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 8834c59..3651cdf 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -448,26 +448,5 @@ struct iomuxc_base_regs {
u32 daisy[104]; /* 0x7b0..94c */
 };
 
-struct src_regs {
-   u32 scr;/* 0x00 */
-   u32 sbmr1;  /* 0x04 */
-   u32 srsr;   /* 0x08 */
-   u32 reserved1;  /* 0x0c */
-   u32 reserved2;  /* 0x10 */
-   u32 sisr;   /* 0x14 */
-   u32 simr;   /* 0x18 */
-   u32 sbmr2;  /* 0x1c */
-   u32 gpr1;   /* 0x20 */
-   u32 gpr2;   /* 0x24 */
-   u32 gpr3;   /* 0x28 */
-   u32 gpr4;   /* 0x2c */
-   u32 gpr5;   /* 0x30 */
-   u32 gpr6;   /* 0x34 */
-   u32 gpr7;   /* 0x38 */
-   u32 gpr8;   /* 0x3c */
-   u32 gpr9;   /* 0x40 */
-   u32 gpr10;  /* 0x44 */
-};
-
 #endif /* __ASSEMBLER__*/
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
-- 
1.7.9

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


Re: [U-Boot] [PATCH V3 3/8] disk: introduce get_device()

2012-09-18 Thread Rob Herring
On 09/18/2012 08:21 PM, Rob Herring wrote:
> On 09/18/2012 05:37 PM, Stephen Warren wrote:
>> From: Stephen Warren 
>>
>> This patch introduces function get_device(). This looks up a
>> block_dev_desc_t from an interface name (e.g. mmc) and device number
>> (e.g. 0). This function is essentially the non-partition-specific
>> prefix of get_device_and_partition().
> 
> Then shouldn't get_device_and_partition just call get_device. Perhaps
> create get_partition() and then get_device_and_partition is just a wrapper.
> 

I should read all the way through the series before replying...

Anyway, I would squash it all unless you want to have restructuring with
current functionality and then enhancements.

Rob

> Rob
> 
>>
>> Signed-off-by: Stephen Warren 
>> ---
>> v3: New patch.
>> ---
>>  disk/part.c|   22 ++
>>  include/part.h |5 +
>>  2 files changed, 27 insertions(+), 0 deletions(-)
>>
>> diff --git a/disk/part.c b/disk/part.c
>> index 277a243..9920d48 100644
>> --- a/disk/part.c
>> +++ b/disk/part.c
>> @@ -435,6 +435,28 @@ void print_part (block_dev_desc_t * dev_desc)
>>  
>>  #endif
>>  
>> +int get_device(const char *ifname, const char *dev_str,
>> +   block_dev_desc_t **dev_desc)
>> +{
>> +char *ep;
>> +int dev;
>> +
>> +dev = simple_strtoul(dev_str, &ep, 16);
>> +if (*ep) {
>> +printf("** Bad device specification %s %s **\n",
>> +   ifname, dev_str);
>> +return -1;
>> +}
>> +
>> +*dev_desc = get_dev(ifname, dev);
>> +if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
>> +printf("** Bad device %s %s **\n", ifname, dev_str);
>> +return -1;
>> +}
>> +
>> +return dev;
>> +}
>> +
>>  #define MAX_SEARCH_PARTITIONS 16
>>  int get_device_and_partition(const char *ifname, const char *dev_str,
>>   block_dev_desc_t **dev_desc,
>> diff --git a/include/part.h b/include/part.h
>> index a6d06f3..144df4e 100644
>> --- a/include/part.h
>> +++ b/include/part.h
>> @@ -112,6 +112,8 @@ int get_partition_info (block_dev_desc_t * dev_desc, int 
>> part, disk_partition_t
>>  void print_part (block_dev_desc_t *dev_desc);
>>  void  init_part (block_dev_desc_t *dev_desc);
>>  void dev_print(block_dev_desc_t *dev_desc);
>> +int get_device(const char *ifname, const char *dev_str,
>> +   block_dev_desc_t **dev_desc);
>>  int get_device_and_partition(const char *ifname, const char *dev_str,
>>   block_dev_desc_t **dev_desc,
>>   disk_partition_t *info);
>> @@ -131,6 +133,9 @@ static inline int get_partition_info (block_dev_desc_t * 
>> dev_desc, int part,
>>  static inline void print_part (block_dev_desc_t *dev_desc) {}
>>  static inline void  init_part (block_dev_desc_t *dev_desc) {}
>>  static inline void dev_print(block_dev_desc_t *dev_desc) {}
>> +static inline int get_device(const char *ifname, const char *dev_str,
>> +   block_dev_desc_t **dev_desc)
>> +{ return -1; }
>>  static inline int get_device_and_partition(const char *ifname,
>> const char *dev_str,
>> block_dev_desc_t **dev_desc,
>>
> 

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


Re: [U-Boot] [PATCH V3 3/8] disk: introduce get_device()

2012-09-18 Thread Rob Herring
On 09/18/2012 05:37 PM, Stephen Warren wrote:
> From: Stephen Warren 
> 
> This patch introduces function get_device(). This looks up a
> block_dev_desc_t from an interface name (e.g. mmc) and device number
> (e.g. 0). This function is essentially the non-partition-specific
> prefix of get_device_and_partition().

Then shouldn't get_device_and_partition just call get_device. Perhaps
create get_partition() and then get_device_and_partition is just a wrapper.

Rob

> 
> Signed-off-by: Stephen Warren 
> ---
> v3: New patch.
> ---
>  disk/part.c|   22 ++
>  include/part.h |5 +
>  2 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/disk/part.c b/disk/part.c
> index 277a243..9920d48 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -435,6 +435,28 @@ void print_part (block_dev_desc_t * dev_desc)
>  
>  #endif
>  
> +int get_device(const char *ifname, const char *dev_str,
> +block_dev_desc_t **dev_desc)
> +{
> + char *ep;
> + int dev;
> +
> + dev = simple_strtoul(dev_str, &ep, 16);
> + if (*ep) {
> + printf("** Bad device specification %s %s **\n",
> +ifname, dev_str);
> + return -1;
> + }
> +
> + *dev_desc = get_dev(ifname, dev);
> + if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
> + printf("** Bad device %s %s **\n", ifname, dev_str);
> + return -1;
> + }
> +
> + return dev;
> +}
> +
>  #define MAX_SEARCH_PARTITIONS 16
>  int get_device_and_partition(const char *ifname, const char *dev_str,
>block_dev_desc_t **dev_desc,
> diff --git a/include/part.h b/include/part.h
> index a6d06f3..144df4e 100644
> --- a/include/part.h
> +++ b/include/part.h
> @@ -112,6 +112,8 @@ int get_partition_info (block_dev_desc_t * dev_desc, int 
> part, disk_partition_t
>  void print_part (block_dev_desc_t *dev_desc);
>  void  init_part (block_dev_desc_t *dev_desc);
>  void dev_print(block_dev_desc_t *dev_desc);
> +int get_device(const char *ifname, const char *dev_str,
> +block_dev_desc_t **dev_desc);
>  int get_device_and_partition(const char *ifname, const char *dev_str,
>block_dev_desc_t **dev_desc,
>disk_partition_t *info);
> @@ -131,6 +133,9 @@ static inline int get_partition_info (block_dev_desc_t * 
> dev_desc, int part,
>  static inline void print_part (block_dev_desc_t *dev_desc) {}
>  static inline void  init_part (block_dev_desc_t *dev_desc) {}
>  static inline void dev_print(block_dev_desc_t *dev_desc) {}
> +static inline int get_device(const char *ifname, const char *dev_str,
> +block_dev_desc_t **dev_desc)
> +{ return -1; }
>  static inline int get_device_and_partition(const char *ifname,
>  const char *dev_str,
>  block_dev_desc_t **dev_desc,
> 

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


Re: [U-Boot] [PATCH V3 2/8] disk: fix get_device_and_partition() bootable search

2012-09-18 Thread Rob Herring
On 09/18/2012 05:37 PM, Stephen Warren wrote:
> From: Stephen Warren 
> 
> The existing get_device_and_partition() bootable search loop attempts
> to save the current best known partition in variable best_part. However,
> it's actually just saving a copy of the (static) "info" variable, and
> hence ends up not doing anything much useful if no bootable partition
> is found. Fix this by reworking the loop to:
> 
> a) When reading information about a partition, always read into the
>caller-supplied buffer; that way, if we find a bootable partition,
>there's no need to copy any information.
> b) Save the first known valid partition's structure content rather than
>pointer in the search loop, and restore the structure content rather
>than the pointer when the loop exits.
> 
> Signed-off-by: Stephen Warren 
> ---
> v3: New patch.

You might as well squash these into my original commits.

Rob

> ---
>  disk/part.c |   38 +-
>  1 files changed, 29 insertions(+), 9 deletions(-)
> 
> diff --git a/disk/part.c b/disk/part.c
> index 6caf6d2..277a243 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -447,7 +447,7 @@ int get_device_and_partition(const char *ifname, const 
> char *dev_str,
>   int p;
>   int part = 0;
>   char *part_str;
> - disk_partition_t *best_part = NULL;
> + disk_partition_t tmpinfo;
>  
>   if (dev_str)
>   dev = simple_strtoul(dev_str, &ep, 16);
> @@ -483,24 +483,44 @@ int get_device_and_partition(const char *ifname, const 
> char *dev_str,
>   part = (int)simple_strtoul(++part_str, NULL, 16);
>   ret = get_partition_info(desc, part, info);
>   } else {
> - /* find the first bootable partition. If none are bootable,
> -  * fall back to the first valid partition */
> + /*
> +  * Find the first bootable partition.
> +  * If none are bootable, fall back to the first valid partition.
> +  */
>   for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
> - ret = get_partition_info(desc, p, info);
> + ret = get_partition_info(*dev_desc, p, info);
>   if (ret)
>   continue;
>  
> - if (!best_part || info->bootable) {
> - best_part = info;
> + /*
> +  * First valid partition, or new better partition?
> +  * If so, save partition ID.
> +  */
> + if (!part || info->bootable)
>   part = p;
> - }
>  
> + /* Best possible partition? Stop searching. */
>   if (info->bootable)
>   break;
> +
> + /*
> +  * We now need to search further for best possible.
> +  * If we what we just queried was the best so far,
> +  * save the info since we over-write it next loop.
> +  */
> + if (part == p)
> + tmpinfo = *info;
>   }
> - info = best_part;
> - if (part)
> + /* If we found any acceptable partition */
> + if (part) {
> + /*
> +  * If we searched all possible partition IDs,
> +  * return the first valid partition we found.
> +  */
> + if (p == MAX_SEARCH_PARTITIONS + 1)
> + *info = tmpinfo;
>   ret = 0;
> + }
>   }
>   if (ret) {
>   printf("** Invalid partition %d, use `dev[:part]' **\n", part);
> 

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


Re: [U-Boot] [RFC] mx6qsabresd: Add Ethernet support

2012-09-18 Thread Kim Phillips
On Tue, 18 Sep 2012 14:08:50 -0300
Fabio Estevam  wrote:

> Add Ethernet support.
> 
> Signed-off-by: Fabio Estevam 
> ---
> As far as I can see mx6qarm2 and mx6qsabresd has the same circuitry related to
> AR8031 Ethernet PHY.
> 
> However, with this patch I still get 25MHz instead of 125MHz in the AR8031 
> CLKO
> pin and Ethernet is not functional.
> 
> Any ideas are appreciated.

I managed to get it working a while back, at least on 1Gb links.
The following hack is based on the original version of your sabresd
support patch and the fsl bsp's.  AFAICT, the largest difference is
how it taps into PHYLIB for some phy config stuff:

>From aaf4a8ff113d662a4c750d686be07c4bb54ec7d0 Mon Sep 17 00:00:00 2001
From: Kim Phillips 
Date: Thu, 26 Jul 2012 14:09:03 -0500
Subject: [HACK] sabresd: add ethernet support

---
 board/freescale/mx6qsabresd/mx6qsabresd.c | 119 ++
 include/configs/mx6qsabresd.h |  23 ++
 2 files changed, 142 insertions(+)

diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c 
b/board/freescale/mx6qsabresd/mx6qsabresd.c
index 4382373..e90508f 100644
--- a/board/freescale/mx6qsabresd/mx6qsabresd.c
+++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
@@ -26,6 +26,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -37,6 +40,10 @@ DECLARE_GLOBAL_DATA_PTR;
PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |   \
PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
 
+#define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |\
+   PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   | \
+   PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
+
 int dram_init(void)
 {
gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -59,6 +66,60 @@ iomux_v3_cfg_t usdhc3_pads[] = {
MX6Q_PAD_NANDF_D0__GPIO_2_0| MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
 };
 
+iomux_v3_cfg_t enet_pads1[] = {
+   MX6Q_PAD_ENET_MDIO__ENET_MDIO   | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   /* pin 35 - 1 (PHY_AD2) on reset */
+   MX6Q_PAD_RGMII_RXC__GPIO_6_30   | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 32 - 1 - (MODE0) all */
+   MX6Q_PAD_RGMII_RD0__GPIO_6_25   | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 31 - 1 - (MODE1) all */
+   MX6Q_PAD_RGMII_RD1__GPIO_6_27   | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 28 - 1 - (MODE2) all */
+   MX6Q_PAD_RGMII_RD2__GPIO_6_28   | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 27 - 1 - (MODE3) all */
+   MX6Q_PAD_RGMII_RD3__GPIO_6_29   | MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 33 - 1 - (CLK125_EN) 125Mhz clockout enabled */
+   MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24| MUX_PAD_CTRL(NO_PAD_CTRL),
+   /* pin 42 PHY nRST */
+   MX6Q_PAD_EIM_D23__GPIO_3_23 | MUX_PAD_CTRL(NO_PAD_CTRL),
+};
+
+iomux_v3_cfg_t enet_pads2[] = {
+   MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3  | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+};
+
+
+static void setup_iomux_enet(void)
+{
+   gpio_direction_output(87, 0);  /* GPIO 3-23 */
+   gpio_direction_output(190, 1); /* GPIO 6-30 */
+   gpio_direction_output(185, 1); /* GPIO 6-25 */
+   gpio_direction_output(187, 1); /* GPIO 6-27 */
+   gpio_direction_output(188, 1); /* GPIO 6-28*/
+   gpio_direction_output(189, 1); /* GPIO 6-29 */
+   imx_iomux_v3_setup_multiple_pads(enet_pads1, ARRAY_SIZE(enet_pads1));
+   gpio_direction_output(184, 1); /* GPIO 6-24 */
+
+   /* Need delay 10ms according to KSZ9021 spec */
+   udelay(1000 * 10);
+   gpio_set_value(87, 1);  /* GPIO 3-23 */
+
+   imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
+}
+
 static void setup_iomux_uart(void)
 {
imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
@@ -83,6 +144,64 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+int mx6_rgmii_rework(struct phy_device *phydev)
+{
+   unsigned short val;
+
+  

[U-Boot] [PATCH 09/11] mx6qsabrelite: imximage.cfg: use symbols instead of hardcoded constants

2012-09-18 Thread Troy Kisky
This allows us to generate plugin data or
DCD rom style data simply by defining USE_PLUGIN

Signed-off-by: Troy Kisky 
---
 arch/arm/include/asm/arch-mx6/imx-mkimage.h  |  163 +
 board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |  248 +-
 2 files changed, 290 insertions(+), 121 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-mx6/imx-mkimage.h

diff --git a/arch/arm/include/asm/arch-mx6/imx-mkimage.h 
b/arch/arm/include/asm/arch-mx6/imx-mkimage.h
new file mode 100644
index 000..e61d5b6
--- /dev/null
+++ b/arch/arm/include/asm/arch-mx6/imx-mkimage.h
@@ -0,0 +1,163 @@
+/*
+ * Copyright (C) 2012 Boundary Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+#ifndef __ASM_ARCH_IMX_MKIMAGE_H__
+#define __ASM_ARCH_IMX_MKIMAGE_H__
+
+/* mx6 duallite and solo have same offsets */
+/*
+ * Bits 31:30 :
+ *  0 : 29:2 absolute address, 1:0 # of data values,
+ * followed by 0-3 data values in (mx6q, mx6dl, mx6_sololite)
+ * 0 means repeat last data value
+ *  1 : iomuxc relative address, 9:0 mx6q offset, 19:10 mx6dl offset,
+ * 29:20 mx6_sololite offset, 0 offset means skip if this processor
+ * previous data repeated
+ *  2 : same as 1, but single data value follows
+ *  3 : same as 1. but 3 data values follow
+ */
+#define MA(mx6q, mx6dl, mx6solo_lite)  ((mx6q / 4 & 0x3ff) | \
+   ((mx6dl / 4 & 0x3ff) * 0x400) | \
+   ((mx6solo_lite / 4 & 0x3ff) * 0x10))
+
+#define IOM_DRAM_DQM0  MA(0x5ac, 0x470, 0x0)
+#define IOM_DRAM_DQM1  MA(0x5b4, 0x474, 0x0)
+#define IOM_DRAM_DQM2  MA(0x528, 0x478, 0x0)
+#define IOM_DRAM_DQM3  MA(0x520, 0x47c, 0x0)
+#define IOM_DRAM_DQM4  MA(0x514, 0x480, 0x0)
+#define IOM_DRAM_DQM5  MA(0x510, 0x484, 0x0)
+#define IOM_DRAM_DQM6  MA(0x5bc, 0x488, 0x0)
+#define IOM_DRAM_DQM7  MA(0x5c4, 0x48c, 0x0)
+
+#define IOM_DRAM_CAS   MA(0x56c, 0x464, 0x0)
+#define IOM_DRAM_RAS   MA(0x578, 0x490, 0x0)
+#define IOM_DRAM_RESET MA(0x57c, 0x494, 0x0)
+#define IOM_DRAM_SDCLK_0   MA(0x588, 0x4ac, 0x0)
+#define IOM_DRAM_SDCLK_1   MA(0x594, 0x4b0, 0x0)
+#define IOM_DRAM_SDBA2 MA(0x58c, 0x4a0, 0x0)
+#define IOM_DRAM_SDCKE0MA(0x590, 0x4a4, 0x0)
+#define IOM_DRAM_SDCKE1MA(0x598, 0x4a8, 0x0)
+#define IOM_DRAM_SDODT0MA(0x59c, 0x4b4, 0x0)
+#define IOM_DRAM_SDODT1MA(0x5a0, 0x4b8, 0x0)
+
+#define IOM_DRAM_SDQS0 MA(0x5a8, 0x4bc, 0x0)
+#define IOM_DRAM_SDQS1 MA(0x5b0, 0x4c0, 0x0)
+#define IOM_DRAM_SDQS2 MA(0x524, 0x4c4, 0x0)
+#define IOM_DRAM_SDQS3 MA(0x51c, 0x4c8, 0x0)
+#define IOM_DRAM_SDQS4 MA(0x518, 0x4cc, 0x0)
+#define IOM_DRAM_SDQS5 MA(0x50c, 0x4d0, 0x0)
+#define IOM_DRAM_SDQS6 MA(0x5b8, 0x4d4, 0x0)
+#define IOM_DRAM_SDQS7 MA(0x5c0, 0x4d8, 0x0)
+
+#define IOM_GRP_B0DS   MA(0x784, 0x764, 0x0)
+#define IOM_GRP_B1DS   MA(0x788, 0x770, 0x0)
+#define IOM_GRP_B2DS   MA(0x794, 0x778, 0x0)
+#define IOM_GRP_B3DS   MA(0x79c, 0x77c, 0x0)
+#define IOM_GRP_B4DS   MA(0x7a0, 0x780, 0x0)
+#define IOM_GRP_B5DS   MA(0x7a4, 0x784, 0x0)
+#define IOM_GRP_B6DS   MA(0x7a8, 0x78c, 0x0)
+#define IOM_GRP_B7DS   MA(0x748, 0x748, 0x0)
+#define IOM_GRP_ADDDS  MA(0x74c, 0x74c, 0x0)
+#define IOM_DDRMODE_CTLMA(0x750, 0x750, 0x0)
+#define IOM_GRP_DDRPKE MA(0x758, 0x754, 0x0)
+#define IOM_GRP_DDRMODEMA(0x774, 0x760, 0x0)
+#define IOM_GRP_CTLDS  MA(0x78c, 0x76c, 0x0)
+#define IOM_GRP_DDR_TYPE   MA(0x798, 0x774, 0x0)
+
+#define MMDC_P00x021b
+#define MMDC_P10x021b4000
+#define IOMUXC_BASE_ADDR 0x020e
+#define CCM_BASE   0x020C4000
+#define IRAM_FREE_START0x00907000
+
+#define IOMUXC_GPR4(IOMUXC_BASE_ADDR + 0x010)
+#define IOMUXC_GPR6(IOMUXC_BASE_ADDR + 0x018)
+#define IOMUXC_GPR7(IOMUXC_BASE_ADDR + 0x01c)
+
+#define MMDC_MDCTL 0x000
+#define MMDC_MDPDC 0x004
+#define MMDC_MDOTC 0x008
+#define MMDC_MDCFG00x00c
+#define MMDC_MDCFG10x010
+#define MMDC_MDCFG20x014
+#define MMDC_MDMISC0x018
+#define MMDC_MDSCR 0x01c
+#define MMDC_MDREF 0x020
+#define MMDC_MDRWD 0x02c
+#define MMDC_MDOR  0x030
+#define MMDC_MDASP 0x040
+#define MMDC_MAPSR 0x404
+#define MMDC_MPZQHWCTRL0x800
+#define MMDC_MPWLDECTRL0   0x80c
+#define MMDC_MPWLDECTRL1   0x810
+#define MMDC_MPODTCTRL 0x818
+#define MMDC_MPRDDQBY0DL   0x81c
+#define MMDC_MPRDDQBY1DL   0x820
+#define MMDC_MPRDDQBY2DL   0x824
+#define MMDC_MPRDDQBY3DL   0x828
+#define MMDC_MPDGCTRL0 0x83c
+#define MMDC_MPDGCTRL1 0x840
+#define MMDC_MPRDDLCTL 0x848
+#d

[U-Boot] [PATCH 04/11] imximage: cleanup parsing

2012-09-18 Thread Troy Kisky
Move to pulling tokens instead of pushing them.
Remove need for switch statements to process commands.
Add error messages such as "command not finished",
"extra data at end of line", and "invalid token"
Add ';' as command separator.

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |  380 ++
 tools/imximage.h |   25 ++--
 2 files changed, 226 insertions(+), 179 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 21c49e6..1e120354 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -75,21 +75,6 @@ static uint32_t g_flash_offset;
 
 static struct image_type_params imximage_params;
 
-static uint32_t get_cfg_value(char *token, char *name,  int linenr)
-{
-   char *endptr;
-   uint32_t value;
-
-   errno = 0;
-   value = strtoul(token, &endptr, 16);
-   if (errno || (token == endptr)) {
-   fprintf(stderr, "Error: %s[%d] - Invalid hex data(%s)\n",
-   name,  linenr, token);
-   exit(EXIT_FAILURE);
-   }
-   return value;
-}
-
 static uint32_t detect_imximage_version(struct imx_header *imx_hdr)
 {
imx_header_v1_t *hdr_v1 = &imx_hdr->header.hdr_v1;
@@ -120,55 +105,38 @@ static void err_imximage_version(int version)
 
 static uint32_t *p_entry;
 
-static void set_dcd_val_v1(struct imx_header *imxhdr, char *name, int lineno,
-   int fld, uint32_t value)
+static int set_dcd_val_v1(struct imx_header *imxhdr, uint32_t *data)
 {
dcd_v1_t *dcd_v1 = &imxhdr->header.hdr_v1.dcd_table;
+   uint32_t val = *data++;
 
-   switch (fld) {
-   case CFG_REG_SIZE:
-   /* Byte, halfword, word */
-   if ((value != 1) && (value != 2) && (value != 4)) {
-   fprintf(stderr, "Error: %s[%d] - "
-   "Invalid register size " "(%d)\n",
-   name, lineno, value);
-   exit(EXIT_FAILURE);
-   }
-   *p_entry++ = value;
-   break;
-   case CFG_REG_ADDRESS:
-   *p_entry++ = value;
-   break;
-   case CFG_REG_VALUE:
-   *p_entry++ = value;
-   dcd_v1->preamble.length = (char *)p_entry
-   - (char *)&dcd_v1->addr_data[0].type;
-   break;
-   default:
-   break;
-
+   /* Byte, halfword, word */
+   if ((val != 1) && (val != 2) && (val != 4)) {
+   fprintf(stderr, "Error: Invalid register size (%d)\n", val);
+   return -1;
}
+   *p_entry++ = val;
+   *p_entry++ = *data++;
+   *p_entry++ = *data++;
+   dcd_v1->preamble.length = (char *)p_entry - (char *)&dcd_v1->
+   addr_data[0].type;
+   return 0;
 }
 
 static write_dcd_command_t *p_dcd;
 
-static void set_dcd_val_v2(struct imx_header *imxhdr, char *name, int lineno,
-   int fld, uint32_t value)
+static int set_dcd_val_v2(struct imx_header *imxhdr, uint32_t *data)
 {
uint32_t len;
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
+   uint32_t val = *data++;
 
-   switch (fld) {
-   case CFG_REG_SIZE:
-   /* Byte, halfword, word */
-   if ((value != 1) && (value != 2) && (value != 4)) {
-   fprintf(stderr, "Error: %s[%d] - "
-   "Invalid register size " "(%d)\n",
-   name, lineno, value);
-   exit(EXIT_FAILURE);
-   }
-   if (p_dcd && (p_dcd->param == value))
-   break;
+   /* Byte, halfword, word */
+   if ((val != 1) && (val != 2) && (val != 4)) {
+   fprintf(stderr, "Error: Invalid register size (%d)\n", val);
+   return -1;
+   }
+   if (!(p_dcd && (p_dcd->param == val))) {
if (!p_dcd) {
dcd_v2->header.tag = DCD_HEADER_TAG;
dcd_v2->header.version = DCD_VERSION;
@@ -176,24 +144,19 @@ static void set_dcd_val_v2(struct imx_header *imxhdr, 
char *name, int lineno,
} else {
p_dcd = (write_dcd_command_t *)p_entry;
}
-   p_dcd->param = value;
+   p_dcd->param = val;
p_dcd->tag = DCD_COMMAND_TAG;
p_entry = (uint32_t *)(p_dcd + 1);
-   break;
-   case CFG_REG_ADDRESS:
-   *p_entry++ = cpu_to_be32(value);
-   break;
-   case CFG_REG_VALUE:
-   *p_entry++ = cpu_to_be32(value);
-   len = (char *)p_entry - (char *)&dcd_v2->header;
-   dcd_v2->header.length = cpu_to_be16(len);
-   len = (char *)p_entry - (char *)p_dcd;
-   p_dcd->length = cpu_to_be16(len);
-   break;
-   default:
-   break;
-

[U-Boot] [PATCH 05/11] imximage: add expression evaluation

2012-09-18 Thread Troy Kisky
Basic expressions with order precedence is
now supported.
ie. (3 + ((1+2*3)/--2 + --5 *(8/4))) is 16.

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |  172 ++
 1 file changed, 162 insertions(+), 10 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 1e120354..2c5a622 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -380,20 +380,172 @@ char *grab_token(char *dest, int size, char *src)
return src;
 }
 
+char precedence[] = {
+   /* (  +  -  *  /  &  ^  |  ) */
+  0, 2, 2, 1, 1, 3, 4, 5, 6
+};
+char unary_operations[]  = "(+-";
+char binary_operations[] = " +-*/&^|)";
+
+uint32_t do_func(uint32_t val1, uint32_t val2, int op)
+{
+   switch (op) {
+   case 1:
+   return val1 + val2;
+   case 2:
+   return val1 - val2;
+   case 3:
+   return val1 * val2;
+   case 4:
+   return val1 / val2;
+   case 5:
+   return val1 & val2;
+   case 6:
+   return val1 ^ val2;
+   case 7:
+   return val1 | val2;
+   }
+   fprintf(stderr, "Error: in func %s: val1=%d val2=%d op = %d\n",
+   __func__, val1, val2, op);
+   exit(EXIT_FAILURE);
+}
+
+int find_op(char c, char *p)
+{
+   int i;
+   for (i = 0; ; i++) {
+   if (c == p[i])
+   return i;
+   if (!p[i])
+   break;
+   }
+   return -1;
+}
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
 static uint32_t get_cfg_value(struct data_src *ds, uint32_t *pval)
 {
char *endptr;
-   uint32_t value;
+   int op_i = 0;
+   int val_i = 0;
+   unsigned char op[16];
+   uint32_t val[16];
+   int unary = 1;
+   char *p;
 
-   if (skip_separators(ds))
-   return -1;
-   errno = 0;
-   value = strtoul(ds->p, &endptr, 16);
-   if (errno || (ds->p == endptr))
-   return -1;
-   *pval = value;
-   ds->p = endptr;
-   return 0;
+   p = ds->p;
+   for (;;) {
+   char c;
+   int i, j;
+   char *ops = unary ? unary_operations : binary_operations;
+
+   if (unary) {
+   ds->p = p;
+   if (skip_separators(ds))
+   return -1;
+   p = ds->p;
+   c = *p;
+   } else {
+   for (;;) {
+   c = *p;
+   if ((c != ' ') && (c != '\t'))
+   break;
+   p++;
+   }
+   }
+   i = find_op(c, ops);
+   debug("%d,%c,%d:%s\n", i, c, unary, p);
+   if ((i < 0) && unary) {
+   if (val_i >= ARRAY_SIZE(val))
+   return -1;
+   errno = 0;
+   val[val_i++] = strtoul(p, &endptr, 16);
+   if (errno || (p == endptr)) {
+   ds->p = p;
+   return -1;
+   }
+   p = endptr;
+   unary = 0;
+   debug("val[%d]=%x,%d,%d\n", val_i - 1, val[val_i - 1],
+   op_i, val_i);
+do_unary:
+   while (op_i) {
+   j = op[op_i - 1];
+   if (!(j & 0x80))
+   break;
+   op_i--;
+   val[val_i - 1] = do_func(0,
+   val[val_i - 1], j & 0x7f);
+   debug("un:%d,%x,%d,%d\n", val[val_i - 1], j,
+   op_i, val_i);
+   }
+   continue;
+   }
+   if (i < 0) {
+   c = 0;
+   i = 8;
+   } else {
+   p++;
+   }
+   if (c == '(') {
+   if (op_i >= ARRAY_SIZE(op))
+   return -1;
+   op[op_i++] = i;
+   debug("op[%d]=%x,%d,%d\n", op_i - 1, op[op_i - 1],
+   op_i, val_i);
+   unary = 1;
+   continue;
+   }
+   for (;;) {
+   if (!op_i || unary)
+   break;
+   j = op[op_i - 1];
+   if (j == 0) {
+   if (c == ')') {
+   op_i--;
+   goto do_unary;
+   }
+

[U-Boot] [PATCH 03/11] imximage: enable word writes for version2 header

2012-09-18 Thread Troy Kisky
Before, only 1 write_dcd_command table was built.
Now, a new table is built when the size changes.

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |  153 ++
 tools/imximage.h |   15 ++
 2 files changed, 77 insertions(+), 91 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 0bfbec3..21c49e6 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -68,10 +68,9 @@ static table_entry_t imximage_versions[] = {
 static uint32_t imximage_version;
 
 static set_dcd_val_t set_dcd_val;
-static set_dcd_rst_t set_dcd_rst;
 static set_imx_hdr_t set_imx_hdr;
 static set_imx_size_t set_imx_size;
-static uint32_t max_dcd_entries;
+static uint32_t *p_max_dcd;
 static uint32_t g_flash_offset;
 
 static struct image_type_params imximage_params;
@@ -119,8 +118,10 @@ static void err_imximage_version(int version)
exit(EXIT_FAILURE);
 }
 
+static uint32_t *p_entry;
+
 static void set_dcd_val_v1(struct imx_header *imxhdr, char *name, int lineno,
-   int fld, uint32_t value, uint32_t off)
+   int fld, uint32_t value)
 {
dcd_v1_t *dcd_v1 = &imxhdr->header.hdr_v1.dcd_table;
 
@@ -133,13 +134,15 @@ static void set_dcd_val_v1(struct imx_header *imxhdr, 
char *name, int lineno,
name, lineno, value);
exit(EXIT_FAILURE);
}
-   dcd_v1->addr_data[off].type = value;
+   *p_entry++ = value;
break;
case CFG_REG_ADDRESS:
-   dcd_v1->addr_data[off].addr = value;
+   *p_entry++ = value;
break;
case CFG_REG_VALUE:
-   dcd_v1->addr_data[off].value = value;
+   *p_entry++ = value;
+   dcd_v1->preamble.length = (char *)p_entry
+   - (char *)&dcd_v1->addr_data[0].type;
break;
default:
break;
@@ -147,17 +150,45 @@ static void set_dcd_val_v1(struct imx_header *imxhdr, 
char *name, int lineno,
}
 }
 
+static write_dcd_command_t *p_dcd;
+
 static void set_dcd_val_v2(struct imx_header *imxhdr, char *name, int lineno,
-   int fld, uint32_t value, uint32_t off)
+   int fld, uint32_t value)
 {
+   uint32_t len;
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
 
switch (fld) {
+   case CFG_REG_SIZE:
+   /* Byte, halfword, word */
+   if ((value != 1) && (value != 2) && (value != 4)) {
+   fprintf(stderr, "Error: %s[%d] - "
+   "Invalid register size " "(%d)\n",
+   name, lineno, value);
+   exit(EXIT_FAILURE);
+   }
+   if (p_dcd && (p_dcd->param == value))
+   break;
+   if (!p_dcd) {
+   dcd_v2->header.tag = DCD_HEADER_TAG;
+   dcd_v2->header.version = DCD_VERSION;
+   p_dcd = &dcd_v2->write_dcd_command;
+   } else {
+   p_dcd = (write_dcd_command_t *)p_entry;
+   }
+   p_dcd->param = value;
+   p_dcd->tag = DCD_COMMAND_TAG;
+   p_entry = (uint32_t *)(p_dcd + 1);
+   break;
case CFG_REG_ADDRESS:
-   dcd_v2->addr_data[off].addr = cpu_to_be32(value);
+   *p_entry++ = cpu_to_be32(value);
break;
case CFG_REG_VALUE:
-   dcd_v2->addr_data[off].value = cpu_to_be32(value);
+   *p_entry++ = cpu_to_be32(value);
+   len = (char *)p_entry - (char *)&dcd_v2->header;
+   dcd_v2->header.length = cpu_to_be16(len);
+   len = (char *)p_entry - (char *)p_dcd;
+   p_dcd->length = cpu_to_be16(len);
break;
default:
break;
@@ -165,47 +196,13 @@ static void set_dcd_val_v2(struct imx_header *imxhdr, 
char *name, int lineno,
}
 }
 
-/*
- * Complete setting up the rest field of DCD of V1
- * such as barker code and DCD data length.
- */
-static void set_dcd_rst_v1(struct imx_header *imxhdr, uint32_t dcd_len,
-   char *name, int lineno)
-{
-   dcd_v1_t *dcd_v1 = &imxhdr->header.hdr_v1.dcd_table;
-
-   dcd_v1->preamble.barker = DCD_BARKER;
-   dcd_v1->preamble.length = dcd_len * sizeof(dcd_type_addr_data_t);
-}
-
-/*
- * Complete setting up the reset field of DCD of V2
- * such as DCD tag, version, length, etc.
- */
-static void set_dcd_rst_v2(struct imx_header *imxhdr, uint32_t dcd_len,
-   char *name, int lineno)
-{
-   dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
-
-   dcd_v2->header.tag = DCD_HEADER_TAG;
-   dcd_v2->header.length = cpu_

[U-Boot] [PATCH 01/11] imximage: make header variable length

2012-09-18 Thread Troy Kisky
Also, the header offset is no longer
right before the code starts.

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |  142 +++---
 tools/imximage.h |   10 ++--
 2 files changed, 87 insertions(+), 65 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 03a7716..25d3b74 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -65,12 +65,15 @@ static table_entry_t imximage_versions[] = {
{-1,"", " (Invalid)", },
 };
 
-static struct imx_header imximage_header;
 static uint32_t imximage_version;
 
 static set_dcd_val_t set_dcd_val;
 static set_dcd_rst_t set_dcd_rst;
 static set_imx_hdr_t set_imx_hdr;
+static set_imx_size_t set_imx_size;
+static uint32_t g_flash_offset;
+
+static struct image_type_params imximage_params;
 
 static uint32_t get_cfg_value(char *token, char *name,  int linenr)
 {
@@ -207,85 +210,79 @@ static void set_dcd_rst_v2(struct imx_header *imxhdr, 
uint32_t dcd_len,
dcd_v2->write_dcd_command.param = DCD_COMMAND_PARAM;
 }
 
-static void set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
-   struct stat *sbuf,
-   struct mkimage_params *params)
+static int set_imx_hdr_v1(struct imx_header *imxhdr, uint32_t dcd_len,
+   uint32_t entry_point, uint32_t flash_offset)
 {
imx_header_v1_t *hdr_v1 = &imxhdr->header.hdr_v1;
flash_header_v1_t *fhdr_v1 = &hdr_v1->fhdr;
dcd_v1_t *dcd_v1 = &hdr_v1->dcd_table;
-   uint32_t base_offset;
-
-   /* Exit if there is no BOOT_FROM field specifying the flash_offset */
-   if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
-   fprintf(stderr, "Error: Header v1: No BOOT_FROM tag in %s\n",
-   params->imagename);
-   exit(EXIT_FAILURE);
-   }
+   uint32_t hdr_base;
+   uint32_t header_length = (((char *)&dcd_v1->addr_data[dcd_len].addr)
+   - ((char *)imxhdr));
 
/* Set magic number */
fhdr_v1->app_code_barker = APP_CODE_BARKER;
 
-   fhdr_v1->app_dest_ptr = params->addr;
-   fhdr_v1->app_dest_ptr = params->ep - imxhdr->flash_offset -
-   sizeof(struct imx_header);
-   fhdr_v1->app_code_jump_vector = params->ep;
+   hdr_base = entry_point - header_length;
+   fhdr_v1->app_dest_ptr = hdr_base - flash_offset;
+   fhdr_v1->app_code_jump_vector = entry_point;
 
-   base_offset = fhdr_v1->app_dest_ptr + imxhdr->flash_offset ;
-   fhdr_v1->dcd_ptr_ptr =
-   (uint32_t) (offsetof(flash_header_v1_t, dcd_ptr) -
-   offsetof(flash_header_v1_t, app_code_jump_vector) +
-   base_offset);
-
-   fhdr_v1->dcd_ptr = base_offset +
-   offsetof(imx_header_v1_t, dcd_table);
-
-   /* The external flash header must be at the end of the DCD table */
-   dcd_v1->addr_data[dcd_len].type = sbuf->st_size +
-   imxhdr->flash_offset +
-   sizeof(struct imx_header);
+   fhdr_v1->dcd_ptr_ptr = hdr_base + offsetof(flash_header_v1_t, dcd_ptr);
+   fhdr_v1->dcd_ptr = hdr_base + offsetof(imx_header_v1_t, dcd_table);
 
/* Security feature are not supported */
fhdr_v1->app_code_csf = 0;
fhdr_v1->super_root_key = 0;
+   return header_length;
+}
+
+static void set_imx_size_v1(struct imx_header *imxhdr, uint32_t file_size,
+   uint32_t flash_offset)
+{
+   uint32_t *p = (uint32_t *)(((char *)imxhdr)
+   + imximage_params.header_size);
+
+   /* The external flash header must be at the end of the DCD table */
+   /* file_size includes header */
+   p[-1] = file_size + flash_offset;
 }
 
-static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
-   struct stat *sbuf,
-   struct mkimage_params *params)
+static int set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len,
+   uint32_t entry_point, uint32_t flash_offset)
 {
imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
flash_header_v2_t *fhdr_v2 = &hdr_v2->fhdr;
-
-   /* Exit if there is no BOOT_FROM field specifying the flash_offset */
-   if(imxhdr->flash_offset == FLASH_OFFSET_UNDEFINED) {
-   fprintf(stderr, "Error: Header v2: No BOOT_FROM tag in %s\n",
-   params->imagename);
-   exit(EXIT_FAILURE);
-   }
+   uint32_t hdr_base;
+   uint32_t header_length = (dcd_len) ?
+   (char *)&hdr_v2->dcd_table.addr_data[dcd_len] - ((char*)imxhdr)
+   : offsetof(imx_header_v2_t, dcd_table);
 
/* Set magic number */
fhdr_v2->header.tag = IVT_HEADER_TAG; /* 0xD1 */
fhdr_v2->header.length = cpu_to_be16(sizeof(flash_header_v2_t));
fhdr_v2->header.version = IVT_VE

[U-Boot] [PATCH 06/11] imximage: add plugin commands

2012-09-18 Thread Troy Kisky
Add commands
plugin address filename
iomux_entry addr, data1 [, data2, [, data3]]
write_entry addr, data1 [, data2, [, data3]]

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |  338 --
 tools/imximage.h |   11 +-
 2 files changed, 287 insertions(+), 62 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 2c5a622..63252be 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -31,7 +31,6 @@
 #include "mkimage.h"
 #include 
 #include "imximage.h"
-
 /*
  * Supported commands for configuration file
  */
@@ -39,6 +38,9 @@ static table_entry_t imximage_cmds[] = {
{CMD_BOOT_FROM, "BOOT_FROM","boot command",   },
{CMD_DATA,  "DATA", "Reg Write Data", },
{CMD_IMAGE_VERSION, "IMAGE_VERSION","image version",  },
+   {CMD_PLUGIN,"plugin",   "plugin addr,file",  },
+   {CMD_IOMUX_ENTRY,   "iomux_entry",  "Write iomux reg",  },
+   {CMD_WRITE_ENTRY,   "write_entry",  "Write register",  },
{-1,"", "",   },
 };
 
@@ -69,8 +71,8 @@ static uint32_t imximage_version;
 
 static set_dcd_val_t set_dcd_val;
 static set_imx_hdr_t set_imx_hdr;
-static set_imx_size_t set_imx_size;
 static uint32_t *p_max_dcd;
+static uint32_t *header_size_ptr;
 static uint32_t g_flash_offset;
 
 static struct image_type_params imximage_params;
@@ -88,8 +90,7 @@ static uint32_t detect_imximage_version(struct imx_header 
*imx_hdr)
return IMXIMAGE_V1;
 
/* Try to detect V2 */
-   if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
-   (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+   if ((fhdr_v2->header.tag == IVT_HEADER_TAG))
return IMXIMAGE_V2;
 
return IMXIMAGE_VER_INVALID;
@@ -160,7 +161,7 @@ static int set_dcd_val_v2(struct imx_header *imxhdr, 
uint32_t *data)
 }
 
 static int set_imx_hdr_v1(struct imx_header *imxhdr,
-   uint32_t entry_point, uint32_t flash_offset)
+   uint32_t entry_point, uint32_t flash_offset, int plugin)
 {
imx_header_v1_t *hdr_v1 = &imxhdr->header.hdr_v1;
flash_header_v1_t *fhdr_v1 = &hdr_v1->fhdr;
@@ -180,22 +181,12 @@ static int set_imx_hdr_v1(struct imx_header *imxhdr,
/* Security feature are not supported */
fhdr_v1->app_code_csf = 0;
fhdr_v1->super_root_key = 0;
+   header_size_ptr = (uint32_t *)(((char *)imxhdr) + header_length - 4);
return header_length;
 }
 
-static void set_imx_size_v1(struct imx_header *imxhdr, uint32_t file_size,
-   uint32_t flash_offset)
-{
-   uint32_t *p = (uint32_t *)(((char *)imxhdr)
-   + imximage_params.header_size);
-
-   /* The external flash header must be at the end of the DCD table */
-   /* file_size includes header */
-   p[-1] = file_size + flash_offset;
-}
-
 static int set_imx_hdr_v2(struct imx_header *imxhdr,
-   uint32_t entry_point, uint32_t flash_offset)
+   uint32_t entry_point, uint32_t flash_offset, int plugin)
 {
imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
flash_header_v2_t *fhdr_v2 = &hdr_v2->fhdr;
@@ -216,27 +207,20 @@ static int set_imx_hdr_v2(struct imx_header *imxhdr,
fhdr_v2->boot_data_ptr = hdr_base
+ offsetof(imx_header_v2_t, boot_data);
hdr_v2->boot_data.start = hdr_base - flash_offset;
+   hdr_v2->boot_data.plugin = plugin;
 
/* Security feature are not supported */
fhdr_v2->csf = 0;
+   header_size_ptr = &hdr_v2->boot_data.size;
return header_length;
 }
 
-static void set_imx_size_v2(struct imx_header *imxhdr, uint32_t file_size,
-   uint32_t flash_offset)
-{
-   imx_header_v2_t *hdr_v2 = &imxhdr->header.hdr_v2;
-   /* file_size includes header */
-   hdr_v2->boot_data.size = file_size + flash_offset;
-}
-
 static void set_hdr_func(struct imx_header *imxhdr)
 {
switch (imximage_version) {
case IMXIMAGE_V1:
set_dcd_val = set_dcd_val_v1;
set_imx_hdr = set_imx_hdr_v1;
-   set_imx_size = set_imx_size_v1;
p_entry = &imxhdr->header.hdr_v1.dcd_table.addr_data[0].type;
p_max_dcd = &imxhdr->header.hdr_v1.dcd_table
.addr_data[MAX_HW_CFG_SIZE_V1].type;
@@ -245,7 +229,6 @@ static void set_hdr_func(struct imx_header *imxhdr)
case IMXIMAGE_V2:
set_dcd_val = set_dcd_val_v2;
set_imx_hdr = set_imx_hdr_v2;
-   set_imx_size = set_imx_size_v2;
p_entry = (uint32_t *)&imxhdr->header.hdr_v2.dcd_table;
p_max_dcd = (uint32_t *)((char *)imxhdr + MAX_HEADER_SIZE);
break;
@@ -283,31 +266,49 @@ static void print_hdr_v1(struct imx_header *imx_hdr)
printf("Entry Po

[U-Boot] (no subject)

2012-09-18 Thread Troy Kisky


This is the 1st part of a series meant to add mx6solo/mx6duallite
support for a saberlite. I stopped at the last patch because
with it applied, Linux will no longer boot. However, the same
plugin code used under imx-android-r13.3 will work fine.


So, the last patch in the series is not ready to be applied.
I also, tried initializing in the normal manner and running
the plugin with nothing to do. That also fails to boot Linux.

Any advice
Thanks
Troy


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


[U-Boot] [PATCH 11/11] RFC mx6qsabrelite: imximage.cfg: enable plugin mode

2012-09-18 Thread Troy Kisky
Don't apply this patch yet, because although u-boot
will boot, Linux won't

The other CPU's won't come online, and L2 cache
initialization crashes

Calibrating delay loop... 1581.05 BogoMIPS (lpj=7905280)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys cpuacct
CPU: Testing write buffer coherency: ok
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 7 counters available
CPU1: failed to come online
CPU2: failed to come online
CPU3: failed to come online
Brought up 1 CPUs
SMP: Total of 1 processors activated (1581.05 BogoMIPS).
print_constraints: dummy:
NET: Registered protocol family 16
print_constraints: vddpu: 725 <--> 1300 mV at 1100 mV fast normal
print_constraints: vddcore: 725 <--> 1300 mV at 1100 mV fast normal
print_constraints: vddsoc: 725 <--> 1300 mV at 1200 mV fast normal
print_constraints: vdd2p5: 2000 <--> 2775 mV at 2400 mV fast normal
print_constraints: vdd1p1: 800 <--> 1400 mV at 1100 mV fast normal
print_constraints: vdd3p0: 2800 <--> 3150 mV at 3000 mV fast normal
 Board type Nitrogen6X/W
hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
hw-breakpoint: 1 breakpoint(s) reserved for watchpoint single-step.
hw-breakpoint: maximum watchpoint size is 4 bytes.
Unhandled fault: imprecise external abort (0x1c06) at 0x1d4c07b4
Internal error: : 1c06 [#1] PREEMPT SMP
Modules linked in:
CPU: 0Not tainted  (3.0.35-1968-gd3f7f36-03060-ga3844c7 #1)
PC is at mxc_init_l2x0+0x50/0x120

Anyone have a clue?

The same thing under freescale's imx-android-r13.3
works fine. Only mainline doesn't work

Signed-off-by: Troy Kisky 
---
 board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg 
b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
index eea8d3a..2af4265 100644
--- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
+++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
@@ -26,7 +26,7 @@
  * The syntax is taken as close as possible with the kwbimage
  */
 #define FOR_MX6Q
-
+#define USE_PLUGIN
 #include 
 
 /* image version */
-- 
1.7.9.5

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


[U-Boot] [PATCH 08/11] mx6: add plugin file for use with imximage.cfg

2012-09-18 Thread Troy Kisky
The "plugin" command of mkimage can take this
file as an argument.

Signed-off-by: Troy Kisky 
---
 arch/arm/cpu/armv7/mx6/Makefile |5 +-
 arch/arm/cpu/armv7/mx6/plugin.S |  141 +++
 2 files changed, 145 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/cpu/armv7/mx6/plugin.S

diff --git a/arch/arm/cpu/armv7/mx6/Makefile b/arch/arm/cpu/armv7/mx6/Makefile
index cbce411..b1fce4e 100644
--- a/arch/arm/cpu/armv7/mx6/Makefile
+++ b/arch/arm/cpu/armv7/mx6/Makefile
@@ -33,11 +33,14 @@ SOBJS   = lowlevel_init.o
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(SOBJS) $(COBJS))
 
-all:   $(obj).depend $(LIB)
+all:   $(obj).depend $(LIB) plugin.bin
 
 $(LIB):$(OBJS)
$(call cmd_link_o_target, $(OBJS))
 
+plugin.bin: plugin.o
+   $(OBJCOPY) -O binary --gap-fill 0xff $< $@
+
 #
 
 # defines $(obj).depend target
diff --git a/arch/arm/cpu/armv7/mx6/plugin.S b/arch/arm/cpu/armv7/mx6/plugin.S
new file mode 100644
index 000..e2a45d7
--- /dev/null
+++ b/arch/arm/cpu/armv7/mx6/plugin.S
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2012 Boundary Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+#include 
+#include 
+
+#define HAB_RVT_ENTRY  0x98
+#define HAB_RVT_FAIL_SAFE_VECT 0xbc
+#define HAB_RVT_LOAD_DATA  0xc8
+
+#define HDR_SELF_PTR   0x14
+#define HDR_BOOT_DATA  0x20
+#define HDR_IMAGE_LEN  0x24
+
+/*
+ * plugin_start(void **start, size_t *bytes, UINT32 *ivt_offset)
+ */
+plugin_start:
+/* Save the return address and the function arguments */
+   push{r0-r8, lr}
+
+/* r0-r2 must not be 0 and must be 4 byte aligned */
+   tst r0, r0
+   tstne   r1, r1
+   tstne   r2, r2
+   mov r3, r0
+   orreq   r3, r3, #1
+   orr r3, r3, r1
+   orr r3, r3, r2
+#if 0
+   ldr r0, plugin
+   tst r0, r0
+   orreq   r3, r3, #1
+#endif
+
+#define rCPU   r2  /* 22 - mx6q, 12 - mx6dl, 2 sololite */
+#define rFlag  r3
+#definerIomux  r4
+#define rVal0  r5
+#define rVal1  r6
+#define rVal2  r7
+#define rTable r8
+   mov rCPU, #2
+
+   ldr r1, =ANATOP_BASE_ADDR
+   ldr r0, [r1, #0x280]
+   mov r0, r0, LSR #16
+   cmp r0, #0x60
+   movne   rCPU, #12
+   ldrne   r0, [r1, #0x260]
+   movne   r0, r0, LSR #16
+   cmpne   r0, #0x61
+   movne   rCPU, #22
+
+   mov rVal0, #0
+   mov rVal1, #0
+   mov rVal2, #0
+   ldr rIomux, =IOMUXC_BASE_ADDR
+   adr rTable, mx6_table
+   b   3f
+
+1: movsr0, r1, LSR #30
+   beq 2f
+   mov r1, r1, LSL rCPU
+   movsr1, r1, LSR #32-10
+   addne   r1, rIomux, r1, LSL #2
+   cmp r0, #3
+   subne   r0, r0, #1
+   orr r1, r1, r0
+
+2: andsr0, r1, #3
+   bic r1, r1, #3
+   ldrne   rVal0, [rTable], #4
+   movne   rVal1, rVal0
+   movne   rVal2, rVal0
+   subnes  r0, r0, #1
+   ldrne   rVal1, [rTable], #4
+   movne   rVal2, rVal1
+   subnes  r0, r0, #1
+   ldrne   rVal2, [rTable], #4
+
+   mov r0, rVal0
+   cmp rCPU, #12
+   moveq   r0, rVal1
+   cmp rCPU, #2
+   moveq   r0, rVal2
+   cmp r1, #0
+   strne   r0, [r1]
+3: ldr r1, [rTable], #4
+   cmp r1, #0
+   bne 1b
+
+   andsrFlag, rFlag, #3
+   bne 4f  /* Branch if not called as plugin */
+/* Align end of table to 64 byte boundary */
+   sub rTable, rTable, #1
+   orr rTable, rTable, #0x3f
+   add rTable, rTable, #1
+   ldr r2, [rTable, #HDR_SELF_PTR]
+   ldr r0, [rTable, #HDR_BOOT_DATA]
+   ldr r1, [rTable, #HDR_IMAGE_LEN]
+   sub rTable, r2, r0
+   mov r2, r0
+   mov r3, r1
+   mov r4, #0
+   push{r0-r4}
+   mov r0, #HAB_RVT_LOAD_DATA
+   ldr r4, [r0]
+   mov r0, sp
+   add r1, sp, #4
+   add r2, sp, #8
+   blx r4
+
+   pop {r4, r5}
+   add sp, sp, #12
+   pop {r0-r3}
+/*
+ * Before returning to ROM, we need to fill the return values arguments
+ * to our function.
+ * plugin_start(void **start, size_t *bytes, UINT32 *ivt_offset)
+ */
+
+   str r4, [r0]
+   str r5, [r1]
+   str rTable, [r2]
+   mov r0, #1
+   pop {r4-r8, pc}
+
+/* Not called as plugin */
+4: popne   {r0-r8, lr}
+   mov r0, #HAB_RVT_ENTRY
+   ldr lr, [r0]
+   blx lr
+   mov r0, #HAB_RVT_FAIL_SAFE_VECT
+   ldr lr, [r0]
+   blx lr
+
+   .ltorg
+mx6_table:
-- 
1.7.9.5

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


[U-Boot] [PATCH 02/11] imximage: check dcd_len as entries added

2012-09-18 Thread Troy Kisky
Before the len was checked after the entire file
was processed, so it could have already overflowed.

Signed-off-by: Troy Kisky 
---
 tools/imximage.c |   26 +++---
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/tools/imximage.c b/tools/imximage.c
index 25d3b74..0bfbec3 100644
--- a/tools/imximage.c
+++ b/tools/imximage.c
@@ -71,6 +71,7 @@ static set_dcd_val_t set_dcd_val;
 static set_dcd_rst_t set_dcd_rst;
 static set_imx_hdr_t set_imx_hdr;
 static set_imx_size_t set_imx_size;
+static uint32_t max_dcd_entries;
 static uint32_t g_flash_offset;
 
 static struct image_type_params imximage_params;
@@ -173,13 +174,6 @@ static void set_dcd_rst_v1(struct imx_header *imxhdr, 
uint32_t dcd_len,
 {
dcd_v1_t *dcd_v1 = &imxhdr->header.hdr_v1.dcd_table;
 
-   if (dcd_len > MAX_HW_CFG_SIZE_V1) {
-   fprintf(stderr, "Error: %s[%d] -"
-   "DCD table exceeds maximum size(%d)\n",
-   name, lineno, MAX_HW_CFG_SIZE_V1);
-   exit(EXIT_FAILURE);
-   }
-
dcd_v1->preamble.barker = DCD_BARKER;
dcd_v1->preamble.length = dcd_len * sizeof(dcd_type_addr_data_t);
 }
@@ -193,13 +187,6 @@ static void set_dcd_rst_v2(struct imx_header *imxhdr, 
uint32_t dcd_len,
 {
dcd_v2_t *dcd_v2 = &imxhdr->header.hdr_v2.dcd_table;
 
-   if (dcd_len > MAX_HW_CFG_SIZE_V2) {
-   fprintf(stderr, "Error: %s[%d] -"
-   "DCD table exceeds maximum size(%d)\n",
-   name, lineno, MAX_HW_CFG_SIZE_V2);
-   exit(EXIT_FAILURE);
-   }
-
dcd_v2->header.tag = DCD_HEADER_TAG;
dcd_v2->header.length = cpu_to_be16(
dcd_len * sizeof(dcd_addr_data_t) + 8);
@@ -293,12 +280,14 @@ static void set_hdr_func(struct imx_header *imxhdr)
set_dcd_rst = set_dcd_rst_v1;
set_imx_hdr = set_imx_hdr_v1;
set_imx_size = set_imx_size_v1;
+   max_dcd_entries = MAX_HW_CFG_SIZE_V1;
break;
case IMXIMAGE_V2:
set_dcd_val = set_dcd_val_v2;
set_dcd_rst = set_dcd_rst_v2;
set_imx_hdr = set_imx_hdr_v2;
set_imx_size = set_imx_size_v2;
+   max_dcd_entries = MAX_HW_CFG_SIZE_V2;
break;
default:
err_imximage_version(imximage_version);
@@ -425,8 +414,15 @@ static void parse_cfg_fld(struct imx_header *imxhdr, 
int32_t *cmd,
value = get_cfg_value(token, name, lineno);
(*set_dcd_val)(imxhdr, name, lineno, fld, value, *dcd_len);
 
-   if (fld == CFG_REG_VALUE)
+   if (fld == CFG_REG_VALUE) {
(*dcd_len)++;
+   if (*dcd_len > max_dcd_entries) {
+   fprintf(stderr, "Error: %s[%d] -"
+   "DCD table exceeds maximum size(%d)\n",
+   name, lineno, max_dcd_entries);
+   exit(EXIT_FAILURE);
+   }
+   }
break;
default:
break;
-- 
1.7.9.5

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


[U-Boot] [PATCH 10/11] mx6qsabrelite: imximage.cfg: allow plugin to work

2012-09-18 Thread Troy Kisky
Enabling plugin mode seems to require this additional
memory write for ddr3 initialization.

Signed-off-by: Troy Kisky 
---
 board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg |2 ++
 1 file changed, 2 insertions(+)

diff --git a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg 
b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
index a95831f..eea8d3a 100644
--- a/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
+++ b/board/freescale/imx/ddr/mx6q_4x_mt41j128.cfg
@@ -111,6 +111,8 @@ WRITE_ENTRY1(MMDC_P1 + MMDC_MPRDDQBY0DL, 0x)
 WRITE_ENTRY1(MMDC_P1 + MMDC_MPRDDQBY1DL, 0x)
 WRITE_ENTRY1(MMDC_P1 + MMDC_MPRDDQBY2DL, 0x)
 WRITE_ENTRY1(MMDC_P1 + MMDC_MPRDDQBY3DL, 0x)
+/* MDPDC - CKE pulse width = 3 cycles. CKSRE = 6 cycles, CKSRX = 6 cycles */
+WRITE_ENTRY1(MMDC_P0 + MMDC_MDPDC, 0x00020036)
 
 WRITE_ENTRY1(MMDC_P0 + MMDC_MDMISC, 0x00081740)
 
-- 
1.7.9.5

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


Re: [U-Boot] Cleanup of CCGR registers (was [PATCH V2 2/2] i.MX6: mx6qsabrelite: Add splash screen support)

2012-09-18 Thread Eric Nelson

On 09/18/2012 06:50 AM, Stefano Babic wrote:

On 18/09/2012 15:28, Eric Nelson wrote:


Do you have a reference to the patch so I can follow precedent?


See http://patchwork.ozlabs.org/patch/177403/

Check changes in .h.



Should I remove the un-named macros?
MXC_CCM_CCGRx_CGy_OFFSET
MXC_CCM_CCGRx_CGy_MASK

It appears that only arch/arm/cpu/armv7/mx6/clock.c is
using them.

Please advise,


Eric
>From c4052c6d1d750a92e046d62899df012120c19398 Mon Sep 17 00:00:00 2001
From: Eric Nelson 
Date: Tue, 18 Sep 2012 16:50:50 -0700
Subject: [RFC PATCH] i.MX6: add meaningful constant names for CCGRx bitfields

---
 arch/arm/include/asm/arch-mx6/crm_regs.h |  212 +++---
 1 files changed, 196 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h b/arch/arm/include/asm/arch-mx6/crm_regs.h
index 8388e38..81aa3ed 100644
--- a/arch/arm/include/asm/arch-mx6/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
@@ -426,6 +426,37 @@ struct mxc_ccm_reg {
 #define MXC_CCM_CCGR0_CG0_OFFSET			0
 #define MXC_CCM_CCGR0_CG0_MASK3
 
+#define MXC_CCM_CCGR0_AIPS_TZ1_OFFSET			0
+#define MXC_CCM_CCGR0_AIPS_TZ1_MASK			(3<___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCHv4] [RFC] DM: early_malloc for DM added.

2012-09-18 Thread Marek Vasut
Dear Graeme Russ,

> Hi Marek,
> 
> On Wed, Sep 19, 2012 at 9:33 AM, Marek Vasut  wrote:
> > Dear Graeme Russ,
> 
> [snip]
> 
> >> >> +struct early_heap_header *early_brk(size_t size)
> >> >> + __attribute__((weak, alias("def_early_brk")));
> >> > 
> >> > what about using (it needs ):
> >> > 
> >> > __weak struct early_heap_header *early_brk(size_t size)
> >> > {
> >> > ...
> >> > body
> >> > ...
> >> > }
> >> 
> >> We already have a lot of the former - I prefer not to add additional
> >> semantics (unless you want to do a wholesale search/replace ;))
> > 
> > The former looks like shit and the later is more linux-friendly. I'd say
> > stick with the later to avoid this insane __attribute__(()) construct.
> 
> I agree, but, consistently bad is worse than inconsistently bad :)

To weed out the old crap, we need linux/compiler.h enabled across whole uboot 
... it's in the todo.

> I'm look forward to reviewing a cleanup patch ;)

Wait until I get it completely built. linux/compiler.h causes breakage on some 
ancient PPC crap.

> Regards,
> 
> Graeme

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 41/71] serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver

2012-09-18 Thread Andreas Bießmann

Dear Marek Vasut,

On 17.09.2012 01:21, Marek Vasut wrote:

Implement support for CONFIG_SERIAL_MULTI into atmel serial driver.
This driver was so far only usable directly, but this patch also adds
support for the multi method. This allows using more than one serial
driver alongside the atmel driver. Also, add a weak implementation
of default_serial_console() returning this driver.

Signed-off-by: Marek Vasut 
Cc: Marek Vasut 
Cc: Tom Rini 
Cc: Xu, Hong 
---


whole series runtime tested on avr32 and at91sam9260ek, therefore

Acked-by: Andreas Bießmann 

Best regards

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


Re: [U-Boot] [PATCHv4] [RFC] DM: early_malloc for DM added.

2012-09-18 Thread Graeme Russ
Hi Marek,

On Wed, Sep 19, 2012 at 9:33 AM, Marek Vasut  wrote:
> Dear Graeme Russ,
>

[snip]

>> >> +struct early_heap_header *early_brk(size_t size)
>> >> + __attribute__((weak, alias("def_early_brk")));
>> >
>> > what about using (it needs ):
>> >
>> > __weak struct early_heap_header *early_brk(size_t size)
>> > {
>> > ...
>> > body
>> > ...
>> > }
>>
>> We already have a lot of the former - I prefer not to add additional
>> semantics (unless you want to do a wholesale search/replace ;))
>
> The former looks like shit and the later is more linux-friendly. I'd say stick
> with the later to avoid this insane __attribute__(()) construct.

I agree, but, consistently bad is worse than inconsistently bad :)

I'm look forward to reviewing a cleanup patch ;)

Regards,

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


[U-Boot] [PATCH] README.commands: Document what UNDEF_SYM does

2012-09-18 Thread Tom Rini
Signed-off-by: Tom Rini 
---
 doc/README.commands |6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/README.commands b/doc/README.commands
index 27815d2..21abfb6 100644
--- a/doc/README.commands
+++ b/doc/README.commands
@@ -22,6 +22,12 @@ This makes it possible for the final link to extract all 
commands
 compiled into any object code and construct a static array so the
 command can be found in an array starting at __u_boot_cmd_start.
 
+To ensure that the linker does not discard these symbols when linking
+full U-Boot we use generate a list of all of the commands and force the
+linker to first enter the symbol as undefined in the object so that
+there is then a need for the symbol to be kept (UNDEF_SYM in the
+Makefile).
+
 If a new board is defined do not forget to define the command section
 by writing in u-boot.lds ($(TOPDIR)/board/boardname/u-boot.lds) these
 3 lines:
-- 
1.7.9.5

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


Re: [U-Boot] [PATCHv4] [RFC] DM: early_malloc for DM added.

2012-09-18 Thread Marek Vasut
Dear Graeme Russ,

> Hi Marek,
> 
> On Tue, Sep 18, 2012 at 8:57 PM, Marek Vasut  wrote:
> > Dear Tomas Hlavacek,
> > 
> >> early_malloc for DM with support for more heaps and lightweight
> >> first heap on stack.
> >> 
> >> Adaptation layer for seamless calling of early_malloc or dlmalloc from
> >> DM based on init stage added (dmmalloc() and related functions).
> >> 
> >> Signed-off-by: Tomas Hlavacek 
> >> ---
> > 
> > It looks mostly OK, few comments
> > 
> > I'd say, pull out the modification of global data into separate patch and
> > put it before this patch. That'd make review of the core code much
> > easier.
> 
> NAK - The addition of the global data member is intrinsic to the early
> malloc implmentaion. Keep them together

Very pleasant to review too, I almost didn't manage to find the core dmmalloc 
code in all that bloat.

> > [...]
> > 
> >> +
> >> +#include  /* for ROUND_UP */
> >> +#include 
> >> +#include  /* for gd_t and gd */
> >> +#include  /* for phys_addr_t and size_addt_t */
> >> +
> >> +#include 
> >> +#include 
> >> +
> >> +DECLARE_GLOBAL_DATA_PTR;
> >> +
> >> +#ifdef CONFIG_SYS_EARLY_MALLOC
> >> +static struct early_heap_header *def_early_brk(size_t size)
> >> +{
> >> + struct early_heap_header *h =
> >> + (struct early_heap_header *)CONFIG_SYS_EARLY_HEAP_ADDR;
> >> +
> >> + h->free_space_pointer = (void *)(roundup(
> >> + (phys_addr_t)CONFIG_SYS_EARLY_HEAP_ADDR +
> >> + sizeof(struct early_heap_header),
> >> + sizeof(phys_addr_t)));
> >> + h->free_bytes = size - roundup(sizeof(struct early_heap_header),
> >> + sizeof(phys_addr_t));
> >> + h->next_early_heap = NULL;
> >> +
> >> + return h;
> >> +}
> >> +
> >> +struct early_heap_header *early_brk(size_t size)
> >> + __attribute__((weak, alias("def_early_brk")));
> > 
> > what about using (it needs ):
> > 
> > __weak struct early_heap_header *early_brk(size_t size)
> > {
> > ...
> > body
> > ...
> > }
> 
> We already have a lot of the former - I prefer not to add additional
> semantics (unless you want to do a wholesale search/replace ;))

The former looks like shit and the later is more linux-friendly. I'd say stick 
with the later to avoid this insane __attribute__(()) construct.

> >> +void *dmmalloc(size_t size)
> >> +{
> >> +#ifdef CONFIG_SYS_EARLY_MALLOC
> >> + if (is_early_malloc_active())
> >> + return early_malloc(size);
> >> +#endif /* CONFIG_SYS_EARLY_MALLOC */
> > 
> > Or you can implement empty prototypes for these functions in case
> > CONFIG_SYS ... isn't defined to punt this preprocessor bloat.
> 
> Agree
> 
> >> + return malloc(size);
> >> +}
> > 
> > [...]
> > 
> >> diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
> >> index 26204af..5cd0dcb 100644
> >> --- a/include/configs/zipitz2.h
> >> +++ b/include/configs/zipitz2.h
> >> @@ -176,8 +176,13 @@ unsigned char zipitz2_spi_read(void);
> >> 
> >>  #define  CONFIG_SYS_LOAD_ADDRCONFIG_SYS_DRAM_BASE
> >> 
> >> +#define CONFIG_SYS_EARLY_HEAP_ADDR (GENERATED_GBL_DATA_SIZE + \
> >> + PHYS_SDRAM_1)
> >> +#define CONFIG_SYS_EARLY_HEAP_SIZE 256
> >> +
> > 
> > 1) Pull this file into separate patch and order it afterwards this patch.
> 
> Already agreed :)
> 
> Regards,
> 
> Graeme

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


Re: [U-Boot] [PATCHv4] [RFC] DM: early_malloc for DM added.

2012-09-18 Thread Graeme Russ
Hi Marek,

On Tue, Sep 18, 2012 at 8:57 PM, Marek Vasut  wrote:
> Dear Tomas Hlavacek,
>
>> early_malloc for DM with support for more heaps and lightweight
>> first heap on stack.
>>
>> Adaptation layer for seamless calling of early_malloc or dlmalloc from
>> DM based on init stage added (dmmalloc() and related functions).
>>
>> Signed-off-by: Tomas Hlavacek 
>> ---
>
> It looks mostly OK, few comments
>
> I'd say, pull out the modification of global data into separate patch and put 
> it
> before this patch. That'd make review of the core code much easier.

NAK - The addition of the global data member is intrinsic to the early
malloc implmentaion. Keep them together

>
> [...]
>
>> +
>> +#include  /* for ROUND_UP */
>> +#include 
>> +#include  /* for gd_t and gd */
>> +#include  /* for phys_addr_t and size_addt_t */
>> +
>> +#include 
>> +#include 
>> +
>> +DECLARE_GLOBAL_DATA_PTR;
>> +
>> +#ifdef CONFIG_SYS_EARLY_MALLOC
>> +static struct early_heap_header *def_early_brk(size_t size)
>> +{
>> + struct early_heap_header *h =
>> + (struct early_heap_header *)CONFIG_SYS_EARLY_HEAP_ADDR;
>> +
>> + h->free_space_pointer = (void *)(roundup(
>> + (phys_addr_t)CONFIG_SYS_EARLY_HEAP_ADDR +
>> + sizeof(struct early_heap_header),
>> + sizeof(phys_addr_t)));
>> + h->free_bytes = size - roundup(sizeof(struct early_heap_header),
>> + sizeof(phys_addr_t));
>> + h->next_early_heap = NULL;
>> +
>> + return h;
>> +}
>> +
>> +struct early_heap_header *early_brk(size_t size)
>> + __attribute__((weak, alias("def_early_brk")));
>
> what about using (it needs ):
>
> __weak struct early_heap_header *early_brk(size_t size)
> {
> ...
> body
> ...
> }

We already have a lot of the former - I prefer not to add additional
semantics (unless you want to do a wholesale search/replace ;))


>> +void *dmmalloc(size_t size)
>> +{
>> +#ifdef CONFIG_SYS_EARLY_MALLOC
>> + if (is_early_malloc_active())
>> + return early_malloc(size);
>> +#endif /* CONFIG_SYS_EARLY_MALLOC */
>
> Or you can implement empty prototypes for these functions in case CONFIG_SYS 
> ...
> isn't defined to punt this preprocessor bloat.

Agree

>
>> + return malloc(size);
>> +}
>
> [...]
>
>> diff --git a/include/configs/zipitz2.h b/include/configs/zipitz2.h
>> index 26204af..5cd0dcb 100644
>> --- a/include/configs/zipitz2.h
>> +++ b/include/configs/zipitz2.h
>> @@ -176,8 +176,13 @@ unsigned char zipitz2_spi_read(void);
>>
>>  #define  CONFIG_SYS_LOAD_ADDRCONFIG_SYS_DRAM_BASE
>>
>> +#define CONFIG_SYS_EARLY_HEAP_ADDR (GENERATED_GBL_DATA_SIZE + \
>> + PHYS_SDRAM_1)
>> +#define CONFIG_SYS_EARLY_HEAP_SIZE 256
>> +
>
> 1) Pull this file into separate patch and order it afterwards this patch.

Already agreed :)

Regards,

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


Re: [U-Boot] [GIT PULL] mpc83xx: mpc8308rdb enhancements

2012-09-18 Thread Tom Rini
On Tue, Sep 18, 2012 at 04:22:01PM -0500, Kim Phillips wrote:
> On Tue, 18 Sep 2012 07:57:08 -0700
> Tom Rini  wrote:
> 
> > On 09/17/12 20:09, Ira W. Snyder wrote:
> > > Go ahead and drop the patch "spansion: add support for S25FL256S1"
> > > from the series. The rest should apply without any trouble.
> > > 
> > > Michal Simek beat me to it in "sf: spansion: Add support for
> > > S25FL256S" (4a4cb4e1114). He got the idcode1 wrong (it should be
> > > 0x0219 instead of 0x2019), but I saw a followup patch on the
> > > mailing list to fix it.
> > 
> > This is good to know.  My preference however is for a new pull request
> > with whatever corrections Kim deems necessary.  Thanks!
> 
> rebased on current master, with Ira's spansion patch omitted.
> Please pull:
> 
> The following changes since commit 037e9d33db9fc86c1e671d64077b2d1a19df7f24:
> 
>   Merge branch 'master' of git://git.denx.de/u-boot-i2c (2012-09-17 11:39:03 
> -0700)
> 
> are available in the git repository at:
> 
>   git://git.denx.de/u-boot-mpc83xx.git master
> 
> for you to fetch changes up to db1fc7d28e8947c402149ded4597970fdb3e5571:
> 
>   mpc8308rdb: add support for eSDHC MMC controller (2012-09-18 16:16:45 -0500)
> 
> 
> Ira W. Snyder (4):
>   mpc8xxx_spi: fix SPI support on MPC8308RDB
>   mpc8308rdb: add support for Spansion SPI flash on header J8
>   mpc8308rdb: add support for FIT images
>   mpc8308rdb: add support for eSDHC MMC controller
> 
>  board/freescale/mpc8308rdb/mpc8308rdb.c | 58 
> +
>  drivers/spi/mpc8xxx_spi.c   |  4 +++
>  include/configs/MPC8308RDB.h| 31 ++
>  3 files changed, 93 insertions(+)

Applied to u-boot/master, thanks.  In the future, please start a new
thread, it helps me track.  Thanks again!

-- 
Tom


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


Re: [U-Boot] [PATCHv4] [RFC] DM: early_malloc for DM added.

2012-09-18 Thread Graeme Russ
Hi Tomas

On Tue, Sep 18, 2012 at 5:13 PM, Tomas Hlavacek  wrote:
> early_malloc for DM with support for more heaps and lightweight
> first heap on stack.

Technically, you are not putting the first heap on the stack - you are
sacrificing some early stack space to create the early heap

>
> Adaptation layer for seamless calling of early_malloc or dlmalloc from
> DM based on init stage added (dmmalloc() and related functions).
>
> Signed-off-by: Tomas Hlavacek 
> ---
>  arch/arm/include/asm/config.h |3 +
>  arch/arm/include/asm/global_data.h|1 +
>  arch/arm/lib/board.c  |7 ++
>  arch/avr32/include/asm/global_data.h  |1 +
>  arch/avr32/lib/board.c|6 ++
>  arch/blackfin/include/asm/global_data.h   |1 +
>  arch/blackfin/lib/board.c |7 ++
>  arch/m68k/include/asm/global_data.h   |1 +
>  arch/m68k/lib/board.c |7 ++
>  arch/microblaze/include/asm/global_data.h |1 +
>  arch/microblaze/lib/board.c   |8 ++
>  arch/mips/include/asm/global_data.h   |1 +
>  arch/mips/lib/board.c |7 ++
>  arch/nds32/include/asm/global_data.h  |1 +
>  arch/nds32/lib/board.c|6 ++
>  arch/nios2/include/asm/global_data.h  |1 +
>  arch/nios2/lib/board.c|6 ++
>  arch/openrisc/include/asm/global_data.h   |1 +
>  arch/openrisc/lib/board.c |6 ++
>  arch/powerpc/include/asm/global_data.h|1 +
>  arch/powerpc/lib/board.c  |6 ++
>  arch/sandbox/include/asm/global_data.h|1 +
>  arch/sandbox/lib/board.c  |6 ++
>  arch/sh/include/asm/global_data.h |1 +
>  arch/sh/lib/board.c   |6 ++
>  arch/sparc/include/asm/global_data.h  |1 +
>  arch/sparc/lib/board.c|6 ++
>  arch/x86/include/asm/global_data.h|1 +
>  arch/x86/lib/board.c  |   14 
>  common/Makefile   |1 +
>  common/dmmalloc.c |  128 
> +
>  include/configs/zipitz2.h |   12 ++-

WTF! - Move this out into another patch

>  include/dmmalloc.h|   51 
>  33 files changed, 306 insertions(+), 1 deletion(-)
>  create mode 100644 common/dmmalloc.c
>  create mode 100644 include/dmmalloc.h
>
> diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
> index c60dba2..8e2f67b 100644
> --- a/arch/arm/include/asm/config.h
> +++ b/arch/arm/include/asm/config.h
> @@ -23,4 +23,7 @@
>
>  #define CONFIG_LMB
>  #define CONFIG_SYS_BOOT_RAMDISK_HIGH
> +
> +#define CONFIG_SYS_EARLY_MALLOC
>  #endif
> +

Why are you adding this define to ARM and nothing else? Shouldn't it be an
all-in or none-in proposition?

(and why the stray eol white-space?)

> diff --git a/arch/arm/include/asm/global_data.h 
> b/arch/arm/include/asm/global_data.h
> index c3ff789..8563d49 100644
> --- a/arch/arm/include/asm/global_data.h
> +++ b/arch/arm/include/asm/global_data.h
> @@ -84,6 +84,7 @@ typedef   struct  global_data {
> unsigned long   post_log_res; /* success of POST test */
> unsigned long   post_init_f_time; /* When post_init_f started */
>  #endif
> +   void*early_heap_first; /* early heap for early_malloc */
>  } gd_t;

early_heap_first is only used if CONFIG_SYS_EARLY_MALLOC is defined, so
wrap a #ifdef around it. This will also help to detect unintended usage
if CONFIG_SYS_EARLY_MALLOC is not defined.

>
>  /*
> diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c
> index 500e216..33e74da 100644
> --- a/arch/arm/lib/board.c
> +++ b/arch/arm/lib/board.c
> @@ -52,6 +52,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #ifdef CONFIG_BITBANGMII
>  #include 
> @@ -273,6 +274,12 @@ void board_init_f(ulong bootflag)
>
> memset((void *)gd, 0, sizeof(gd_t));
>
> +
> +#ifdef CONFIG_SYS_EARLY_MALLOC
> +   /* Initialize early_malloc */
> +   gd->early_heap_first = early_brk(CONFIG_SYS_EARLY_HEAP_SIZE);
> +#endif /* CONFIG_SYS_EARLY_MALLOC */
> +

Did you checkpatch? You've added an additional blank line (for a total of
two)

[snip]

> diff --git a/arch/x86/lib/board.c b/arch/x86/lib/board.c
> index 5f0b62c..b609dbe 100644
> --- a/arch/x86/lib/board.c
> +++ b/arch/x86/lib/board.c
> @@ -40,6 +40,8 @@
>  #include 
>  #include 
>
> +#include 
> +
>  /*
>   * Breath some life into the board...
>   *
> @@ -85,6 +87,17 @@
>  typedef int (init_fnc_t) (void);
>
>  /*
> + * Initialize early heap (when enabled by config).
> + */
> +static void early_malloc_init(void)
> +{
> +#ifdef CONFIG_SYS_EARLY_MALLOC
> +   /* Initialize early_malloc */
> +   gd->early_heap_first = early_brk(CONFIG_SYS_EARLY_HEAP_SIZE);
> +#endif /* CONFIG_SYS_EARLY_MALLOC */
> +}
> +
> +/*
>   * init_sequence_f is the list of init f

Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Marek Vasut
Dear Simon Glass,

> Hi,
> 
> On Tue, Sep 18, 2012 at 2:21 PM, Marek Vasut  wrote:
> > Dear Simon Glass,
> > 
> >> Hi,
> >> 
> >> On Tue, Sep 18, 2012 at 1:04 PM, Thierry Reding
> >> 
> >>  wrote:
> >> > On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
> >> >> Dear Thierry Reding,
> >> >> 
> >> >> [...]
> >> >> 
> >> >> > > Sure, but after you apply the bounce buffer, you can safely
> >> >> > > invalidate the whole cacheline, so align it up and be done with
> >> >> > > it.
> >> >> > 
> >> >> > That's what I proposed to do last time around but it was NAK'ed.
> >> >> 
> >> >> By who?
> >> > 
> >> > I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
> >> > valid reason, so I'm not complaining.
> >> > 
> >> >> > At the
> >> >> > time I didn't ensure that the buffer was actually big enough, which
> >> >> > is why people didn't like it (data on the stack after the DMA
> >> >> > buffer might be invalidated as well).
> >> >> 
> >> >> Correct, thus the bounce buffer.
> >> > 
> >> > I don't think we even need the bounce buffer. All that needs to be
> >> > done is guarantee that the buffers passed to the MMC driver are
> >> > properly aligned and sized.
> >> > 
> >> > Thierry
> >> 
> >> Perhaps a point to make here is that we really don't want every driver
> >> (or even driver stack) implementing bounce buffers to when it is not a
> >> huge effort to change the code that calls them (typically filesystem
> >> code) to do the right thing. The code will be smaller and more
> >> efficient if the alignment issues are dealt with at source IMO.
> > 
> > You need the BB for user-case, when user gives you misaligned buffer.
> 
> Yes, although I think you are talking about non-filesystem (i.e. raw)

Like fatload ? Fatload doesn't use any interim buffer either, so not only raw.

> access, and it would be odd to read a kernel to a non-cached-aligned
> address. If we want to support that, we can (perhaps even in the
> command itself)., but at least U-Boot's own code should ideally not
> generate unaligned access.

Correct

> 
> Regards,
> Simon
> 
> > Best regards,
> > 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] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Simon Glass
Hi,

On Tue, Sep 18, 2012 at 2:21 PM, Marek Vasut  wrote:
> Dear Simon Glass,
>
>> Hi,
>>
>> On Tue, Sep 18, 2012 at 1:04 PM, Thierry Reding
>>
>>  wrote:
>> > On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
>> >> Dear Thierry Reding,
>> >>
>> >> [...]
>> >>
>> >> > > Sure, but after you apply the bounce buffer, you can safely
>> >> > > invalidate the whole cacheline, so align it up and be done with it.
>> >> >
>> >> > That's what I proposed to do last time around but it was NAK'ed.
>> >>
>> >> By who?
>> >
>> > I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
>> > valid reason, so I'm not complaining.
>> >
>> >> > At the
>> >> > time I didn't ensure that the buffer was actually big enough, which is
>> >> > why people didn't like it (data on the stack after the DMA buffer
>> >> > might be invalidated as well).
>> >>
>> >> Correct, thus the bounce buffer.
>> >
>> > I don't think we even need the bounce buffer. All that needs to be done
>> > is guarantee that the buffers passed to the MMC driver are properly
>> > aligned and sized.
>> >
>> > Thierry
>>
>> Perhaps a point to make here is that we really don't want every driver
>> (or even driver stack) implementing bounce buffers to when it is not a
>> huge effort to change the code that calls them (typically filesystem
>> code) to do the right thing. The code will be smaller and more
>> efficient if the alignment issues are dealt with at source IMO.
>
> You need the BB for user-case, when user gives you misaligned buffer.

Yes, although I think you are talking about non-filesystem (i.e. raw)
access, and it would be odd to read a kernel to a non-cached-aligned
address. If we want to support that, we can (perhaps even in the
command itself)., but at least U-Boot's own code should ideally not
generate unaligned access.

Regards,
Simon

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


[U-Boot] [PATCH V3 8/8] cmd_part: add partition-related command

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

This implements the following:

part uuid mmc 0:1
  -> print partition UUID
part uuid mmc 0:1 uuid
  -> set environment variable to partition UUID
part list mmc 0
  -> list the partitions on the specified device

"part uuid" can be useful when writing a bootcmd which searches all
known devices for something bootable, and then wants the kernel to
use the same partition as the root device, e.g.:

part uuid ${devtype} ${devnum}:${rootpart} uuid
setenv bootargs root=PARTUUID=${uuid} ...

Signed-off-by: Stephen Warren 
---
v3:
* Rebased on top of u-boot/ext4 and Rob Herring's get_device_and_partition
  patches.
* Implemented "part list" sub-command.
v2:
* validate that CONFIG_PARTITION_UUID is defined when CONFIG_CMD_PART is
---
 common/Makefile   |1 +
 common/cmd_part.c |  105 +
 2 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_part.c

diff --git a/common/Makefile b/common/Makefile
index 482795e..b56df1d 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -136,6 +136,7 @@ COBJS-$(CONFIG_CMD_NAND) += cmd_nand.o
 COBJS-$(CONFIG_CMD_NET) += cmd_net.o
 COBJS-$(CONFIG_CMD_ONENAND) += cmd_onenand.o
 COBJS-$(CONFIG_CMD_OTP) += cmd_otp.o
+COBJS-$(CONFIG_CMD_PART) += cmd_part.o
 ifdef CONFIG_PCI
 COBJS-$(CONFIG_CMD_PCI) += cmd_pci.o
 endif
diff --git a/common/cmd_part.c b/common/cmd_part.c
new file mode 100644
index 000..d997597
--- /dev/null
+++ b/common/cmd_part.c
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
+ *
+ * made from cmd_ext2, which was:
+ *
+ * (C) Copyright 2004
+ * esd gmbh 
+ * Reinhard Arlt 
+ *
+ * made from cmd_reiserfs by
+ *
+ * (C) Copyright 2003 - 2004
+ * Sysgo Real-Time Solutions, AG 
+ * Pavel Bartusek 
+ *
+ * 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, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifndef CONFIG_PARTITION_UUIDS
+#error CONFIG_PARTITION_UUIDS must be enabled for CONFIG_CMD_PART to be enabled
+#endif
+
+int do_part_uuid(int argc, char * const argv[])
+{
+   int part;
+   block_dev_desc_t *dev_desc;
+   disk_partition_t info;
+
+   if (argc < 2)
+   return CMD_RET_USAGE;
+   if (argc > 3)
+   return CMD_RET_USAGE;
+
+   part = get_device_and_partition(argv[0], argv[1], &dev_desc, &info, 0);
+   if (part < 0)
+   return 1;
+
+   if (argc > 2)
+   setenv(argv[2], info.uuid);
+   else
+   printf("%s\n", info.uuid);
+
+   return 0;
+}
+
+int do_part_list(int argc, char * const argv[])
+{
+   int ret;
+   block_dev_desc_t *desc;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+
+   ret = get_device(argv[0], argv[1], &desc);
+   if (ret < 0)
+   return 1;
+
+   print_part(desc);
+
+   return 0;
+}
+
+int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   if (argc < 2)
+   return CMD_RET_USAGE;
+
+   if (!strcmp(argv[1], "uuid"))
+   return do_part_uuid(argc - 2, argv + 2);
+   else if (!strcmp(argv[1], "list"))
+   return do_part_list(argc - 2, argv + 2);
+
+   return CMD_RET_USAGE;
+}
+
+U_BOOT_CMD(
+   part,   5,  1,  do_part,
+   "disk partition related commands",
+   "part uuid  :\n"
+   "- print partition UUID\n"
+   "part uuid  : \n"
+   "- set environment variable to partition UUID\n"
+   "part list  \n"
+   "- print a device's partition table"
+);
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 6/8] disk: part_efi: parse and store partition UUID

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

Each EFI partition table entry contains a UUID. Extend U-Boot's struct
disk_partition to be able to store this information, and modify
get_partition_info_efi() to fill it in.

The implementation of uuid_string() was derived from the Linux kernel,
tag v3.6-rc4 file lib/vsprintf.c function uuid_string().

Signed-off-by: Stephen Warren 
---
v3: Provided pointer to source of uuid_string() code in commit description.
v2: Add #ifdef CONFIG_PARTITION_UUIDS around all new code and struct fields.
---
 disk/part.c |5 +
 disk/part_efi.c |   25 +
 include/part.h  |3 +++
 3 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 9916708..ede888f 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -296,6 +296,11 @@ void init_part (block_dev_desc_t * dev_desc)
 int get_partition_info (block_dev_desc_t *dev_desc, int part
, disk_partition_t *info)
 {
+#ifdef CONFIG_PARTITION_UUIDS
+   /* The common case is no UUID support */
+   info->uuid[0] = 0;
+#endif
+
switch (dev_desc->part_type) {
 #ifdef CONFIG_MAC_PARTITION
case PART_TYPE_MAC:
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 2962fd8..264ea9c 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -154,6 +154,28 @@ void print_part_efi(block_dev_desc_t * dev_desc)
return;
 }
 
+#ifdef CONFIG_PARTITION_UUIDS
+static void uuid_string(unsigned char *uuid, char *str)
+{
+   static const u8 le[16] = {3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11,
+ 12, 13, 14, 15};
+   int i;
+
+   for (i = 0; i < 16; i++) {
+   sprintf(str, "%02x", uuid[le[i]]);
+   str += 2;
+   switch (i) {
+   case 3:
+   case 5:
+   case 7:
+   case 9:
+   *str++ = '-';
+   break;
+   }
+   }
+}
+#endif
+
 int get_partition_info_efi(block_dev_desc_t * dev_desc, int part,
disk_partition_t * info)
 {
@@ -190,6 +212,9 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, int 
part,
sprintf((char *)info->name, "%s",
print_efiname(&gpt_pte[part - 1]));
sprintf((char *)info->type, "U-Boot");
+#ifdef CONFIG_PARTITION_UUIDS
+   uuid_string(gpt_pte[part - 1].unique_partition_guid.b, info->uuid);
+#endif
 
debug("%s: start 0x%lX, size 0x%lX, name %s", __func__,
info->start, info->size, info->name);
diff --git a/include/part.h b/include/part.h
index 3f780a1..27ea283 100644
--- a/include/part.h
+++ b/include/part.h
@@ -94,6 +94,9 @@ typedef struct disk_partition {
uchar   name[32];   /* partition name   */
uchar   type[32];   /* string type description  */
int bootable;   /* Active/Bootable flag is set  */
+#ifdef CONFIG_PARTITION_UUIDS
+   charuuid[37];   /* filesystem UUID as string, if exists */
+#endif
 } disk_partition_t;
 
 /* Misc _get_dev functions */
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 7/8] disk: part_msdos: parse and store partition UUID

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

The MSDOS/MBR partition table includes a 32-bit unique ID, often referred
to as the NT disk signature. When combined with a partition number within
the table, this can form a unique ID similar in concept to EFI/GPT's
partition UUID.

This patch generates UUIDs in the format 0002dd75-01, which matches the
format expected by the Linux kernel.

Signed-off-by: Stephen Warren 
---
v3: No change.
v2: New patch.
---
 disk/part_dos.c |   15 ---
 disk/part_dos.h |2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/disk/part_dos.c b/disk/part_dos.c
index 24ac00c..c9a3e2b 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -169,7 +169,8 @@ static void print_partition_extended (block_dev_desc_t 
*dev_desc, int ext_part_s
  */
 static int get_partition_info_extended (block_dev_desc_t *dev_desc, int 
ext_part_sector,
 int relative, int part_num,
-int which_part, disk_partition_t *info)
+int which_part, disk_partition_t *info,
+unsigned int disksig)
 {
ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
dos_partition_t *pt;
@@ -188,6 +189,11 @@ static int get_partition_info_extended (block_dev_desc_t 
*dev_desc, int ext_part
return -1;
}
 
+#ifdef CONFIG_PARTITION_UUIDS
+   if (!ext_part_sector)
+   disksig = le32_to_int(&buffer[DOS_PART_DISKSIG_OFFSET]);
+#endif
+
/* Print all primary/logical partitions */
pt = (dos_partition_t *) (buffer + DOS_PART_TBL_OFFSET);
for (i = 0; i < 4; i++, pt++) {
@@ -229,6 +235,9 @@ static int get_partition_info_extended (block_dev_desc_t 
*dev_desc, int ext_part
/* sprintf(info->type, "%d, pt->sys_ind); */
sprintf ((char *)info->type, "U-Boot");
info->bootable = is_bootable(pt);
+#ifdef CONFIG_PARTITION_UUIDS
+   sprintf(info->uuid, "%08x-%02x", disksig, part_num);
+#endif
return 0;
}
 
@@ -247,7 +256,7 @@ static int get_partition_info_extended (block_dev_desc_t 
*dev_desc, int ext_part
 
return get_partition_info_extended (dev_desc, lba_start,
 ext_part_sector == 0 ? lba_start : relative,
-part_num, which_part, info);
+part_num, which_part, info, disksig);
}
}
return -1;
@@ -261,7 +270,7 @@ void print_part_dos (block_dev_desc_t *dev_desc)
 
 int get_partition_info_dos (block_dev_desc_t *dev_desc, int part, 
disk_partition_t * info)
 {
-   return get_partition_info_extended (dev_desc, 0, 0, 1, part, info);
+   return get_partition_info_extended(dev_desc, 0, 0, 1, part, info, 0);
 }
 
 
diff --git a/disk/part_dos.h b/disk/part_dos.h
index de75542..7b77c1d 100644
--- a/disk/part_dos.h
+++ b/disk/part_dos.h
@@ -24,7 +24,7 @@
 #ifndef _DISK_PART_DOS_H
 #define _DISK_PART_DOS_H
 
-
+#define DOS_PART_DISKSIG_OFFSET0x1b8
 #define DOS_PART_TBL_OFFSET0x1be
 #define DOS_PART_MAGIC_OFFSET  0x1fe
 #define DOS_PBR_FSTYPE_OFFSET  0x36
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 5/8] disk: part_efi: range-check partition number

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

Enhance get_partition_info_efi() to range-check the partition number.
This prevents invalid partitions being accessed, and prevents access
beyond the end of the gpt_pte[] array.

Signed-off-by: Stephen Warren 
---
v3: No change.
v2: New patch.
---
 disk/part_efi.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/disk/part_efi.c b/disk/part_efi.c
index 02927a0..2962fd8 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -173,6 +173,13 @@ int get_partition_info_efi(block_dev_desc_t * dev_desc, 
int part,
return -1;
}
 
+   if (part > le32_to_int(gpt_head->num_partition_entries) ||
+   !is_pte_valid(&gpt_pte[part - 1])) {
+   printf("%s: *** ERROR: Invalid partition number %d ***\n",
+   __func__, part);
+   return -1;
+   }
+
/* The ulong casting limits the maximum disk size to 2 TB */
info->start = (ulong) le64_to_int(gpt_pte[part - 1].starting_lba);
/* The ending LBA is inclusive, to calculate size, add 1 to it */
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 4/8] disk: get_device_and_partition() enhancements

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

Rework get_device_and_partition to:
a) Make use of get_device().
b) Add parameter to indicate whether returning a whole device is
   acceptable, or whether a partition is mandatory.
c) Make error-checking of the user's device-/partition-specification
   more complete. In particular, if strtoul() doesn't convert all
   characters, it's an error rather than just ignored.
d) Require user to explicitly specify "N:auto" as the device/partition
   specification to get the automatic "search for a bootable partition"
   mode of operation; Rob's patch changed the behaviour of some syntaxes
   from defaulting to partition 1.

The resultant device/partition returned by the function will be as
follows, based on whether the disk has a partition table (ptable) or not,
and whether the calling command allows the whole device to be returned
or not.

(D and P are integers, P >= 1)

D
D:
  No ptable:
!allow_whole_dev: error
allow_whole_dev: device D
  ptable:
device D partition 1
D:0
  !allow_whole_dev: error
  allow_whole_dev: device D
D:P
  No ptable: error
  ptable: device D partition P
D:auto
  No ptable:
!allow_whole_dev: error
allow_whole_dev: device D
  ptable:
first partition in device D with bootable flag set.
If none, first valid paratition in device D.

Note: In order to review this patch, it's probably easiest to simply
look at the file contents post-application, rather than reading the
patch itself.

Signed-off-by: Stephen Warren 
---
v3: New patch.
---
 common/cmd_disk.c   |2 +-
 common/cmd_ext4.c   |2 +-
 common/cmd_ext_common.c |4 +-
 common/cmd_fat.c|8 +-
 common/cmd_reiser.c |4 +-
 common/cmd_zfs.c|4 +-
 disk/part.c |  151 ++-
 include/part.h  |9 ++-
 8 files changed, 127 insertions(+), 57 deletions(-)

diff --git a/common/cmd_disk.c b/common/cmd_disk.c
index e6676b0..3bd1eba 100644
--- a/common/cmd_disk.c
+++ b/common/cmd_disk.c
@@ -31,7 +31,7 @@ int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int 
argc,
bootstage_mark(BOOTSTAGE_ID_IDE_BOOT_DEVICE);
 
part = get_device_and_partition(intf, (argc == 3) ? argv[2] : NULL,
-   &dev_desc, &info);
+   &dev_desc, &info, 1);
if (part < 0) {
bootstage_error(BOOTSTAGE_ID_IDE_TYPE);
return 1;
diff --git a/common/cmd_ext4.c b/common/cmd_ext4.c
index 48f9ba3..ca46561 100644
--- a/common/cmd_ext4.c
+++ b/common/cmd_ext4.c
@@ -87,7 +87,7 @@ int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
if (argc < 6)
return cmd_usage(cmdtp);
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
diff --git a/common/cmd_ext_common.c b/common/cmd_ext_common.c
index 7d26944..1952f4d 100644
--- a/common/cmd_ext_common.c
+++ b/common/cmd_ext_common.c
@@ -108,7 +108,7 @@ int do_ext_load(cmd_tbl_t *cmdtp, int flag, int argc,
return 1;
}
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
@@ -166,7 +166,7 @@ int do_ext_ls(cmd_tbl_t *cmdtp, int flag, int argc, char 
*const argv[])
if (argc < 2)
return cmd_usage(cmdtp);
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 90412d6..01e02f5 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -49,7 +49,7 @@ int do_fat_fsload (cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
return 1;
}
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
@@ -101,7 +101,7 @@ int do_fat_ls (cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
return 0;
}
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
@@ -139,7 +139,7 @@ int do_fat_fsinfo (cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
return 0;
}
 
-   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info);
+   part = get_device_and_partition(argv[1], argv[2], &dev_desc, &info, 1);
if (part < 0)
return 1;
 
@@ -175,7 +175,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmd

[U-Boot] [PATCH V3 2/8] disk: fix get_device_and_partition() bootable search

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

The existing get_device_and_partition() bootable search loop attempts
to save the current best known partition in variable best_part. However,
it's actually just saving a copy of the (static) "info" variable, and
hence ends up not doing anything much useful if no bootable partition
is found. Fix this by reworking the loop to:

a) When reading information about a partition, always read into the
   caller-supplied buffer; that way, if we find a bootable partition,
   there's no need to copy any information.
b) Save the first known valid partition's structure content rather than
   pointer in the search loop, and restore the structure content rather
   than the pointer when the loop exits.

Signed-off-by: Stephen Warren 
---
v3: New patch.
---
 disk/part.c |   38 +-
 1 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 6caf6d2..277a243 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -447,7 +447,7 @@ int get_device_and_partition(const char *ifname, const char 
*dev_str,
int p;
int part = 0;
char *part_str;
-   disk_partition_t *best_part = NULL;
+   disk_partition_t tmpinfo;
 
if (dev_str)
dev = simple_strtoul(dev_str, &ep, 16);
@@ -483,24 +483,44 @@ int get_device_and_partition(const char *ifname, const 
char *dev_str,
part = (int)simple_strtoul(++part_str, NULL, 16);
ret = get_partition_info(desc, part, info);
} else {
-   /* find the first bootable partition. If none are bootable,
-* fall back to the first valid partition */
+   /*
+* Find the first bootable partition.
+* If none are bootable, fall back to the first valid partition.
+*/
for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
-   ret = get_partition_info(desc, p, info);
+   ret = get_partition_info(*dev_desc, p, info);
if (ret)
continue;
 
-   if (!best_part || info->bootable) {
-   best_part = info;
+   /*
+* First valid partition, or new better partition?
+* If so, save partition ID.
+*/
+   if (!part || info->bootable)
part = p;
-   }
 
+   /* Best possible partition? Stop searching. */
if (info->bootable)
break;
+
+   /*
+* We now need to search further for best possible.
+* If we what we just queried was the best so far,
+* save the info since we over-write it next loop.
+*/
+   if (part == p)
+   tmpinfo = *info;
}
-   info = best_part;
-   if (part)
+   /* If we found any acceptable partition */
+   if (part) {
+   /*
+* If we searched all possible partition IDs,
+* return the first valid partition we found.
+*/
+   if (p == MAX_SEARCH_PARTITIONS + 1)
+   *info = tmpinfo;
ret = 0;
+   }
}
if (ret) {
printf("** Invalid partition %d, use `dev[:part]' **\n", part);
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 3/8] disk: introduce get_device()

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

This patch introduces function get_device(). This looks up a
block_dev_desc_t from an interface name (e.g. mmc) and device number
(e.g. 0). This function is essentially the non-partition-specific
prefix of get_device_and_partition().

Signed-off-by: Stephen Warren 
---
v3: New patch.
---
 disk/part.c|   22 ++
 include/part.h |5 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 277a243..9920d48 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -435,6 +435,28 @@ void print_part (block_dev_desc_t * dev_desc)
 
 #endif
 
+int get_device(const char *ifname, const char *dev_str,
+  block_dev_desc_t **dev_desc)
+{
+   char *ep;
+   int dev;
+
+   dev = simple_strtoul(dev_str, &ep, 16);
+   if (*ep) {
+   printf("** Bad device specification %s %s **\n",
+  ifname, dev_str);
+   return -1;
+   }
+
+   *dev_desc = get_dev(ifname, dev);
+   if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
+   printf("** Bad device %s %s **\n", ifname, dev_str);
+   return -1;
+   }
+
+   return dev;
+}
+
 #define MAX_SEARCH_PARTITIONS 16
 int get_device_and_partition(const char *ifname, const char *dev_str,
 block_dev_desc_t **dev_desc,
diff --git a/include/part.h b/include/part.h
index a6d06f3..144df4e 100644
--- a/include/part.h
+++ b/include/part.h
@@ -112,6 +112,8 @@ int get_partition_info (block_dev_desc_t * dev_desc, int 
part, disk_partition_t
 void print_part (block_dev_desc_t *dev_desc);
 void  init_part (block_dev_desc_t *dev_desc);
 void dev_print(block_dev_desc_t *dev_desc);
+int get_device(const char *ifname, const char *dev_str,
+  block_dev_desc_t **dev_desc);
 int get_device_and_partition(const char *ifname, const char *dev_str,
 block_dev_desc_t **dev_desc,
 disk_partition_t *info);
@@ -131,6 +133,9 @@ static inline int get_partition_info (block_dev_desc_t * 
dev_desc, int part,
 static inline void print_part (block_dev_desc_t *dev_desc) {}
 static inline void  init_part (block_dev_desc_t *dev_desc) {}
 static inline void dev_print(block_dev_desc_t *dev_desc) {}
+static inline int get_device(const char *ifname, const char *dev_str,
+  block_dev_desc_t **dev_desc)
+{ return -1; }
 static inline int get_device_and_partition(const char *ifname,
   const char *dev_str,
   block_dev_desc_t **dev_desc,
-- 
1.7.0.4

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


[U-Boot] [PATCH V3 0/8] disk: "part" command and dependencies

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

This series:
a) Fixes some issues in Rob Herring's get_device_and_partition series.
b) Implements a new "part" command, for dumping partition tables and UUIDs.

The series is based on a merge of u-boot-tegra/master, u-boot-usb/master,
and u-boot/ext4, although only u-boot/ext4 is likely to contribute any
context to the diffs here; my usage of the other branches was just a
convenience for testing.

Stephen Warren (8):
  disk: parameterize get_device_and_partition's loop count
  disk: fix get_device_and_partition() bootable search
  disk: introduce get_device()
  disk: get_device_and_partition() enhancements
  disk: part_efi: range-check partition number
  disk: part_efi: parse and store partition UUID
  disk: part_msdos: parse and store partition UUID
  cmd_part: add partition-related command

 common/Makefile |1 +
 common/cmd_disk.c   |2 +-
 common/cmd_ext4.c   |2 +-
 common/cmd_ext_common.c |4 +-
 common/cmd_fat.c|8 +-
 common/cmd_part.c   |  105 ++
 common/cmd_reiser.c |4 +-
 common/cmd_zfs.c|4 +-
 disk/part.c |  223 ---
 disk/part_dos.c |   15 +++-
 disk/part_dos.h |2 +-
 disk/part_efi.c |   32 +++
 include/part.h  |   17 +++-
 13 files changed, 346 insertions(+), 73 deletions(-)
 create mode 100644 common/cmd_part.c

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


[U-Boot] [PATCH V3 1/8] disk: parameterize get_device_and_partition's loop count

2012-09-18 Thread Stephen Warren
From: Stephen Warren 

Create #define MAX_SEARCH_PARTITIONS to indicate how many partition IDs
get_device_and_partition()'s automatic mode should search through. Also,
search 1..n not 1..n-1 - it's unlikely anyone has this many partitions,
but given the loop is 1-based, including the limit seems more consistent.

Signed-off-by: Stephen Warren 
---
v3: New patch.
---
 disk/part.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/disk/part.c b/disk/part.c
index 1284e1a..6caf6d2 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -435,6 +435,7 @@ void print_part (block_dev_desc_t * dev_desc)
 
 #endif
 
+#define MAX_SEARCH_PARTITIONS 16
 int get_device_and_partition(const char *ifname, const char *dev_str,
 block_dev_desc_t **dev_desc,
 disk_partition_t *info)
@@ -484,7 +485,7 @@ int get_device_and_partition(const char *ifname, const char 
*dev_str,
} else {
/* find the first bootable partition. If none are bootable,
 * fall back to the first valid partition */
-   for (p = 1; p < 16; p++) {
+   for (p = 1; p <= MAX_SEARCH_PARTITIONS; p++) {
ret = get_partition_info(desc, p, info);
if (ret)
continue;
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On 09/18/12 12:25, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 12:19, Marek Vasut wrote:
> >>> Dear Tom Rini,
> >>> 
>  On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
>  
>  [snip]
>  
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at
> >> compile time (not pointed to a stub at link time) on an
> >> SPL that has no output support, but once that's done the
> >> low level serial functions shouldn't be referenced
> >> anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler
> > will GC these useless stubs anyway. But wait, we're getting
> > to LTO here, right?
> > 
> > So the safest bet really is macro in serial.h ?
>  
>  Due to the gcc bug I've mentioned before, yes.  Dummy
>  functions will, I bet, keep the string constants around.  do
>  {} while(0) will drop them out entirely.
> >>> 
> >>> Damn, not much gain on m28evk (with C functionss/with macros),
> >>> using gcc 4.7.1:
> >>> 
> >>> Configuring for m28evk board... textdata bss dec
> >>> hex filename 4189947780  288632  715406   aea8e ./u-boot
> >>> 11773 788 12   12573311d ./spl/u-boot-spl
> >>> 
> >>> Configuring for m28evk board... textdata bss dec
> >>> hex filename 4189987780  288628  715406   aea8e ./u-boot
> >>> 11765 788 12   125653115 ./spl/u-boot-spl
> >> 
> >> Right, didn't have many strings.  But do you see what I mean now
> >> about not needing this patch as it stands currently?
> > 
> > No, I don't. If I remove this patch, the build breaks either
> > because serial_* is defined twice or not defined at all.
> 
> m28evk currently, needlessly, defines serial_puts/putc.  I locally
> patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> and the references in common/libcommon.o are correctly
> garbage-collected.  They are in fact unused functions today as they're
> garbage collected without patching, see spl/u-boot-spl.map after
> building.  So again I say, if common/serial.o is NOT being discard in
> your series on m28evk there is a bug in your series to fix or a change
> to better understand and document (and then see if we can change since
> as Scott notes, this needs to work for 4kb boards and that is tight).

Ok, so we cleared this up on jabber, latest ToT works correctly, discard this 
patch.

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 8/9] Tegra30: Add common pinmux config in board_early_init_f

2012-09-18 Thread Stephen Warren
On 09/18/2012 03:32 PM, Tom Warren wrote:
...
> As far as I'm aware, an FDT pinmux for Tegra (which is on my plate,
> but quite a bit behind T30) would be essentially the same deal - one
> large list of mux settings per build/board.

Initializing pinmux from DT can work either way, depending on how the DT
author wrote the DT file.

The pinmux DT node can contain a pinmux configuration which is applied
as soon as the pinmux driver loads. This configuration can contain as
little as you want (even nothing) all the way through to containing the
entire board's static pinmux configuration.

For portions of the pinmux settings which the pinmux driver's own DT
node doesn't configure (if any, based on the above), the relevant
individual driver DT node can configure the pinmux as required, and that
configuration would be applied when the relevant driver loads and parses
its DT node.

In practice, so far, all the kernel board files for Tegra almost
exclusively use static muxing in the pinmux controller's own DT node.
However, there are a couple small dynamic cases (e.g.
Seaboard/Springbank's pinctrl-based I2C mux for example).
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Scott Wood

On 09/18/2012 04:19:07 PM, Marek Vasut wrote:

Dear Tom Rini,

> (and then see if we can change since
> as Scott notes, this needs to work for 4kb boards and that is  
tight).


What exactly are the 4k boards?


Anything that uses fsl_elbc_nand is 4K.  I think most (all?) of the ppc  
4xx boards are 4K.  fsl_ifc_nand is 8K, though the linker script needs  
some rework to fully take advantage of that.


At least some of the i.MX boards have constraints but I don't know  
exactly what they are.


Maybe some others.

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


Re: [U-Boot] [PATCH 8/9] Tegra30: Add common pinmux config in board_early_init_f

2012-09-18 Thread Tom Warren
Simon,

On Tue, Sep 18, 2012 at 12:53 PM, Simon Glass  wrote:
> Hi,
>
> On Thu, Sep 13, 2012 at 3:37 PM, Stephen Warren  wrote:
>> On 09/12/2012 04:10 PM, Tom Warren wrote:
>>> Signed-off-by: Tom Warren 
>>> ---
>>>  board/nvidia/common/board.c |   27 ++-
>>>  1 files changed, 26 insertions(+), 1 deletions(-)
>>
>> Common code:-) :-) But ...
>>
>>> diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
>>
>>> +#ifdef CONFIG_TEGRA30
>>> +#include "../cardhu/pinmux-config-common.h"
>>> +#endif
>>
>> Not all Tegra30 will be Cardhu...
>>
>> Given this is really board-specific, shouldn't the following be an empty
>> weak definition:
>>
>>> +/*
>>> + * Routine: pinmux_init
>>> + * Description: Do individual peripheral pinmux configs
>>> + */
>>> +static void pinmux_init(void)
>>> +{
>>> +#if defined(CONFIG_TEGRA30)
>>> + pinmux_config_table(tegra3_pinmux_common,
>>> + ARRAY_SIZE(tegra3_pinmux_common));
>>> +
>>> + pinmux_config_table(unused_pins_lowpower,
>>> + ARRAY_SIZE(unused_pins_lowpower));
>>> +#endif
>>> +}
>>
>> ... and the function be overridden in board files as needed?
>>
>> If we are moving to a model of a single function that sets up the entire
>> pin mux at boot (which seems fine to me, and could eventually be driven
>> by DT if it happened late enough), then it seems like we wouldn't need
>> e.g. pin_mux_mmc() or pin_mux_usb() any more.
>
> While the fdt may eventually remove this discussion, I don't think
> forcing a one-time pinmux init is the best idea. Some peripherals will
> not be needed on every boot (e.g. normally boot from eMMC unless USB
> is available). Some peripherals may want to change their config based
> on run-time settings (although this is unlikely I suppose,
> particularly if we have the fdt).

I've been basically adapting our internal T30 U-Boot code to fit
within the framework of what's upstream, including Allen's SPL reorg.
Pinmux on our T30 codebase (including the Chromium U-Boot code, I
believe) was done in a single monolithic file, as demonstrated in this
patch. The advantages are that you can construct the table to ensure
there are no conflicts, no small task with 4 options per mux and over
100 muxes. Even the HW power-on defaults have conflicts.  The only
exception in this patchset was the UART muxing, so we can start
putting out debug/status spew to the console as early as possible.

As far as I'm aware, an FDT pinmux for Tegra (which is on my plate,
but quite a bit behind T30) would be essentially the same deal - one
large list of mux settings per build/board.

Also, we've had bugs submitted by the kernel guys at times because
U-Boot didn't do _enough_ init. While I agree with the U-Boot
philosophy of doing just what's necessary to get a kernel loaded, I
don't consider pinmux init from a table as a time-consuming or
code-intensive operation, and see no harm in leaving it in. The driver
can always remap the muxes as it chooses at a later date, based on
what it discovers or knows from its config or the DT.

Thanks,

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


Re: [U-Boot] [PATCH 2/2] Add unlzo command

2012-09-18 Thread Joe Hershberger
Hi Mike,

On Fri, Aug 17, 2012 at 6:26 PM, Mike Frysinger  wrote:
> On Friday 17 August 2012 16:59:44 Joe Hershberger wrote:
>> --- a/common/Makefile
>> +++ b/common/Makefile
>>
>>  ifdef CONFIG_LZMA
>>  COBJS-$(CONFIG_CMD_UNLZMA) += cmd_unlzma.o
>>  endif
>> +ifdef CONFIG_LZO
>> +COBJS-$(CONFIG_CMD_UNLZO) += cmd_unlzo.o
>> +endif
>
> imo, these ifdefs shouldn't exist.  the commands shouldn't get silently
> ignored because someone omitted an option.  add an #ifdef check to the .c file
> and have it #error out if the necessary config options aren't defined.

OK

>> --- /dev/null
>> +++ b/common/cmd_unlzo.c
>>
>> +int do_unlzo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
> static

OK

>> + ret = lzop_decompress((void *)src, src_len, (void *)dst, &dst_len);
>> + if (ret != LZO_E_OK) {
>> + printf("unlzo: uncompress or overwrite error %d\n", ret);
>> + return -1;
>
> how about returning ret ?

OK

>> + sprintf(buf, "%lX", (unsigned long) dst_len);
>> + setenv("filesize", buf);
>
> setenv_ulong() ?

OK

>> +U_BOOT_CMD(
>> + unlzo,  5,  1,  do_unlzo,
>> + "unlzo a memory region",
>> + "srcaddr srcsize dstaddr [dstsize]"
>> +);
>
> isn't there a way you could "stream" this so you don't need the srcsize ?  or
> does the lzop API not support that ?

The lzo API uses the source size to check if the input is complete at
the end of the file.  I could pass in ~0 optionally and it would stop
at the end.  (It's not as clear how unlzma will handle it.)

So it would look like "unlzo srcaddr dstaddr [dstsize]"

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


Re: [U-Boot] [GIT PULL] mpc83xx: mpc8308rdb enhancements

2012-09-18 Thread Kim Phillips
On Tue, 18 Sep 2012 07:57:08 -0700
Tom Rini  wrote:

> On 09/17/12 20:09, Ira W. Snyder wrote:
> > Go ahead and drop the patch "spansion: add support for S25FL256S1"
> > from the series. The rest should apply without any trouble.
> > 
> > Michal Simek beat me to it in "sf: spansion: Add support for
> > S25FL256S" (4a4cb4e1114). He got the idcode1 wrong (it should be
> > 0x0219 instead of 0x2019), but I saw a followup patch on the
> > mailing list to fix it.
> 
> This is good to know.  My preference however is for a new pull request
> with whatever corrections Kim deems necessary.  Thanks!

rebased on current master, with Ira's spansion patch omitted.
Please pull:

The following changes since commit 037e9d33db9fc86c1e671d64077b2d1a19df7f24:

  Merge branch 'master' of git://git.denx.de/u-boot-i2c (2012-09-17 11:39:03 
-0700)

are available in the git repository at:

  git://git.denx.de/u-boot-mpc83xx.git master

for you to fetch changes up to db1fc7d28e8947c402149ded4597970fdb3e5571:

  mpc8308rdb: add support for eSDHC MMC controller (2012-09-18 16:16:45 -0500)


Ira W. Snyder (4):
  mpc8xxx_spi: fix SPI support on MPC8308RDB
  mpc8308rdb: add support for Spansion SPI flash on header J8
  mpc8308rdb: add support for FIT images
  mpc8308rdb: add support for eSDHC MMC controller

 board/freescale/mpc8308rdb/mpc8308rdb.c | 58 +
 drivers/spi/mpc8xxx_spi.c   |  4 +++
 include/configs/MPC8308RDB.h| 31 ++
 3 files changed, 93 insertions(+)

Thanks,

Kim

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


Re: [U-Boot] [PATCH 7/9] Tegra30: Add config files (common and Cardhu)

2012-09-18 Thread Tom Warren
Simon,

On Tue, Sep 18, 2012 at 12:46 PM, Simon Glass  wrote:
> Hi Tom,
>
> On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
>> Signed-off-by: Tom Warren 
>> ---
>>  include/configs/cardhu.h |   52 +++
>>  include/configs/tegra30-common.h |  188 
>> ++
>>  2 files changed, 240 insertions(+), 0 deletions(-)
>>  create mode 100644 include/configs/cardhu.h
>>  create mode 100644 include/configs/tegra30-common.h
>>
>> diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
>> new file mode 100644
>> index 000..bfadbff
>> --- /dev/null
>> +++ b/include/configs/cardhu.h
>> @@ -0,0 +1,52 @@
>> +/*
>> + *  (C) Copyright 2010-2012
>> + *  NVIDIA Corporation 
>> + *
>> + * 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
>> + */
>> +
>> +#ifndef __CONFIG_H
>> +#define __CONFIG_H
>> +
>> +#include 
>> +
>> +#include "tegra30-common.h"
>> +
>> +/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */
>> +#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu
>> +#define CONFIG_OF_CONTROL
>> +#define CONFIG_OF_SEPARATE
>> +
>> +/* High-level configuration options */
>> +#define V_PROMPT   "Tegra30 (Cardhu) # "
>> +#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Cardhu"
>> +
>> +/* Board-specific serial config */
>> +#define CONFIG_SERIAL_MULTI
>> +#define CONFIG_TEGRA_ENABLE_UARTA
>> +#define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
>> +
>> +#define CONFIG_MACH_TYPE   MACH_TYPE_CARDHU
>> +
>> +#define CONFIG_BOARD_EARLY_INIT_F
>> +#define CONFIG_ENV_IS_NOWHERE
>> +
>> +#include "tegra-common-post.h"
>> +
>> +#endif /* __CONFIG_H */
>> diff --git a/include/configs/tegra30-common.h 
>> b/include/configs/tegra30-common.h
>> new file mode 100644
>> index 000..b23823d
>> --- /dev/null
>> +++ b/include/configs/tegra30-common.h
>> @@ -0,0 +1,188 @@
>> +/*
>> + *  (C) Copyright 2010-2012
>> + *  NVIDIA Corporation 
>> + *
>> + * 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
>> + */
>> +
>> +#ifndef __TEGRA30_COMMON_H
>> +#define __TEGRA30_COMMON_H
>> +#include 
>> +
>> +/*
>> + * QUOTE(m) will evaluate to a string version of the value of the macro m
>> + * passed in.  The extra level of indirection here is to first evaluate the
>> + * macro m before applying the quoting operator.
>> + */
>> +#define QUOTE_(m)   #m
>> +#define QUOTE(m)QUOTE_(m)
>> +
>> +/*
>> + * High Level Configuration Options
>> + */
>> +#define CONFIG_ARMCORTEXA9 /* This is an ARM V7 CPU core */
>> +#define CONFIG_TEGRA30 /* in a NVidia Tegra30 core */
>> +#define CONFIG_TEGRA   /* which is a Tegra generic machine 
>> */
>> +#define CONFIG_SYS_L2CACHE_OFF /* No L2 cache */
>> +
>> +#define CONFIG_SYS_CACHELINE_SIZE  32
>> +
>> +#include   /* get chip and board defs */
>> +
>> +/*
>> + * Display CPU and Board information
>> + */
>> +#define CONFIG_DISPLAY_CPUINFO
>> +#define CONFIG_DISPLAY_BOARDINFO
>> +
>> +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
>> +#define CONFIG_OF_LIBFDT   /* enable passing of devicetree */
>
> Do you think there should be a tegra-common.h, included by
> tegra20-common and tegra30-common? That was the approach we talk in
> the Chromium tree.

There can be. There's already a tegra-common-post.h header for boot
stuff. I

Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Marek Vasut
Dear Simon Glass,

> Hi,
> 
> On Tue, Sep 18, 2012 at 1:04 PM, Thierry Reding
> 
>  wrote:
> > On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
> >> Dear Thierry Reding,
> >> 
> >> [...]
> >> 
> >> > > Sure, but after you apply the bounce buffer, you can safely
> >> > > invalidate the whole cacheline, so align it up and be done with it.
> >> > 
> >> > That's what I proposed to do last time around but it was NAK'ed.
> >> 
> >> By who?
> > 
> > I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
> > valid reason, so I'm not complaining.
> > 
> >> > At the
> >> > time I didn't ensure that the buffer was actually big enough, which is
> >> > why people didn't like it (data on the stack after the DMA buffer
> >> > might be invalidated as well).
> >> 
> >> Correct, thus the bounce buffer.
> > 
> > I don't think we even need the bounce buffer. All that needs to be done
> > is guarantee that the buffers passed to the MMC driver are properly
> > aligned and sized.
> > 
> > Thierry
> 
> Perhaps a point to make here is that we really don't want every driver
> (or even driver stack) implementing bounce buffers to when it is not a
> huge effort to change the code that calls them (typically filesystem
> code) to do the right thing. The code will be smaller and more
> efficient if the alignment issues are dealt with at source IMO.

You need the BB for user-case, when user gives you misaligned buffer.

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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Marek Vasut
Dear Thierry Reding,

> On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
> > Dear Thierry Reding,
> > 
> > [...]
> > 
> > > > Sure, but after you apply the bounce buffer, you can safely
> > > > invalidate the whole cacheline, so align it up and be done with it.
> > > 
> > > That's what I proposed to do last time around but it was NAK'ed.
> > 
> > By who?
> 
> I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
> valid reason, so I'm not complaining.
> 
> > > At the
> > > time I didn't ensure that the buffer was actually big enough, which is
> > > why people didn't like it (data on the stack after the DMA buffer might
> > > be invalidated as well).
> > 
> > Correct, thus the bounce buffer.
> 
> I don't think we even need the bounce buffer. All that needs to be done
> is guarantee that the buffers passed to the MMC driver are properly
> aligned and sized.

If you resize the MMC structures and call sizeof() on them to get the size of 
the transfer, the MMC won't work correctly anymore.

> Thierry

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 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On 09/18/12 12:25, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 12:19, Marek Vasut wrote:
> >>> Dear Tom Rini,
> >>> 
>  On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
>  
>  [snip]
>  
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at
> >> compile time (not pointed to a stub at link time) on an
> >> SPL that has no output support, but once that's done the
> >> low level serial functions shouldn't be referenced
> >> anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler
> > will GC these useless stubs anyway. But wait, we're getting
> > to LTO here, right?
> > 
> > So the safest bet really is macro in serial.h ?
>  
>  Due to the gcc bug I've mentioned before, yes.  Dummy
>  functions will, I bet, keep the string constants around.  do
>  {} while(0) will drop them out entirely.
> >>> 
> >>> Damn, not much gain on m28evk (with C functionss/with macros),
> >>> using gcc 4.7.1:
> >>> 
> >>> Configuring for m28evk board... textdata bss dec
> >>> hex filename 4189947780  288632  715406   aea8e ./u-boot
> >>> 11773 788 12   12573311d ./spl/u-boot-spl
> >>> 
> >>> Configuring for m28evk board... textdata bss dec
> >>> hex filename 4189987780  288628  715406   aea8e ./u-boot
> >>> 11765 788 12   125653115 ./spl/u-boot-spl
> >> 
> >> Right, didn't have many strings.  But do you see what I mean now
> >> about not needing this patch as it stands currently?
> > 
> > No, I don't. If I remove this patch, the build breaks either
> > because serial_* is defined twice or not defined at all.
> 
> m28evk currently, needlessly, defines serial_puts/putc.  I locally
> patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
> and the references in common/libcommon.o are correctly
> garbage-collected.  They are in fact unused functions today as they're
> garbage collected without patching, see spl/u-boot-spl.map after
> building.

I'd love to, this is what I get with my patchset when I remove the #ifdef from 
serial.c:

$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- ./MAKEALL m28evk
Configuring for m28evk board...
make[1]: *** [/home/marex/U-Boot/u-boot-marex/spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl.bin] Error 2
arm-linux-gnueabi-size: './u-boot': No such file
common/libcommon.o: In function `get_current':
/home/marex/U-Boot/u-boot-marex/common/serial.c:229: undefined reference to 
`default_serial_console'
make[1]: *** [/home/marex/U-Boot/u-boot-marex/spl/u-boot-spl] Error 1
make: *** [spl/u-boot-spl.bin] Error 2
make: *** Waiting for unfinished jobs

So someone still has to implement default_serial_console() call. Is that fine ?

> So again I say, if common/serial.o is NOT being discard in
> your series on m28evk there is a bug in your series to fix or a change
> to better understand and document

Ok, I spent hours documenting this series. What else is there to document?

Besides, my team is starting to collect dead weight and we're running behind 
the 
schedule a lot ... I'm fucked, I'm desperate and I really don't know what to do 
anymore. Pardon if I'm a bit unpleasant to deal with recently.

> (and then see if we can change since
> as Scott notes, this needs to work for 4kb boards and that is tight).

What exactly are the 4k boards?

One more question -- if I have two __weak functions and one non-weak, the non-
weak wins and noone complains, right?

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 2/9] Tegra: T30: Add AVP (arm720t) files

2012-09-18 Thread Tom Warren
Simon,

On Tue, Sep 18, 2012 at 12:37 PM, Simon Glass  wrote:
> Hi Tom,
>
> On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
>> Signed-off-by: Tom Warren 
>> ---
>>  arch/arm/cpu/arm720t/tegra30/Makefile  |   48 +++
>>  arch/arm/cpu/arm720t/tegra30/board.h   |   25 ++
>>  arch/arm/cpu/arm720t/tegra30/config.mk |   26 ++
>>  arch/arm/cpu/arm720t/tegra30/cpu.c |  570 
>> 
>>  arch/arm/cpu/arm720t/tegra30/cpu.h |   65 
>>  arch/arm/cpu/arm720t/tegra30/spl.c |  132 
>
> It certainly has complicated your work, with the AVP arm720t refactor
> going in before these patches.

In some ways, yes. In others, it made it easy to first get a SPL (AVP)
U-Boot up and printing its sign-on, and then having a base to work
from/debug A9 code for the second, CPU-init half.
>
> I feel that quite a bit of the code here should perhaps go to
> arch/arm/cpu/arm720t/tegra-common or similar, so that you can share it
> with tegra30.

WIP.  There'll be an arch/arm/cpu/arm720t/tegra-common, an
arch/arm/cpu/armv7/tegra-common, and even an
arch/arm/cpu/tegra-common, plus an arch/arm/include/asm/arch-tegra to
hold common code & include files.

How those changes will be captured in a patchset (or 2) that show the
movement of the original Tegra20 files, then the copy/edit for Tegra30
is still to be seen.

Thanks,

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


Re: [U-Boot] [PATCH 1/9] Tegra: T30: Add include files

2012-09-18 Thread Tom Warren
Simon,

On Tue, Sep 18, 2012 at 12:29 PM, Simon Glass  wrote:
> Hi Tom,
>
> On Thu, Sep 13, 2012 at 2:10 PM, Tom Warren  wrote:
>> Tom,
>>
>> On Thu, Sep 13, 2012 at 11:06 AM, Tom Rini  wrote:
>>> On Wed, Sep 12, 2012 at 03:10:47PM -0700, Tom Warren wrote:
>>>
 Signed-off-by: Tom Warren 
>>>
>>> A few things:
>>> - I see some #define FOO[space][space]val that should be [tab]
>>
>> Probably copied over from Tegra20 files. I'll turn on whitespace
>> highlighting in my editor and fix 'em up.
>>
>>> - I didn't checkpatch.pl this (nor the whole series) but please do and
>>>   let us know if it's clean or why the warnings are false positives.
>>
>> I always run checkpath before submitting. I'll put a notice to that
>> affect in the next version. Checkpatch ran clean w/only 1
>> false-positive about 'macros with complex values should be enclosed in
>> parenthesis' for the "#define CONFIG_DEFAULT_DEVICE_TREE
>> tegra30-cardhu" line in cardhu.h.
>>
>>> - My preference is to bring in includes and C files and Makefiles and so
>>>   on all at once, when each is needed / useful.  YMMV and not a big
>>>   deal.
>>> - But please make sure that you aren't adding defines / structs / etc
>>>   that aren't used at some point by the end of the series at least.
>>>   Removing (and correcting!) structs and defines was one of the things I
>>>   had to do on am33xx.  If it wasn't added until the corresponding
>>>   driver work was being pushed, it'd have saved me some time.
>>>
>>
>> Sure, and that's good advice. I took a couple of passes during the
>> port to try and remove vestigial and/or useless/unsupported files,
>> features, and code, but I'm sure I missed some (as Stephen has already
>> pointed out). I'll address those in V2.
>
> Congrats on getting this out. It is a lot of work!
>
> In the Chromium tree, we have an arch-tegra directory where a lot of
> the common code lives. It sounds like you are going to split that out
> a bit which is good. I suspect you may also want a few patches to move
> quite a bit of the code in arch/arm/include/arch-tegra20 to
> arch/arm/include/arch-tegra.

As per a side-discussion with TomR and StephenW, I am in the process
of recasting this T30 patchset as a move to common Tegra code. It'll
mimic quite a lot of the Chromium U-Boot directory structure, I'm
sure.

Thanks,

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


[U-Boot] [PATCH] am33xx: Fix fetching of mmc1 bootmode from bootrom for AM33XX

2012-09-18 Thread Joel A Fernandes
U-boot should not ignore getting the bootmode passed on from the bootrom.
With this, U-boot SPL knows it was loaded from MMC1 and use this info to
read full U-boot from MMC1 as well.

Cc: pprak...@ti.com
Cc: tr...@ti.com
Signed-off-by: Joel A Fernandes 
---
 arch/arm/cpu/armv7/omap-common/lowlevel_init.S |6 --
 arch/arm/include/asm/omap_common.h |9 +++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S 
b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
index 1ece073..665bab7 100644
--- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
+++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S
@@ -26,7 +26,9 @@
  * MA 02111-1307 USA
  */
 
+#include 
 #include 
+#include 
 #include 
 
 ENTRY(save_boot_params)
@@ -59,9 +61,9 @@ ENTRY(save_boot_params)
strbr2, [r3, #BOOT_DEVICE_OFFSET]   @ omap_boot_device <- r1
 
/* boot mode is passed only for devices that can raw/fat mode */
-   cmp r2, #2
+   cmp r2, #BOOT_DEVICE_XIP
blt 2f
-   cmp r2, #7
+   cmp r2, #BOOT_DEVICE_MMC2
bgt 2f
/* Store the boot mode (raw/FAT) in omap_boot_mode */
ldr r2, [r0, #DEV_DESC_PTR_OFFSET]  @ get the device descriptor ptr
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 71ef9b0..557fb5c 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -34,8 +34,6 @@
 #define OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL  2
 #define OMAP_INIT_CONTEXT_UBOOT_AFTER_CH   3
 
-void preloader_console_init(void);
-
 /* Boot device */
 #ifdef CONFIG_OMAP54XX
 #define BOOT_DEVICE_NONE0
@@ -65,6 +63,7 @@ void preloader_console_init(void);
 #define BOOT_DEVICE_XIPWAIT7
 #define BOOT_DEVICE_MMC2_2  0xFF
 #elif defined(CONFIG_AM33XX)   /* AM33XX */
+#define BOOT_DEVICE_XIP2
 #define BOOT_DEVICE_NAND   5
 #define BOOT_DEVICE_MMC1   8
 #define BOOT_DEVICE_MMC2   9 /* eMMC or daughter card */
@@ -78,6 +77,8 @@ void preloader_console_init(void);
 #define MMCSD_MODE_FAT 2
 #define NAND_MODE_HW_ECC   3
 
+#ifndef __ASSEMBLY__
+
 struct spl_image_info {
const char *name;
u8 os;
@@ -137,4 +138,8 @@ static inline u32 omap_revision(void)
 #define OMAP5430_SILICON_ID_INVALID0
 #define OMAP5430_ES1_0 0x54300100
 #define OMAP5432_ES1_0 0x54320100
+
+void preloader_console_init(void);
+
+#endif
 #endif /* _OMAP_COMMON_H_ */
-- 
1.7.9.5

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


[U-Boot] [PATCH] AM335X: Set fdt_high for AM335X devices to enable booting with Device Tree

2012-09-18 Thread Vaibhav Hiremath
For AM335X boards, such as the EVM and Bone Linux kernel fails to
locate the device tree blob on boot. The reason being is that
u-boot is copying the DT blob to the upper part of RAM when booting
the kernel and the kernel is unable to access the blob.
By setting the fdt_high variable to 0x (to prevent the copy)
the kernel is able to locate the DT blob and boot.

This patch is tested on BeagleBone platform.

Signed-off-by: Vaibhav Hiremath 
Cc: Tom Rini 
---
 include/configs/am335x_evm.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index a3752bc..1af9b97 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -49,6 +49,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=0x8020\0" \
"fdtaddr=0x80F8\0" \
+   "fdt_high=0x\0" \
"rdaddr=0x8100\0" \
"bootfile=/boot/uImage\0" \
"console=ttyO0,115200n8\0" \
-- 
1.7.0.4

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


Re: [U-Boot] [PATCH v3 09/11] S3C24XX: Add NAND Flash driver

2012-09-18 Thread Scott Wood

On 09/18/2012 01:48:09 PM, José Miguel Gonçalves wrote:

On 18-09-2012 19:30, Scott Wood wrote:

On 09/18/2012 01:22:58 PM, José Miguel Gonçalves wrote:

On 18-09-2012 19:02, Scott Wood wrote:

Please consider using the new SELF_INIT mechanism.



Can you explain and/or point_to_resources for what this means (I'm  
a U-Boot newbie)...


See CONFIG_SYS_NAND_SELF_INIT in doc/README.nand

I'd like the old way to be removed at some point.


From what I've seen there is an incompatibility between the SPL  
simple nand driver and the SELF_INIT mechanism.
The nand_init() function in drivers/mtd/nand/nand_spl_simple.c calls  
board_nand_init() with a pointer to a struct nand_chip as an argument  
(the old way). This needs to be changed to be able to use that SPL  
driver. Can you give me an hint on the proper way to handle this?


Hmm... yes, this will need some work.  Go ahead and leave it for now.

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


Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/18/12 12:25, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 12:19, Marek Vasut wrote:
>>> Dear Tom Rini,
>>> 
 On 09/18/12 11:33, Marek Vasut wrote:
> Dear Scott Wood,
 
 [snip]
 
>> I think I got some wires crossed and was thinking about 
>> printf/puts. We want those to be optimized away at
>> compile time (not pointed to a stub at link time) on an
>> SPL that has no output support, but once that's done the
>> low level serial functions shouldn't be referenced
>> anymore, right?
> 
> But if you point them to stubs, that's OK. The compiler
> will GC these useless stubs anyway. But wait, we're getting
> to LTO here, right?
> 
> So the safest bet really is macro in serial.h ?
 
 Due to the gcc bug I've mentioned before, yes.  Dummy
 functions will, I bet, keep the string constants around.  do
 {} while(0) will drop them out entirely.
>>> 
>>> Damn, not much gain on m28evk (with C functionss/with macros), 
>>> using gcc 4.7.1:
>>> 
>>> Configuring for m28evk board... textdata bss dec
>>> hex filename 4189947780  288632  715406   aea8e ./u-boot
>>> 11773 788 12   12573311d ./spl/u-boot-spl
>>> 
>>> Configuring for m28evk board... textdata bss dec
>>> hex filename 4189987780  288628  715406   aea8e ./u-boot
>>> 11765 788 12   125653115 ./spl/u-boot-spl
>> 
>> Right, didn't have many strings.  But do you see what I mean now
>> about not needing this patch as it stands currently?
> 
> No, I don't. If I remove this patch, the build breaks either
> because serial_* is defined twice or not defined at all.

m28evk currently, needlessly, defines serial_puts/putc.  I locally
patched master to drop them from arch/arm/cpu/arm926ejs/mxs/spl_boot.c
and the references in common/libcommon.o are correctly
garbage-collected.  They are in fact unused functions today as they're
garbage collected without patching, see spl/u-boot-spl.map after
building.  So again I say, if common/serial.o is NOT being discard in
your series on m28evk there is a bug in your series to fix or a change
to better understand and document (and then see if we can change since
as Scott notes, this needs to work for 4kb boards and that is tight).

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWN59AAoJENk4IS6UOR1WtG0P/iYMxTtr0X/F6RRhZ9sLlSNt
pj6o+MTd9eO4e64+0A/jyXDuFd9NBvYdsjBKz8iyQFOrUYAyCdKdl+MZ+E3sD57O
gHKVXcfnMS2jnXTvKMabn4Ddjl8FVjLz+YGXFcwqBpcN5KjuyRKJnl4jntrj8QgK
1d9aqYwnQcMbP36ApPS1WRGotAlydhmL9Bw++ebk+j28iBs1KZWiFK1RUCYc1b5T
bverqK4EQTMxOh8KJNvGs5J61bO1BUA3fWHv2kzKo4XEr+XjRkoFVXDb1Tjf1Xlw
ZDaaky+zyq7D4zwZUFJxseDN7dBTuAYNoYj5UhYvkbTO04s60vKzhyuLMDWxyHrx
ABrmisfWB44K6sjQKZUTBvO6gajA8fe9kTg/uaMaG+9h9xyM0oNBfDmDd7/CK6PE
Mi7q9TJ7cOh1DgHrzSrLaO8n5cam4B3XecLH5Rj1uOA5HHCnKExIxWTdeEg4w63b
VQVdgQ7g/2x8TINdjz9oo1B79n+yHlmIHzc64ZNnBAJhVDKM9h9h6FarAvfwLM1B
Ns/vUCrM17vsaduNcvD0ZGDZSk4MOc8dfPLqfLe9rzFH4VAEmTV8qEaFjnbeORiD
jknV1mLAYD1A/eu1AHdwE58OgPgCTKyYxLA4bE/Yldxy1L+E5DUx+nmOnrCNWPPm
dqdGjBg7P4HHZo2mw6oZ
=QI/g
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Simon Glass
Hi,

On Tue, Sep 18, 2012 at 1:04 PM, Thierry Reding
 wrote:
> On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
>> Dear Thierry Reding,
>>
>> [...]
>>
>> > > Sure, but after you apply the bounce buffer, you can safely invalidate
>> > > the whole cacheline, so align it up and be done with it.
>> >
>> > That's what I proposed to do last time around but it was NAK'ed.
>>
>> By who?
>
> I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
> valid reason, so I'm not complaining.
>
>> > At the
>> > time I didn't ensure that the buffer was actually big enough, which is
>> > why people didn't like it (data on the stack after the DMA buffer might
>> > be invalidated as well).
>>
>> Correct, thus the bounce buffer.
>
> I don't think we even need the bounce buffer. All that needs to be done
> is guarantee that the buffers passed to the MMC driver are properly
> aligned and sized.
>
> Thierry

Perhaps a point to make here is that we really don't want every driver
(or even driver stack) implementing bounce buffers to when it is not a
huge effort to change the code that calls them (typically filesystem
code) to do the right thing. The code will be smaller and more
efficient if the alignment issues are dealt with at source IMO.

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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Thierry Reding
On Tue, Sep 18, 2012 at 09:36:18PM +0200, Marek Vasut wrote:
> Dear Thierry Reding,
> 
> [...]
> 
> > > Sure, but after you apply the bounce buffer, you can safely invalidate
> > > the whole cacheline, so align it up and be done with it.
> > 
> > That's what I proposed to do last time around but it was NAK'ed.
> 
> By who?

I think it was Simon Glass and Mike Frysinger. They NAK'ed it for very
valid reason, so I'm not complaining.

> > At the
> > time I didn't ensure that the buffer was actually big enough, which is
> > why people didn't like it (data on the stack after the DMA buffer might
> > be invalidated as well).
> 
> Correct, thus the bounce buffer.

I don't think we even need the bounce buffer. All that needs to be done
is guarantee that the buffers passed to the MMC driver are properly
aligned and sized.

Thierry


pgpyI5NerfSbU.pgp
Description: PGP signature
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/2] net: Netconsole port configuration and filtering

2012-09-18 Thread Joe Hershberger
This series depends on this patch:
http://patchwork.ozlabs.org/patch/174282/

Changes in v2:
- Made string pointer const

Joe Hershberger (2):
  net: Allow netconsole settings to change after nc_start
  net: Filter incoming netconsole packets by IP

 drivers/net/netconsole.c | 104 ---
 include/net.h|   3 +-
 net/net.c|   1 +
 3 files changed, 74 insertions(+), 34 deletions(-)

-- 
1.7.11.5

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


[U-Boot] [PATCH 1/2] net: Allow netconsole settings to change after nc_start

2012-09-18 Thread Joe Hershberger
Refresh the netconsole settings from the env before each packet instead
of only on netconsole init.

Signed-off-by: Joe Hershberger 
---
Changes in v2:
- Made string pointer const

 drivers/net/netconsole.c | 96 
 1 file changed, 65 insertions(+), 31 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 86f5301..2e25fd5 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -60,8 +60,69 @@ static void nc_timeout(void)
net_set_state(NETLOOP_SUCCESS);
 }
 
+static int is_broadcast(IPaddr_t ip)
+{
+   static IPaddr_t netmask;
+   static IPaddr_t our_ip;
+   static int env_changed_id;
+   int env_id = get_env_id();
+
+   /* update only when the environment has changed */
+   if (env_changed_id != env_id) {
+   netmask = getenv_IPaddr("netmask");
+   our_ip = getenv_IPaddr("ipaddr");
+
+   env_changed_id = env_id;
+   }
+
+   return (ip == ~0 || /* 255.255.255.255 */
+   ((netmask & our_ip) == (netmask & ip) &&/* on the same net */
+   (netmask | ip) == ~0)); /* broadcast to our net */
+}
+
+static int refresh_settings_from_env(void)
+{
+   const char *p;
+   static int env_changed_id;
+   int env_id = get_env_id();
+
+   /* update only when the environment has changed */
+   if (env_changed_id != env_id) {
+   if (getenv("ncip")) {
+   nc_ip = getenv_IPaddr("ncip");
+   if (!nc_ip)
+   return -1;  /* ncip is 0.0.0.0 */
+   p = strchr(getenv("ncip"), ':');
+   if (p != NULL) {
+   nc_out_port = simple_strtoul(p + 1, NULL, 10);
+   nc_in_port = nc_out_port;
+   }
+   } else
+   nc_ip = ~0; /* ncip is not set, so broadcast */
+
+   p = getenv("ncoutport");
+   if (p != NULL)
+   nc_out_port = simple_strtoul(p, NULL, 10);
+   p = getenv("ncinport");
+   if (p != NULL)
+   nc_in_port = simple_strtoul(p, NULL, 10);
+
+   if (is_broadcast(nc_ip))
+   /* broadcast MAC address */
+   memset(nc_ether, 0xff, sizeof(nc_ether));
+   else
+   /* force arp request */
+   memset(nc_ether, 0, sizeof(nc_ether));
+   }
+   return 0;
+}
+
+/**
+ * Called from NetLoop in net/net.c before each packet
+ */
 void NcStart(void)
 {
+   refresh_settings_from_env();
if (!output_packet_len || memcmp(nc_ether, NetEtherNullAddr, 6)) {
/* going to check for input packet */
net_set_udp_handler(nc_handler);
@@ -148,41 +209,14 @@ static void nc_send_packet(const char *buf, int len)
 
 static int nc_start(void)
 {
-   int netmask, our_ip;
-   char *p;
+   int retval;
 
nc_out_port = ; /* default port */
nc_in_port = nc_out_port;
 
-   if (getenv("ncip")) {
-
-   nc_ip = getenv_IPaddr("ncip");
-   if (!nc_ip)
-   return -1;  /* ncip is 0.0.0.0 */
-   p = strchr(getenv("ncip"), ':');
-   if (p != NULL) {
-   nc_out_port = simple_strtoul(p + 1, NULL, 10);
-   nc_in_port = nc_out_port;
-   }
-   } else
-   nc_ip = ~0; /* ncip is not set, so broadcast */
-
-   p = getenv("ncoutport");
-   if (p != NULL)
-   nc_out_port = simple_strtoul(p, NULL, 10);
-   p = getenv("ncinport");
-   if (p != NULL)
-   nc_in_port = simple_strtoul(p, NULL, 10);
-
-   our_ip = getenv_IPaddr("ipaddr");
-   netmask = getenv_IPaddr("netmask");
-
-   if (nc_ip == ~0 ||  /* 255.255.255.255 */
-   ((netmask & our_ip) == (netmask & nc_ip) && /* on the same net */
-   (netmask | nc_ip) == ~0))   /* broadcast to our net */
-   memset(nc_ether, 0xff, sizeof(nc_ether));
-   else
-   memset(nc_ether, 0, sizeof(nc_ether));  /* force arp request */
+   retval = refresh_settings_from_env();
+   if (retval != 0)
+   return retval;
 
/*
 * Initialize the static IP settings and buffer pointers
-- 
1.7.11.5

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


[U-Boot] [PATCH 2/2] net: Filter incoming netconsole packets by IP

2012-09-18 Thread Joe Hershberger
Check the incoming packets' source IP address... if ncip isn't set to a
broadcast address, only listen to the client at ncip.


Signed-off-by: Joe Hershberger 
---

 drivers/net/netconsole.c | 8 ++--
 include/net.h| 3 ++-
 net/net.c| 1 +
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 2e25fd5..b0cc81c 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -138,13 +138,17 @@ void NcStart(void)
}
 }
 
-int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len)
+int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+   unsigned src_port, unsigned len)
 {
int end, chunk;
 
-   if (dest != nc_in_port || !len)
+   if (dest_port != nc_in_port || !len)
return 0; /* not for us */
 
+   if (src_ip != nc_ip && !is_broadcast(nc_ip))
+   return 0; /* not from our client */
+
debug_cond(DEBUG_DEV_PKT, "input: \"%*.*s\"\n", len, len, pkt);
 
if (input_size == sizeof(input_buffer))
diff --git a/include/net.h b/include/net.h
index 6d2d6cd..f0cf2ee 100644
--- a/include/net.h
+++ b/include/net.h
@@ -529,7 +529,8 @@ extern void NetReceive(uchar *, int);
 
 #ifdef CONFIG_NETCONSOLE
 void NcStart(void);
-int nc_input_packet(uchar *pkt, unsigned dest, unsigned src, unsigned len);
+int nc_input_packet(uchar *pkt, IPaddr_t src_ip, unsigned dest_port,
+   unsigned src_port, unsigned len);
 #endif
 
 /*
diff --git a/net/net.c b/net/net.c
index e8ff066..83fcbe5 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1147,6 +1147,7 @@ NetReceive(uchar *inpkt, int len)
 
 #ifdef CONFIG_NETCONSOLE
nc_input_packet((uchar *)ip + IP_UDP_HDR_SIZE,
+   ntohl(ip->ip_src),
ntohs(ip->udp_dst),
ntohs(ip->udp_src),
ntohs(ip->udp_len) - UDP_HDR_SIZE);
-- 
1.7.11.5

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


Re: [U-Boot] [PATCH 8/9] Tegra30: Add common pinmux config in board_early_init_f

2012-09-18 Thread Simon Glass
Hi,

On Thu, Sep 13, 2012 at 3:37 PM, Stephen Warren  wrote:
> On 09/12/2012 04:10 PM, Tom Warren wrote:
>> Signed-off-by: Tom Warren 
>> ---
>>  board/nvidia/common/board.c |   27 ++-
>>  1 files changed, 26 insertions(+), 1 deletions(-)
>
> Common code:-) :-) But ...
>
>> diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
>
>> +#ifdef CONFIG_TEGRA30
>> +#include "../cardhu/pinmux-config-common.h"
>> +#endif
>
> Not all Tegra30 will be Cardhu...
>
> Given this is really board-specific, shouldn't the following be an empty
> weak definition:
>
>> +/*
>> + * Routine: pinmux_init
>> + * Description: Do individual peripheral pinmux configs
>> + */
>> +static void pinmux_init(void)
>> +{
>> +#if defined(CONFIG_TEGRA30)
>> + pinmux_config_table(tegra3_pinmux_common,
>> + ARRAY_SIZE(tegra3_pinmux_common));
>> +
>> + pinmux_config_table(unused_pins_lowpower,
>> + ARRAY_SIZE(unused_pins_lowpower));
>> +#endif
>> +}
>
> ... and the function be overridden in board files as needed?
>
> If we are moving to a model of a single function that sets up the entire
> pin mux at boot (which seems fine to me, and could eventually be driven
> by DT if it happened late enough), then it seems like we wouldn't need
> e.g. pin_mux_mmc() or pin_mux_usb() any more.

While the fdt may eventually remove this discussion, I don't think
forcing a one-time pinmux init is the best idea. Some peripherals will
not be needed on every boot (e.g. normally boot from eMMC unless USB
is available). Some peripherals may want to change their config based
on run-time settings (although this is unlikely I suppose,
particularly if we have the fdt).

Regards,
Simon

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


Re: [U-Boot] [PATCH 7/9] Tegra30: Add config files (common and Cardhu)

2012-09-18 Thread Simon Glass
Hi Tom,

On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
> Signed-off-by: Tom Warren 
> ---
>  include/configs/cardhu.h |   52 +++
>  include/configs/tegra30-common.h |  188 
> ++
>  2 files changed, 240 insertions(+), 0 deletions(-)
>  create mode 100644 include/configs/cardhu.h
>  create mode 100644 include/configs/tegra30-common.h
>
> diff --git a/include/configs/cardhu.h b/include/configs/cardhu.h
> new file mode 100644
> index 000..bfadbff
> --- /dev/null
> +++ b/include/configs/cardhu.h
> @@ -0,0 +1,52 @@
> +/*
> + *  (C) Copyright 2010-2012
> + *  NVIDIA Corporation 
> + *
> + * 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
> + */
> +
> +#ifndef __CONFIG_H
> +#define __CONFIG_H
> +
> +#include 
> +
> +#include "tegra30-common.h"
> +
> +/* Enable fdt support for Cardhu. Flash the image in u-boot-dtb.bin */
> +#define CONFIG_DEFAULT_DEVICE_TREE tegra30-cardhu
> +#define CONFIG_OF_CONTROL
> +#define CONFIG_OF_SEPARATE
> +
> +/* High-level configuration options */
> +#define V_PROMPT   "Tegra30 (Cardhu) # "
> +#define CONFIG_TEGRA_BOARD_STRING  "NVIDIA Cardhu"
> +
> +/* Board-specific serial config */
> +#define CONFIG_SERIAL_MULTI
> +#define CONFIG_TEGRA_ENABLE_UARTA
> +#define CONFIG_SYS_NS16550_COM1NV_PA_APB_UARTA_BASE
> +
> +#define CONFIG_MACH_TYPE   MACH_TYPE_CARDHU
> +
> +#define CONFIG_BOARD_EARLY_INIT_F
> +#define CONFIG_ENV_IS_NOWHERE
> +
> +#include "tegra-common-post.h"
> +
> +#endif /* __CONFIG_H */
> diff --git a/include/configs/tegra30-common.h 
> b/include/configs/tegra30-common.h
> new file mode 100644
> index 000..b23823d
> --- /dev/null
> +++ b/include/configs/tegra30-common.h
> @@ -0,0 +1,188 @@
> +/*
> + *  (C) Copyright 2010-2012
> + *  NVIDIA Corporation 
> + *
> + * 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
> + */
> +
> +#ifndef __TEGRA30_COMMON_H
> +#define __TEGRA30_COMMON_H
> +#include 
> +
> +/*
> + * QUOTE(m) will evaluate to a string version of the value of the macro m
> + * passed in.  The extra level of indirection here is to first evaluate the
> + * macro m before applying the quoting operator.
> + */
> +#define QUOTE_(m)   #m
> +#define QUOTE(m)QUOTE_(m)
> +
> +/*
> + * High Level Configuration Options
> + */
> +#define CONFIG_ARMCORTEXA9 /* This is an ARM V7 CPU core */
> +#define CONFIG_TEGRA30 /* in a NVidia Tegra30 core */
> +#define CONFIG_TEGRA   /* which is a Tegra generic machine */
> +#define CONFIG_SYS_L2CACHE_OFF /* No L2 cache */
> +
> +#define CONFIG_SYS_CACHELINE_SIZE  32
> +
> +#include   /* get chip and board defs */
> +
> +/*
> + * Display CPU and Board information
> + */
> +#define CONFIG_DISPLAY_CPUINFO
> +#define CONFIG_DISPLAY_BOARDINFO
> +
> +#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
> +#define CONFIG_OF_LIBFDT   /* enable passing of devicetree */

Do you think there should be a tegra-common.h, included by
tegra20-common and tegra30-common? That was the approach we talk in
the Chromium tree.

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


Re: [U-Boot] [PATCH 6/9] Tegra30: Add Cardhu board files

2012-09-18 Thread Simon Glass
Hi Tom,

On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
> Signed-off-by: Tom Warren 
> ---
>  board/nvidia/cardhu/Makefile   |   48 
>  board/nvidia/cardhu/cardhu.c   |   87 +++
>  board/nvidia/cardhu/pinmux-config-common.h |  346 
> 
>  3 files changed, 481 insertions(+), 0 deletions(-)
>  create mode 100644 board/nvidia/cardhu/Makefile
>  create mode 100644 board/nvidia/cardhu/cardhu.c
>  create mode 100644 board/nvidia/cardhu/pinmux-config-common.h
>
> diff --git a/board/nvidia/cardhu/Makefile b/board/nvidia/cardhu/Makefile
> new file mode 100644
> index 000..a910577
> --- /dev/null
> +++ b/board/nvidia/cardhu/Makefile
> @@ -0,0 +1,48 @@
> +#
> +#  (C) Copyright 2010-2012
> +#  NVIDIA Corporation 
> +#
> +#
> +#  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
> +
> +ifneq ($(OBJTREE),$(SRCTREE))
> +$(shell mkdir -p $(obj)../common)
> +endif
> +
> +LIB= $(obj)lib$(BOARD).o
> +
> +COBJS  := $(BOARD).o
> +
> +SRCS   := $(COBJS:.o=.c)
> +OBJS   := $(addprefix $(obj),$(COBJS))
> +
> +$(LIB):$(obj).depend $(OBJS)
> +   $(call cmd_link_o_target, $(OBJS))
> +
> +#
> +
> +# defines $(obj).depend target
> +include $(SRCTREE)/rules.mk
> +
> +sinclude $(obj).depend
> +
> +#
> diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c
> new file mode 100644
> index 000..f907906
> --- /dev/null
> +++ b/board/nvidia/cardhu/cardhu.c
> @@ -0,0 +1,87 @@
> +/*
> + *  (C) Copyright 2010-2012
> + *  NVIDIA Corporation 
> + *
> + * 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 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#ifdef CONFIG_TEGRA_MMC
> +#include 
> +#endif
> +
> +/*
> + * Routine: gpio_config_uart
> + * Description: Does nothing on Cardhu - no conflict w/SPI.
> + */
> +void gpio_config_uart(void)
> +{
> +}
> +
> +#ifdef CONFIG_TEGRA_MMC
> +/*
> + * Routine: pin_mux_mmc
> + * Description: setup the pin muxes/tristate values for the SDMMC(s)
> + */
> +static void pin_mux_mmc(void)
> +{
> +   funcmux_select(PERIPH_ID_SDMMC4, FUNCMUX_SDMMC4_ATB_GMA_GME_8_BIT);
> +   funcmux_select(PERIPH_ID_SDMMC3, FUNCMUX_SDMMC3_SDB_4BIT);
> +
> +   /* For power GPIO PI6 */
> +   pinmux_tristate_disable(PINGRP_ATA);
> +   /* For CD GPIO PI5 */
> +   pinmux_tristate_disable(PINGRP_ATC);
> +}
> +
> +/* this is a weak define that we are overriding */
> +int board_mmc_init(bd_t *bd)
> +{
> +   debug("board_mmc_init called\n");
> +
> +   /* Enable muxes, etc. for SDMMC controllers */
> +   pin_mux_mmc();
> +
> +   debug("board_mmc_init: init eMMC\n");
> +   /* init dev 0, eMMC chip, with 4-bit bus */
> +   /* The board has an 8-bit bus, but 8-bit doesn't work yet */
> +   tegra_mmc_init(0, 4, -1, -1);
> +
> +   debug("board_mmc_init: init SD slot\n");
> +   /* init dev 1, SD slot, with 4-bit bus */
> +   tegra_mmc_init(1, 4, GPIO_PI6, GPIO_PI5);
> +
> +   return 0;
> +}
> +#endif
> +
> +#ifdef CONFIG_USB_EHCI_TEGRA
> +void pin_mux_usb(void)
> +{
> +   /* For USB's GPIO PD0. For now, since we have no pinmux in fdt */
> +   pinmux_tristate_disable(PINGRP_SLXK);
> +}

Re: [U-Boot] [PATCH 1/2] net: Allow netconsole settings to change after nc_start

2012-09-18 Thread Joe Hershberger
Hi Mike,

On Fri, Aug 17, 2012 at 9:28 PM, Mike Frysinger  wrote:
> On Friday 17 August 2012 15:48:20 Joe Hershberger wrote:
>> --- a/drivers/net/netconsole.c
>> +++ b/drivers/net/netconsole.c
>>
>> +static int refresh_settings_from_env(void)
>
> this func always returns 0.  why not change it to void to simplify the code
> (source and generated) ?

It returns -1 in the case where ncip == 0 in the environment.

>> + char *p;
>
> const

OK

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


Re: [U-Boot] [PATCH 4/9] Tegra: T30: Add common Tegra30 CPU files

2012-09-18 Thread Simon Glass
Hi Tom,

On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
> Signed-off-by: Tom Warren 
> ---
>  arch/arm/cpu/tegra30-common/Makefile|   51 ++
>  arch/arm/cpu/tegra30-common/ap30.c  |   98 +++
>  arch/arm/cpu/tegra30-common/board.c |  141 
>  arch/arm/cpu/tegra30-common/clock.c | 1099 
> +++

Again I feel that a lot of the code here is common. We actually got
away with identical code for T30 (even the tables!). Agreed that won't
really work, but it should hows much can be common.

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


Re: [U-Boot] [PATCH 2/9] Tegra: T30: Add AVP (arm720t) files

2012-09-18 Thread Simon Glass
Hi Tom,

On Wed, Sep 12, 2012 at 3:10 PM, Tom Warren  wrote:
> Signed-off-by: Tom Warren 
> ---
>  arch/arm/cpu/arm720t/tegra30/Makefile  |   48 +++
>  arch/arm/cpu/arm720t/tegra30/board.h   |   25 ++
>  arch/arm/cpu/arm720t/tegra30/config.mk |   26 ++
>  arch/arm/cpu/arm720t/tegra30/cpu.c |  570 
> 
>  arch/arm/cpu/arm720t/tegra30/cpu.h |   65 
>  arch/arm/cpu/arm720t/tegra30/spl.c |  132 

It certainly has complicated your work, with the AVP arm720t refactor
going in before these patches.

I feel that quite a bit of the code here should perhaps go to
arch/arm/cpu/arm720t/tegra-common or similar, so that you can share it
with tegra30.

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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Marek Vasut
Dear Thierry Reding,

[...]

> > Sure, but after you apply the bounce buffer, you can safely invalidate
> > the whole cacheline, so align it up and be done with it.
> 
> That's what I proposed to do last time around but it was NAK'ed.

By who?

> At the
> time I didn't ensure that the buffer was actually big enough, which is
> why people didn't like it (data on the stack after the DMA buffer might
> be invalidated as well).

Correct, thus the bounce buffer.

> > > This is by no means Tegra specific. In fact every board that has proper
> > > cache invalidation support should expose this problem.
> > 
> > Yea of course, the arm926ejs had this trouble too, see the mxs MMC driver
> > and arm926 cache.c
> 
> I suppose we could do something like this as well. If we make sure that
> the buffer is properly aligned and and sized, we could pass the aligned
> end address to invalidate_dcache_range().
> 
> Thierry

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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Thierry Reding
On Tue, Sep 18, 2012 at 09:21:14PM +0200, Marek Vasut wrote:
> Dear Thierry Reding,
> 
> > On Tue, Sep 18, 2012 at 08:37:44PM +0200, Marek Vasut wrote:
> > > Dear Simon Glass,
> > > 
> > > > Hi Thierry,
> > > > 
> > > > On Tue, Sep 18, 2012 at 7:54 AM, Thierry Reding
> > > > 
> > > >  wrote:
> > > > > On Mon, Sep 17, 2012 at 02:39:01PM -0700, Simon Glass wrote:
> > > > >> Hi Thierry,
> > > > >> 
> > > > >> On Sat, Sep 15, 2012 at 11:49 PM, Thierry Reding
> > > > >> 
> > > > >>  wrote:
> > > > >> > On Sat, Sep 15, 2012 at 07:45:30PM -0700, Simon Glass wrote:
> > > > >> >> Hi,
> > > > >> >> 
> > > > >> >> On Sat, Sep 15, 2012 at 1:41 PM, Thierry Reding
> > > > >> >> 
> > > > >> >>  wrote:
> > > > >> >> > On Sat, Sep 15, 2012 at 10:11:54PM +0200, Marek Vasut wrote:
> > > > >> >> >> Dear Thierry Reding,
> > > > >> >> >> 
> > > > >> >> >> > On Fri, Sep 14, 2012 at 08:53:32AM -0700, Simon Glass wrote:
> > > > >> >> >> > > Hi,
> > > > >> >> >> > > 
> > > > >> >> >> > > On Wed, Sep 12, 2012 at 4:42 PM, Marek Vasut
> > > > >> >> >> > > 
> > > 
> > > wrote:
> > > > >> >> >> > > > Dear Stephen Warren,
> > > > >> >> >> > > > 
> > > > >> >> >> > > >> On 09/12/2012 04:38 PM, Marek Vasut wrote:
> > > > >> >> >> > > >> > Dear Stephen Warren,
> > > > >> >> >> > > >> > 
> > > > >> >> >> > > >> >> On 09/12/2012 10:19 AM, Tom Warren wrote:
> > > > >> >> >> > > >> >>> Folks,
> > > > >> >> >> > > >> >>> 
> > > > >> >> >> > > >> >>> Stephen Warren has posted an internal bug regarding
> > > > >> >> >> > > >> >>> the cache alignment 'warnings' seen on Tegra20
> > > > >> >> >> > > >> >>> boards when accessing MMC. Here's the gist:
> > > > >> >> >> > > >> >>> 
> > > > >> >> >> > > >> >>> Executing "mmc dev 0" still yields cache warnings:
> > > > >> >> >> > > >> >>> 
> > > > >> >> >> > > >> >>> Tegra20 (Harmony) # mmc dev 0
> > > > >> >> >> > > >> >>> ERROR: v7_dcache_inval_range- stop address is not
> > > > >> >> >> > > >> >>> aligned- 0x3fb69908 mmc0 is current device
> > > > >> >> >> > > >> >> 
> > > > >> >> >> > > >> >> ...
> > > > >> >> >> > > >> >> 
> > > > >> >> >> > > >> >>> There have been patches in the past (IIRC) that
> > > > >> >> >> > > >> >>> have tried to ensure all callers (FS, MMC driver,
> > > > >> >> >> > > >> >>> USB driver, etc.) force their buffers to the
> > > > >> >> >> > > >> >>> appropriate alignment, but I don't know that we
> > > > >> >> >> > > >> >>> can ever correct every instance, now or in the
> > > > >> >> >> > > >> >>> future.
> > > > >> >> >> > > >> >>> 
> > > > >> >> >> > > >> >>> Can we start a discussion about what we can do
> > > > >> >> >> > > >> >>> about this warning? Adding an appropriate #ifdef
> > > > >> >> >> > > >> >>> (CONFIG_SYS_NO_CACHE_ALIGNMENT_WARNINGS, etc.)
> > > > >> >> >> > > >> >>> where Stephen put his #if 0's would be one
> > > > >> >> >> > > >> >>> approach, or changing the printf() to a debug(),
> > > > >> >> >> > > >> >>> perhaps. As far as I can tell, these alignment
> > > > >> >> >> > > >> >>> 'errors' don't seem to produce bad data in the
> > > > >> >> >> > > >> >>> transfer.
> > > > >> >> >> > > >> >> 
> > > > >> >> >> > > >> >> I don't think simply turning off the warning is the
> > > > >> >> >> > > >> >> correct approach; I believe they represent real
> > > > >> >> >> > > >> >> problems that can in fact cause data corruption. I
> > > > >> >> >> > > >> >> don't believe we have any choice other than to fully
> > > > >> >> >> > > >> >> solve the root-cause.
> > > > >> >> >> > > 
> > > > >> >> >> > > Yes I agree, and I think it is pretty close - certainly
> > > > >> >> >> > > much better than it used to be. The good thing about them
> > > > >> >> >> > > being annoying is that they will likely get fixed :-)
> > > > >> >> >> > 
> > > > >> >> >> > I think I traced this to the copying of CSD a while back.
> > > > >> >> >> > The problem is that the transferred buffer is 8 bytes, so
> > > > >> >> >> > there's no way to make it aligned properly. Unfortunately
> > > > >> >> >> > the entailing discussion did not yield a solution at the
> > > > >> >> >> > time.
> > > > >> >> >> 
> > > > >> >> >> And how exactly does the MMC bounce buffer not help here?
> > > > >> >> > 
> > > > >> >> > The problem solved by the bounce buffer is that it is properly
> > > > >> >> > cache- line aligned. However the issue here is not that the
> > > > >> >> > buffer is not properly aligned but rather that the transfer is
> > > > >> >> > too small.
> > > > >> >> > 
> > > > >> >> > When the MMC core transfers the SCR, it requests 8 bytes. The
> > > > >> >> > buffer used to store these 8 bytes is properly allocated.
> > > > >> >> > However, those 8 bytes eventually end up as the size of the
> > > > >> >> > range that is to be invalidated. This is the reason for the
> > > > >> >> > warning. Address x of the buffer is cache-line aligned, but x
> > > > >> >> > + 8 is never properly aligned and therefore the code
> > > > >> >> > complains.
> > > > >> >> 
> > > > >> >> Would it be too dreadful to define a min

Re: [U-Boot] [PATCH 1/9] Tegra: T30: Add include files

2012-09-18 Thread Simon Glass
Hi Tom,

On Thu, Sep 13, 2012 at 2:10 PM, Tom Warren  wrote:
> Tom,
>
> On Thu, Sep 13, 2012 at 11:06 AM, Tom Rini  wrote:
>> On Wed, Sep 12, 2012 at 03:10:47PM -0700, Tom Warren wrote:
>>
>>> Signed-off-by: Tom Warren 
>>
>> A few things:
>> - I see some #define FOO[space][space]val that should be [tab]
>
> Probably copied over from Tegra20 files. I'll turn on whitespace
> highlighting in my editor and fix 'em up.
>
>> - I didn't checkpatch.pl this (nor the whole series) but please do and
>>   let us know if it's clean or why the warnings are false positives.
>
> I always run checkpath before submitting. I'll put a notice to that
> affect in the next version. Checkpatch ran clean w/only 1
> false-positive about 'macros with complex values should be enclosed in
> parenthesis' for the "#define CONFIG_DEFAULT_DEVICE_TREE
> tegra30-cardhu" line in cardhu.h.
>
>> - My preference is to bring in includes and C files and Makefiles and so
>>   on all at once, when each is needed / useful.  YMMV and not a big
>>   deal.
>> - But please make sure that you aren't adding defines / structs / etc
>>   that aren't used at some point by the end of the series at least.
>>   Removing (and correcting!) structs and defines was one of the things I
>>   had to do on am33xx.  If it wasn't added until the corresponding
>>   driver work was being pushed, it'd have saved me some time.
>>
>
> Sure, and that's good advice. I took a couple of passes during the
> port to try and remove vestigial and/or useless/unsupported files,
> features, and code, but I'm sure I missed some (as Stephen has already
> pointed out). I'll address those in V2.

Congrats on getting this out. It is a lot of work!

In the Chromium tree, we have an arch-tegra directory where a lot of
the common code lives. It sounds like you are going to split that out
a bit which is good. I suspect you may also want a few patches to move
quite a bit of the code in arch/arm/include/arch-tegra20 to
arch/arm/include/arch-tegra.

Regards,
Simon

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


[U-Boot] [PATCH] mx6qsabresd: Add 8-bit USDHC support

2012-09-18 Thread Fabio Estevam
USDHC3 has 8 pins wired in mx6qsabresd. Configure the extra pins.

Signed-off-by: Fabio Estevam 
---
 board/freescale/mx6qsabresd/mx6qsabresd.c |4 
 1 file changed, 4 insertions(+)

diff --git a/board/freescale/mx6qsabresd/mx6qsabresd.c 
b/board/freescale/mx6qsabresd/mx6qsabresd.c
index 4f47fd3..56ec153 100644
--- a/board/freescale/mx6qsabresd/mx6qsabresd.c
+++ b/board/freescale/mx6qsabresd/mx6qsabresd.c
@@ -81,6 +81,10 @@ iomux_v3_cfg_t usdhc3_pads[] = {
MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6Q_PAD_SD3_DAT4__USDHC3_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6Q_PAD_SD3_DAT5__USDHC3_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6Q_PAD_SD3_DAT6__USDHC3_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
+   MX6Q_PAD_SD3_DAT7__USDHC3_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
MX6Q_PAD_NANDF_D0__GPIO_2_0| MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
 };
 
-- 
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 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On 09/18/12 12:19, Marek Vasut wrote:
> > Dear Tom Rini,
> > 
> >> On 09/18/12 11:33, Marek Vasut wrote:
> >>> Dear Scott Wood,
> >> 
> >> [snip]
> >> 
>  I think I got some wires crossed and was thinking about
>  printf/puts. We want those to be optimized away at compile
>  time (not pointed to a stub at link time) on an SPL that has
>  no output support, but once that's done the low level serial
>  functions shouldn't be referenced anymore, right?
> >>> 
> >>> But if you point them to stubs, that's OK. The compiler will GC
> >>> these useless stubs anyway. But wait, we're getting to LTO
> >>> here, right?
> >>> 
> >>> So the safest bet really is macro in serial.h ?
> >> 
> >> Due to the gcc bug I've mentioned before, yes.  Dummy functions
> >> will, I bet, keep the string constants around.  do {} while(0)
> >> will drop them out entirely.
> > 
> > Damn, not much gain on m28evk (with C functionss/with macros),
> > using gcc 4.7.1:
> > 
> > Configuring for m28evk board... textdata bss dec hex
> > filename 4189947780  288632  715406   aea8e ./u-boot 11773 788
> > 12   12573311d ./spl/u-boot-spl
> > 
> > Configuring for m28evk board... textdata bss dec hex
> > filename 4189987780  288628  715406   aea8e ./u-boot 11765 788
> > 12   125653115 ./spl/u-boot-spl
> 
> Right, didn't have many strings.  But do you see what I mean now about
> not needing this patch as it stands currently?

No, I don't. If I remove this patch, the build breaks either because serial_* 
is 
defined twice or not defined at all.

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 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Scott Wood,

> On 09/18/2012 01:33:11 PM, Marek Vasut wrote:
> > Dear Scott Wood,
> > 
> > > On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> > > > I'd say the GCC must optimize it out anyway.
> > > 
> > > I think I got some wires crossed and was thinking about printf/puts.
> > > We want those to be optimized away at compile time (not pointed to a
> > > stub at link time) on an SPL that has no output support, but once
> > > that's done the low level serial functions shouldn't be referenced
> > > anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC these
> > useless
> > stubs anyway. But wait, we're getting to LTO here, right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> For printf/puts, we want something header-based.  For the serial
> functions it depends on whether we have call sites that do not get GCed.

I'm not removing printf() puts() etc. .. only the serial_ goo ... and see my 
other email, not much gain :(

> -Scott

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 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Tom Rini
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/18/12 12:19, Marek Vasut wrote:
> Dear Tom Rini,
> 
>> On 09/18/12 11:33, Marek Vasut wrote:
>>> Dear Scott Wood,
>> 
>> [snip]
>> 
 I think I got some wires crossed and was thinking about 
 printf/puts. We want those to be optimized away at compile 
 time (not pointed to a stub at link time) on an SPL that has 
 no output support, but once that's done the low level serial 
 functions shouldn't be referenced anymore, right?
>>> 
>>> But if you point them to stubs, that's OK. The compiler will GC
>>> these useless stubs anyway. But wait, we're getting to LTO 
>>> here, right?
>>> 
>>> So the safest bet really is macro in serial.h ?
>> 
>> Due to the gcc bug I've mentioned before, yes.  Dummy functions 
>> will, I bet, keep the string constants around.  do {} while(0) 
>> will drop them out entirely.
> 
> Damn, not much gain on m28evk (with C functionss/with macros), 
> using gcc 4.7.1:
> 
> Configuring for m28evk board... textdata bss dec hex
> filename 4189947780  288632  715406   aea8e ./u-boot 11773 788
> 12   12573311d ./spl/u-boot-spl
> 
> Configuring for m28evk board... textdata bss dec hex
> filename 4189987780  288628  715406   aea8e ./u-boot 11765 788
> 12   125653115 ./spl/u-boot-spl

Right, didn't have many strings.  But do you see what I mean now about
not needing this patch as it stands currently?

- -- 
Tom
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQIcBAEBAgAGBQJQWMojAAoJENk4IS6UOR1Ws/EP/jx1vvg3N2gIlSVRfl6em3ul
VwBi/tLW+mAlF3V/+Ge3h//U9gAef6uDbRlLUngxAvVuHQZZb7gqtf6T9Zw7DDu/
BFLSocaLi99rnEdwEZe4lApJnBP3pZEcLnHiKVvFN+lGSA7G6vEzJemawnxhFdKh
B9MgtxgKEe3EUxdKj8rXaXvPUIO+NpQ/BcI2FLQrJfr8nH0mK6m1yNFEe3VYc64y
3dUTxr1ILS6O2uLvf1ErUdSi7YZOnkAwpyw+mTLF6weCJNisrDCrChjZibeBEtVN
ZdH5ZkKckXegy3N6HM/tDuLGaO5spvxM797gS1tzqesPrMWy+ng9npFwqk6zxM8Y
rtG6G0ddtAk0u6UCEDvoQiYPciNY4F+YhuhesVXZVUe7l09XbZdiDLHXlqR34hVo
9H1qPCfi7DmvRR/mArG4URc9TkbsjsQkZp1s1/3jDFlM6xenM+2SdTy3ncrsMwmx
Ri92BjdOE+VQSdgqexV660yjNB3qYn2AC7/dtgNhaZA7/+p7XSip3NnjTmTr7buL
xoo8sse/sr8viGDCyyWf8Bv/sOvc5pqR0SYu3187BkgkMlAv3Se/lwNT/r+lPqFd
K0w69mMqN+WNEQYHkisE2bKGsuKCWOLt/KTFvDNXQJZsxa4uE2lbNSTXzStsGcAw
rh+d7dV2ylpGxRccUYDb
=dyAB
-END PGP SIGNATURE-
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [U-Boot, 1/3] dm: sparc: net: Fixup greth compile warnings

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On Fri, Jul 27, 2012 at 08:04:32AM -, Marek Vasut wrote:
> > greth.c: In function ???greth_recv???:
> > greth.c:507:3: warning: format ???%lx??? expects argument of type ???long
> > unsigned int???, but argument 2 has type ???unsigned int??? [-Wformat]
> > greth.c:507:3: warning: format ???%lx??? expects argument of type
> > ???long unsigned int???, but argument 3 has type ???unsigned int???
> > [-Wformat] greth.c:541:6: warning: pointer targets in assignment differ
> > in signedness [-Wpointer-sign] greth.c: In function
> > ???greth_initialize???:
> > greth.c:623:2: warning: format ???%lx??? expects argument of type ???long
> > unsigned int???, but argument 2 has type ???struct greth_regs *???
> > [-Wformat] greth.c:655:3: warning: format ???%x??? expects argument of
> > type ???unsigned int???, but argument 2 has type ???struct greth_regs
> > *??? [-Wformat] greth.c:684:2: warning: format ???%x??? expects argument
> > of type ???unsigned int???, but argument 2 has type ???struct greth_regs
> > *??? [-Wformat]
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Joe Hershberger 
> > Cc: Daniel Hellstrom 
> > Cc: u-boot...@lists.denx.de
> 
> Applied to u-boot/master, thanks!

I wonder if we shouldn't throw all that sparc crap away ... same with m68k. 
It's 
starting to rot, noone uses it anymore anyway.

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 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Scott Wood

On 09/18/2012 01:33:11 PM, Marek Vasut wrote:

Dear Scott Wood,

> On 09/18/2012 01:03:17 PM, Marek Vasut wrote:
> > I'd say the GCC must optimize it out anyway.
>
> I think I got some wires crossed and was thinking about printf/puts.
> We want those to be optimized away at compile time (not pointed to a
> stub at link time) on an SPL that has no output support, but once
> that's done the low level serial functions shouldn't be referenced
> anymore, right?

But if you point them to stubs, that's OK. The compiler will GC these  
useless

stubs anyway. But wait, we're getting to LTO here, right?

So the safest bet really is macro in serial.h ?


For printf/puts, we want something header-based.  For the serial  
functions it depends on whether we have call sites that do not get GCed.


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


Re: [U-Boot] [PATCH v2 1/4] nand: Add support for unlock.invert

2012-09-18 Thread Joe Hershberger
Hi Scott,

On Mon, Sep 17, 2012 at 5:35 PM, Scott Wood  wrote:
> On Wed, Aug 22, 2012 at 04:49:42PM -0500, Joe Hershberger wrote:
>> NAND unlock command allows an invert bit to be set to unlock all but
>> the selected page range.
>>
>> Signed-off-by: Joe Hershberger 
>> ---
>> Changes in v2:
>> - Changed invert to allexcept
>> - Changed unlock printf to debug print
>> - Dropped cast in unlock debug print
>>
>>  common/cmd_nand.c| 13 ++---
>>  drivers/mtd/nand/nand_util.c | 10 +++---
>>  include/nand.h   |  4 ++--
>>  3 files changed, 19 insertions(+), 8 deletions(-)
>
> Applied to u-boot-nand-flash with the diff below.  Do you know if all
> chips that support locking support the invert bit?  If not, we should at
> least update the documentation to mention this (though runtime detection
> would be good if practical).

I'm not aware of a part that supports lock and not the invert
functionality.  I'm also not aware of a way to detect at runtime if it
is supported.

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


Re: [U-Boot] [U-Boot,1/2,V2] ARM: Remove apollon board

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On Wed, Sep 05, 2012 at 05:16:55PM -, Marek Vasut wrote:
> > This board is the only board that still sticks to OneNAND IPL.
> > Remove this board, since we have SPL around for a while and
> > OneNAND is well supported in the SPL framework. The board can
> > be revived if necessary.
> > 
> > Signed-off-by: Marek Vasut 
> > Cc: Albert Aribaud 
> > Cc: Kyungmin Park 
> > Cc: Tom Rini 
> 
> Applied to u-boot/master, thanks!

This should have gone through u-boot-arm ;-) But screw that.

Anyway, I'm looking forward to your push and how jenkins will handle it.

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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Marek Vasut
Dear Thierry Reding,

> On Tue, Sep 18, 2012 at 08:37:44PM +0200, Marek Vasut wrote:
> > Dear Simon Glass,
> > 
> > > Hi Thierry,
> > > 
> > > On Tue, Sep 18, 2012 at 7:54 AM, Thierry Reding
> > > 
> > >  wrote:
> > > > On Mon, Sep 17, 2012 at 02:39:01PM -0700, Simon Glass wrote:
> > > >> Hi Thierry,
> > > >> 
> > > >> On Sat, Sep 15, 2012 at 11:49 PM, Thierry Reding
> > > >> 
> > > >>  wrote:
> > > >> > On Sat, Sep 15, 2012 at 07:45:30PM -0700, Simon Glass wrote:
> > > >> >> Hi,
> > > >> >> 
> > > >> >> On Sat, Sep 15, 2012 at 1:41 PM, Thierry Reding
> > > >> >> 
> > > >> >>  wrote:
> > > >> >> > On Sat, Sep 15, 2012 at 10:11:54PM +0200, Marek Vasut wrote:
> > > >> >> >> Dear Thierry Reding,
> > > >> >> >> 
> > > >> >> >> > On Fri, Sep 14, 2012 at 08:53:32AM -0700, Simon Glass wrote:
> > > >> >> >> > > Hi,
> > > >> >> >> > > 
> > > >> >> >> > > On Wed, Sep 12, 2012 at 4:42 PM, Marek Vasut
> > > >> >> >> > > 
> > 
> > wrote:
> > > >> >> >> > > > Dear Stephen Warren,
> > > >> >> >> > > > 
> > > >> >> >> > > >> On 09/12/2012 04:38 PM, Marek Vasut wrote:
> > > >> >> >> > > >> > Dear Stephen Warren,
> > > >> >> >> > > >> > 
> > > >> >> >> > > >> >> On 09/12/2012 10:19 AM, Tom Warren wrote:
> > > >> >> >> > > >> >>> Folks,
> > > >> >> >> > > >> >>> 
> > > >> >> >> > > >> >>> Stephen Warren has posted an internal bug regarding
> > > >> >> >> > > >> >>> the cache alignment 'warnings' seen on Tegra20
> > > >> >> >> > > >> >>> boards when accessing MMC. Here's the gist:
> > > >> >> >> > > >> >>> 
> > > >> >> >> > > >> >>> Executing "mmc dev 0" still yields cache warnings:
> > > >> >> >> > > >> >>> 
> > > >> >> >> > > >> >>> Tegra20 (Harmony) # mmc dev 0
> > > >> >> >> > > >> >>> ERROR: v7_dcache_inval_range- stop address is not
> > > >> >> >> > > >> >>> aligned- 0x3fb69908 mmc0 is current device
> > > >> >> >> > > >> >> 
> > > >> >> >> > > >> >> ...
> > > >> >> >> > > >> >> 
> > > >> >> >> > > >> >>> There have been patches in the past (IIRC) that
> > > >> >> >> > > >> >>> have tried to ensure all callers (FS, MMC driver,
> > > >> >> >> > > >> >>> USB driver, etc.) force their buffers to the
> > > >> >> >> > > >> >>> appropriate alignment, but I don't know that we
> > > >> >> >> > > >> >>> can ever correct every instance, now or in the
> > > >> >> >> > > >> >>> future.
> > > >> >> >> > > >> >>> 
> > > >> >> >> > > >> >>> Can we start a discussion about what we can do
> > > >> >> >> > > >> >>> about this warning? Adding an appropriate #ifdef
> > > >> >> >> > > >> >>> (CONFIG_SYS_NO_CACHE_ALIGNMENT_WARNINGS, etc.)
> > > >> >> >> > > >> >>> where Stephen put his #if 0's would be one
> > > >> >> >> > > >> >>> approach, or changing the printf() to a debug(),
> > > >> >> >> > > >> >>> perhaps. As far as I can tell, these alignment
> > > >> >> >> > > >> >>> 'errors' don't seem to produce bad data in the
> > > >> >> >> > > >> >>> transfer.
> > > >> >> >> > > >> >> 
> > > >> >> >> > > >> >> I don't think simply turning off the warning is the
> > > >> >> >> > > >> >> correct approach; I believe they represent real
> > > >> >> >> > > >> >> problems that can in fact cause data corruption. I
> > > >> >> >> > > >> >> don't believe we have any choice other than to fully
> > > >> >> >> > > >> >> solve the root-cause.
> > > >> >> >> > > 
> > > >> >> >> > > Yes I agree, and I think it is pretty close - certainly
> > > >> >> >> > > much better than it used to be. The good thing about them
> > > >> >> >> > > being annoying is that they will likely get fixed :-)
> > > >> >> >> > 
> > > >> >> >> > I think I traced this to the copying of CSD a while back.
> > > >> >> >> > The problem is that the transferred buffer is 8 bytes, so
> > > >> >> >> > there's no way to make it aligned properly. Unfortunately
> > > >> >> >> > the entailing discussion did not yield a solution at the
> > > >> >> >> > time.
> > > >> >> >> 
> > > >> >> >> And how exactly does the MMC bounce buffer not help here?
> > > >> >> > 
> > > >> >> > The problem solved by the bounce buffer is that it is properly
> > > >> >> > cache- line aligned. However the issue here is not that the
> > > >> >> > buffer is not properly aligned but rather that the transfer is
> > > >> >> > too small.
> > > >> >> > 
> > > >> >> > When the MMC core transfers the SCR, it requests 8 bytes. The
> > > >> >> > buffer used to store these 8 bytes is properly allocated.
> > > >> >> > However, those 8 bytes eventually end up as the size of the
> > > >> >> > range that is to be invalidated. This is the reason for the
> > > >> >> > warning. Address x of the buffer is cache-line aligned, but x
> > > >> >> > + 8 is never properly aligned and therefore the code
> > > >> >> > complains.
> > > >> >> 
> > > >> >> Would it be too dreadful to define a minimum MMC transfer size,
> > > >> >> and set that to the cache line size?
> > > >> > 
> > > >> > I did try setting the data size to the cache line size back then,
> > > >> > but that resulted in an error. After that I gave up. I think what
> > > >> > we really n

Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
> 
> [snip]
> 
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at compile time
> >> (not pointed to a stub at link time) on an SPL that has no output
> >> support, but once that's done the low level serial functions
> >> shouldn't be referenced anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC
> > these useless stubs anyway. But wait, we're getting to LTO here,
> > right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> Due to the gcc bug I've mentioned before, yes.  Dummy functions will,
> I bet, keep the string constants around.  do {} while(0) will drop
> them out entirely.

Damn, not much gain on m28evk (with C functionss/with macros), using gcc 4.7.1:

Configuring for m28evk board...
   textdata bss dec hex filename
 4189947780  288632  715406   aea8e ./u-boot
  11773 788  12   12573311d ./spl/u-boot-spl

Configuring for m28evk board...
   textdata bss dec hex filename
 4189987780  288628  715406   aea8e ./u-boot
  11765 788  12   125653115 ./spl/u-boot-spl

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


Re: [U-Boot] env_nand: fix incorrect size parameter to ALLOC_CACHE_ALIGN_BUFFER

2012-09-18 Thread Tom Rini
On Fri, Sep 07, 2012 at 09:15:33AM -, Stephen Warren wrote:

> From: Stephen Warren 
> 
> The third parameter to ALLOC_CACHE_ALIGN_BUFFER is not size (as named),
> but rather count (number of elements of the type to allocate). The
> current code ends up allocating one copy of env_t for each byte in its
> size, which quite possibly ends up overflowing RAM.
> 
> This fixes a bug in commit 3801a15 "env_nand: align NAND buffers".
> 
> Reported-by: Prabhakar Lad 
> Signed-off-by: Stephen Warren 
> Reported-by: Prabhakar Lad 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Subject: [PATCH] Fix for bug in memory sizing code

2012-09-18 Thread Tom Rini
On Sun, Sep 09, 2012 at 08:16:58PM -, Iwo Mergler wrote:

> The original memory sizing code in get_ram_size clobbers the word
> at the base address, but forgets to restore it.
> 
> Signed-off-by: Iwo Mergler 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] env_nand: fix incorrect size parameter to ALLOC_CACHE_ALIGN_BUFFER

2012-09-18 Thread Tom Rini
On Fri, Sep 07, 2012 at 09:15:33AM -, Stephen Warren wrote:

> From: Stephen Warren 
> 
> The third parameter to ALLOC_CACHE_ALIGN_BUFFER is not size (as named),
> but rather count (number of elements of the type to allocate). The
> current code ends up allocating one copy of env_t for each byte in its
> size, which quite possibly ends up overflowing RAM.
> 
> This fixes a bug in commit 3801a15 "env_nand: align NAND buffers".
> 
> Reported-by: Prabhakar Lad 
> Signed-off-by: Stephen Warren 
> Reported-by: Prabhakar Lad 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,2/2] IPL: Remove remains of OneNAND IPL

2012-09-18 Thread Tom Rini
On Wed, Sep 05, 2012 at 05:09:08PM -, Marek Vasut wrote:

> After removing the Apollon board, remove the OneNAND IPL too.
> There are no users for it any more.
> 
> Signed-off-by: Marek Vasut 
> Cc: Albert Aribaud 
> Cc: Minkyu Kang 
> Cc: Tom Rini 
> Acked-by: Minkyu Kang 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,1/2,V2] ARM: Remove apollon board

2012-09-18 Thread Tom Rini
On Wed, Sep 05, 2012 at 05:16:55PM -, Marek Vasut wrote:

> This board is the only board that still sticks to OneNAND IPL.
> Remove this board, since we have SPL around for a while and
> OneNAND is well supported in the SPL framework. The board can
> be revived if necessary.
> 
> Signed-off-by: Marek Vasut 
> Cc: Albert Aribaud 
> Cc: Kyungmin Park 
> Cc: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, v4, 1/7] env: cosmetic: drop assignment i = iomux_doenv()

2012-09-18 Thread Tom Rini
On Fri, Aug 24, 2012 at 12:11:36AM -, Gerlando Falauto wrote:

> iomux_doenv() can only return 0 or 1.
> So there is no need to save its return value in variable i, as checking
> its truth value within an if statement is enough.
> 
> Signed-off-by: Gerlando Falauto 
> Reviewed-by: Marek Vasut 

Along with the rest of the series, applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 3/5] env import/export: Remove from help if disabled

2012-09-18 Thread Tom Rini
On Fri, Aug 10, 2012 at 07:45:44AM -, Beno?t Th?baudeau wrote:

> Signed-off-by: Beno?t Th?baudeau 
> Cc: Wolfgang Denk 
> Acked-by: Mike Frysinger 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot,2/5] env_common: Add missing ethprime

2012-09-18 Thread Tom Rini
On Fri, Aug 10, 2012 at 07:45:31AM -, Beno?t Th?baudeau wrote:

> The ethprime env var was missing from env_common.
> 
> Signed-off-by: Beno?t Th?baudeau 
> Cc: Wolfgang Denk 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 1/5] fw_env: Add env vars describing U-Boot target board

2012-09-18 Thread Tom Rini
On Fri, Aug 10, 2012 at 07:45:15AM -, Beno?t Th?baudeau wrote:

> Commit 5e724ca did the same thing for env_common and env_embedded, but forgot
> fw_env.
> 
> Signed-off-by: Beno?t Th?baudeau 
> Cc: Wolfgang Denk 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] spl: remove forced linking of commands into SPL

2012-09-18 Thread Tom Rini
On Wed, Aug 08, 2012 at 04:24:13PM -, Tyler Olmstead wrote:

> Remove linker command line options from the SPL makefile
> that force the inclusion of unreferenced command code from
> linked object files. As commands are not used in the SPL,
> these options resulted in an unnecessary increase in the
> image size, in addition to introducing the possibility of
> tricky link errors in the case where the command code
> contained symbols that were not resolved by linking in the
> limited objects compiled in the SPL build.
> 
> Signed-off-by: Tyler Olmstead 
> Acked-by: Tom Rini 

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 3/3] dm: sparc: Fixup the compile warnings in sparc code

2012-09-18 Thread Tom Rini
On Fri, Jul 27, 2012 at 08:04:34AM -, Marek Vasut wrote:

> Signed-off-by: Marek Vasut 
> Cc: Daniel Hellstrom 
> Cc: u-boot...@lists.denx.de

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [U-Boot, 2/3] dm: sparc: common: Fixup cmd_bdinfo warnings

2012-09-18 Thread Tom Rini
On Fri, Jul 27, 2012 at 08:04:33AM -, Marek Vasut wrote:

> cmd_bdinfo.c: In function ???do_bdinfo???:
> cmd_bdinfo.c:220:9: warning: format ???%lx??? expects argument of type 
> ???long unsigned int???, but argument 2 has type ???int??? [-Wformat]
> cmd_bdinfo.c:222:9: warning: format ???%lx??? expects argument of type 
> ???long unsigned int???, but argument 2 has type ???int??? [-Wformat]
> cmd_bdinfo.c:224:9: warning: format ???%lx??? expects argument of type 
> ???long unsigned int???, but argument 2 has type ???int??? [-Wformat]
> cmd_bdinfo.c:226:9: warning: format ???%lx??? expects argument of type 
> ???long unsigned int???, but argument 2 has type ???int??? [-Wformat]
> cmd_bdinfo.c:228:9: warning: format ???%lx??? expects argument of type 
> ???long unsigned int???, but argument 2 has type ???int??? [-Wformat]
> 
> Signed-off-by: Marek Vasut 
> Cc: Daniel Hellstrom 
> Cc: u-boot...@lists.denx.de

Applied to u-boot/master, thanks!

-- 
Tom


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


[U-Boot] [PATCH] P4080/esdhc: make the P4080 ESDHC13 errata workaround conditional

2012-09-18 Thread Roy Zang
P4080 Rev3.0 fixes ESDHC13 errata, so update the code to make the
workaround conditional.
In formal release document, the errata number should be ESDHC13 instead
of ESDHC136.

Signed-off-by: Roy Zang 
---
for sdk1.3. fix defect ENGR180745

 arch/powerpc/cpu/mpc85xx/cmd_errata.c |5 +++--
 arch/powerpc/cpu/mpc85xx/cpu_init.c   |   10 ++
 arch/powerpc/include/asm/config_mpc85xx.h |2 +-
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/cmd_errata.c 
b/arch/powerpc/cpu/mpc85xx/cmd_errata.c
index 38e23c8..acc3b83 100644
--- a/arch/powerpc/cpu/mpc85xx/cmd_errata.c
+++ b/arch/powerpc/cpu/mpc85xx/cmd_errata.c
@@ -79,8 +79,9 @@ static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC135)
puts("Work-around for Erratum ESDHC135 enabled\n");
 #endif
-#if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC136)
-   puts("Work-around for Erratum ESDHC136 enabled\n");
+#if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC13)
+   if (SVR_MAJ(svr) < 3)
+   puts("Work-around for Erratum ESDHC13 enabled\n");
 #endif
 #if defined(CONFIG_SYS_FSL_ERRATUM_ESDHC_A001)
puts("Work-around for Erratum ESDHC-A001 enabled\n");
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c 
b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index 2397547..fe4b39e 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -495,11 +495,13 @@ skip_l2:
setup_mp();
 #endif
 
-#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC136
+#ifdef CONFIG_SYS_FSL_ERRATUM_ESDHC13
{
-   void *p;
-   p = (void *)CONFIG_SYS_DCSRBAR + 0x20520;
-   setbits_be32(p, 1 << (31 - 14));
+   if (SVR_MAJ(svr) < 3) {
+   void *p;
+   p = (void *)CONFIG_SYS_DCSRBAR + 0x20520;
+   setbits_be32(p, 1 << (31 - 14));
+   }
}
 #endif
 
diff --git a/arch/powerpc/include/asm/config_mpc85xx.h 
b/arch/powerpc/include/asm/config_mpc85xx.h
index fab01d5..ddd6557 100644
--- a/arch/powerpc/include/asm/config_mpc85xx.h
+++ b/arch/powerpc/include/asm/config_mpc85xx.h
@@ -387,7 +387,7 @@
 #define CONFIG_SYS_FSL_ERRATUM_ELBC_A001
 #define CONFIG_SYS_FSL_ERRATUM_ESDHC111
 #define CONFIG_SYS_FSL_ERRATUM_ESDHC135
-#define CONFIG_SYS_FSL_ERRATUM_ESDHC136
+#define CONFIG_SYS_FSL_ERRATUM_ESDHC13
 #define CONFIG_SYS_P4080_ERRATUM_CPU22
 #define CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
 #define CONFIG_SYS_P4080_ERRATUM_SERDES8
-- 
1.7.8.1


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


Re: [U-Boot] [U-Boot, 1/3] dm: sparc: net: Fixup greth compile warnings

2012-09-18 Thread Tom Rini
On Fri, Jul 27, 2012 at 08:04:32AM -, Marek Vasut wrote:

> greth.c: In function ???greth_recv???:
> greth.c:507:3: warning: format ???%lx??? expects argument of type ???long 
> unsigned int???, but argument 2 has type ???unsigned int??? [-Wformat]
> greth.c:507:3: warning: format ???%lx??? expects argument of type ???long 
> unsigned int???, but argument 3 has type ???unsigned int??? [-Wformat]
> greth.c:541:6: warning: pointer targets in assignment differ in signedness 
> [-Wpointer-sign]
> greth.c: In function ???greth_initialize???:
> greth.c:623:2: warning: format ???%lx??? expects argument of type ???long 
> unsigned int???, but argument 2 has type ???struct greth_regs *??? [-Wformat]
> greth.c:655:3: warning: format ???%x??? expects argument of type ???unsigned 
> int???, but argument 2 has type ???struct greth_regs *??? [-Wformat]
> greth.c:684:2: warning: format ???%x??? expects argument of type ???unsigned 
> int???, but argument 2 has type ???struct greth_regs *??? [-Wformat]
> 
> Signed-off-by: Marek Vasut 
> Cc: Joe Hershberger 
> Cc: Daniel Hellstrom 
> Cc: u-boot...@lists.denx.de

Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH v2 5/8] FAT: Fix file contents listed as directory

2012-09-18 Thread Tom Rini
On Mon, Sep 03, 2012 at 04:08:02PM +0200, Beno??t Th??baudeau wrote:
> Dear Wolfgang Denk,
> 
> On Sunday, September 2, 2012 5:21:15 PM, Wolfgang Denk wrote:
> > Dear Beno??t Th??baudeau,
> > 
> > In message
> > <2017658963.332562.1342790429735.javamail.r...@advansee.com> you
> > wrote:
> > > With:
> > > fatls mmc 0 /dir/file
> > > dir: regular directory
> > > file: regular file
> > >
> > > The previous code read the contents of file as if it were directory
> > > entries to
> > > list. This patch refuses to list file contents as if it were a
> > > folder.
> > 
> > But this means that "fatls" on a plain file stops working?
> > 
> > This doesn't make sense to me.  Or what am I missing?
> 
> This already did not work before, because "fatls" is supposed to support only
> directories:
> 
> $ help fatls
> fatls - list files in a directory (default /)
> 
> Usage:
> fatls   [directory]
> - list files from 'dev' on 'interface' in a 'directory'

Note that ext2ls _also_ fails to ls files so we're being consistent as I
believe Wolfgang was expecting that *ls of a file would work like real
ls does, but that's not the case.  Applied to u-boot/master, thanks!

-- 
Tom


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


Re: [U-Boot] Cache alignment warnings on Tegra (ARM)

2012-09-18 Thread Thierry Reding
On Tue, Sep 18, 2012 at 08:37:44PM +0200, Marek Vasut wrote:
> Dear Simon Glass,
> 
> > Hi Thierry,
> > 
> > On Tue, Sep 18, 2012 at 7:54 AM, Thierry Reding
> > 
> >  wrote:
> > > On Mon, Sep 17, 2012 at 02:39:01PM -0700, Simon Glass wrote:
> > >> Hi Thierry,
> > >> 
> > >> On Sat, Sep 15, 2012 at 11:49 PM, Thierry Reding
> > >> 
> > >>  wrote:
> > >> > On Sat, Sep 15, 2012 at 07:45:30PM -0700, Simon Glass wrote:
> > >> >> Hi,
> > >> >> 
> > >> >> On Sat, Sep 15, 2012 at 1:41 PM, Thierry Reding
> > >> >> 
> > >> >>  wrote:
> > >> >> > On Sat, Sep 15, 2012 at 10:11:54PM +0200, Marek Vasut wrote:
> > >> >> >> Dear Thierry Reding,
> > >> >> >> 
> > >> >> >> > On Fri, Sep 14, 2012 at 08:53:32AM -0700, Simon Glass wrote:
> > >> >> >> > > Hi,
> > >> >> >> > > 
> > >> >> >> > > On Wed, Sep 12, 2012 at 4:42 PM, Marek Vasut  
> wrote:
> > >> >> >> > > > Dear Stephen Warren,
> > >> >> >> > > > 
> > >> >> >> > > >> On 09/12/2012 04:38 PM, Marek Vasut wrote:
> > >> >> >> > > >> > Dear Stephen Warren,
> > >> >> >> > > >> > 
> > >> >> >> > > >> >> On 09/12/2012 10:19 AM, Tom Warren wrote:
> > >> >> >> > > >> >>> Folks,
> > >> >> >> > > >> >>> 
> > >> >> >> > > >> >>> Stephen Warren has posted an internal bug regarding the
> > >> >> >> > > >> >>> cache alignment 'warnings' seen on Tegra20 boards when
> > >> >> >> > > >> >>> accessing MMC. Here's the gist:
> > >> >> >> > > >> >>> 
> > >> >> >> > > >> >>> Executing "mmc dev 0" still yields cache warnings:
> > >> >> >> > > >> >>> 
> > >> >> >> > > >> >>> Tegra20 (Harmony) # mmc dev 0
> > >> >> >> > > >> >>> ERROR: v7_dcache_inval_range- stop address is not
> > >> >> >> > > >> >>> aligned- 0x3fb69908 mmc0 is current device
> > >> >> >> > > >> >> 
> > >> >> >> > > >> >> ...
> > >> >> >> > > >> >> 
> > >> >> >> > > >> >>> There have been patches in the past (IIRC) that have
> > >> >> >> > > >> >>> tried to ensure all callers (FS, MMC driver, USB
> > >> >> >> > > >> >>> driver, etc.) force their buffers to the appropriate
> > >> >> >> > > >> >>> alignment, but I don't know that we can ever correct
> > >> >> >> > > >> >>> every instance, now or in the future.
> > >> >> >> > > >> >>> 
> > >> >> >> > > >> >>> Can we start a discussion about what we can do about
> > >> >> >> > > >> >>> this warning? Adding an appropriate #ifdef
> > >> >> >> > > >> >>> (CONFIG_SYS_NO_CACHE_ALIGNMENT_WARNINGS, etc.) where
> > >> >> >> > > >> >>> Stephen put his #if 0's would be one approach, or
> > >> >> >> > > >> >>> changing the printf() to a debug(), perhaps. As far as
> > >> >> >> > > >> >>> I can tell, these alignment 'errors' don't seem to
> > >> >> >> > > >> >>> produce bad data in the transfer.
> > >> >> >> > > >> >> 
> > >> >> >> > > >> >> I don't think simply turning off the warning is the
> > >> >> >> > > >> >> correct approach; I believe they represent real
> > >> >> >> > > >> >> problems that can in fact cause data corruption. I
> > >> >> >> > > >> >> don't believe we have any choice other than to fully
> > >> >> >> > > >> >> solve the root-cause.
> > >> >> >> > > 
> > >> >> >> > > Yes I agree, and I think it is pretty close - certainly much
> > >> >> >> > > better than it used to be. The good thing about them being
> > >> >> >> > > annoying is that they will likely get fixed :-)
> > >> >> >> > 
> > >> >> >> > I think I traced this to the copying of CSD a while back. The
> > >> >> >> > problem is that the transferred buffer is 8 bytes, so there's
> > >> >> >> > no way to make it aligned properly. Unfortunately the entailing
> > >> >> >> > discussion did not yield a solution at the time.
> > >> >> >> 
> > >> >> >> And how exactly does the MMC bounce buffer not help here?
> > >> >> > 
> > >> >> > The problem solved by the bounce buffer is that it is properly
> > >> >> > cache- line aligned. However the issue here is not that the buffer
> > >> >> > is not properly aligned but rather that the transfer is too small.
> > >> >> > 
> > >> >> > When the MMC core transfers the SCR, it requests 8 bytes. The
> > >> >> > buffer used to store these 8 bytes is properly allocated. However,
> > >> >> > those 8 bytes eventually end up as the size of the range that is
> > >> >> > to be invalidated. This is the reason for the warning. Address x
> > >> >> > of the buffer is cache-line aligned, but x + 8 is never properly
> > >> >> > aligned and therefore the code complains.
> > >> >> 
> > >> >> Would it be too dreadful to define a minimum MMC transfer size, and
> > >> >> set that to the cache line size?
> > >> > 
> > >> > I did try setting the data size to the cache line size back then, but
> > >> > that resulted in an error. After that I gave up. I think what we
> > >> > really need to do is separate the invalidation size from the transfer
> > >> > size in order to properly handle these situations. Or alternatively
> > >> > pass an additional buffer size so the code knows how much needs to be
> > >> > invalidated. AFAICT this is the only location where this actually
> > >> > happens. All other transfers are

Re: [U-Boot] [PATCH 62/71] serial: spl: Implement empty functions for SPL

2012-09-18 Thread Marek Vasut
Dear Tom Rini,

> On 09/18/12 11:33, Marek Vasut wrote:
> > Dear Scott Wood,
> 
> [snip]
> 
> >> I think I got some wires crossed and was thinking about
> >> printf/puts. We want those to be optimized away at compile time
> >> (not pointed to a stub at link time) on an SPL that has no output
> >> support, but once that's done the low level serial functions
> >> shouldn't be referenced anymore, right?
> > 
> > But if you point them to stubs, that's OK. The compiler will GC
> > these useless stubs anyway. But wait, we're getting to LTO here,
> > right?
> > 
> > So the safest bet really is macro in serial.h ?
> 
> Due to the gcc bug I've mentioned before, yes.  Dummy functions will,
> I bet, keep the string constants around.  do {} while(0) will drop
> them out entirely.

Yea ... the GCC bug, what a crap :-(

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


  1   2   >