[U-Boot] [PATCH v3 7/7] arm:trats: Enable g_dnl composite USB gadget with embedded DFU function on TRATS

2012-07-30 Thread Lukasz Majewski
Enable the g_dnl composite USB gadget driver with embedded DFU function on it.
It now uses the composite gadget framework to support download specific
USB functions (like enabled DFU or USB Mass Storage).

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 
Cc: Minkyu Kang 

---
Change for v2:
- Move the G_DNL_{VENDOR_NUM, PRODUCT_NUM and MANUFACTURER} definitions to
  ./include/configs/.h

Changes for v3:
- None
---
 include/configs/trats.h |   24 +++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/include/configs/trats.h b/include/configs/trats.h
index eb269b2..75a23b0 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -94,6 +94,21 @@
 #undef CONFIG_CMD_ONENAND
 #undef CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
+
+/* FAT */
+#define CONFIG_CMD_FAT
+#define CONFIG_FAT_WRITE
+
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
+
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 #define CONFIG_BOOTDELAY   1
 #define CONFIG_ZERO_BOOTDELAY_CHECK
@@ -104,6 +119,11 @@
 #define CONFIG_BOOTBLOCK   "10"
 #define CONFIG_ENV_COMMON_BOOT "${console} ${meminfo}"
 
+#define CONFIG_DFU_ALT \
+   "dfu_alt_info=" \
+   "u-boot mmc 80 400;" \
+   "uImage fat 0 2\0" \
+
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
@@ -146,7 +166,8 @@
"mmcdev=0\0" \
"mmcbootpart=2\0" \
"mmcrootpart=3\0" \
-   "opts=always_resume=1"
+   "opts=always_resume=1\0" \
+   CONFIG_DFU_ALT
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
@@ -209,6 +230,7 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW2
 
 /* LCD */
 #define CONFIG_EXYNOS_FB
-- 
1.7.2.3

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


[U-Boot] [PATCH v3 6/7] arm:trats: Support for USB UDC driver at TRATS board.

2012-07-30 Thread Lukasz Majewski
Support for USB UDC driver at trats board.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 
Cc: Minkyu Kang 

---
Changes for v2:
- replace puts to debug
---
 board/samsung/trats/trats.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index a8b2b11..4f9cb5a 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -59,6 +59,8 @@ static int hwrevision(int rev)
return (board_rev & 0xf) == rev;
 }
 
+struct s3c_plat_otg_data s5pc210_otg_data;
+
 int board_init(void)
 {
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
@@ -259,6 +261,12 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
.usb_phy_ctrl   = EXYNOS4_USBPHY_CONTROL,
.usb_flags  = PHY0_SLEEP,
 };
+
+void board_usb_init(void)
+{
+   debug("USB_udc_probe\n");
+   s3c_udc_probe(&s5pc210_otg_data);
+}
 #endif
 
 static void pmic_reset(void)
-- 
1.7.2.3

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


[U-Boot] [PATCH v3 2/7] dfu:usb: DFU USB function (f_dfu) support for g_dnl composite gadget

2012-07-30 Thread Lukasz Majewski
Support for f_dfu USB function.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 

---
Changes for v2:

- Replace kzalloc and kfree with free and calloc
- Reorganization of calloc calls
- Misspelling corrected
- Redesign of DFU state machine from "switch case" to function pointers
- Split the dfu_handle method to separate functions for each DFU state

Changes for v3:
- Missing parenthesis added to sizeof call
---
 drivers/usb/gadget/Makefile |1 +
 drivers/usb/gadget/f_dfu.c  |  751 +++
 drivers/usb/gadget/f_dfu.h  |  100 ++
 3 files changed, 852 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/f_dfu.c
 create mode 100644 drivers/usb/gadget/f_dfu.h

diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 2c067c8..5bbdd36 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -30,6 +30,7 @@ ifdef CONFIG_USB_GADGET
 COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
 COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
+COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
 endif
 ifdef CONFIG_USB_ETHER
 COBJS-y += ether.o epautoconf.o config.o usbstring.o
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
new file mode 100644
index 000..17b656c
--- /dev/null
+++ b/drivers/usb/gadget/f_dfu.c
@@ -0,0 +1,751 @@
+/*
+ * f_dfu.c -- Device Firmware Update USB function
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * authors: Andrzej Pietrasiewicz 
+ *  Lukasz Majewski 
+ *
+ * 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 
+#include "f_dfu.h"
+
+struct f_dfu {
+   struct usb_function usb_function;
+
+   struct usb_descriptor_header**function;
+   struct usb_string   *strings;
+
+   /* when configured, we have one config */
+   u8  config;
+   u8  altsetting;
+   enum dfu_state  dfu_state;
+   unsigned intdfu_status;
+
+   /* Send/received block number is handy for data integrity check */
+   int blk_seq_num;
+};
+
+typedef int (*dfu_state_fn) (struct f_dfu *,
+const struct usb_ctrlrequest *,
+struct usb_gadget *,
+struct usb_request *);
+
+static inline struct f_dfu *func_to_dfu(struct usb_function *f)
+{
+   return container_of(f, struct f_dfu, usb_function);
+}
+
+static const struct dfu_function_descriptor dfu_func = {
+   .bLength =  sizeof dfu_func,
+   .bDescriptorType =  DFU_DT_FUNC,
+   .bmAttributes = DFU_BIT_WILL_DETACH |
+   DFU_BIT_MANIFESTATION_TOLERANT |
+   DFU_BIT_CAN_UPLOAD |
+   DFU_BIT_CAN_DNLOAD,
+   .wDetachTimeOut =   0,
+   .wTransferSize =DFU_USB_BUFSIZ,
+   .bcdDFUVersion =__constant_cpu_to_le16(0x0110),
+};
+
+static struct usb_interface_descriptor dfu_intf_runtime = {
+   .bLength =  sizeof dfu_intf_runtime,
+   .bDescriptorType =  USB_DT_INTERFACE,
+   .bNumEndpoints =0,
+   .bInterfaceClass =  USB_CLASS_APP_SPEC,
+   .bInterfaceSubClass =   1,
+   .bInterfaceProtocol =   1,
+   /* .iInterface = DYNAMIC */
+};
+
+static struct usb_descriptor_header *dfu_runtime_descs[] = {
+   (struct usb_descriptor_header *) &dfu_intf_runtime,
+   NULL,
+};
+
+static struct usb_qualifier_descriptor dev_qualifier = {
+   .bLength =  sizeof dev_qualifier,
+   .bDescriptorType =  USB_DT_DEVICE_QUALIFIER,
+   .bcdUSB =   __constant_cpu_to_le16(0x0200),
+   .bDeviceClass = USB_CLASS_VENDOR_SPEC,
+   .bNumConfigurations =   1,
+};
+
+static const char dfu_name[] = "Device Firmware Upgrade";
+
+/*
+ * static strings, in UTF-8
+ *
+ * dfu_generic configuration
+ */
+static struct usb_string strings_dfu_generic[] = {
+   [0].s = dfu_name,
+   {  }/* end of list */
+};
+
+static struct us

[U-Boot] [PATCH v3 4/7] dfu: MMC specific routines for DFU operation

2012-07-30 Thread Lukasz Majewski
Support for MMC storage devices to work with DFU framework.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 

---
Changes for v2:
- None

Changes for v3:
- Provide special abstraction layer (mmc_{block|file}_{read|write})
  to alleviate switch to new device model (DM)
- More verbose messages when not supported layout encountered
- Calls to strncmp() replaced with strcmp()
---
 drivers/dfu/Makefile  |1 +
 drivers/dfu/dfu_mmc.c |  165 +
 2 files changed, 166 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dfu/dfu_mmc.c

diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
index 7736485..7b717bc 100644
--- a/drivers/dfu/Makefile
+++ b/drivers/dfu/Makefile
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB= $(obj)libdfu.o
 
 COBJS-$(CONFIG_DFU_FUNCTION) += dfu.o
+COBJS-$(CONFIG_DFU_MMC) += dfu_mmc.o
 
 SRCS:= $(COBJS-y:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS-y))
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
new file mode 100644
index 000..3909910
--- /dev/null
+++ b/drivers/dfu/dfu_mmc.c
@@ -0,0 +1,165 @@
+/*
+ * dfu.c -- DFU back-end routines
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * author: Lukasz Majewski 
+ *
+ * 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 
+
+enum dfu_mmc_op {
+   DFU_OP_READ = 1,
+   DFU_OP_WRITE,
+};
+
+static int mmc_block_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
+   void *buf, long *len)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, cmd_buf, DFU_CMD_BUF_SIZE);
+   memset(cmd_buf, '\0', sizeof(cmd_buf));
+
+   sprintf(cmd_buf, "mmc %s 0x%x %x %x",
+   op == DFU_OP_READ ? "read" : "write",
+   (unsigned int) buf,
+   dfu->data.mmc.lba_start,
+   dfu->data.mmc.lba_size);
+
+   if (op == DFU_OP_READ)
+   *len = dfu->data.mmc.lba_blk_size * dfu->data.mmc.lba_size;
+
+   debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
+   return run_command(cmd_buf, 0);
+}
+
+static inline int mmc_block_write(struct dfu_entity *dfu, void *buf, long *len)
+{
+   return mmc_block_op(DFU_OP_WRITE, dfu, buf, len);
+}
+
+static inline int mmc_block_read(struct dfu_entity *dfu, void *buf, long *len)
+{
+   return mmc_block_op(DFU_OP_READ, dfu, buf, len);
+}
+
+static int mmc_file_op(enum dfu_mmc_op op, struct dfu_entity *dfu,
+   void *buf, long *len)
+{
+   ALLOC_CACHE_ALIGN_BUFFER(char, cmd_buf, DFU_CMD_BUF_SIZE);
+   char *str_env;
+   int ret;
+
+   memset(cmd_buf, '\0', sizeof(cmd_buf));
+
+   sprintf(cmd_buf, "fat%s mmc %d:%d 0x%x %s %lx",
+   op == DFU_OP_READ ? "load" : "write",
+   dfu->data.mmc.dev, dfu->data.mmc.part,
+   (unsigned int) buf, dfu->name, *len);
+
+   debug("%s: %s 0x%p\n", __func__, cmd_buf, cmd_buf);
+
+   ret = run_command(cmd_buf, 0);
+   if (ret) {
+   puts("dfu: Read error!\n");
+   return ret;
+   }
+
+   if (dfu->layout != DFU_RAW_ADDR) {
+   str_env = getenv("filesize");
+   if (str_env == NULL) {
+   puts("dfu: Wrong file size!\n");
+   return -1;
+   }
+   *len = simple_strtoul(str_env, NULL, 16);
+   }
+
+   return ret;
+}
+
+static inline int mmc_file_write(struct dfu_entity *dfu, void *buf, long *len)
+{
+   return mmc_file_op(DFU_OP_WRITE, dfu, buf, len);
+}
+
+static inline int mmc_file_read(struct dfu_entity *dfu, void *buf, long *len)
+{
+   return mmc_file_op(DFU_OP_READ, dfu, buf, len);
+}
+
+int dfu_write_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
+{
+   int ret = -1;
+
+   switch (dfu->layout) {
+   case DFU_RAW_ADDR:
+   ret = mmc_block_write(dfu, buf, len);
+   break;
+   case DFU_FS_FAT:
+   ret = mmc_file_write(dfu, buf, len);
+   break;
+   default:
+   printf("%s: Layout (%s) not (yet) supported!\n", __func__,
+  dfu_get_layout(dfu->layout));
+   }
+
+   return ret;
+}
+
+int dfu_read_medium_mmc(struct dfu_entity *dfu, void *buf, long *len)
+{
+   int ret = -1;

[U-Boot] [PATCH v3 5/7] dfu:cmd: Support for DFU u-boot command

2012-07-30 Thread Lukasz Majewski
Support for u-boot's "dfu   [list]" command.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 

---
Changes for v2:
- None

Changes for v3:
- Remove unnecessary initialization to NULL of dynamic variables
- goto done added to reduce code duplication
- static definition of do_dfu()
---
 common/Makefile  |1 +
 common/cmd_dfu.c |   81 ++
 2 files changed, 82 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_dfu.c

diff --git a/common/Makefile b/common/Makefile
index 483eb4d..32d44e5 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -183,6 +183,7 @@ COBJS-$(CONFIG_MENU) += menu.o
 COBJS-$(CONFIG_MODEM_SUPPORT) += modem.o
 COBJS-$(CONFIG_UPDATE_TFTP) += update.o
 COBJS-$(CONFIG_USB_KEYBOARD) += usb_kbd.o
+COBJS-$(CONFIG_CMD_DFU) += cmd_dfu.o
 endif
 
 ifdef CONFIG_SPL_BUILD
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
new file mode 100644
index 000..72efb60
--- /dev/null
+++ b/common/cmd_dfu.c
@@ -0,0 +1,81 @@
+/*
+ * cmd_dfu.c -- dfu command
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * authors: Andrzej Pietrasiewicz 
+ * Lukasz Majewski 
+ *
+ * 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 
+
+static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+   static char *s = "dfu";
+   const char *str_env;
+   char *env_bkp;
+   int ret;
+
+   if (argc < 3)
+   return CMD_RET_USAGE;
+
+   str_env = getenv("dfu_alt_info");
+   if (str_env == NULL) {
+   printf("%s: \"dfu_alt_info\" env variable not defined!\n",
+  __func__);
+   return CMD_RET_FAILURE;
+   }
+
+   env_bkp = strdup(str_env);
+   ret = dfu_config_entities(env_bkp, argv[1],
+   (int)simple_strtoul(argv[2], NULL, 10));
+   if (ret)
+   return CMD_RET_FAILURE;
+
+   if (strcmp(argv[3], "list") == 0) {
+   dfu_show_entities();
+   goto done;
+   }
+
+   board_usb_init();
+   g_dnl_register(s);
+   while (1) {
+   if (ctrlc())
+   goto exit;
+
+   usb_gadget_handle_interrupts();
+   }
+exit:
+   g_dnl_unregister();
+done:
+   dfu_free_entities();
+   free(env_bkp);
+
+   return CMD_RET_SUCCESS;
+}
+
+U_BOOT_CMD(dfu, CONFIG_SYS_MAXARGS, 1, do_dfu,
+   "Device Firmware Upgrade",
+   "  [list]\n"
+   "  - device firmware upgrade on a device \n"
+   "attached to interface \n"
+   "[list] - list available alt settings"
+);
-- 
1.7.2.3

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


[U-Boot] [PATCH v3 3/7] dfu: DFU backend implementation

2012-07-30 Thread Lukasz Majewski
New, separate driver at ./drivers/dfu has been added. It allows platform
and storage independent operation of DFU.
It has been extended to use new MMC level of command abstraction.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 

---
Changes for v2:
- None

Changes for v3:
- Remove unnecessary NULL and 0 initialization of dynamic variables
- Combine two puts to one
- Adding const qualifier to device and layout definitions
- Remove unnecessary casting at dfu->name passing
- Provide more meaningful names for dfu layouts and device types
- Removal of dfu_extract_{token|entity} functions and replace them
  with strsep calls
---
 Makefile |1 +
 drivers/dfu/Makefile |   43 +
 drivers/dfu/dfu.c|  237 ++
 include/dfu.h|  103 ++
 4 files changed, 384 insertions(+), 0 deletions(-)
 create mode 100644 drivers/dfu/Makefile
 create mode 100644 drivers/dfu/dfu.c
 create mode 100644 include/dfu.h

diff --git a/Makefile b/Makefile
index d57c15e..bd469f4 100644
--- a/Makefile
+++ b/Makefile
@@ -271,6 +271,7 @@ LIBS += drivers/pci/libpci.o
 LIBS += drivers/pcmcia/libpcmcia.o
 LIBS += drivers/power/libpower.o
 LIBS += drivers/spi/libspi.o
+LIBS += drivers/dfu/libdfu.o
 ifeq ($(CPU),mpc83xx)
 LIBS += drivers/qe/libqe.o
 LIBS += arch/powerpc/cpu/mpc8xxx/ddr/libddr.o
diff --git a/drivers/dfu/Makefile b/drivers/dfu/Makefile
new file mode 100644
index 000..7736485
--- /dev/null
+++ b/drivers/dfu/Makefile
@@ -0,0 +1,43 @@
+#
+# Copyright (C) 2012 Samsung Electronics
+# Lukasz Majewski 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)libdfu.o
+
+COBJS-$(CONFIG_DFU_FUNCTION) += dfu.o
+
+SRCS:= $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+
+$(LIB):$(obj).depend $(OBJS)
+   $(call cmd_link_o_target, $(OBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
new file mode 100644
index 000..8f48b49
--- /dev/null
+++ b/drivers/dfu/dfu.c
@@ -0,0 +1,237 @@
+/*
+ * dfu.c -- DFU back-end routines
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * author: Lukasz Majewski 
+ *
+ * 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 
+
+static LIST_HEAD(dfu_list);
+static int dfu_alt_num;
+
+static int dfu_find_alt_num(char *s)
+{
+   int i = 0;
+
+   for (; *s; s++)
+   if (*s == ';')
+   i++;
+
+   return ++i;
+}
+
+static unsigned char __aligned(CONFIG_SYS_CACHELINE_SIZE)
+dfu_buf[DFU_DATA_BUF_SIZE];
+
+int dfu_write(struct dfu_entity *dfu, void *buf, int size, int blk_seq_num)
+{
+   static unsigned char *i_buf;
+   static int i_blk_seq_num;
+   long w_size = 0;
+   int ret = 0;
+
+   debug("%s: name: %s buf: 0x%p size: 0x%x p_num: 0x%x i_buf: 0x%p\n",
+  __func__, dfu->name, buf, size, blk_seq_num, i_buf);
+
+   if (blk_seq_num == 0) {
+   memset(dfu_buf, '\0', sizeof(dfu_buf));
+   i_buf = dfu_buf;
+   i_blk_seq_num = 0;
+   }
+
+   if (i_blk_seq_num++ != blk_seq_num) {
+   printf("%s: Wrong sequence number! [%d] [%d]\n",
+  

[U-Boot] [PATCH v3 0/7] dfu:usb: DFU support via USB Download gadget

2012-07-30 Thread Lukasz Majewski
Those patches add support for composite USB download gadget.
This gadget (at least for now) is equipped with DFU download function.

A separate DFU back-end and front-end have been added.
Back-end is placed at ./drivers/dfu directory. The front-end is implemented
as USB function.

The back-end is written in a generic manner with storage device specific
code separated (eMMC).

DFU specification can be found at:
http://wiki.openmoko.org/wiki/USB_DFU_-_The_USB_Device_Firmware_Upgrade_standard

Example usage:

u-boot side: dfu mmc 0
PC: dfu-util -U IMAGE.bin -a uImage (for upload)
dfu-util -D uImage -a uImage (download)

To list the alt settings:
dfu mmc 0 list

Test HW:
Exynos4210 Trats board


Lukasz Majewski (7):
  dfu:usb: Support for g_dnl composite download gadget.
  dfu:usb: DFU USB function (f_dfu) support for g_dnl composite gadget
  dfu: DFU backend implementation
  dfu: MMC specific routines for DFU operation
  dfu:cmd: Support for DFU u-boot command
  arm:trats: Support for USB UDC driver at TRATS board.
  arm:trats: Enable g_dnl composite USB gadget with embedded DFU
function on TRATS

 Makefile|1 +
 board/samsung/trats/trats.c |8 +
 common/Makefile |1 +
 common/cmd_dfu.c|   81 +
 drivers/dfu/Makefile|   44 +++
 drivers/dfu/dfu.c   |  237 ++
 drivers/dfu/dfu_mmc.c   |  165 ++
 drivers/usb/gadget/Makefile |2 +
 drivers/usb/gadget/f_dfu.c  |  751 +++
 drivers/usb/gadget/f_dfu.h  |  100 ++
 drivers/usb/gadget/g_dnl.c  |  218 +
 include/configs/trats.h |   24 ++-
 include/dfu.h   |  103 ++
 include/g_dnl.h |   33 ++
 14 files changed, 1767 insertions(+), 1 deletions(-)
 create mode 100644 common/cmd_dfu.c
 create mode 100644 drivers/dfu/Makefile
 create mode 100644 drivers/dfu/dfu.c
 create mode 100644 drivers/dfu/dfu_mmc.c
 create mode 100644 drivers/usb/gadget/f_dfu.c
 create mode 100644 drivers/usb/gadget/f_dfu.h
 create mode 100644 drivers/usb/gadget/g_dnl.c
 create mode 100644 include/dfu.h
 create mode 100644 include/g_dnl.h

-- 
1.7.2.3

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


[U-Boot] [PATCH v3 1/7] dfu:usb: Support for g_dnl composite download gadget.

2012-07-30 Thread Lukasz Majewski
Composite USB download gadget support (g_dnl) for download functions.
This code works on top of composite gadget.

Signed-off-by: Lukasz Majewski 
Signed-off-by: Kyungmin Park 
Cc: Marek Vasut 

---
Changes for v2:

- G_DNL_{VENDOR_NUM, PRODUCT_NUM and MANUFACTURER} defined at
./include/configs/.h
- Suspend and resume stub methods removed
- '\0' repleaced with plain 0

Changes for v3:
- Remove unused #includes
- Replace strncpy and strncat with strcpy and strcat. It was possible
  due to new approach to g_dnl name generation (at g_dnl_register function)
- Rename the g_dnl_{init|cleanup} to g_dnl_{register|unregister}
- Replace the G_DNL_* CONFIG_G_DNL_*
---
 drivers/usb/gadget/Makefile |1 +
 drivers/usb/gadget/g_dnl.c  |  218 +++
 include/g_dnl.h |   33 +++
 3 files changed, 252 insertions(+), 0 deletions(-)
 create mode 100644 drivers/usb/gadget/g_dnl.c
 create mode 100644 include/g_dnl.h

diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 87d1918..2c067c8 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -29,6 +29,7 @@ LIB   := $(obj)libusb_gadget.o
 ifdef CONFIG_USB_GADGET
 COBJS-y += epautoconf.o config.o usbstring.o
 COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
+COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
 endif
 ifdef CONFIG_USB_ETHER
 COBJS-y += ether.o epautoconf.o config.o usbstring.o
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
new file mode 100644
index 000..a77da30
--- /dev/null
+++ b/drivers/usb/gadget/g_dnl.c
@@ -0,0 +1,218 @@
+/*
+ * g_dnl.c -- USB Downloader Gadget
+ *
+ * Copyright (C) 2012 Samsung Electronics
+ * Lukasz Majewski  
+ *
+ * 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 "f_dfu.h"
+
+#include "gadget_chips.h"
+#include "composite.c"
+
+/*
+ * One needs to define the following:
+ * CONFIG_G_DNL_VENDOR_NUM
+ * CONFIG_G_DNL_PRODUCT_NUM
+ * CONFIG_G_DNL_MANUFACTURER
+ * at e.g. ./include/configs/.h
+ */
+
+#define STRING_MANUFACTURER 25
+#define STRING_PRODUCT 2
+#define STRING_USBDOWN 2
+#define CONFIG_USBDOWNLOADER 2
+
+#define DRIVER_VERSION "usb_dnl 2.0"
+
+static const char shortname[] = "usb_dnl_";
+static const char product[] = "USB download gadget";
+static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
+
+static struct usb_device_descriptor device_desc = {
+   .bLength =  sizeof device_desc,
+   .bDescriptorType =  USB_DT_DEVICE,
+
+   .bcdUSB =   __constant_cpu_to_le16(0x0200),
+   .bDeviceClass = USB_CLASS_COMM,
+   .bDeviceSubClass =  0x02,   /*0x02:CDC-modem , 0x00:CDC-serial*/
+
+   .idVendor = __constant_cpu_to_le16(CONFIG_G_DNL_VENDOR_NUM),
+   .idProduct =__constant_cpu_to_le16(CONFIG_G_DNL_PRODUCT_NUM),
+   .iProduct = STRING_PRODUCT,
+   .bNumConfigurations =   1,
+};
+
+static const struct usb_descriptor_header *otg_desc[] = {
+   (struct usb_descriptor_header *) &(struct usb_otg_descriptor){
+   .bLength =  sizeof(struct usb_otg_descriptor),
+   .bDescriptorType =  USB_DT_OTG,
+   .bmAttributes = USB_OTG_SRP,
+   },
+   NULL,
+};
+
+/* static strings, in UTF-8 */
+static struct usb_string odin_string_defs[] = {
+   { 0, manufacturer, },
+   { 1, product, },
+};
+
+static struct usb_gadget_strings odin_string_tab = {
+   .language   = 0x0409,   /* en-us */
+   .strings= odin_string_defs,
+};
+
+static struct usb_gadget_strings *g_dnl_composite_strings[] = {
+   &odin_string_tab,
+   NULL,
+};
+
+static int g_dnl_unbind(struct usb_composite_dev *cdev)
+{
+   debug("%s\n", __func__);
+   return 0;
+}
+
+static int g_dnl_do_config(struct usb_configuration *c)
+{
+   int ret = -1;
+   char *s = (char *) c->cdev->driver->name;
+
+   debug("%s: configuration: 0x%p composite dev: 0x%p\n",
+ __func__, c, c->cdev);
+
+   if (gadget_is_otg(c->cdev->gadget)) {
+   c->descriptors = otg_desc;
+   c->bmAttributes |= USB_CONFIG_ATT_WAKEUP;
+   }
+
+   printf("GADGET DRIVER: %s\n", s);
+
+   i

[U-Boot] Help with u-boot

2012-07-30 Thread Андрей Борисович
Hello
Help make a u-bottles for sti7109 for mb442 motherboards and Linux to boot
in 32bit mode. (now loaded in 29bit mode)
Thanks in advance.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] tegra: Enable NAND on TEC

2012-07-30 Thread Thierry Reding
This commit enables NAND support on the Tamonten Evaluation Carrier and
adds the corresponding device tree nodes. Furthermore, the U-Boot
environment can now be stored in NAND.

Signed-off-by: Thierry Reding 
---
 board/avionic-design/dts/tegra20-tec.dts | 11 +++
 include/configs/tec.h| 12 ++--
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/board/avionic-design/dts/tegra20-tec.dts 
b/board/avionic-design/dts/tegra20-tec.dts
index 9faebd8..bb3851b 100644
--- a/board/avionic-design/dts/tegra20-tec.dts
+++ b/board/avionic-design/dts/tegra20-tec.dts
@@ -55,4 +55,15 @@
usb@c5004000 {
status = "disabled";
};
+
+   nand-controller@70008000 {
+   nvidia,wp-gpios = <&gpio 23 0>; /* PC7 */
+   nvidia,width = <8>;
+   nvidia,timing = <26 100 20 80 20 10 12 10 70>;
+
+   nand@0 {
+   reg = <0>;
+   compatible = "hynix,hy27uf4g2b", "nand-flash";
+   };
+   };
 };
diff --git a/include/configs/tec.h b/include/configs/tec.h
index 9b3f88d..54fcd41 100644
--- a/include/configs/tec.h
+++ b/include/configs/tec.h
@@ -45,14 +45,22 @@
 
 #define CONFIG_BOARD_EARLY_INIT_F
 
-#define CONFIG_ENV_IS_NOWHERE
-
 /* SD/MMC */
 #define CONFIG_MMC
 #define CONFIG_GENERIC_MMC
 #define CONFIG_TEGRA_MMC
 #define CONFIG_CMD_MMC
 
+/* NAND support */
+#define CONFIG_CMD_NAND
+#define CONFIG_TEGRA_NAND
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE   TEGRA20_NAND_BASE
+
+/* Environment not stored */
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET  (SZ_512M - SZ_128K) /* 128K sector size 
*/
+
 /* USB host support */
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_TEGRA
-- 
1.7.11.3

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


[U-Boot] [PATCH 1/2] cmd_nand: dump: Align data and OOB buffers

2012-07-30 Thread Thierry Reding
In order for cache invalidation and flushing to work properly, the data
and OOB buffers must be aligned to full cache lines.

Signed-off-by: Thierry Reding 
---
 common/cmd_nand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index a91ccf4..4367f5a 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -48,8 +48,8 @@ static int nand_dump(nand_info_t *nand, ulong off, int 
only_oob, int repeat)
 
last = off;
 
-   datbuf = malloc(nand->writesize);
-   oobbuf = malloc(nand->oobsize);
+   datbuf = memalign(ARCH_DMA_MINALIGN, nand->writesize);
+   oobbuf = memalign(ARCH_DMA_MINALIGN, nand->oobsize);
if (!datbuf || !oobbuf) {
puts("No memory for page buffer\n");
return 1;
-- 
1.7.11.3

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


Re: [U-Boot] [PATCH v4 0/6] tegra: Add NAND flash support

2012-07-30 Thread Thierry Reding
On Sun, Jul 29, 2012 at 11:53:24PM -0700, Simon Glass wrote:
> This series adds NAND flash support to Tegra and enables it on Seaboard.
> 
> Included here is a proposed device tree binding with most of the properties
> private to "nvidia,". The binding includes information about the NAND
> controller as well as the connected NAND device. The Seaboard has a
> Hynix HY27UF4G2B.
> 
> The driver supports ECC-based access and uses DMA and NAND acceleration
> features of the Tegra SOC to provide access at reasonable speed.

There is an issue with the nand dump command, but it was easy to fix.
I'll send a patch along with support on TEC which I've tested this on
successfully:

Tested-by: Thierry Reding 


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


Re: [U-Boot] [PATCH] lsxl: support power switch

2012-07-30 Thread Prafulla Wadaskar


> -Original Message-
> From: Michael Walle [mailto:mich...@walle.cc]
> Sent: 31 July 2012 02:17
> To: u-boot@lists.denx.de
> Cc: Michael Walle; Prafulla Wadaskar
> Subject: [PATCH] lsxl: support power switch
> 
> This patch restores the Linkstation's original behaviour when powering
> off.
> Once the (soft) power switch is turned off, linux will reboot and the
> bootloader turns off HDD and USB power. Then it loops as long as the
> switch
> is in the off position, before continuing the boot process again.
> 
> Additionally, this patch fixes the board function set_led(LED_OFF).
> 
> Signed-off-by: Michael Walle 
> Cc: Prafulla Wadaskar 
> ---
>  board/buffalo/lsxl/lsxl.c |   22 +-
>  1 files changed, 21 insertions(+), 1 deletions(-)
> 
> diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
> index fe15511..b3f31d6 100644
> --- a/board/buffalo/lsxl/lsxl.c
> +++ b/board/buffalo/lsxl/lsxl.c
> @@ -158,7 +158,7 @@ static void set_led(int state)
>  {
>   switch (state) {
>   case LED_OFF:
> - __set_led(0, 0, 0, 0, 0, 0);
> + __set_led(0, 0, 0, 1, 1, 1);
>   break;
>   case LED_ALARM_ON:
>   __set_led(0, 0, 0, 0, 1, 1);
> @@ -192,6 +192,25 @@ int board_init(void)
>  }
> 
>  #ifdef CONFIG_MISC_INIT_R
> +static void check_power_switch(void)
> +{
> + if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
> + /* turn off HDD and USB power */
> + kw_gpio_set_value(GPIO_HDD_POWER, 0);
> + kw_gpio_set_value(GPIO_USB_VBUS, 0);
> + set_led(LED_OFF);
> +
> + /* loop until released */
> + while (kw_gpio_get_value(GPIO_POWER_SWITCH))
> + ;

Please avoid infinite loop, may you introduce timeout?

> +
> + /* turn power on again */
> + kw_gpio_set_value(GPIO_HDD_POWER, 1);
> + kw_gpio_set_value(GPIO_USB_VBUS, 1);
> + set_led(LED_POWER_BLINKING);
> + }
> +}
> +
>  void check_enetaddr(void)
>  {
>   uchar enetaddr[6];
> @@ -261,6 +280,7 @@ static void check_push_button(void)
> 
>  int misc_init_r(void)
>  {
> + check_power_switch();
>   check_enetaddr();
>   check_push_button();

Ack for rest of the code.

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


Re: [U-Boot] [PATCH 2/2] kirkwood: Add support for the D-Link DNS-320

2012-07-30 Thread Prafulla Wadaskar


> -Original Message-
> From: Jamie Lentin [mailto:j...@lentin.co.uk]
> Sent: 31 July 2012 03:26
> To: u-boot@lists.denx.de
> Cc: Prafulla Wadaskar; albert.u.b...@aribaud.net;
> ub...@lukaperkov.net; Jamie Lentin
> Subject: [PATCH 2/2] kirkwood: Add support for the D-Link DNS-320
> 
> Extend dnskw to support the D-Link DNS-320 ShareCenter NAS also. For
> more
> information on this NAS, see:-
> 
>   http://jamie.lentin.co.uk/devices/dlink-dns320
>   http://dns323.kood.org/dns-320
>   http://sharecenter.dlink.com/products/DNS-320
> 
> Signed-off-by: Jamie Lentin 
> Cc: prafu...@marvell.com
> Cc: albert.u.b...@aribaud.net
> ---
>  MAINTAINERS|4 +
>  board/d-link/dnskw/dnskw.c |8 +-
>  board/d-link/dnskw/dnskw.h |6 +
>  board/d-link/dnskw/kwbimage.dns320.cfg |  207
> 
>  boards.cfg |1 +
>  include/configs/dnskw.h|   10 ++
>  6 files changed, 232 insertions(+), 4 deletions(-)
>  create mode 100644 board/d-link/dnskw/kwbimage.dns320.cfg
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index fd0c65c..92ede1f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -673,6 +673,10 @@ Igor Grinberg 
> 
>   cm-t35  ARM ARMV7 (OMAP3xx Soc)
> 
> +Jamie Lentin 
> +
> + dns320  ARM926EJS (Kirkwood SoC)
> +
>  Stefan Herbrechtsmeier 
> 
>   dns325  ARM926EJS (Kirkwood SoC)
> diff --git a/board/d-link/dnskw/dnskw.c b/board/d-link/dnskw/dnskw.c
> index d29735c..cd6bfe9 100644
> --- a/board/d-link/dnskw/dnskw.c
> +++ b/board/d-link/dnskw/dnskw.c
> @@ -58,8 +58,8 @@ int board_early_init_f(void)
>   MPP10_UART0_TXD,
>   MPP11_UART0_RXD,
>   MPP12_SD_CLK,
> - MPP13_SD_CMD,
> - MPP14_SD_D0,
> + MPP13_UART1_TXD,/* Custom ...*/
> + MPP14_UART1_RXD,/* ... controller */

Are these entries valid for both boards? If not then encapsulate with #ifdef

>   MPP15_SD_D1,
>   MPP16_SD_D2,
>   MPP17_SD_D3,
> @@ -74,13 +74,13 @@ int board_early_init_f(void)
>   MPP26_GPIO, /* power led */
>   MPP27_GPIO, /* sata0(right) error led */
>   MPP28_GPIO, /* sata1(left) error led */
> - MPP29_GPIO, /* usb error led */
> + MPP29_GPIO, /* usb error led (dns-325) */

Ditto

>   MPP30_GPIO,
>   MPP31_GPIO,
>   MPP32_GPIO,
>   MPP33_GPIO,
>   MPP34_GPIO, /* power key */
> - MPP35_GPIO,
> + MPP35_GPIO, /* usb error led (dns-320) */

Ditto

>   MPP36_GPIO,
>   MPP37_GPIO,
>   MPP38_GPIO,
> diff --git a/board/d-link/dnskw/dnskw.h b/board/d-link/dnskw/dnskw.h
> index 4b11cb6..8886050 100644
> --- a/board/d-link/dnskw/dnskw.h
> +++ b/board/d-link/dnskw/dnskw.h
> @@ -43,6 +43,12 @@
>  #define DNSKW_OE_VAL_HIGH0x0800  /* disable leds */
>  #endif /* CONFIG_BOARD_IS_DNS325 */
> 
> +/* DNS-320 specific configuration */
> +#ifdef CONFIG_BOARD_IS_DNS320
> +#define DNSKW_OE_VAL_LOW 0x3800  /* disable leds */
> +#define DNSKW_OE_VAL_HIGH0x0808  /* disable leds */
> +#endif /* CONFIG_BOARD_IS_DNS320 */
> +
>  /* PHY related */
>  #define MV88E1116_MAC_CTRL_REG   21
>  #define MV88E1116_PGADR_REG  22
> diff --git a/board/d-link/dnskw/kwbimage.dns320.cfg b/board/d-
> link/dnskw/kwbimage.dns320.cfg
> new file mode 100644
> index 000..5fb4052
> --- /dev/null
> +++ b/board/d-link/dnskw/kwbimage.dns320.cfg
> @@ -0,0 +1,207 @@
> +#
> +# Copyright (C) 2012
> +# Jamie Lentin 
> +#
> +# Based on dns325 support:
> +# Copyright (C) 2011
> +# Stefan Herbrechtsmeier 
> +#
> +# See file CREDITS for list of people who contributed to this
> +# project.
> +#
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License as
> +# published by the Free Software Foundation; either version 2 of
> +# the License, or (at your option) any later version.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
> +# MA 02110-1301 USA
> +#
> +# Refer docs/README.kwimage for more details about how-to configure
> +# and create kirkwood boot image
> +#
> +
> +# Boot Media configurations
> +BOOT_FROMnand
> +NAND_ECC_MODEdefault
> +NAND_PAGE_SIZE   0x0800
> +
> +# SOC

Re: [U-Boot] i.MX(6) dcache status?

2012-07-30 Thread Dirk Behme

On 31.07.2012 07:56, Dirk Behme wrote:

Hi,

now, after U-Boot v2012.07 is released, I'd like to ask what's the 
status the dcache support for i.MX(6)? Is it safe to enable 
CONFIG_SYS_DCACHE_OFF now?


Arg, inverted logic ;) I meant 'disable/remove' CONFIG_SYS_DCACHE_OFF 
here. I.e. is it save to _enable_ the dcache now?


Dirk


E.g. for the SabreLite [1]?

And if so, do we have to enable CONFIG_MMC_BOUNCE_BUFFER, too?

Opinions?

Many thanks and best regards

Dirk

[1] 
http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/mx6qsabrelite.h;h=e42fe6b00b445e2ea0623fb682cb758fdf09c586;hb=HEAD#l238

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


[U-Boot] i.MX(6) dcache status?

2012-07-30 Thread Dirk Behme

Hi,

now, after U-Boot v2012.07 is released, I'd like to ask what's the 
status the dcache support for i.MX(6)? Is it safe to enable 
CONFIG_SYS_DCACHE_OFF now? E.g. for the SabreLite [1]?


And if so, do we have to enable CONFIG_MMC_BOUNCE_BUFFER, too?

Opinions?

Many thanks and best regards

Dirk

[1] 
http://git.denx.de/?p=u-boot.git;a=blob;f=include/configs/mx6qsabrelite.h;h=e42fe6b00b445e2ea0623fb682cb758fdf09c586;hb=HEAD#l238

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


Re: [U-Boot] [RESEND] [PATCH 0/2] kirkwood: Generalise dns325 support, include dns320

2012-07-30 Thread Prafulla Wadaskar
Dear Jamie Lentin

> -Original Message-
> From: Jamie Lentin [mailto:j...@lentin.co.uk]
> Sent: 31 July 2012 03:26
> To: u-boot@lists.denx.de
> Cc: Prafulla Wadaskar; albert.u.b...@aribaud.net;
> ub...@lukaperkov.net; Jamie Lentin
> Subject: [RESEND] [PATCH 0/2] kirkwood: Generalise dns325 support,
> include dns320
> 
> I submitted this a while ago[0], it would be nice to see it included
> if possible. It generalises the DNS325 support so that it can be used
> for both the DNS320 and DNS325.
> 
> Luka Perkov stated "I have no more questions regarding this patch",
> not
> sure if this counts as an ACK. The patch here is ~same, just rebased.
> 
> Somewhat related, I have tried using tools/kwboot to boot both NASes.
> The DNS325 boots fine, however the DNS320 reports:-
> 
> Sending boot message. Please reboot the target...|
> Sending boot image...
>   0 % [+xmodem: Bad message
> 
> UART-boot works with kwuartboot, although only when it is killed and
> restarted. If I work out anything interesting will follow it up in
> a separate thread.
> 
> Any feedback appreciated!
> 
> [0] http://thread.gmane.org/gmane.comp.boot-loaders.u-
> boot/130234/focus=130575
> 
> Jamie Lentin (2):
>   kirkwood: Rename dns325 to dnskw
>   kirkwood: Add support for the D-Link DNS-320
> 
>  MAINTAINERS|4 +
>  board/d-link/{dns325 => dnskw}/Makefile|2 +-
>  board/d-link/{dns325/dns325.c => dnskw/dnskw.c}|   18 +-
>  board/d-link/{dns325/dns325.h => dnskw/dnskw.h}|   30 ++-
>  board/d-link/dnskw/kwbimage.dns320.cfg |  207
> 
>  .../kwbimage.cfg => dnskw/kwbimage.dns325.cfg} |0
>  boards.cfg |3 +-
>  include/configs/{dns325.h => dnskw.h}  |   21 +-
>  8 files changed, 261 insertions(+), 24 deletions(-)
>  rename board/d-link/{dns325 => dnskw}/Makefile (98%)
>  rename board/d-link/{dns325/dns325.c => dnskw/dnskw.c} (90%)
>  rename board/d-link/{dns325/dns325.h => dnskw/dnskw.h} (65%)
>  create mode 100644 board/d-link/dnskw/kwbimage.dns320.cfg

Finally you will two kwbimage files for two  boards being supported.
BTW: I would like to ask : what is a difference between these two files? If it 
is very small, it can be handled in early_board_init().

In that case you can keep the earlier name kwbimage.cfg as it is and one file 
can be avoided.

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


Re: [U-Boot] [PATCH] tegra: enable NAND on Harmony

2012-07-30 Thread Thierry Reding
On Mon, Jul 30, 2012 at 11:37:52AM -0600, Stephen Warren wrote:
> diff --git a/include/configs/harmony.h b/include/configs/harmony.h
[...]
>  /* Environment not stored */
> -#define CONFIG_ENV_IS_NOWHERE
> +#define CONFIG_ENV_IS_IN_NAND
> +#define CONFIG_ENV_OFFSET(SZ_512M - SZ_128K) /* 128K sector size */

Perhaps the comment should be updated now.

Also on a semi-related note, do you think it would be useful to define
some kind of common layout for NAND content? I noticed that there is now
an open-source implementation of nvflash that could be used to bootstrap
U-Boot. That combined with the NAND support in U-Boot could be used to
streamline the bootstrapping of boards.

Thierry


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


Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB controllers at once

2012-07-30 Thread Marek Vasut
Dear Jim Lin,

> >-Original Message-
> >From: Marek Vasut [mailto:marek.va...@gmail.com]
> >Sent: Monday, July 30, 2012 8:02 PM
> >To: Jim Lin
> >Cc: Wolfgang Denk; Tom Warren; u-boot@lists.denx.de
> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
> >controllers at once
> >
> >Dear Jim Lin,
> >
> >> >-Original Message-
> >> >From: Marek Vasut [mailto:marek.va...@gmail.com]
> >> >Sent: Friday, July 27, 2012 5:26 PM
> >> >To: u-boot@lists.denx.de
> >> >Cc: Jim Lin; Wolfgang Denk; Tom Warren
> >> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
> >> >controllers at once
> >> >
> >> >> Wolfgang,
> >> >> Is there any chance to get this feature in after Stephen explained to
> >> >> you?
> >> >
> >> >I'll poke into it. Can we not get rid of the added ifdef, eg. by
> >> >setting up the controller number to 1 for those that don't define
> >> >CONFIG_USB_MULTI now (everyone)
> >> 
> >> I assume you want me to add these in next patch.
> >> 1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
> >> 
> >>  (current patch),
> >> 
> >> 2. If CONFIG_USB_MULTI is not defined, then define
> >> CONFIG_USB_MAX_CONTROLLER_COUNT as 1.
> >
> >Yes, is that a problem? Aka. have this always enabled and don't treat not
> >having multiple controllers as a special case.
> 
> Item 2 is not necessary.
> Because CONFIG_USB_MAX_CONTROLLER_COUNT will not be used if
> CONFIG_USB_MULTI is not defined.

But we don't need CONFIG_USB_MULTI option at all -- just assume it's always 
defined and unless a board has multiple controllers, define 
CONFIG_USB_MAX_CONTROLLER_COUNT to be 1.

Aka. it boils down to sticking

#ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
#define CONFIG_USB_MAX_CONTROLLER_COUNT 1
#endif

somewhere in usb.c or so.

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


Re: [U-Boot] Pull request - microblaze

2012-07-30 Thread Michal Simek

Dear Wolfgang Denk,

Please pull these patches to your repository. There will be one simple merge 
conflict
around SPI makefile which is easy to resolve.

dts/ patch is acked by Simon

Thanks,
Michal


The following changes since commit 436da3cd233e7166b5ce9293dbd28092cf37bcc9:
  u-b...@lakedaemon.net (1):
ext2load: increase read speed

are available in the git repository at:

  git://www.denx.de/git/u-boot-microblaze.git master

Michal Simek (6):
  microblaze: Add gpio.h
  microblaze: Move individual board linker scripts to common script in cpu 
tree.
  microblaze: Remove extern from board.c
  microblaze: Move __udelay implementation
  microblaze: Call serial multi initialization
  microblaze: intc: Clear interrupt code

Stephan Linz (9):
  microblaze: Remove wrong define CONFIG_SYS_FLASH_PROTECTION
  microblaze: Avoid compile error on systems without cfi flash
  microblaze: Enable ubi support
  microblaze: Expand and correct configuration comments
  microblaze: Add missing undefs for UBI and UBIFS
  fdt: Add board specific dts inclusion
  microblaze: Wire up dts configuration
  spi: microblaze: Adds driver for Xilinx SPI controller
  microblaze: Wire up SPI driver

 arch/microblaze/config.mk  |2 +
 arch/microblaze/cpu/interrupts.c   |   88 +
 arch/microblaze/cpu/start.S|2 -
 arch/microblaze/cpu/timer.c|   21 ++-
 .../microblaze/cpu}/u-boot.lds |0
 arch/microblaze/include/asm/gpio.h |   41 
 arch/microblaze/include/asm/microblaze_intc.h  |3 +
 arch/microblaze/lib/Makefile   |1 -
 arch/microblaze/lib/board.c|   15 +-
 arch/microblaze/lib/time.c |   42 
 board/xilinx/dts/microblaze.dts|1 +
 board/xilinx/microblaze-generic/dts/microblaze.dts |7 +
 drivers/spi/Makefile   |1 +
 drivers/spi/xilinx_spi.c   |  214 
 drivers/spi/xilinx_spi.h   |  135 
 dts/Makefile   |3 +-
 include/configs/microblaze-generic.h   |  129 ++--
 17 files changed, 594 insertions(+), 111 deletions(-)
 rename {board/xilinx/microblaze-generic => arch/microblaze/cpu}/u-boot.lds 
(100%)
 create mode 100644 arch/microblaze/include/asm/gpio.h
 create mode 100644 board/xilinx/dts/microblaze.dts
 create mode 100644 board/xilinx/microblaze-generic/dts/microblaze.dts
 create mode 100644 drivers/spi/xilinx_spi.c
 create mode 100644 drivers/spi/xilinx_spi.h

--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] microblaze: Wire up SPI driver

2012-07-30 Thread Michal Simek

On 07/29/2012 12:25 AM, Stephan Linz wrote:

Depending on XILINX_SPI_FLASH_BASEADDR enable SPI flash
and environment in SPI flash.

Expected values from xparameters.h are:
 - XILINX_SPI_FLASH_BASEADDR
 - XILINX_SPI_FLASH_MAX_FREQ
 - XILINX_SPI_FLASH_CS

Signed-off-by: Stephan Linz 
---
  include/configs/microblaze-generic.h |   55 --
  1 files changed, 52 insertions(+), 3 deletions(-)



Should be v2 in subject but applied.

Thanks,
Michal


--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] spi: microblaze: Adds driver for Xilinx SPI controller

2012-07-30 Thread Michal Simek

On 07/29/2012 12:25 AM, Stephan Linz wrote:

This is an improved version of the driver patch original
submitted by Graeme Smecher 

The changes are:
 - remove hard coded Xilinx BSP defines (XPAR_SPI_*) and
   use CONFIG_SYS_SPI_BASE from config.h instead
 - add extensive register struct definitions
 - remove offset calculation for register access and
   use the new register struct instead
 - move default SPI controller configuration from
   spi_setup_slave() to spi_claim_bus()
 - add spi_set_speed()
 - insert SPI controller deactivation in spi_release_bus()
 - protect while loops in spi_xfer() with counter / timeouts
 - support SPI mode flags: LSB_FIRST, CPHA, CPOL, LOOP

Come from:
 http://patchwork.ozlabs.org/patch/71797/

Signed-off-by: Stephan Linz 
---
v2: Remove useles information from commit message
 Add newline and split variable declaration from code


Should be v2 in subject but
I have tested and applied to microblaze custodian repo.

Thanks,
Michal


--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Wolfgang Denk
Dear Jim Shimer,

In message  
you wrote:
>
> Here's a patch.

Please read http://www.denx.de/wiki/U-Boot/Patches

User git-format-patch and git-send-email (or makae sure yourself to
stick to the mandatory format, which includes for example the
"[PATCH]" marker in the subject, and submit inline, not as MIME
atachment.


Finally: it appears you introduce a new config option
CONFIG_USB_LEGACY_RW - this MUST be documented.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
An optimist believes we live in the best world possible; a  pessimist
fears this is true.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Jim Shimer
Hi Marek,

Here's a patch.

-Jim

On Mon, Jul 30, 2012 at 7:41 PM, Marek Vasut  wrote:

> Dear Jim Shimer,
>
> > Marek,
> >
> > I don't have a USB 1.x device to do that regression. Taking the call to
> > usb_test_unit_ready out of the block reads/writes and leaving it only in
> > get info really speed up ext2load.  With the recent cache changes on top
> of
> > this and the 5ms delay, we're getting fairly close to the Linux USB
> > transfer times and are happy with the results.  Can you look into
> > integrating this?
>
> Can you send a patch that'll yank it out? I should be able to test it in a
> bit.
>
> > -Jim
> >
> > On Mon, Jul 30, 2012 at 6:54 PM, Marek Vasut  wrote:
> > > Dear Jim Shimer,
> > >
> > > > While tuning ext2load, we found that usb_test_unit_ready was being
> > > > called every block read.  We compared the usb block storage to the
> > > > scsi block storage cmd_scsi.c, and found that the scsi device was
> only
> > > > calling its scsi_setup_test_unit_ready() during scsi_can.  It appears
> > > > that usb_test_unit_ready() really only needs to be called once during
> > > > usb_stor_scan(), via usb_stor_get_info().   Is there a particular
> > > > reason usb_test_unit_ready is called for every block read, or do you
> > > > think its
> > >
> > > ok
> > >
> > > > to only call during usb_stor_scan()?  We're finding this speeds up
> > >
> > > ext2load
> > >
> > > > quite a bit.
> > >
> > > Could it be because the USB is actually quite slower than SCSI and the
> > > device
> > > might get congested? It seems the code was there ever since (I can't
> seem
> > > to
> > > find the origin of it) and we might actually want to try if this
> doesn't
> > > break
> > > some usb 1.x things.
> > >
> > > > Regards,
> > > > Jim
> > >
> > > Best regards,
> > > Marek Vasut
>
> Best regards,
> Marek Vasut
>



-- 
*James H Shimer*
Motorola Mobility T3-12-HH72
900 Chelmsford Street
Lowell MA 08151
978-614-3550


0001-Optimize-USB-load-ext2load-by-removing-uneeded-test-.patch
Description: Binary data
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Jim Shimer
Marek,

I don't have a USB 1.x device to do that regression. Taking the call to
usb_test_unit_ready out of the block reads/writes and leaving it only in
get info really speed up ext2load.  With the recent cache changes on top of
this and the 5ms delay, we're getting fairly close to the Linux USB
transfer times and are happy with the results.  Can you look into
integrating this?

-Jim

On Mon, Jul 30, 2012 at 6:54 PM, Marek Vasut  wrote:

> Dear Jim Shimer,
>
> > While tuning ext2load, we found that usb_test_unit_ready was being called
> > every block read.  We compared the usb block storage to the scsi block
> > storage cmd_scsi.c, and found that the scsi device was only calling its
> > scsi_setup_test_unit_ready() during scsi_can.  It appears that
> > usb_test_unit_ready() really only needs to be called once during
> > usb_stor_scan(), via usb_stor_get_info().   Is there a particular reason
> > usb_test_unit_ready is called for every block read, or do you think its
> ok
> > to only call during usb_stor_scan()?  We're finding this speeds up
> ext2load
> > quite a bit.
>
> Could it be because the USB is actually quite slower than SCSI and the
> device
> might get congested? It seems the code was there ever since (I can't seem
> to
> find the origin of it) and we might actually want to try if this doesn't
> break
> some usb 1.x things.
>
> > Regards,
> > Jim
>
> Best regards,
> Marek Vasut
>



-- 
*James H Shimer*
Motorola Mobility T3-12-HH72
900 Chelmsford Street
Lowell MA 08151
978-614-3550
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB controllers at once

2012-07-30 Thread Jim Lin
>-Original Message-
>From: Marek Vasut [mailto:marek.va...@gmail.com] 
>Sent: Monday, July 30, 2012 8:02 PM
>To: Jim Lin
>Cc: Wolfgang Denk; Tom Warren; u-boot@lists.denx.de
>Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB 
>controllers at once
>
>Dear Jim Lin,
>
>> >-Original Message-
>> >From: Marek Vasut [mailto:marek.va...@gmail.com]
>> >Sent: Friday, July 27, 2012 5:26 PM
>> >To: u-boot@lists.denx.de
>> >Cc: Jim Lin; Wolfgang Denk; Tom Warren
>> >Subject: Re: [U-Boot] [PATCH 1/1] USB: EHCI: Initialize multiple USB
>> >controllers at once
>> >
>> >> Wolfgang,
>> >> Is there any chance to get this feature in after Stephen explained to
>> >> you?
>> >
>> >I'll poke into it. Can we not get rid of the added ifdef, eg. by setting
>> >up the controller number to 1 for those that don't define
>> >CONFIG_USB_MULTI now (everyone)
>> 
>> I assume you want me to add these in next patch.
>> 1 . Use CONFIG_USB_MULTI, instead of CONFIG_USB_INIT_MULTI
>>  (current patch),
>> 2. If CONFIG_USB_MULTI is not defined, then define
>> CONFIG_USB_MAX_CONTROLLER_COUNT as 1.
>
>Yes, is that a problem? Aka. have this always enabled and don't treat not 
>having 
>multiple controllers as a special case.

Item 2 is not necessary.
Because CONFIG_USB_MAX_CONTROLLER_COUNT will not be used if
CONFIG_USB_MULTI is not defined.

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


Re: [U-Boot] [PATCH v2 2/5] ehci-hcd: Boost transfer speed

2012-07-30 Thread Benoît Thébaudeau
Dear Marek Vasut,

On Tue, Jul 31, 2012 at 12:38:54 AM, Marek Vasut wrote:
> [...]
> 
> > > > Can you explain where this gain would come from? In both cases,
> > > > the
> > > > data in USB
> > > > transfers would be organized in the same way, and it would be
> > > > accessed in memory
> > > > also in the same way (regarding bursts). The only difference
> > > > would
> > > > be the fetch
> > > > time of a little bit more qTDs, which is extremely fast and
> > > > insignificant
> > > > compared to the transfer time of the payload, which remains
> > > > unchanged.
> > > 
> > > You are right, the speed different will be minimal, only the
> > > memory
> > > usage will be lower.
> > 
> > If your point is only the memory gain, I agree. With your
> > suggestion, there
> > are roughly 25% less qTDs used in the "(max wMaxPacketSize)-aligned
> > but
> > not page-aligned" case since the number of qTDs is about (total
> > transfer
> > size) / 5 instead of (total transfer size) / 4. But this is still
> > small
> > compared to usual heap sizes (at least on the kind of hardware I
> > use).
> 
> Ok, I see the point. I understand it's not really a bug, just an
> improvement.

Exactly.

> Maybe we can do a subsequent patch on top of these from Benoit and
> see how it
> fares?

If you wish. I'll do that.

> > > > Moreover, in your use case, if you are e.g. using FAT, on the
> > > > one
> > > > hand, the
> > > > buffers in fat.c are never aligned to more than the DMA min
> > > > alignment, and on
> > > > the other hand, if you can align your user buffers to 512
> > > > bytes,
> > > > you can also
> > > > align them directly to 4 kB.
> > > 
> > > The user buffer is aligned to 4kB, but this doesn't matter as a
> > > file
> > > load from a storage device (ex. fatload) can be segmented in
> > > partial
> > > USB
> > > transfers. This can lead to any block aligned buffer for a
> > > partial
> > > transfer.
> > 
> > What do you mean by "partial USB transfers"? As seen from EHCI
> > users like
> > the MSC driver (usb_storage.c), USB transfers either succeed or
> > fail, but
> > they cannot be "segmented".
> 
> Segmented -- like multiple transfers being issues with small payload?
> You can
> not put these together at the USB-level, since it's the issuing code
> that has to
> be fixed.
> 
> > On its side, the MSC driver will only segment the FAT layer
> > requests if
> > they are larger than 65535 blocks, so still not what you describe.
> > 
> > As to the FAT stack, it will only read whole clusters while
> > accessing file
> > payload, and the most usual cluster sizes are by default a multiple
> > of 4
> > kiB (see http://support.microsoft.com/kb/140365).
> 
> 512b is minimum and it's quite often used.

OK.

> > So I don't see "segmentation" anywhere, and for usual cluster
> > sizes, the
> > EHCI buffer alignment is fully determined by the applicative buffer
> > alignment and the file position corresponding to the beginning of
> > the
> > applicative buffer. But there are indeed some unusual use cases
> > (e.g.
> > smaller clusters) for which only a block-aligned buffer will reach
> > EHCI
> > despite a page-aligned applicative buffer.
> 
> I don't quite get this one.

I meant that 512 bytes (most usual storage block size) is what we should aim at
to optimize the number of qTDs.

> > > >> My suggestion would be to truncate the xfr_bytes with the max
> > > >> wMaxPacketSize (1024) and for the qtd_count use:
> > > >> 
> > > >> if ((uint32_t)buffer & 1023)/* wMaxPacketSize unaligned */
> > > >> 
> > > >>   qtd_count += DIV_ROUND_UP(((uint32_t)buffer & 4095) +
> > > >>   
> > > >>   length, (QT_BUFFER_CNT - 1) * 4096);
> > > >> 
> > > >> else/* wMaxPacketSize aligned */
> > > >> 
> > > >>   qtd_count += DIV_ROUND_UP(((uint32_t)buffer & 4095) +
> > > >>   
> > > >>   length, QT_BUFFER_CNT * 4096);
> > > >> 
> > > >> This allows 50% of unaligned block data (512) to be
> > > >> transferred
> > > >> with
> > > >> min
> > > >> qTDs.
> > > > 
> > > > That would also require a realignment-to-page stage. This is
> > > > specific code for
> > > > specific buffer alignment from the upper layers. We could also
> > > > skip
> > > > the
> > > > realignment to page and always keep the same qTD transfer size
> > > > except for the
> > > > last one, by adding as many packets as possible for the buffer
> > > > alignment.
> > > 
> > > What you mean by realignment-to-page stage?
> > 
> > I mean that the alignment of the transfer to 1024 instead of 4096
> > can make
> > the first qTD transfer larger than the following ones, which
> > guarantees
> > that the following qTD transfers are page-aligned, even if the
> > first one
> > was only aligned to 1024. For the 1024-aligned case, this results
> > in the
> > change that you suggest, but it also changes things for the
> > unaligned
> > case, which makes this part of the code inaccurate. See below.
> > 
> > > > But I still don't see a significant reason

Re: [U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Marek Vasut
Dear Jim Shimer,

> Marek,
> 
> I don't have a USB 1.x device to do that regression. Taking the call to
> usb_test_unit_ready out of the block reads/writes and leaving it only in
> get info really speed up ext2load.  With the recent cache changes on top of
> this and the 5ms delay, we're getting fairly close to the Linux USB
> transfer times and are happy with the results.  Can you look into
> integrating this?

Can you send a patch that'll yank it out? I should be able to test it in a bit.

> -Jim
> 
> On Mon, Jul 30, 2012 at 6:54 PM, Marek Vasut  wrote:
> > Dear Jim Shimer,
> > 
> > > While tuning ext2load, we found that usb_test_unit_ready was being
> > > called every block read.  We compared the usb block storage to the
> > > scsi block storage cmd_scsi.c, and found that the scsi device was only
> > > calling its scsi_setup_test_unit_ready() during scsi_can.  It appears
> > > that usb_test_unit_ready() really only needs to be called once during
> > > usb_stor_scan(), via usb_stor_get_info().   Is there a particular
> > > reason usb_test_unit_ready is called for every block read, or do you
> > > think its
> > 
> > ok
> > 
> > > to only call during usb_stor_scan()?  We're finding this speeds up
> > 
> > ext2load
> > 
> > > quite a bit.
> > 
> > Could it be because the USB is actually quite slower than SCSI and the
> > device
> > might get congested? It seems the code was there ever since (I can't seem
> > to
> > find the origin of it) and we might actually want to try if this doesn't
> > break
> > some usb 1.x things.
> > 
> > > Regards,
> > > Jim
> > 
> > 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] [PATCH v4 3/6] tegra: fdt: Add NAND controller binding and definitions

2012-07-30 Thread Scott Wood
On 07/30/2012 01:53 AM, Simon Glass wrote:
> diff --git a/arch/arm/dts/tegra20.dtsi b/arch/arm/dts/tegra20.dtsi
> index f95be58..d936b1e 100644
> --- a/arch/arm/dts/tegra20.dtsi
> +++ b/arch/arm/dts/tegra20.dtsi
> @@ -204,4 +204,11 @@
>   compatible = "nvidia,tegra20-kbc";
>   reg = <0x7000e200 0x0078>;
>   };
> +
> + nand: nand-controller@70008000 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + compatible = "nvidia,tegra20-nand";
> + reg = <0x70008000 0x100>;
> + };
>  };
> diff --git a/doc/device-tree-bindings/nand/nvidia,tegra20-nand.txt 
> b/doc/device-tree-bindings/nand/nvidia,tegra20-nand.txt
> new file mode 100644
> index 000..86ae408
> --- /dev/null
> +++ b/doc/device-tree-bindings/nand/nvidia,tegra20-nand.txt
> @@ -0,0 +1,53 @@
> +NAND Flash
> +--
> +
> +(there isn't yet a generic binding in Linux, so this describes what is in
> +U-Boot. There should not be Linux-specific or U-Boot specific binding, just
> +a binding that describes this hardware. But agreeing a binding in Linux in
> +the absence of a driver may be beyond my powers.)

Please at least attempt to get a binding accepted in Linux, or perhaps
in a neutral repository such as devicetree.org (but point out on
devicetree-discuss that you've posted it there).  The device tree is
supposed to describe the hardware, not what Linux currently uses.

> +Example
> +---
> +
> +nand-controller@0x70008000 {
> + compatible = "nvidia,tegra20-nand";
> + #address-cells = <1>;
> + #size-cells = <0>;
> + nvidia,wp-gpios = <&gpio 59 0>; /* PH3 */
> + nvidia,nand-width = <8>;
> + nvidia,timing = <26 100 20 80 20 10 12 10 70>;
> + nand@0 {
> + reg = <0>;
> + compatible = "hynix,hy27uf4g2b", "nand-flash";
> + };
> +};

Where is "reg" in the parent node?  You're not supposed to have a unit
address without reg.   Also, most bus bindings don't put 0x in the unit
address).

I see that it's OK in the actual .dtsi -- it's just the example that
needs fixing.

-Scott


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


Re: [U-Boot] [PATCH v4 1/6] nand: Try to align the default buffers

2012-07-30 Thread Scott Wood
On 07/30/2012 01:53 AM, Simon Glass wrote:
> The NAND layer needs to use cache-aligned buffers by default. Towards this
> goal. align the default buffers and their members according to the minimum
> DMA alignment defined for the architecture.
> 
> Signed-off-by: Simon Glass 
> ---
> Changes in v2:
> - Add new patch to align default buffers in nand_base
> 
>  drivers/mtd/nand/nand_base.c |3 ++-
>  include/linux/mtd/nand.h |7 ---
>  2 files changed, 6 insertions(+), 4 deletions(-)

Acked-by: Scott Wood http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] env_nand: align NAND buffers

2012-07-30 Thread Scott Wood
On 07/30/2012 12:38 PM, Stephen Warren wrote:
> From: Stephen Warren 
> 
> This allows cache flush/invalidate operations to succeed on the buffers.
> 
> Signed-off-by: Stephen Warren 
> ---
>  common/env_nand.c |   10 +-
>  1 files changed, 5 insertions(+), 5 deletions(-)

Acked-by: Scott Wood 

I'm assuming you want it to go with the Tegra patches and not via my tree.

-Scott


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


Re: [U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Marek Vasut
Dear Jim Shimer,

> While tuning ext2load, we found that usb_test_unit_ready was being called
> every block read.  We compared the usb block storage to the scsi block
> storage cmd_scsi.c, and found that the scsi device was only calling its
> scsi_setup_test_unit_ready() during scsi_can.  It appears that
> usb_test_unit_ready() really only needs to be called once during
> usb_stor_scan(), via usb_stor_get_info().   Is there a particular reason
> usb_test_unit_ready is called for every block read, or do you think its ok
> to only call during usb_stor_scan()?  We're finding this speeds up ext2load
> quite a bit.

Could it be because the USB is actually quite slower than SCSI and the device 
might get congested? It seems the code was there ever since (I can't seem to 
find the origin of it) and we might actually want to try if this doesn't break 
some usb 1.x things.

> Regards,
> Jim

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 v4 4/6] tegra: fdt: Add NAND definitions to fdt

2012-07-30 Thread Scott Wood
On 07/30/2012 01:53 AM, Simon Glass wrote:
> Add a flash node to handle the NAND, including memory timings and
> page / block size information.
> 
> Signed-off-by: Simon Glass 
> ---
> Changes in v2:
> - Update NAND binding to add "nvidia," prefix
> 
> Changes in v3:
> - Add reg property for unit address (should be used for chip select)
> - Update fdt binding to make everything Nvidia-specific
> 
> Changes in v4:
> - Remove fdt bindings related to page structure
> 
>  board/nvidia/dts/tegra20-seaboard.dts |   10 ++
>  1 files changed, 10 insertions(+), 0 deletions(-)
> 
> diff --git a/board/nvidia/dts/tegra20-seaboard.dts 
> b/board/nvidia/dts/tegra20-seaboard.dts
> index 3352539..25a63a0 100644
> --- a/board/nvidia/dts/tegra20-seaboard.dts
> +++ b/board/nvidia/dts/tegra20-seaboard.dts
> @@ -153,4 +153,14 @@
>   0x1f04008a>;
>   linux,fn-keymap = <0x05040002>;
>   };
> +
> + nand-controller@70008000 {
> + nvidia,wp-gpios = <&gpio 59 0>; /* PH3 */
> + nvidia,width = <8>;
> + nvidia,timing = <26 100 20 80 20 10 12 10 70>;
> + nand@0 {
> + reg = <0>;
> + compatible = "hynix,hy27uf4g2b", "nand-flash";
> + };
> + };

Are #address-cells, #size-cells, and reg on the controller node provided
by an /include/?

-Scott


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


Re: [U-Boot] [PATCH v2 2/5] ehci-hcd: Boost transfer speed

2012-07-30 Thread Marek Vasut
Dear Benoît Thébaudeau,

[...]

> > > Can you explain where this gain would come from? In both cases, the
> > > data in USB
> > > transfers would be organized in the same way, and it would be
> > > accessed in memory
> > > also in the same way (regarding bursts). The only difference would
> > > be the fetch
> > > time of a little bit more qTDs, which is extremely fast and
> > > insignificant
> > > compared to the transfer time of the payload, which remains
> > > unchanged.
> > 
> > You are right, the speed different will be minimal, only the memory
> > usage will be lower.
> 
> If your point is only the memory gain, I agree. With your suggestion, there
> are roughly 25% less qTDs used in the "(max wMaxPacketSize)-aligned but
> not page-aligned" case since the number of qTDs is about (total transfer
> size) / 5 instead of (total transfer size) / 4. But this is still small
> compared to usual heap sizes (at least on the kind of hardware I use).

Ok, I see the point. I understand it's not really a bug, just an improvement. 
Maybe we can do a subsequent patch on top of these from Benoit and see how it 
fares?

> > > Moreover, in your use case, if you are e.g. using FAT, on the one
> > > hand, the
> > > buffers in fat.c are never aligned to more than the DMA min
> > > alignment, and on
> > > the other hand, if you can align your user buffers to 512 bytes,
> > > you can also
> > > align them directly to 4 kB.
> > 
> > The user buffer is aligned to 4kB, but this doesn't matter as a file
> > load from a storage device (ex. fatload) can be segmented in partial
> > USB
> > transfers. This can lead to any block aligned buffer for a partial
> > transfer.
> 
> What do you mean by "partial USB transfers"? As seen from EHCI users like
> the MSC driver (usb_storage.c), USB transfers either succeed or fail, but
> they cannot be "segmented".

Segmented -- like multiple transfers being issues with small payload? You can 
not put these together at the USB-level, since it's the issuing code that has 
to 
be fixed.

> On its side, the MSC driver will only segment the FAT layer requests if
> they are larger than 65535 blocks, so still not what you describe.
> 
> As to the FAT stack, it will only read whole clusters while accessing file
> payload, and the most usual cluster sizes are by default a multiple of 4
> kiB (see http://support.microsoft.com/kb/140365).

512b is minimum and it's quite often used.

> So I don't see "segmentation" anywhere, and for usual cluster sizes, the
> EHCI buffer alignment is fully determined by the applicative buffer
> alignment and the file position corresponding to the beginning of the
> applicative buffer. But there are indeed some unusual use cases (e.g.
> smaller clusters) for which only a block-aligned buffer will reach EHCI
> despite a page-aligned applicative buffer.

I don't quite get this one.

> > >> My suggestion would be to truncate the xfr_bytes with the max
> > >> wMaxPacketSize (1024) and for the qtd_count use:
> > >> 
> > >> if ((uint32_t)buffer & 1023)/* wMaxPacketSize unaligned */
> > >> 
> > >>   qtd_count += DIV_ROUND_UP(((uint32_t)buffer & 4095) +
> > >>   
> > >>   length, (QT_BUFFER_CNT - 1) * 4096);
> > >> 
> > >> else/* wMaxPacketSize aligned */
> > >> 
> > >>   qtd_count += DIV_ROUND_UP(((uint32_t)buffer & 4095) +
> > >>   
> > >>   length, QT_BUFFER_CNT * 4096);
> > >> 
> > >> This allows 50% of unaligned block data (512) to be transferred
> > >> with
> > >> min
> > >> qTDs.
> > > 
> > > That would also require a realignment-to-page stage. This is
> > > specific code for
> > > specific buffer alignment from the upper layers. We could also skip
> > > the
> > > realignment to page and always keep the same qTD transfer size
> > > except for the
> > > last one, by adding as many packets as possible for the buffer
> > > alignment.
> > 
> > What you mean by realignment-to-page stage?
> 
> I mean that the alignment of the transfer to 1024 instead of 4096 can make
> the first qTD transfer larger than the following ones, which guarantees
> that the following qTD transfers are page-aligned, even if the first one
> was only aligned to 1024. For the 1024-aligned case, this results in the
> change that you suggest, but it also changes things for the unaligned
> case, which makes this part of the code inaccurate. See below.
> 
> > > But I still don't see a significant reason to complicate code to do
> > > that.
> > 
> > I don't understand where you expect to complicate the code.
> > 
> > You limit the size of one transfer (xfr_bytes) to (QT_BUFFER_CNT - 1)
> > *
> > 4kB for unaligned buffers. But you only need to limit it to a
> > multiple
> > of the maximal possible wMaxPacketSize (1kB) to make sure that you
> > always send full packages.
> > 
> > I only suggest to replace the causeless 4kB alignment with a
> > reasonable
> > 1kB alignment and adapte the qtd_count caluclation.
> > 
> >  int xfr_bytes =

Re: [U-Boot] [PATCH v4 5/6] tegra: nand: Add Tegra NAND driver

2012-07-30 Thread Scott Wood
On 07/30/2012 01:53 AM, Simon Glass wrote:
> From: Jim Lin 
> 
> A device tree is used to configure the NAND, including memory
> timings and block/pages sizes.
> 
> If this node is not present or is disabled, then NAND will not
> be initialized.
> 
> Signed-off-by: Jim Lin 
> Signed-off-by: Simon Glass 

Acked-by: Scott Wood 

-Scott


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


[U-Boot] [PATCH 1/2] kirkwood: Rename dns325 to dnskw

2012-07-30 Thread Jamie Lentin
So we can re-use DNS-325 configuration for the DNS-320 without things getting
confusing, rename all common parts from dns325 to dnskw, and use a config
option to configure DNS-325 specifics.

Signed-off-by: Jamie Lentin 
Cc: prafu...@marvell.com
Cc: albert.u.b...@aribaud.net
---
 board/d-link/{dns325 => dnskw}/Makefile|2 +-
 board/d-link/{dns325/dns325.c => dnskw/dnskw.c}|   10 
 board/d-link/{dns325/dns325.h => dnskw/dnskw.h}|   24 
 .../kwbimage.cfg => dnskw/kwbimage.dns325.cfg} |0
 boards.cfg |2 +-
 include/configs/{dns325.h => dnskw.h}  |   11 ++---
 6 files changed, 29 insertions(+), 20 deletions(-)
 rename board/d-link/{dns325 => dnskw}/Makefile (98%)
 rename board/d-link/{dns325/dns325.c => dnskw/dnskw.c} (94%)
 rename board/d-link/{dns325/dns325.h => dnskw/dnskw.h} (73%)
 rename board/d-link/{dns325/kwbimage.cfg => dnskw/kwbimage.dns325.cfg} (100%)
 rename include/configs/{dns325.h => dnskw.h} (95%)

diff --git a/board/d-link/dns325/Makefile b/board/d-link/dnskw/Makefile
similarity index 98%
rename from board/d-link/dns325/Makefile
rename to board/d-link/dnskw/Makefile
index 35da21a..174127e 100644
--- a/board/d-link/dns325/Makefile
+++ b/board/d-link/dnskw/Makefile
@@ -30,7 +30,7 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).o
 
-COBJS  := dns325.o
+COBJS  := dnskw.o
 
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
diff --git a/board/d-link/dns325/dns325.c b/board/d-link/dnskw/dnskw.c
similarity index 94%
rename from board/d-link/dns325/dns325.c
rename to board/d-link/dnskw/dnskw.c
index 11260fe..d29735c 100644
--- a/board/d-link/dns325/dns325.c
+++ b/board/d-link/dnskw/dnskw.c
@@ -33,15 +33,15 @@
 #include 
 #include 
 #include 
-#include "dns325.h"
+#include "dnskw.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 int board_early_init_f(void)
 {
/* Gpio configuration */
-   kw_config_gpio(DNS325_OE_VAL_LOW, DNS325_OE_VAL_HIGH,
-   DNS325_OE_LOW, DNS325_OE_HIGH);
+   kw_config_gpio(DNSKW_OE_VAL_LOW, DNSKW_OE_VAL_HIGH,
+   DNSKW_OE_LOW, DNSKW_OE_HIGH);
 
/* Multi-Purpose Pins Functionality configuration */
u32 kwmpp_config[] = {
@@ -99,9 +99,9 @@ int board_early_init_f(void)
};
kirkwood_mpp_conf(kwmpp_config, NULL);
 
-   kw_gpio_set_blink(DNS325_GPIO_LED_POWER , 1);
+   kw_gpio_set_blink(DNSKW_GPIO_LED_POWER , 1);
 
-   kw_gpio_set_value(DNS325_GPIO_SATA0_EN , 1);
+   kw_gpio_set_value(DNSKW_GPIO_SATA0_EN , 1);
return 0;
 }
 
diff --git a/board/d-link/dns325/dns325.h b/board/d-link/dnskw/dnskw.h
similarity index 73%
rename from board/d-link/dns325/dns325.h
rename to board/d-link/dnskw/dnskw.h
index 7859cea..4b11cb6 100644
--- a/board/d-link/dns325/dns325.h
+++ b/board/d-link/dnskw/dnskw.h
@@ -26,18 +26,22 @@
  * MA 02110-1301 USA
  */
 
-#ifndef __DNS325_H
-#define __DNS325_H
+#ifndef __DNSKW_H
+#define __DNSKW_H
 
 /* GPIO configuration */
-#define DNS325_OE_LOW  0x
-#define DNS325_OE_HIGH 0x00039604
-#define DNS325_OE_VAL_LOW  0x3800  /* disable leds */
-#define DNS325_OE_VAL_HIGH 0x0800  /* disable leds */
+#define DNSKW_OE_LOW   0x
+#define DNSKW_OE_HIGH  0x00039604
 
-#define DNS325_GPIO_LED_POWER  26
-#define DNS325_GPIO_SATA0_EN   39
-#define DNS325_GPIO_SATA1_EN   40
+#define DNSKW_GPIO_LED_POWER   26
+#define DNSKW_GPIO_SATA0_EN39
+#define DNSKW_GPIO_SATA1_EN40
+
+/* DNS-325 specific configuration */
+#ifdef CONFIG_BOARD_IS_DNS325
+#define DNSKW_OE_VAL_LOW   0x3800  /* disable leds */
+#define DNSKW_OE_VAL_HIGH  0x0800  /* disable leds */
+#endif /* CONFIG_BOARD_IS_DNS325 */
 
 /* PHY related */
 #define MV88E1116_MAC_CTRL_REG 21
@@ -45,4 +49,4 @@
 #define MV88E1116_RGMII_TXTM_CTRL  (1 << 4)
 #define MV88E1116_RGMII_RXTM_CTRL  (1 << 5)
 
-#endif /* __DNS325_H */
+#endif /* __DNSKW_H */
diff --git a/board/d-link/dns325/kwbimage.cfg 
b/board/d-link/dnskw/kwbimage.dns325.cfg
similarity index 100%
rename from board/d-link/dns325/kwbimage.cfg
rename to board/d-link/dnskw/kwbimage.dns325.cfg
diff --git a/boards.cfg b/boards.cfg
index 2d36d83..8b8bb45 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -139,7 +139,7 @@ hawkboard_uart   arm arm926ejs   
da8xxevmdavinci
 enbw_cmc arm arm926ejs   enbw_cmcenbw  
 davinci
 calimain arm arm926ejs   calimain
omicrondavinci
 pogo_e02 arm arm926ejs   -   
cloudengines   kirkwood
-dns325   arm arm926ejs   -   
d-link kirkwood
+dns325  

[U-Boot] [PATCH 2/2] kirkwood: Add support for the D-Link DNS-320

2012-07-30 Thread Jamie Lentin
Extend dnskw to support the D-Link DNS-320 ShareCenter NAS also. For more
information on this NAS, see:-

  http://jamie.lentin.co.uk/devices/dlink-dns320
  http://dns323.kood.org/dns-320
  http://sharecenter.dlink.com/products/DNS-320

Signed-off-by: Jamie Lentin 
Cc: prafu...@marvell.com
Cc: albert.u.b...@aribaud.net
---
 MAINTAINERS|4 +
 board/d-link/dnskw/dnskw.c |8 +-
 board/d-link/dnskw/dnskw.h |6 +
 board/d-link/dnskw/kwbimage.dns320.cfg |  207 
 boards.cfg |1 +
 include/configs/dnskw.h|   10 ++
 6 files changed, 232 insertions(+), 4 deletions(-)
 create mode 100644 board/d-link/dnskw/kwbimage.dns320.cfg

diff --git a/MAINTAINERS b/MAINTAINERS
index fd0c65c..92ede1f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -673,6 +673,10 @@ Igor Grinberg 
 
cm-t35  ARM ARMV7 (OMAP3xx Soc)
 
+Jamie Lentin 
+
+   dns320  ARM926EJS (Kirkwood SoC)
+
 Stefan Herbrechtsmeier 
 
dns325  ARM926EJS (Kirkwood SoC)
diff --git a/board/d-link/dnskw/dnskw.c b/board/d-link/dnskw/dnskw.c
index d29735c..cd6bfe9 100644
--- a/board/d-link/dnskw/dnskw.c
+++ b/board/d-link/dnskw/dnskw.c
@@ -58,8 +58,8 @@ int board_early_init_f(void)
MPP10_UART0_TXD,
MPP11_UART0_RXD,
MPP12_SD_CLK,
-   MPP13_SD_CMD,
-   MPP14_SD_D0,
+   MPP13_UART1_TXD,/* Custom ...*/
+   MPP14_UART1_RXD,/* ... controller */
MPP15_SD_D1,
MPP16_SD_D2,
MPP17_SD_D3,
@@ -74,13 +74,13 @@ int board_early_init_f(void)
MPP26_GPIO, /* power led */
MPP27_GPIO, /* sata0(right) error led */
MPP28_GPIO, /* sata1(left) error led */
-   MPP29_GPIO, /* usb error led */
+   MPP29_GPIO, /* usb error led (dns-325) */
MPP30_GPIO,
MPP31_GPIO,
MPP32_GPIO,
MPP33_GPIO,
MPP34_GPIO, /* power key */
-   MPP35_GPIO,
+   MPP35_GPIO, /* usb error led (dns-320) */
MPP36_GPIO,
MPP37_GPIO,
MPP38_GPIO,
diff --git a/board/d-link/dnskw/dnskw.h b/board/d-link/dnskw/dnskw.h
index 4b11cb6..8886050 100644
--- a/board/d-link/dnskw/dnskw.h
+++ b/board/d-link/dnskw/dnskw.h
@@ -43,6 +43,12 @@
 #define DNSKW_OE_VAL_HIGH  0x0800  /* disable leds */
 #endif /* CONFIG_BOARD_IS_DNS325 */
 
+/* DNS-320 specific configuration */
+#ifdef CONFIG_BOARD_IS_DNS320
+#define DNSKW_OE_VAL_LOW   0x3800  /* disable leds */
+#define DNSKW_OE_VAL_HIGH  0x0808  /* disable leds */
+#endif /* CONFIG_BOARD_IS_DNS320 */
+
 /* PHY related */
 #define MV88E1116_MAC_CTRL_REG 21
 #define MV88E1116_PGADR_REG22
diff --git a/board/d-link/dnskw/kwbimage.dns320.cfg 
b/board/d-link/dnskw/kwbimage.dns320.cfg
new file mode 100644
index 000..5fb4052
--- /dev/null
+++ b/board/d-link/dnskw/kwbimage.dns320.cfg
@@ -0,0 +1,207 @@
+#
+# Copyright (C) 2012
+# Jamie Lentin 
+#
+# Based on dns325 support:
+# Copyright (C) 2011
+# Stefan Herbrechtsmeier 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA
+#
+# Refer docs/README.kwimage for more details about how-to configure
+# and create kirkwood boot image
+#
+
+# Boot Media configurations
+BOOT_FROM  nand
+NAND_ECC_MODE  default
+NAND_PAGE_SIZE 0x0800
+
+# SOC registers configuration using bootrom header extension
+# Maximum KWBIMAGE_MAX_CONFIG configurations allowed
+
+# Configure RGMII-0 interface pad voltage to 1.8V
+DATA 0xFFD100e0 0x1b1b1b9b
+
+#Dram initalization for SINGLE x16 CL=3 @ 200MHz
+DATA 0xFFD01400 0x43000618 # DDR Configuration register
+# bit13-0:  0x618 DDR2 clks refresh rate
+# bit23-14: 0 required
+# bit24:1 enable exit self refresh mode on DDR access
+# bit25:1 required
+# bit29-26: 0 required
+# bit31-30: 0b01 required
+
+DATA 0xFFD01404 0x35143000 # DDR Controller Control Low
+# bit3-0:   0 required
+

[U-Boot] [RESEND] [PATCH 0/2] kirkwood: Generalise dns325 support, include dns320

2012-07-30 Thread Jamie Lentin
I submitted this a while ago[0], it would be nice to see it included
if possible. It generalises the DNS325 support so that it can be used
for both the DNS320 and DNS325.

Luka Perkov stated "I have no more questions regarding this patch", not
sure if this counts as an ACK. The patch here is ~same, just rebased.

Somewhat related, I have tried using tools/kwboot to boot both NASes.
The DNS325 boots fine, however the DNS320 reports:-

Sending boot message. Please reboot the target...|
Sending boot image...
  0 % [+xmodem: Bad message

UART-boot works with kwuartboot, although only when it is killed and
restarted. If I work out anything interesting will follow it up in
a separate thread.

Any feedback appreciated!

[0] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/130234/focus=130575

Jamie Lentin (2):
  kirkwood: Rename dns325 to dnskw
  kirkwood: Add support for the D-Link DNS-320

 MAINTAINERS|4 +
 board/d-link/{dns325 => dnskw}/Makefile|2 +-
 board/d-link/{dns325/dns325.c => dnskw/dnskw.c}|   18 +-
 board/d-link/{dns325/dns325.h => dnskw/dnskw.h}|   30 ++-
 board/d-link/dnskw/kwbimage.dns320.cfg |  207 
 .../kwbimage.cfg => dnskw/kwbimage.dns325.cfg} |0
 boards.cfg |3 +-
 include/configs/{dns325.h => dnskw.h}  |   21 +-
 8 files changed, 261 insertions(+), 24 deletions(-)
 rename board/d-link/{dns325 => dnskw}/Makefile (98%)
 rename board/d-link/{dns325/dns325.c => dnskw/dnskw.c} (90%)
 rename board/d-link/{dns325/dns325.h => dnskw/dnskw.h} (65%)
 create mode 100644 board/d-link/dnskw/kwbimage.dns320.cfg
 rename board/d-link/{dns325/kwbimage.cfg => dnskw/kwbimage.dns325.cfg} (100%)
 rename include/configs/{dns325.h => dnskw.h} (89%)

-- 
1.7.10.4

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


Re: [U-Boot] [PATCH] env_nand: align NAND buffers

2012-07-30 Thread Simon Glass
Hi Wolfgang,

On Mon, Jul 30, 2012 at 10:10 PM, Wolfgang Denk  wrote:
> Dear Simon Glass,
>
> In message 
>  you 
> wrote:
>>
>> > -   env_t   env_new;
>> > +   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
>>
>> I think this should b
>
> Should be ... ???

Sorry, I started a comment, but thought better of it. It looks fine to me.

>
> Best regards,
>
> Wolfgang Denk
>
> --
> DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
> Be wiser than other people if you can, but do not tell them so.
>-- Philip Earl of Chesterfield

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


Re: [U-Boot] [PATCH] env_nand: align NAND buffers

2012-07-30 Thread Wolfgang Denk
Dear Simon Glass,

In message  
you wrote:
>
> > -   env_t   env_new;
> > +   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
> 
> I think this should b

Should be ... ???

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Be wiser than other people if you can, but do not tell them so.
   -- Philip Earl of Chesterfield
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] net: Improve the speed of netconsole

2012-07-30 Thread Joe Hershberger
Hi Mike,

On Wed, Jul 25, 2012 at 1:49 PM, Mike Frysinger  wrote:
> On Tuesday 24 July 2012 16:11:15 Joe Hershberger wrote:
>> --- a/drivers/net/netconsole.c
>> +++ b/drivers/net/netconsole.c
>> @@ -131,8 +131,17 @@ static void nc_send_packet(const char *buf, int len)
>>   }
>>
>>   if (eth->state != ETH_STATE_ACTIVE) {
>> - if (eth_init(gd->bd) < 0)
>> - return;
>> +#ifdef CONFIG_NETCONSOLE_PERSIST_ETH
>> + if (net_loop_last_protocol != NETCONS) {
>> +#endif
>> + if (eth_init(gd->bd) < 0)
>> + return;
>> +#ifdef CONFIG_NETCONSOLE_PERSIST_ETH
>> + net_loop_last_protocol = NETCONS;
>> + } else {
>> + eth_init_state_only(gd->bd);
>> + }
>> +#endif
>
> seems to me these pre/post clauses should really get refactored someway.  the
> ifdef noise is significant here.

I agree.

> so in the header, something like:
>
> static inline int eth_reinit_protocol(int protocol)
> {
> #ifdef CONFIG_NETCONSOLE_PERSIST_ETH
> return protocol != NETCONS;
> #else
> return 1;
> #endif
> }
> static inline void eth_set_last_protocol(int protocol)
> {
> #ifdef CONFIG_NETCONSOLE_PERSIST_ETH
> net_loop_last_protocol = protocol;
> #endif
> }
> #ifdef CONFIG_NETCONSOLE_PERSIST_ETH
> extern enum proto_t net_loop_last_protocol;
> #else
> # define net_loop_last_protocol -1
> #endif
>
> then the source becomes the more manageable:
>
> if (eth_reinit_protocol(net_loop_last_protocol)) {
> if (eth_init(gd->bd) < 0)
> return;
> eth_set_last_protocol(NETCONS);
> } else
> eth_init_state_only(gd->bd);

Much nicer.  With static inline it should compile to the same thing.

>> --- a/net/eth.c
>> +++ b/net/eth.c
>>
>> +#ifdef CONFIG_NETCONSOLE_PERSIST_ETH
>> +int eth_init_state_only(bd_t *bis)
>> +{
>> + eth_current->state = ETH_STATE_ACTIVE;
>> +
>> + return 0;
>> +}
>> +
>> +void eth_halt_state_only(void)
>> +{
>> + eth_current->state = ETH_STATE_PASSIVE;
>> +}
>> +#endif
>
> these *really* should be static inlines in the global header.  they're so dirt
> simple, the overhead of the function call is probably much higher than the
> single memory store.

I can do that, but I don't think it will save anything.  Since
eth_current is static, I would have to change it to eth_get_dev(), and
we're back to a function call.  Thoughts?

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


Re: [U-Boot] Building u-boot for iMX28 and getting error in mkimage of missing command line parameter CONFIG_IMX_CONFIG

2012-07-30 Thread Fabio Estevam
On Mon, Jul 30, 2012 at 3:53 PM, Bill  wrote:
> Progress!   I switched all the references from ttyAMA0...   to ttyAM0.  Also
> changed netargs too.  Now it starts to boot linux but hangs right after the
> line of:
> mxs_cpu_init:  cpufreq init finished.

Please remove cpufreq from your kernel config.

You can use this patch:
https://github.com/Freescale/meta-fsl-arm/blob/denzil/recipes-kernel/linux/linux-imx-2.6.35.3/mx28-removecpufreq.patch

Regards,

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


[U-Boot] [PATCH 3/3] tegra: put eMMC environment into the boot sectors

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

When I set up Tegra's config files to put the environment into eMMC, I
assumed that CONFIG_ENV_OFFSET was a linearized address relative to the
start of the eMMC device, and spanning HW partitions boot0, boot1,
general* and the user area in order. However, it turns out that the
offset is actually relative to the beginning of the user area. Hence,
the environment block ended up in a different location to expected and
documented.

Set CONFIG_SYS_MMC_ENV_PART=2 (boot1) to solve this, and adjust
CONFIG_ENV_OFFSET to be relative to the start of boot1, not the entire
eMMC.

Signed-off-by: Stephen Warren 
---
 include/configs/paz00.h|3 ++-
 include/configs/seaboard.h |3 ++-
 include/configs/ventana.h  |3 ++-
 include/configs/whistler.h |3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index 0eb9f3b..99b8753 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -51,8 +51,9 @@
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_ENV_OFFSET ((2 * 1024 * 1024) - CONFIG_ENV_SIZE)
+#define CONFIG_ENV_OFFSET ((1024 * 1024) - CONFIG_ENV_SIZE)
 #define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_PART 2
 
 /* USB Host support */
 #define CONFIG_USB_EHCI
diff --git a/include/configs/seaboard.h b/include/configs/seaboard.h
index 479af1a..6996502 100644
--- a/include/configs/seaboard.h
+++ b/include/configs/seaboard.h
@@ -77,8 +77,9 @@
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_ENV_OFFSET ((2 * 512 * 1024) - CONFIG_ENV_SIZE)
+#define CONFIG_ENV_OFFSET ((512 * 1024) - CONFIG_ENV_SIZE)
 #define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_PART 2
 
 /* USB Host support */
 #define CONFIG_USB_EHCI
diff --git a/include/configs/ventana.h b/include/configs/ventana.h
index 25ec2eb..f5e1bf8 100644
--- a/include/configs/ventana.h
+++ b/include/configs/ventana.h
@@ -58,8 +58,9 @@
 
 /* Environment in eMMC, at the end of 2nd "boot sector" */
 #define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_ENV_OFFSET ((2 * 1024 * 1024) - CONFIG_ENV_SIZE)
+#define CONFIG_ENV_OFFSET ((1024 * 1024) - CONFIG_ENV_SIZE)
 #define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_PART 2
 
 /* USB Host support */
 #define CONFIG_USB_EHCI
diff --git a/include/configs/whistler.h b/include/configs/whistler.h
index b747d0e..3235718 100644
--- a/include/configs/whistler.h
+++ b/include/configs/whistler.h
@@ -72,8 +72,9 @@
  * particular card is standard practice as far as I know.
  */
 #define CONFIG_ENV_IS_IN_MMC
-#define CONFIG_ENV_OFFSET ((2 * 512 * 1024) - CONFIG_ENV_SIZE)
+#define CONFIG_ENV_OFFSET ((512 * 1024) - CONFIG_ENV_SIZE)
 #define CONFIG_SYS_MMC_ENV_DEV 0
+#define CONFIG_SYS_MMC_ENV_PART 2
 
 /* USB Host support */
 #define CONFIG_USB_EHCI
-- 
1.7.0.4

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


[U-Boot] [PATCH 2/3] env_mmc: allow environment to be in an eMMC partition

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

eMMC devices may have hardware-level partitions: 2 boot partitions,
up to 4 general partitions, plus the user area. This change introduces
optional config variable CONFIG_SYS_MMC_ENV_PART to indicate which
partition the environment should be stored in: 0=user, 1=boot0, 2=boot1,
4..7=general0..3. This allows the environment to be kept out of the user
area, which simplifies the management of OS-/user-level (MBR/GPT)
partitions within the user area.

Signed-off-by: Stephen Warren 
---
 common/env_mmc.c |   64 +++--
 1 files changed, 56 insertions(+), 8 deletions(-)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index be2f2be..a2ff90b 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -75,9 +75,28 @@ static int init_mmc_for_env(struct mmc *mmc)
return -1;
}
 
+#ifdef CONFIG_SYS_MMC_ENV_PART
+   if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num) {
+   if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV,
+   CONFIG_SYS_MMC_ENV_PART)) {
+   puts("MMC partition switch failed\n");
+   return -1;
+   }
+   }
+#endif
+
return 0;
 }
 
+static void fini_mmc_for_env(struct mmc *mmc)
+{
+#ifdef CONFIG_SYS_MMC_ENV_PART
+   if (CONFIG_SYS_MMC_ENV_PART != mmc->part_num)
+   mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV,
+   mmc->part_num);
+#endif
+}
+
 #ifdef CONFIG_CMD_SAVEENV
 static inline int write_env(struct mmc *mmc, unsigned long size,
unsigned long offset, const void *buffer)
@@ -100,26 +119,38 @@ int saveenv(void)
char*res;
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
u32 offset;
+   int ret;
 
-   if (init_mmc_for_env(mmc) || mmc_get_env_addr(mmc, &offset))
+   if (init_mmc_for_env(mmc))
return 1;
 
+   if (mmc_get_env_addr(mmc, &offset)) {
+   ret = 1;
+   goto fini;
+   }
+
res = (char *)&env_new->data;
len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
-   return 1;
+   ret = 1;
+   goto fini;
}
 
env_new->crc = crc32(0, &env_new->data[0], ENV_SIZE);
printf("Writing to MMC(%d)... ", CONFIG_SYS_MMC_ENV_DEV);
if (write_env(mmc, CONFIG_ENV_SIZE, offset, (u_char *)env_new)) {
puts("failed\n");
-   return 1;
+   ret = 1;
+   goto fini;
}
 
puts("done\n");
-   return 0;
+   ret = 0;
+
+fini:
+   fini_mmc_for_env(mmc);
+   return ret;
 }
 #endif /* CONFIG_CMD_SAVEENV */
 
@@ -143,13 +174,30 @@ void env_relocate_spec(void)
ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
u32 offset;
+   int ret;
 
-   if (init_mmc_for_env(mmc) || mmc_get_env_addr(mmc, &offset))
-   return set_default_env(NULL);
+   if (init_mmc_for_env(mmc)) {
+   ret = 1;
+   goto err;
+   }
 
-   if (read_env(mmc, CONFIG_ENV_SIZE, offset, buf))
-   return set_default_env(NULL);
+   if (mmc_get_env_addr(mmc, &offset)) {
+   ret = 1;
+   goto fini;
+   }
+
+   if (read_env(mmc, CONFIG_ENV_SIZE, offset, buf)) {
+   ret = 1;
+   goto fini;
+   }
 
env_import(buf, 1);
+   ret = 0;
+
+fini:
+   fini_mmc_for_env(mmc);
+err:
+   if (ret)
+   set_default_env(NULL);
 #endif
 }
-- 
1.7.0.4

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


[U-Boot] [PATCH 1/3] mmc: detect boot sectors using EXT_CSD_BOOT_MULT too

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

Some eMMC devices contain boot partitions, but do not set the PART_SUPPORT
bit in EXT_CSD_PARTITIONING_SUPPORT. Allow partition selection on such
devices, by enabling partition switching when EXT_CSD_BOOT_MULT is set.

Note that the Linux kernel enables access to boot partitions solely based
on the value of EXT_CSD_BOOT_MULT; EXT_CSD_PARTITIONING_SUPPORT only
influences access to "general" partitions.

eMMC devices affected by this issue exist on various NVIDIA Tegra
platforms (and presumably many others too), such as Harmony (plug-in eMMC),
Seaboard, Springbank, and Whistler (plug-in eMMC).

Signed-off-by: Stephen Warren 
---
 drivers/mmc/mmc.c |3 ++-
 include/mmc.h |1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index aebe578..3b08953 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1157,7 +1157,8 @@ int mmc_startup(struct mmc *mmc)
}
 
/* store the partition info of emmc */
-   if (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT)
+   if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
+   ext_csd[EXT_CSD_BOOT_MULT])
mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
}
 
diff --git a/include/mmc.h b/include/mmc.h
index 2305986..89df83c 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -159,6 +159,7 @@
 #define EXT_CSD_CARD_TYPE  196 /* RO */
 #define EXT_CSD_SEC_CNT212 /* RO, 4 bytes */
 #define EXT_CSD_HC_ERASE_GRP_SIZE  224 /* RO */
+#define EXT_CSD_BOOT_MULT  226 /* RO */
 
 /*
  * EXT_CSD field definitions
-- 
1.7.0.4

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


[U-Boot] [PATCH 1/3] mmc: detect boot sectors using EXT_CSD_BOOT_MULT too

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

Some eMMC devices contain boot partitions, but do not set the PART_SUPPORT
bit in EXT_CSD_PARTITIONING_SUPPORT. Allow partition selection on such
devices, by enabling partition switching when EXT_CSD_BOOT_MULT is set.

Note that the Linux kernel enables access to boot partitions solely based
on the value of EXT_CSD_BOOT_MULT; EXT_CSD_PARTITIONING_SUPPORT only
influences access to "general" partitions.

eMMC devices affected by this issue exist on various NVIDIA Tegra
platforms (and presumably many others too), such as Harmony (plug-in eMMC),
Seaboard, Springbank, and Whistler (plug-in eMMC).

Signed-off-by: Stephen Warren 
---
 drivers/mmc/mmc.c |3 ++-
 include/mmc.h |1 +
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index aebe578..3b08953 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1157,7 +1157,8 @@ int mmc_startup(struct mmc *mmc)
}
 
/* store the partition info of emmc */
-   if (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT)
+   if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) ||
+   ext_csd[EXT_CSD_BOOT_MULT])
mmc->part_config = ext_csd[EXT_CSD_PART_CONF];
}
 
diff --git a/include/mmc.h b/include/mmc.h
index 2305986..89df83c 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -159,6 +159,7 @@
 #define EXT_CSD_CARD_TYPE  196 /* RO */
 #define EXT_CSD_SEC_CNT212 /* RO, 4 bytes */
 #define EXT_CSD_HC_ERASE_GRP_SIZE  224 /* RO */
+#define EXT_CSD_BOOT_MULT  226 /* RO */
 
 /*
  * EXT_CSD field definitions
-- 
1.7.0.4

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


[U-Boot] [PATCH] lsxl: support power switch

2012-07-30 Thread Michael Walle
This patch restores the Linkstation's original behaviour when powering off.
Once the (soft) power switch is turned off, linux will reboot and the
bootloader turns off HDD and USB power. Then it loops as long as the switch
is in the off position, before continuing the boot process again.

Additionally, this patch fixes the board function set_led(LED_OFF).

Signed-off-by: Michael Walle 
Cc: Prafulla Wadaskar 
---
 board/buffalo/lsxl/lsxl.c |   22 +-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index fe15511..b3f31d6 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -158,7 +158,7 @@ static void set_led(int state)
 {
switch (state) {
case LED_OFF:
-   __set_led(0, 0, 0, 0, 0, 0);
+   __set_led(0, 0, 0, 1, 1, 1);
break;
case LED_ALARM_ON:
__set_led(0, 0, 0, 0, 1, 1);
@@ -192,6 +192,25 @@ int board_init(void)
 }
 
 #ifdef CONFIG_MISC_INIT_R
+static void check_power_switch(void)
+{
+   if (kw_gpio_get_value(GPIO_POWER_SWITCH)) {
+   /* turn off HDD and USB power */
+   kw_gpio_set_value(GPIO_HDD_POWER, 0);
+   kw_gpio_set_value(GPIO_USB_VBUS, 0);
+   set_led(LED_OFF);
+
+   /* loop until released */
+   while (kw_gpio_get_value(GPIO_POWER_SWITCH))
+   ;
+
+   /* turn power on again */
+   kw_gpio_set_value(GPIO_HDD_POWER, 1);
+   kw_gpio_set_value(GPIO_USB_VBUS, 1);
+   set_led(LED_POWER_BLINKING);
+   }
+}
+
 void check_enetaddr(void)
 {
uchar enetaddr[6];
@@ -261,6 +280,7 @@ static void check_push_button(void)
 
 int misc_init_r(void)
 {
+   check_power_switch();
check_enetaddr();
check_push_button();
 
-- 
1.7.2.5

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


Re: [U-Boot] [PATCH] env_nand: align NAND buffers

2012-07-30 Thread Simon Glass
On Mon, Jul 30, 2012 at 6:38 PM, Stephen Warren  wrote:
> From: Stephen Warren 
>
> This allows cache flush/invalidate operations to succeed on the buffers.
>
> Signed-off-by: Stephen Warren 

Acked-by: Simon Glass 

> ---
>  common/env_nand.c |   10 +-
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/common/env_nand.c b/common/env_nand.c
> index e8daec9..e635472 100644
> --- a/common/env_nand.c
> +++ b/common/env_nand.c
> @@ -226,7 +226,7 @@ int saveenv(void)
>  int saveenv(void)
>  {
> int ret = 0;
> -   env_t   env_new;
> +   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));

I think this should b
> ssize_t len;
> char*res;
> nand_erase_options_t nand_erase_options;
> @@ -238,20 +238,20 @@ int saveenv(void)
> if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
> return 1;
>
> -   res = (char *)&env_new.data;
> +   res = (char *)&env_new->data;
> len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
> if (len < 0) {
> error("Cannot export environment: errno = %d\n", errno);
> return 1;
> }
> -   env_new.crc = crc32(0, env_new.data, ENV_SIZE);
> +   env_new->crc = crc32(0, env_new->data, ENV_SIZE);
>
> puts("Erasing Nand...\n");
> if (nand_erase_opts(&nand_info[0], &nand_erase_options))
> return 1;
>
> puts("Writing to Nand... ");
> -   if (writeenv(CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
> +   if (writeenv(CONFIG_ENV_OFFSET, (u_char *)env_new)) {
> puts("FAILED!\n");
> return 1;
> }
> @@ -398,7 +398,7 @@ void env_relocate_spec(void)
>  {
>  #if !defined(ENV_IS_EMBEDDED)
> int ret;
> -   char buf[CONFIG_ENV_SIZE];
> +   ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
>
>  #if defined(CONFIG_ENV_OFFSET_OOB)
> ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
> --
> 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] tegra: enable NAND on Harmony

2012-07-30 Thread Simon Glass
On Mon, Jul 30, 2012 at 6:37 PM, Stephen Warren  wrote:
> From: Stephen Warren 
>
> Signed-off-by: Stephen Warren 

Acked-by: Simon Glass 

(nice to have a commit message though)

> ---
>  board/nvidia/dts/tegra20-harmony.dts |   10 ++
>  include/configs/harmony.h|9 -
>  2 files changed, 18 insertions(+), 1 deletions(-)
>
> diff --git a/board/nvidia/dts/tegra20-harmony.dts 
> b/board/nvidia/dts/tegra20-harmony.dts
> index c351954..ca5facb 100644
> --- a/board/nvidia/dts/tegra20-harmony.dts
> +++ b/board/nvidia/dts/tegra20-harmony.dts
> @@ -54,4 +54,14 @@
> usb@c5004000 {
> status = "disabled";
> };
> +
> +   nand-controller@70008000 {
> +   nvidia,wp-gpios = <&gpio 23 0>; /* PC7 */
> +   nvidia,width = <8>;
> +   nvidia,timing = <26 100 20 80 20 10 12 10 70>;
> +   nand@0 {
> +   reg = <0>;
> +   compatible = "hynix,hy27uf4g2b", "nand-flash";
> +   };
> +   };
>  };
> diff --git a/include/configs/harmony.h b/include/configs/harmony.h
> index d0555c1..85059b9 100644
> --- a/include/configs/harmony.h
> +++ b/include/configs/harmony.h
> @@ -62,8 +62,15 @@
>  #define CONFIG_CMD_EXT2
>  #define CONFIG_CMD_FAT
>
> +/* NAND support */
> +#define CONFIG_CMD_NAND
> +#define CONFIG_TEGRA_NAND
> +#define CONFIG_SYS_MAX_NAND_DEVICE 1
> +#define CONFIG_SYS_NAND_BASE   TEGRA20_NAND_BASE
> +
>  /* Environment not stored */
> -#define CONFIG_ENV_IS_NOWHERE
> +#define CONFIG_ENV_IS_IN_NAND
> +#define CONFIG_ENV_OFFSET  (SZ_512M - SZ_128K) /* 128K sector size */
>
>  /* USB Host support */
>  #define CONFIG_USB_EHCI
> --
> 1.7.0.4
>
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] pull request for u-boot-tegra/master

2012-07-30 Thread Tom Warren
Albert,

Please pull u-boot-tegra/master into ARM master. Thanks!

The following changes since commit f8f09dd40423b7f9ea0f0b810a8f5da9cd580a17:
  Benoît Thébaudeau (1):
ARM1136: Fix cache range checks

are available in the git repository at:

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

Allen Martin (15):
  tegra20: rename tegra2 -> tegra20
  tegra20: move tegra20 SoC code to arch/arm/cpu/tegra20-common
  tegra20: rename CONFIG_MACH_TEGRA_GENERIC
  tegra20: tec: add tegra20-common-post.h
  tegra20: make board mkdir commands unconditional
  mkconfig: add support for SPL CPU
  ARM: Fix arm720t SPL build
  tegra20: remove timer_init from SPL build
  ARM: add tegra20 support to arm720t
  tegra20: add u-boot-*-tegra.bin targets
  tegra20: move SDRAM param save to later in boot
  tegra20: enable SPL for tegra20 boards
  arm: enable libgcc build for SPL
  spl: fix SPL build of private libgcc
  tegra20: Remove armv4t build flags

 MAINTAINERS|   18 ++--
 Makefile   |   26 
 arch/arm/cpu/arm720t/cpu.c |2 +
 arch/arm/cpu/arm720t/interrupts.c  |5 +
 arch/arm/cpu/arm720t/start.S   |   19 +++-
 .../cpu/{armv7/tegra2 => arm720t/tegra20}/Makefile |   28 +---
 .../arch-tegra2 => cpu/arm720t/tegra20}/board.h|   11 +-
 .../{armv7/tegra2 => arm720t/tegra20}/config.mk|   12 --
 .../{armv7/tegra2/ap20.c => arm720t/tegra20/cpu.c} |  148 ++--
 .../ap20.h => cpu/arm720t/tegra20/cpu.h}   |   15 +--
 arch/arm/cpu/arm720t/tegra20/spl.c |  132 +
 arch/arm/cpu/armv7/start.S |2 -
 arch/arm/cpu/armv7/{tegra2 => tegra20}/Makefile|   15 +--
 .../cpu/armv7/{tegra2 => tegra20}/cmd_enterrcm.c   |4 +-
 arch/arm/cpu/armv7/{tegra2 => tegra20}/config.mk   |   12 --
 arch/arm/cpu/armv7/{tegra2 => tegra20}/usb.c   |2 +-
 .../cpu/{armv7/tegra2 => tegra20-common}/Makefile  |   29 ++---
 arch/arm/cpu/tegra20-common/ap20.c |  131 +
 .../cpu/{armv7/tegra2 => tegra20-common}/board.c   |   39 ++
 .../cpu/{armv7/tegra2 => tegra20-common}/clock.c   |   10 +-
 .../cpu/{armv7/tegra2 => tegra20-common}/crypto.c  |0
 .../cpu/{armv7/tegra2 => tegra20-common}/crypto.h  |0
 .../arm/cpu/{armv7/tegra2 => tegra20-common}/emc.c |2 +-
 .../cpu/{armv7/tegra2 => tegra20-common}/funcmux.c |2 +-
 .../tegra2 => tegra20-common}/lowlevel_init.S  |0
 .../cpu/{armv7/tegra2 => tegra20-common}/pinmux.c  |4 +-
 .../arm/cpu/{armv7/tegra2 => tegra20-common}/pmu.c |2 +-
 .../{armv7/tegra2 => tegra20-common}/sys_info.c|2 +-
 .../cpu/{armv7/tegra2 => tegra20-common}/timer.c   |2 +-
 .../{armv7/tegra2 => tegra20-common}/warmboot.c|   18 ++--
 .../tegra2 => tegra20-common}/warmboot_avp.c   |4 +-
 .../tegra2 => tegra20-common}/warmboot_avp.h   |0
 .../asm/{arch-tegra2 => arch-tegra20}/ap20.h   |4 +-
 .../asm/{arch-tegra2 => arch-tegra20}/apb_misc.h   |0
 .../asm/{arch-tegra2 => arch-tegra20}/board.h  |0
 .../asm/{arch-tegra2 => arch-tegra20}/clk_rst.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/clock.h  |0
 .../asm/{arch-tegra2 => arch-tegra20}/emc.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/flow.h   |0
 .../asm/{arch-tegra2 => arch-tegra20}/funcmux.h|2 +-
 .../asm/{arch-tegra2 => arch-tegra20}/fuse.h   |0
 .../asm/{arch-tegra2 => arch-tegra20}/gp_padctrl.h |2 +-
 .../asm/{arch-tegra2 => arch-tegra20}/gpio.h   |2 +-
 arch/arm/include/asm/arch-tegra20/hardware.h   |   29 
 .../asm/{arch-tegra2 => arch-tegra20}/mmc.h|8 +-
 .../asm/{arch-tegra2 => arch-tegra20}/pinmux.h |0
 .../asm/{arch-tegra2 => arch-tegra20}/pmc.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/pmu.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/scu.h|0
 .../{arch-tegra2 => arch-tegra20}/sdram_param.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/sys_proto.h  |4 +-
 .../tegra2.h => arch-tegra20/tegra20.h}|   18 ++--
 .../asm/{arch-tegra2 => arch-tegra20}/tegra_i2c.h  |2 +-
 .../asm/{arch-tegra2 => arch-tegra20}/tegra_spi.h  |4 +-
 .../asm/{arch-tegra2 => arch-tegra20}/timer.h  |6 +-
 .../uart-spi-switch.h  |0
 .../asm/{arch-tegra2 => arch-tegra20}/uart.h   |0
 .../asm/{arch-tegra2 => arch-tegra20}/usb.h|0
 .../asm/{arch-tegra2 => arch-tegra20}/warmboot.h   |0
 arch/arm/lib/Makefile  |2 +-
 board/avionic-design/common/tamonten.c |4 +-
 .../dts/{tegra2-medcom.dts => tegra20-medcom.dts}  |0
 .../dts/{tegra2-plutux.dts => tegra20-plutux.dts}  |0
 .../dts/{tegra2-tec.dts => tegra20-tec.dts}|0
 board/avionic-design/medcom/Mak

[U-Boot] usb_test_unit_ready called every block read - performance

2012-07-30 Thread Jim Shimer
While tuning ext2load, we found that usb_test_unit_ready was being called
every block read.  We compared the usb block storage to the scsi block
storage cmd_scsi.c, and found that the scsi device was only calling its
scsi_setup_test_unit_ready() during scsi_can.  It appears that
usb_test_unit_ready() really only needs to be called once during
usb_stor_scan(), via usb_stor_get_info().   Is there a particular reason
usb_test_unit_ready is called for every block read, or do you think its ok
to only call during usb_stor_scan()?  We're finding this speeds up ext2load
quite a bit.

Regards,
Jim

-- 
*James H Shimer*
Motorola Mobility T3-12-HH72
900 Chelmsford Street
Lowell MA 08151
978-614-3550
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 18/17] am33xx: Correct and clean up ddr_regs struct

2012-07-30 Thread Tom Rini
The ddr_regs struct was incorrectly offset after the dt0wiratio0 entry.
Correct this by documenting a missing register that will be used at some
point in the future (when write leveling is supported).  Further, the
cmdNcs{force,delay} fields are undocumented and we have been setting
them to zero, remove.  Next, setting of the
'DATAn_REG_PHY_USE_RANK0_DELAYS field belongs with the rest of the
ddr_data entries, so program it there.  Finally, comment on how we are
configuring the DATA1 registers that correspond to the DATA0 (dt0)
registers defined in the struct.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |7 +
 arch/arm/cpu/armv7/am33xx/emif4.c   |   10 +---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   37 +--
 3 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index 59ca51f..bceed81 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -77,20 +77,14 @@ void config_ddr_phy(const struct emif_regs *regs)
 void config_cmd_ctrl(const struct cmd_control *cmd)
 {
writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio);
-   writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce);
-   writel(cmd->cmd0csdelay, &ddr_reg[0]->cm0csdelay);
writel(cmd->cmd0dldiff, &ddr_reg[0]->cm0dldiff);
writel(cmd->cmd0iclkout, &ddr_reg[0]->cm0iclkout);
 
writel(cmd->cmd1csratio, &ddr_reg[0]->cm1csratio);
-   writel(cmd->cmd1csforce, &ddr_reg[0]->cm1csforce);
-   writel(cmd->cmd1csdelay, &ddr_reg[0]->cm1csdelay);
writel(cmd->cmd1dldiff, &ddr_reg[0]->cm1dldiff);
writel(cmd->cmd1iclkout, &ddr_reg[0]->cm1iclkout);
 
writel(cmd->cmd2csratio, &ddr_reg[0]->cm2csratio);
-   writel(cmd->cmd2csforce, &ddr_reg[0]->cm2csforce);
-   writel(cmd->cmd2csdelay, &ddr_reg[0]->cm2csdelay);
writel(cmd->cmd2dldiff, &ddr_reg[0]->cm2dldiff);
writel(cmd->cmd2iclkout, &ddr_reg[0]->cm2iclkout);
 }
@@ -106,6 +100,7 @@ void config_ddr_data(int macrono, const struct ddr_data 
*data)
writel(data->datagiratio0, &ddr_reg[macrono]->dt0giratio0);
writel(data->datafwsratio0, &ddr_reg[macrono]->dt0fwsratio0);
writel(data->datawrsratio0, &ddr_reg[macrono]->dt0wrsratio0);
+   writel(data->datauserank0delay, &ddr_reg[macrono]->dt0rdelays0);
writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0);
 }
 
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index ace3d26..3bb91d3 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -61,25 +61,20 @@ static const struct ddr_data ddr2_data = {
|(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0)),
.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20)
|(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0)),
+   .datauserank0delay = DDR2_PHY_RANK0_DELAY,
.datadldiff0 = PHY_DLL_LOCK_DIFF,
 };
 
 static const struct cmd_control ddr2_cmd_ctrl_data = {
.cmd0csratio = DDR2_RATIO,
-   .cmd0csforce = CMD_FORCE,
-   .cmd0csdelay = CMD_DELAY,
.cmd0dldiff = DDR2_DLL_LOCK_DIFF,
.cmd0iclkout = DDR2_INVERT_CLKOUT,
 
.cmd1csratio = DDR2_RATIO,
-   .cmd1csforce = CMD_FORCE,
-   .cmd1csdelay = CMD_DELAY,
.cmd1dldiff = DDR2_DLL_LOCK_DIFF,
.cmd1iclkout = DDR2_INVERT_CLKOUT,
 
.cmd2csratio = DDR2_RATIO,
-   .cmd2csforce = CMD_FORCE,
-   .cmd2csdelay = CMD_DELAY,
.cmd2dldiff = DDR2_DLL_LOCK_DIFF,
.cmd2iclkout = DDR2_INVERT_CLKOUT,
 };
@@ -121,9 +116,6 @@ void config_ddr(short ddr_type)
config_ddr_data(0, &ddr2_data);
config_ddr_data(1, &ddr2_data);
 
-   writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
-   writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
-
config_io_ctrl(DDR2_IOCTRL_VALUE);
 
/* Set CKE to be controlled by EMIF/DDR PHY */
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index b37b161..0526863 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -26,8 +26,6 @@
 #define VTP_CTRL_READY (0x1 << 5)
 #define VTP_CTRL_ENABLE(0x1 << 6)
 #define VTP_CTRL_START_EN  (0x1)
-#define CMD_FORCE  0x00
-#define CMD_DELAY  0x00
 #define PHY_DLL_LOCK_DIFF  0x0
 #define DDR_CKE_CTRL_NORMAL0x1
 
@@ -66,43 +64,43 @@ void config_ddr_phy(const struct emif_regs *regs);
 
 /**
  * This structure represents the DDR registers on AM33XX devices.
+ * We make use of DDR_PHY_BASE_ADDR2 to address the DATA1 registers that
+ * correspond to DATA1 registers defined here.
  */
 struct ddr_regs {
unsigned int resv0[7];
unsigned int cm0csratio;/*

[U-Boot] [STATUS] v2012.07 released, Merge Window is OPEN

2012-07-30 Thread Wolfgang Denk
Hello all,
 
 U-Boot v2012.07 has been released and is available from the git 
 repository and the FTP server.
  
The Merge Window for the next release (v2012.10) is open until
Sat Aug 18, 2012, 23:59:59 CEST = 19 days remaining.

Release "v2012.10" is scheduled in 77 days — on October 15, 2012.

A little statistics [1] - changes since release v2012.04:

Processed 775 csets from 115 developers
14 employers found
A total of 55134 lines added, 11790 removed (delta 43344)

Developers with the most changesets
Joe Hershberger 90 (11.6%)
Fabio Estevam   56 (7.2%)
Marek Vasut 42 (5.4%)
Stephen Warren  35 (4.5%)
SRICHARAN R 29 (3.7%)
Tom Rini25 (3.2%)
Mike Frysinger  22 (2.8%)
Simon Glass 22 (2.8%)
Vipin Kumar 21 (2.7%)
Anatolij Gustschin  19 (2.5%)
...

Developers with the most changed lines
Donghwa Lee   9433 (15.7%)
Mike Frysinger3200 (5.3%)
Joe Hershberger   2929 (4.9%)
Nobuhiro Iwamatsu 2412 (4.0%)
Yen Lin   2098 (3.5%)
Stefano Babic 2090 (3.5%)
Stefan Roese  2001 (3.3%)
Lukasz Majewski  1954 (3.3%)
Marek Vasut   1815 (3.0%)
Macpaul Lin   1690 (2.8%)
...

Developers with the most lines removed
Tom Rini   831 (7.0%)
Jaehoon Chung  353 (3.0%)
Enric Balletbò i Serra262 (2.2%)
Amit Virdi 104 (0.9%)
York Sun51 (0.4%)
Timur Tabi  51 (0.4%)
Andreas Bießmann   43 (0.4%)
Wolfgang Denk   22 (0.2%)
Simon Guinot13 (0.1%)
Thomas Chou  6 (0.1%)
...

Developers with the most signoffs (total 372)
Tom Warren  80 (21.5%)
Stefan Roese46 (12.4%)
Kyungmin Park   32 (8.6%)
Amit Virdi  31 (8.3%)
Andy Fleming16 (4.3%)
Kim Phillips14 (3.8%)
Simon Glass 14 (3.8%)
Valentin Longchamp  13 (3.5%)
Minkyu Kang 11 (3.0%)
Anatolij Gustschin  10 (2.7%)
...

Developers with the most reviews (total 2)
Joe Hershberger  2 (100.0%)

Developers with the most test credits (total 25)
Anatolij Gustschin   3 (12.0%)
Tom Rini 3 (12.0%)
Wolfgang Denk2 (8.0%)
Gary Thomas  2 (8.0%)
Pali Rohár  2 (8.0%)
Stephen Warren   2 (8.0%)
Simon Glass  1 (4.0%)
Holger Brunck1 (4.0%)
Jaehoon Chung1 (4.0%)
Simon Guinot 1 (4.0%)
...

Developers who gave the most tested-by credits (total 25)
Anatolij Gustschin   3 (12.0%)
Luka Perkov  3 (12.0%)
SRICHARAN R  2 (8.0%)
Tetsuyuki Kobayashi  2 (8.0%)
u-b...@lakedaemon.net2 (8.0%)
Grazvydas Ignotas2 (8.0%)
Timo Ketola  2 (8.0%)
Stephen Warren   1 (4.0%)
amar...@nvidia.com   1 (4.0%)
Tom Warren   1 (4.0%)
...

Developers with the most report credits (total 12)
Isabelle Gros3 (25.0%)
Jerome Angeloni  3 (25.0%)
Pali Rohár  1 (8.3%)
Marek Vasut  1 (8.3%)
Deepak Sikri 1 (8.3%)
David Jander 1 (8.3%)
Armando Visconti 1 (8.3%)
Michael Walle1 (8.3%)

Developers who gave the most report credits (total 12)
Nishanth Menon   6 (50.0%)
Shiraz Hashim2 (16.7%)
Anatolij Gustschin   1 (8.3%)
Mike Frysinger   1 (8.3%)
Joe Hershberger  1 (8.3%)
Stefano Babic1 (8.3%)

Top changeset contributors by employer
(Unknown)  321 (41.4%)
Freescale  102 (13.2%)
DENX Software Engineering   92 (11.9%)
Texas Instruments   83 (10.7%)
NVidia  51 (6.6%)
Samsung 44 (5.7%)
ST Microelectronics 41 (5.3%)
Renesas Technology  13 (1.7%)
Boundary Devices12 (1.5%)
CompuLab 7 (0.9%)
...

Top lines changed by employer
(Unknown) 21667 (36.1%)
Samsung   13488 (22.5%)
DENX Software Engineering 6788 (11.3%)
NVidia4584 (7.6%)
Freescale 4044 (6.7%)
Texas Instruments 3424 (5.7%)
Renesas Technology2803 (4.7%)
ST Microelectronics   1752 (2.9%)
Atmel  719 (1.2%)
Boundary Devices   426 (0.7%)
...

Employers with the most signoffs (total 372)
NVidia  80 (21.5%)
(Unknown)   64 (17.2%)
DENX Software Engineering   60 (16.1%)
Freescale   59 (15.9%)
Samsung 57 (15.3%)
ST Microelectronics 35 (9.4%)
Texas Instruments   10 (2.7%)
CompuLab 5 (1.3%)
Marvell   

Re: [U-Boot] [PATCH 4/7] powerpc/82xx: move km/km82xx-common.h within km82xx.h

2012-07-30 Thread Wolfgang Denk
Dear Gerlando,

In message <5016d241.4030...@keymile.com> you wrote:
>
> > Please also try with -M -C and see if this changes anything.
> 
> For this one patch I can't get git to detect renames.

Neither can I.  Thanks for trying, though.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
How many Unix hacks does it take to change a light bulb?  Let's  see,
   can you use a shell script for that or does it need a C program?
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Building u-boot for iMX28 and getting error in mkimage of missing command line parameter CONFIG_IMX_CONFIG

2012-07-30 Thread Bill
Progress!   I switched all the references from ttyAMA0...   to ttyAM0.  
Also changed netargs too.  Now it starts to boot linux but hangs right 
after the line of:

mxs_cpu_init:  cpufreq init finished.
In regards to your question, yes it was booting the mainline kernel.

Here is the latest output from the boot.

U-Boot 2012.07-rc1-08235-g7c5f511 (Jul 26 2012 - 12:00:38)

Freescale i.MX28 family at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
I2C:   ready
DRAM:  128 MiB
MMC:   MXS MMC: 0
In:serial
Out:   serial
Err:   serial
Net:   FEC0, FEC1
Hit any key to stop autoboot:  0
Booting from net ...
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 42
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 42
*** Unhandled DHCP Option in OFFER/ACK: 44
DHCP client bound to address 192.168.0.240
Using FEC0 device
TFTP from server 192.168.0.204; our IP address is 192.168.0.240
Filename 'uImage'.
Load address: 0x4200
Loading: #
 #
 #
 #
 #
 #
 #
 ##
done
Bytes transferred = 2562232 (2718b8 hex)
## Booting kernel from Legacy Image at 4200 ...
   Image Name:   Linux-2.6.35.3-571-gcca29a0
   Created:  2012-07-12  15:53:55 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:2562168 Bytes = 2.4 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35.3-571-gcca29a0 (blsousan@ubuntu) (gcc version 4.4.4 
(4.4.4_09.06.2010) ) #1 PREEMPT Thu Jul 12 08:53:51 PDT 2012

CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Freescale MX28EVK board
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
Kernel command line: console=ttyAM0,115200
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 124316k/124316k available, 6756k reserved, 0K highmem
Virtual kernel memory layout:
vector  : 0x - 0x1000   (   4 kB)
fixmap  : 0xfff0 - 0xfffe   ( 896 kB)
DMA : 0xfde0 - 0xffe0   (  32 MB)
vmalloc : 0xc880 - 0xf000   ( 632 MB)
lowmem  : 0xc000 - 0xc800   ( 128 MB)
modules : 0xbf00 - 0xc000   (  16 MB)
  .init : 0xc0008000 - 0xc003   ( 160 kB)
  .text : 0xc003 - 0xc04f7000   (4892 kB)
  .data : 0xc04f8000 - 0xc0535960   ( 247 kB)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Hierarchical RCU implementation.
RCU-based detection of stalled CPUs is disabled.
Verbose stalled-CPUs detection is disabled.
NR_IRQS:288
Console: colour dummy device 80x30
console [ttyAM0] enabled
Calibrating delay loop... 226.09 BogoMIPS (lpj=1130496)
pid_max: default: 32768 minimum: 301
Security Framework initialized
SELinux:  Initializing.
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
regulator: core version 0.5
NET: Registered protocol family 16
regulator: vddd: 800 <--> 1575 mV at 1500 mV fast normal
regulator: vdddbo: 800 <--> 1575 mV fast normal
regulator: vdda: 1500 <--> 2275 mV at 1800 mV fast normal
vddio = 338, val=10
regulator: vddio: 2880 <--> 3680 mV at 3380 mV fast normal
regulator: overall_current: fast normal
regulator: vbus5v:
regulator: mxs-duart-1: fast normal
regulator: mxs-bl-1: fast normal
regulator: mxs-i2c-1: fast normal
regulator: mmc_ssp-1: fast normal
regulator: mmc_ssp-2: fast normal
regulator: charger-1: fast normal
regulator: power-test-1: fast normal
regulator: cpufreq-1: fast normal
i.MX IRAM pool: 124 KB@0xc882
usb DR wakeup device is registered
IMX usb wakeup probe
audit: cannot initialize inotify handle
bio: create slab  at 0
SCSI subsystem initialized
Freescale USB OTG Driver loaded, $Revision: 1.55 $
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Version 1.0.23.
Switching to clocksource mxs clock source
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table en

Re: [U-Boot] [PATCH 4/7] powerpc/82xx: move km/km82xx-common.h within km82xx.h

2012-07-30 Thread Gerlando Falauto

On 07/27/2012 07:31 PM, Wolfgang Denk wrote:

Dear Gerlando Falauto,

In message<1343402200-32020-5-git-send-email-gerlando.fala...@keymile.com>  you 
wrote:

The only file including km82xx-common.h is km82xx.h.
So there is no need to have it as a separate file.

Signed-off-by: Gerlando Falauto
---
  include/configs/km/km82xx-common.h |  317 
  include/configs/km82xx.h   |  290 -
  2 files changed, 289 insertions(+), 318 deletions(-)
  delete mode 100644 include/configs/km/km82xx-common.h


Please also try with -M -C and see if this changes anything.


For this one patch I can't get git to detect renames.
I tried with git 1.7.1, 1.7.10.4, 1.7.11.3:

-> git commit --amend
[xxx f9981ff] powerpc/82xx: move km/km82xx-common.h within km82xx.h
 1 files changed, 124 insertions(+), 4 deletions(-)
 rename include/configs/{km/km82xx-common.h => km82xx.h} (75%)

Notice how git commit DOES detect the rename, but the following 
format-patch does NOT:


-> git format-patch -M -C --stdout -1
From f9981ff849562c9d466d9429e0ec9a510a0d4b3c Mon Sep 17 00:00:00 2001
From: Gerlando Falauto 
Date: Tue, 10 Jul 2012 18:13:27 +0200
Subject: [PATCH] ...
...
---
 include/configs/km/km82xx-common.h |  317 

 include/configs/km82xx.h   |  290 
-

 2 files changed, 289 insertions(+), 318 deletions(-)
 delete mode 100644 include/configs/km/km82xx-common.h
...
 #endif /* __CONFIG_H */
--
1.7.10.4

I guess the reason behind this is that km82xx.h is already existing.
Again, git can somehow track renames (i.e. one file's gone, another 
one's brand new), but it does not detect "merging" of files.


As a matter of fact, if I rename the target file, i.e.:
-> git mv include/configs/km82xx.h include/configs/km82xx-tmp.h
-> git commit --amend
[xxx 49c85c3] powerpc/82xx: move km/km82xx-common.h within km82xx.h
 2 files changed, 124 insertions(+), 153 deletions(-)
 rename include/configs/{km/km82xx-common.h => km82xx-tmp.h} (75%)
 delete mode 100644 include/configs/km82xx.h

-> ~/bin/git format-patch -M -C -1 --stdout

From 49c85c351f65330746836bf90a06443a6b095b1e Mon Sep 17 00:00:00 2001
From: Gerlando Falauto 
Date: Tue, 10 Jul 2012 18:13:27 +0200
Subject: [PATCH] ...

...
---
 .../configs/{km/km82xx-common.h => km82xx-tmp.h}   |  128 
-
 include/configs/km82xx.h   |  149 


 2 files changed, 124 insertions(+), 153 deletions(-)
 rename include/configs/{km/km82xx-common.h => km82xx-tmp.h} (75%)
 delete mode 100644 include/configs/km82xx.h

diff --git a/include/configs/km/km82xx-common.h 
b/include/configs/km82xx-tmp.h

similarity index 75%
rename from include/configs/km/km82xx-common.h
rename to include/configs/km82xx-tmp.h
index 2c763bb..9bfb8df 100644

THEN, AND ONLY THEN, do I get a rename detected.
And we would need an extra patch to rename it back...

Anyway, I believe the above patch, if applied to a tree with a slightly 
different (let's say updated) km82xx.h, would fail upon the deletion of 
km82xx.h, but would apply cleanly on km82xx-common.h (introducing 
outdated chunks of km82xx.h though). Is that what we really want?


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


Re: [U-Boot] [PATCH] hawkboard: Fix SPL Nand driver misconfiguration

2012-07-30 Thread Wolfgang Denk
Dear Linu Cherian,

In message <1343377313-30301-1-git-send-email-linucher...@gmail.com> you wrote:
> Hawkboard was using the wrong nand_read_page version for SPL image.
> As a side effect, the u-boot image loaded by the SPL from nand
> was getting corrupted.
> 
> Enable CONFIG_SYS_NAND_HW_ECC_OOBFIRST to select the correct nand_read_page
> algorithm for SPL.
> 
> Signed-off-by: Linu Cherian 
> ---
>  include/configs/hawkboard.h |1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
On the subject of C program indentation: "In My Egotistical  Opinion,
most  people's  C  programs  should be indented six feet downward and
covered with dirt."   - Blair P. Houghton
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/7] powerpc/82xx: merge mgcoge.h and mgcoge3ne.h into km82xx.h

2012-07-30 Thread Gerlando Falauto
Since mgcoge and mgcoge3ne are the only km82xx boards, there is no need
to keep them as separate .h config files.
Therefore, make mgcoge3ne.h and mgcoge.h converge into a single km82xx.h
file.

Signed-off-by: Gerlando Falauto 
---
Changes from v1:
  switched to git v1.7.11.3, used git format-patch -M -C
---
 boards.cfg|  4 +-
 include/configs/{mgcoge3ne.h => km82xx.h} | 58 ++-
 include/configs/mgcoge.h  | 93 ---
 3 files changed, 59 insertions(+), 96 deletions(-)
 rename include/configs/{mgcoge3ne.h => km82xx.h} (66%)
 delete mode 100644 include/configs/mgcoge.h

diff --git a/boards.cfg b/boards.cfg
index 2d36d83..1af87c0 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -577,8 +577,8 @@ PQ2FADS-ZU_66MHz powerpc mpc8260 
mpc8260ads  freesca
 PQ2FADS-ZU_66MHz_lowboot powerpc mpc8260 mpc8260ads  
freescale  -   
MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=6600,SYS_TEXT_BASE=0xFF80
 PQ2FADS-ZU_lowboot   powerpc mpc8260 mpc8260ads  
freescale  -   
MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF80
 VoVPN-GW_66MHz   powerpc mpc8260 vovpn-gw
funkwerk   -   VoVPN-GW:CLKIN_66MHz
-mgcoge   powerpc mpc8260 km82xx  
keymile
-mgcoge3nepowerpc mpc8260 km82xx  
keymile
+mgcoge   powerpc mpc8260 km82xx  
keymile-   km82xx:MGCOGE
+mgcoge3nepowerpc mpc8260 km82xx  
keymile-   km82xx:MGCOGE3NE
 SCM  powerpc mpc8260 -   
siemens
 TQM8255_AA   powerpc mpc8260 tqm8260 tqc   
 -   TQM8260:MPC8255,300MHz
 TQM8260_AA   powerpc mpc8260 tqm8260 tqc   
 -   TQM8260:MPC8260,200MHz
diff --git a/include/configs/mgcoge3ne.h b/include/configs/km82xx.h
similarity index 66%
rename from include/configs/mgcoge3ne.h
rename to include/configs/km82xx.h
index 7ab03a0..5d62f4b 100644
--- a/include/configs/mgcoge3ne.h
+++ b/include/configs/km82xx.h
@@ -30,11 +30,21 @@
  */
 
 #define CONFIG_MPC8247
-#define CONFIG_MGCOGE3NE
+/* MGCOGE */
+#if defined(CONFIG_MGCOGE)
+#define CONFIG_HOSTNAMEmgcoge
+#define CONFIG_KM_BOARD_EXTRA_ENV  ""
+
+/* MGCOGE3NE */
+#elif defined(CONFIG_MGCOGE3NE)
 #define CONFIG_HOSTNAMEmgcoge3ne
 #define CONFIG_KM_82XX
 #define CONFIG_KM_BOARD_EXTRA_ENV  "bobcatreset=true\0"
 
+#else
+#error ("Board unsupported")
+#endif
+
 #defineCONFIG_SYS_TEXT_BASE0xFE00
 
 /* include common defines/options for all Keymile boards */
@@ -46,6 +56,51 @@
 #define CONFIG_SYS_FLASH_SIZE  32
 #define CONFIG_SYS_FLASH_CFI
 #define CONFIG_FLASH_CFI_DRIVER
+
+/* MGCOGE */
+#if defined(CONFIG_MGCOGE)
+#define CONFIG_SYS_MAX_FLASH_BANKS 3
+/* max num of sects on one chip */
+#define CONFIG_SYS_MAX_FLASH_SECT  512
+
+#define CONFIG_SYS_FLASH_BASE_10x5000
+#define CONFIG_SYS_FLASH_SIZE_132
+#define CONFIG_SYS_FLASH_BASE_20x5200
+#define CONFIG_SYS_FLASH_SIZE_232
+
+#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \
+   CONFIG_SYS_FLASH_BASE_1, \
+   CONFIG_SYS_FLASH_BASE_2 }
+#define MTDIDS_DEFAULT "nor3=app"
+
+/*
+ * Bank 1 - 60x bus SDRAM
+ */
+#define SDRAM_MAX_SIZE 0x0800  /* max. 128 MB  */
+#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT  (256 << 20) /* less than 256 MB */
+
+/* SDRAM initialization values
+*/
+
+#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
+  ORxS_SDAM_MSK)   |\
+   ORxS_BPD_8  |\
+   ORxS_ROWST_PBI0_A7  |\
+   ORxS_NUMR_13)
+
+#define CONFIG_SYS_PSDMR ( \
+   PSDMR_SDAM_A14_IS_A5|\
+   PSDMR_BSMA_A14_A16  |\
+   PSDMR_SDA10_PBI0_A9 |\
+   PSDMR_RFRC_5_CLK|\
+   PSDMR_PRETOACT_2W   |\
+   PSDMR_ACTTORW_2W|\
+   PSDMR_LDOTOPRE_1C   |\
+   PSDMR_WRC_1C|\
+   PSDMR_CL_2)
+
+/* MGCOGE3NE */
+#elif defined(CONFIG_MGCOGE3NE)
 #define CONFIG_SYS_MAX_FLASH_BANKS 2   /* max num of flash banks */
 #define CONFIG_SYS_MAX_FLASH_SECT  1024/*
 * max num of sects on one
@@ -86,6 +141,7 @@
PSDMR_

Re: [U-Boot] [PATCH 3/7] powerpc/82xx: merge mgcoge.h and mgcoge3ne.h into km82xx.h

2012-07-30 Thread Gerlando Falauto

On 07/30/2012 06:07 PM, Wolfgang Denk wrote:

Dear Gerlando Falauto,

In message<5016a093.6040...@keymile.com>  you wrote:


The way I understand it, such renaming information is built on the fly
while building the patch (like you're suggesting, it's a parameter to
git format-patch, not to the commit itself).


Yes, and I fail to understand where your problems could be.


However, I've been struggling to get this same kind of message through
git-format-patch. No way, I don't know why. I tried with -M, -M -C,
-M10%, adding "[diff]\n renames = copies" to ~/.gitconfig, with both
versions below, nothing. Detected as a rename at commit time, it's a
plain delete/create commit at patch creation time.


I see this (doing it all manually for testing):

->  patch -p1  git rm include/configs/mgcoge.h include/configs/mgcoge3ne.h
->  git add include/configs/km82xx.h
->  git commit -s -m 'test 1'
->  git format-patch -M -C --stdout HEAD^>/tmp/patch
->  less /tmp/patch
 From 1d9ce92a542d139b78291fb4e437e538d647d55b Mon Sep 17 00:00:00 2001
From: Wolfgang Denk
Date: Mon, 30 Jul 2012 17:57:53 +0200
Subject: [PATCH] test 1

Signed-off-by: Wolfgang Denk
---
  include/configs/{mgcoge3ne.h =>  km82xx.h} |   95 
++---
  include/configs/mgcoge.h  |   93 
  2 files changed, 74 insertions(+), 114 deletions(-)
  rename include/configs/{mgcoge3ne.h =>  km82xx.h} (55%)
  delete mode 100644 include/configs/mgcoge.h

...

Oops, I forgot to "git add boards.cfg" here, but for this test it
makes no difference.


It turns out it's a bug/limitation of git 1.7.1.
I upgraded to 1.7.10.4 and 1.7.11.3 and now I get the same results as 
you do (rename detected). See new patch as a follow-up.


[...]


In any case, I have no clue whether git would be able to correctly (i.e.
intelligently) apply such patch to a slightly different tree (e.g.
through cherry-pick or rebase).
So for instance, in your example above, what if file.1 (whose contents
is anyway moved into file.common, regardless of rename detection) is
slightly different?


It doesn't matter.  If there are conflicts, and these can be resolved,
it works just the same.


I'm strongly convinced that if we want to track such changes for what
they are (code moving) so that they can be "easily" re-applied, we
should mark this explicitly. Even at the cost of creating multiple
patches if necessary. Since git isn't able to figure it out by itself,


No, on contrary.  This is basicly an atomic change, and we should not
artificially split it.  git should have no problems with such actions,
they are really not special in any way.


Renaming, I understand. But merging/splitting files, I guess they should 
be treated differently (i.e., as such!) IMHO, if we want repeatability 
and resilience to small changes.
But git doesn't (yet?) do that, and I think it should be worked around 
some other way.





the only way I can think of doing this is splitting the commit into 3 parts:


No, please don't.


Since mgcoge and mgcoge3ne are the only km82xx boards, there is no
need to keep them as separate .h config files.
Therefore, make mgcoge3ne.h and mgcoge.h converge into a single
km82xx.h file.
Step 2 of 3: substitute include files through the following script:

INCLUDE_STMT='#include "mgcoge.h"'
INCLUDED=include/configs/mgcoge.h
INCLUDING=include/configs/km82xx.h


Argh No, this is not what we're going to do.


Alright, your call.

Thanks for your patience.
Gerlando
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] km/common: remove printfs for i2c deblocking code

2012-07-30 Thread Prafulla Wadaskar


> -Original Message-
> From: Heiko Schocher [mailto:h...@denx.de]
> Sent: 30 July 2012 14:53
> To: Gerlando Falauto
> Cc: u-boot@lists.denx.de; Holger Brunck; Prafulla Wadaskar
> Subject: Re: [U-Boot] [PATCH] km/common: remove printfs for i2c
> deblocking code
> 
> Hello Gerlando,
> 
> On 27.07.2012 16:58, Gerlando Falauto wrote:
> > From: Holger Brunck
> >
> > This code will also be used before reallocation and during this time
> we
> > are not allowed to do these printings.
> >
> > Signed-off-by: Holger Brunck
> > ---
> >   board/keymile/common/common.c |3 ---
> >   1 files changed, 0 insertions(+), 3 deletions(-)
> 
> Acked-by: Heiko Schocher
> 
> @Prafulla: Is it OK for you, if I pick this patch up to my i2c tree?
> 

Hi Heiko
Yes, I am okay with it, please pick it.

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


[U-Boot] [PATCH] at91: Add support for taskit AT91SAM9G20 boards.

2012-07-30 Thread Markus Hubig
This adds support for the AT91SAM9G20 boards by taskit GmbH.
Both boards, Stamp9G20 and PortuxG20, are integrated in one
file. PortuxG20 is basically a SBC built around the Stamp9G20.

Signed-off-by: Markus Hubig 
Cc: Andreas Bießmann 
---
 board/taskit/stamp9g20/Makefile|   52 
 board/taskit/stamp9g20/stamp9g20.c |  199 +++
 boards.cfg |2 +
 include/configs/stamp9g20.h|  225 
 4 files changed, 478 insertions(+), 0 deletions(-)
 create mode 100644 board/taskit/stamp9g20/Makefile
 create mode 100644 board/taskit/stamp9g20/stamp9g20.c
 create mode 100644 include/configs/stamp9g20.h

diff --git a/board/taskit/stamp9g20/Makefile b/board/taskit/stamp9g20/Makefile
new file mode 100644
index 000..e99bfaa
--- /dev/null
+++ b/board/taskit/stamp9g20/Makefile
@@ -0,0 +1,52 @@
+#
+# (C) Copyright 2003-2008
+# Wolfgang Denk, DENX Software Engineering, w...@denx.de.
+#
+# (C) Copyright 2008
+# Stelian Pop 
+# Lead Tech Design 
+#
+# (C) Copyright 2012
+# Markus Hubig 
+# IMKO GmbH 
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB= $(obj)lib$(BOARD).o
+
+COBJS-y+= stamp9g20.o
+
+SRCS   := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
+OBJS   := $(addprefix $(obj),$(COBJS-y))
+SOBJS  := $(addprefix $(obj),$(SOBJS))
+
+$(LIB):$(obj).depend $(OBJS) $(SOBJS)
+   $(call cmd_link_o_target, $(OBJS) $(SOBJS))
+
+#
+
+# defines $(obj).depend target
+include $(SRCTREE)/rules.mk
+
+sinclude $(obj).depend
+
+#
diff --git a/board/taskit/stamp9g20/stamp9g20.c 
b/board/taskit/stamp9g20/stamp9g20.c
new file mode 100644
index 000..b87de51
--- /dev/null
+++ b/board/taskit/stamp9g20/stamp9g20.c
@@ -0,0 +1,199 @@
+/*
+ * (C) Copyright 2007-2008
+ * Stelian Pop 
+ * Lead Tech Design 
+ *
+ * Achim Ehrlich 
+ * taskit GmbH 
+ *
+ * (C) Copyright 2012-
+ * Markus Hubig 
+ * IMKO GmbH 
+ *
+ * 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_MACB
+# include 
+# include 
+#endif /* CONFIG_MACB */
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static void stamp9G20_nand_hw_init(void)
+{
+   struct at91_smc *smc = (struct at91_smc *)ATMEL_BASE_SMC;
+   struct at91_matrix *matrix = (struct at91_matrix *)ATMEL_BASE_MATRIX;
+   unsigned long csa;
+
+   /* Assign CS3 to NAND/SmartMedia Interface */
+   csa = readl(&matrix->ebicsa);
+   csa |= AT91_MATRIX_CS3A_SMC_SMARTMEDIA;
+   writel(csa, &matrix->ebicsa);
+
+   /* Configure SMC CS3 for NAND/SmartMedia */
+   writel(AT91_SMC_SETUP_NWE(1) | AT91_SMC_SETUP_NCS_WR(0) |
+   AT91_SMC_SETUP_NRD(1) | AT91_SMC_SETUP_NCS_RD(0),
+   &smc->cs[3].setup);
+   writel(AT91_SMC_PULSE_NWE(3) | AT91_SMC_PULSE_NCS_WR(3) |
+   AT91_SMC_PULSE_NRD(3) | AT91_SMC_PULSE_NCS_RD(3),
+   &smc->cs[3].pulse);
+   writel(AT91_SMC_CYCLE_NWE(5) | AT91_SMC_CYCLE_NRD(5),
+   &smc->cs[3].cycle);
+   writel(AT91_SMC_MODE_RM_NRD | AT91_SMC_MODE_WM_NWE |
+   AT91_SMC_MODE_EXNW_DISABLE |
+   AT91_SMC_MODE_DBW_8 |
+   AT91_SMC_MODE_TDF_CYCLE(2),
+   &smc->cs[3].mode);
+
+   /* Configure RDY/BSY */
+   at9

Re: [U-Boot] [PATCH v4 0/6] tegra: Add NAND flash support

2012-07-30 Thread Tom Warren
Stephen,

> -Original Message-
> From: Stephen Warren [mailto:swar...@wwwdotorg.org]
> Sent: Monday, July 30, 2012 10:34 AM
> To: Simon Glass
> Cc: U-Boot Mailing List; Tom Warren; Scott Wood
> Subject: Re: [PATCH v4 0/6] tegra: Add NAND flash support
> 
> On 07/30/2012 12:53 AM, Simon Glass wrote:
> > This series adds NAND flash support to Tegra and enables it on Seaboard.
> >
> > Included here is a proposed device tree binding with most of the
> > properties private to "nvidia,". The binding includes information
> > about the NAND controller as well as the connected NAND device. The
> > Seaboard has a Hynix HY27UF4G2B.
> >
> > The driver supports ECC-based access and uses DMA and NAND
> > acceleration features of the Tegra SOC to provide access at reasonable
> speed.
> 
> Along with a couple of patches that I'll post momentarily, this works for me
> on Harmony, so:
> 
> Tested-by: Stephen Warren 

Your two patches (Harmony NAND and env_nand) have been applied to 
u-boot-tegra/next (along w/Simon's NAND patchset, obviously), and pushed to 
denx.de. I'll apply them to u-boot-tegra/master when they're ACK'd along 
w/Simon's NAND work.

Thanks,

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


[U-Boot] [PATCH] env_nand: align NAND buffers

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

This allows cache flush/invalidate operations to succeed on the buffers.

Signed-off-by: Stephen Warren 
---
 common/env_nand.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/common/env_nand.c b/common/env_nand.c
index e8daec9..e635472 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -226,7 +226,7 @@ int saveenv(void)
 int saveenv(void)
 {
int ret = 0;
-   env_t   env_new;
+   ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, sizeof(env_t));
ssize_t len;
char*res;
nand_erase_options_t nand_erase_options;
@@ -238,20 +238,20 @@ int saveenv(void)
if (CONFIG_ENV_RANGE < CONFIG_ENV_SIZE)
return 1;
 
-   res = (char *)&env_new.data;
+   res = (char *)&env_new->data;
len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
}
-   env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+   env_new->crc = crc32(0, env_new->data, ENV_SIZE);
 
puts("Erasing Nand...\n");
if (nand_erase_opts(&nand_info[0], &nand_erase_options))
return 1;
 
puts("Writing to Nand... ");
-   if (writeenv(CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
+   if (writeenv(CONFIG_ENV_OFFSET, (u_char *)env_new)) {
puts("FAILED!\n");
return 1;
}
@@ -398,7 +398,7 @@ void env_relocate_spec(void)
 {
 #if !defined(ENV_IS_EMBEDDED)
int ret;
-   char buf[CONFIG_ENV_SIZE];
+   ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 
 #if defined(CONFIG_ENV_OFFSET_OOB)
ret = get_nand_env_oob(&nand_info[0], &nand_env_oob_offset);
-- 
1.7.0.4

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


[U-Boot] [PATCH] tegra: enable NAND on Harmony

2012-07-30 Thread Stephen Warren
From: Stephen Warren 

Signed-off-by: Stephen Warren 
---
 board/nvidia/dts/tegra20-harmony.dts |   10 ++
 include/configs/harmony.h|9 -
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/board/nvidia/dts/tegra20-harmony.dts 
b/board/nvidia/dts/tegra20-harmony.dts
index c351954..ca5facb 100644
--- a/board/nvidia/dts/tegra20-harmony.dts
+++ b/board/nvidia/dts/tegra20-harmony.dts
@@ -54,4 +54,14 @@
usb@c5004000 {
status = "disabled";
};
+
+   nand-controller@70008000 {
+   nvidia,wp-gpios = <&gpio 23 0>; /* PC7 */
+   nvidia,width = <8>;
+   nvidia,timing = <26 100 20 80 20 10 12 10 70>;
+   nand@0 {
+   reg = <0>;
+   compatible = "hynix,hy27uf4g2b", "nand-flash";
+   };
+   };
 };
diff --git a/include/configs/harmony.h b/include/configs/harmony.h
index d0555c1..85059b9 100644
--- a/include/configs/harmony.h
+++ b/include/configs/harmony.h
@@ -62,8 +62,15 @@
 #define CONFIG_CMD_EXT2
 #define CONFIG_CMD_FAT
 
+/* NAND support */
+#define CONFIG_CMD_NAND
+#define CONFIG_TEGRA_NAND
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define CONFIG_SYS_NAND_BASE   TEGRA20_NAND_BASE
+
 /* Environment not stored */
-#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET  (SZ_512M - SZ_128K) /* 128K sector size */
 
 /* USB Host support */
 #define CONFIG_USB_EHCI
-- 
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 v4 0/6] tegra: Add NAND flash support

2012-07-30 Thread Stephen Warren
On 07/30/2012 12:53 AM, Simon Glass wrote:
> This series adds NAND flash support to Tegra and enables it on Seaboard.
> 
> Included here is a proposed device tree binding with most of the properties
> private to "nvidia,". The binding includes information about the NAND
> controller as well as the connected NAND device. The Seaboard has a
> Hynix HY27UF4G2B.
> 
> The driver supports ECC-based access and uses DMA and NAND acceleration
> features of the Tegra SOC to provide access at reasonable speed.

Along with a couple of patches that I'll post momentarily, this works
for me on Harmony, so:

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


Re: [U-Boot] [PATCH v4 0/6] tegra: Add NAND flash support

2012-07-30 Thread Tom Warren
Simon,

> -Original Message-
> From: Simon Glass [mailto:s...@chromium.org]
> Sent: Sunday, July 29, 2012 11:53 PM
> To: U-Boot Mailing List
> Cc: Tom Warren; Stephen Warren; Scott Wood; Simon Glass
> Subject: [PATCH v4 0/6] tegra: Add NAND flash support
> 
> This series adds NAND flash support to Tegra and enables it on Seaboard.
> 
> Included here is a proposed device tree binding with most of the properties
> private to "nvidia,". The binding includes information about the NAND
> controller as well as the connected NAND device. The Seaboard has a Hynix
> HY27UF4G2B.
> 
> The driver supports ECC-based access and uses DMA and NAND acceleration
> features of the Tegra SOC to provide access at reasonable speed.

Applied to u-boot-tegra/master AOK. ./MAKEALL -s tegra20 AOK. Able to 
erase/read/write NAND on my Seaboard AOK.
Tested-by: Tom Warren 

Thanks, I'll upload a new u-boot-tegra/master and /next with this change later 
once I see some ACKs.

Tom
-- 
nvpublic
> 
> Changes in v2:
> - Add new patch to align default buffers in nand_base
> - Added comment about the behaviour of the 'resp' register
> - Call set_bus_width_page_size() at init to report errors earlier
> - Change set_bus_width_page_size() to return an error when needed
> - Change timing structure member to u32 to match device tree
> - Check for supported bus width in board_nand_init()
> - Fix tegra nand header file to remove BIT defines
> - Implement a dummy nand_select_chip() instead of nand_hwcontro()
> - Make nand_command() display an error on an unknown command
> - Minor code tidy-ups in driver for style
> - Move cache logic into a separate dma_prepare() function
> - Remove CMD_TRANS_SIZE_BYTESx enum
> - Remove space after casts
> - Remove use of 'register' variables
> - Rename struct nand_info to struct nand_drv to avoid nand_info_t confusion
> - Support 4096 byte page devices, drop 1024 and 2048
> - Tidy up nand_waitfor_cmd_completion() logic
> - Update NAND binding to add "nvidia," prefix
> - Use s32 for device tree integer values
> 
> Changes in v3:
> - Add reg property for unit address (should be used for chip select)
> - Change note in fdt binding about the need for a hardware-specific binding
> - Fix up typos in fdt binding, and rename the file
> - Update fdt binding to make everything Nvidia-specific
> 
> Changes in v4:
> - Align buffer length to cache line size in dma_prepare()
> - Fix "Write Page 0x0 timeout with ECC" error on 4.4.1
> - Fix the issue that read_byte can read at most 4 times
> - Get some information from Read ID data instead of from device tree
> - In nand_command, set NAND_CMD_RNDOUT as unsupported command
> - Modify eccoob layout
> - Move to using CONFIG_SYS_NAND_SELF_INIT
> - Remove "DEFAULT" from comment because that function is not default
> - Remove fdt bindings related to page structure
> - Remove local read_buf and write_buf functions
> - Remove some fields in fdt_nand structure
> - Rename CONFIG_TEGRA2_NAND to CONFIG_TEGRA_NAND
> - Rename variables my_* as our_*
> - Use virt_to_phys() when filling address register
> 
> Jim Lin (1):
>   tegra: nand: Add Tegra NAND driver
> 
> Simon Glass (5):
>   nand: Try to align the default buffers
>   tegra: Add NAND support to funcmux
>   tegra: fdt: Add NAND controller binding and definitions
>   tegra: fdt: Add NAND definitions to fdt
>   tegra: Enable NAND on Seaboard
> 
>  arch/arm/cpu/tegra20-common/funcmux.c  |7 +
>  arch/arm/dts/tegra20.dtsi  |7 +
>  arch/arm/include/asm/arch-tegra20/funcmux.h|3 +
>  arch/arm/include/asm/arch-tegra20/tegra20.h|1 +
>  board/nvidia/dts/tegra20-seaboard.dts  |   10 +
>  .../nand/nvidia,tegra20-nand.txt   |   53 +
>  drivers/mtd/nand/Makefile  |1 +
>  drivers/mtd/nand/nand_base.c   |3 +-
>  drivers/mtd/nand/tegra_nand.c  | 1026
> 
>  drivers/mtd/nand/tegra_nand.h  |  257 +
>  include/configs/seaboard.h |9 +
>  include/configs/tegra20-common.h   |2 +
>  include/fdtdec.h   |1 +
>  include/linux/mtd/nand.h   |7 +-
>  lib/fdtdec.c   |1 +
>  15 files changed, 1384 insertions(+), 4 deletions(-)  create mode 100644
> doc/device-tree-bindings/nand/nvidia,tegra20-nand.txt
>  create mode 100644 drivers/mtd/nand/tegra_nand.c  create mode 100644
> drivers/mtd/nand/tegra_nand.h
> 
> --
> 1.7.7.3

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


Re: [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed

2012-07-30 Thread Tom Rini
On Mon, Jul 30, 2012 at 04:34:39PM +, Laurence Withers wrote:
> On Mon, Jul 30, 2012 at 04:30:15PM +, Laurence Withers wrote:
> > Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
> > definition. In addition, don't request this clock ID on DA830 hardware,
> > which does not have a DDR2/mDDR PHY (or associated PLL controller).
> > 
> > Signed-off-by: Laurence Withers 
> > Cc: Prabhakar Lad 
> > ---
> >  arch/arm/cpu/arm926ejs/davinci/cpu.c |3 ++-
> >  arch/arm/include/asm/arch-davinci/hardware.h |2 ++
> >  2 files changed, 4 insertions(+), 1 deletions(-)
> > 
> > diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c 
> > b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > index 4bdb08b..b31add8 100644
> > --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> > @@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
> >  {
> > gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 100;
> > /* DDR PHY uses an x2 input clock */
> > -   gd->bd->bi_ddr_freq = clk_get(0x10001) / 100;
> > +   gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
> > +   (clk_get(DAVINCI_DDR_CLKID) / 100);
> > gd->bd->bi_dsp_freq = 0;
> > return 0;
> >  }
> > diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
> > b/arch/arm/include/asm/arch-davinci/hardware.h
> > index 0fce940..7f3dcc2 100644
> > --- a/arch/arm/include/asm/arch-davinci/hardware.h
> > +++ b/arch/arm/include/asm/arch-davinci/hardware.h
> > @@ -459,10 +459,12 @@ enum davinci_clk_ids {
> > DAVINCI_PLL0_SYSCLK2= DAVINCI_PLLC0_FLAG | 2,
> > DAVINCI_PLL0_SYSCLK4= DAVINCI_PLLC0_FLAG | 4,
> > DAVINCI_PLL0_SYSCLK6= DAVINCI_PLLC0_FLAG | 6,
> > +   DAVINCI_PLL1_SYSCLK1= DAVINCI_PLLC1_FLAG | 1,
> > DAVINCI_PLL1_SYSCLK2= DAVINCI_PLLC1_FLAG | 2,
> >  
> > /* map peripherals to clock IDs */
> > DAVINCI_ARM_CLKID   = DAVINCI_PLL0_SYSCLK6,
> > +   DAVINCI_DDR_CLKID   = DAVINCI_PLL1_SYSCLK1,
> > DAVINCI_MDIO_CLKID  = DAVINCI_PLL0_SYSCLK4,
> > DAVINCI_MMC_CLKID   = DAVINCI_PLL0_SYSCLK2,
> > DAVINCI_SPI0_CLKID  = DAVINCI_PLL0_SYSCLK2,
> > -- 
> > 1.7.2.5
> > 
> 
> Hi,
> 
> This patch does depend on my earlier patch to tidy up the definition of
> set_cpu_clk_info() :
> 
>   http://lists.denx.de/pipermail/u-boot/2012-July/129205.html

Can you please post everything as a series of 4 patches so that we don't
add and then replace the magic value with the enum?  Other than that,
I'm happy with the series and will apply the updated series on Friday or
so, 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] Building u-boot for iMX28 and getting error in mkimage of missing command line parameter CONFIG_IMX_CONFIG

2012-07-30 Thread Fabio Estevam
On Mon, Jul 30, 2012 at 2:06 PM, Bill  wrote:
> Here is my log.  It stops at the "done, booting kernel."I tried setting
> the console to ttyAM0 and no change.  I don't think its booting as I don't
> see the LCD flash and no penguin.  The odd this is that I built the latest
> kernel for iMX and this uboot will boot it.   I also included my u-boot

Do you mean you are able to boot a mainline kernel, but not a 2.6.35 kernel?

> environment settings at the end.


> U-boot environment settings:
>
> U-Boot 2012.07-rc1-08235-g7c5f511 (Jul 26 2012 - 12:00:38)
>
>
> Freescale i.MX28 family at 454 MHz
> BOOT:  SSP SD/MMC #0, 3V3
> I2C:   ready
> DRAM:  128 MiB
> MMC:   MXS MMC: 0
> In:serial
> Out:   serial
> Err:   serial
> Net:   FEC0, FEC1
> Hit any key to stop autoboot:  0
> MX28EVK U-Boot > printenv
> baudrate=115200
> bootargs=console=ttyAMA0,115200n8 debug root=/dev/nfs ip=dhcp

Please change it to ttyAM0.

> nfsroot=192.168.0.204:/tools/rootfs,v3,tcp fec_mac=
> bootcmd=run bootcmd_net
> bootcmd_net=echo Booting from net ...; run netargs; dhcp ${uimage}; bootm
> bootdelay=3
> bootfile=uImage
> console=ttyAMA0

If you boot a 2.6.35 you need to use ttyAM0.

> console_fsl=console=ttyAM0console_mainline=console=ttyAMA0netargs=setenv

This line seems to be without any spaces. Are you sure this is correct?

Make sure your kernel command line passes ttyAM0 instead of ttyAMA0 if
you want to boot a 2.6.35 kernel.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 0/8] CPSW switch plus SPL net support

2012-07-30 Thread Tom Rini
On Wed, Jul 25, 2012 at 02:22:15AM +0400, Ilya Yanok wrote:
> 
> These patches add CPSW switch driver and enable support for it
> on TI AM335x based boards. This version is rebased on top of
> u-boot-ti/next. Also now CPSW driver uses internal controller
> memory for DMA descriptors so coherent allocator is no longer
> a requirement for this series.
> 
> The second part of the series provides support for networking in SPL.
> These patches try to use network infrasctructure as is, without
> trying to cut some minimal set of it, so the resulting SPL image
> is quite big and only useful for boards with plenty of SRAM/OCRAM
> (like TI AM335x based ones).

Parts 1 to 5 look good, barring comments from someone else, I'll pick those
up Friday or so and you can v4 just 6/7/8.

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


Re: [U-Boot] Building u-boot for iMX28 and getting error in mkimage of missing command line parameter CONFIG_IMX_CONFIG

2012-07-30 Thread Bill
Here is my log.  It stops at the "done, booting kernel."I tried 
setting the console to ttyAM0 and no change.  I don't think its booting 
as I don't see the LCD flash and no penguin.  The odd this is that I 
built the latest kernel for iMX and this uboot will boot it.   I also 
included my u-boot environment settings at the end.


Thanks,
Bills

U-Boot 2012.07-rc1-08235-g7c5f511 (Jul 26 2012 - 12:00:38)

Freescale i.MX28 family at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
I2C:   ready
DRAM:  128 MiB
MMC:   MXS MMC: 0
In:serial
Out:   serial
Err:   serial
Net:   FEC0, FEC1
Hit any key to stop autoboot:  0
Booting from net ...
BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 42
*** Unhandled DHCP Option in OFFER/ACK: 44
*** Unhandled DHCP Option in OFFER/ACK: 42
*** Unhandled DHCP Option in OFFER/ACK: 44
DHCP client bound to address 192.168.0.240
Using FEC0 device
TFTP from server 192.168.0.204; our IP address is 192.168.0.240
Filename 'uImage'.
Load address: 0x4200
Loading: #
 #
 #
 #
 #
 #
 #
 ##
done
Bytes transferred = 2562232 (2718b8 hex)
## Booting kernel from Legacy Image at 4200 ...
   Image Name:   Linux-2.6.35.3-571-gcca29a0
   Created:  2012-07-12  15:53:55 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:2562168 Bytes = 2.4 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.





U-boot environment settings:

U-Boot 2012.07-rc1-08235-g7c5f511 (Jul 26 2012 - 12:00:38)

Freescale i.MX28 family at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
I2C:   ready
DRAM:  128 MiB
MMC:   MXS MMC: 0
In:serial
Out:   serial
Err:   serial
Net:   FEC0, FEC1
Hit any key to stop autoboot:  0
MX28EVK U-Boot > printenv
baudrate=115200
bootargs=console=ttyAMA0,115200n8 debug root=/dev/nfs ip=dhcp 
nfsroot=192.168.0.204:/tools/rootfs,v3,tcp fec_mac=

bootcmd=run bootcmd_net
bootcmd_net=echo Booting from net ...; run netargs; dhcp ${uimage}; bootm
bootdelay=3
bootfile=uImage
console=ttyAMA0
console_fsl=console=ttyAM0console_mainline=console=ttyAMA0netargs=setenv 
bootargs console=${console_mainline}root=/dev/nfs ip=dhcp 
nfsroot=${serverip}:${nfsroot}

console_mainline=ttyAMA0
ethact=FEC0
ipaddr=192.168.0.19
loadaddr=0x4200
netargs=setenv bootargs console=ttyAMA0,115200
netmask=255.255.255.0
nfsroot=/tools/rootfs
serverip=192.168.0.204
stderr=serial
stdin=serial
stdout=serial
ver=U-Boot 2012.07-rc1-08235-g7c5f511 (Jul 26 2012 - 12:00:38)

Environment size: 770/16380 bytes
MX28EVK U-Boot >







On 7/28/2012 3:19 PM, Fabio Estevam wrote:

On Fri, Jul 27, 2012 at 3:15 PM, Fabio Estevam  wrote:

On Fri, Jul 27, 2012 at 12:35 PM, Bill  wrote:

Thanks.  I tried that and got the same results.  Are there any debug/logging
that I can use to see what's going on?

I just tried it here and 2012.07-rc3 does not boot for me too.

I was using the wrong LOADADDR for mx28, and that's the reason it did not boot.

What is the error you are seeing? Can you post your log?

Here is the log on 2012.07-rc3:
...

U-Boot 2012.07-rc3 (Jul 28 2012 - 17:08:24)

Freescale i.MX28 family at 454 MHz
BOOT:  SSP SD/MMC #0, 3V3
I2C:   ready
DRAM:  128 MiB
MMC:   MXS MMC: 0
In:serial
Out:   serial
Err:   serial
Net:   FEC0, FEC1
Hit any key to stop autoboot:  0
Using FEC0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.2
Filename 'uImage'.
Load address: 0x4200
Loading: #
  #
  #
  #
  #
  #
  #
  ##
done
Bytes transferred = 2358008 (23faf8 hex)
## Booting kernel from Legacy Image at 4200 ...
Image Name:   Linux-3.5.0-next-20120727-4-
Created:  2012-07-28  20:06:58 UTC
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:2357944 Bytes = 2.2 MiB
Load Address: 40008000
Entry Point:  40008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK

Starting kernel

Re: [U-Boot] [u-boot-arm/next RESEND PATCH 0/3] OMAP3: igep00x0: add nand flash and SPL support

2012-07-30 Thread Tom Rini
On Sat, Jul 28, 2012 at 01:19:31PM +0200, Javier Martinez Canillas wrote:

> IGEP-based boards can have two different flash memories, a OneNAND or a
> NAND device.
> 
> Since u-boot still lacks of a device model to be the able to look at
> run-time which memory type is available on a the board, a built time
> config option is needed to choose which memory to use.
> 
> This is a resend of a patch-set that adds both a config option for the
> nand memory type and SPL support to IGEP-based boards.
> 
> The patch-set is composed of the following patches:
> 
> [u-boot-arm/next RESEND PATCH 1/3] OMAP3: igep00x0: Add config
> [u-boot-arm/next RESEND PATCH 2/3] OMAP3: mem: Add Numonyx OneNAND
> [u-boot-arm/next RESEND PATCH 3/3] OMAP3: igep00x0: add SPL support

This all looks good, barring comments from someone else, I'll pick this
up Friday or so.

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


Re: [U-Boot] multichannel mmc strangeness on omap

2012-07-30 Thread Steve Sakoman
On Mon, Jul 30, 2012 at 7:27 AM, Tom Rini  wrote:

>> After adding a few printf's, it seems that the crash/hang is occurring
>> when calling env_relocate_spec in env_nand.c, which of course is
>> completely unrelated code!
>
> I've spent some time scratching my head against a hang in the same spot,
> on am335x.  I only have seen it when booting from NAND (same image from
> MMC or UART is fine).  Further, it only showed up when a change was made
> in another driver which isn't even entered before the hang.

In order to keep making progress on hardware bringup I swapped the
base register pointer setup for mmc2 and mmc3 since enabling mmc2 in
the board file didn't seem to cause the hang.

With this change the mmc3 port hardware worked as expected.

What a strange bug!  I have a feeling that this is going to be a real
bear to find root cause.

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


[U-Boot] [PATCH 17/17] am33xx: Do not touch 'ratio1' fields

2012-07-30 Thread Tom Rini
The various ratio1 fields are not documented in any of the documentation
I can find.  Removing these and testing has yielded success, so remove
the code that sets them and move their locations into the reserved
fields.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |   11 ---
 arch/arm/cpu/armv7/am33xx/emif4.c   |6 --
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   25 +++--
 3 files changed, 7 insertions(+), 35 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index 597d62f..59ca51f 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -101,22 +101,11 @@ void config_cmd_ctrl(const struct cmd_control *cmd)
 void config_ddr_data(int macrono, const struct ddr_data *data)
 {
writel(data->datardsratio0, &ddr_reg[macrono]->dt0rdsratio0);
-   writel(data->datardsratio1, &ddr_reg[macrono]->dt0rdsratio1);
-
writel(data->datawdsratio0, &ddr_reg[macrono]->dt0wdsratio0);
-   writel(data->datawdsratio1, &ddr_reg[macrono]->dt0wdsratio1);
-
writel(data->datawiratio0, &ddr_reg[macrono]->dt0wiratio0);
-   writel(data->datawiratio1, &ddr_reg[macrono]->dt0wiratio1);
writel(data->datagiratio0, &ddr_reg[macrono]->dt0giratio0);
-   writel(data->datagiratio1, &ddr_reg[macrono]->dt0giratio1);
-
writel(data->datafwsratio0, &ddr_reg[macrono]->dt0fwsratio0);
-   writel(data->datafwsratio1, &ddr_reg[macrono]->dt0fwsratio1);
-
writel(data->datawrsratio0, &ddr_reg[macrono]->dt0wrsratio0);
-   writel(data->datawrsratio1, &ddr_reg[macrono]->dt0wrsratio1);
-
writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0);
 }
 
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 3219045..ace3d26 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -51,22 +51,16 @@ void dram_init_banksize(void)
 static const struct ddr_data ddr2_data = {
.datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20)
|(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0)),
-   .datardsratio1 = DDR2_RD_DQS>>2,
.datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20)
|(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0)),
-   .datawdsratio1 = DDR2_WR_DQS>>2,
.datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20)
|(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0)),
-   .datawiratio1 = DDR2_PHY_WRLVL>>2,
.datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20)
|(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0)),
-   .datagiratio1 = DDR2_PHY_GATELVL>>2,
.datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20)
|(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0)),
-   .datafwsratio1 = DDR2_PHY_FIFO_WE>>2,
.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20)
|(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0)),
-   .datawrsratio1 = DDR2_PHY_WR_DATA>>2,
.datadldiff0 = PHY_DLL_LOCK_DIFF,
 };
 
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index ebd3077..b37b161 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -88,25 +88,20 @@ struct ddr_regs {
unsigned int cm2iclkout;/* offset 0x094 */
unsigned int resv3[12];
unsigned int dt0rdsratio0;  /* offset 0x0C8 */
-   unsigned int dt0rdsratio1;  /* offset 0x0CC */
-   unsigned int resv4[3];
+   unsigned int resv4[4];
unsigned int dt0wdsratio0;  /* offset 0x0DC */
-   unsigned int dt0wdsratio1;  /* offset 0x0E0 */
-   unsigned int resv5[3];
+   unsigned int resv5[4];
unsigned int dt0wiratio0;   /* offset 0x0F0 */
-   unsigned int dt0wiratio1;   /* offset 0x0F4 */
+   unsigned int resv6;
unsigned int dt0giratio0;   /* offset 0x0FC */
-   unsigned int dt0giratio1;   /* offset 0x100 */
-   unsigned int resv6[1];
+   unsigned int resv7[2];
unsigned int dt0fwsratio0;  /* offset 0x108 */
-   unsigned int dt0fwsratio1;  /* offset 0x10C */
-   unsigned int resv7[4];
+   unsigned int resv8[5];
unsigned int dt0wrsratio0;  /* offset 0x120 */
-   unsigned int dt0wrsratio1;  /* offset 0x124 */
-   unsigned int resv8[3];
+   unsigned int resv9[4];
unsigned int dt0rdelays0;   /* offset 0x134 */
unsigned int dt0dldiff0;/* offset 0x138 */
-   unsigned int resv9[39];
+   unsigned int resv10[39];
unsigned int dt1rdelays0;   /* offset 0x1D8 */
 };
 
@@ -136,17 +131,11 @@ struct cmd_control {
  */
 struct ddr_data {
unsigned long datardsratio0;
-   unsigned long datardsratio1;

[U-Boot] [PATCH 14/17] am33xx: Turn a number of 'int' functions to 'void'

2012-07-30 Thread Tom Rini
A number of memory initalization functions were int and always returned
0.  Further it's not feasible to be doing error checking here, so simply
turn them into void functions.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |   29 ++-
 arch/arm/cpu/armv7/am33xx/emif4.c   |   16 +++
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   12 +--
 3 files changed, 15 insertions(+), 42 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index b4b3c01..7ac144a 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -40,26 +40,19 @@ static struct ddr_cmdtctrl *ioctrl_reg = {
(struct ddr_cmdtctrl *)DDR_CONTROL_BASE_ADDR};
 
 /**
- * As a convention, all functions here return 0 on success
- * -1 on failure.
- */
-
-/**
  * Configure SDRAM
  */
-int config_sdram(struct sdram_config *cfg)
+void config_sdram(struct sdram_config *cfg)
 {
writel(cfg->refresh, &emif_reg->emif_sdram_ref_ctrl);
writel(cfg->refresh_sh, &emif_reg->emif_sdram_ref_ctrl_shdw);
writel(cfg->sdrcr, &emif_reg->emif_sdram_config);
-
-   return 0;
 }
 
 /**
  * Set SDRAM timings
  */
-int set_sdram_timings(struct sdram_timing *t)
+void set_sdram_timings(struct sdram_timing *t)
 {
writel(t->time1, &emif_reg->emif_sdram_tim_1);
writel(t->time1_sh, &emif_reg->emif_sdram_tim_1_shdw);
@@ -67,25 +60,21 @@ int set_sdram_timings(struct sdram_timing *t)
writel(t->time2_sh, &emif_reg->emif_sdram_tim_2_shdw);
writel(t->time3, &emif_reg->emif_sdram_tim_3);
writel(t->time3_sh, &emif_reg->emif_sdram_tim_3_shdw);
-
-   return 0;
 }
 
 /**
  * Configure DDR PHY
  */
-int config_ddr_phy(struct ddr_phy_control *p)
+void config_ddr_phy(struct ddr_phy_control *p)
 {
writel(p->reg, &emif_reg->emif_ddr_phy_ctrl_1);
writel(p->reg_sh, &emif_reg->emif_ddr_phy_ctrl_1_shdw);
-
-   return 0;
 }
 
 /**
  * Configure DDR CMD control registers
  */
-int config_cmd_ctrl(const struct cmd_control *cmd)
+void config_cmd_ctrl(const struct cmd_control *cmd)
 {
writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio);
writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce);
@@ -104,14 +93,12 @@ int config_cmd_ctrl(const struct cmd_control *cmd)
writel(cmd->cmd2csdelay, &ddr_reg[0]->cm2csdelay);
writel(cmd->cmd2dldiff, &ddr_reg[0]->cm2dldiff);
writel(cmd->cmd2iclkout, &ddr_reg[0]->cm2iclkout);
-
-   return 0;
 }
 
 /**
  * Configure DDR DATA registers
  */
-int config_ddr_data(int macrono, const struct ddr_data *data)
+void config_ddr_data(int macrono, const struct ddr_data *data)
 {
writel(data->datardsratio0, &ddr_reg[macrono]->dt0rdsratio0);
writel(data->datardsratio1, &ddr_reg[macrono]->dt0rdsratio1);
@@ -131,17 +118,13 @@ int config_ddr_data(int macrono, const struct ddr_data 
*data)
writel(data->datawrsratio1, &ddr_reg[macrono]->dt0wrsratio1);
 
writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0);
-
-   return 0;
 }
 
-int config_io_ctrl(struct ddr_ioctrl *ioctrl)
+void config_io_ctrl(struct ddr_ioctrl *ioctrl)
 {
writel(ioctrl->cmd1ctl, &ioctrl_reg->cm0ioctl);
writel(ioctrl->cmd2ctl, &ioctrl_reg->cm1ioctl);
writel(ioctrl->cmd3ctl, &ioctrl_reg->cm2ioctl);
writel(ioctrl->data1ctl, &ioctrl_reg->dt0ioctl);
writel(ioctrl->data2ctl, &ioctrl_reg->dt1ioctl);
-
-   return 0;
 }
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index e04e970..66ab892 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -107,7 +107,6 @@ static void config_vtp(void)
 
 static void config_emif_ddr2(void)
 {
-   int ret;
struct sdram_config cfg;
struct sdram_timing tmg;
struct ddr_phy_control phyc;
@@ -130,18 +129,9 @@ static void config_emif_ddr2(void)
cfg.refresh_sh = DDR2_EMIF_SDREF;
 
/* Program EMIF instance */
-   ret = config_ddr_phy(&phyc);
-   if (ret < 0)
-   printf("Couldn't configure phyc\n");
-
-
-   ret = set_sdram_timings(&tmg);
-   if (ret < 0)
-   printf("Couldn't configure timings\n");
-
-   ret = config_sdram(&cfg);
-   if (ret < 0)
-   printf("Couldn't configure SDRAM\n");
+   config_ddr_phy(&phyc);
+   set_sdram_timings(&tmg);
+   config_sdram(&cfg);
 }
 
 void config_ddr(short ddr_type)
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index f755736..997480b 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -82,17 +82,17 @@ struct sdram_config {
 /**
  * Configure SDRAM
  */
-int config_sdram(struct sdram_config *cfg);
+void config_sdram(struct sdram_config *cfg);
 
 /**
  * Set SDRAM timings
  */
-int set_sdram_timings(struct

[U-Boot] [PATCH 15/17] am33xx: Use emif_regs struct for storing initialization values

2012-07-30 Thread Tom Rini
Rather than defining our own structs to note what to use when
programming the EMIF and related re-use the emif_regs struct.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |   28 -
 arch/arm/cpu/armv7/am33xx/emif4.c   |   43 ---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   38 +++
 3 files changed, 31 insertions(+), 78 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index 7ac144a..993f3da 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -42,33 +42,33 @@ static struct ddr_cmdtctrl *ioctrl_reg = {
 /**
  * Configure SDRAM
  */
-void config_sdram(struct sdram_config *cfg)
+void config_sdram(const struct emif_regs *regs)
 {
-   writel(cfg->refresh, &emif_reg->emif_sdram_ref_ctrl);
-   writel(cfg->refresh_sh, &emif_reg->emif_sdram_ref_ctrl_shdw);
-   writel(cfg->sdrcr, &emif_reg->emif_sdram_config);
+   writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl);
+   writel(regs->ref_ctrl, &emif_reg->emif_sdram_ref_ctrl_shdw);
+   writel(regs->sdram_config, &emif_reg->emif_sdram_config);
 }
 
 /**
  * Set SDRAM timings
  */
-void set_sdram_timings(struct sdram_timing *t)
+void set_sdram_timings(const struct emif_regs *regs)
 {
-   writel(t->time1, &emif_reg->emif_sdram_tim_1);
-   writel(t->time1_sh, &emif_reg->emif_sdram_tim_1_shdw);
-   writel(t->time2, &emif_reg->emif_sdram_tim_2);
-   writel(t->time2_sh, &emif_reg->emif_sdram_tim_2_shdw);
-   writel(t->time3, &emif_reg->emif_sdram_tim_3);
-   writel(t->time3_sh, &emif_reg->emif_sdram_tim_3_shdw);
+   writel(regs->sdram_tim1, &emif_reg->emif_sdram_tim_1);
+   writel(regs->sdram_tim1, &emif_reg->emif_sdram_tim_1_shdw);
+   writel(regs->sdram_tim2, &emif_reg->emif_sdram_tim_2);
+   writel(regs->sdram_tim2, &emif_reg->emif_sdram_tim_2_shdw);
+   writel(regs->sdram_tim3, &emif_reg->emif_sdram_tim_3);
+   writel(regs->sdram_tim3, &emif_reg->emif_sdram_tim_3_shdw);
 }
 
 /**
  * Configure DDR PHY
  */
-void config_ddr_phy(struct ddr_phy_control *p)
+void config_ddr_phy(const struct emif_regs *regs)
 {
-   writel(p->reg, &emif_reg->emif_ddr_phy_ctrl_1);
-   writel(p->reg_sh, &emif_reg->emif_ddr_phy_ctrl_1_shdw);
+   writel(regs->emif_ddr_phy_ctlr_1, &emif_reg->emif_ddr_phy_ctrl_1);
+   writel(regs->emif_ddr_phy_ctlr_1, &emif_reg->emif_ddr_phy_ctrl_1_shdw);
 }
 
 /**
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 66ab892..0190ec6 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -90,6 +90,15 @@ static const struct cmd_control ddr2_cmd_ctrl_data = {
.cmd2iclkout = DDR2_INVERT_CLKOUT,
 };
 
+static const struct emif_regs ddr2_emif_reg_data = {
+   .sdram_config = DDR2_EMIF_SDCFG,
+   .ref_ctrl = DDR2_EMIF_SDREF,
+   .sdram_tim1 = DDR2_EMIF_TIM1,
+   .sdram_tim2 = DDR2_EMIF_TIM2,
+   .sdram_tim3 = DDR2_EMIF_TIM3,
+   .emif_ddr_phy_ctlr_1 = DDR2_EMIF_READ_LATENCY,
+};
+
 static void config_vtp(void)
 {
writel(readl(&vtpreg->vtp0ctrlreg) | VTP_CTRL_ENABLE,
@@ -105,35 +114,6 @@ static void config_vtp(void)
;
 }
 
-static void config_emif_ddr2(void)
-{
-   struct sdram_config cfg;
-   struct sdram_timing tmg;
-   struct ddr_phy_control phyc;
-
-   /* Program EMIF0 CFG Registers */
-   phyc.reg = DDR2_EMIF_READ_LATENCY;
-   phyc.reg_sh = DDR2_EMIF_READ_LATENCY;
-   phyc.reg2 = DDR2_EMIF_READ_LATENCY;
-
-   tmg.time1 = DDR2_EMIF_TIM1;
-   tmg.time1_sh = DDR2_EMIF_TIM1;
-   tmg.time2 = DDR2_EMIF_TIM2;
-   tmg.time2_sh = DDR2_EMIF_TIM2;
-   tmg.time3 = DDR2_EMIF_TIM3;
-   tmg.time3_sh = DDR2_EMIF_TIM3;
-
-   cfg.sdrcr = DDR2_EMIF_SDCFG;
-   cfg.sdrcr2 = DDR2_EMIF_SDCFG;
-   cfg.refresh = DDR2_EMIF_SDREF;
-   cfg.refresh_sh = DDR2_EMIF_SDREF;
-
-   /* Program EMIF instance */
-   config_ddr_phy(&phyc);
-   set_sdram_timings(&tmg);
-   config_sdram(&cfg);
-}
-
 void config_ddr(short ddr_type)
 {
struct ddr_ioctrl ioctrl;
@@ -163,7 +143,10 @@ void config_ddr(short ddr_type)
/* Set CKE to be controlled by EMIF/DDR PHY */
writel(DDR_CKE_CTRL_NORMAL, &ddrctrl->ddrckectrl);
 
-   config_emif_ddr2();
+   /* Program EMIF instance */
+   config_ddr_phy(&ddr2_emif_reg_data);
+   set_sdram_timings(&ddr2_emif_reg_data);
+   config_sdram(&ddr2_emif_reg_data);
}
 }
 #endif
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 997480b..7806e1b 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -20,6 +20,7 @@
 #define _DDR_DEFS_H
 
 #include 
+#include 
 
 /* AM335X EMIF Register values */
 #define

[U-Boot] [PATCH 13/17] am33xx: Document what we're doing with ddrctrl->ddrckectrl

2012-07-30 Thread Tom Rini
- Remove the call to set ddrctrl->ddrioctrl as it's all zeros.
- Comment what we're really setting in ddrctrl->ddrckectrl which is that
  we're operating in the normal mode where EMIF/PHY clock is controlled
  by the PHY.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/emif4.c   |6 ++
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |1 +
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 684b123..e04e970 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -170,10 +170,8 @@ void config_ddr(short ddr_type)
 
config_io_ctrl(&ioctrl);
 
-   writel(readl(&ddrctrl->ddrioctrl) & 0xefff,
-   &ddrctrl->ddrioctrl);
-   writel(readl(&ddrctrl->ddrckectrl) | 0x0001,
-   &ddrctrl->ddrckectrl);
+   /* Set CKE to be controlled by EMIF/DDR PHY */
+   writel(DDR_CKE_CTRL_NORMAL, &ddrctrl->ddrckectrl);
 
config_emif_ddr2();
}
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 879c5fb..f755736 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -28,6 +28,7 @@
 #define CMD_FORCE  0x00
 #define CMD_DELAY  0x00
 #define PHY_DLL_LOCK_DIFF  0x0
+#define DDR_CKE_CTRL_NORMAL0x1
 
 #define DDR2_EMIF_READ_LATENCY 0x15/* Enable Dynamic Power Down */
 #define DDR2_EMIF_TIM1 0x0666B3C9
-- 
1.7.9.5

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


[U-Boot] [PATCH 16/17] am33xx: Rework config_io_ctrl slightly

2012-07-30 Thread Tom Rini
This function sets a number of related registers to the same value (the
registers in question all have the same field descriptions and are
related in operation).  Rather than defining a struct and setting the
value repeatedly, just pass in the value.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |   12 ++--
 arch/arm/cpu/armv7/am33xx/emif4.c   |   10 +-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   13 +
 3 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index 993f3da..597d62f 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -120,11 +120,11 @@ void config_ddr_data(int macrono, const struct ddr_data 
*data)
writel(data->datadldiff0, &ddr_reg[macrono]->dt0dldiff0);
 }
 
-void config_io_ctrl(struct ddr_ioctrl *ioctrl)
+void config_io_ctrl(unsigned long val)
 {
-   writel(ioctrl->cmd1ctl, &ioctrl_reg->cm0ioctl);
-   writel(ioctrl->cmd2ctl, &ioctrl_reg->cm1ioctl);
-   writel(ioctrl->cmd3ctl, &ioctrl_reg->cm2ioctl);
-   writel(ioctrl->data1ctl, &ioctrl_reg->dt0ioctl);
-   writel(ioctrl->data2ctl, &ioctrl_reg->dt1ioctl);
+   writel(val, &ioctrl_reg->cm0ioctl);
+   writel(val, &ioctrl_reg->cm1ioctl);
+   writel(val, &ioctrl_reg->cm2ioctl);
+   writel(val, &ioctrl_reg->dt0ioctl);
+   writel(val, &ioctrl_reg->dt1ioctl);
 }
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 0190ec6..3219045 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -116,8 +116,6 @@ static void config_vtp(void)
 
 void config_ddr(short ddr_type)
 {
-   struct ddr_ioctrl ioctrl;
-
enable_emif_clocks();
 
if (ddr_type == EMIF_REG_SDRAM_TYPE_DDR2) {
@@ -132,13 +130,7 @@ void config_ddr(short ddr_type)
writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
 
-   ioctrl.cmd1ctl = DDR2_IOCTRL_VALUE;
-   ioctrl.cmd2ctl = DDR2_IOCTRL_VALUE;
-   ioctrl.cmd3ctl = DDR2_IOCTRL_VALUE;
-   ioctrl.data1ctl = DDR2_IOCTRL_VALUE;
-   ioctrl.data2ctl = DDR2_IOCTRL_VALUE;
-
-   config_io_ctrl(&ioctrl);
+   config_io_ctrl(DDR2_IOCTRL_VALUE);
 
/* Set CKE to be controlled by EMIF/DDR PHY */
writel(DDR_CKE_CTRL_NORMAL, &ddrctrl->ddrckectrl);
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 7806e1b..ebd3077 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -174,20 +174,9 @@ struct ddr_cmdtctrl {
 };
 
 /**
- * Encapsulates DDR CMD & DATA io control registers.
- */
-struct ddr_ioctrl {
-   unsigned long cmd1ctl;
-   unsigned long cmd2ctl;
-   unsigned long cmd3ctl;
-   unsigned long data1ctl;
-   unsigned long data2ctl;
-};
-
-/**
  * Configure DDR io control registers
  */
-void config_io_ctrl(struct ddr_ioctrl *ioctrl);
+void config_io_ctrl(unsigned long val);
 
 struct ddr_ctrl {
unsigned int ddrioctrl;
-- 
1.7.9.5

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


[U-Boot] [PATCH 12/17] am335x: ddr_defs: Update EMIF parameters

2012-07-30 Thread Tom Rini
From: Vaibhav Bedia 

EMIF parameters are calculated based on the AC timing
parameters from the SDRAM datasheet and the DDR frequency.

Current values for these paramters in AM335x U-Boot code,
though reliable, are not fully optimal. The most optimal
settings can be derived based on the guidelines published
at [1]. A pre-computed set of values with the most optimum
settings for AM335x EVM and BeagleBone can be found at [2].

[1] http://processors.wiki.ti.com/index.php/AM335x_EMIF_Configuration_tips
[2] http://processors.wiki.ti.com/index.php/OMAP_and_Sitara_CCS_support#AM335x

Signed-off-by: Vaibhav Bedia 
Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index b4735ba..879c5fb 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -29,11 +29,11 @@
 #define CMD_DELAY  0x00
 #define PHY_DLL_LOCK_DIFF  0x0
 
-#define DDR2_EMIF_READ_LATENCY 0x05
-#define DDR2_EMIF_TIM1 0x0666B3D6
-#define DDR2_EMIF_TIM2 0x143731DA
-#define DDR2_EMIF_TIM3 0x0347
-#define DDR2_EMIF_SDCFG0x43805332
+#define DDR2_EMIF_READ_LATENCY 0x15/* Enable Dynamic Power Down */
+#define DDR2_EMIF_TIM1 0x0666B3C9
+#define DDR2_EMIF_TIM2 0x243631CA
+#define DDR2_EMIF_TIM3 0x033F
+#define DDR2_EMIF_SDCFG0x41805332
 #define DDR2_EMIF_SDREF0x081a
 #define DDR2_DLL_LOCK_DIFF 0x0
 #define DDR2_RATIO 0x80
-- 
1.7.9.5

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


[U-Boot] [PATCH 11/17] am33xx: Clean up unused DDR defines, prefix more with 'DDR2'

2012-07-30 Thread Tom Rini
- Remove a handful of unused defines.
- Prefix more values with 'DDR2' as DDR3 will require different values.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/emif4.c   |   46 +--
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   32 +++
 2 files changed, 35 insertions(+), 43 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 12f270a..684b123 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -112,22 +112,22 @@ static void config_emif_ddr2(void)
struct sdram_timing tmg;
struct ddr_phy_control phyc;
 
-   /*Program EMIF0 CFG Registers*/
-   phyc.reg = EMIF_READ_LATENCY;
-   phyc.reg_sh = EMIF_READ_LATENCY;
-   phyc.reg2 = EMIF_READ_LATENCY;
-
-   tmg.time1 = EMIF_TIM1;
-   tmg.time1_sh = EMIF_TIM1;
-   tmg.time2 = EMIF_TIM2;
-   tmg.time2_sh = EMIF_TIM2;
-   tmg.time3 = EMIF_TIM3;
-   tmg.time3_sh = EMIF_TIM3;
-
-   cfg.sdrcr = EMIF_SDCFG;
-   cfg.sdrcr2 = EMIF_SDCFG;
-   cfg.refresh = EMIF_SDREF;
-   cfg.refresh_sh = EMIF_SDREF;
+   /* Program EMIF0 CFG Registers */
+   phyc.reg = DDR2_EMIF_READ_LATENCY;
+   phyc.reg_sh = DDR2_EMIF_READ_LATENCY;
+   phyc.reg2 = DDR2_EMIF_READ_LATENCY;
+
+   tmg.time1 = DDR2_EMIF_TIM1;
+   tmg.time1_sh = DDR2_EMIF_TIM1;
+   tmg.time2 = DDR2_EMIF_TIM2;
+   tmg.time2_sh = DDR2_EMIF_TIM2;
+   tmg.time3 = DDR2_EMIF_TIM3;
+   tmg.time3_sh = DDR2_EMIF_TIM3;
+
+   cfg.sdrcr = DDR2_EMIF_SDCFG;
+   cfg.sdrcr2 = DDR2_EMIF_SDCFG;
+   cfg.refresh = DDR2_EMIF_SDREF;
+   cfg.refresh_sh = DDR2_EMIF_SDREF;
 
/* Program EMIF instance */
ret = config_ddr_phy(&phyc);
@@ -159,14 +159,14 @@ void config_ddr(short ddr_type)
config_ddr_data(0, &ddr2_data);
config_ddr_data(1, &ddr2_data);
 
-   writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
-   writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
+   writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
+   writel(DDR2_PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
 
-   ioctrl.cmd1ctl = DDR_IOCTRL_VALUE;
-   ioctrl.cmd2ctl = DDR_IOCTRL_VALUE;
-   ioctrl.cmd3ctl = DDR_IOCTRL_VALUE;
-   ioctrl.data1ctl = DDR_IOCTRL_VALUE;
-   ioctrl.data2ctl = DDR_IOCTRL_VALUE;
+   ioctrl.cmd1ctl = DDR2_IOCTRL_VALUE;
+   ioctrl.cmd2ctl = DDR2_IOCTRL_VALUE;
+   ioctrl.cmd3ctl = DDR2_IOCTRL_VALUE;
+   ioctrl.data1ctl = DDR2_IOCTRL_VALUE;
+   ioctrl.data2ctl = DDR2_IOCTRL_VALUE;
 
config_io_ctrl(&ioctrl);
 
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 842e45f..b4735ba 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -22,38 +22,30 @@
 #include 
 
 /* AM335X EMIF Register values */
-#define EMIF_SDMGT 0x8000
-#define EMIF_SDRAM 0x4650
-#define EMIF_PHYCFG0x2
-#define DDR_PHY_RESET  (0x1 << 10)
-#define DDR_FUNCTIONAL_MODE_EN 0x1
-#define DDR_PHY_READY  (0x1 << 2)
 #define VTP_CTRL_READY (0x1 << 5)
 #define VTP_CTRL_ENABLE(0x1 << 6)
-#define VTP_CTRL_LOCK_EN   (0x1 << 4)
 #define VTP_CTRL_START_EN  (0x1)
-#define DDR2_RATIO 0x80
 #define CMD_FORCE  0x00
 #define CMD_DELAY  0x00
+#define PHY_DLL_LOCK_DIFF  0x0
 
-#define EMIF_READ_LATENCY  0x05
-#define EMIF_TIM1  0x0666B3D6
-#define EMIF_TIM2  0x143731DA
-#define EMIF_TIM3  0x0347
-#define EMIF_SDCFG 0x43805332
-#define EMIF_SDREF 0x081a
+#define DDR2_EMIF_READ_LATENCY 0x05
+#define DDR2_EMIF_TIM1 0x0666B3D6
+#define DDR2_EMIF_TIM2 0x143731DA
+#define DDR2_EMIF_TIM3 0x0347
+#define DDR2_EMIF_SDCFG0x43805332
+#define DDR2_EMIF_SDREF0x081a
 #define DDR2_DLL_LOCK_DIFF 0x0
-#define DDR2_RD_DQS0x12
-#define DDR2_PHY_FIFO_WE   0x80
-
+#define DDR2_RATIO 0x80
 #define DDR2_INVERT_CLKOUT 0x00
+#define DDR2_RD_DQS0x12
 #define DDR2_WR_DQS0x00
 #define DDR2_PHY_WRLVL 0x00
 #define DDR2_PHY_GATELVL   0x00
 #define DDR2_PHY_WR_DATA   0x40
-#define PHY_RANK0_DELAY0x01
-#define PHY_DLL_LOCK_DIFF  0x0
-#define DDR_IOCTRL_VALUE   0x18B
+#define DDR2_PHY_FIFO_WE   0x80
+#define DDR2_PHY_RANK0_DELAY   0x1
+#define DDR2_IOCTRL_VALUE  0x18B
 
 /**
  * Encapsulates DDR PHY control and corresponding shadow registers.
-- 
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/17] am33xx: Move the call to ddr_pll_config, make it take the frequency

2012-07-30 Thread Tom Rini
Depending on if we have DDR2 or DDR3 on the board we will need to call
ddr_pll_config with a different value.  This call can be delayed
slightly to the point where we know which type of memory we have.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/clock.c|5 ++---
 arch/arm/cpu/armv7/am33xx/emif4.c|2 ++
 arch/arm/include/asm/arch-am33xx/sys_proto.h |1 +
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/clock.c 
b/arch/arm/cpu/armv7/am33xx/clock.c
index d05780c..82bbba2 100644
--- a/arch/arm/cpu/armv7/am33xx/clock.c
+++ b/arch/arm/cpu/armv7/am33xx/clock.c
@@ -216,7 +216,7 @@ static void per_pll_config(void)
;
 }
 
-static void ddr_pll_config(void)
+void ddr_pll_config(unsigned int ddrpll_m)
 {
u32 clkmode, clksel, div_m2;
 
@@ -234,7 +234,7 @@ static void ddr_pll_config(void)
;
 
clksel = clksel & (~CLK_SEL_MASK);
-   clksel = clksel | ((DDRPLL_M << CLK_SEL_SHIFT) | DDRPLL_N);
+   clksel = clksel | ((ddrpll_m << CLK_SEL_SHIFT) | DDRPLL_N);
writel(clksel, &cmwkup->clkseldpllddr);
 
div_m2 = div_m2 & CLK_DIV_SEL;
@@ -268,7 +268,6 @@ void pll_init()
mpu_pll_config();
core_pll_config();
per_pll_config();
-   ddr_pll_config();
 
/* Enable the required interconnect clocks */
enable_interface_clocks();
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 9b1a80c..12f270a 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -150,6 +151,7 @@ void config_ddr(short ddr_type)
enable_emif_clocks();
 
if (ddr_type == EMIF_REG_SDRAM_TYPE_DDR2) {
+   ddr_pll_config(266);
config_vtp();
 
config_cmd_ctrl(&ddr2_cmd_ctrl_data);
diff --git a/arch/arm/include/asm/arch-am33xx/sys_proto.h 
b/arch/arm/include/asm/arch-am33xx/sys_proto.h
index 6c58f1b..eef5573 100644
--- a/arch/arm/include/asm/arch-am33xx/sys_proto.h
+++ b/arch/arm/include/asm/arch-am33xx/sys_proto.h
@@ -30,4 +30,5 @@ int print_cpuinfo(void);
 
 u32 get_device_type(void);
 void setup_clocks_for_console(void);
+void ddr_pll_config(unsigned int ddrpll_M);
 #endif
-- 
1.7.9.5

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


[U-Boot] [PATCH 09/17] am33xx: Pass to config_ddr the type of memory that is connected

2012-07-30 Thread Tom Rini
We need to pass in the type of memory that is connected to the board.
The only reliable way to do this is to know what type of board we are
running on (which later will be knowable in s_init()).  For now, pass in
the value of DDR2.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/board.c   |3 ++-
 arch/arm/cpu/armv7/am33xx/emif4.c   |   38 +++
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |2 +-
 arch/arm/include/asm/emif.h |8 +-
 4 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/board.c 
b/arch/arm/cpu/armv7/am33xx/board.c
index 71309a7..fd2d82b 100644
--- a/arch/arm/cpu/armv7/am33xx/board.c
+++ b/arch/arm/cpu/armv7/am33xx/board.c
@@ -26,6 +26,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -97,7 +98,7 @@ void s_init(void)
 
preloader_console_init();
 
-   config_ddr();
+   config_ddr(EMIF_REG_SDRAM_TYPE_DDR2);
 #endif
 
/* Enable MMC0 */
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 26c6a66..9b1a80c 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -29,7 +30,6 @@ struct ddr_regs *ddrregs = (struct ddr_regs 
*)DDR_PHY_BASE_ADDR;
 struct vtp_reg *vtpreg = (struct vtp_reg *)VTP0_CTRL_ADDR;
 struct ddr_ctrl *ddrctrl = (struct ddr_ctrl *)DDR_CTRL_ADDR;
 
-
 int dram_init(void)
 {
/* dram_init must store complete ramsize in gd->ram_size */
@@ -143,33 +143,37 @@ static void config_emif_ddr2(void)
printf("Couldn't configure SDRAM\n");
 }
 
-void config_ddr(void)
+void config_ddr(short ddr_type)
 {
struct ddr_ioctrl ioctrl;
 
enable_emif_clocks();
 
-   config_vtp();
+   if (ddr_type == EMIF_REG_SDRAM_TYPE_DDR2) {
+   config_vtp();
 
-   config_cmd_ctrl(&ddr2_cmd_ctrl_data);
+   config_cmd_ctrl(&ddr2_cmd_ctrl_data);
 
-   config_ddr_data(0, &ddr2_data);
-   config_ddr_data(1, &ddr2_data);
+   config_ddr_data(0, &ddr2_data);
+   config_ddr_data(1, &ddr2_data);
 
-   writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
-   writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
+   writel(PHY_RANK0_DELAY, &ddrregs->dt0rdelays0);
+   writel(PHY_RANK0_DELAY, &ddrregs->dt1rdelays0);
 
-   ioctrl.cmd1ctl = DDR_IOCTRL_VALUE;
-   ioctrl.cmd2ctl = DDR_IOCTRL_VALUE;
-   ioctrl.cmd3ctl = DDR_IOCTRL_VALUE;
-   ioctrl.data1ctl = DDR_IOCTRL_VALUE;
-   ioctrl.data2ctl = DDR_IOCTRL_VALUE;
+   ioctrl.cmd1ctl = DDR_IOCTRL_VALUE;
+   ioctrl.cmd2ctl = DDR_IOCTRL_VALUE;
+   ioctrl.cmd3ctl = DDR_IOCTRL_VALUE;
+   ioctrl.data1ctl = DDR_IOCTRL_VALUE;
+   ioctrl.data2ctl = DDR_IOCTRL_VALUE;
 
-   config_io_ctrl(&ioctrl);
+   config_io_ctrl(&ioctrl);
 
-   writel(readl(&ddrctrl->ddrioctrl) & 0xefff, &ddrctrl->ddrioctrl);
-   writel(readl(&ddrctrl->ddrckectrl) | 0x0001, &ddrctrl->ddrckectrl);
+   writel(readl(&ddrctrl->ddrioctrl) & 0xefff,
+   &ddrctrl->ddrioctrl);
+   writel(readl(&ddrctrl->ddrckectrl) | 0x0001,
+   &ddrctrl->ddrckectrl);
 
-   config_emif_ddr2();
+   config_emif_ddr2();
+   }
 }
 #endif
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 087082f..842e45f 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -232,6 +232,6 @@ struct ddr_ctrl {
unsigned int ddrckectrl;
 };
 
-void config_ddr(void);
+void config_ddr(short ddr_type);
 
 #endif  /* _DDR_DEFS_H */
diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h
index 674c3de..ed251ec 100644
--- a/arch/arm/include/asm/emif.h
+++ b/arch/arm/include/asm/emif.h
@@ -19,7 +19,7 @@
 #define EMIF1_BASE 0x4c00
 #define EMIF2_BASE 0x4d00
 
-/* Registers shifts and masks */
+/* Registers shifts, masks and values */
 
 /* EMIF_MOD_ID_REV */
 #define EMIF_REG_SCHEME_SHIFT  30
@@ -46,6 +46,12 @@
 /* SDRAM_CONFIG */
 #define EMIF_REG_SDRAM_TYPE_SHIFT  29
 #define EMIF_REG_SDRAM_TYPE_MASK   (0x7 << 29)
+#define EMIF_REG_SDRAM_TYPE_DDR1   0
+#define EMIF_REG_SDRAM_TYPE_LPDDR1 1
+#define EMIF_REG_SDRAM_TYPE_DDR2   2
+#define EMIF_REG_SDRAM_TYPE_DDR3   3
+#define EMIF_REG_SDRAM_TYPE_LPDDR2_S4  4
+#define EMIF_REG_SDRAM_TYPE_LPDDR2_S2  5
 #define EMIF_REG_IBANK_POS_SHIFT   27
 #define EMIF_REG_IBANK_POS_MASK  

[U-Boot] [PATCH 08/17] am33xx: Make config_cmd_ctrl / config_ddr_data take const structs

2012-07-30 Thread Tom Rini
Rework the EMIF4/DDR code slightly to setup the structs that
config_cmd_ctrl and config_ddr_data take to be setup at compile time and
mark them as const.  This lets us simplify the calling path slightly as
well as making it easier to deal with DDR3.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |4 +-
 arch/arm/cpu/armv7/am33xx/emif4.c   |  101 ---
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |4 +-
 3 files changed, 48 insertions(+), 61 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index c37f91b..b4b3c01 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -85,7 +85,7 @@ int config_ddr_phy(struct ddr_phy_control *p)
 /**
  * Configure DDR CMD control registers
  */
-int config_cmd_ctrl(struct cmd_control *cmd)
+int config_cmd_ctrl(const struct cmd_control *cmd)
 {
writel(cmd->cmd0csratio, &ddr_reg[0]->cm0csratio);
writel(cmd->cmd0csforce, &ddr_reg[0]->cm0csforce);
@@ -111,7 +111,7 @@ int config_cmd_ctrl(struct cmd_control *cmd)
 /**
  * Configure DDR DATA registers
  */
-int config_ddr_data(int macrono, struct ddr_data *data)
+int config_ddr_data(int macrono, const struct ddr_data *data)
 {
writel(data->datardsratio0, &ddr_reg[macrono]->dt0rdsratio0);
writel(data->datardsratio1, &ddr_reg[macrono]->dt0rdsratio1);
diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 8f7aadc..26c6a66 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -47,58 +47,47 @@ void dram_init_banksize(void)
 
 
 #ifdef CONFIG_SPL_BUILD
-static void data_macro_config(int dataMacroNum)
-{
-   struct ddr_data data;
-
-   data.datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20)
-   |(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0));
-   data.datardsratio1 = DDR2_RD_DQS>>2;
-   data.datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20)
-   |(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0));
-   data.datawdsratio1 = DDR2_WR_DQS>>2;
-   data.datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20)
-   |(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0));
-   data.datawiratio1 = DDR2_PHY_WRLVL>>2;
-   data.datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20)
-   |(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0));
-   data.datagiratio1 = DDR2_PHY_GATELVL>>2;
-   data.datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20)
-   |(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0));
-   data.datafwsratio1 = DDR2_PHY_FIFO_WE>>2;
-   data.datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20)
-   |(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0));
-   data.datawrsratio1 = DDR2_PHY_WR_DATA>>2;
-   data.datadldiff0 = PHY_DLL_LOCK_DIFF;
-
-   config_ddr_data(dataMacroNum, &data);
-}
-
-static void cmd_macro_config(void)
-{
-   struct cmd_control cmd;
-
-   cmd.cmd0csratio = DDR2_RATIO;
-   cmd.cmd0csforce = CMD_FORCE;
-   cmd.cmd0csdelay = CMD_DELAY;
-   cmd.cmd0dldiff = DDR2_DLL_LOCK_DIFF;
-   cmd.cmd0iclkout = DDR2_INVERT_CLKOUT;
-
-   cmd.cmd1csratio = DDR2_RATIO;
-   cmd.cmd1csforce = CMD_FORCE;
-   cmd.cmd1csdelay = CMD_DELAY;
-   cmd.cmd1dldiff = DDR2_DLL_LOCK_DIFF;
-   cmd.cmd1iclkout = DDR2_INVERT_CLKOUT;
-
-   cmd.cmd2csratio = DDR2_RATIO;
-   cmd.cmd2csforce = CMD_FORCE;
-   cmd.cmd2csdelay = CMD_DELAY;
-   cmd.cmd2dldiff = DDR2_DLL_LOCK_DIFF;
-   cmd.cmd2iclkout = DDR2_INVERT_CLKOUT;
-
-   config_cmd_ctrl(&cmd);
-
-}
+static const struct ddr_data ddr2_data = {
+   .datardsratio0 = ((DDR2_RD_DQS<<30)|(DDR2_RD_DQS<<20)
+   |(DDR2_RD_DQS<<10)|(DDR2_RD_DQS<<0)),
+   .datardsratio1 = DDR2_RD_DQS>>2,
+   .datawdsratio0 = ((DDR2_WR_DQS<<30)|(DDR2_WR_DQS<<20)
+   |(DDR2_WR_DQS<<10)|(DDR2_WR_DQS<<0)),
+   .datawdsratio1 = DDR2_WR_DQS>>2,
+   .datawiratio0 = ((DDR2_PHY_WRLVL<<30)|(DDR2_PHY_WRLVL<<20)
+   |(DDR2_PHY_WRLVL<<10)|(DDR2_PHY_WRLVL<<0)),
+   .datawiratio1 = DDR2_PHY_WRLVL>>2,
+   .datagiratio0 = ((DDR2_PHY_GATELVL<<30)|(DDR2_PHY_GATELVL<<20)
+   |(DDR2_PHY_GATELVL<<10)|(DDR2_PHY_GATELVL<<0)),
+   .datagiratio1 = DDR2_PHY_GATELVL>>2,
+   .datafwsratio0 = ((DDR2_PHY_FIFO_WE<<30)|(DDR2_PHY_FIFO_WE<<20)
+   |(DDR2_PHY_FIFO_WE<<10)|(DDR2_PHY_FIFO_WE<<0)),
+   .datafwsratio1 = DDR2_PHY_FIFO_WE>>2,
+   .datawrsratio0 = ((DDR2_PHY_WR_DATA<<30)|(DDR2_PHY_WR_DATA<<20)
+   |(DDR2_PHY_WR_DATA<<10)|(DDR2_PHY_WR_DATA<<0)),
+   .datawrsratio1 = DDR2_PHY_WR_DATA>>2,
+   .datadldiff0 = PHY_DLL_LOCK_DIFF,
+};
+
+static const struc

[U-Boot] [PATCH 07/17] am33xx: Rework DDR2 EMIF initalization slightly

2012-07-30 Thread Tom Rini
With the previous bugfix we now don't need to set two different REF_CTRL
values and instead set the final value.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/emif4.c |   17 ++---
 1 file changed, 2 insertions(+), 15 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/emif4.c 
b/arch/arm/cpu/armv7/am33xx/emif4.c
index 2f4164d..8f7aadc 100644
--- a/arch/arm/cpu/armv7/am33xx/emif4.c
+++ b/arch/arm/cpu/armv7/am33xx/emif4.c
@@ -117,7 +117,6 @@ static void config_vtp(void)
 
 static void config_emif_ddr2(void)
 {
-   int i;
int ret;
struct sdram_config cfg;
struct sdram_timing tmg;
@@ -137,31 +136,19 @@ static void config_emif_ddr2(void)
 
cfg.sdrcr = EMIF_SDCFG;
cfg.sdrcr2 = EMIF_SDCFG;
-   cfg.refresh = 0x4650;
-   cfg.refresh_sh = 0x4650;
+   cfg.refresh = EMIF_SDREF;
+   cfg.refresh_sh = EMIF_SDREF;
 
/* Program EMIF instance */
ret = config_ddr_phy(&phyc);
if (ret < 0)
printf("Couldn't configure phyc\n");
 
-   ret = config_sdram(&cfg);
-   if (ret < 0)
-   printf("Couldn't configure SDRAM\n");
 
ret = set_sdram_timings(&tmg);
if (ret < 0)
printf("Couldn't configure timings\n");
 
-   /* Delay */
-   for (i = 0; i < 5000; i++)
-   ;
-
-   cfg.refresh = EMIF_SDREF;
-   cfg.refresh_sh = EMIF_SDREF;
-   cfg.sdrcr = EMIF_SDCFG;
-   cfg.sdrcr2 = EMIF_SDCFG;
-
ret = config_sdram(&cfg);
if (ret < 0)
printf("Couldn't configure SDRAM\n");
-- 
1.7.9.5

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


[U-Boot] [PATCH 05/17] am33xx: Remove extra check in enable_ddr_clocks

2012-07-30 Thread Tom Rini
We do not need to check for EMIF_GCLK and L3_GCLK being active.  This
was a hold-over from bringup and no longer required.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/clock.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/clock.c 
b/arch/arm/cpu/armv7/am33xx/clock.c
index bbb9c13..d05780c 100644
--- a/arch/arm/cpu/armv7/am33xx/clock.c
+++ b/arch/arm/cpu/armv7/am33xx/clock.c
@@ -255,11 +255,6 @@ void enable_emif_clocks(void)
writel(PRCM_MOD_EN, &cmper->emiffwclkctrl);
/* Enable EMIF0 Clock */
writel(PRCM_MOD_EN, &cmper->emifclkctrl);
-   /* Poll for emif_gclk  & L3_G clock  are active */
-   while ((readl(&cmper->l3clkstctrl) & (PRCM_EMIF_CLK_ACTIVITY |
-   PRCM_L3_GCLK_ACTIVITY)) != (PRCM_EMIF_CLK_ACTIVITY |
-   PRCM_L3_GCLK_ACTIVITY))
-   ;
/* Poll if module is functional */
while ((readl(&cmper->emifclkctrl)) != PRCM_MOD_EN)
;
-- 
1.7.9.5

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


[U-Boot] [PATCH 06/17] am33xx: Bugfix to config_sdram()

2012-07-30 Thread Tom Rini
When we change SDRAM_CONFIG this triggers a refresh based on all of the
parameters that we have programmed so we must do this last.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index e592609..c37f91b 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -49,10 +49,9 @@ static struct ddr_cmdtctrl *ioctrl_reg = {
  */
 int config_sdram(struct sdram_config *cfg)
 {
-   writel(cfg->sdrcr, &emif_reg->emif_sdram_config);
-   writel(cfg->sdrcr2, &emif_reg->emif_lpddr2_nvm_config);
writel(cfg->refresh, &emif_reg->emif_sdram_ref_ctrl);
writel(cfg->refresh_sh, &emif_reg->emif_sdram_ref_ctrl_shdw);
+   writel(cfg->sdrcr, &emif_reg->emif_sdram_config);
 
return 0;
 }
-- 
1.7.9.5

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


[U-Boot] [PATCH 04/17] am33xx: Convert to using to describe the EMIF

2012-07-30 Thread Tom Rini
Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/am33xx/ddr.c |   29 ++-
 arch/arm/include/asm/arch-am33xx/ddr_defs.h |   27 -
 2 files changed, 15 insertions(+), 41 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index ed982c1..e592609 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -18,12 +18,13 @@ http://www.ti.com/
 #include 
 #include 
 #include 
+#include 
 
 /**
  * Base address for EMIF instances
  */
-static struct emif_regs *emif_reg = {
-   (struct emif_regs *)EMIF4_0_CFG_BASE};
+static struct emif_reg_struct *emif_reg = {
+   (struct emif_reg_struct *)EMIF4_0_CFG_BASE};
 
 /**
  * Base address for DDR instance
@@ -48,10 +49,10 @@ static struct ddr_cmdtctrl *ioctrl_reg = {
  */
 int config_sdram(struct sdram_config *cfg)
 {
-   writel(cfg->sdrcr, &emif_reg->sdrcr);
-   writel(cfg->sdrcr2, &emif_reg->sdrcr2);
-   writel(cfg->refresh, &emif_reg->sdrrcr);
-   writel(cfg->refresh_sh, &emif_reg->sdrrcsr);
+   writel(cfg->sdrcr, &emif_reg->emif_sdram_config);
+   writel(cfg->sdrcr2, &emif_reg->emif_lpddr2_nvm_config);
+   writel(cfg->refresh, &emif_reg->emif_sdram_ref_ctrl);
+   writel(cfg->refresh_sh, &emif_reg->emif_sdram_ref_ctrl_shdw);
 
return 0;
 }
@@ -61,12 +62,12 @@ int config_sdram(struct sdram_config *cfg)
  */
 int set_sdram_timings(struct sdram_timing *t)
 {
-   writel(t->time1, &emif_reg->sdrtim1);
-   writel(t->time1_sh, &emif_reg->sdrtim1sr);
-   writel(t->time2, &emif_reg->sdrtim2);
-   writel(t->time2_sh, &emif_reg->sdrtim2sr);
-   writel(t->time3, &emif_reg->sdrtim3);
-   writel(t->time3_sh, &emif_reg->sdrtim3sr);
+   writel(t->time1, &emif_reg->emif_sdram_tim_1);
+   writel(t->time1_sh, &emif_reg->emif_sdram_tim_1_shdw);
+   writel(t->time2, &emif_reg->emif_sdram_tim_2);
+   writel(t->time2_sh, &emif_reg->emif_sdram_tim_2_shdw);
+   writel(t->time3, &emif_reg->emif_sdram_tim_3);
+   writel(t->time3_sh, &emif_reg->emif_sdram_tim_3_shdw);
 
return 0;
 }
@@ -76,8 +77,8 @@ int set_sdram_timings(struct sdram_timing *t)
  */
 int config_ddr_phy(struct ddr_phy_control *p)
 {
-   writel(p->reg, &emif_reg->ddrphycr);
-   writel(p->reg_sh, &emif_reg->ddrphycsr);
+   writel(p->reg, &emif_reg->emif_ddr_phy_ctrl_1);
+   writel(p->reg_sh, &emif_reg->emif_ddr_phy_ctrl_1_shdw);
 
return 0;
 }
diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
index 388336f..c62f826 100644
--- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
+++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
@@ -56,33 +56,6 @@
 #define DDR_IOCTRL_VALUE   0x18B
 
 /**
- * This structure represents the EMIF registers on AM33XX devices.
- */
-struct emif_regs {
-   unsigned int sdrrev;/* offset 0x00 */
-   unsigned int sdrstat;   /* offset 0x04 */
-   unsigned int sdrcr; /* offset 0x08 */
-   unsigned int sdrcr2;/* offset 0x0C */
-   unsigned int sdrrcr;/* offset 0x10 */
-   unsigned int sdrrcsr;   /* offset 0x14 */
-   unsigned int sdrtim1;   /* offset 0x18 */
-   unsigned int sdrtim1sr; /* offset 0x1C */
-   unsigned int sdrtim2;   /* offset 0x20 */
-   unsigned int sdrtim2sr; /* offset 0x24 */
-   unsigned int sdrtim3;   /* offset 0x28 */
-   unsigned int sdrtim3sr; /* offset 0x2C */
-   unsigned int res1[2];
-   unsigned int sdrmcr;/* offset 0x38 */
-   unsigned int sdrmcsr;   /* offset 0x3C */
-   unsigned int res2[8];
-   unsigned int sdritr;/* offset 0x60 */
-   unsigned int res3[32];
-   unsigned int ddrphycr;  /* offset 0xE4 */
-   unsigned int ddrphycsr; /* offset 0xE8 */
-   unsigned int ddrphycr2; /* offset 0xEC */
-};
-
-/**
  * Encapsulates DDR PHY control and corresponding shadow registers.
  */
 struct ddr_phy_control {
-- 
1.7.9.5

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


[U-Boot] [PATCH 03/17] am33xx: Remove DMM_BASE define

2012-07-30 Thread Tom Rini
The am33xx does not have a DMM, so don't define the base.

Signed-off-by: Tom Rini 
---
 arch/arm/include/asm/arch-am33xx/hardware.h |1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-am33xx/hardware.h 
b/arch/arm/include/asm/arch-am33xx/hardware.h
index 0ec22eb..9be679f 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware.h
@@ -53,7 +53,6 @@
 /* EMIF Base address */
 #define EMIF4_0_CFG_BASE   0x4C00
 #define EMIF4_1_CFG_BASE   0x4D00
-#define DMM_BASE   0x4E00
 
 /* PLL related registers */
 #define CM_PER 0x44E0
-- 
1.7.9.5

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


[U-Boot] [PATCH 01/17] omap3/omap4/omap5/am33xx: Use a common running_from_sdram function

2012-07-30 Thread Tom Rini
On all OMAP3+ platforms we know that SDRAM starts at 0x8000 and we
can use 0xD000 as the end.

Signed-off-by: Tom Rini 
---
 arch/arm/cpu/armv7/omap3/board.c|4 ++--
 arch/arm/cpu/armv7/omap3/sys_info.c |   12 
 arch/arm/include/asm/arch-omap3/sys_proto.h |1 -
 arch/arm/include/asm/arch-omap4/omap.h  |5 -
 arch/arm/include/asm/arch-omap4/sys_proto.h |8 
 arch/arm/include/asm/arch-omap5/omap.h  |5 -
 arch/arm/include/asm/arch-omap5/sys_proto.h |8 
 arch/arm/include/asm/omap_common.h  |   14 ++
 8 files changed, 16 insertions(+), 41 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap3/board.c b/arch/arm/cpu/armv7/omap3/board.c
index f2e52e9..7639bdd 100644
--- a/arch/arm/cpu/armv7/omap3/board.c
+++ b/arch/arm/cpu/armv7/omap3/board.c
@@ -177,7 +177,7 @@ void secureworld_exit()
 void try_unlock_memory()
 {
int mode;
-   int in_sdram = is_running_in_sdram();
+   int in_sdram = running_from_sdram();
 
/*
 * if GP device unlock device SRAM for general use
@@ -210,7 +210,7 @@ void try_unlock_memory()
  */
 void s_init(void)
 {
-   int in_sdram = is_running_in_sdram();
+   int in_sdram = running_from_sdram();
 
watchdog_init();
 
diff --git a/arch/arm/cpu/armv7/omap3/sys_info.c 
b/arch/arm/cpu/armv7/omap3/sys_info.c
index 3c80113..a49e84a 100644
--- a/arch/arm/cpu/armv7/omap3/sys_info.c
+++ b/arch/arm/cpu/armv7/omap3/sys_info.c
@@ -240,18 +240,6 @@ u32 is_running_in_sram(void)
return 0;   /* running in FLASH or SDRAM */
 }
 
-/
- *  is_running_in_sdram() - tell if currently running in
- *  SDRAM.
- ***/
-u32 is_running_in_sdram(void)
-{
-   if (get_base() > 4)
-   return 1;   /* in SDRAM */
-
-   return 0;   /* running in SRAM or FLASH */
-}
-
 /***
  *  get_boot_type() - Is this an XIP type device or a stream one
  *  bits 4-0 specify type. Bit 5 says mem/perif
diff --git a/arch/arm/include/asm/arch-omap3/sys_proto.h 
b/arch/arm/include/asm/arch-omap3/sys_proto.h
index 9e52b12..269b8cc 100644
--- a/arch/arm/include/asm/arch-omap3/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap3/sys_proto.h
@@ -57,7 +57,6 @@ u32 get_sysboot_value(void);
 u32 is_gpmc_muxed(void);
 u32 get_gpmc0_type(void);
 u32 get_gpmc0_width(void);
-u32 is_running_in_sdram(void);
 u32 is_running_in_sram(void);
 u32 is_running_in_flash(void);
 u32 get_device_type(void);
diff --git a/arch/arm/include/asm/arch-omap4/omap.h 
b/arch/arm/include/asm/arch-omap4/omap.h
index 03bd923..83d3813 100644
--- a/arch/arm/include/asm/arch-omap4/omap.h
+++ b/arch/arm/include/asm/arch-omap4/omap.h
@@ -42,11 +42,6 @@
 #define OMAP44XX_L4_WKUP_BASE  0x4A30
 #define OMAP44XX_L4_PER_BASE   0x4800
 
-#define OMAP44XX_DRAM_ADDR_SPACE_START 0x8000
-#define OMAP44XX_DRAM_ADDR_SPACE_END   0xD000
-#define DRAM_ADDR_SPACE_START  OMAP44XX_DRAM_ADDR_SPACE_START
-#define DRAM_ADDR_SPACE_ENDOMAP44XX_DRAM_ADDR_SPACE_END
-
 /* CONTROL */
 #define CTRL_BASE  (OMAP44XX_L4_CORE_BASE + 0x2000)
 #define CONTROL_PADCONF_CORE   (OMAP44XX_L4_CORE_BASE + 0x10)
diff --git a/arch/arm/include/asm/arch-omap4/sys_proto.h 
b/arch/arm/include/asm/arch-omap4/sys_proto.h
index d633573..48a6550 100644
--- a/arch/arm/include/asm/arch-omap4/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap4/sys_proto.h
@@ -67,14 +67,6 @@ void force_emif_self_refresh(void);
  */
 extern struct omap_boot_parameters boot_params;
 
-static inline u32 running_from_sdram(void)
-{
-   u32 pc;
-   asm volatile ("mov %0, pc" : "=r" (pc));
-   return ((pc >= OMAP44XX_DRAM_ADDR_SPACE_START) &&
-   (pc < OMAP44XX_DRAM_ADDR_SPACE_END));
-}
-
 static inline u8 uboot_loaded_by_spl(void)
 {
/*
diff --git a/arch/arm/include/asm/arch-omap5/omap.h 
b/arch/arm/include/asm/arch-omap5/omap.h
index 7f05cb5..c697e0b 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -39,11 +39,6 @@
 #define OMAP54XX_L4_WKUP_BASE  0x4Ae0
 #define OMAP54XX_L4_PER_BASE   0x4800
 
-#define OMAP54XX_DRAM_ADDR_SPACE_START 0x8000
-#define OMAP54XX_DRAM_ADDR_SPACE_END   0x
-#define DRAM_ADDR_SPACE_START  OMAP54XX_DRAM_ADDR_SPACE_START
-#define DRAM_ADDR_SPACE_ENDOMAP54XX_DRAM_ADDR_SPACE_END
-
 /* CONTROL */
 #define CTRL_BASE  (OMAP54XX_L4_CORE_BASE + 0x2000)
 #define CONTROL_PADCONF_CORE   (CTRL_BASE + 0x0800)
diff --git a/arch/arm/include/asm/arch-omap5/sys_proto.h 
b/arch/arm/include/asm/arch-omap5/sys_proto.h
index 74feb90..23b02fd 100644
--- a/arch/arm/include/asm/arch-omap5/sys_proto.h
+++ b/arch/arm/include/asm/arch-omap5/sys_proto.h
@@ -68,14 +68,6 @@ void forc

[U-Boot] [PATCH 02/17] am335x_evm: Update config for common usage

2012-07-30 Thread Tom Rini
- Add default commands
- Add HUSH parser
- Make environment, malloc areas larger
- Add ATAGS and OF_LIBFDT
- Add defaults to boot ramdisk and MMC, use uEnv.txt

Signed-off-by: Tom Rini 
---
 include/configs/am335x_evm.h |   69 --
 1 file changed, 59 insertions(+), 10 deletions(-)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index d0fbc88..32a7441 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -17,32 +17,81 @@
 #define __CONFIG_AM335X_EVM_H
 
 #define CONFIG_AM33XX
-#define CONFIG_CMD_MEMORY  /* for mtest */
-#undef CONFIG_GZIP
-#undef CONFIG_ZLIB
-#undef CONFIG_SYS_HUSH_PARSER
 #undef CONFIG_CMD_NET
 
 #include 
 #include 
 
-#define CONFIG_ENV_SIZE0x400
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (8 * 1024))
+#define CONFIG_ENV_SIZE(128 << 10) /* 128 KiB */
+#define CONFIG_SYS_MALLOC_LEN  (1024 << 10)
+#define CONFIG_SYS_LONGHELP/* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
 #define CONFIG_SYS_PROMPT  "U-Boot# "
 #define CONFIG_SYS_NO_FLASH
 #define MACH_TYPE_TIAM335EVM   3589/* Until the next sync */
 #define CONFIG_MACH_TYPE   MACH_TYPE_TIAM335EVM
 
+#define CONFIG_OF_LIBFDT
+#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS
+#define CONFIG_INITRD_TAG
+
+/* commands to include */
+#include 
+
 #define CONFIG_CMD_ASKENV
 #define CONFIG_VERSION_VARIABLE
 
 /* set to negative value for no autoboot */
 #define CONFIG_BOOTDELAY   3
-#define CONFIG_SYS_AUTOLOAD"no"
-#define CONFIG_BOOTFILE"uImage"
 #define CONFIG_EXTRA_ENV_SETTINGS \
-   "verify=yes\0" \
-   "ramdisk_file=ramdisk.gz\0" \
+   "loadaddr=0x8020\0" \
+   "rdaddr=0x8100\0" \
+   "bootfile=/boot/uImage\0" \
+   "console=ttyO0,115200n8\0" \
+   "optargs=\0" \
+   "mmcdev=0\0" \
+   "mmcroot=/dev/mmcblk0p2 rw\0" \
+   "mmcrootfstype=ext3 rootwait\0" \
+   "ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=${rdaddr},64M\0" \
+   "ramrootfstype=ext2\0" \
+   "mmcargs=setenv bootargs console=${console} " \
+   "${optargs} " \
+   "root=${mmcroot} " \
+   "rootfstype=${mmcrootfstype}\0" \
+   "bootenv=uEnv.txt\0" \
+   "loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}\0" \
+   "importbootenv=echo Importing environment from mmc ...; " \
+   "env import -t $loadaddr $filesize\0" \
+   "ramargs=setenv bootargs console=${console} " \
+   "${optargs} " \
+   "root=${ramroot} " \
+   "rootfstype=${ramrootfstype}\0" \
+   "loadramdisk=fatload mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
+   "loaduimagefat=fatload mmc ${mmcdev} ${loadaddr} ${bootfile}\0" \
+   "loaduimage=ext2load mmc ${mmcdev}:2 ${loadaddr} ${bootfile}\0" \
+   "mmcboot=echo Booting from mmc ...; " \
+   "run mmcargs; " \
+   "bootm ${loadaddr}\0" \
+   "ramboot=echo Booting from ramdisk ...; " \
+   "run ramargs; " \
+   "bootm ${loadaddr}\0" \
+
+#define CONFIG_BOOTCOMMAND \
+   "if mmc rescan ${mmcdev}; then " \
+   "echo SD/MMC found on device ${mmcdev};" \
+   "if run loadbootenv; then " \
+   "echo Loaded environment from ${bootenv};" \
+   "run importbootenv;" \
+   "fi;" \
+   "if test -n $uenvcmd; then " \
+   "echo Running uenvcmd ...;" \
+   "run uenvcmd;" \
+   "fi;" \
+   "if run loaduimage; then " \
+   "run mmcboot;" \
+   "fi;" \
+   "fi;" \
 
 /* Clock Defines */
 #define V_OSCK 2400  /* Clock output from T2 */
-- 
1.7.9.5

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


[U-Boot] [PATCH 0/17]: Improve am33xx support

2012-07-30 Thread Tom Rini
Hey all,

The following series of patches improves am33xx support, and cleans up
omap3/4/5 slightly.  The slight cleanup to omap3/4/5 is that we can all
share a single function to see if we are executing in SDRAM or not.  The
rest of the series cleans up the EMIF code for am33xx.  While I had
hoped to be able to re-use the omap4/5 code as the EMIF unit is the same
block, it's simply wired up too differently to reuse the same codebase.
We can however reuse the register structs so some of the commits here
are about changing to use that.  There's also bugfixes to the DDR2 init
sequence and cleanups that will make adding DDR3 support easier.  I also
update the am335x_evm config to be like a "normal" board and support
common commands and booting Linux.

-- 
Tom

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


Re: [U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed

2012-07-30 Thread Laurence Withers
On Mon, Jul 30, 2012 at 04:30:15PM +, Laurence Withers wrote:
> Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
> definition. In addition, don't request this clock ID on DA830 hardware,
> which does not have a DDR2/mDDR PHY (or associated PLL controller).
> 
> Signed-off-by: Laurence Withers 
> Cc: Prabhakar Lad 
> ---
>  arch/arm/cpu/arm926ejs/davinci/cpu.c |3 ++-
>  arch/arm/include/asm/arch-davinci/hardware.h |2 ++
>  2 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c 
> b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> index 4bdb08b..b31add8 100644
> --- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
> +++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
> @@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
>  {
>   gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 100;
>   /* DDR PHY uses an x2 input clock */
> - gd->bd->bi_ddr_freq = clk_get(0x10001) / 100;
> + gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
> + (clk_get(DAVINCI_DDR_CLKID) / 100);
>   gd->bd->bi_dsp_freq = 0;
>   return 0;
>  }
> diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
> b/arch/arm/include/asm/arch-davinci/hardware.h
> index 0fce940..7f3dcc2 100644
> --- a/arch/arm/include/asm/arch-davinci/hardware.h
> +++ b/arch/arm/include/asm/arch-davinci/hardware.h
> @@ -459,10 +459,12 @@ enum davinci_clk_ids {
>   DAVINCI_PLL0_SYSCLK2= DAVINCI_PLLC0_FLAG | 2,
>   DAVINCI_PLL0_SYSCLK4= DAVINCI_PLLC0_FLAG | 4,
>   DAVINCI_PLL0_SYSCLK6= DAVINCI_PLLC0_FLAG | 6,
> + DAVINCI_PLL1_SYSCLK1= DAVINCI_PLLC1_FLAG | 1,
>   DAVINCI_PLL1_SYSCLK2= DAVINCI_PLLC1_FLAG | 2,
>  
>   /* map peripherals to clock IDs */
>   DAVINCI_ARM_CLKID   = DAVINCI_PLL0_SYSCLK6,
> + DAVINCI_DDR_CLKID   = DAVINCI_PLL1_SYSCLK1,
>   DAVINCI_MDIO_CLKID  = DAVINCI_PLL0_SYSCLK4,
>   DAVINCI_MMC_CLKID   = DAVINCI_PLL0_SYSCLK2,
>   DAVINCI_SPI0_CLKID  = DAVINCI_PLL0_SYSCLK2,
> -- 
> 1.7.2.5
> 

Hi,

This patch does depend on my earlier patch to tidy up the definition of
set_cpu_clk_info() :

http://lists.denx.de/pipermail/u-boot/2012-July/129205.html

Bye for now,
-- 
Laurence Withers, http://www.guralp.com/
Direct tel:+447753988197 or tel:+44408643   Software Engineer
General support queries:  CMG-DCM CMG-EAM CMG-NAM
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] DaVinci DA8xx: fix set_cpu_clk_info()

2012-07-30 Thread Laurence Withers
On Sat, Jul 28, 2012 at 12:49:55PM +0530, Prabhakar Lad wrote:
> Thanks for the patch. I have tested this patch, below are few comments.
[snip]
> > +int set_cpu_clk_info(void)
> > +{
> > +   gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 100;
> > +   /* DDR PHY uses an x2 input clock */
> > +   gd->bd->bi_ddr_freq = clk_get(0x10001) / 100;
> 
>  Can you define a macro for this 0x10001 ?
> 
> With that change you can add my ACK:
> Acked-by: Prabhakar Lad 

Hi Prabhakar,

I have tidied up the clock IDs a little and added a constant for the DDR2
clock ID as you suggested. It made sense that this would be a separate set
of patches:

  http://lists.denx.de/pipermail/u-boot/2012-July/129444.html

Bye for now,
-- 
Laurence Withers, http://www.guralp.com/
Direct tel:+447753988197 or tel:+44408643   Software Engineer
General support queries:  CMG-DCM CMG-EAM CMG-NAM
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] DaVinci DA850: UART2 clock ID comes from ASYNC3

2012-07-30 Thread Laurence Withers
On the DA830, UART2's clock is derived from PLL controller 0 output 2.
On the DA850, it is in the ASYNC3 group, and may be switched between PLL
controller 0 or 1. Fix the definition of the ID to match.

Signed-off-by: Laurence Withers 
Cc: Prabhakar Lad 
---
 arch/arm/include/asm/arch-davinci/hardware.h |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
b/arch/arm/include/asm/arch-davinci/hardware.h
index dac43bb..0fce940 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -466,7 +466,6 @@ enum davinci_clk_ids {
DAVINCI_MDIO_CLKID  = DAVINCI_PLL0_SYSCLK4,
DAVINCI_MMC_CLKID   = DAVINCI_PLL0_SYSCLK2,
DAVINCI_SPI0_CLKID  = DAVINCI_PLL0_SYSCLK2,
-   DAVINCI_UART2_CLKID = DAVINCI_PLL0_SYSCLK2,
 
/* special clock ID - output of PLL multiplier */
DAVINCI_PLLM_CLKID  = 0x0FF,
@@ -478,6 +477,9 @@ enum davinci_clk_ids {
DAVINCI_AUXCLK_CLKID= 0x101,
 };
 
+#define DAVINCI_UART2_CLKID(cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
+   : get_async3_src())
+
 #define DAVINCI_SPI1_CLKID (cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
: get_async3_src())
 
-- 
1.7.2.5

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


[U-Boot] [PATCH 3/3] DaVinci DA8xx: replace magic number for DDR speed

2012-07-30 Thread Laurence Withers
Replace a magic number for the DDR2/mDDR PHY clock ID with a proper
definition. In addition, don't request this clock ID on DA830 hardware,
which does not have a DDR2/mDDR PHY (or associated PLL controller).

Signed-off-by: Laurence Withers 
Cc: Prabhakar Lad 
---
 arch/arm/cpu/arm926ejs/davinci/cpu.c |3 ++-
 arch/arm/include/asm/arch-davinci/hardware.h |2 ++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/davinci/cpu.c 
b/arch/arm/cpu/arm926ejs/davinci/cpu.c
index 4bdb08b..b31add8 100644
--- a/arch/arm/cpu/arm926ejs/davinci/cpu.c
+++ b/arch/arm/cpu/arm926ejs/davinci/cpu.c
@@ -122,7 +122,8 @@ int set_cpu_clk_info(void)
 {
gd->bd->bi_arm_freq = clk_get(DAVINCI_ARM_CLKID) / 100;
/* DDR PHY uses an x2 input clock */
-   gd->bd->bi_ddr_freq = clk_get(0x10001) / 100;
+   gd->bd->bi_ddr_freq = cpu_is_da830() ? 0 :
+   (clk_get(DAVINCI_DDR_CLKID) / 100);
gd->bd->bi_dsp_freq = 0;
return 0;
 }
diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
b/arch/arm/include/asm/arch-davinci/hardware.h
index 0fce940..7f3dcc2 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -459,10 +459,12 @@ enum davinci_clk_ids {
DAVINCI_PLL0_SYSCLK2= DAVINCI_PLLC0_FLAG | 2,
DAVINCI_PLL0_SYSCLK4= DAVINCI_PLLC0_FLAG | 4,
DAVINCI_PLL0_SYSCLK6= DAVINCI_PLLC0_FLAG | 6,
+   DAVINCI_PLL1_SYSCLK1= DAVINCI_PLLC1_FLAG | 1,
DAVINCI_PLL1_SYSCLK2= DAVINCI_PLLC1_FLAG | 2,
 
/* map peripherals to clock IDs */
DAVINCI_ARM_CLKID   = DAVINCI_PLL0_SYSCLK6,
+   DAVINCI_DDR_CLKID   = DAVINCI_PLL1_SYSCLK1,
DAVINCI_MDIO_CLKID  = DAVINCI_PLL0_SYSCLK4,
DAVINCI_MMC_CLKID   = DAVINCI_PLL0_SYSCLK2,
DAVINCI_SPI0_CLKID  = DAVINCI_PLL0_SYSCLK2,
-- 
1.7.2.5

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


[U-Boot] [PATCH 1/3] DaVinci DA8xx: tidy up clock ID definition

2012-07-30 Thread Laurence Withers
Tidy up the clock IDs defined for the DA8xx SOCs. With this new structure in
place, it is clear how to define new clock IDs, and how these map to the
numbers presented in the technical reference manual.

Signed-off-by: Laurence Withers 
Cc: Prabhakar Lad 
---
 arch/arm/include/asm/arch-davinci/hardware.h |   53 +++---
 1 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/arch-davinci/hardware.h 
b/arch/arm/include/asm/arch-davinci/hardware.h
index b145c6e..dac43bb 100644
--- a/arch/arm/include/asm/arch-davinci/hardware.h
+++ b/arch/arm/include/asm/arch-davinci/hardware.h
@@ -441,21 +441,46 @@ struct davinci_pllc_regs {
 #define davinci_pllc1_regs ((struct davinci_pllc_regs 
*)DAVINCI_PLL_CNTRL1_BASE)
 #define DAVINCI_PLLC_DIV_MASK  0x1f
 
-#define ASYNC3  get_async3_src()
-#define PLL1_SYSCLK2   ((1 << 16) | 0x2)
-#define DAVINCI_SPI1_CLKID  (cpu_is_da830() ? 2 : ASYNC3)
-/* Clock IDs */
+/*
+ * A clock ID is a 32-bit number where bit 16 represents the PLL controller
+ * (clear is PLLC0, set is PLLC1) and the low 16 bits represent the divisor,
+ * counting from 1. Clock IDs may be passed to clk_get().
+ */
+
+/* flags to select PLL controller */
+#define DAVINCI_PLLC0_FLAG (0)
+#define DAVINCI_PLLC1_FLAG (1 << 16)
+
 enum davinci_clk_ids {
-   DAVINCI_SPI0_CLKID = 2,
-   DAVINCI_UART2_CLKID = 2,
-   DAVINCI_MMC_CLKID = 2,
-   DAVINCI_MDIO_CLKID = 4,
-   DAVINCI_ARM_CLKID = 6,
-   DAVINCI_PLLM_CLKID = 0xff,
-   DAVINCI_PLLC_CLKID = 0x100,
-   DAVINCI_AUXCLK_CLKID = 0x101
+   /*
+* Clock IDs for PLL outputs. Each may be switched on/off independently,
+* and each may map to one or more peripherals.
+*/
+   DAVINCI_PLL0_SYSCLK2= DAVINCI_PLLC0_FLAG | 2,
+   DAVINCI_PLL0_SYSCLK4= DAVINCI_PLLC0_FLAG | 4,
+   DAVINCI_PLL0_SYSCLK6= DAVINCI_PLLC0_FLAG | 6,
+   DAVINCI_PLL1_SYSCLK2= DAVINCI_PLLC1_FLAG | 2,
+
+   /* map peripherals to clock IDs */
+   DAVINCI_ARM_CLKID   = DAVINCI_PLL0_SYSCLK6,
+   DAVINCI_MDIO_CLKID  = DAVINCI_PLL0_SYSCLK4,
+   DAVINCI_MMC_CLKID   = DAVINCI_PLL0_SYSCLK2,
+   DAVINCI_SPI0_CLKID  = DAVINCI_PLL0_SYSCLK2,
+   DAVINCI_UART2_CLKID = DAVINCI_PLL0_SYSCLK2,
+
+   /* special clock ID - output of PLL multiplier */
+   DAVINCI_PLLM_CLKID  = 0x0FF,
+
+   /* special clock ID - output of PLL post divisor */
+   DAVINCI_PLLC_CLKID  = 0x100,
+
+   /* special clock ID - PLL bypass */
+   DAVINCI_AUXCLK_CLKID= 0x101,
 };
 
+#define DAVINCI_SPI1_CLKID (cpu_is_da830() ? DAVINCI_PLL0_SYSCLK2 \
+   : get_async3_src())
+
 int clk_get(enum davinci_clk_ids id);
 
 /* Boot config */
@@ -570,10 +595,10 @@ static inline int cpu_is_da850(void)
return ((part_no == 0xb7d1) ? 1 : 0);
 }
 
-static inline int get_async3_src(void)
+static inline enum davinci_clk_ids get_async3_src(void)
 {
return (REG(&davinci_syscfg_regs->cfgchip3) & 0x10) ?
-   PLL1_SYSCLK2 : 2;
+   DAVINCI_PLL1_SYSCLK2 : DAVINCI_PLL0_SYSCLK2;
 }
 
 #endif /* CONFIG_SOC_DA8XX */
-- 
1.7.2.5

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


Re: [U-Boot] [PATCH 3/7] powerpc/82xx: merge mgcoge.h and mgcoge3ne.h into km82xx.h

2012-07-30 Thread Wolfgang Denk
Dear Gerlando Falauto,

In message <5016a093.6040...@keymile.com> you wrote:
>
> The way I understand it, such renaming information is built on the fly 
> while building the patch (like you're suggesting, it's a parameter to 
> git format-patch, not to the commit itself).

Yes, and I fail to understand where your problems could be.

> However, I've been struggling to get this same kind of message through 
> git-format-patch. No way, I don't know why. I tried with -M, -M -C, 
> -M10%, adding "[diff]\n renames = copies" to ~/.gitconfig, with both 
> versions below, nothing. Detected as a rename at commit time, it's a 
> plain delete/create commit at patch creation time.

I see this (doing it all manually for testing):

-> patch -p1  git rm include/configs/mgcoge.h include/configs/mgcoge3ne.h
-> git add include/configs/km82xx.h
-> git commit -s -m 'test 1'
-> git format-patch -M -C --stdout HEAD^ >/tmp/patch
-> less /tmp/patch
>From 1d9ce92a542d139b78291fb4e437e538d647d55b Mon Sep 17 00:00:00 2001
From: Wolfgang Denk 
Date: Mon, 30 Jul 2012 17:57:53 +0200
Subject: [PATCH] test 1

Signed-off-by: Wolfgang Denk 
---
 include/configs/{mgcoge3ne.h => km82xx.h} |   95 ++---
 include/configs/mgcoge.h  |   93 
 2 files changed, 74 insertions(+), 114 deletions(-)
 rename include/configs/{mgcoge3ne.h => km82xx.h} (55%)
 delete mode 100644 include/configs/mgcoge.h

...

Oops, I forgot to "git add boards.cfg" here, but for this test it
makes no difference.

> $ git --version
> git version 1.7.1
> 
> $ ~/git/bin-wrappers/git --version
> git version 1.7.11.3
> 
> Could you please share what GIT version you're running?

-> git --version
git version 1.7.10.4

That's what I get from the normal Fedora 17 installation.

> Could you please try applying the patch to your tree (namely 3 and 4), 
> and then build it again by running:
>   git-format-patch -M30% -C

See above...

> In any case, I have no clue whether git would be able to correctly (i.e. 
> intelligently) apply such patch to a slightly different tree (e.g. 
> through cherry-pick or rebase).
> So for instance, in your example above, what if file.1 (whose contents 
> is anyway moved into file.common, regardless of rename detection) is 
> slightly different?

It doesn't matter.  If there are conflicts, and these can be resolved,
it works just the same.

> I'm strongly convinced that if we want to track such changes for what 
> they are (code moving) so that they can be "easily" re-applied, we 
> should mark this explicitly. Even at the cost of creating multiple 
> patches if necessary. Since git isn't able to figure it out by itself,

No, on contrary.  This is basicly an atomic change, and we should not
artificially split it.  git should have no problems with such actions,
they are really not special in any way.

> the only way I can think of doing this is splitting the commit into 3 parts:

No, please don't.

> Since mgcoge and mgcoge3ne are the only km82xx boards, there is no
> need to keep them as separate .h config files.
> Therefore, make mgcoge3ne.h and mgcoge.h converge into a single
> km82xx.h file.
> Step 2 of 3: substitute include files through the following script:
> 
> INCLUDE_STMT='#include "mgcoge.h"'
> INCLUDED=include/configs/mgcoge.h
> INCLUDING=include/configs/km82xx.h

Argh No, this is not what we're going to do.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
All a hacker needs is a tight PUSHJ, a loose pair of UUOs, and a warm
place to shift.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] dm: net: Fixup the armada100 FEC driver

2012-07-30 Thread Marek Vasut
Dear Joe Hershberger,

> Hi Marek,
> 
> On Mon, Jul 30, 2012 at 1:35 AM, Marek Vasut  wrote:
> > Dear Prafulla Wadaskar,
> > 
> >> > -Original Message-
> >> > From: u-boot-boun...@lists.denx.de [mailto:u-boot-
> >> > boun...@lists.denx.de] On Behalf Of Marek Vasut
> >> > Sent: 28 July 2012 01:20
> >> > To: u-boot@lists.denx.de
> >> > Cc: Marek Vasut; Joe Hershberger; u-boot...@lists.denx.de
> >> > Subject: [U-Boot] [PATCH] dm: net: Fixup the armada100 FEC driver
> >> > 
> >> > Apply the following questionable adjustment to silence GCC.
> >> > 
> >> > armada100_fec.c: In function 'armdfec_send':
> >> > armada100_fec.c:589:2: warning: dereferencing type-punned pointer will
> >> > break strict-aliasing rules [-Wstrict-aliasing]
> >> > 
> >> > Signed-off-by: Marek Vasut 
> >> > Cc: Joe Hershberger 
> > 
> > [...]
> > 
> > Joe, can you please pick this for -next (or -master already?) ?
> 
> OK... I figured this was just an RFC, since it was sent to the u-boot-dm
> list.

That was a bad choice to cross post it to both MLs ... and I was already told 
so, quite a lot.

> I'll pull it into master after release.
> 
> Thanks,
> -Joe

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] dm: net: Fixup the armada100 FEC driver

2012-07-30 Thread Joe Hershberger
Hi Marek,

On Mon, Jul 30, 2012 at 1:35 AM, Marek Vasut  wrote:
> Dear Prafulla Wadaskar,
>
>> > -Original Message-
>> > From: u-boot-boun...@lists.denx.de [mailto:u-boot-
>> > boun...@lists.denx.de] On Behalf Of Marek Vasut
>> > Sent: 28 July 2012 01:20
>> > To: u-boot@lists.denx.de
>> > Cc: Marek Vasut; Joe Hershberger; u-boot...@lists.denx.de
>> > Subject: [U-Boot] [PATCH] dm: net: Fixup the armada100 FEC driver
>> >
>> > Apply the following questionable adjustment to silence GCC.
>> >
>> > armada100_fec.c: In function 'armdfec_send':
>> > armada100_fec.c:589:2: warning: dereferencing type-punned pointer will
>> > break strict-aliasing rules [-Wstrict-aliasing]
>> >
>> > Signed-off-by: Marek Vasut 
>> > Cc: Joe Hershberger 
> [...]
>
> Joe, can you please pick this for -next (or -master already?) ?

OK... I figured this was just an RFC, since it was sent to the u-boot-dm list.

I'll pull it into master after release.

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


Re: [U-Boot] building u-boot inside buildroot

2012-07-30 Thread Karl O. Pinc
On 07/30/2012 01:28:45 AM, Prafulla Wadaskar wrote:
> 
> 
> > -Original Message-
> > From: u-boot-boun...@lists.denx.de [mailto:u-boot-
> > boun...@lists.denx.de] On Behalf Of Karl O. Pinc
> > Sent: 30 July 2012 08:00
> > To: Sabri Altunbas
> > Cc: u-boot@lists.denx.de
> > Subject: Re: [U-Boot] building u-boot inside buildroot
> > 
> > On 07/29/2012 07:43:00 AM, Sabri Altunbas wrote:
> > > I installed buildroot as my embedded linux environment. For first
> > > time
> > > I can
> > > build u-boot. But if i change a c-file and try to recompile
> u-boot.
> > > It
> > > doesn,t work. Buildroot doesn,t notice this changing and does
> > > nothing.
> > >
> > > Can anybody give me any hints please
> 
> Hi Karl
> May you please describe the process you followed to build the u-boot
> and for which board?

This question is for Sabri, right?



Karl 
Free Software:  "You don't pay back, you pay forward."
 -- Robert A. Heinlein

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


Re: [U-Boot] [PATCH 3/7] powerpc/82xx: merge mgcoge.h and mgcoge3ne.h into km82xx.h

2012-07-30 Thread Gerlando Falauto

On 07/30/2012 03:00 PM, Wolfgang Denk wrote:

Dear Gerlando Falauto,

In message<50164f3a.6050...@keymile.com>  you wrote:



   boards.cfg  |4 +-
   include/configs/km82xx.h|  149 
+++
   include/configs/mgcoge.h|   93 ---
   include/configs/mgcoge3ne.h |   93 ---
   4 files changed, 151 insertions(+), 188 deletions(-)
   create mode 100644 include/configs/km82xx.h
   delete mode 100644 include/configs/mgcoge.h
   delete mode 100644 include/configs/mgcoge3ne.h


Can you please try creating this patch with git format-patch with
options "-M" and "-C", please? I think git should do better to
recognize this rename / merge of two files.


I tried this but to no avail, the resulting patch is still the same.
Same for patch number 4.

I guess git gets confused by the fact that we are merging two files into
one.


No, git can handle this pretty well if you tell it what you are doing.
I just retested this; the result is:

---
 file.1| 64 
---
 file.2 =>  file.common | 64 
+++
 2 files changed, 64 insertions(+), 64 deletions(-)
 delete mode 100644 file.1
 rename file.2 =>  file.common (63%)


What I could do is to split this commit so that, for instance,
first we rename one of the files and then (on a separate commit) we move
the content of one into the other.


No, this can and should be done in a single commit, for example like this:

1. run: git mv include/configs/mgcoge.h include/configs/km82xx.h
2. merge include/configs/mgcoge3ne.h into include/configs/km82xx.h
3. run: git rm include/configs/mgcoge3ne.h

git format-patch -M -C will then recognize what you did.


The way I understand it, such renaming information is built on the fly 
while building the patch (like you're suggesting, it's a parameter to 
git format-patch, not to the commit itself).


In other words, a renaming is just a remove and an add (see [1]):
--
Git has a rename command git mv, but that is just for convenience. The 
effect is indistinguishable from removing the file and adding another 
with different name and the same content.

--

As a matter of fact, I am able to get the renaming recognized when 
committing:


---
[detached HEAD 85129b8] powerpc/82xx: 1of2 move km/km82xx-common.h 
within km82xx.h

 1 files changed, 148 insertions(+), 0 deletions(-)
 rename include/configs/{km/km82xx-common.h => km82xx.h} (71%)
---

However, I've been struggling to get this same kind of message through 
git-format-patch. No way, I don't know why. I tried with -M, -M -C, 
-M10%, adding "[diff]\n renames = copies" to ~/.gitconfig, with both 
versions below, nothing. Detected as a rename at commit time, it's a 
plain delete/create commit at patch creation time.


$ git --version
git version 1.7.1

$ ~/git/bin-wrappers/git --version
git version 1.7.11.3

Could you please share what GIT version you're running?


Question is, is this really worth the effort?
Is there a common practice for such reworks?


Yes, if possible we want that git tracks such renames / merges.
And here it seems easily possible.


Could you please try applying the patch to your tree (namely 3 and 4), 
and then build it again by running:

 git-format-patch -M30% -C

It should get detected as a rename anyway (I mean, even if applied as a 
whole delete/add).


In any case, I have no clue whether git would be able to correctly (i.e. 
intelligently) apply such patch to a slightly different tree (e.g. 
through cherry-pick or rebase).
So for instance, in your example above, what if file.1 (whose contents 
is anyway moved into file.common, regardless of rename detection) is 
slightly different?
Would the patch fail? Or worse, would it silently apply by just deleting 
the "new" file and applying the "old" contents (verbatim from the patch)?


I'm strongly convinced that if we want to track such changes for what 
they are (code moving) so that they can be "easily" re-applied, we 
should mark this explicitly. Even at the cost of creating multiple 
patches if necessary. Since git isn't able to figure it out by itself,

the only way I can think of doing this is splitting the commit into 3 parts:
1) preparation work, adding #include statements to the old files
2) automated code moving through a script like the following (and 
including it in the commit message itself)

3) cleanup changes


powerpc/82xx: 2of3 merge mgcoge.h and mgcoge3ne.h into km82xx.h

Since mgcoge and mgcoge3ne are the only km82xx boards, there is no
need to keep them as separate .h config files.
Therefore, make mgcoge3ne.h and mgcoge.h converge into a single
km82xx.h file.
Step 2 of 3: substitute include files through the following script:

INCLUDE_STMT='#include "mgcoge.h"'

  1   2   >