Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Eric Bénard
Hi Otavio,

Le Sat, 26 Apr 2014 19:47:27 -0300,
Otavio Salvador ota...@ossystems.com.br a écrit :
 I'd like to know if someone has succeed in using usbtty with i.MX6. I
 am interested in using it for one board but been not succed, it seems:
 
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:553: undefined
 reference to `udc_init'
 drivers/serial/built-in.o: In function `usbtty_init_instances':
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:686: undefined
 reference to `udc_setup_ep'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:708: undefined
 reference to `urb_link_init'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:709: undefined
 reference to `urb_link_init'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:710: undefined
 reference to `urb_link_init
 ...
 
 Does someone got it working?
 
you need a gadget driver for the i.MX6 USB port which doesn't seems to
exist in u-boot.

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


[U-Boot] [PATCH v2 6/6] ARM: tegra: paz00: enable nvec keyboard

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: ac...@lists.launchpad.net
---
 Changes for v2:
- device tree part moved to separate patch
- added I2C specific defines for initialization

 include/configs/paz00.h |9 +
 1 file changed, 9 insertions(+)

diff --git a/include/configs/paz00.h b/include/configs/paz00.h
index 9e2686a..39dbe1e 100644
--- a/include/configs/paz00.h
+++ b/include/configs/paz00.h
@@ -72,6 +72,15 @@
 #define CONFIG_SYS_WHITE_ON_BLACK
 #define CONFIG_CONSOLE_SCROLL_LINES10
 
+/* Keyboard support */
+#define CONFIG_KEYBOARD
+#define CONFIG_TEGRA_NVEC_KEYBOARD
+/* NVEC support */
+#define CONFIG_SYS_I2C
+#define CONFIG_SYS_I2C_TEGRA
+#define CONFIG_SYS_I2C_INIT_BOARD
+#define CONFIG_SYS_I2C_TEGRA_NVEC
+
 #include tegra-common-post.h
 
 #endif /* __CONFIG_H */
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 1/6] i2c: add slave mode support

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: ac...@lists.launchpad.net
---
 drivers/i2c/i2c_core.c |   13 +
 include/i2c.h  |   30 +-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 18d6736..105aa0a 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -395,6 +395,19 @@ void i2c_reg_write(uint8_t addr, uint8_t reg, uint8_t val)
i2c_write(addr, reg, 1, val, 1);
 }
 
+int i2c_slave_io(struct i2c_transaction *trans)
+{
+   struct i2c_adapter *cur = I2C_ADAP;
+
+   if (!cur-slave_io) {
+   printf(Error: slave IO is not supported on adap %d\n,
+  cur-hwadapnr);
+   return -1;
+   }
+
+   return cur-slave_io(cur, trans);
+}
+
 void __i2c_init(int speed, int slaveaddr)
 {
i2c_init_bus(i2c_get_bus_num(), speed, slaveaddr);
diff --git a/include/i2c.h b/include/i2c.h
index f93a183..165b919 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -55,6 +55,20 @@
 #define CONFIG_SYS_SPD_BUS_NUM 0
 #endif
 
+struct i2c_transaction {
+   char rx_buf[34];
+   int rx_pos;
+
+   char tx_buf[34];
+   int tx_pos;
+   int tx_size;
+
+   unsigned int start_timeout;
+   unsigned int timeout;
+
+   int res;
+};
+
 struct i2c_adapter {
void(*init)(struct i2c_adapter *adap, int speed,
int slaveaddr);
@@ -65,6 +79,8 @@ struct i2c_adapter {
int (*write)(struct i2c_adapter *adap, uint8_t chip,
uint addr, int alen, uint8_t *buffer,
int len);
+   int (*slave_io)(struct i2c_adapter *adap,
+   struct i2c_transaction *trans);
uint(*set_bus_speed)(struct i2c_adapter *adap,
uint speed);
int speed;
@@ -81,12 +97,13 @@ struct i2c_adapter {
.probe  =   _probe, \
.read   =   _read, \
.write  =   _write, \
+   .slave_io   =   0, \
.set_bus_speed  =   _set_speed, \
.speed  =   _speed, \
.slaveaddr  =   _slaveaddr, \
.init_done  =   0, \
.hwadapnr   =   _hwadapnr, \
-   .name   =   #_name \
+   .name   =   #_name, \
 };
 
 #define U_BOOT_I2C_ADAP_COMPLETE(_name, _init, _probe, _read, _write, \
@@ -450,4 +467,15 @@ int i2c_get_bus_num_fdt(int node);
  * @return 0 if port was reset, -1 if not found
  */
 int i2c_reset_port_fdt(const void *blob, int node);
+
+/**
+ * Perform I2C transaction with master device.
+ *
+ * @param trans  I2C transaction object
+ * @return 0 if succeeded, -1 if not supported,
+ * 1 if not ready, 2 if operation timed out,
+ * 3 if not our packet, other - unknown error.
+ */
+int i2c_slave_io(struct i2c_transaction *trans);
+
 #endif /* _I2C_H_ */
-- 
1.7.9.5

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


[U-Boot] [PATCH v2 3/6] ARM: tegra: i2c: add nvec driver

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: ac...@lists.launchpad.net
---
 Changes for v2:
- NVEC driver was reworked to use tegra-i2c

 arch/arm/include/asm/arch-tegra/tegra_nvec.h |  130 
 board/nvidia/common/board.c  |   12 ++
 drivers/i2c/Makefile |1 +
 drivers/i2c/tegra_nvec.c |  294 ++
 include/fdtdec.h |1 +
 lib/fdtdec.c |1 +
 6 files changed, 439 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-tegra/tegra_nvec.h
 create mode 100644 drivers/i2c/tegra_nvec.c

diff --git a/arch/arm/include/asm/arch-tegra/tegra_nvec.h 
b/arch/arm/include/asm/arch-tegra/tegra_nvec.h
new file mode 100644
index 000..f1cec0d
--- /dev/null
+++ b/arch/arm/include/asm/arch-tegra/tegra_nvec.h
@@ -0,0 +1,130 @@
+/*
+ * (C) Copyright 2014
+ * Andrey Danin danind...@mail.ru
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _TEGRA_NVEC_H_
+#define _TEGRA_NVEC_H_
+
+#define I2C_CNFG   0x00
+#define I2C_CNFG_PACKET_MODE_EN(110)
+#define I2C_CNFG_NEW_MASTER_SFM(111)
+#define I2C_CNFG_DEBOUNCE_CNT_SHIFT12
+
+#define I2C_SL_CNFG0x20
+#define I2C_SL_NEWSL   (12)
+#define I2C_SL_NACK(11)
+#define I2C_SL_RESP(10)
+#define I2C_SL_IRQ (13)
+#define END_TRANS  (14)
+#define RCVD   (12)
+#define RNW(11)
+
+#define I2C_SL_RCVD0x24
+#define I2C_SL_STATUS  0x28
+#define I2C_SL_ADDR1   0x2c
+#define I2C_SL_ADDR2   0x30
+#define I2C_SL_DELAY_COUNT 0x3c
+
+
+enum nvec_msg_type {
+   NVEC_KEYBOARD = 0,
+   NVEC_SYS = 1,
+   NVEC_BAT,
+   NVEC_GPIO,
+   NVEC_SLEEP,
+   NVEC_KBD,
+   NVEC_PS2,
+   NVEC_CNTL,
+   NVEC_OEM0 = 0x0d,
+   NVEC_KB_EVT = 0x80,
+   NVEC_PS2_EVT,
+   NVEC_LAST_MSG,
+};
+
+enum nvec_event_size {
+   NVEC_2BYTES,
+   NVEC_3BYTES,
+   NVEC_VAR_SIZE,
+};
+
+enum sys_subcmds {
+   SYS_GET_STATUS,
+   SYS_CNFG_EVENT_REPORTING,
+   SYS_ACK_STATUS,
+   SYS_CNFG_WAKE = 0xfd,
+};
+
+enum kbd_subcmds {
+   CNFG_WAKE = 3,
+   CNFG_WAKE_KEY_REPORTING,
+   SET_LEDS = 0xed,
+   ENABLE_KBD = 0xf4,
+   DISABLE_KBD,
+};
+
+enum cntl_subcmds {
+   CNTL_RESET_EC = 0x00,
+   CNTL_SELF_TEST = 0x01,
+   CNTL_NOOP = 0x02,
+   CNTL_GET_EC_SPEC_VER = 0x10,
+   CNTL_GET_FIRMWARE_VERSION = 0x15,
+};
+
+enum nvec_sleep_subcmds {
+   GLOBAL_EVENTS,
+   AP_PWR_DOWN,
+   AP_SUSPEND,
+};
+
+enum ps2_subcmds {
+   MOUSE_SEND_CMD = 0x01
+};
+
+#define MOUSE_RESET 0xff
+
+typedef int (*periph_start)(void);
+typedef int (*periph_process_msg)(const unsigned char *);
+
+struct nvec_periph {
+   periph_startstart;
+   periph_process_msg  process_msg;
+};
+
+
+int board_nvec_init(void);
+
+/**
+ * Read all available events.
+ *
+ * @return count of available events if ok, -1 on error
+ */
+int nvec_read_events(void);
+
+int nvec_msg_is_event(const unsigned char *msg);
+int nvec_msg_event_type(const unsigned char *msg);
+
+/**
+ * Register perepherial device driver.
+ *
+ * @param msg_type type of messages that divece processes.
+ * @param periph   pointer to device description.
+ *
+ * @return 0 if ok, -1 on error
+ */
+int nvec_register_periph(int msg_type, struct nvec_periph *periph);
+
+/**
+ * Send request and read response. If write or read failed
+ * operation will be repeated NVEC_ATTEMPTS_MAX times.
+ *
+ * @param buf  request data
+ * @param size request data size
+ * @return 0 if ok, -1 on error
+ */
+int nvec_do_request(char *buf, int size);
+
+
+#endif /* _TEGRA_NVEC_H_ */
diff --git a/board/nvidia/common/board.c b/board/nvidia/common/board.c
index 3b18e28..6d3055c 100644
--- a/board/nvidia/common/board.c
+++ b/board/nvidia/common/board.c
@@ -38,6 +38,9 @@
 #include asm/arch-tegra/tegra_mmc.h
 #include asm/arch-tegra/mmc.h
 #endif
+#ifdef CONFIG_SYS_I2C_TEGRA_NVEC
+#include asm/arch-tegra/tegra_nvec.h
+#endif
 #include i2c.h
 #include spi.h
 #include emc.h
@@ -194,10 +197,19 @@ int board_early_init_f(void)
 
 int board_late_init(void)
 {
+   __maybe_unused int err;
+
 #ifdef CONFIG_LCD
/* Make sure we finish initing the LCD */
tegra_lcd_check_next_stage(gd-fdt_blob, 1);
 #endif
+
+#ifdef CONFIG_SYS_I2C_TEGRA_NVEC
+   err = board_nvec_init();
+   if (err)
+   debug(NVEC controller init failed: %d\n, err);
+#endif
+
return 0;
 }
 
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index fa3a875..3041191 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -27,4 +27,5 @@ obj-$(CONFIG_SYS_I2C_S3C24X0) += 

[U-Boot] [PATCH v2 4/6] ARM: tegra: nvec: add keyboard support

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: ac...@lists.launchpad.net
---
 Changes for v2:
- fixed incorrect keys handling in nvec-keyboard driver

 .../include/asm/arch-tegra/tegra_nvec_keyboard.h   |  304 
 drivers/input/Makefile |3 +
 drivers/input/tegra-nvec-kbc.c |  215 ++
 include/configs/tegra-common-post.h|2 +
 4 files changed, 524 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-tegra/tegra_nvec_keyboard.h
 create mode 100644 drivers/input/tegra-nvec-kbc.c

diff --git a/arch/arm/include/asm/arch-tegra/tegra_nvec_keyboard.h 
b/arch/arm/include/asm/arch-tegra/tegra_nvec_keyboard.h
new file mode 100644
index 000..5f789f4
--- /dev/null
+++ b/arch/arm/include/asm/arch-tegra/tegra_nvec_keyboard.h
@@ -0,0 +1,304 @@
+/*
+ * (C) Copyright 2014
+ * Andrey Danin danind...@mail.ru
+ * (C) Copyright 2009
+ * NVIDIA Corporation.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _TEGRA_NVEC_KEYBOARD_H_
+#define _TEGRA_NVEC_KEYBOARD_H_
+
+#include linux/input.h
+
+
+/* Keytables */
+
+static unsigned short code_tab_102us[] = {
+   /* 0x00 */
+   KEY_GRAVE,
+   KEY_ESC,
+   KEY_1,
+   KEY_2,
+   KEY_3,
+   KEY_4,
+   KEY_5,
+   KEY_6,
+   KEY_7,
+   KEY_8,
+   KEY_9,
+   KEY_0,
+   KEY_MINUS,
+   KEY_EQUAL,
+   KEY_BACKSPACE,
+   KEY_TAB,
+   /* 0x10 */
+   KEY_Q,
+   KEY_W,
+   KEY_E,
+   KEY_R,
+   KEY_T,
+   KEY_Y,
+   KEY_U,
+   KEY_I,
+   KEY_O,
+   KEY_P,
+   KEY_LEFTBRACE,
+   KEY_RIGHTBRACE,
+   KEY_ENTER,
+   KEY_LEFTCTRL,
+   KEY_A,
+   KEY_S,
+   /* 0x20 */
+   KEY_D,
+   KEY_F,
+   KEY_G,
+   KEY_H,
+   KEY_J,
+   KEY_K,
+   KEY_L,
+   KEY_SEMICOLON,
+   KEY_APOSTROPHE,
+   KEY_GRAVE,
+   KEY_LEFTSHIFT,
+   KEY_BACKSLASH,
+   KEY_Z,
+   KEY_X,
+   KEY_C,
+   KEY_V,
+   /* 0x30 */
+   KEY_B,
+   KEY_N,
+   KEY_M,
+   KEY_COMMA,
+   KEY_DOT,
+   KEY_SLASH,
+   KEY_RIGHTSHIFT,
+   KEY_KPASTERISK,
+   KEY_LEFTALT,
+   KEY_SPACE,
+   KEY_CAPSLOCK,
+   KEY_F1,
+   KEY_F2,
+   KEY_F3,
+   KEY_F4,
+   KEY_F5,
+   /* 0x40 */
+   KEY_F6,
+   KEY_F7,
+   KEY_F8,
+   KEY_F9,
+   KEY_F10,
+   KEY_FN,
+   /* VK_SCROLL */
+   0,
+   KEY_KP7,
+   KEY_KP8,
+   KEY_KP9,
+   KEY_KPMINUS,
+   KEY_KP4,
+   KEY_KP5,
+   KEY_KP6,
+   KEY_KPPLUS,
+   KEY_KP1,
+   /* 0x50 */
+   KEY_KP2,
+   KEY_KP3,
+   KEY_KP0,
+   KEY_KPDOT,
+   /* VK_SNAPSHOT */
+   0, /* KEY_MENU, */
+   KEY_POWER,
+   /* VK_OEM_102 */
+   KEY_102ND,
+   KEY_F11,
+   KEY_F12,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   /* 0x60 */
+   0,
+   0,
+   0,
+   0, /* KEY_SEARCH, */
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   /* 0x70 */
+   0,
+   0,
+   0,
+   KEY_KP5,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   KEY_KP9,
+};
+
+static unsigned short extcode_tab_us102[] = {
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   /* 0x10 */
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   /* VK_MEDIA_NEXT_TRACK */
+   0,
+   0,
+   0,
+   /* VK_RETURN */
+   0,
+   KEY_RIGHTCTRL,
+   0,
+   0,
+   /* 0x20 */
+   KEY_MUTE,
+   /* VK_LAUNCH_APP1 */
+   0,
+   /* VK_MEDIA_PLAY_PAUSE */
+   0,
+   0,
+   /* VK_MEDIA_STOP */
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   0,
+   /* 0x30 */
+   KEY_VOLUMEUP,
+   0,
+   /* VK_BROWSER_HOME */
+   0,
+   0,
+   0,
+   /* VK_DIVIDE */
+   KEY_KPSLASH,
+   0,
+   /* VK_SNAPSHOT */
+   KEY_SYSRQ,
+   /* VK_RMENU */
+   KEY_RIGHTALT,
+   /* VK_OEM_NV_BACKLIGHT_UP */
+   0,
+   /* VK_OEM_NV_BACKLIGHT_DN */
+   0,
+   /* VK_OEM_NV_BACKLIGHT_AUTOTOGGLE */
+   0,
+   /* VK_OEM_NV_POWER_INFO */
+   0,
+   /* VK_OEM_NV_WIFI_TOGGLE */
+   0,
+   /* VK_OEM_NV_DISPLAY_SELECT */
+   0,
+   /* VK_OEM_NV_AIRPLANE_TOGGLE */
+   0,
+   /* 0x40 */
+   0,
+   KEY_LEFT,
+   0,
+   0,
+   0,
+   0,
+   0, /* 

[U-Boot] [PATCH v2 0/6] ARM: tegra: add nvec keyboard support for paz00

2014-04-27 Thread Andrey Danin
This patch series introduces keyboard support for AC100 (board paz00).

 I2C slave mode was implemented for i2c core and tegra-i2c.

 NVEC code from linux kernel was reworked to use tegra-i2c driver.

 Keytable header file is copied from linux kernel but modified
 to fix styles and remove unused code.

 Based on u-boot-tegra/next.

CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: devicet...@vger.kernel.org
CC: ac...@lists.launchpad.net
---
 Changes for v2:
- I2C slave mode for i2c-core and tegra-i2c implemented
- Fixed NVEC dt bindings 
- NVEC driver was reworked to use tegra-i2c
- fixed incorrect keys handling in nvec-keyboard driver
- patch is splitted to smaller parts

Andrey Danin (6):
  i2c: add slave mode support
  ARM: tegra: i2c: add slave mode support
  ARM: tegra: i2c: add nvec driver
  ARM: tegra: nvec: add keyboard support
  ARM: tegra: paz00: add dt bindings for nvec
  ARM: tegra: paz00: enable nvec keyboard

 arch/arm/include/asm/arch-tegra/tegra_i2c.h|6 +
 arch/arm/include/asm/arch-tegra/tegra_nvec.h   |  130 +
 .../include/asm/arch-tegra/tegra_nvec_keyboard.h   |  304 
 board/compal/dts/tegra20-paz00.dts |8 +-
 board/nvidia/common/board.c|   12 +
 drivers/i2c/Makefile   |1 +
 drivers/i2c/i2c_core.c |   13 +
 drivers/i2c/tegra_i2c.c|  199 -
 drivers/i2c/tegra_nvec.c   |  294 +++
 drivers/input/Makefile |3 +
 drivers/input/tegra-nvec-kbc.c |  215 ++
 include/configs/paz00.h|9 +
 include/configs/tegra-common-post.h|2 +
 include/fdtdec.h   |1 +
 include/i2c.h  |   30 +-
 lib/fdtdec.c   |1 +
 16 files changed, 1223 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-tegra/tegra_nvec.h
 create mode 100644 arch/arm/include/asm/arch-tegra/tegra_nvec_keyboard.h
 create mode 100644 drivers/i2c/tegra_nvec.c
 create mode 100644 drivers/input/tegra-nvec-kbc.c

-- 
1.7.9.5

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


[U-Boot] [PATCH v2 2/6] ARM: tegra: i2c: add slave mode support

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: ac...@lists.launchpad.net
---
 arch/arm/include/asm/arch-tegra/tegra_i2c.h |6 +
 drivers/i2c/tegra_i2c.c |  199 ++-
 2 files changed, 202 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/tegra_i2c.h 
b/arch/arm/include/asm/arch-tegra/tegra_i2c.h
index 853e59b..f818731 100644
--- a/arch/arm/include/asm/arch-tegra/tegra_i2c.h
+++ b/arch/arm/include/asm/arch-tegra/tegra_i2c.h
@@ -132,13 +132,19 @@ struct i2c_ctlr {
(1  DVC_CTRL_REG3_I2C_HW_SW_PROG_SHIFT)
 
 /* I2C_CNFG */
+#define I2C_CNFG_DEBOUNCE_CNT_SHIFT12
+#define I2C_CNFG_DEBOUNCE_CNT_MASK (0x2  I2C_CNFG_DEBOUNCE_CNT_SHIFT)
 #define I2C_CNFG_NEW_MASTER_FSM_SHIFT  11
 #define I2C_CNFG_NEW_MASTER_FSM_MASK   (1  I2C_CNFG_NEW_MASTER_FSM_SHIFT)
 #define I2C_CNFG_PACKET_MODE_SHIFT 10
 #define I2C_CNFG_PACKET_MODE_MASK  (1  I2C_CNFG_PACKET_MODE_SHIFT)
 
 /* I2C_SL_CNFG */
+#define I2C_SL_CNFG_RESP_SHIFT 0
+#define I2C_SL_CNFG_NACK_SHIFT 1
 #define I2C_SL_CNFG_NEWSL_SHIFT2
+#define I2C_SL_CNFG_IRQ_SHIFT  3
+#define I2C_SL_CNFG_END_TRANS_SHIFT4
 #define I2C_SL_CNFG_NEWSL_MASK (1  I2C_SL_CNFG_NEWSL_SHIFT)
 
 /* I2C_FIFO_STATUS */
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 594e5dd..287a5df 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -22,6 +22,7 @@ DECLARE_GLOBAL_DATA_PTR;
 /* Information about i2c controller */
 struct i2c_bus {
int id;
+   int node;
enum periph_id  periph_id;
int speed;
int pinmux_config;
@@ -30,10 +31,31 @@ struct i2c_bus {
int is_dvc; /* DVC type, rather than I2C */
int is_scs; /* single clock source (T114+) */
int inited; /* bus is inited */
+   int slave_addr;
 };
 
 static struct i2c_bus i2c_controllers[TEGRA_I2C_NUM_CONTROLLERS];
 
+/**
+ * Init i2c controller to operate in slave mode.
+ *
+ * @param bus  i2c bus/controller state struct
+ */
+static void set_slave_mode(struct i2c_bus *bus)
+{
+   unsigned long val;
+
+   val = I2C_CNFG_NEW_MASTER_FSM_MASK | I2C_CNFG_PACKET_MODE_MASK |
+   I2C_CNFG_DEBOUNCE_CNT_MASK;
+   writel(val, bus-regs-cnfg);
+
+   writel(I2C_SL_CNFG_NEWSL_MASK, bus-regs-sl_cnfg);
+   writel(0x1E, bus-regs-sl_delay_count);
+
+   writel(bus-slave_addr  1, bus-regs-sl_addr1);
+   writel(0, bus-regs-sl_addr2);
+}
+
 static void set_packet_mode(struct i2c_bus *i2c_bus)
 {
u32 config;
@@ -59,8 +81,12 @@ static void i2c_reset_controller(struct i2c_bus *i2c_bus)
/* Reset I2C controller. */
reset_periph(i2c_bus-periph_id, 1);
 
-   /* re-program config register to packet mode */
-   set_packet_mode(i2c_bus);
+   if (i2c_bus-slave_addr == 0) {
+   /* re-program config register to packet mode */
+   set_packet_mode(i2c_bus);
+   } else {
+   set_slave_mode(i2c_bus);
+   }
 }
 
 static void i2c_init_controller(struct i2c_bus *i2c_bus)
@@ -193,6 +219,121 @@ static int wait_for_transfer_complete(struct i2c_control 
*control)
return -1;
 }
 
+
+#define I2C_SL_IRQ (13)
+#define END_TRANS  (14)
+#define RCVD   (12)
+#define RNW(11)
+
+
+static inline int is_ready(unsigned long status)
+{
+   return status  I2C_SL_IRQ;
+}
+
+static inline int is_read(unsigned long status)
+{
+   return (status  RNW) == 0;
+}
+
+static inline int is_trans_start(unsigned long status)
+{
+   return status  RCVD;
+}
+
+static inline int is_trans_end(unsigned long status)
+{
+   return status  END_TRANS;
+}
+
+
+/**
+ * Send or receive packet in slave mode.
+ *
+ * @param i2c_bus  pointer to bus structure
+ * @param transI2C transaction object
+ *
+ * @return 0 if succeeded,
+ * 1 if not ready,
+ * 2 if operation timed out,
+ * 3 if not our packet,
+ * other - unknown error.
+ */
+static int slave_send_recv_packets(struct i2c_bus *i2c_bus,
+  struct i2c_transaction *trans)
+{
+   unsigned int poll_start_ms = 0;
+   unsigned long status;
+
+   unsigned int received = 0;
+   unsigned int to_send = 0;
+   unsigned int timer_ms = 0;
+   int addr = -1;
+
+   poll_start_ms = get_timer(0);
+
+   while (1) {
+   status = readl(i2c_bus-regs-sl_status);
+   if (!is_ready(status)) {
+   timer_ms = get_timer(poll_start_ms);
+   if (addr != i2c_bus-slave_addr 
+

[U-Boot] [PATCH v2 5/6] ARM: tegra: paz00: add dt bindings for nvec

2014-04-27 Thread Andrey Danin
Signed-off-by: Andrey Danin danind...@mail.ru
CC: Stephen Warren swar...@nvidia.com
CC: Marc Dietrich marvi...@gmx.de
CC: Julian Andres Klode j...@jak-linux.org
CC: devicet...@vger.kernel.org
CC: ac...@lists.launchpad.net
---
 Changes for v2:
- Separated from enabling keyboard patch
- Changed NVEC dt bindings 

 arch/arm/dts/tegra20-paz00.dts |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/dts/tegra20-paz00.dts b/arch/arm/dts/tegra20-paz00.dts
index 780203c..9906f3a 100644
--- a/arch/arm/dts/tegra20-paz00.dts
+++ b/arch/arm/dts/tegra20-paz00.dts
@@ -40,7 +40,13 @@
};
 
i2c@7000c500 {
-   status = disabled;
+   status = okay;
+   clock-frequency = 4;
+   slave-addr = 138;
+   nvec {
+   compatible = nvidia,tegra20-nvec;
+   request-gpios = gpio 170 0; /* gpio PV2 */
+   };
};
 
i2c@7000d000 {
-- 
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/3] cm_t54: add MAC address and env partiton handling

2014-04-27 Thread Dmitry Lifshitz
Add Eth MAC address handling, stored in onboard EEPROM.

cm-t54 config defines eMMC as env storage device.
cm-t54 U-Boot environment is stored in the same partition as boot loader.
It can be both - eMMC boot or user data partition.
Add support for setting environment partition number in runtime.

Dmitry Lifshitz (3):
  cm-t54: add EEPROM support and MAC address handling
  env_mmc: support env partition setup in runtime
  cm-t54: add environment partition runtime detection

 board/compulab/cm_t54/cm_t54.c |   85 
 common/env_mmc.c   |   35 
 include/configs/cm_t54.h   |   10 +
 3 files changed, 121 insertions(+), 9 deletions(-)

-- 
1.7.5.4

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


[U-Boot] [PATCH 4/4] cm-t54: add cm-t54 board support

2014-04-27 Thread Dmitry Lifshitz
Add cm-t54 board directory, config file. Enable build.

Basic support includes:

Serial console
SD/MMC
eMMC
USB
Ethernet

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
Acked-by: Igor Grinberg grinb...@compulab.co.il
---
 board/compulab/cm_t54/Makefile |   10 ++
 board/compulab/cm_t54/cm_t54.c |  177 
 board/compulab/cm_t54/mux.c|   94 +
 board/compulab/cm_t54/spl.c|   66 +++
 boards.cfg |1 +
 include/configs/cm_t54.h   |  144 
 6 files changed, 492 insertions(+), 0 deletions(-)
 create mode 100644 board/compulab/cm_t54/Makefile
 create mode 100644 board/compulab/cm_t54/cm_t54.c
 create mode 100644 board/compulab/cm_t54/mux.c
 create mode 100644 board/compulab/cm_t54/spl.c
 create mode 100644 include/configs/cm_t54.h

diff --git a/board/compulab/cm_t54/Makefile b/board/compulab/cm_t54/Makefile
new file mode 100644
index 000..bd8bc51
--- /dev/null
+++ b/board/compulab/cm_t54/Makefile
@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2014 Compulab Ltd - http://compulab.co.il/
+#
+# Author: Dmitry Lifshitz lifsh...@compulab.co.il
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += $(BOARD).o
+obj-$(CONFIG_SPL_BUILD) += mux.o spl.o
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
new file mode 100644
index 000..1a4be72
--- /dev/null
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -0,0 +1,177 @@
+/*
+ * Board functions for Compulab CM-T54 board
+ *
+ * Copyright (C) 2014, Compulab Ltd - http://compulab.co.il/
+ *
+ * Author: Dmitry Lifshitz lifsh...@compulab.co.il
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include common.h
+#include usb.h
+#include mmc.h
+#include palmas.h
+
+#include asm/gpio.h
+#include asm/arch/sys_proto.h
+#include asm/arch/mmc_host_def.h
+#include asm/arch/clock.h
+#include asm/arch/ehci.h
+#include asm/ehci-omap.h
+
+#define DIE_ID_REG_BASE(OMAP54XX_L4_CORE_BASE + 0x2000)
+#define DIE_ID_REG_OFFSET  0x200
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#if !defined(CONFIG_SPL_BUILD)
+inline void set_muxconf_regs_essential(void){};
+#endif
+
+const struct omap_sysinfo sysinfo = {
+   Board: CM-T54\n
+};
+
+/*
+ * Routine: board_init
+ * Description: hardware init.
+ */
+int board_init(void)
+{
+   gd-bd-bi_boot_params = (0x8000 + 0x100); /* boot param addr */
+
+   return 0;
+}
+
+/*
+ * Routine: cm_t54_palmas_regulator_set
+ * Description:  select voltage and turn on/off Palmas PMIC regulator.
+ */
+static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 creg, u8 cval)
+{
+   int err;
+
+   /* Setup voltage */
+   err = palmas_i2c_write_u8(TWL603X_CHIP_P1, vreg, vval);
+   if (err) {
+   printf(cm_t54: could not set regulator 0x%02x voltage : %d\n,
+  vreg, err);
+   return err;
+   }
+
+   /* Turn on/off regulator */
+   err = palmas_i2c_write_u8(TWL603X_CHIP_P1, creg, cval);
+   if (err) {
+   printf(cm_t54: could not turn on/off regulator 0x%02x : %d\n,
+  creg, err);
+   return err;
+   }
+
+   return 0;
+}
+
+#if defined(CONFIG_GENERIC_MMC)  !defined(CONFIG_SPL_BUILD)
+#define SB_T54_CD_GPIO 228
+#define SB_T54_WP_GPIO 229
+
+int board_mmc_getcd(struct mmc *mmc)
+{
+   return !gpio_get_value(SB_T54_CD_GPIO);
+}
+
+int board_mmc_init(bd_t *bis)
+{
+   int ret0, ret1;
+
+   ret0 = omap_mmc_init(0, 0, 0, -1, SB_T54_WP_GPIO);
+   if (ret0)
+   printf(cm_t54: failed to initialize mmc0\n);
+
+   ret1 = omap_mmc_init(1, 0, 0, -1, -1);
+   if (ret1)
+   printf(cm_t54: failed to initialize mmc1\n);
+
+   if (ret0  ret1)
+   return -1;
+
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_USB_EHCI
+static struct omap_usbhs_board_data usbhs_bdata = {
+   .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
+   .port_mode[1] = OMAP_EHCI_PORT_MODE_HSIC,
+   .port_mode[2] = OMAP_EHCI_PORT_MODE_HSIC,
+};
+
+static void setup_host_clocks(bool enable)
+{
+   int usbhost_clk = OPTFCLKEN_HSIC60M_P3_CLK |
+ OPTFCLKEN_HSIC480M_P3_CLK |
+ OPTFCLKEN_HSIC60M_P2_CLK |
+ OPTFCLKEN_HSIC480M_P2_CLK |
+ OPTFCLKEN_UTMI_P3_CLK |
+ OPTFCLKEN_UTMI_P2_CLK;
+
+   int usbtll_clk = OPTFCLKEN_USB_CH1_CLK_ENABLE |
+OPTFCLKEN_USB_CH2_CLK_ENABLE;
+
+   int usbhub_clk = CKOBUFFER_CLK_ENABLE_MASK;
+
+   if (enable) {
+   /* Enable port 2 and 3 clocks*/
+   setbits_le32((*prcm)-cm_l3init_hsusbhost_clkctrl, usbhost_clk);
+   /* Enable port 2 and 3 usb host ports tll clocks*/
+   setbits_le32((*prcm)-cm_l3init_hsusbtll_clkctrl, usbtll_clk);
+   /* Request FREF_XTAL_CLK clock for HSIC USB Hub */
+   

[U-Boot] [PATCH 3/3] cm-t54: add environment partition runtime detection

2014-04-27 Thread Dmitry Lifshitz
Add environment partition runtime detection callback.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
Acked-by: Igor Grinberg grinb...@compulab.co.il
---
 board/compulab/cm_t54/cm_t54.c |   22 ++
 include/configs/cm_t54.h   |1 +
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 574ced2..11e77f9 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -13,6 +13,7 @@
 #include usb.h
 #include mmc.h
 #include palmas.h
+#include spl.h
 
 #include asm/gpio.h
 #include asm/arch/sys_proto.h
@@ -74,6 +75,27 @@ static int cm_t54_palmas_regulator_set(u8 vreg, u8 vval, u8 
creg, u8 cval)
return 0;
 }
 
+/*
+ * Routine: mmc_get_env_part
+ * Description:  setup environment storage device partition.
+ */
+#ifdef CONFIG_SYS_MMC_ENV_PART
+uint mmc_get_env_part(struct mmc *mmc)
+{
+   u32 bootmode = gd-arch.omap_boot_params.omap_bootmode;
+   uint bootpart = CONFIG_SYS_MMC_ENV_PART;
+
+   /*
+* If booted from eMMC boot partition then force eMMC
+* FIRST boot partition to be env storage
+*/
+   if (bootmode == BOOT_DEVICE_MMC2_2)
+   bootpart = 1;
+
+   return bootpart;
+}
+#endif
+
 #if defined(CONFIG_GENERIC_MMC)  !defined(CONFIG_SPL_BUILD)
 #define SB_T54_CD_GPIO 228
 #define SB_T54_WP_GPIO 229
diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h
index 8d474f0..680aac3 100644
--- a/include/configs/cm_t54.h
+++ b/include/configs/cm_t54.h
@@ -49,6 +49,7 @@
 
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV 1   /* SLOT2: eMMC(1) */
+#define CONFIG_SYS_MMC_ENV_PART0
 #define CONFIG_ENV_OFFSET  0xc /* (in bytes) 768 KB */
 #define CONFIG_ENV_SIZE(16  10)  /* 16 KB */
 #define CONFIG_ENV_OFFSET_REDUND   (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE)
-- 
1.7.5.4

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


[U-Boot] [PATCH 1/4] ARM: OMAP5: add UART4 support

2014-04-27 Thread Dmitry Lifshitz
Add UART4 base address.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
---
 arch/arm/include/asm/arch-omap5/omap.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap5/omap.h 
b/arch/arm/include/asm/arch-omap5/omap.h
index 19fdece..e35a81a 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -50,6 +50,7 @@
 #define UART1_BASE (OMAP54XX_L4_PER_BASE + 0x6a000)
 #define UART2_BASE (OMAP54XX_L4_PER_BASE + 0x6c000)
 #define UART3_BASE (OMAP54XX_L4_PER_BASE + 0x2)
+#define UART4_BASE (OMAP54XX_L4_PER_BASE + 0x6e000)
 
 /* General Purpose Timers */
 #define GPT1_BASE  (OMAP54XX_L4_WKUP_BASE + 0x18000)
-- 
1.7.5.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: support env partition setup in runtime

2014-04-27 Thread Dmitry Lifshitz
Add callback with __weak annotation to allow setup of environment
partition number in runtime from a board file.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
Signed-off-by: Igor Grinberg grinb...@compulab.co.il
---
 common/env_mmc.c |   35 ++-
 1 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/common/env_mmc.c b/common/env_mmc.c
index 045428c..5d4b5f4 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -62,6 +62,30 @@ int env_init(void)
return 0;
 }
 
+
+#ifdef CONFIG_SYS_MMC_ENV_PART
+__weak uint mmc_get_env_part(struct mmc *mmc)
+{
+   return CONFIG_SYS_MMC_ENV_PART;
+}
+
+static int mmc_set_env_part(struct mmc *mmc)
+{
+   uint part = mmc_get_env_part(mmc);
+
+   if (part != mmc-part_num) {
+   if (mmc_switch_part(CONFIG_SYS_MMC_ENV_DEV, part)) {
+   puts(MMC partition switch failed\n);
+   return -1;
+   }
+   }
+
+   return 0;
+}
+#else
+static inline int mmc_set_env_part(struct mmc *mmc) {return 0; };
+#endif
+
 static int init_mmc_for_env(struct mmc *mmc)
 {
if (!mmc) {
@@ -74,15 +98,8 @@ 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
+   if (mmc_set_env_part(mmc))
+   return -1;
 
return 0;
 }
-- 
1.7.5.4

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


[U-Boot] [PATCH 0/4] ARM: OMAP5: add cm-t54 board support

2014-04-27 Thread Dmitry Lifshitz
Add support for CompuLab cm-t54 CoM, based on OMAP5432 CPU.

http://compulab.co.il/products/computer-on-modules/cm-t54/

Basic support includes:

* Boot from MMC/SD and eMMC
* USB
* LAN

Dmitry Lifshitz (4):
  ARM: OMAP5: add UART4 support
  ARM: OMAP5: Power: add LDO2 support for Palmas driver
  ARM: OMAP5: add CKO buffer control mask
  cm-t54: add cm-t54 board support

 arch/arm/include/asm/arch-omap5/clock.h |3 +
 arch/arm/include/asm/arch-omap5/omap.h  |1 +
 board/compulab/cm_t54/Makefile  |   10 ++
 board/compulab/cm_t54/cm_t54.c  |  177 +++
 board/compulab/cm_t54/mux.c |   94 
 board/compulab/cm_t54/spl.c |   66 
 boards.cfg  |1 +
 include/configs/cm_t54.h|  144 +
 include/palmas.h|4 +
 9 files changed, 500 insertions(+), 0 deletions(-)
 create mode 100644 board/compulab/cm_t54/Makefile
 create mode 100644 board/compulab/cm_t54/cm_t54.c
 create mode 100644 board/compulab/cm_t54/mux.c
 create mode 100644 board/compulab/cm_t54/spl.c
 create mode 100644 include/configs/cm_t54.h

-- 
1.7.5.4

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


[U-Boot] [PATCH 3/4] ARM: OMAP5: add CKO buffer control mask

2014-04-27 Thread Dmitry Lifshitz
Add CKOBUFFER_CLK_EN bit mask enabling FREF_XTAL_CLK clock.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
---
 arch/arm/include/asm/arch-omap5/clock.h |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/arm/include/asm/arch-omap5/clock.h 
b/arch/arm/include/asm/arch-omap5/clock.h
index 2dfe4ef..30d9de2 100644
--- a/arch/arm/include/asm/arch-omap5/clock.h
+++ b/arch/arm/include/asm/arch-omap5/clock.h
@@ -322,6 +322,9 @@
 
 #define V_SCLK V_OSCK
 
+/* CKO buffer control */
+#define CKOBUFFER_CLK_ENABLE_MASK  (1  28)
+
 /* AUXCLKx reg fields */
 #define AUXCLK_ENABLE_MASK (1  8)
 #define AUXCLK_SRCSELECT_SHIFT 1
-- 
1.7.5.4

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


[U-Boot] [PATCH 2/4] ARM: OMAP5: Power: add LDO2 support for Palmas driver

2014-04-27 Thread Dmitry Lifshitz
Add defines required to turn on LDO2 regulator.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
---
 include/palmas.h |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/palmas.h b/include/palmas.h
index eaf3670..cca3f9a 100644
--- a/include/palmas.h
+++ b/include/palmas.h
@@ -24,6 +24,10 @@
 #define LDO1_CTRL  0x50
 #define LDO1_VOLTAGE   0x51
 
+/* LDO2 control/voltage */
+#define LDO2_CTRL  0x52
+#define LDO2_VOLTAGE   0x53
+
 /* LDO9 control/voltage */
 #define LDO9_CTRL  0x60
 #define LDO9_VOLTAGE   0x61
-- 
1.7.5.4

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


[U-Boot] [PATCH 1/3] cm-t54: add EEPROM support and MAC address handling

2014-04-27 Thread Dmitry Lifshitz
cm-t54 Eth MAC address is stored in onboard EEPROM.
Add EEPROM support and setup stored Eth MAC address.

If EEPROM does not contain a valid MAC, then generate it from the
processor ID code (reference code is taken from OMAP5 uEvm board file).

Modify Device Tree blob MAC address field with retrieved data.

Signed-off-by: Dmitry Lifshitz lifsh...@compulab.co.il
Acked-by: Igor Grinberg grinb...@compulab.co.il
---
 board/compulab/cm_t54/cm_t54.c |   63 
 include/configs/cm_t54.h   |9 ++
 2 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 1a4be72..574ced2 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -9,6 +9,7 @@
  */
 
 #include common.h
+#include fdt_support.h
 #include usb.h
 #include mmc.h
 #include palmas.h
@@ -20,6 +21,8 @@
 #include asm/arch/ehci.h
 #include asm/ehci-omap.h
 
+#include ../common/eeprom.h
+
 #define DIE_ID_REG_BASE(OMAP54XX_L4_CORE_BASE + 0x2000)
 #define DIE_ID_REG_OFFSET  0x200
 
@@ -99,6 +102,66 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_USB_HOST_ETHER
+
+void ft_board_setup(void *blob, bd_t *bd)
+{
+   uint8_t enetaddr[6];
+
+   /* MAC addr */
+   if (eth_getenv_enetaddr(usbethaddr, enetaddr)) {
+   fdt_find_and_setprop(blob, /smsc95xx@0, mac-address,
+enetaddr, 6, 1);
+   }
+}
+
+static void generate_mac_addr(uint8_t *enetaddr)
+{
+   int reg;
+
+   reg = DIE_ID_REG_BASE + DIE_ID_REG_OFFSET;
+
+   /*
+* create a fake MAC address from the processor ID code.
+* first byte is 0x02 to signify locally administered.
+*/
+   enetaddr[0] = 0x02;
+   enetaddr[1] = readl(reg + 0x10)  0xff;
+   enetaddr[2] = readl(reg + 0xC)  0xff;
+   enetaddr[3] = readl(reg + 0x8)  0xff;
+   enetaddr[4] = readl(reg)  0xff;
+   enetaddr[5] = (readl(reg)  8)  0xff;
+}
+
+/*
+ * Routine: handle_mac_address
+ * Description: prepare MAC address for on-board Ethernet.
+ */
+static int handle_mac_address(void)
+{
+   uint8_t enetaddr[6];
+   int ret;
+
+   ret = eth_getenv_enetaddr(usbethaddr, enetaddr);
+   if (ret)
+   return 0;
+
+   ret = cl_eeprom_read_mac_addr(enetaddr);
+   if (!ret || !is_valid_ether_addr(enetaddr))
+   generate_mac_addr(enetaddr);
+
+   if (!is_valid_ether_addr(enetaddr))
+   return -1;
+
+   return eth_setenv_enetaddr(usbethaddr, enetaddr);
+}
+
+int board_eth_init(bd_t *bis)
+{
+   return handle_mac_address();
+}
+#endif
+
 #ifdef CONFIG_USB_EHCI
 static struct omap_usbhs_board_data usbhs_bdata = {
.port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
diff --git a/include/configs/cm_t54.h b/include/configs/cm_t54.h
index 3ca229b..8d474f0 100644
--- a/include/configs/cm_t54.h
+++ b/include/configs/cm_t54.h
@@ -19,6 +19,15 @@
 #undef CONFIG_MISC_INIT_R
 #undef CONFIG_SPL_OS_BOOT
 
+/* Device Tree defines */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
+
+/* EEPROM related defines */
+#define CONFIG_SYS_I2C_OMAP34XX
+#define CONFIG_SYS_I2C_EEPROM_ADDR 0x50
+#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
+
 /* Enable SD/MMC CD and WP GPIOs */
 #define OMAP_HSMMC_USE_GPIO
 
-- 
1.7.5.4

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


Re: [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length

2014-04-27 Thread Ian Campbell
On Sat, 2014-04-26 at 20:28 +0200, Marek Vasut wrote:
 On Friday, April 18, 2014 at 08:05:50 PM, Ian Campbell wrote:
  From: Jens Kuske jensku...@gmail.com
  
  The GMAC module in Allwinner sunxi SoCs seems to have problems with
  burst lengths  8.
 
 Is there any explanation for the problems please ?

Jens or Wens, can you answer this?

Ian.


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


Re: [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length

2014-04-27 Thread Chen-Yu Tsai
On Sun, Apr 27, 2014 at 11:25 PM, Ian Campbell i...@hellion.org.uk wrote:
 On Sat, 2014-04-26 at 20:28 +0200, Marek Vasut wrote:
 On Friday, April 18, 2014 at 08:05:50 PM, Ian Campbell wrote:
  From: Jens Kuske jensku...@gmail.com
 
  The GMAC module in Allwinner sunxi SoCs seems to have problems with
  burst lengths  8.

 Is there any explanation for the problems please ?

 Jens or Wens, can you answer this?

IIRC, with burst lengths  8, GMAC doesn't work, no ping, no DHCP.
I don't remember if it was TX or RX that suffered, or even both.

Hope this clarifies things a bit.


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


Re: [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support

2014-04-27 Thread Ian Campbell
On Sat, 2014-04-26 at 20:41 +0200, Marek Vasut wrote:
  +#define CONFIG_CMD_SNTP
 
 Do you really need this ?

Doubtful, sunxi doesn't enable (or support) CONFIG_CMD_DATE so SNTP
doesn't even do anything. I'll drop it.

  +#define CONFIG_TIMESTAMP /* Needed by SNTP */
  +#define CONFIG_CMD_DNS
  +#define CONFIG_NETCONSOLE
  +#define CONFIG_BOOTP_NISDOMAIN
  +#define CONFIG_BOOTP_BOOTFILESIZE
  +#define CONFIG_BOOTP_DNS2
  +#define CONFIG_BOOTP_SEND_HOSTNAME
  +#define CONFIG_BOOTP_NTPSERVER
  +#define CONFIG_BOOTP_TIMEOFFSET
  +#define CONFIG_BOOTP_MAY_FAIL
  +#define CONFIG_BOOTP_SERVERIP
  +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY  5
 
 Just delete this BOOTP nonsense.

All of them? I'm thinking of keeping SEND_HOSTNAME which seems useful
(surprised it isn't in config_distro_defaults.h) and perhaps DNS2 (I
figure why not?).

The only other one I'm not sure about is BOOTFILESIZE -- it's widely
enabled but AFAICT is only logged and does nothing useful. I'm erring on
the side of dropping it.

Ian.


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


Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Ian Campbell
On Sat, 2014-04-26 at 20:46 +0200, Marek Vasut wrote:

  +#define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a)-1)
  +#define __ALIGN_MASK(x, mask) (((x)+(mask))~(mask))
 
 Isn't this already defined in include/common.h ?

Yes but it seems that header isn't usable by tools/* AFAICT. I get a
boatload of compiler errors when I try...

Ian.


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


Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Eric Nelson

Hi Eric,

On 04/27/2014 02:05 AM, Eric Bénard wrote:

Hi Otavio,

Le Sat, 26 Apr 2014 19:47:27 -0300,
Otavio Salvador ota...@ossystems.com.br a écrit :

I'd like to know if someone has succeed in using usbtty with i.MX6. I
am interested in using it for one board but been not succed, it seems:

/home/otavio/hacking/u-boot/drivers/serial/usbtty.c:553: undefined
reference to `udc_init'
drivers/serial/built-in.o: In function `usbtty_init_instances':
/home/otavio/hacking/u-boot/drivers/serial/usbtty.c:686: undefined
reference to `udc_setup_ep'
/home/otavio/hacking/u-boot/drivers/serial/usbtty.c:708: undefined
reference to `urb_link_init'
/home/otavio/hacking/u-boot/drivers/serial/usbtty.c:709: undefined
reference to `urb_link_init'
/home/otavio/hacking/u-boot/drivers/serial/usbtty.c:710: undefined
reference to `urb_link_init
...

Does someone got it working?


you need a gadget driver for the i.MX6 USB port which doesn't seems to
exist in u-boot.



We're using UDC on all of our i.MX6 board. Marek and Troy have had this
working for a while now.

I think the two key patches are these:
https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c

We've been using it a lot for USB networking, where it provides a
very nice download mechanism. See this post for details:
http://boundarydevices.com/u-boot-2014-01/#usbrecover

I think usbtty is a different thing though (USB serial adapter connected
to a Host port).

We haven't tested that, but it should work. Most of our USB Host uses
have been for USB sticks and keyboards.

Regards,


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


Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Michael Trimarchi
Hi

Il 27/apr/2014 19:57 Eric Nelson eric.nel...@boundarydevices.com ha
scritto:

 Hi Eric,


 On 04/27/2014 02:05 AM, Eric Bénard wrote:

 Hi Otavio,

 Le Sat, 26 Apr 2014 19:47:27 -0300,
 Otavio Salvador ota...@ossystems.com.br a écrit :

 I'd like to know if someone has succeed in using usbtty with i.MX6. I
 am interested in using it for one board but been not succed, it seems:

 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:553: undefined
 reference to `udc_init'
 drivers/serial/built-in.o: In function `usbtty_init_instances':
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:686: undefined
 reference to `udc_setup_ep'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:708: undefined
 reference to `urb_link_init'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:709: undefined
 reference to `urb_link_init'
 /home/otavio/hacking/u-boot/drivers/serial/usbtty.c:710: undefined
 reference to `urb_link_init
 ...

 Does someone got it working?

 you need a gadget driver for the i.MX6 USB port which doesn't seems to
 exist in u-boot.


 We're using UDC on all of our i.MX6 board. Marek and Troy have had this
 working for a while now.

 I think the two key patches are these:
 https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
 https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c

 We've been using it a lot for USB networking, where it provides a
 very nice download mechanism. See this post for details:
 http://boundarydevices.com/u-boot-2014-01/#usbrecover

 I think usbtty is a different thing though (USB serial adapter connected
 to a Host port).

usbtty should be a way to have the console on a gadget interface

Michael

 We haven't tested that, but it should work. Most of our USB Host uses
 have been for USB sticks and keyboards.

 Regards,



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


Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 07:00:34 PM, Ian Campbell wrote:
 On Sat, 2014-04-26 at 20:46 +0200, Marek Vasut wrote:
   +#define ALIGN(x, a) __ALIGN_MASK((x), (typeof(x))(a)-1)
   +#define __ALIGN_MASK(x, mask) (((x)+(mask))~(mask))
  
  Isn't this already defined in include/common.h ?
 
 Yes but it seems that header isn't usable by tools/* AFAICT. I get a
 boatload of compiler errors when I try...

There are a couple of things which include it even in tools/ :

# git grep common.h tools/
tools/patman/test.py: include/common.h|8 ++
tools/patman/test.py:+#include common.h
tools/scripts/define2mk.sed:# which preprocesses the common.h header files and 
outputs the final
tools/updater/cmd_flash.c:#include common.h
tools/updater/flash.c:#include common.h
tools/updater/flash_hw.c:#include common.h
tools/updater/update.c:#include common.h
tools/updater/utils.c:#include common.h

btw. I should have escaped the dot in common.h pattern, but whatever ...

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


Re: [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 05:29:29 PM, Chen-Yu Tsai wrote:
 On Sun, Apr 27, 2014 at 11:25 PM, Ian Campbell i...@hellion.org.uk wrote:
  On Sat, 2014-04-26 at 20:28 +0200, Marek Vasut wrote:
  On Friday, April 18, 2014 at 08:05:50 PM, Ian Campbell wrote:
   From: Jens Kuske jensku...@gmail.com
   
   The GMAC module in Allwinner sunxi SoCs seems to have problems with
   burst lengths  8.
  
  Is there any explanation for the problems please ?
  
  Jens or Wens, can you answer this?
 
 IIRC, with burst lengths  8, GMAC doesn't work, no ping, no DHCP.
 I don't remember if it was TX or RX that suffered, or even both.
 
 Hope this clarifies things a bit.

No, it does not at all, sorry. What you describe are symptoms, but what I want 
to know is what is the root cause of those symptoms. You did not explain that.

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


Re: [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 06:33:52 PM, Ian Campbell wrote:
 On Sat, 2014-04-26 at 20:41 +0200, Marek Vasut wrote:
   +#define CONFIG_CMD_SNTP
  
  Do you really need this ?
 
 Doubtful, sunxi doesn't enable (or support) CONFIG_CMD_DATE so SNTP
 doesn't even do anything. I'll drop it.
 
   +#define CONFIG_TIMESTAMP /* Needed by SNTP */
   +#define CONFIG_CMD_DNS
   +#define CONFIG_NETCONSOLE
   +#define CONFIG_BOOTP_NISDOMAIN
   +#define CONFIG_BOOTP_BOOTFILESIZE
   +#define CONFIG_BOOTP_DNS2
   +#define CONFIG_BOOTP_SEND_HOSTNAME
   +#define CONFIG_BOOTP_NTPSERVER
   +#define CONFIG_BOOTP_TIMEOFFSET
   +#define CONFIG_BOOTP_MAY_FAIL
   +#define CONFIG_BOOTP_SERVERIP
   +#define CONFIG_BOOTP_DHCP_REQUEST_DELAY  5
  
  Just delete this BOOTP nonsense.
 
 All of them? I'm thinking of keeping SEND_HOSTNAME which seems useful
 (surprised it isn't in config_distro_defaults.h) and perhaps DNS2 (I
 figure why not?).
 
 The only other one I'm not sure about is BOOTFILESIZE -- it's widely
 enabled but AFAICT is only logged and does nothing useful. I'm erring on
 the side of dropping it.

Do you use BOOTP at all ?

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


Re: [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support

2014-04-27 Thread Ian Campbell
On Sun, 2014-04-27 at 20:10 +0200, Marek Vasut wrote:
 Do you use BOOTP at all ?

Despite the names many of these options are related to both DHCP and
BOOTP. I imagine more people are using DHCP than BOOTP these days but I
don't know that I would rule out BOOTP.

Ian.



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


Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Ian Campbell
On Sun, 2014-04-27 at 20:07 +0200, Marek Vasut wrote:

 # git grep common.h tools/
 tools/patman/test.py: include/common.h|8 ++
 tools/patman/test.py:+#include common.h
 tools/scripts/define2mk.sed:# which preprocesses the common.h header files 
 and 
 outputs the final

I only got these three when I looked. I'm on v2014.04, but even with
current trunk I only see fit_common.h not the ones which you show below
(tools/updater isn't even in trunk). Perhaps this is some newer stuff
not yet in trunk?

 tools/updater/cmd_flash.c:#include common.h
 tools/updater/flash.c:#include common.h
 tools/updater/flash_hw.c:#include common.h
 tools/updater/update.c:#include common.h
 tools/updater/utils.c:#include common.h
 
 btw. I should have escaped the dot in common.h pattern, but whatever ...
 
 Best regards,
 Marek Vasut
 


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


Re: [U-Boot] [linux-sunxi] Uboot error: address not aligned in v7_dcache_inval_range

2014-04-27 Thread Ian Campbell
On Sat, 2014-04-26 at 20:27 +0200, Marek Vasut wrote:

 This was a sheer luck this ever worked. Looking at the entire driver, to fix 
 all 
 your issues with DMA and caches, it would be sufficient to re-align struct 
 dw_eth_dev properly.
 
 See drivers/net/designware.h:
 1) struct dmamacdescr {} is already __aligned(ARCH_DMA_MINALIGN)
= This structure, if aligned in memory to proper boundary, can be flushed/
   invalidated without problems.
 2) struct dw_eth_dev {} can be aligned to ANY 4-byte boundary
But this structure contains two arrays of struct dmamacdescr {} , which 
 each
have their elements' lenght aligned to ARCH_DMA_MINALIGN
 
 Solution:
 
 Your patch [1/3] and reorder the structure in designware.h so that the
 struct dmamacdescr tx_mac_descrtable[]
 struct dmamacdescr rx_mac_descrtable[]
 are first and anything that does not need to be aligned follows. This way, 
 the 
 DMA descriptors will always be aligned and you need not worry about the 
 flushes. 
 You don't even need to ROUNDUP their length, since they are already fine.

That sounds like a good plan. I'll take a look.

 When reordering the struct dw_eth_dev {}, make sure to add a comment about 
 the 
 alignment.

Of course.

Ian.



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


Re: [U-Boot] [PATCH 2/3] net/designware: invalidate entire descriptor in dw_eth_send

2014-04-27 Thread Ian Campbell
CCing the ARM custodian. Albert, what do you think of Alexey's comments
below? Actually, having read it properly myself I think Alexey is
confusing cache flushing with cache invalidation, I've left the CC in
place though in case you have any thoughts on the matter.

On Fri, 2014-04-25 at 08:48 +, Alexey Brodkin wrote:
 I thought a bit more about this situation and now I'm not that sure if
 we need to align addresses we pass to cache invalidate/flush functions.
 
 Because IMHO drivers shouldn't care about specifics of particular
 platform or architecture. Otherwise we'll need to patch each and every
 driver only for cache invalidate/flush functions. I looked how these
 functions are used in other drivers and see that in most of cases no
 additional alignment precautions were implemented. People just pass
 start and end addresses.
 
 In its turn platform and architecture provides cache invalidate/flush
 functions implement its functionality depending on hardware specifics.
 
 For example on architectures that may only flush/invalidate with
 granularity of 1 cache line cache invalidate/flush functions make sure
 to start processing from the start of the cache line to which start
 address falls and end processing when cache line where end address falls
 is processed.
 
 I may assume that there're architectures that automatically understand
 from which cache line to start and at which line to stop processing.
 
 But if your architecture requires cache line aligned addresses to be
 used for start/end addresses you may look for examples in ARC
 (http://git.denx.de/?p=u-boot/u-boot-arc.git;a=blob;f=arch/arc/cpu/arc700/cache.c),,
  MIPS 
 (http://git.denx.de/?p=u-boot/u-boot-arc.git;a=blob;f=arch/mips/cpu/mips32/cpu.c),
  SH 
 (http://git.denx.de/?p=u-boot/u-boot-arc.git;a=blob;f=arch/sh/cpu/sh4/cache.c),
 
 and what's interesting even implementation you use have semi-proper
 start/end addresses handling -
 http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/lib/cache-pl310.c

This is the driver for one particular ARM cache controller and not the
one used for the SoC. In any case it does proper start/end handling
only for cache flush operations, not cache invalidate.

Cache invalidate is a potentially destructive operation (throwing away
data in the caches), having it operate on anything more than the precise
region requested would be very surprising to almost anyone I think.

 
 Here's your invalidation procedure:
 
 /* invalidate memory from start to stop-1 */
 void v7_outer_cache_inval_range(u32 start, u32 stop)
 {
   /* PL310 currently supports only 32 bytes cache line */
   u32 pa, line_size = 32;
 
   /*
* If start address is not aligned to cache-line do not
* invalidate the first cache-line
*/
   if (start  (line_size - 1)) {
   printf(ERROR: %s - start address is not aligned - 0x%08x\n,
   __func__, start);
   /* move to next cache line */
   start = (start + line_size - 1)  ~(line_size - 1);
   }
 
   /*
* If stop address is not aligned to cache-line do not
* invalidate the last cache-line
*/
   if (stop  (line_size - 1)) {
   printf(ERROR: %s - stop address is not aligned - 0x%08x\n,
   __func__, stop);
   /* align to the beginning of this cache line */
   stop = ~(line_size - 1);
   }
 
   for (pa = start; pa  stop; pa = pa + line_size)
   writel(pa, pl310-pl310_inv_line_pa);
 
   pl310_cache_sync();
 }
 
 
 1. I don't understand why start from the next cache line if start
 address is not aligned to cache line boundary? I'd say that you want to
 invalidate cache line that contains unaligned start address. Otherwise
 first bytes won't be invalidated, right?
 
 2. Why do we throw _error_ message. I may understand if you emit
 _warning_ message in case of debug build (with DEBUG defined). Well in
 current implementation (see 1) it could be error because behavior is
 really dangerous. But if you start from correct cache line only warning
 in debug mode makes sense (IMHO).
 
 3. Stop/end address in contrast might need to be extended depending on
 HW implementation (see above comment).
 
 And here's your flush procedure:
 ===
 void v7_outer_cache_flush_range(u32 start, u32 stop)
 {
   /* PL310 currently supports only 32 bytes cache line */
   u32 pa, line_size = 32;
 
   /*
* Align to the beginning of cache-line - this ensures that
* the first 5 bits are 0 as required by PL310 TRM
*/
   start = ~(line_size - 1);
 
   for (pa = start; pa  stop; pa = pa + line_size)
   writel(pa, pl310-pl310_clean_inv_line_pa);
 
   pl310_cache_sync();
 }
 ===
 
 Which looks very correct to me. I'm wondering if there was a reason to
 have so different implementation of functions that do very similar
 things.

I think 

Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Eric Bénard
Hi Eric,

Le Sun, 27 Apr 2014 10:56:48 -0700,
Eric Nelson eric.nel...@boundarydevices.com a écrit :
 We're using UDC on all of our i.MX6 board. Marek and Troy have had this
 working for a while now.
 
 I think the two key patches are these:
   https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
   https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c
 
that's not mainline :-)

 We've been using it a lot for USB networking, where it provides a
 very nice download mechanism. See this post for details:
   http://boundarydevices.com/u-boot-2014-01/#usbrecover
 
 I think usbtty is a different thing though (USB serial adapter connected
 to a Host port).
 
No, that's a serial port gadget on a USB device controler.

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


Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Otavio Salvador
On Sun, Apr 27, 2014 at 3:56 PM, Eric Bénard e...@eukrea.com wrote:
 Le Sun, 27 Apr 2014 10:56:48 -0700,
 Eric Nelson eric.nel...@boundarydevices.com a écrit :
 We're using UDC on all of our i.MX6 board. Marek and Troy have had this
 working for a while now.

 I think the two key patches are these:
   https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
   https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c

 that's not mainline :-)

Those two are already merged in mainline.

 We've been using it a lot for USB networking, where it provides a
 very nice download mechanism. See this post for details:
   http://boundarydevices.com/u-boot-2014-01/#usbrecover

 I think usbtty is a different thing though (USB serial adapter connected
 to a Host port).

 No, that's a serial port gadget on a USB device controler.

Right and than we can use it to send the console input/output to the
host system.

-- 
Otavio Salvador O.S. Systems
http://www.ossystems.com.brhttp://code.ossystems.com.br
Mobile: +55 (53) 9981-7854Mobile: +1 (347) 903-9750
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Eric Bénard
Hi again,

Le Sun, 27 Apr 2014 20:56:56 +0200,
Eric Bénard e...@eukrea.com a écrit :
 Le Sun, 27 Apr 2014 10:56:48 -0700,
 Eric Nelson eric.nel...@boundarydevices.com a écrit :
  We're using UDC on all of our i.MX6 board. Marek and Troy have had this
  working for a while now.
  
  I think the two key patches are these:
  https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
  https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c
  
 that's not mainline :-)
 
Oops sorry, in fact that's also mainline. Interesting to learn it ;-)

Quickly looking at the code, it seems that usbtty is not using the same
API as the other gadgets in drivers/usb/gadget : it doesn't call
usb_gadget_register_driver and instead call the udc functions directly.
So indeed in the present state, this driver can't work on an i.MX6.

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


Re: [U-Boot] [linux-sunxi] Uboot error: address not aligned in v7_dcache_inval_range

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 08:40:50 PM, Ian Campbell wrote:
 On Sat, 2014-04-26 at 20:27 +0200, Marek Vasut wrote:
  This was a sheer luck this ever worked. Looking at the entire driver, to
  fix all your issues with DMA and caches, it would be sufficient to
  re-align struct dw_eth_dev properly.
  
  See drivers/net/designware.h:
  1) struct dmamacdescr {} is already __aligned(ARCH_DMA_MINALIGN)
  
 = This structure, if aligned in memory to proper boundary, can be
 flushed/
 
invalidated without problems.
  
  2) struct dw_eth_dev {} can be aligned to ANY 4-byte boundary
  
 But this structure contains two arrays of struct dmamacdescr {} ,
 which each have their elements' lenght aligned to ARCH_DMA_MINALIGN
  
  Solution:
  
  Your patch [1/3] and reorder the structure in designware.h so that the
  struct dmamacdescr tx_mac_descrtable[]
  struct dmamacdescr rx_mac_descrtable[]
  are first and anything that does not need to be aligned follows. This
  way, the DMA descriptors will always be aligned and you need not worry
  about the flushes. You don't even need to ROUNDUP their length, since
  they are already fine.
 
 That sounds like a good plan. I'll take a look.
 
  When reordering the struct dw_eth_dev {}, make sure to add a comment
  about the alignment.
 
 Of course.

Thanks

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


Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 08:38:52 PM, Ian Campbell wrote:
 On Sun, 2014-04-27 at 20:07 +0200, Marek Vasut wrote:
  # git grep common.h tools/
  tools/patman/test.py: include/common.h|8 ++
  tools/patman/test.py:+#include common.h
  tools/scripts/define2mk.sed:# which preprocesses the common.h header
  files and outputs the final
 
 I only got these three when I looked. I'm on v2014.04, but even with
 current trunk I only see fit_common.h not the ones which you show below
 (tools/updater isn't even in trunk). Perhaps this is some newer stuff
 not yet in trunk?

Ah, darn. What errors do you get ?

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


Re: [U-Boot] [PATCH v3 6/9] sunxi: add gmac Ethernet support

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 08:35:40 PM, Ian Campbell wrote:
 On Sun, 2014-04-27 at 20:10 +0200, Marek Vasut wrote:
  Do you use BOOTP at all ?
 
 Despite the names many of these options are related to both DHCP and
 BOOTP. I imagine more people are using DHCP than BOOTP these days but I
 don't know that I would rule out BOOTP.

I use DHCP boot on all those boards without having any of that BOOTP nonsense 
enabled, so I believe it's fine. Let's kill it and if someone is complaining, 
then he can submit a patch to re-enable what he needs.

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


Re: [U-Boot] usbtty using i.MX6

2014-04-27 Thread Eric Nelson

Hi Eric,

On 04/27/2014 11:56 AM, Eric Bénard wrote:

Hi Eric,

Le Sun, 27 Apr 2014 10:56:48 -0700,
Eric Nelson eric.nel...@boundarydevices.com a écrit :

We're using UDC on all of our i.MX6 board. Marek and Troy have had this
working for a while now.

I think the two key patches are these:
https://github.com/boundarydevices/u-boot-imx6/commit/f3d7cff
https://github.com/boundarydevices/u-boot-imx6/commit/f016f8c


that's not mainline :-)


Sorry. I just found it easier to use Github's U/I.


We've been using it a lot for USB networking, where it provides a
very nice download mechanism. See this post for details:
http://boundarydevices.com/u-boot-2014-01/#usbrecover

I think usbtty is a different thing though (USB serial adapter connected
to a Host port).


No, that's a serial port gadget on a USB device controler.



Oops.

We have also used netconsole with UDC, though usbtty seems like
a useful tool.

Regards,


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


Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Ian Campbell
On Sun, 2014-04-27 at 21:15 +0200, Marek Vasut wrote:
 On Sunday, April 27, 2014 at 08:38:52 PM, Ian Campbell wrote:
  On Sun, 2014-04-27 at 20:07 +0200, Marek Vasut wrote:
   # git grep common.h tools/
   tools/patman/test.py: include/common.h|8 ++
   tools/patman/test.py:+#include common.h
   tools/scripts/define2mk.sed:# which preprocesses the common.h header
   files and outputs the final
  
  I only got these three when I looked. I'm on v2014.04, but even with
  current trunk I only see fit_common.h not the ones which you show below
  (tools/updater isn't even in trunk). Perhaps this is some newer stuff
  not yet in trunk?
 
 Ah, darn. What errors do you get ?

All sorts...

  HOSTCC  tools/mksunxiboot
In file included from include/common.h:20:0,
 from tools/mksunxiboot.c:18:
include/linux/bitops.h: In function ‘generic_set_bit’:
include/linux/bitops.h:141:23: error: ‘BITS_PER_LONG’ undeclared (first use in 
this function)
  unsigned long mask = BIT_MASK(nr);
   ^
include/linux/bitops.h:141:23: note: each undeclared identifier is reported 
only once for each function it appears in
include/linux/bitops.h: In function ‘generic_clear_bit’:
include/linux/bitops.h:149:23: error: ‘BITS_PER_LONG’ undeclared (first use in 
this function)
  unsigned long mask = BIT_MASK(nr);
   ^
In file included from include/part.h:177:0,
 from include/common.h:92,
 from tools/mksunxiboot.c:18:
include/part_efi.h: At top level:
include/part_efi.h:62:1: error: unknown type name ‘u16’
 typedef u16 efi_char16_t;
 ^
include/part_efi.h:65:2: error: unknown type name ‘u8’
  u8 b[16];
  ^
include/part_efi.h:70:2: error: unknown type name ‘u8’
  u8 boot_ind;  /* 0x80 - active */
  ^
include/part_efi.h:71:2: error: unknown type name ‘u8’
  u8 head;  /* starting head */
  ^
include/part_efi.h:72:2: error: unknown type name ‘u8’
  u8 sector;  /* starting sector */
  ^
include/part_efi.h:73:2: error: unknown type name ‘u8’
  u8 cyl;   /* starting cylinder */
  ^
include/part_efi.h:74:2: error: unknown type name ‘u8’
  u8 sys_ind;  /* What partition type */
  ^
include/part_efi.h:75:2: error: unknown type name ‘u8’
  u8 end_head;  /* end head */
  ^
include/part_efi.h:76:2: error: unknown type name ‘u8’
  u8 end_sector;  /* end sector */
  ^
include/part_efi.h:77:2: error: unknown type name ‘u8’
  u8 end_cyl;  /* end cylinder */
  ^
include/part_efi.h:98:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or 
‘__attribute__’ before ‘gpt_header’
 } __packed gpt_header;
^
include/part_efi.h:102:3: error: unknown type name ‘u64’
   u64 required_to_function:1;
   ^
include/part_efi.h:103:3: error: unknown type name ‘u64’
   u64 no_block_io_protocol:1;
   ^
include/part_efi.h:104:3: error: unknown type name ‘u64’
   u64 legacy_bios_bootable:1;
   ^
include/part_efi.h:105:3: error: unknown type name ‘u64’
   u64 reserved:45;
   ^
include/part_efi.h:105:3: error: width of ‘reserved’ exceeds its type
include/part_efi.h:106:3: error: unknown type name ‘u64’
   u64 type_guid_specific:16;
   ^
include/part_efi.h:109:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or 
‘__attribute__’ before ‘gpt_entry_attributes’
 } __packed gpt_entry_attributes;
^
include/part_efi.h:117:2: error: unknown type name ‘gpt_entry_attributes’
  gpt_entry_attributes attributes;
  ^
include/part_efi.h:119:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or 
‘__attribute__’ before ‘gpt_entry’
 } __packed gpt_entry;
^
include/part_efi.h:122:2: error: unknown type name ‘u8’
  u8 boot_code[440];
  ^
include/part_efi.h:127:12: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or 
‘__attribute__’ before ‘legacy_mbr’
 } __packed legacy_mbr;
^
In file included from include/common.h:92:0,
 from tools/mksunxiboot.c:18:
include/part.h:193:5: error: unknown type name ‘gpt_header’
 gpt_header *gpt_h, gpt_entry *gpt_e);
 ^
include/part.h:193:24: error: unknown type name ‘gpt_entry’
 gpt_header *gpt_h, gpt_entry *gpt_e);
^
include/part.h:205:18: error: unknown type name ‘gpt_header’
 int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
  ^
include/part.h:205:37: error: unknown type name ‘gpt_entry’
 int gpt_fill_pte(gpt_header *gpt_h, gpt_entry *gpt_e,
 ^
include/part.h:218:49: error: unknown type name ‘gpt_header’
 int gpt_fill_header(block_dev_desc_t *dev_desc, gpt_header *gpt_h,
 ^
In file included from include/image.h:49:0,
 from include/common.h:94,
 from tools/mksunxiboot.c:18:
include/fdt_support.h:15:1: error: unknown type name ‘u32’
 u32 fdt_getprop_u32_default(const void *fdt, const char *path,
 ^
include/fdt_support.h:16:5: error: unknown type name ‘u32’
 const char *prop, const u32 dflt);
 ^
include/fdt_support.h:22:6: error: unknown type name ‘u32’
  u32 val, int create);
   

Re: [U-Boot] [PATCH v3 8/9] sunxi: non-FEL SPL boot support for sun7i

2014-04-27 Thread Marek Vasut
On Sunday, April 27, 2014 at 09:29:02 PM, Ian Campbell wrote:
 On Sun, 2014-04-27 at 21:15 +0200, Marek Vasut wrote:
  On Sunday, April 27, 2014 at 08:38:52 PM, Ian Campbell wrote:
   On Sun, 2014-04-27 at 20:07 +0200, Marek Vasut wrote:
# git grep common.h tools/
tools/patman/test.py: include/common.h|8 ++
tools/patman/test.py:+#include common.h
tools/scripts/define2mk.sed:# which preprocesses the common.h header
files and outputs the final
   
   I only got these three when I looked. I'm on v2014.04, but even with
   current trunk I only see fit_common.h not the ones which you show below
   (tools/updater isn't even in trunk). Perhaps this is some newer stuff
   not yet in trunk?
  
  Ah, darn. What errors do you get ?
 
 All sorts...

Ouch, ok. How come the other files can include this stuff without errors ?

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


[U-Boot] [PATCH v2] cosmetic: delete misleading comment /* CONFIG_BOARDDIR */

2014-04-27 Thread Masahiro Yamada
CONFIG_BOARDDIR is not referenced in these linker scripts.
The comment /* CONFIG_BOARDDIR */ is misleading.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
---

Changes in v2:
  - commit 0938b6094 also added this comment. Remove it too.

 arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 2 +-
 arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 2 +-
 arch/powerpc/cpu/mpc85xx/u-boot-spl.lds  | 2 +-
 arch/powerpc/cpu/mpc85xx/u-boot.lds  | 2 +-
 board/dave/PPChameleonEVB/u-boot.lds | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds 
b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
index d77a6dc..f933b21 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include config.h/* CONFIG_BOARDDIR */
+#include config.h
 
 #ifndef CONFIG_SYS_MONITOR_LEN
 #define CONFIG_SYS_MONITOR_LEN 0x8
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds 
b/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
index 844f7e9..b83c553 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
@@ -7,7 +7,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include config.h/* CONFIG_BOARDDIR */
+#include config.h
 
 OUTPUT_ARCH(powerpc)
 SECTIONS
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds 
b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
index 8453f3a..5ae7b3e 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-spl.lds
@@ -7,7 +7,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include config.h/* CONFIG_BOARDDIR */
+#include config.h
 
 OUTPUT_ARCH(powerpc)
 #ifdef CONFIG_SYS_MPC85XX_NO_RESETVEC
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot.lds 
b/arch/powerpc/cpu/mpc85xx/u-boot.lds
index 0b9086d..2cf0b25 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot.lds
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include config.h/* CONFIG_BOARDDIR */
+#include config.h
 
 #ifdef CONFIG_RESET_VECTOR_ADDRESS
 #define RESET_VECTOR_ADDRESS   CONFIG_RESET_VECTOR_ADDRESS
diff --git a/board/dave/PPChameleonEVB/u-boot.lds 
b/board/dave/PPChameleonEVB/u-boot.lds
index 5af55e9..94b7076 100644
--- a/board/dave/PPChameleonEVB/u-boot.lds
+++ b/board/dave/PPChameleonEVB/u-boot.lds
@@ -4,7 +4,7 @@
  * SPDX-License-Identifier:GPL-2.0+
  */
 
-#include config.h/* CONFIG_BOARDDIR */
+#include config.h
 
 #ifndef RESET_VECTOR_ADDRESS
 #define RESET_VECTOR_ADDRESS   0xfffc
-- 
1.8.3.2

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


[U-Boot] [PATCH v2] config: remove platform CONFIG_SYS_HZ definition part 4

2014-04-27 Thread Masahiro Yamada
Some new boards define CONFIG_SYS_HZ again! Remove.

Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
Acked-by: Bo Shen voice.s...@atmel.com
---

Changes in v2:
  - At commit eaf8c986, ids8313 board added CONFIG_SYS_HZ again.
Remove it too.

 include/configs/T208xRDB.h | 1 -
 include/configs/ids8313.h  | 1 -
 include/configs/sama5d3_xplained.h | 1 -
 3 files changed, 3 deletions(-)

diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h
index 73d82ed..0be0a0f 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -750,7 +750,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
 #define CONFIG_SYS_MAXARGS 16  /* max number of command args */
 #define CONFIG_SYS_BARGSIZECONFIG_SYS_CBSIZE/* Boot Argument Buffer Size */
-#define CONFIG_SYS_HZ  1000/* decrementer freq: 1ms ticks*/
 
 /*
  * For booting Linux, the board info and command line data
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 613f7e1..c1b3b63 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -474,7 +474,6 @@
 #define CONFIG_ENV_FLAGS_LIST_STATIC ethaddr:mo,eth1addr:mo
 
 #define CONFIG_BAUDRATE115200
-#define CONFIG_SYS_HZ  1000
 
 /* Initial Memory map for Linux*/
 #define CONFIG_SYS_BOOTMAPSZ   (256  20)
diff --git a/include/configs/sama5d3_xplained.h 
b/include/configs/sama5d3_xplained.h
index 91cc7d8..41c946d 100644
--- a/include/configs/sama5d3_xplained.h
+++ b/include/configs/sama5d3_xplained.h
@@ -17,7 +17,6 @@
 /* ARM asynchronous clock */
 #define CONFIG_SYS_AT91_SLOW_CLOCK  32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK  1200 /* from 12 MHz crystal */
-#define CONFIG_SYS_HZ  1000
 
 #define CONFIG_AT91FAMILY
 #define CONFIG_ARCH_CPU_INIT
-- 
1.8.3.2

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


[U-Boot] [PATCH 3/5] arm: mxs: Wait for DRAM to start

2014-04-27 Thread Marek Vasut
Instead of waiting for a fixed period of time and hoping for the best
that the DRAM will start, read back an EMI status register which tells
us exactly when the DRAM started.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

NOTE: It's interesting that Freescale failed to document this register
  in the i.MX23 datasheet, thus this part is undocumented.

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c 
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index de8841a..97ef67d 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -274,7 +274,13 @@ static void mx23_mem_init(void)
setbits_le32(MXS_DRAM_BASE + 0x20, 1  16);
 
clrbits_le32(MXS_DRAM_BASE + 0x40, 1  17);
-   early_delay(2);
+
+   /* Wait for EMI_STAT bit DRAM_HALTED */
+   for (;;) {
+   if (!(readl(MXS_EMI_BASE + 0x10)  (1  1)))
+   break;
+   early_delay(1000);
+   }
 
/* Adjust EMI port priority. */
clrsetbits_le32(0x8002, 0x1f  16, 0x2);
-- 
1.9.2

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


[U-Boot] [PATCH 4/5] arm: mxs: olinuxino: Enable USB only when needed

2014-04-27 Thread Marek Vasut
Enable the power to the USB port only when the USB port is really needed.
Do not enable the power unconditionally.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 board/olimex/mx23_olinuxino/mx23_olinuxino.c | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c 
b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index e2a03a1..65cbbf1 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -30,13 +30,25 @@ int board_early_init_f(void)
/* SSP0 clock at 96MHz */
mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
 
+   return 0;
+}
+
 #ifdef CONFIG_CMD_USB
-   /* Enable LAN9512 */
+int board_ehci_hcd_init(int port)
+{
+   /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1);
-#endif
+   udelay(100);
+   return 0;
+}
 
+int board_ehci_hcd_exit(int port)
+{
+   /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */
+   gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0);
return 0;
 }
+#endif
 
 int dram_init(void)
 {
-- 
1.9.2

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


[U-Boot] [PATCH 1/5] usb: ehci: mxs: Add board-specific callbacks

2014-04-27 Thread Marek Vasut
Add board-specific callbacks for enabling/disabling port power
into the MXS EHCI controller driver. This is in-line with the
names of callbacks on other systems.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 drivers/usb/host/ehci-mxs.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c
index 4d652b3..6b8d969 100644
--- a/drivers/usb/host/ehci-mxs.c
+++ b/drivers/usb/host/ehci-mxs.c
@@ -77,6 +77,16 @@ static int ehci_mxs_toggle_clock(const struct ehci_mxs_port 
*port, int enable)
return 0;
 }
 
+int __weak board_ehci_hcd_init(int port)
+{
+   return 0;
+}
+
+int __weak board_ehci_hcd_exit(int port)
+{
+   return 0;
+}
+
 int ehci_hcd_init(int index, enum usb_init_type init,
struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
@@ -90,6 +100,10 @@ int ehci_hcd_init(int index, enum usb_init_type init,
return -EINVAL;
}
 
+   ret = board_ehci_hcd_init(index);
+   if (ret)
+   return ret;
+
port = mxs_port[index];
 
/* Reset the PHY block */
@@ -154,5 +168,7 @@ int ehci_hcd_stop(int index)
/* Disable USB clock */
ret = ehci_mxs_toggle_clock(port, 0);
 
+   board_ehci_hcd_exit(index);
+
return ret;
 }
-- 
1.9.2

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


[U-Boot] [PATCH 5/5] arm: mxs: olinuxino: Fine-tune DRAM configuration

2014-04-27 Thread Marek Vasut
Add fine-tuning for the DRAM configuration according to the DRAM chip
datasheet. THis configuration applies to both Hynix HY5DU12622DTP and
Samsung K5H511538J-D43 .

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 board/olimex/mx23_olinuxino/mx23_olinuxino.c | 30 
 1 file changed, 30 insertions(+)

diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c 
b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index 65cbbf1..313ab20 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -78,3 +78,33 @@ int board_init(void)
 
return 0;
 }
+
+/* Fine-tune the DRAM configuration. */
+void mxs_adjust_memory_params(uint32_t *dram_vals)
+{
+   /* Enable Auto Precharge. */
+   dram_vals[3] |= 1  8;
+   /* Enable Fast Writes. */
+   dram_vals[5] |= 1  8;
+   /* tEMRS = 3*tCK */
+   dram_vals[10] = ~(0x3  8);
+   dram_vals[10] |= (0x3  8);
+   /* CASLAT = 3*tCK */
+   dram_vals[11] = ~(0x3  0);
+   dram_vals[11] |= (0x3  0);
+   /* tCKE = 1*tCK */
+   dram_vals[12] = ~(0x7  0);
+   dram_vals[12] |= (0x1  0);
+   /* CASLAT_LIN_GATE = 3*tCK , CASLAT_LIN = 3*tCK, tWTR=2*tCK */
+   dram_vals[13] = ~((0xf  16) | (0xf  24) | (0xf  0));
+   dram_vals[13] |= (0x6  16) | (0x6  24) | (0x2  0);
+   /* tDAL = 6*tCK */
+   dram_vals[15] = ~(0xf  16);
+   dram_vals[15] |= (0x6  16);
+   /* tREF = 1040*tCK */
+   dram_vals[26] = ~0x;
+   dram_vals[26] |= 0x0410;
+   /* tRAS_MAX = 9334*tCK */
+   dram_vals[32] = ~0x;
+   dram_vals[32] |= 0x2475;
+}
-- 
1.9.2

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


[U-Boot] [PATCH 2/5] arm: mxs: Wait when disabling VDDMEM current limiter

2014-04-27 Thread Marek Vasut
According to i.MX23 datasheet Table 32-17, we must wait for the supply
to settle before disabling the current limiter. Indeed, not waiting a
little here causes the system to crash at times.

Signed-off-by: Marek Vasut ma...@denx.de
Cc: Stefano Babic sba...@denx.de
---
 arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c 
b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index 3baf4dd..de8841a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -240,9 +240,14 @@ static void mx23_mem_setup_vddmem(void)
struct mxs_power_regs *power_regs =
(struct mxs_power_regs *)MXS_POWER_BASE;
 
+   /* We must wait before and after disabling the current limiter! */
+   early_delay(1);
+
clrbits_le32(power_regs-hw_power_vddmemctrl,
POWER_VDDMEMCTRL_ENABLE_ILIMIT);
 
+   early_delay(1);
+
 }
 
 static void mx23_mem_init(void)
-- 
1.9.2

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


Re: [U-Boot] [PATCH] ARM: imx6: nitrogen6x: Enable CONFIG_SYS_GENERIC_BOARD

2014-04-27 Thread Marek Vasut
On Saturday, April 26, 2014 at 01:15:46 AM, Eric Nelson wrote:

You should learn to write sensible commit messages ;-)

 Signed-off-by: Eric Nelson eric.nel...@boundarydevices.com
 ---
 Note that this seems a bit premature until we have some infrastructure
 around DTB files in place, but we certainly don't want big hairy
 warning messages on our boards.
 
 Is anyone planning on pulling in at least the pinfunc and .dtsi
 files for i.MX? I'm not sure how much else will be useful in U-Boot.
 
  include/configs/nitrogen6x.h | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
 index f7e7315..895f36f 100644
 --- a/include/configs/nitrogen6x.h
 +++ b/include/configs/nitrogen6x.h
 @@ -24,6 +24,7 @@
  #define CONFIG_SETUP_MEMORY_TAGS
  #define CONFIG_INITRD_TAG
  #define CONFIG_REVISION_TAG
 +#define CONFIG_SYS_GENERIC_BOARD
 
  /* Size of malloc() pool */
  #define CONFIG_SYS_MALLOC_LEN(10 * 1024 * 1024)

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 02/11] Do not apply: tools: add genkconfig

2014-04-27 Thread Masahiro Yamada
Hi Simon,


 Will this tool become useless once this series is applied?

Yes, I think so.


Best Regards
Masahiro Yamada

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


Re: [U-Boot] [PATCH 1/5] usb: ci_udc: Support larger packets

2014-04-27 Thread Marek Vasut
On Friday, April 25, 2014 at 01:52:36 AM, Stephen Warren wrote:
 From: Stephen Warren swar...@nvidia.com
 
 ci_ep_queue() currently only fills in the page0/page1 fields in the
 queue item. If the buffer is larger than 4KiB (unaligned) or 8KiB
 (page-aligned), then this prevents the HW from knowing where to write
 the balance of the data.
 
 Fix this by initializing all 5 pageN pointers, which allows up to
 16KiB (potentially non-page-aligned) buffers.
 
 Signed-off-by: Stephen Warren swar...@nvidia.com

Applied all, thanks. But can you please check if we can get the buffer 
allocation from 5/5 sorted please ? I'd really like that instead of such hacks.

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


Re: [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length

2014-04-27 Thread Chen-Yu Tsai
On Mon, Apr 28, 2014 at 2:08 AM, Marek Vasut ma...@denx.de wrote:
 On Sunday, April 27, 2014 at 05:29:29 PM, Chen-Yu Tsai wrote:
 On Sun, Apr 27, 2014 at 11:25 PM, Ian Campbell i...@hellion.org.uk wrote:
  On Sat, 2014-04-26 at 20:28 +0200, Marek Vasut wrote:
  On Friday, April 18, 2014 at 08:05:50 PM, Ian Campbell wrote:
   From: Jens Kuske jensku...@gmail.com
  
   The GMAC module in Allwinner sunxi SoCs seems to have problems with
   burst lengths  8.
 
  Is there any explanation for the problems please ?
 
  Jens or Wens, can you answer this?

 IIRC, with burst lengths  8, GMAC doesn't work, no ping, no DHCP.
 I don't remember if it was TX or RX that suffered, or even both.

 Hope this clarifies things a bit.

 No, it does not at all, sorry. What you describe are symptoms, but what I want
 to know is what is the root cause of those symptoms. You did not explain that.

I can not offer much more explanation. The value was hardcoded in
Allwinner's code. The datasheets don't offer much, except this line
might be related:

  (DMA) Descriptor architecture, allowing large blocks of data transfer
  with minimum CPU intervention; each descriptor can transfer up to
  4 KB data.

Also probably related:

  4KB TX FIFO for transmission packets and 16KB RX FIFO for reception
  packets.

I'm not an expert in hardware. We could ask Allwinner, but given past
inquiries from the linux-sunxi community, I'd say getting a reply on
hardware specifics is unlikely to happen.

So my guess is that this is limited by the DWMAC IP Allwinner licensed
from Synopsys.


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


Re: [U-Boot] [PATCH v3 9/9] net/designware: Reduce DMA burst length

2014-04-27 Thread Marek Vasut
On Monday, April 28, 2014 at 07:51:49 AM, Chen-Yu Tsai wrote:
 On Mon, Apr 28, 2014 at 2:08 AM, Marek Vasut ma...@denx.de wrote:
  On Sunday, April 27, 2014 at 05:29:29 PM, Chen-Yu Tsai wrote:
  On Sun, Apr 27, 2014 at 11:25 PM, Ian Campbell i...@hellion.org.uk wrote:
   On Sat, 2014-04-26 at 20:28 +0200, Marek Vasut wrote:
   On Friday, April 18, 2014 at 08:05:50 PM, Ian Campbell wrote:
From: Jens Kuske jensku...@gmail.com

The GMAC module in Allwinner sunxi SoCs seems to have problems with
burst lengths  8.
   
   Is there any explanation for the problems please ?
   
   Jens or Wens, can you answer this?
  
  IIRC, with burst lengths  8, GMAC doesn't work, no ping, no DHCP.
  I don't remember if it was TX or RX that suffered, or even both.
  
  Hope this clarifies things a bit.
  
  No, it does not at all, sorry. What you describe are symptoms, but what I
  want to know is what is the root cause of those symptoms. You did not
  explain that.
 
 I can not offer much more explanation. The value was hardcoded in
 Allwinner's code. The datasheets don't offer much, except this line
 might be related:
 
   (DMA) Descriptor architecture, allowing large blocks of data transfer
   with minimum CPU intervention; each descriptor can transfer up to
   4 KB data.
 
 Also probably related:
 
   4KB TX FIFO for transmission packets and 16KB RX FIFO for reception
   packets.
 
 I'm not an expert in hardware. We could ask Allwinner, but given past
 inquiries from the linux-sunxi community, I'd say getting a reply on
 hardware specifics is unlikely to happen.
 
 So my guess is that this is limited by the DWMAC IP Allwinner licensed
 from Synopsys.

+CC Alexey

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