[U-Boot] [PATCH] mmc: postponed needless timer initialization

2014-04-29 Thread Mateusz Zalega
mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Change-Id: Iec694abe3315d146d35dc130ad80b73dffd0983b
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
---
Detached from earlier DFU, MMC, Gadget, Goni, misc. series because of lack
of relevance to other patches.

There were no changes since the first version of this patch.
---
 drivers/mmc/mmc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 16051e5..c93dc24 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1310,15 +1310,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
int err = IN_PROGRESS;
-   unsigned start = get_timer(0);
+   unsigned start;
 
if (mmc-has_init)
return 0;
+
+   start = get_timer(0);
+
if (!mmc-init_in_progress)
err = mmc_start_init(mmc);
-
if (!err || err == IN_PROGRESS)
err = mmc_complete_init(mmc);
+
debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
return err;
 }
-- 
1.9.0

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


[U-Boot] [PATCH] common: fixed linker-list example

2014-04-29 Thread Mateusz Zalega
Last argument shouldn't be there.

Change-Id: Ie227f4bee2c542b15c1a7089894532366ec89a1d
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Marek Vasut ma...@denx.de
Cc: Tom Rini tr...@ti.com
---
Detached from earlier DFU, MMC, Gadget, Goni, misc. series because of lack
of relevance to other patches.

There were no changes since the first version of this patch.
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  * .x = 3,
  * .y = 4,
  * };
-- 
1.9.0

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


[U-Boot] [PATCH v2] common: fixed linker-list example

2014-04-29 Thread Mateusz Zalega
Last argument shouldn't be there.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Marek Vasut ma...@denx.de
Cc: Tom Rini tr...@ti.com
---
Detached from earlier DFU, MMC, Gadget, Goni, misc. series because of lack
of relevance to other patches.

v2:
- deleted change-id line from commit message, sorry!
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  * .x = 3,
  * .y = 4,
  * };
-- 
1.9.0

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


[U-Boot] [PATCH v2] mmc: postponed needless timer initialization

2014-04-29 Thread Mateusz Zalega
mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
---
Detached from earlier DFU, MMC, Gadget, Goni, misc. series because of lack
of relevance to other patches.

v2:
- deleted change-id line from commit message, sorry!
---
 drivers/mmc/mmc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 16051e5..c93dc24 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1310,15 +1310,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
int err = IN_PROGRESS;
-   unsigned start = get_timer(0);
+   unsigned start;
 
if (mmc-has_init)
return 0;
+
+   start = get_timer(0);
+
if (!mmc-init_in_progress)
err = mmc_start_init(mmc);
-
if (!err || err == IN_PROGRESS)
err = mmc_complete_init(mmc);
+
debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
return err;
 }
-- 
1.9.0

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


[U-Boot] [PATCH] ARM: Samsung: s5p_goni: maintainer update

2014-04-29 Thread Mateusz Zalega
Because I'm leaving Samsung Electronics, I won't have access to their
developer hardware anymore. Przemyslaw Marczak will take over my
responsibilities.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Przemyslaw Marczak p.marc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 boards.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boards.cfg b/boards.cfg
index 983c657..7bdd0d8 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -368,7 +368,7 @@ Active  arm armv7  rmobile renesas  
   koelsch
 Active  arm armv7  rmobile renesas koelsch 
koelsch_nor  koelsch:NORFLASH   

   Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com
 Active  arm armv7  rmobile renesas lager   
lager-  

   Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com
 Active  arm armv7  rmobile renesas lager   
lager_norlager:NORFLASH 

   Nobuhiro Iwamatsu nobuhiro.iwamatsu...@renesas.com
-Active  arm armv7  s5pc1xx samsung goni
s5p_goni -  

   Mateusz Zalega m.zal...@samsung.com
+Active  arm armv7  s5pc1xx samsung goni
s5p_goni -  

   Przemyslaw Marczak p.marc...@samsung.com
 Active  arm armv7  s5pc1xx samsung smdkc100
smdkc100 -  

   Minkyu Kang mk7.k...@samsung.com
 Active  arm armv7  socfpga altera  socfpga 
socfpga_cyclone5 -  

   -
 Active  arm armv7  u8500   st-ericsson snowball
snowball -  

   Mathieu Poirier mathieu.poir...@linaro.org
-- 
1.9.0

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


[U-Boot] [PATCH v5 02/12] part: header fix

2014-04-28 Thread Mateusz Zalega
Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- none
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include ide.h
+#include common.h
 
 typedef struct block_dev_desc {
int if_type;/* type of the interface */
-- 
1.9.0

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


[U-Boot] [PATCH v5 01/12] mmc: mmc header fix

2014-04-28 Thread Mateusz Zalega
Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
---
Changes since v1:
- none
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index 42d0125..bc11f45 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include linux/list.h
 #include linux/compiler.h
+#include part.h
 
 #define SD_VERSION_SD  0x2
 #define SD_VERSION_3   (SD_VERSION_SD | 0x300)
-- 
1.9.0

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


[U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API

2014-04-28 Thread Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Acked-by: Marek Vasut ma...@denx.de
---
Changes since v1:
- reordered
since v2:
- fixed coding style issues reported by [Marek Vasut]
- added convenient macro wrappers for used ll_entry_declare
since v4:
- fixed coding style issues reported by [Jaehoon Chung]
---
 common/cmd_dfu.c|  3 +-
 common/cmd_thordown.c   |  3 +-
 common/cmd_usb_mass_storage.c   |  2 +-
 drivers/usb/gadget/f_dfu.c  |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c |  2 ++
 drivers/usb/gadget/g_dnl.c  | 64 -
 include/dfu.h   |  7 
 include/g_dnl.h | 23 +
 include/thor.h  |  8 -
 include/usb_mass_storage.h  |  8 -
 11 files changed, 62 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   char *s = dfu;
int ret, i = 0;
 
ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
int controller_index = simple_strtoul(usb_controller, NULL, 0);
board_usb_init(controller_index, USB_INIT_DEVICE);
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_dfu);
while (1) {
if (dfu_reset())
/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   const char *s = thor;
int ret;
 
puts(TIZEN \THOR\ Downloader\n);
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
goto exit;
}
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_thor);
 
ret = thor_init();
if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 14a5b6a..d8d9efd 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-   g_dnl_register(ums);
+   g_dnl_register(usb_dnl_ums);
 
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index de75ff1..1b1e179 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include linux/usb/composite.h
 
 #include dfu.h
+#include g_dnl.h
 #include f_dfu.h
 
 struct f_dfu {
@@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
 
return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index 4fae5cd..6374bb9 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 #include usb/lin_gadget_compat.h
+#include g_dnl.h
 
 /**/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
debug(%s:\n, __func__);
return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 973d737..743bae5 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION usb_dnl 2.0
 
-static const char shortname[] = usb_dnl_;
 static const char product[] = USB download gadget;
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
free(cdev-config);
cdev-config = NULL;
debug(%s: calling usb_gadget_disconnect

[U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc.

2014-04-28 Thread Mateusz Zalega
Patchset contains fixes for:
* DFU write issues
* USB cable detection
* ums command
* U-Boot's base framework (headers)
* fixed base DFU offsets
and features:
* convenient USB Gadget registration
* Samsung Goni DFU, UMS, GPT bringup
also:
* am335x will no longer support DFU in SPL builds

There _are_ dependencies between these patches. ie. Goni stuff depends on the
new Gadget registration API, which in turn depends on disabling DFU in
am335x's SPL build so that some poor soul wouldn't trip over a board-breaking
commit while running git bisect, and I could have not written correct code
without fixing u-boot headers first...

Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Marek Vasut ma...@denx.de

---
Changes since v1:
- reordered USB: gadget: added a saner gadget downloader registration API
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient ROM capacity
since v2:
in USB: gadget: added a saner gadget downloader:
fixed issues which came to [Marek Vasut]'s attention:
- fixed coding style issues
- added convenient macro wrappers for used ll_entry_declare
since v3:
- grouped patches related to common topics
in ums: always initialize mmc before ums_disk_init()
- Added const attribute of ums_disk_init introduced type warnings. It would
  take a lot of changes to MMC core code to fix it, so it was dropped, even
  though ums_disk_init shouldn't and doesn't change struct mmc it is passed.
since v4:
- added detailed changelog to each patch
- removed patches which can go in separately:
  common: fixed linker-list example
  mmc: postponed needless timer initialization
in dfu: mmc: raw data write fix:
- commit message was made more detailed
- the patch was split in two, introducing
  dfu: mmc: change offset base handling to the patchset
in usb: dfu: fix boards wo USB cable detection:
- removed CONFIG_USB_CABLE_CHECK
- moved implementation from usb.h (reserved for USB host code)
  to USB gadget
- renamed usb_cable_connected to g_dnl_usb_cable_connected
- removed defunct board implementations (origen, universal)
- added __weak default implementation and removed ifdef'd blocks around
  dependent code
in gadget: added a saner gadget downloader
- fixed coding style issues reported by [Jaehoon Chung] 
---

Mateusz Zalega (12):
  mmc: mmc header fix
  part: header fix
  usb: dfu: fix boards wo USB cable detection
  dfu: mmc: raw data write fix
  dfu: mmc: change offset base handling
  ums: always initialize mmc before ums_disk_init()
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm: goni: Update configuration for Goni target
  arm: goni: dfu: Add support for DFU to Goni target
  arm: goni: enable GPT command
  arm: goni: enable USB Mass Storage

 README   |   7 --
 board/samsung/common/ums.c   |   6 +-
 board/samsung/goni/goni.c|   8 +++
 board/samsung/origen/origen.c|   7 --
 board/samsung/trats/trats.c  |   4 +-
 board/samsung/trats2/trats2.c|   4 +-
 board/samsung/universal_c210/universal.c |   7 --
 common/cmd_dfu.c |   3 +-
 common/cmd_thordown.c|   3 +-
 common/cmd_usb_mass_storage.c|  10 ++-
 drivers/dfu/dfu_mmc.c| 109 ++---
 drivers/usb/gadget/f_dfu.c   |   3 +
 drivers/usb/gadget/f_mass_storage.c  |  11 +--
 drivers/usb/gadget/f_thor.c  |   2 +
 drivers/usb/gadget/g_dnl.c   |  69 +--
 include/configs/am335x_evm.h |  10 +--
 include/configs/exynos4-dt.h |   1 -
 include/configs/s5p_goni.h   | 113 +--
 include/configs/trats.h  |   2 +-
 include/configs/trats2.h |   2 +-
 include/dfu.h|  12 
 include/g_dnl.h  |  24 +++
 include/mmc.h|   1 +
 include/part.h   |   1 +
 include/thor.h   |   8 ---
 include/usb.h|  10 ---
 include/usb_mass_storage.h   |   8 ---
 27 files changed, 247 insertions(+), 198 deletions(-)

-- 
1.9.0

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


[U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection

2014-04-28 Thread Mateusz Zalega
Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and added
its default implementation to gadget downloader driver code. There's
only one driver of this kind and it's unlikely there'll be another, so
there's no point in keeping it in /common.

Previously this function was declared in usb.h. I've moved it, since
it's more appropriate to keep it in g_dnl.h - usb.h seems to be intended
for USB host implementation.

Existing code, confronted with default -EOPNOTSUPP return value,
continues as if the cable was connected.

CONFIG_USB_CABLE_CHECK was removed.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
Changes since v4:
- removed CONFIG_USB_CABLE_CHECK
- moved implementation from usb.h (reserved for USB host code)
  to USB gadget
- renamed usb_cable_connected to g_dnl_usb_cable_connected
- removed defunct board implementations (origen, universal)
- added __weak default implementation and removed ifdef'd blocks around
  dependent code
---
 README   |  7 ---
 board/samsung/origen/origen.c|  7 ---
 board/samsung/trats/trats.c  |  4 +---
 board/samsung/trats2/trats2.c|  4 +---
 board/samsung/universal_c210/universal.c |  7 ---
 common/cmd_usb_mass_storage.c|  8 ++--
 drivers/usb/gadget/f_mass_storage.c  |  8 
 drivers/usb/gadget/g_dnl.c   |  5 +
 include/configs/exynos4-dt.h |  1 -
 include/g_dnl.h  |  1 +
 include/usb.h| 10 --
 11 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/README b/README
index 12758dc..b973344 100644
--- a/README
+++ b/README
@@ -1484,13 +1484,6 @@ The following options need to be configured:
for your device
- CONFIG_USBD_PRODUCTID 0x
 
-   Some USB device drivers may need to check USB cable attachment.
-   In this case you can enable following config in BoardName.h:
-   CONFIG_USB_CABLE_CHECK
-   This enables function definition:
-   - usb_cable_connected() in include/usb.h
-   Implementation of this function is board-specific.
-
 - ULPI Layer Support:
The ULPI (UTMI Low Pin (count) Interface) PHYs are supported via
the generic ULPI layer. The generic layer accesses the ULPI PHY
diff --git a/board/samsung/origen/origen.c b/board/samsung/origen/origen.c
index d502f02..a539267 100644
--- a/board/samsung/origen/origen.c
+++ b/board/samsung/origen/origen.c
@@ -30,13 +30,6 @@ int board_usb_init(int index, enum usb_init_type init)
return 0;
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
-{
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int exynos_early_init_f(void)
 {
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7c79e7b..ab0ad1d 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -430,8 +430,7 @@ int board_usb_init(int index, enum usb_init_type init)
return s3c_udc_probe(s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
+int g_dnl_board_usb_cable_connected(void)
 {
struct pmic *muic = pmic_get(MAX8997_MUIC);
if (!muic)
@@ -440,7 +439,6 @@ int usb_cable_connected(void)
return !!muic-chrg-chrg_type(muic);
 }
 #endif
-#endif
 
 static void pmic_reset(void)
 {
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index f558ef9..4709525 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -312,8 +312,7 @@ int board_usb_init(int index, enum usb_init_type init)
return s3c_udc_probe(s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
+int g_dnl_board_usb_cable_connected(void)
 {
struct pmic *muic = pmic_get(MAX77693_MUIC);
if (!muic)
@@ -322,7 +321,6 @@ int usb_cable_connected(void)
return !!muic-chrg-chrg_type(muic);
 }
 #endif
-#endif
 
 static int pmic_init_max77686(void)
 {
diff --git a/board/samsung/universal_c210/universal.c 
b/board/samsung/universal_c210/universal.c
index f9d71b6..8e49195 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -197,13 +197,6 @@ int board_usb_init(int index, enum usb_init_type init)
return s3c_udc_probe(s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
-{
-   return 0;
-}
-#endif
-
 int exynos_early_init_f(void)
 {
wdt_stop();
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..14a5b6a 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common

[U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target

2014-04-28 Thread Mateusz Zalega
Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 56 +-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110 1   /* which is in a S5PC110 */
 #define CONFIG_MACH_GONI   1   /* working with Goni */
 
+#include linux/sizes.h
 #include asm/arch/cpu.h  /* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x10, 0x10 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
,7m(kernel)\
,1m(log)\
,12m(modem)\
-   ,60m(qboot)\
-   ,-(UBI)\0
+   ,60m(qboot)\0
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
-#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext2 \
+#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext4 \
 ${console} ${meminfo}
 
 #define CONFIG_COMMON_BOOT ${console} ${meminfo} ${mtdparts}
 
-#define CONFIG_BOOTARGSroot=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 
ubi.mtd=6 \
-rootfstype=cramfs  CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGSroot=/dev/mtdblock8 rootfstype=ext4  \
+   CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB updateb=onenand erase 0x0 0x10; \
 onenand write 0x32008000 0x0 0x10\0
 
-#define CONFIG_UBI_MTD  ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6
-
-#define CONFIG_UBIFS_OPTIONrootflags=bulk_read,no_chk_data_crc
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
-   rootfstype=${rootfstype} CONFIG_UBI_MTD  ${opts}  \
+   rootfstype=${rootfstype} ${opts}  \
${lcdinfo}  CONFIG_COMMON_BOOT ; run bootk\0 \
ubifsboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
tftpboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
-   CONFIG_COMMON_BOOT ; tftp 0x30007FC0 uImage;  \
-   bootm 0x30007FC0\0 \
+   ${opts} ${lcdinfo}  CONFIG_COMMON_BOOT \
+   ; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0 \
ramboot= \
set bootargs  CONFIG_RAMDISK_BOOT \
-initrd=0x3300,8M ramdisk=8192\0 \
+   initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
-   CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   mmcblk=/dev/mmcblk1p1\0 \
+   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   mmcdev=0\0 \
+   mmcbootpart=2\0 \
+   mmcrootpart=5\0

[U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command

2014-04-28 Thread Mateusz Zalega
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.9.0

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


[U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init()

2014-04-28 Thread Mateusz Zalega
In cases when MMC hadn't been initialized before, ie. by the user or other
subsystem, it was still uninitialized while UMS media capacity check,
leading to broken ums command.

UMS has to initialize resources it uses.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v3:
- Added const attribute of ums_disk_init introduced type warnings. It would
  take a lot of changes to MMC core code to fix it, so it was dropped, even
  though ums_disk_init shouldn't and doesn't change struct mmc it is passed.
Changes since v4:
- added slightly more detailed commit message 
---
 board/samsung/common/ums.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..cebabe9 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-   struct mmc *mmc = NULL;
+   struct mmc *mmc = find_mmc_device(dev_num);
 
-   mmc = find_mmc_device(dev_num);
-   if (!mmc)
+   if (!mmc || mmc_init(mmc))
return NULL;
-
return ums_disk_init(mmc);
 }
-- 
1.9.0

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


[U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage

2014-04-28 Thread Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif /* __CONFIG_H */
-- 
1.9.0

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


[U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix

2014-04-28 Thread Mateusz Zalega
When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing MMC device before use in
dfu_fill_entity_mmc().

While fixing initialization sequence, I had to change about half of
dfu_fill_entity_mmc's body, so I refactored it on the way to make it,
IMHO, considerably more comprehensible.

Being left as dead code, get_mmc_blk_size() was removed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Acked-by: Tom Rini tr...@ti.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v4:
- added more detailed commit message
- converted to C90-style
- split into two patches: write fix and offset interpretation change
---
 drivers/dfu/dfu_mmc.c | 105 +++---
 include/dfu.h |   5 ---
 2 files changed, 65 insertions(+), 45 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 651cfff..b41785d 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -184,66 +184,91 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 
offset, void *buf,
return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ * 1st:
+ * raw (raw read/write)
+ * fat (files)
+ * ext4(^)
+ * part(partition image)
+ * 2nd and 3rd:
+ * lba_start and lba_size, for raw write
+ * mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-   int dev, part;
-   struct mmc *mmc;
-   block_dev_desc_t *blk_dev;
-   disk_partition_t partinfo;
-   char *st;
+   const char *entity_type;
+   size_t second_arg;
+   size_t third_arg;
 
-   dfu-dev_type = DFU_DEV_MMC;
-   st = strsep(s,  );
-   if (!strcmp(st, mmc)) {
-   dfu-layout = DFU_RAW_ADDR;
-   dfu-data.mmc.lba_start = simple_strtoul(s, s, 16);
-   dfu-data.mmc.lba_size = simple_strtoul(++s, s, 16);
-   dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
-   } else if (!strcmp(st, fat)) {
-   dfu-layout = DFU_FS_FAT;
-   } else if (!strcmp(st, ext4)) {
-   dfu-layout = DFU_FS_EXT4;
-   } else if (!strcmp(st, part)) {
-
-   dfu-layout = DFU_RAW_ADDR;
+   struct mmc *mmc;
 
-   dev = simple_strtoul(s, s, 10);
-   s++;
-   part = simple_strtoul(s, s, 10);
+   const char *argv[3];
+   const char **parg = argv;
 
-   mmc = find_mmc_device(dev);
-   if (mmc == NULL || mmc_init(mmc)) {
-   printf(%s: could not find mmc device #%d!\n,
-  __func__, dev);
+   for (; parg  argv + sizeof(argv) / sizeof(*argv); ++parg) {
+   *parg = strsep(s,  );
+   if (*parg == NULL) {
+   error(Invalid number of arguments.\n);
return -ENODEV;
}
+   }
 
-   blk_dev = mmc-block_dev;
-   if (get_partition_info(blk_dev, part, partinfo) != 0) {
-   printf(%s: could not find partition #%d on mmc device 
#%d!\n,
-  __func__, part, dev);
+   entity_type = argv[0];
+   second_arg = simple_strtoul(argv[1], NULL, 16);
+   third_arg = simple_strtoul(argv[2], NULL, 16);
+
+   mmc = find_mmc_device(dfu-dev_num);
+   if (mmc == NULL) {
+   error(Couldn't find MMC device no. %d.\n, dfu-dev_num);
+   return -ENODEV;
+   }
+
+   if (mmc_init(mmc)) {
+   error(Couldn't init MMC device.\n);
+   return -ENODEV;
+   }
+
+   if (!strcmp(entity_type, raw)) {
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = second_arg;
+   dfu-data.mmc.lba_size  = third_arg;
+   dfu-data.mmc.lba_blk_size  = mmc-read_bl_len;
+   } else if (!strcmp(entity_type, part)) {
+   disk_partition_t partinfo;
+   block_dev_desc_t *blk_dev = mmc-block_dev;
+   int mmcdev = second_arg;
+   int mmcpart = third_arg;
+
+   if (get_partition_info(blk_dev, mmcpart, partinfo) != 0) {
+   error(Couldn't find part #%d on mmc device #%d\n,
+ mmcpart, mmcdev);
return -ENODEV;
}
 
-   dfu-data.mmc.lba_start = partinfo.start;
-   dfu-data.mmc.lba_size = partinfo.size;
-   dfu-data.mmc.lba_blk_size

[U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling

2014-04-28 Thread Mateusz Zalega
Previously offsets handled by dfu_fill_entity_mmc(), defined in boards'
CONFIG_DFU_ALT were treated as hexadecimal regardless of their prefix,
which sometimes led to confusion. This patch forces usage of explicit
numerical base prefixes.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Introduced in v5.
---
 drivers/dfu/dfu_mmc.c| 8 ++--
 include/configs/am335x_evm.h | 8 
 include/configs/trats.h  | 2 +-
 include/configs/trats2.h | 2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index b41785d..5e10ea7 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -215,8 +215,12 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
}
 
entity_type = argv[0];
-   second_arg = simple_strtoul(argv[1], NULL, 16);
-   third_arg = simple_strtoul(argv[2], NULL, 16);
+   /*
+* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+* with default 10.
+*/
+   second_arg = simple_strtoul(argv[1], NULL, 0);
+   third_arg = simple_strtoul(argv[2], NULL, 0);
 
mmc = find_mmc_device(dfu-dev_num);
if (mmc == NULL) {
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ea9e758..4147f9f 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -320,10 +320,10 @@
boot part 0 1; \
rootfs part 0 2; \
MLO fat 0 1; \
-   MLO.raw mmc 100 100; \
-   u-boot.img.raw mmc 300 400; \
-   spl-os-args.raw mmc 80 80; \
-   spl-os-image.raw mmc 900 2000; \
+   MLO.raw mmc 0x100 0x100; \
+   u-boot.img.raw mmc 0x300 0x400; \
+   spl-os-args.raw mmc 0x80 0x80; \
+   spl-os-image.raw mmc 0x900 0x2000; \
spl-os-args fat 0 1; \
spl-os-image fat 0 1; \
u-boot.img fat 0 1; \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 5d8bd60..8461343 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -101,7 +101,7 @@
name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_DFU_ALT \
-   u-boot mmc 80 400; \
+   u-boot raw 0x80 0x400; \
uImage ext4 0 2; \
modem.bin ext4 0 2; \
exynos4210-trats.dtb ext4 0 2; \
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 53d449c..03e88ee 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -91,7 +91,7 @@
name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_DFU_ALT \
-   u-boot mmc 80 800; \
+   u-boot raw 0x80 0x800; \
uImage ext4 0 2; \
modem.bin ext4 0 2; \
exynos4412-trats2.dtb ext4 0 2; \
-- 
1.9.0

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


[U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build

2014-04-28 Thread Mateusz Zalega
Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Acked-by: Tom Rini tr...@ti.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
---
Changes since v2:
- none
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4147f9f..670e3f1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -312,6 +312,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -354,6 +355,7 @@
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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


[U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to Goni target

2014-04-28 Thread Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- reordered
---
 board/samsung/goni/goni.c  |  8 +++
 include/configs/s5p_goni.h | 54 --
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
 #include samsung/misc.h
+#include usb.h
+#include usb_mass_storage.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   return s3c_udc_probe(s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER Samsung
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT onenand0=samsung-onenand
@@ -91,7 +95,34 @@
,12m(modem)\
,60m(qboot)\0
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_BOOT boot
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define CONFIG_DFU_ALT \
+   u-boot raw 0x80 0x400; \
+   uImage ext4 0 2; \
+   exynos3-goni.dtb ext4 0 2; \
+   PARTS_ROOT part 0 5\0
+
+#define PARTS_DEFAULT \
+   uuid_disk=${uuid_gpt_disk}; \
+   name=PARTS_CSA,size=8MiB,uuid=${uuid_gpt_PARTS_CSA}; \
+   name=PARTS_BOOTLOADER,size=60MiB, \
+   uuid=${uuid_gpt_PARTS_BOOTLOADER}; \
+   name=PARTS_BOOT,size=100MiB,uuid=${uuid_gpt_PARTS_BOOT}; \
+   name=PARTS_ROOT,size=1GiB,uuid=${uuid_gpt_PARTS_ROOT}; \
+   name=PARTS_DATA,size=3GiB,uuid=${uuid_gpt_PARTS_DATA}; \
+   name=PARTS_CSC,size=150MiB,uuid=${uuid_gpt_PARTS_CSC}; \
+   name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_BOOTCOMMAND run mmcboot
 
@@ -150,18 +181,18 @@
verify=n\0 \
rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
-   mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
mmcrootpart=5\0 \
+   partitions= PARTS_DEFAULT \
bootblock=9\0 \
ubiblock=8\0 \
ubi=enabled\0 \
-   opts=always_resume=1
+   opts=always_resume=1\0 \
+   dfu_alt_info= CONFIG_DFU_ALT \0
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/
 #define CONFIG_SYS_PROMPT  Goni # 
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support

Re: [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API

2014-04-16 Thread Mateusz Zalega
On 04/16/14 06:23, Jaehoon Chung wrote:
 Hi, Mateusz.
 
 ERROR: foo * bar should be foo *bar
 #701: FILE: drivers/usb/gadget/g_dnl.c:104:
 +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)
 
 ERROR: foo * bar should be foo *bar
 #707: FILE: drivers/usb/gadget/g_dnl.c:110:
 +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)
 
 ERROR: open brace '{' following struct go on the same line
 #842: FILE: include/g_dnl.h:32:
 +struct g_dnl_bind_callback
 +{

ack

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API

2014-04-15 Thread Mateusz Zalega
On 04/11/14 14:02, Marek Vasut wrote:
 Existing code relied on boolean value returned from
 usb_cable_connected(), but there was no way to signal that it's
 impossible to tell whether cable is connected or not. If you prefer an
 enum with USBCNT_DONTKNOW as a return value, make a decision.
 
 Did I say anything about USBCNT_DONTKNOW above please?
 
 Sorry, I also lost context of this thread as it was dead for more than a 
 month.

As I described on the IRC. We've got to have a way to signal U-Boot code
that our hardware isn't capable of knowing if cable is connected, thus
#ifdef all related code or introduce 3-valued enum.

 The whole patchset is a mix of completely unrelated things which should
 go through different trees. Can the patchset be reordered/split in some
 reasonable chunks ? There are fixes which should go in immediatelly and
 then features which should go in for -next.

 Not exactly unrelated, most of it should be applied in this particular
 order. It would be less chaotic had it been accepted in one piece.
 
 Please elaborate why can the fixes not go first and features second. Thank 
 you.

It's because of silly relationships between some of these patches. ie.
am335x SPL build process just blew (too little ROM), leaving its
codebase in unbisectable state, after I added some more code to DFU
implementation. am335x's SPL had to be disabled first, and I consider it
a change on the feature list.

I've reordered the fixes I could, but I guess it doesn't matter anymore,
now that -next is out.

Please ack applicable USB patches on the next patchset version or
propose a different solution.

Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 01/13] mmc: mmc header fix

2014-04-15 Thread Mateusz Zalega
Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index 42d0125..bc11f45 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include linux/list.h
 #include linux/compiler.h
+#include part.h
 
 #define SD_VERSION_SD  0x2
 #define SD_VERSION_3   (SD_VERSION_SD | 0x300)
-- 
1.9.0

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


[U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection

2014-04-15 Thread Mateusz Zalega
Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Minkyu Kang mk7.k...@samsung.com
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..2f69a53 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -42,6 +42,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 
g_dnl_register(ums);
 
+#ifdef CONFIG_USB_CABLE_CHECK
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
}
puts(\r\n);
}
+#endif
 
while (1) {
usb_gadget_handle_interrupts();
-- 
1.9.0

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


[U-Boot] [PATCH v4 06/13] dfu: mmc: raw data write fix

2014-04-15 Thread Mateusz Zalega
When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/dfu/dfu_mmc.c| 106 ++-
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h  |   2 +-
 include/configs/trats2.h |   2 +-
 include/dfu.h|   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 651cfff..2f7ae21 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -184,66 +184,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 
offset, void *buf,
return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ * 1st:
+ * raw (raw read/write)
+ * fat (files)
+ * ext4(^)
+ * part(partition image)
+ * 2nd and 3rd:
+ * lba_start and lba_size, for raw write
+ * mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-   int dev, part;
-   struct mmc *mmc;
-   block_dev_desc_t *blk_dev;
-   disk_partition_t partinfo;
-   char *st;
-
-   dfu-dev_type = DFU_DEV_MMC;
-   st = strsep(s,  );
-   if (!strcmp(st, mmc)) {
-   dfu-layout = DFU_RAW_ADDR;
-   dfu-data.mmc.lba_start = simple_strtoul(s, s, 16);
-   dfu-data.mmc.lba_size = simple_strtoul(++s, s, 16);
-   dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
-   } else if (!strcmp(st, fat)) {
-   dfu-layout = DFU_FS_FAT;
-   } else if (!strcmp(st, ext4)) {
-   dfu-layout = DFU_FS_EXT4;
-   } else if (!strcmp(st, part)) {
+   const char *argv[3];
+   const char **parg = argv;
+   for (; parg  argv + sizeof(argv) / sizeof(*argv); ++parg) {
+   *parg = strsep(s,  );
+   if (*parg == NULL) {
+   error(Invalid number of arguments.\n);
+   return -ENODEV;
+   }
+   }
 
-   dfu-layout = DFU_RAW_ADDR;
+   const char *entity_type = argv[0];
+   /*
+* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+* with default 10.
+*/
+   size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+   size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-   dev = simple_strtoul(s, s, 10);
-   s++;
-   part = simple_strtoul(s, s, 10);
+   struct mmc *mmc = find_mmc_device(dfu-dev_num);
+   if (mmc == NULL) {
+   error(Couldn't find MMC device no. %d.\n, dfu-dev_num);
+   return -ENODEV;
+   }
 
-   mmc = find_mmc_device(dev);
-   if (mmc == NULL || mmc_init(mmc)) {
-   printf(%s: could not find mmc device #%d!\n,
-  __func__, dev);
-   return -ENODEV;
-   }
+   if (mmc_init(mmc)) {
+   error(Couldn't init MMC device.\n);
+   return -ENODEV;
+   }
 
-   blk_dev = mmc-block_dev;
-   if (get_partition_info(blk_dev, part, partinfo) != 0) {
-   printf(%s: could not find partition #%d on mmc device 
#%d!\n,
-  __func__, part, dev);
+   if (!strcmp(entity_type, raw)) {
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = second_arg;
+   dfu-data.mmc.lba_size  = third_arg;
+   dfu-data.mmc.lba_blk_size  = mmc-read_bl_len;
+   } else if (!strcmp(entity_type, part)) {
+   disk_partition_t partinfo;
+   block_dev_desc_t *blk_dev = mmc-block_dev;
+   int mmcdev = second_arg;
+   int mmcpart = third_arg;
+
+   if (get_partition_info(blk_dev, mmcpart, partinfo) != 0) {
+   error(Couldn't find part #%d on mmc device #%d\n,
+ mmcpart, mmcdev);
return -ENODEV;
}
 
-   dfu-data.mmc.lba_start = partinfo.start;
-   dfu-data.mmc.lba_size = partinfo.size;
-   dfu-data.mmc.lba_blk_size = partinfo.blksz;
-
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = partinfo.start;
+   dfu-data.mmc.lba_size  = partinfo.size

[U-Boot] [PATCH v4 03/13] common: fixed linker-list example

2014-04-15 Thread Mateusz Zalega
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  * .x = 3,
  * .y = 4,
  * };
-- 
1.9.0

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


[U-Boot] [PATCH v4 11/13] arm: goni: dfu: Add support for DFU to Goni target

2014-04-15 Thread Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/goni/goni.c  |  8 +++
 include/configs/s5p_goni.h | 54 --
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
 #include samsung/misc.h
+#include usb.h
+#include usb_mass_storage.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   return s3c_udc_probe(s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER Samsung
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT onenand0=samsung-onenand
@@ -91,7 +95,34 @@
,12m(modem)\
,60m(qboot)\0
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_BOOT boot
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define CONFIG_DFU_ALT \
+   u-boot raw 0x80 0x400; \
+   uImage ext4 0 2; \
+   exynos3-goni.dtb ext4 0 2; \
+   PARTS_ROOT part 0 5\0
+
+#define PARTS_DEFAULT \
+   uuid_disk=${uuid_gpt_disk}; \
+   name=PARTS_CSA,size=8MiB,uuid=${uuid_gpt_PARTS_CSA}; \
+   name=PARTS_BOOTLOADER,size=60MiB, \
+   uuid=${uuid_gpt_PARTS_BOOTLOADER}; \
+   name=PARTS_BOOT,size=100MiB,uuid=${uuid_gpt_PARTS_BOOT}; \
+   name=PARTS_ROOT,size=1GiB,uuid=${uuid_gpt_PARTS_ROOT}; \
+   name=PARTS_DATA,size=3GiB,uuid=${uuid_gpt_PARTS_DATA}; \
+   name=PARTS_CSC,size=150MiB,uuid=${uuid_gpt_PARTS_CSC}; \
+   name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_BOOTCOMMAND run mmcboot
 
@@ -150,18 +181,18 @@
verify=n\0 \
rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
-   mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
mmcrootpart=5\0 \
+   partitions= PARTS_DEFAULT \
bootblock=9\0 \
ubiblock=8\0 \
ubi=enabled\0 \
-   opts=always_resume=1
+   opts=always_resume=1\0 \
+   dfu_alt_info= CONFIG_DFU_ALT \0
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/
 #define CONFIG_SYS_PROMPT  Goni # 
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE

[U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API

2014-04-15 Thread Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Minkyu Kang mk7.k...@samsung.com
---
 common/cmd_dfu.c|  3 +-
 common/cmd_thordown.c   |  3 +-
 common/cmd_usb_mass_storage.c   |  2 +-
 drivers/usb/gadget/f_dfu.c  |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c |  2 ++
 drivers/usb/gadget/g_dnl.c  | 64 -
 include/dfu.h   |  7 
 include/g_dnl.h | 24 ++
 include/thor.h  |  8 -
 include/usb_mass_storage.h  |  8 -
 11 files changed, 63 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   char *s = dfu;
int ret, i = 0;
 
ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
int controller_index = simple_strtoul(usb_controller, NULL, 0);
board_usb_init(controller_index, USB_INIT_DEVICE);
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_dfu);
while (1) {
if (dfu_reset())
/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   const char *s = thor;
int ret;
 
puts(TIZEN \THOR\ Downloader\n);
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
goto exit;
}
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_thor);
 
ret = thor_init();
if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 2f69a53..ab10ea6 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-   g_dnl_register(ums);
+   g_dnl_register(usb_dnl_ums);
 
 #ifdef CONFIG_USB_CABLE_CHECK
/* Timeout unit: seconds */
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index de75ff1..1b1e179 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include linux/usb/composite.h
 
 #include dfu.h
+#include g_dnl.h
 #include f_dfu.h
 
 struct f_dfu {
@@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
 
return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index f896169..f88bb12 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 #include usb/lin_gadget_compat.h
+#include g_dnl.h
 
 /**/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
debug(%s:\n, __func__);
return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..3575aca 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION usb_dnl 2.0
 
-static const char shortname[] = usb_dnl_;
 static const char product[] = USB download gadget;
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
free(cdev-config);
cdev-config = NULL;
debug(%s: calling usb_gadget_disconnect for 
-   controller '%s'\n, shortname, gadget-name);
+   controller '%s'\n, __func__, gadget-name);
usb_gadget_disconnect(gadget);
 
return 0;
 }
 
+static inline struct

[U-Boot] [PATCH v4 05/13] mmc: postponed needless timer initialization

2014-04-15 Thread Mateusz Zalega
mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/mmc/mmc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 16051e5..c93dc24 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1310,15 +1310,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
int err = IN_PROGRESS;
-   unsigned start = get_timer(0);
+   unsigned start;
 
if (mmc-has_init)
return 0;
+
+   start = get_timer(0);
+
if (!mmc-init_in_progress)
err = mmc_start_init(mmc);
-
if (!err || err == IN_PROGRESS)
err = mmc_complete_init(mmc);
+
debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
return err;
 }
-- 
1.9.0

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


[U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc.

2014-04-15 Thread Mateusz Zalega
This is, I hope, the final version of patchset.

Custodians: please ack appropriate patches.

Minkyu Kang: Could you pick it up after it gets reviewed by the community?

patches 1-7: fixes that can be applied before features
patches 8-13: features and fixes that depend on features

Patchset has been tested by running MAKEALL -a arm on every commit, so that it
wouldn't break bisect.

Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com

---
Changes since v1:
- reordered
  USB: gadget: added a saner gadget downloader registration API
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
v2:
- fixed issues which came to [Marek Vasut]'s attention
- rebased
v3:
- previous version of the ums patch introduced unused variable warnings
- const attribute of function argument broke existing interface in one of MMC 
patches
- grouped patches related to common topics
---

Mateusz Zalega (13):
  mmc: mmc header fix
  part: header fix
  common: fixed linker-list example
  usb: dfu: fix boards wo USB cable detection
  mmc: postponed needless timer initialization
  dfu: mmc: raw data write fix
  ums: always initialize mmc before ums_disk_init()
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm: goni: Update configuration for Goni target
  arm: goni: dfu: Add support for DFU to Goni target
  arm: goni: enable GPT command
  arm: goni: enable USB Mass Storage

 board/samsung/common/ums.c  |  10 ++--
 board/samsung/goni/goni.c   |   8 +++
 common/cmd_dfu.c|   3 +-
 common/cmd_thordown.c   |   3 +-
 common/cmd_usb_mass_storage.c   |   4 +-
 drivers/dfu/dfu_mmc.c   | 106 +++--
 drivers/mmc/mmc.c   |   7 ++-
 drivers/usb/gadget/f_dfu.c  |   3 +
 drivers/usb/gadget/f_mass_storage.c |   3 +
 drivers/usb/gadget/f_thor.c |   2 +
 drivers/usb/gadget/g_dnl.c  |  64 +---
 include/configs/am335x_evm.h|  10 ++--
 include/configs/s5p_goni.h  | 113 +---
 include/configs/trats.h |   2 +-
 include/configs/trats2.h|   2 +-
 include/dfu.h   |  12 
 include/g_dnl.h |  24 
 include/linker_lists.h  |   2 +-
 include/mmc.h   |   1 +
 include/part.h  |   1 +
 include/thor.h  |   8 ---
 include/usb_mass_storage.h  |   8 ---
 22 files changed, 235 insertions(+), 161 deletions(-)

-- 
1.9.0

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


[U-Boot] [PATCH v4 02/13] part: header fix

2014-04-15 Thread Mateusz Zalega
Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include ide.h
+#include common.h
 
 typedef struct block_dev_desc {
int if_type;/* type of the interface */
-- 
1.9.0

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


[U-Boot] [PATCH v4 10/13] arm: goni: Update configuration for Goni target

2014-04-15 Thread Mateusz Zalega
Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 56 +-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110 1   /* which is in a S5PC110 */
 #define CONFIG_MACH_GONI   1   /* working with Goni */
 
+#include linux/sizes.h
 #include asm/arch/cpu.h  /* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x10, 0x10 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
,7m(kernel)\
,1m(log)\
,12m(modem)\
-   ,60m(qboot)\
-   ,-(UBI)\0
+   ,60m(qboot)\0
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
-#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext2 \
+#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext4 \
 ${console} ${meminfo}
 
 #define CONFIG_COMMON_BOOT ${console} ${meminfo} ${mtdparts}
 
-#define CONFIG_BOOTARGSroot=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 
ubi.mtd=6 \
-rootfstype=cramfs  CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGSroot=/dev/mtdblock8 rootfstype=ext4  \
+   CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB updateb=onenand erase 0x0 0x10; \
 onenand write 0x32008000 0x0 0x10\0
 
-#define CONFIG_UBI_MTD  ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6
-
-#define CONFIG_UBIFS_OPTIONrootflags=bulk_read,no_chk_data_crc
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
-   rootfstype=${rootfstype} CONFIG_UBI_MTD  ${opts}  \
+   rootfstype=${rootfstype} ${opts}  \
${lcdinfo}  CONFIG_COMMON_BOOT ; run bootk\0 \
ubifsboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
tftpboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
-   CONFIG_COMMON_BOOT ; tftp 0x30007FC0 uImage;  \
-   bootm 0x30007FC0\0 \
+   ${opts} ${lcdinfo}  CONFIG_COMMON_BOOT \
+   ; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0 \
ramboot= \
set bootargs  CONFIG_RAMDISK_BOOT \
-initrd=0x3300,8M ramdisk=8192\0 \
+   initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
-   CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   mmcblk=/dev/mmcblk1p1\0 \
+   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   mmcdev=0\0 \
+   mmcbootpart=2\0 \
+   mmcrootpart=5\0 \
bootblock=9\0

[U-Boot] [PATCH v4 12/13] arm: goni: enable GPT command

2014-04-15 Thread Mateusz Zalega
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.9.0

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


[U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init()

2014-04-15 Thread Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/common/ums.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..dec2963 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -37,8 +37,8 @@ static struct ums ums_dev = {
 
 static struct ums *ums_disk_init(struct mmc *mmc)
 {
-   uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
-   uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+   const uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
+   const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
if (!mmc_end_sector) {
error(MMC capacity is not valid);
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-   struct mmc *mmc = NULL;
+   struct mmc *mmc = find_mmc_device(dev_num);
 
-   mmc = find_mmc_device(dev_num);
-   if (!mmc)
+   if (!mmc || mmc_init(mmc))
return NULL;
-
return ums_disk_init(mmc);
 }
-- 
1.9.0

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


[U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build

2014-04-15 Thread Mateusz Zalega
Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4147f9f..670e3f1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -312,6 +312,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -354,6 +355,7 @@
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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


[U-Boot] [PATCH v4 13/13] arm: goni: enable USB Mass Storage

2014-04-15 Thread Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif /* __CONFIG_H */
-- 
1.9.0

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


Re: [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API

2014-04-11 Thread Mateusz Zalega
On 04/03/14 10:52, Marek Vasut wrote:
 Acked-by: Lukasz Majewski l.majew...@samsung.com

 I suggest this goes for -next. Do you agree?

 I'm fine with this code going to -next. Thanks in advance.
 
 Hm, actually, I see we have open issues with the 04/13 V2 patch (why don't 
 you 
 have default __weak usb_cable_detection() implementation instead of another 
 #ifdef ?).

Existing code relied on boolean value returned from
usb_cable_connected(), but there was no way to signal that it's
impossible to tell whether cable is connected or not. If you prefer an
enum with USBCNT_DONTKNOW as a return value, make a decision.

 The whole patchset is a mix of completely unrelated things which should go 
 through different trees. Can the patchset be reordered/split in some 
 reasonable 
 chunks ? There are fixes which should go in immediatelly and then features 
 which 
 should go in for -next.

Not exactly unrelated, most of it should be applied in this particular
order. It would be less chaotic had it been accepted in one piece.

 btw. please keep custodians on CC of the respective patches.

OK

Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] board: samsung: delete unused source files

2014-04-11 Thread Mateusz Zalega
On 03/31/14 06:05, Masahiro Yamada wrote:
 Signed-off-by: Masahiro Yamada yamad...@jp.panasonic.com
 Cc: Mateusz Zalega m.zal...@samsung.com
 Cc: Minkyu Kang mk7.k...@samsung.com
 ---
  board/samsung/goni/mem_setup.S | 249 
 -
  board/samsung/smdkc100/mem_setup.S | 181 ---
  2 files changed, 430 deletions(-)
  delete mode 100644 board/samsung/goni/mem_setup.S
  delete mode 100644 board/samsung/smdkc100/mem_setup.S

Acked-by: Mateusz Zalega m.zal...@samsung.com

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 02/13] part: header fix

2014-03-31 Thread Mateusz Zalega
Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include ide.h
+#include common.h
 
 typedef struct block_dev_desc {
int if_type;/* type of the interface */
-- 
1.9.0

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


[U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc.

2014-03-31 Thread Mateusz Zalega
This is an updated version of patch series regarding DFU, MMC, USB Gadget and
Samsung Goni board, originally sent on 10 January 2014.

---
Changes since v1:
- reordered
  USB: gadget: added a saner gadget downloader registration API
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
v2:
- fixed issues which came to [Marek Vasut]'s attention
- rebased
---

Mateusz Zalega (13):
  mmc: mmc header fix
  part: header fix
  arm:goni: Update configuration for goni target
  dfu: fix boards wo USB cable detection
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm:goni:dfu Add support for DFU to Goni target
  arm:goni: enable GPT command
  arm:goni: enable USB Mass Storage
  dfu:mmc: raw data write fix
  mmc: postponed needless timer initialization
  ums: always initialize mmc before ums_disk_init()
  common: fixed linker-list example

 board/samsung/common/ums.c  |  12 ++--
 board/samsung/goni/goni.c   |   8 +++
 common/cmd_dfu.c|   3 +-
 common/cmd_thordown.c   |   3 +-
 common/cmd_usb_mass_storage.c   |   4 +-
 drivers/dfu/dfu_mmc.c   | 106 +++--
 drivers/mmc/mmc.c   |   7 ++-
 drivers/usb/gadget/f_dfu.c  |   3 +
 drivers/usb/gadget/f_mass_storage.c |   3 +
 drivers/usb/gadget/f_thor.c |   2 +
 drivers/usb/gadget/g_dnl.c  |  64 +---
 include/configs/am335x_evm.h|  10 ++--
 include/configs/s5p_goni.h  | 113 +---
 include/configs/trats.h |   2 +-
 include/configs/trats2.h|   2 +-
 include/dfu.h   |  12 
 include/g_dnl.h |  24 
 include/linker_lists.h  |   2 +-
 include/mmc.h   |   1 +
 include/part.h  |   1 +
 include/thor.h  |   8 ---
 include/usb_mass_storage.h  |   8 ---
 22 files changed, 236 insertions(+), 162 deletions(-)

-- 
1.9.0

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


[U-Boot] [PATCH v3 05/13] am335x: dfu: disable DFU in am335x_evm SPL build

2014-03-31 Thread Mateusz Zalega
Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index fd6f52c..c1f2abf 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -315,6 +315,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -357,6 +358,7 @@
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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


[U-Boot] [PATCH v3 09/13] arm:goni: enable USB Mass Storage

2014-03-31 Thread Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif /* __CONFIG_H */
-- 
1.9.0

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


[U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API

2014-03-31 Thread Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
 common/cmd_dfu.c|  3 +-
 common/cmd_thordown.c   |  3 +-
 common/cmd_usb_mass_storage.c   |  2 +-
 drivers/usb/gadget/f_dfu.c  |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c |  2 ++
 drivers/usb/gadget/g_dnl.c  | 64 -
 include/dfu.h   |  7 
 include/g_dnl.h | 24 ++
 include/thor.h  |  8 -
 include/usb_mass_storage.h  |  8 -
 11 files changed, 63 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   char *s = dfu;
int ret, i = 0;
 
ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
int controller_index = simple_strtoul(usb_controller, NULL, 0);
board_usb_init(controller_index, USB_INIT_DEVICE);
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_dfu);
while (1) {
if (dfu_reset())
/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   const char *s = thor;
int ret;
 
puts(TIZEN \THOR\ Downloader\n);
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
goto exit;
}
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_thor);
 
ret = thor_init();
if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5175bd5..4c2de48 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-   g_dnl_register(ums);
+   g_dnl_register(usb_dnl_ums);
 
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..2f822c4 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include linux/usb/composite.h
 
 #include dfu.h
+#include g_dnl.h
 #include f_dfu.h
 
 struct f_dfu {
@@ -781,3 +782,5 @@ int dfu_add(struct usb_configuration *c)
 
return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index f896169..f88bb12 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 #include usb/lin_gadget_compat.h
+#include g_dnl.h
 
 /**/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
debug(%s:\n, __func__);
return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..3575aca 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION usb_dnl 2.0
 
-static const char shortname[] = usb_dnl_;
 static const char product[] = USB download gadget;
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
free(cdev-config);
cdev-config = NULL;
debug(%s: calling usb_gadget_disconnect for 
-   controller '%s'\n, shortname, gadget-name);
+   controller '%s'\n, __func__, gadget-name);
usb_gadget_disconnect(gadget);
 
return 0;
 }
 
+static inline struct

[U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init()

2014-03-31 Thread Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/common/ums.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..1375138 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -35,10 +35,10 @@ static struct ums ums_dev = {
.name = UMS disk,
 };
 
-static struct ums *ums_disk_init(struct mmc *mmc)
+static struct ums *ums_disk_init(const struct mmc *mmc)
 {
-   uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
-   uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+   const uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
+   const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
if (!mmc_end_sector) {
error(MMC capacity is not valid);
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-   struct mmc *mmc = NULL;
+   struct mmc *mmc = find_mmc_device(dev_num);
 
-   mmc = find_mmc_device(dev_num);
-   if (!mmc)
+   if (!mmc || mmc_init(mmc))
return NULL;
-
return ums_disk_init(mmc);
 }
-- 
1.9.0

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


[U-Boot] [PATCH v3 03/13] arm:goni: Update configuration for goni target

2014-03-31 Thread Mateusz Zalega
Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@gmail.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 56 +-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110 1   /* which is in a S5PC110 */
 #define CONFIG_MACH_GONI   1   /* working with Goni */
 
+#include linux/sizes.h
 #include asm/arch/cpu.h  /* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x10, 0x10 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
,7m(kernel)\
,1m(log)\
,12m(modem)\
-   ,60m(qboot)\
-   ,-(UBI)\0
+   ,60m(qboot)\0
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
-#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext2 \
+#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext4 \
 ${console} ${meminfo}
 
 #define CONFIG_COMMON_BOOT ${console} ${meminfo} ${mtdparts}
 
-#define CONFIG_BOOTARGSroot=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 
ubi.mtd=6 \
-rootfstype=cramfs  CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGSroot=/dev/mtdblock8 rootfstype=ext4  \
+   CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB updateb=onenand erase 0x0 0x10; \
 onenand write 0x32008000 0x0 0x10\0
 
-#define CONFIG_UBI_MTD  ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6
-
-#define CONFIG_UBIFS_OPTIONrootflags=bulk_read,no_chk_data_crc
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
-   rootfstype=${rootfstype} CONFIG_UBI_MTD  ${opts}  \
+   rootfstype=${rootfstype} ${opts}  \
${lcdinfo}  CONFIG_COMMON_BOOT ; run bootk\0 \
ubifsboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
tftpboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
-   CONFIG_COMMON_BOOT ; tftp 0x30007FC0 uImage;  \
-   bootm 0x30007FC0\0 \
+   ${opts} ${lcdinfo}  CONFIG_COMMON_BOOT \
+   ; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0 \
ramboot= \
set bootargs  CONFIG_RAMDISK_BOOT \
-initrd=0x3300,8M ramdisk=8192\0 \
+   initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
-   CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   mmcblk=/dev/mmcblk1p1\0 \
+   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   mmcdev=0\0 \
+   mmcbootpart=2\0 \
+   mmcrootpart=5\0 \
bootblock=9\0

[U-Boot] [PATCH v3 13/13] common: fixed linker-list example

2014-03-31 Thread Mateusz Zalega
Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Tom Rini tr...@ti.com
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  * .x = 3,
  * .y = 4,
  * };
-- 
1.9.0

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


[U-Boot] [PATCH v3 10/13] dfu:mmc: raw data write fix

2014-03-31 Thread Mateusz Zalega
When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/dfu/dfu_mmc.c| 106 ++-
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h  |   2 +-
 include/configs/trats2.h |   2 +-
 include/dfu.h|   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 0816f46..75ff373 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -167,66 +167,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 
offset, void *buf,
return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ * 1st:
+ * raw (raw read/write)
+ * fat (files)
+ * ext4(^)
+ * part(partition image)
+ * 2nd and 3rd:
+ * lba_start and lba_size, for raw write
+ * mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-   int dev, part;
-   struct mmc *mmc;
-   block_dev_desc_t *blk_dev;
-   disk_partition_t partinfo;
-   char *st;
-
-   dfu-dev_type = DFU_DEV_MMC;
-   st = strsep(s,  );
-   if (!strcmp(st, mmc)) {
-   dfu-layout = DFU_RAW_ADDR;
-   dfu-data.mmc.lba_start = simple_strtoul(s, s, 16);
-   dfu-data.mmc.lba_size = simple_strtoul(++s, s, 16);
-   dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
-   } else if (!strcmp(st, fat)) {
-   dfu-layout = DFU_FS_FAT;
-   } else if (!strcmp(st, ext4)) {
-   dfu-layout = DFU_FS_EXT4;
-   } else if (!strcmp(st, part)) {
+   const char *argv[3];
+   const char **parg = argv;
+   for (; parg  argv + sizeof(argv) / sizeof(*argv); ++parg) {
+   *parg = strsep(s,  );
+   if (*parg == NULL) {
+   error(Invalid number of arguments.\n);
+   return -ENODEV;
+   }
+   }
 
-   dfu-layout = DFU_RAW_ADDR;
+   const char *entity_type = argv[0];
+   /*
+* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+* with default 10.
+*/
+   size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+   size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-   dev = simple_strtoul(s, s, 10);
-   s++;
-   part = simple_strtoul(s, s, 10);
+   struct mmc *mmc = find_mmc_device(dfu-dev_num);
+   if (mmc == NULL) {
+   error(Couldn't find MMC device no. %d.\n, dfu-dev_num);
+   return -ENODEV;
+   }
 
-   mmc = find_mmc_device(dev);
-   if (mmc == NULL || mmc_init(mmc)) {
-   printf(%s: could not find mmc device #%d!\n,
-  __func__, dev);
-   return -ENODEV;
-   }
+   if (mmc_init(mmc)) {
+   error(Couldn't init MMC device.\n);
+   return -ENODEV;
+   }
 
-   blk_dev = mmc-block_dev;
-   if (get_partition_info(blk_dev, part, partinfo) != 0) {
-   printf(%s: could not find partition #%d on mmc device 
#%d!\n,
-  __func__, part, dev);
+   if (!strcmp(entity_type, raw)) {
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = second_arg;
+   dfu-data.mmc.lba_size  = third_arg;
+   dfu-data.mmc.lba_blk_size  = mmc-read_bl_len;
+   } else if (!strcmp(entity_type, part)) {
+   disk_partition_t partinfo;
+   block_dev_desc_t *blk_dev = mmc-block_dev;
+   int mmcdev = second_arg;
+   int mmcpart = third_arg;
+
+   if (get_partition_info(blk_dev, mmcpart, partinfo) != 0) {
+   error(Couldn't find part #%d on mmc device #%d\n,
+ mmcpart, mmcdev);
return -ENODEV;
}
 
-   dfu-data.mmc.lba_start = partinfo.start;
-   dfu-data.mmc.lba_size = partinfo.size;
-   dfu-data.mmc.lba_blk_size = partinfo.blksz;
-
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = partinfo.start;
+   dfu-data.mmc.lba_size  = partinfo.size

[U-Boot] [PATCH v3 07/13] arm:goni:dfu Add support for DFU to Goni target

2014-03-31 Thread Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/goni/goni.c  |  8 +++
 include/configs/s5p_goni.h | 54 --
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
 #include samsung/misc.h
+#include usb.h
+#include usb_mass_storage.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   return s3c_udc_probe(s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER Samsung
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT onenand0=samsung-onenand
@@ -91,7 +95,34 @@
,12m(modem)\
,60m(qboot)\0
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_BOOT boot
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define CONFIG_DFU_ALT \
+   u-boot raw 0x80 0x400; \
+   uImage ext4 0 2; \
+   exynos3-goni.dtb ext4 0 2; \
+   PARTS_ROOT part 0 5\0
+
+#define PARTS_DEFAULT \
+   uuid_disk=${uuid_gpt_disk}; \
+   name=PARTS_CSA,size=8MiB,uuid=${uuid_gpt_PARTS_CSA}; \
+   name=PARTS_BOOTLOADER,size=60MiB, \
+   uuid=${uuid_gpt_PARTS_BOOTLOADER}; \
+   name=PARTS_BOOT,size=100MiB,uuid=${uuid_gpt_PARTS_BOOT}; \
+   name=PARTS_ROOT,size=1GiB,uuid=${uuid_gpt_PARTS_ROOT}; \
+   name=PARTS_DATA,size=3GiB,uuid=${uuid_gpt_PARTS_DATA}; \
+   name=PARTS_CSC,size=150MiB,uuid=${uuid_gpt_PARTS_CSC}; \
+   name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_BOOTCOMMAND run mmcboot
 
@@ -150,18 +181,18 @@
verify=n\0 \
rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
-   mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
mmcrootpart=5\0 \
+   partitions= PARTS_DEFAULT \
bootblock=9\0 \
ubiblock=8\0 \
ubi=enabled\0 \
-   opts=always_resume=1
+   opts=always_resume=1\0 \
+   dfu_alt_info= CONFIG_DFU_ALT \0
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/
 #define CONFIG_SYS_PROMPT  Goni # 
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE

[U-Boot] [PATCH v3 01/13] mmc: mmc header fix

2014-03-31 Thread Mateusz Zalega
Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index b65ad9e..afc226a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include linux/list.h
 #include linux/compiler.h
+#include part.h
 
 #define SD_VERSION_SD  0x2
 #define SD_VERSION_3   (SD_VERSION_SD | 0x300)
-- 
1.9.0

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


[U-Boot] [PATCH v3 08/13] arm:goni: enable GPT command

2014-03-31 Thread Mateusz Zalega
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.9.0

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


[U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection

2014-03-31 Thread Mateusz Zalega
Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..5175bd5 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
+#ifdef CONFIG_USB_CABLE_CHECK
if (!usb_cable_connected()) {
puts(Please connect USB cable.\n);
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
}
puts(\r\n);
}
+#endif
 
while (1) {
usb_gadget_handle_interrupts();
-- 
1.9.0

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


[U-Boot] [PATCH v3 11/13] mmc: postponed needless timer initialization

2014-03-31 Thread Mateusz Zalega
mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Change-Id: Ib4e0f5a04316c604e6a77a0679d42ff61d5641d2
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
---
 drivers/mmc/mmc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 8ab0bc9..9da31f5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1279,15 +1279,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
int err = IN_PROGRESS;
-   unsigned start = get_timer(0);
+   unsigned start;
 
if (mmc-has_init)
return 0;
+
+   start = get_timer(0);
+
if (!mmc-init_in_progress)
err = mmc_start_init(mmc);
-
if (!err || err == IN_PROGRESS)
err = mmc_complete_init(mmc);
+
debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
return err;
 }
-- 
1.9.0

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


Re: [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API

2014-02-06 Thread Mateusz Zalega
On 02/05/14 19:00, Marek Vasut wrote:
 On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
 
 [...]
 
 Are these two new functions called from multiple places at all? If not,
 just inline these ll_foo() calls and be done with it. FYI you can also
 make macros for these to avoid having to type all these args all around
 and duplicating the code.

 Macros or static inlines, it's all the same
 
 NAK, what you say is seriously wrong, you should know that by now!
 
 Macros do not do any kind of typechecking, functions do typechecking.
 Macros are expanded in place during preprocessing, functions are (usually) 
 single-instance.
 
 etc.

Yeah, and it's all the same if you don't care for typechecking and all
that, which I assumed from _you_ proposing usage of macros here.

 there's no point in
 changing that. The symbols aren't visible outside this compilation unit
 and function calls are, well, inlined.
 
 It's pointless to have them pulled out so explicitly. Or would you prefer to 
 have each function encapsulated in another function ? This doesn't make does 
 now, does it ?

Pardon?

 What I would like to do is for you to follow the advice in linker_lists.h and 
 produce a small shim over these crude linker lists prototypes there, so that 
 the 
 users here in the g_* world don't have to type the whole linker list macros 
 with 
 all the arguments, which do not ever change for this g_* . Does it make sense 
 please?

It's taken care of by static inlines.

  static int g_dnl_do_config(struct usb_configuration *c)
  {
  
const char *s = c-cdev-driver-name;

 -  int ret = -1;

debug(%s: configuration: 0x%p composite dev: 0x%p\n,

 -__func__, c, c-cdev);
 -
 +  __func__, c, c-cdev);

printf(GADGET DRIVER: %s\n, s);

 -  if (!strcmp(s, usb_dnl_dfu))
 -  ret = dfu_add(c);
 -  else if (!strcmp(s, usb_dnl_ums))
 -  ret = fsg_add(c);
 -  else if (!strcmp(s, usb_dnl_thor))
 -  ret = thor_add(c);
 -
 -  return ret;
 +
 +  struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
 +  for (; callback != g_dnl_last_bind_callback(); ++callback)

 callback++ , this is not C++ where the order might matter. Nonetheless,
 you do

 It doesn't matter anyway and can't be supported on Coding Style grounds,
 don't bug me.
 
 Can be done on purely statistical grounds, try this:
 
 $ git grep 'for.*(.* *++[:alnum:]\+ *)' | wc -l
 13
 $ git grep 'for.*(.* *[:alnum:]\+++ *)' | wc -l
 183
 
 Please fix, thank you.

Okay, whatever.

 want to use ll_entry_count() and ll_entry_get() with an iterator variable

 I don't think using ll_entry_get() in this way is possible with current
 implementation of linker lists. Moreover, there's plenty of code doing
 just the same already accepted to U-Boot.
 
 Ah meh, sorry. Seems like someone was messing with the linkerlists and 
 misdesigned it. Dang.

$ git show 42eba

Yeah, it's a pity.

 instead to make sure you don't step onto a corrupted field and crash in
 some weird way.

 Linker would have to split sections to make this sort of thing possible.
 Won't happen.
 
 Can you please elaborate ?
 [...]
 

You're guaranteed by the linker, and our setup, that all your
linker-list data will end up in a contiguous block.

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API

2014-02-05 Thread Mateusz Zalega
On 02/05/14 08:13, Marek Vasut wrote:
 On Tuesday, February 04, 2014 at 06:02:38 PM, Mateusz Zalega wrote:
 Preprocessor definitions and hardcoded implementation selection in
 g_dnl core were replaced by a linker list made of (usb_function_name,
 bind_callback) pairs.

 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 
 [...]
 
 +
 +/* export dfu_add to g_dnl.o */
 +ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
 +g_dnl_bind_callbacks) = { .usb_function_name = usb_dnl_dfu,
 +  .fptr = dfu_add };
 
 
 from linker-lists.h quote:
 
 104  * ll_entry_declare() - Declare linker-generated array entry
 [...]
 110  * This macro declares a variable that is placed into a linker-generated
 111  * array. This is a basic building block for more advanced use of linker-
 112  * generated arrays. The user is expected to build their own macro wrapper
 113  * around this one.
 
 Can you follow this advice and build a macro for declaring these USB devices ?
 btw would you mind fixing the example for ll_entry_declare() in 
 linker-lists.h ? 
 It has four params in the example for some reason (it's a remnant from 
 rework).

Yup

 [...]
 
 +static inline struct g_dnl_bind_callback * g_dnl_first_bind_callback(void)
 +{
 +return ll_entry_start(struct g_dnl_bind_callback,
 +g_dnl_bind_callbacks);
 +}
 +
 +static inline struct g_dnl_bind_callback * g_dnl_last_bind_callback(void)
 +{
 +return ll_entry_end(struct g_dnl_bind_callback,
 +g_dnl_bind_callbacks);
 +}
 +
 
 Are these two new functions called from multiple places at all? If not, just 
 inline these ll_foo() calls and be done with it. FYI you can also make macros 
 for these to avoid having to type all these args all around and duplicating 
 the 
 code.

Macros or static inlines, it's all the same, there's no point in
changing that. The symbols aren't visible outside this compilation unit
and function calls are, well, inlined.

  static int g_dnl_do_config(struct usb_configuration *c)
  {
  const char *s = c-cdev-driver-name;
 -int ret = -1;

  debug(%s: configuration: 0x%p composite dev: 0x%p\n,
 -  __func__, c, c-cdev);
 -
 +__func__, c, c-cdev);
  printf(GADGET DRIVER: %s\n, s);
 -if (!strcmp(s, usb_dnl_dfu))
 -ret = dfu_add(c);
 -else if (!strcmp(s, usb_dnl_ums))
 -ret = fsg_add(c);
 -else if (!strcmp(s, usb_dnl_thor))
 -ret = thor_add(c);
 -
 -return ret;
 +
 +struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
 +for (; callback != g_dnl_last_bind_callback(); ++callback)
 
 callback++ , this is not C++ where the order might matter. Nonetheless, you 
 do 

It doesn't matter anyway and can't be supported on Coding Style grounds,
don't bug me.

 want to use ll_entry_count() and ll_entry_get() with an iterator variable 

I don't think using ll_entry_get() in this way is possible with current
implementation of linker lists. Moreover, there's plenty of code doing
just the same already accepted to U-Boot.

 instead to make sure you don't step onto a corrupted field and crash in some 
 weird way.

Linker would have to split sections to make this sort of thing possible.
Won't happen.

 +if (!strcmp(s, callback-usb_function_name))
 +return callback-fptr(c);
 +return -ENODEV;
  }

  static int g_dnl_config_register(struct usb_composite_dev *cdev)
 @@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
  device_desc.bcdDevice = cpu_to_le16(gcnum);
  else {
  debug(%s: controller '%s' not recognized\n,
 -shortname, gadget-name);
 +__func__, gadget-name);
  device_desc.bcdDevice = __constant_cpu_to_le16(0x);
  }

 -debug(%s: calling usb_gadget_connect for 
 -controller '%s'\n, shortname, gadget-name);
 +debug(%s: calling usb_gadget_connect for controller '%s'\n,
 +__func__, gadget-name);
 
 Please split all these cleanups into a separate patch.

Right, I'll post v3.

 [...]
 

Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 00/12] Series v2.

2014-02-04 Thread Mateusz Zalega
This is an updated version of patch series regarding DFU, MMC, USB Gadget and
Samsung Goni board, originally sent on 10 January 2014.

---
Changes since v1:
- reordered
  USB: gadget: added a saner gadget downloader registration API
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
---

Mateusz Zalega (12):
  mmc: mmc header fix
  part: header fix
  arm:goni: Update configuration for goni target
  dfu: fix boards wo USB cable detection
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm:goni:dfu Add support for DFU to Goni target
  arm:goni: enable GPT command
  arm:goni: enable USB Mass Storage
  dfu:mmc: raw data write fix
  mmc: postponed needless timer initialization
  ums: always initialize mmc before ums_disk_init()

 board/samsung/common/ums.c  |  12 ++--
 board/samsung/goni/goni.c   |   9 +++
 common/cmd_dfu.c|   3 +-
 common/cmd_thordown.c   |   3 +-
 common/cmd_usb_mass_storage.c   |   4 +-
 drivers/dfu/dfu_mmc.c   | 106 +++--
 drivers/mmc/mmc.c   |   7 ++-
 drivers/usb/gadget/f_dfu.c  |  11 +++-
 drivers/usb/gadget/f_mass_storage.c |   6 ++
 drivers/usb/gadget/f_thor.c |   5 ++
 drivers/usb/gadget/g_dnl.c  |  74 +++
 include/configs/am335x_evm.h|  10 ++--
 include/configs/s5p_goni.h  | 113 +---
 include/configs/trats.h |   2 +-
 include/configs/trats2.h|   2 +-
 include/dfu.h   |  12 
 include/g_dnl.h |  11 
 include/mmc.h   |   1 +
 include/part.h  |   1 +
 include/thor.h  |   8 ---
 include/usb_mass_storage.h  |   8 ---
 21 files changed, 239 insertions(+), 169 deletions(-)

-- 
1.8.2.1

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


[U-Boot] [PATCH v2 07/12] arm:goni:dfu Add support for DFU to Goni target

2014-02-04 Thread Mateusz Zalega
Proper adjustment for supporting DFU by Goni target has been made.
The s5p_goni.h file has been updated. Moreover, the code for low level
USB initialization has been added to Goni board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/goni/goni.c  |  9 
 include/configs/s5p_goni.h | 54 --
 2 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 366f648..6b1548c 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -13,6 +13,9 @@
 #include usb/s3c_udc.h
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
+#include usb.h
+#include usb_mass_storage.h
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct s5pc110_gpio *s5pc110_gpio;
@@ -172,4 +175,10 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   return s3c_udc_probe(s5pc110_otg_data);
+}
 #endif
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 1d2dcc0..24a0fcc 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -39,7 +39,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -70,14 +70,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER Samsung
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT onenand0=samsung-onenand
@@ -90,7 +94,34 @@
,12m(modem)\
,60m(qboot)\0
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_BOOT boot
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define CONFIG_DFU_ALT \
+   u-boot raw 0x80 0x400; \
+   uImage ext4 0 2; \
+   exynos3-goni.dtb ext4 0 2; \
+   PARTS_ROOT part 0 5\0
+
+#define PARTS_DEFAULT \
+   uuid_disk=${uuid_gpt_disk}; \
+   name=PARTS_CSA,size=8MiB,uuid=${uuid_gpt_PARTS_CSA}; \
+   name=PARTS_BOOTLOADER,size=60MiB, \
+   uuid=${uuid_gpt_PARTS_BOOTLOADER}; \
+   name=PARTS_BOOT,size=100MiB,uuid=${uuid_gpt_PARTS_BOOT}; \
+   name=PARTS_ROOT,size=1GiB,uuid=${uuid_gpt_PARTS_ROOT}; \
+   name=PARTS_DATA,size=3GiB,uuid=${uuid_gpt_PARTS_DATA}; \
+   name=PARTS_CSC,size=150MiB,uuid=${uuid_gpt_PARTS_CSC}; \
+   name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_BOOTCOMMAND run mmcboot
 
@@ -144,18 +175,18 @@
verify=n\0 \
rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
-   mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
mmcrootpart=5\0 \
+   partitions= PARTS_DEFAULT \
bootblock=9\0 \
ubiblock=8\0 \
ubi=enabled\0 \
-   opts=always_resume=1
+   opts=always_resume=1\0 \
+   dfu_alt_info= CONFIG_DFU_ALT \0
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/
 #define CONFIG_SYS_PROMPT  Goni # 
@@ -194,6 +225,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define

[U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection

2014-02-04 Thread Mateusz Zalega
Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..5175bd5 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
+#ifdef CONFIG_USB_CABLE_CHECK
if (!usb_cable_connected()) {
puts(Please connect USB cable.\n);
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
}
puts(\r\n);
}
+#endif
 
while (1) {
usb_gadget_handle_interrupts();
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API

2014-02-04 Thread Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
Changes since v1:
- reordered
---
 common/cmd_dfu.c|  3 +-
 common/cmd_thordown.c   |  3 +-
 common/cmd_usb_mass_storage.c   |  2 +-
 drivers/usb/gadget/f_dfu.c  | 11 --
 drivers/usb/gadget/f_mass_storage.c |  6 +++
 drivers/usb/gadget/f_thor.c |  5 +++
 drivers/usb/gadget/g_dnl.c  | 74 +
 include/dfu.h   |  7 
 include/g_dnl.h | 11 ++
 include/thor.h  |  8 
 include/usb_mass_storage.h  |  8 
 11 files changed, 66 insertions(+), 72 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   char *s = dfu;
int ret, i = 0;
 
ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
int controller_index = simple_strtoul(usb_controller, NULL, 0);
board_usb_init(controller_index, USB_INIT_DEVICE);
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_dfu);
while (1) {
if (dfu_reset())
/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   const char *s = thor;
int ret;
 
puts(TIZEN \THOR\ Downloader\n);
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
goto exit;
}
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_thor);
 
ret = thor_init();
if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5175bd5..4c2de48 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-   g_dnl_register(ums);
+   g_dnl_register(usb_dnl_ums);
 
/* Timeout unit: seconds */
int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..cde1895 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -18,12 +18,14 @@
 #include errno.h
 #include common.h
 #include malloc.h
+#include linker_lists.h
 
 #include linux/usb/ch9.h
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 
 #include dfu.h
+#include g_dnl.h
 #include f_dfu.h
 
 struct f_dfu {
@@ -768,9 +770,7 @@ static int dfu_bind_config(struct usb_configuration *c)
 
 int dfu_add(struct usb_configuration *c)
 {
-   int id;
-
-   id = usb_string_id(c-cdev);
+   int id = usb_string_id(c-cdev);
if (id  0)
return id;
strings_dfu_generic[0].id = id;
@@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
 
return dfu_bind_config(c);
 }
+
+/* export dfu_add to g_dnl.o */
+ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
+   g_dnl_bind_callbacks) = { .usb_function_name = usb_dnl_dfu,
+ .fptr = dfu_add };
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index b1fe8bd..b7d03f2 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -243,6 +243,7 @@
 #include config.h
 #include malloc.h
 #include common.h
+#include linker_lists.h
 #include usb.h
 
 #include linux/err.h
@@ -255,6 +256,7 @@
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 #include usb/lin_gadget_compat.h
+#include g_dnl.h
 
 /**/
 
@@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
 
return 0;
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
+   g_dnl_bind_callbacks) = { .usb_function_name = usb_dnl_ums,
+ .fptr = fsg_add };
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index c4c9909..3f428c8 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -17,6 +17,7 @@
 
 #include errno.h
 #include common.h
+#include linker_lists.h
 #include

[U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix

2014-02-04 Thread Mateusz Zalega
When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Acked-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- updated overlooked type in DFU_CONFIG_ALT, trats2.h
---
 drivers/dfu/dfu_mmc.c| 106 ++-
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h  |   2 +-
 include/configs/trats2.h |   2 +-
 include/dfu.h|   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index f942758..075e4cd 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -168,66 +168,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 
offset, void *buf,
return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ * 1st:
+ * raw (raw read/write)
+ * fat (files)
+ * ext4(^)
+ * part(partition image)
+ * 2nd and 3rd:
+ * lba_start and lba_size, for raw write
+ * mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-   int dev, part;
-   struct mmc *mmc;
-   block_dev_desc_t *blk_dev;
-   disk_partition_t partinfo;
-   char *st;
-
-   dfu-dev_type = DFU_DEV_MMC;
-   st = strsep(s,  );
-   if (!strcmp(st, mmc)) {
-   dfu-layout = DFU_RAW_ADDR;
-   dfu-data.mmc.lba_start = simple_strtoul(s, s, 16);
-   dfu-data.mmc.lba_size = simple_strtoul(++s, s, 16);
-   dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
-   } else if (!strcmp(st, fat)) {
-   dfu-layout = DFU_FS_FAT;
-   } else if (!strcmp(st, ext4)) {
-   dfu-layout = DFU_FS_EXT4;
-   } else if (!strcmp(st, part)) {
+   const char *argv[3];
+   const char **parg = argv;
+   for (; parg  argv + sizeof(argv) / sizeof(*argv); ++parg) {
+   *parg = strsep(s,  );
+   if (*parg == NULL) {
+   error(Invalid number of arguments.\n);
+   return -ENODEV;
+   }
+   }
 
-   dfu-layout = DFU_RAW_ADDR;
+   const char *entity_type = argv[0];
+   /*
+* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+* with default 10.
+*/
+   size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+   size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-   dev = simple_strtoul(s, s, 10);
-   s++;
-   part = simple_strtoul(s, s, 10);
+   struct mmc *mmc = find_mmc_device(dfu-dev_num);
+   if (mmc == NULL) {
+   error(Couldn't find MMC device no. %d.\n, dfu-dev_num);
+   return -ENODEV;
+   }
 
-   mmc = find_mmc_device(dev);
-   if (mmc == NULL || mmc_init(mmc)) {
-   printf(%s: could not find mmc device #%d!\n,
-  __func__, dev);
-   return -ENODEV;
-   }
+   if (mmc_init(mmc)) {
+   error(Couldn't init MMC device.\n);
+   return -ENODEV;
+   }
 
-   blk_dev = mmc-block_dev;
-   if (get_partition_info(blk_dev, part, partinfo) != 0) {
-   printf(%s: could not find partition #%d on mmc device 
#%d!\n,
-  __func__, part, dev);
+   if (!strcmp(entity_type, raw)) {
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = second_arg;
+   dfu-data.mmc.lba_size  = third_arg;
+   dfu-data.mmc.lba_blk_size  = mmc-read_bl_len;
+   } else if (!strcmp(entity_type, part)) {
+   disk_partition_t partinfo;
+   block_dev_desc_t *blk_dev = mmc-block_dev;
+   int mmcdev = second_arg;
+   int mmcpart = third_arg;
+
+   if (get_partition_info(blk_dev, mmcpart, partinfo) != 0) {
+   error(Couldn't find part #%d on mmc device #%d\n,
+ mmcpart, mmcdev);
return -ENODEV;
}
 
-   dfu-data.mmc.lba_start = partinfo.start;
-   dfu-data.mmc.lba_size = partinfo.size;
-   dfu-data.mmc.lba_blk_size = partinfo.blksz;
-
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start

[U-Boot] [PATCH v2 03/12] arm:goni: Update configuration for goni target

2014-02-04 Thread Mateusz Zalega
Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Change-Id: I00e55bc970512986f50b1f943021ba9de683795e
Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 56 +-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..1d2dcc0 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110 1   /* which is in a S5PC110 */
 #define CONFIG_MACH_GONI   1   /* working with Goni */
 
+#include asm/sizes.h
 #include asm/arch/cpu.h  /* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -37,11 +38,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x10, 0x10 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -89,30 +88,25 @@
,7m(kernel)\
,1m(log)\
,12m(modem)\
-   ,60m(qboot)\
-   ,-(UBI)\0
+   ,60m(qboot)\0
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
-#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext2 \
+#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext4 \
 ${console} ${meminfo}
 
 #define CONFIG_COMMON_BOOT ${console} ${meminfo} ${mtdparts}
 
-#define CONFIG_BOOTARGSroot=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 
ubi.mtd=6 \
-rootfstype=cramfs  CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGSroot=/dev/mtdblock8 rootfstype=ext4  \
+   CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB updateb=onenand erase 0x0 0x10; \
 onenand write 0x32008000 0x0 0x10\0
 
-#define CONFIG_UBI_MTD  ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6
-
-#define CONFIG_UBIFS_OPTIONrootflags=bulk_read,no_chk_data_crc
-
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_EXTRA_ENV_SETTINGS  \
@@ -124,36 +118,38 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
-   rootfstype=${rootfstype} CONFIG_UBI_MTD  ${opts}  \
+   rootfstype=${rootfstype} ${opts}  \
${lcdinfo}  CONFIG_COMMON_BOOT ; run bootk\0 \
ubifsboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
tftpboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
-   CONFIG_COMMON_BOOT ; tftp 0x30007FC0 uImage;  \
-   bootm 0x30007FC0\0 \
+   ${opts} ${lcdinfo}  CONFIG_COMMON_BOOT \
+   ; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0 \
ramboot= \
set bootargs  CONFIG_RAMDISK_BOOT \
-initrd=0x3300,8M ramdisk=8192\0 \
+   initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
-   CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   mmcblk=/dev/mmcblk1p1\0 \
+   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   mmcdev=0

[U-Boot] [PATCH v2 05/12] am335x: dfu: disable DFU in am335x_evm SPL build

2014-02-04 Thread Mateusz Zalega
Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Tom Rini tr...@ti.com
Cc: Lukasz Majewski l.majew...@samsung.com
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 73a9adb..4f89556 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -302,6 +302,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -344,6 +345,7 @@
DFU_ALT_INFO_MMC \
DFU_ALT_INFO_RAM \
DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 08/12] arm:goni: enable GPT command

2014-02-04 Thread Mateusz Zalega
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 24a0fcc..d25c494 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -231,6 +232,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 01/12] mmc: mmc header fix

2014-02-04 Thread Mateusz Zalega
Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Tom Rini tr...@ti.com
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index e1060b9..64b9be9 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include linux/list.h
 #include linux/compiler.h
+#include part.h
 
 #define SD_VERSION_SD  0x2
 #define SD_VERSION_3   (SD_VERSION_SD | 0x300)
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 09/12] arm:goni: enable USB Mass Storage

2014-02-04 Thread Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index d25c494..7314bff 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -261,5 +261,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif /* __CONFIG_H */
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 02/12] part: header fix

2014-02-04 Thread Mateusz Zalega
Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Change-Id: Iafdd4f1997767e9eb84d583fd32c79c8c4d43afd
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Tom Rini tr...@ti.com
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include ide.h
+#include common.h
 
 typedef struct block_dev_desc {
int if_type;/* type of the interface */
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 11/12] mmc: postponed needless timer initialization

2014-02-04 Thread Mateusz Zalega
mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Pantelis Antoniou pa...@antoniou-consulting.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/mmc/mmc.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index c6a1c23..730ae01 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1279,15 +1279,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
int err = IN_PROGRESS;
-   unsigned start = get_timer(0);
+   unsigned start;
 
if (mmc-has_init)
return 0;
+
+   start = get_timer(0);
+
if (!mmc-init_in_progress)
err = mmc_start_init(mmc);
-
if (!err || err == IN_PROGRESS)
err = mmc_complete_init(mmc);
+
debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
return err;
 }
-- 
1.8.2.1

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


[U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init()

2014-02-04 Thread Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v1:
- patch conforms to kernel coding style
- moved mmc_init() check to ums_init()
---
 board/samsung/common/ums.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..1375138 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -35,10 +35,10 @@ static struct ums ums_dev = {
.name = UMS disk,
 };
 
-static struct ums *ums_disk_init(struct mmc *mmc)
+static struct ums *ums_disk_init(const struct mmc *mmc)
 {
-   uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
-   uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+   const uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
+   const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
if (!mmc_end_sector) {
error(MMC capacity is not valid);
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-   struct mmc *mmc = NULL;
+   struct mmc *mmc = find_mmc_device(dev_num);
 
-   mmc = find_mmc_device(dev_num);
-   if (!mmc)
+   if (!mmc || mmc_init(mmc))
return NULL;
-
return ums_disk_init(mmc);
 }
-- 
1.8.2.1

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


Re: [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()

2014-01-14 Thread Mateusz Zalega
On 01/14/14 01:49, Minkyu Kang wrote:
 On 09/01/14 23:31, Mateusz Zalega wrote:
 In some cases MMC was still uninitialized while media capacity check,
 leading to broken ums command.

 Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Minkyu Kang mk7.k...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 ---
  board/samsung/common/ums.c | 3 +++
  1 file changed, 3 insertions(+)

 diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
 index dc155ad..0d8f30d 100644
 --- a/board/samsung/common/ums.c
 +++ b/board/samsung/common/ums.c
 @@ -37,6 +37,9 @@ static struct ums ums_dev = {
  
  static struct ums *ums_disk_init(struct mmc *mmc)
  {
 +if (mmc_init(mmc))
 +return NULL;
 +
  uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
  uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
  

 
 Why don't you init the mmc before call this function?
 
 diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
 index dc155ad..7017c2a 100644
 --- a/board/samsung/common/ums.c
 +++ b/board/samsung/common/ums.c
 @@ -72,5 +72,8 @@ struct ums *ums_init(unsigned int dev_num)
 if (!mmc)
 return NULL;
  
 +   if (mmc_init(mmc))
 +   return NULL;
 +
 return ums_disk_init(mmc);
  }

I agree, ACK.

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix

2014-01-13 Thread Mateusz Zalega
On 01/10/14 06:03, Jaehoon Chung wrote:
 This patch should be separated with dfu and mmc.

ACK, because we're going to remove the bl_len assertion, see below.

 On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
 When user attempted to perform a raw write using DFU (vide
 dfu_fill_entity_mmc) with MMC interface not initialized before,
 get_mmc_blk_size() reported invalid (zero) block size - it wasn't
 possible to write ie. a new u-boot image.

 This commit fixes that by initializing device in get_mmc_blk_size() when
 needed.

 Tested on Samsung Goni.

 v2 changes:
 - code cleanup
 - minor dfu_alt_info format change

 v3 changes:
 - moved invalid block length check to mmc core
 - removed redundant 'has_init' check

 Change-Id: Icb50bb9f805a9a78848acd19f682fad474cb9082
 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 Reviewed-by: Lukasz Majewski l.majew...@samsung.com
 Cc: Minkyu Kang mk7.k...@samsung.com
 ---
  drivers/dfu/dfu_mmc.c| 106 
 ++-
  drivers/mmc/mmc.c|  13 --
  include/configs/am335x_evm.h |   8 ++--
  include/configs/trats.h  |   2 +-
  include/configs/trats2.h |   2 +-
  include/dfu.h|   5 --
  6 files changed, 80 insertions(+), 56 deletions(-)

 diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
(...)
 diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
 index e1461a9..f2fa230 100644
 --- a/drivers/mmc/mmc.c
 +++ b/drivers/mmc/mmc.c
 @@ -15,6 +15,7 @@
  #include malloc.h
  #include linux/list.h
  #include div64.h
 +#include errno.h
  #include mmc_private.h
  
  /* Set block count limit because of 16 bit register limit on some hardware*/
 @@ -1266,17 +1267,23 @@ static int mmc_complete_init(struct mmc *mmc)
  
  int mmc_init(struct mmc *mmc)
  {
 +if (mmc-has_init)
 +return 0;
 +
 What difference before?

It doesn't have to go through get_timer(). The effect, although
negligible, saves some cycles.

  int err = IN_PROGRESS;
  unsigned start = get_timer(0);
  
 -if (mmc-has_init)
 -return 0;
  if (!mmc-init_in_progress)
  err = mmc_start_init(mmc);
 -
 Need not to change.
 
  if (!err || err == IN_PROGRESS)
  err = mmc_complete_init(mmc);
 +
 Ditto.

NAK, it improves code readability.

  debug(%s: %d, time %lu\n, __func__, err, get_timer(start));
 +
 +if (!mmc-read_bl_len || !mmc-write_bl_len) {
 +error(invalid block length\n);
 +return -ENODEV;
 +}
 I know mmc-read_bl_len and write_bl_len is set at init time.
 Why this condition needs?

I added it as a countermeasure after fixing the bug and mistook its
purpose when writing a late update to this patch, my bad.

Given the circumstances it might be a sound assertion, but we shouldn't
clobber the codebase that we aim to optimize for size, should we.

ACK, will remove.

  return err;
  }
  
 diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
 index 8af4d6a..d76962f 100644
 --- a/include/configs/am335x_evm.h
 +++ b/include/configs/am335x_evm.h
 @@ -312,10 +312,10 @@
  boot part 0 1; \
  rootfs part 0 2; \
  MLO fat 0 1; \
 -MLO.raw mmc 100 100; \
 -u-boot.img.raw mmc 300 400; \
 -spl-os-args.raw mmc 80 80; \
 -spl-os-image.raw mmc 900 2000; \
 +MLO.raw mmc 0x100 0x100; \
 +u-boot.img.raw mmc 0x300 0x400; \
 +spl-os-args.raw mmc 0x80 0x80; \
 +spl-os-image.raw mmc 0x900 0x2000; \
  spl-os-args fat 0 1; \
  spl-os-image fat 0 1; \
  u-boot.img fat 0 1; \
 diff --git a/include/configs/trats.h b/include/configs/trats.h
 index 6cd15c2..ed3b278 100644
 --- a/include/configs/trats.h
 +++ b/include/configs/trats.h
 @@ -140,7 +140,7 @@
  name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
  
  #define CONFIG_DFU_ALT \
 -u-boot mmc 80 400; \
 +u-boot raw 0x80 0x400; \
  uImage ext4 0 2; \
  exynos4210-trats.dtb ext4 0 2; \
  PARTS_ROOT part 0 5\0
 diff --git a/include/configs/trats2.h b/include/configs/trats2.h
 index 5d86a3d..a22be63 100644
 --- a/include/configs/trats2.h
 +++ b/include/configs/trats2.h
 @@ -169,7 +169,7 @@
  name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
  
  #define CONFIG_DFU_ALT \
 -u-boot mmc 80 800; \
 +u-boot mmc 0x80 0x800; \
 
 u-boot mmc? u-boot raw? what's correct?

raw - ACK

  uImage ext4 0 2; \
  exynos4412-trats2.dtb ext4 0 2; \
  PARTS_ROOT part 0 5\0
 diff --git a/include/dfu.h b/include/dfu.h
 index f973426..f2e83db 100644
 --- a/include/dfu.h
 +++ b/include/dfu.h
 @@ -64,11 +64,6 @@ struct ram_internal_data {
  unsigned intsize;
  };
  
 -static inline unsigned int get_mmc_blk_size(int dev)
 -{
 -return find_mmc_device(dev)-read_bl_len;
 -}
 -
  #define DFU_NAME_SIZE   32
  #define DFU_CMD_BUF_SIZE128
  #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE

 
 


-- 
Mateusz Zalega
Samsung RD Institute

Re: [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()

2014-01-13 Thread Mateusz Zalega
On 01/10/14 06:08, Jaehoon Chung wrote:
 index dc155ad..0d8f30d 100644
 --- a/board/samsung/common/ums.c
 +++ b/board/samsung/common/ums.c
 @@ -37,6 +37,9 @@ static struct ums ums_dev = {
  
  static struct ums *ums_disk_init(struct mmc *mmc)
  {
 +if (mmc_init(mmc))
 +return NULL;
 +
  uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
  uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
 --   if (mmc_init(mmc))
   return NULL;
 
 Locate this point.

If you're asking to put this if() block after variable declaration, NAK.

It's perfectly fine C99 code. I'm not aware of any existing U-Boot style
guidelines that would forbid me to leave it this way.

These variables are only meaningful when mmc_init() returns a valid pointer.

Regards,
-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target

2014-01-13 Thread Mateusz Zalega
On 01/10/14 05:55, Jaehoon Chung wrote:
 On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
 Proper adjustment for supporting DFU at GONI target has been made.
 The s5p_goni.h file has been updated. Moreover, the code for low level
 USB initialization has been added to Goni board code.

 The malloc pool has been enlarged in order to support larger buffer
 sizes needed by DFU implementation.

 Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
 Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
 Tested-by: Mateusz Zalega m.zal...@samsung.com
 Cc: Minkyu Kang mk7.k...@samsung.com
 ---
  board/samsung/goni/goni.c  | 10 +
  include/configs/s5p_goni.h | 54 
 --
  2 files changed, 53 insertions(+), 11 deletions(-)

 diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
 index 366f648..5498daa 100644
 --- a/board/samsung/goni/goni.c
 +++ b/board/samsung/goni/goni.c
 @@ -13,6 +13,9 @@
  #include usb/s3c_udc.h
  #include asm/arch/cpu.h
  #include power/max8998_pmic.h
 +#include usb.h
 +#include usb_mass_storage.h
 +
  DECLARE_GLOBAL_DATA_PTR;
  
  static struct s5pc110_gpio *s5pc110_gpio;
 @@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
  .regs_otg = S5PC110_OTG_BASE,
  .usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
  };
 +
 +int board_usb_init(int index, enum usb_init_type init)
 +{
 +debug(USB_udc_probe\n);
 +s3c_udc_probe(s5pc110_otg_data);
 +return 0;
 Always return 0? return s3c_udc_probe(s5pc110_otg_data);

ACK, will fix.

 +}
  #endif
 diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
 index 1d2dcc0..24a0fcc 100644
 --- a/include/configs/s5p_goni.h
 +++ b/include/configs/s5p_goni.h
 @@ -39,7 +39,7 @@
  #define CONFIG_CMDLINE_EDITING
  
  /* Size of malloc() pool.*/
 -#define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
 +#define CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + 80 * SZ_1M)
  
  /*
   * select serial console configuration
 @@ -70,14 +70,18 @@
  #define CONFIG_CMD_CACHE
  #define CONFIG_CMD_REGINFO
  #define CONFIG_CMD_ONENAND
 -#define CONFIG_CMD_MTDPARTS
  #define CONFIG_CMD_MMC
 +#define CONFIG_CMD_DFU
  
 -#define CONFIG_BOOTDELAY1
 -#define CONFIG_ZERO_BOOTDELAY_CHECK
 +/* USB Composite download gadget - g_dnl */
 +#define CONFIG_USBDOWNLOAD_GADGET
 +#define CONFIG_DFU_FUNCTION
 +#define CONFIG_DFU_MMC
  
 -#define CONFIG_MTD_DEVICE
 -#define CONFIG_MTD_PARTITIONS
 +/* USB Samsung's IDs */
 +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
 +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
 +#define CONFIG_G_DNL_MANUFACTURER Samsung
  
  /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
  #define MTDIDS_DEFAULT  onenand0=samsung-onenand
 @@ -90,7 +94,34 @@
  ,12m(modem)\
  ,60m(qboot)\0
  
 -#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 +#define CONFIG_BOOTDELAY1
 +#define CONFIG_ZERO_BOOTDELAY_CHECK
 +
 +/* partitions definitions */
 +#define PARTS_CSA   csa-mmc
 +#define PARTS_BOOTLOADERu-boot
 +#define PARTS_BOOT  boot
 +#define PARTS_ROOT  platform
 +#define PARTS_DATA  data
 +#define PARTS_CSC   csc
 +#define PARTS_UMS   ums
 +
 +#define CONFIG_DFU_ALT \
 +u-boot raw 0x80 0x400; \
 +uImage ext4 0 2; \
 +exynos3-goni.dtb ext4 0 2; \
 exynos3-goni.dtb?

Correct. It's a DFU entry for the relevant devicetree blob.

(...)

Regards,
-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()

2014-01-13 Thread Mateusz Zalega
On 01/13/14 15:43, Michael Trimarchi wrote:
 On Mon, Jan 13, 2014 at 3:39 PM, Mateusz Zalega m.zal...@samsung.com wrote:
 On 01/10/14 06:08, Jaehoon Chung wrote:
 index dc155ad..0d8f30d 100644
 --- a/board/samsung/common/ums.c
 +++ b/board/samsung/common/ums.c
 @@ -37,6 +37,9 @@ static struct ums ums_dev = {

  static struct ums *ums_disk_init(struct mmc *mmc)
  {
 +if (mmc_init(mmc))
 +return NULL;
 +
  uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
  uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;

 --   if (mmc_init(mmc))
   return NULL;

 Locate this point.

 If you're asking to put this if() block after variable declaration, NAK.

 
 I don't understand your point
 
 It's perfectly fine C99 code. I'm not aware of any existing U-Boot style
 guidelines that would forbid me to leave it this way.

 These variables are only meaningful when mmc_init() returns a valid pointer.

 
 http://www.denx.de/wiki/U-Boot/CodingStyle
 
 Michael

touché

OK, I'll move declarations to the beginning of the closure, C89 style.

Thanks,
-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()

2014-01-09 Thread Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 board/samsung/common/ums.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..0d8f30d 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -37,6 +37,9 @@ static struct ums ums_dev = {
 
 static struct ums *ums_disk_init(struct mmc *mmc)
 {
+   if (mmc_init(mmc))
+   return NULL;
+
uint64_t mmc_end_sector = mmc-capacity / SECTOR_SIZE;
uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 3/9] arm:goni: Update configuration for goni target

2014-01-09 Thread Mateusz Zalega
Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

It's an updated version of an earlier patch which didn't make it to mainline
due to dependencies.

Change-Id: I00e55bc970512986f50b1f943021ba9de683795e
Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@gmail.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 include/configs/s5p_goni.h | 56 +-
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..1d2dcc0 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110 1   /* which is in a S5PC110 */
 #define CONFIG_MACH_GONI   1   /* working with Goni */
 
+#include asm/sizes.h
 #include asm/arch/cpu.h  /* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -37,11 +38,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x10, 0x10 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -89,30 +88,25 @@
,7m(kernel)\
,1m(log)\
,12m(modem)\
-   ,60m(qboot)\
-   ,-(UBI)\0
+   ,60m(qboot)\0
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
-#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext2 \
+#define CONFIG_RAMDISK_BOOTroot=/dev/ram0 rw rootfstype=ext4 \
 ${console} ${meminfo}
 
 #define CONFIG_COMMON_BOOT ${console} ${meminfo} ${mtdparts}
 
-#define CONFIG_BOOTARGSroot=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 
ubi.mtd=6 \
-rootfstype=cramfs  CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGSroot=/dev/mtdblock8 rootfstype=ext4  \
+   CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB updateb=onenand erase 0x0 0x10; \
 onenand write 0x32008000 0x0 0x10\0
 
-#define CONFIG_UBI_MTD  ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6
-
-#define CONFIG_UBIFS_OPTIONrootflags=bulk_read,no_chk_data_crc
-
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_EXTRA_ENV_SETTINGS  \
@@ -124,36 +118,38 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
-   rootfstype=${rootfstype} CONFIG_UBI_MTD  ${opts}  \
+   rootfstype=${rootfstype} ${opts}  \
${lcdinfo}  CONFIG_COMMON_BOOT ; run bootk\0 \
ubifsboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
tftpboot= \
set bootargs root=ubi0!rootfs rootfstype=ubifs  \
-   CONFIG_UBIFS_OPTION CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
-   CONFIG_COMMON_BOOT ; tftp 0x30007FC0 uImage;  \
-   bootm 0x30007FC0\0 \
+   ${opts} ${lcdinfo}  CONFIG_COMMON_BOOT \
+   ; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0 \
ramboot= \
set bootargs  CONFIG_RAMDISK_BOOT \
-initrd=0x3300,8M ramdisk=8192\0 \
+   initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
-   CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M

[U-Boot] [PATCH 5/9] arm:goni: enable GPT command

2014-01-09 Thread Mateusz Zalega
Change-Id: Ifa9acad620652ac731e00d00db511846b6606917
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 include/configs/s5p_goni.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 24a0fcc..d25c494 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -231,6 +232,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.8.2.1

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


[U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix

2014-01-09 Thread Mateusz Zalega
When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

v2 changes:
- code cleanup
- minor dfu_alt_info format change

v3 changes:
- moved invalid block length check to mmc core
- removed redundant 'has_init' check

Change-Id: Icb50bb9f805a9a78848acd19f682fad474cb9082
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 drivers/dfu/dfu_mmc.c| 106 ++-
 drivers/mmc/mmc.c|  13 --
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h  |   2 +-
 include/configs/trats2.h |   2 +-
 include/dfu.h|   5 --
 6 files changed, 80 insertions(+), 56 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index f942758..075e4cd 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -168,66 +168,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 
offset, void *buf,
return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ * 1st:
+ * raw (raw read/write)
+ * fat (files)
+ * ext4(^)
+ * part(partition image)
+ * 2nd and 3rd:
+ * lba_start and lba_size, for raw write
+ * mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-   int dev, part;
-   struct mmc *mmc;
-   block_dev_desc_t *blk_dev;
-   disk_partition_t partinfo;
-   char *st;
-
-   dfu-dev_type = DFU_DEV_MMC;
-   st = strsep(s,  );
-   if (!strcmp(st, mmc)) {
-   dfu-layout = DFU_RAW_ADDR;
-   dfu-data.mmc.lba_start = simple_strtoul(s, s, 16);
-   dfu-data.mmc.lba_size = simple_strtoul(++s, s, 16);
-   dfu-data.mmc.lba_blk_size = get_mmc_blk_size(dfu-dev_num);
-   } else if (!strcmp(st, fat)) {
-   dfu-layout = DFU_FS_FAT;
-   } else if (!strcmp(st, ext4)) {
-   dfu-layout = DFU_FS_EXT4;
-   } else if (!strcmp(st, part)) {
+   const char *argv[3];
+   const char **parg = argv;
+   for (; parg  argv + sizeof(argv) / sizeof(*argv); ++parg) {
+   *parg = strsep(s,  );
+   if (*parg == NULL) {
+   error(Invalid number of arguments.\n);
+   return -ENODEV;
+   }
+   }
 
-   dfu-layout = DFU_RAW_ADDR;
+   const char *entity_type = argv[0];
+   /*
+* Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+* with default 10.
+*/
+   size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+   size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-   dev = simple_strtoul(s, s, 10);
-   s++;
-   part = simple_strtoul(s, s, 10);
+   struct mmc *mmc = find_mmc_device(dfu-dev_num);
+   if (mmc == NULL) {
+   error(Couldn't find MMC device no. %d.\n, dfu-dev_num);
+   return -ENODEV;
+   }
 
-   mmc = find_mmc_device(dev);
-   if (mmc == NULL || mmc_init(mmc)) {
-   printf(%s: could not find mmc device #%d!\n,
-  __func__, dev);
-   return -ENODEV;
-   }
+   if (mmc_init(mmc)) {
+   error(Couldn't init MMC device.\n);
+   return -ENODEV;
+   }
 
-   blk_dev = mmc-block_dev;
-   if (get_partition_info(blk_dev, part, partinfo) != 0) {
-   printf(%s: could not find partition #%d on mmc device 
#%d!\n,
-  __func__, part, dev);
+   if (!strcmp(entity_type, raw)) {
+   dfu-layout = DFU_RAW_ADDR;
+   dfu-data.mmc.lba_start = second_arg;
+   dfu-data.mmc.lba_size  = third_arg;
+   dfu-data.mmc.lba_blk_size  = mmc-read_bl_len;
+   } else if (!strcmp(entity_type, part)) {
+   disk_partition_t partinfo;
+   block_dev_desc_t *blk_dev = mmc-block_dev;
+   int mmcdev = second_arg;
+   int mmcpart = third_arg;
+
+   if (get_partition_info(blk_dev, mmcpart, partinfo) != 0) {
+   error(Couldn't find part #%d on mmc device #%d\n,
+ mmcpart, mmcdev);
return -ENODEV;
}
 
-   dfu-data.mmc.lba_start = partinfo.start;
-   dfu-data.mmc.lba_size

[U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API

2014-01-09 Thread Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of {usb_function_name,
bind_callback) pairs.

Change-Id: I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dc
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 common/cmd_dfu.c|  3 +-
 common/cmd_thordown.c   |  3 +-
 common/cmd_usb_mass_storage.c   |  2 +-
 drivers/usb/gadget/f_dfu.c  | 11 --
 drivers/usb/gadget/f_mass_storage.c |  6 +++
 drivers/usb/gadget/f_thor.c |  5 +++
 drivers/usb/gadget/g_dnl.c  | 74 +
 include/dfu.h   |  7 
 include/g_dnl.h | 11 ++
 include/thor.h  |  8 
 include/usb_mass_storage.h  |  8 
 11 files changed, 66 insertions(+), 72 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   char *s = dfu;
int ret, i = 0;
 
ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
int controller_index = simple_strtoul(usb_controller, NULL, 0);
board_usb_init(controller_index, USB_INIT_DEVICE);
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_dfu);
while (1) {
if (dfu_reset())
/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *interface = argv[2];
char *devstring = argv[3];
 
-   const char *s = thor;
int ret;
 
puts(TIZEN \THOR\ Downloader\n);
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
goto exit;
}
 
-   g_dnl_register(s);
+   g_dnl_register(usb_dnl_thor);
 
ret = thor_init();
if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 99487f4..c8e152c 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
return CMD_RET_FAILURE;
}
 
-   g_dnl_register(ums);
+   g_dnl_register(usb_dnl_ums);
 
while (1) {
usb_gadget_handle_interrupts();
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..cde1895 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -18,12 +18,14 @@
 #include errno.h
 #include common.h
 #include malloc.h
+#include linker_lists.h
 
 #include linux/usb/ch9.h
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 
 #include dfu.h
+#include g_dnl.h
 #include f_dfu.h
 
 struct f_dfu {
@@ -768,9 +770,7 @@ static int dfu_bind_config(struct usb_configuration *c)
 
 int dfu_add(struct usb_configuration *c)
 {
-   int id;
-
-   id = usb_string_id(c-cdev);
+   int id = usb_string_id(c-cdev);
if (id  0)
return id;
strings_dfu_generic[0].id = id;
@@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
 
return dfu_bind_config(c);
 }
+
+/* export dfu_add to g_dnl.o */
+ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
+   g_dnl_bind_callbacks) = { .usb_function_name = usb_dnl_dfu,
+ .fptr = dfu_add };
diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index b1fe8bd..b7d03f2 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -243,6 +243,7 @@
 #include config.h
 #include malloc.h
 #include common.h
+#include linker_lists.h
 #include usb.h
 
 #include linux/err.h
@@ -255,6 +256,7 @@
 #include linux/usb/gadget.h
 #include linux/usb/composite.h
 #include usb/lin_gadget_compat.h
+#include g_dnl.h
 
 /**/
 
@@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
 
return 0;
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
+   g_dnl_bind_callbacks) = { .usb_function_name = usb_dnl_ums,
+ .fptr = fsg_add };
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index c4c9909..3f428c8 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -17,6 +17,7 @@
 
 #include errno.h
 #include common.h
+#include linker_lists.h
 #include

[U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target

2014-01-09 Thread Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover, the code for low level
USB initialization has been added to Goni board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
 board/samsung/goni/goni.c  | 10 +
 include/configs/s5p_goni.h | 54 --
 2 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 366f648..5498daa 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -13,6 +13,9 @@
 #include usb/s3c_udc.h
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
+#include usb.h
+#include usb_mass_storage.h
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct s5pc110_gpio *s5pc110_gpio;
@@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   s3c_udc_probe(s5pc110_otg_data);
+   return 0;
+}
 #endif
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 1d2dcc0..24a0fcc 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -39,7 +39,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -70,14 +70,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER Samsung
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT onenand0=samsung-onenand
@@ -90,7 +94,34 @@
,12m(modem)\
,60m(qboot)\0
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY   1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA  csa-mmc
+#define PARTS_BOOTLOADER   u-boot
+#define PARTS_BOOT boot
+#define PARTS_ROOT platform
+#define PARTS_DATA data
+#define PARTS_CSC  csc
+#define PARTS_UMS  ums
+
+#define CONFIG_DFU_ALT \
+   u-boot raw 0x80 0x400; \
+   uImage ext4 0 2; \
+   exynos3-goni.dtb ext4 0 2; \
+   PARTS_ROOT part 0 5\0
+
+#define PARTS_DEFAULT \
+   uuid_disk=${uuid_gpt_disk}; \
+   name=PARTS_CSA,size=8MiB,uuid=${uuid_gpt_PARTS_CSA}; \
+   name=PARTS_BOOTLOADER,size=60MiB, \
+   uuid=${uuid_gpt_PARTS_BOOTLOADER}; \
+   name=PARTS_BOOT,size=100MiB,uuid=${uuid_gpt_PARTS_BOOT}; \
+   name=PARTS_ROOT,size=1GiB,uuid=${uuid_gpt_PARTS_ROOT}; \
+   name=PARTS_DATA,size=3GiB,uuid=${uuid_gpt_PARTS_DATA}; \
+   name=PARTS_CSC,size=150MiB,uuid=${uuid_gpt_PARTS_CSC}; \
+   name=PARTS_UMS,size=-,uuid=${uuid_gpt_PARTS_UMS}\0 \
 
 #define CONFIG_BOOTCOMMAND run mmcboot
 
@@ -144,18 +175,18 @@
verify=n\0 \
rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
-   mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
-   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
mmcdev=0\0 \
mmcbootpart=2\0 \
mmcrootpart=5\0 \
+   partitions= PARTS_DEFAULT \
bootblock=9\0 \
ubiblock=8\0 \
ubi=enabled\0 \
-   opts=always_resume=1
+   opts=always_resume=1\0 \
+   dfu_alt_info= CONFIG_DFU_ALT \0
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER /* use hush command parser*/
 #define CONFIG_SYS_PROMPT  Goni # 
@@ -194,6 +225,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define

[U-Boot] [PATCH 6/9] arm:goni: enable USB Mass Storage

2014-01-09 Thread Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.

Change-Id: I6c960e6785742653831aae4e7fc717ee493332cc
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index d25c494..7314bff 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -261,5 +261,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif /* __CONFIG_H */
-- 
1.8.2.1

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


[U-Boot] [PATCH 1/9] mmc: mmc header fix

2014-01-09 Thread Mateusz Zalega
Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Change-Id: I3ccf56ce1e5334c32a7bc061e8bd9a5054ccb7f5
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index cb558da..e490a06 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include linux/list.h
 #include linux/compiler.h
+#include part.h
 
 #define SD_VERSION_SD  0x2
 #define SD_VERSION_3   (SD_VERSION_SD | 0x300)
-- 
1.8.2.1

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


[U-Boot] [PATCH 2/9] part: header fix

2014-01-09 Thread Mateusz Zalega
Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Change-Id: Iafdd4f1997767e9eb84d583fd32c79c8c4d43afd
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index ce840bd..329613a 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include ide.h
+#include common.h
 
 typedef struct block_dev_desc {
int if_type;/* type of the interface */
-- 
1.8.2.1

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


Re: [U-Boot] [PATCH v7 0/13] Driver model implementation, tests, demo and GPIO

2013-12-02 Thread Mateusz Zalega
On 11/29/13 02:00, Masahiro Yamada wrote:
 How come 13/13 is missing?

It's not.

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v6 14/17] dm: Add GPIO support and tests

2013-11-22 Thread Mateusz Zalega
On 11/07/13 17:32, Simon Glass wrote:
 Add driver model support for GPIOs. (...)

Just a thought - what's keeping us from implementing 1:1 GPIO devicetree
mapping with Linux?

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v10] Add dmmalloc module for DM.

2013-11-05 Thread Mateusz Zalega
On 10/29/12 00:20, Tomas Hlavacek wrote:
 Add pointer to the first early heap into GD structure.
 Implement simple early_malloc and early_free functions.
 Prepare for additional heaps and automated heap initialization.
 Add temporary early_malloc_active function (to be replaced in future by
 more coarse DM init flags).
 Add DM specific malloc calls - dmmalloc, dmfree, dmrealloc and dmcalloc.
 
 Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
 ---
 Changes in v10:
- Change GD type to struct early_heap_header *.
- Move dmmalloc, dmfree, ... function from .h to dmmalloc.c .
- Rework early_malloc_active() to use new GD_FLG_HEAP_INIT flag.
- Add early_heap_active() and GD_FLG_EARLY_HEAP_DONE flag.
- Rework dmrealloc() and dmfree() to use new flags and support relocation.
- Rename early_heap_dump() to early_malloc_heap_dump().
- Add early_malloc_dump.
- Drop conditional undef CONFIG_SYS_EARLY_MALLOC in dmmalloc.h.
- Moved struct early_block_header and macros to dmmalloc.c.
 
 Changes in v9:
- Rework early_malloc to keep track of allocated block size.
- Add early_free and dmfree functions.
- Rework dmrealloc.
 
 Changes in v8:
- Add dmcalloc() implementation.
- Add comments to function prototypes in dmmalloc.h.
 
 Changes in v7:
- Rework check of first heap in early_brk().
 
 Changes in v6:
- Move dmmalloc() and all dm* functions to dmmalloc.h.
- Fix bool expression in early_malloc_active().
 
  arch/arm/include/asm/global_data.h|8 +
  arch/avr32/include/asm/global_data.h  |7 +
  arch/blackfin/include/asm/global_data.h   |6 +
  arch/m68k/include/asm/global_data.h   |8 +
  arch/microblaze/include/asm/global_data.h |8 +
  arch/mips/include/asm/global_data.h   |6 +
  arch/nds32/include/asm/global_data.h  |8 +
  arch/nios2/include/asm/global_data.h  |7 +
  arch/openrisc/include/asm/global_data.h   |8 +
  arch/powerpc/include/asm/global_data.h|6 +
  arch/sandbox/include/asm/global_data.h|7 +
  arch/sh/include/asm/global_data.h |7 +
  arch/sparc/include/asm/global_data.h  |6 +
  arch/x86/include/asm/global_data.h|8 +
  common/Makefile   |1 +
  common/dmmalloc.c |  297 
 +
  include/asm-generic/global_data_flags.h   |6 +-
  include/dmmalloc.h|  132 +
  18 files changed, 534 insertions(+), 2 deletions(-)
  create mode 100644 common/dmmalloc.c
  create mode 100644 include/dmmalloc.h
 
 diff --git a/arch/arm/include/asm/global_data.h 
 b/arch/arm/include/asm/global_data.h
 index 2b9af93..01075dc 100644
 --- a/arch/arm/include/asm/global_data.h
 +++ b/arch/arm/include/asm/global_data.h
 @@ -23,6 +23,11 @@
  
  #ifndef  __ASM_GBL_DATA_H
  #define __ASM_GBL_DATA_H
 +
 +#ifdef CONFIG_SYS_EARLY_MALLOC
 +#include dmmalloc.h
 +#endif /* CONFIG_SYS_EARLY_MALLOC */
 +
  /*
   * The following data structure is placed in some memory which is
   * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
 @@ -82,6 +87,9 @@ typedef struct  global_data {
   unsigned long   post_log_res; /* success of POST test */
   unsigned long   post_init_f_time; /* When post_init_f started */
  #endif
 +#ifdef CONFIG_SYS_EARLY_MALLOC
 + struct early_heap_header *early_heap;   /* heap for early_malloc */
 +#endif
  } gd_t;
  
  #include asm-generic/global_data_flags.h
 diff --git a/arch/avr32/include/asm/global_data.h 
 b/arch/avr32/include/asm/global_data.h
 index bf661e2..ba9cf0e 100644
 --- a/arch/avr32/include/asm/global_data.h
 +++ b/arch/avr32/include/asm/global_data.h
 @@ -22,6 +22,10 @@
  #ifndef __ASM_GLOBAL_DATA_H__
  #define __ASM_GLOBAL_DATA_H__
  
 +#ifdef CONFIG_SYS_EARLY_MALLOC
 +#include dmmalloc.h
 +#endif /* CONFIG_SYS_EARLY_MALLOC */
 +
  /*
   * The following data structure is placed in some memory wich is
   * available very early after boot (like DPRAM on MPC8xx/MPC82xx, or
 @@ -48,6 +52,9 @@ typedef struct  global_data {
  #endif
   void**jt;   /* jump table */
   charenv_buf[32];/* buffer for getenv() before reloc. */
 +#ifdef CONFIG_SYS_EARLY_MALLOC
 + struct early_heap_header *early_heap;   /* heap for early_malloc */
 +#endif
  } gd_t;
  
  #include asm-generic/global_data_flags.h
 diff --git a/arch/blackfin/include/asm/global_data.h 
 b/arch/blackfin/include/asm/global_data.h
 index d91e5a4..daeb314 100644
 --- a/arch/blackfin/include/asm/global_data.h
 +++ b/arch/blackfin/include/asm/global_data.h
 @@ -29,6 +29,9 @@
  #define __ASM_GBL_DATA_H
  
  #include asm/u-boot.h
 +#ifdef CONFIG_SYS_EARLY_MALLOC
 +#include dmmalloc.h
 +#endif /* CONFIG_SYS_EARLY_MALLOC */
  
  /*
   * The following data structure is placed in some memory wich is
 @@ -57,6 +60,9 @@ typedef struct global_data {
  
   void**jt;   /* jump table */
   

Re: [U-Boot] [PATCH v10] Add dmmalloc module for DM.

2013-11-05 Thread Mateusz Zalega
 Add pointer to the first early heap into GD structure.
 Implement simple early_malloc and early_free functions.
 Prepare for additional heaps and automated heap initialization.
 Add temporary early_malloc_active function (to be replaced in future by
 more coarse DM init flags).
 Add DM specific malloc calls - dmmalloc, dmfree, dmrealloc and dmcalloc.

 Signed-off-by: Tomas Hlavacek tmshl...@gmail.com
 [snip]
 does it ring a bell? I need to get it (or an equivalent solution) to
 work before implementing a working DM2-I2C uclass. I don't see any
 replies to the original v10 e-mail. Why wasn't it accepted into U-Boot?
 Should I work on top of this patch, or start from scratch?
 
 The patch itself was OK, but the rest of the DM work did not end up
 going in, so there was no user of this change.  If you have a user,
 please re-use his patch (and it'll need a v11 to apply again on top of
 tree and comply with SPDX licenisng tags) and push it forward, thanks!
 

will do, thx!

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2] mmc: sdhci: Avoid commands errors by simple timeout adaptation.

2013-10-29 Thread Mateusz Zalega
 Dear Pantelis,
 You don't reply for a long time. Could you look on it at this time?


 Is this a way to address people on a mailing list?

 People, especially volunteers are busy with other things too.

 Eventually things get merged, but not when people are being rude.

 What did I wrong by contacting mmc-u-boot custodian via the mailing list?

 At least for linux it is a good and common practice to ping maintainers 
 after 2 weeks of not reply to the patch.

 
 This passive aggressive crap might work on your mother, but not here.
 
 Learn how open source works, and expect delays when it is conference season.
 I am in contact with the core maintainers and nothing is being dropped.
 
 That is all.
 
 -- Pantelis

Mister, you seem to be upset.

Regards,


-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4 2/2] arm:goni:dfu Add support for DFU at GONI target

2013-10-14 Thread Mateusz Zalega
From: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com

Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Change-Id: I1b4953368176e8a7588abb0da37de6321f835698
Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v3:
- adjusted to match recently accepted USB patches
---
 board/samsung/goni/goni.c  | 80 ++
 include/configs/s5p_goni.h | 69 ++-
 2 files changed, 127 insertions(+), 22 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 366f648..3a2f686 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -13,6 +13,9 @@
 #include usb/s3c_udc.h
 #include asm/arch/cpu.h
 #include power/max8998_pmic.h
+#include usb.h
+#include usb_mass_storage.h
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct s5pc110_gpio *s5pc110_gpio;
@@ -172,4 +175,81 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
.regs_otg = S5PC110_OTG_BASE,
.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum board_usb_init_type init)
+{
+   debug(USB_udc_probe\n);
+   s3c_udc_probe(s5pc110_otg_data);
+   return 0;
+}
+#endif
+
+#ifdef CONFIG_USB_GADGET_MASS_STORAGE
+static int ums_read_sector(struct ums_device *ums_dev,
+   ulong start, lbaint_t blkcnt, void *buf)
+{
+   if (ums_dev-mmc-block_dev.block_read(ums_dev-dev_num,
+  start + ums_dev-offset,
+  blkcnt, buf) != blkcnt)
+   return -1;
+
+   return 0;
+}
+
+static int ums_write_sector(struct ums_device *ums_dev,
+   ulong start, lbaint_t blkcnt, const void *buf)
+{
+   if (ums_dev-mmc-block_dev.block_write(ums_dev-dev_num,
+   start + ums_dev-offset,
+   blkcnt, buf) != blkcnt)
+   return -1;
+
+   return 0;
+}
+
+static void ums_get_capacity(struct ums_device *ums_dev,
+   long long int *capacity)
+{
+   long long int tmp_capacity;
+
+   tmp_capacity = (long long int) ((ums_dev-offset + ums_dev-part_size)
+   * SECTOR_SIZE);
+   *capacity = ums_dev-mmc-capacity - tmp_capacity;
+}
+
+static struct ums_board_info ums_board = {
+   .read_sector = ums_read_sector,
+   .write_sector = ums_write_sector,
+   .get_capacity = ums_get_capacity,
+   .name = GONI UMS disk,
+   .ums_dev = {
+   .mmc = NULL,
+   .dev_num = 0,
+   .offset = 0,
+   .part_size = 0.
+   },
+};
+
+struct ums_board_info *board_ums_init(unsigned int dev_num, unsigned int 
offset,
+   unsigned int part_size)
+{
+   struct mmc *mmc;
+
+   mmc = find_mmc_device(dev_num);
+   /*
+* mmc initialization is necessary prior to the ums command usage
+* due to fact that on goni target environment is read from oneNand
+* memory, so the mmc remains uninitialized when u-boot prompt appears
+*/
+   if (!mmc || mmc_init(mmc))
+   return NULL;
+
+   ums_board.ums_dev.mmc = mmc;
+   ums_board.ums_dev.dev_num = dev_num;
+   ums_board.ums_dev.offset = offset;
+   ums_board.ums_dev.part_size = part_size;
+
+   return ums_board;
+}
+
 #endif
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index fd441c8..218cf3d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -41,7 +41,7 @@
  * Size of malloc() pool
  * 1MB = 0x10, 0x10 = 1024 * 1024
  */
-#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (1  20))
+#define CONFIG_SYS_MALLOC_LEN  (CONFIG_ENV_SIZE + (16  20))
 /*
  * select serial console configuration
  */
@@ -71,28 +71,46 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
-#define CONFIG_BOOTDELAY   1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define

[U-Boot] [PATCH v4 1/2] arm:goni: Update configuration for goni target

2013-10-14 Thread Mateusz Zalega
From: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Tested-by: Arkadiusz Wlodarczyk a.wlodarc...@samsung.com
Tested-by: Mateusz Zalega m.zal...@gmail.com
Cc: Minkyu Kang mk7.k...@samsung.com
---
Changes since v3:
- added CMD_EXT4
- made it conform with current, recently accepted USB patches
---
 include/configs/s5p_goni.h | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c303244..fd441c8 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -94,7 +94,7 @@
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND run ubifsboot
+#define CONFIG_BOOTCOMMAND run mmcboot
 
 #define CONFIG_DEFAULT_CONSOLE console=ttySAC2,115200n8\0
 
@@ -124,7 +124,7 @@
onenand erase 0x0156 0x1eaa; \
onenand write 0x3200 0x126 0x8C\0 \
bootk= \
-   onenand read 0x30007FC0 0xc0 0x60; \
+   run loaduimage; \
bootm 0x30007FC0\0 \
flashboot= \
set bootargs root=/dev/mtdblock${bootblock}  \
@@ -143,16 +143,21 @@
set bootargs  CONFIG_RAMDISK_BOOT \
 initrd=0x3300,8M ramdisk=8192\0 \
mmcboot= \
-   set bootargs root=${mmcblk} rootfstype=${rootfstype} \
+   set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart}  \
+   rootfstype=${rootfstype} \
CONFIG_UBI_MTD  ${opts} ${lcdinfo}  \
CONFIG_COMMON_BOOT ; run bootk\0 \
boottrace=setenv opts initcall_debug; run bootcmd\0 \
bootchart=set opts init=/sbin/bootchartd; run bootcmd\0 \
verify=n\0 \
-   rootfstype=cramfs\0 \
+   rootfstype=ext4\0 \
console= CONFIG_DEFAULT_CONSOLE \
mtdparts= MTDPARTS_DEFAULT \
meminfo=mem=80M mem=256M@0x4000 mem=128M@0x5000\0 \
+   loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0 \
+   mmcdev=0\0 \
+   mmcbootpart=2\0 \
+   mmcrootpart=5\0 \
mmcblk=/dev/mmcblk1p1\0 \
bootblock=9\0 \
ubiblock=8\0 \
@@ -198,6 +203,11 @@
 
 #define CONFIG_DOS_PARTITION   1
 
+/* FAT */
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+#define CONFIG_FAT_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR(CONFIG_SYS_LOAD_ADDR - 0x100)
 
 #define CONFIG_SYS_CACHELINE_SIZE   64
-- 
1.8.2.1

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


Re: [U-Boot] [PATCH v6] usb: new board-specific USB init interface

2013-10-07 Thread Mateusz Zalega
On 10/05/13 02:48, Troy Kisky wrote:
 On 10/4/2013 10:22 AM, Mateusz Zalega wrote:
   +/*
 + * You can initialize platform's USB host or device
 + * ports by passing this enum as an argument to
 + * board_usb_init().
 + */
 +enum board_usb_init_type {
 +USB_INIT_HOST,
 +USB_INIT_DEVICE
 +};
 +

 I'm a little late to the game, but can you rename this to just
 usb_init_type ?
 I'm wanting to use this as a parameter to usb_lowlevel_init, moving it
 above the usb_lowlevel_init definition would help me too.

Looks like Marek already applied it. You can always send another RFC.

Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v6] usb: new board-specific USB init interface

2013-10-04 Thread Mateusz Zalega
This commit unifies board-specific USB initialization implementations
under one symbol (usb_board_init), declaration of which is available in
usb.h.

New API allows selective initialization of USB controllers whenever needed.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Lukasz Majewski l.majew...@samsung.com
---
Changes since RFC (v1):
- NVIDIA Tegra doesn't postpone its USB init anymore
- board_usb_init()'s sole argument name was shortened
- networking code comment style (/* blurb...) dropped
- squashed RFC changes so that patch won't break bisect

v2 changes:
- commit message fixup

v3 changes:
- added 'index' argument to perform selective port initialization

v4 changes:
- board_usb_init_fail() renamed to board_usb_cleanup()
- board_usb_cleanup() accepts controller index and init type
- DFU and UMS commands don't init all USB controllers anymore
- minor related fixes  refactorization

v5 changes:
- fixed an issue with boards based on canyonlands.c
- patch passes MAKEALL -a powerpc (vide: ^)

v6 changes:
- rebased onto usb/next
---
 arch/arm/include/asm/arch-tegra/usb.h |  3 +-
 arch/arm/include/asm/ehci-omap.h  |  4 +--
 board/amcc/canyonlands/canyonlands.c  |  5 +--
 board/balloon3/balloon3.c |  7 +++--
 board/compulab/cm_t35/cm_t35.c|  2 +-
 board/esd/apc405/apc405.c |  8 ++---
 board/esd/pmc440/pmc440.c |  8 ++---
 board/htkw/mcx/mcx.c  |  2 +-
 board/icpdas/lp8x4x/lp8x4x.c  |  7 +++--
 board/nvidia/common/board.c   |  4 ++-
 board/samsung/trats/trats.c   |  5 +--
 board/technexion/twister/twister.c|  2 +-
 board/teejet/mt_ventoux/mt_ventoux.c  |  2 +-
 board/ti/beagle/beagle.c  |  2 +-
 board/ti/omap5_uevm/evm.c |  2 +-
 board/ti/panda/panda.c|  2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |  7 +++--
 board/trizepsiv/conxs.c   |  7 +++--
 board/vpac270/vpac270.c   |  7 +++--
 common/cmd_dfu.c  | 30 ++
 common/cmd_usb_mass_storage.c | 44 ++-
 common/usb.c  |  6 
 drivers/dfu/dfu.c |  2 +-
 drivers/usb/host/ehci-omap.c  | 12 ++--
 drivers/usb/host/ehci-tegra.c |  2 +-
 drivers/usb/host/ohci-hcd.c   |  4 +--
 drivers/usb/host/ohci.h   | 11 +++
 include/g_dnl.h   |  2 --
 include/usb.h | 30 --
 include/usb_mass_storage.h| 13 +++-
 30 files changed, 138 insertions(+), 104 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/usb.h 
b/arch/arm/include/asm/arch-tegra/usb.h
index f66257c..a1efd07 100644
--- a/arch/arm/include/asm/arch-tegra/usb.h
+++ b/arch/arm/include/asm/arch-tegra/usb.h
@@ -131,8 +131,7 @@
 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
 #define VBUS_VLD_STS   (1  26)
 
-
 /* Setup USB on the board */
-int board_usb_init(const void *blob);
+int usb_process_devicetree(const void *blob);
 
 #endif /* _TEGRA_USB_H_ */
diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h
index ac83a53..c7bca05 100644
--- a/arch/arm/include/asm/ehci-omap.h
+++ b/arch/arm/include/asm/ehci-omap.h
@@ -145,8 +145,8 @@ struct omap_ehci {
 struct ehci_hccr;
 struct ehci_hcor;
 
-int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor);
+int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
+  struct ehci_hccr **hccr, struct ehci_hcor **hcor);
 int omap_ehci_hcd_stop(void);
 
 #endif /* _OMAP_COMMON_EHCI_H_ */
diff --git a/board/amcc/canyonlands/canyonlands.c 
b/board/amcc/canyonlands/canyonlands.c
index cc36f45..395095e 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -16,6 +16,7 @@
 #include asm/4xx_pcie.h
 #include asm/ppc4xx-gpio.h
 #include asm/errno.h
+#include usb.h
 
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH 
chips */
 
@@ -188,7 +189,7 @@ int board_early_init_f(void)
 }
 
 #if defined(CONFIG_USB_OHCI_NEW)  defined(CONFIG_SYS_USB_OHCI_BOARD_INIT)
-int usb_board_init(void)
+int board_usb_init(int index, enum board_usb_init_type init)
 {
struct board_bcsr *bcsr_data =
(struct board_bcsr *)CONFIG_SYS_BCSR_BASE;
@@ -229,7 +230,7 @@ int usb_board_stop(void)
return 0;
 }
 
-int usb_board_init_fail(void)
+int board_usb_cleanup(int index, enum board_usb_init_type init

[U-Boot] [PATCH v5] usb: new board-specific USB init interface

2013-10-02 Thread Mateusz Zalega
This commit unifies board-specific USB initialization implementations
under one symbol (usb_board_init), declaration of which is available in
usb.h.

New API allows selective initialization of USB controllers whenever needed.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Lukasz Majewski l.majew...@samsung.com
---
Changes since RFC (v1):
- NVIDIA Tegra doesn't postpone its USB init anymore
- board_usb_init()'s sole argument name was shortened
- networking code comment style (/* blurb...) dropped
- squashed RFC changes so that patch won't break bisect

v2 changes:
- commit message fixup

v3 changes:
- added 'index' argument to perform selective port initialization

v4 changes:
- board_usb_init_fail() renamed to board_usb_cleanup()
- board_usb_cleanup() accepts controller index and init type
- DFU and UMS commands don't init all USB controllers anymore
- minor related fixes  refactorization

v5 changes:
- fixed an issue with boards based on canyonlands.c
- patch passes MAKEALL -a powerpc (vide: ^)
---

 arch/arm/include/asm/arch-tegra/usb.h |  3 +-
 arch/arm/include/asm/ehci-omap.h  |  4 +--
 board/amcc/canyonlands/canyonlands.c  |  5 +--
 board/balloon3/balloon3.c |  7 +++--
 board/compulab/cm_t35/cm_t35.c|  2 +-
 board/esd/apc405/apc405.c |  8 ++---
 board/esd/pmc440/pmc440.c |  8 ++---
 board/htkw/mcx/mcx.c  |  2 +-
 board/icpdas/lp8x4x/lp8x4x.c  |  7 +++--
 board/nvidia/common/board.c   |  4 ++-
 board/samsung/trats/trats.c   |  5 +--
 board/technexion/twister/twister.c|  2 +-
 board/teejet/mt_ventoux/mt_ventoux.c  |  2 +-
 board/ti/beagle/beagle.c  |  2 +-
 board/ti/omap5_uevm/evm.c |  2 +-
 board/ti/panda/panda.c|  2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |  7 +++--
 board/trizepsiv/conxs.c   |  7 +++--
 board/vpac270/vpac270.c   |  7 +++--
 common/cmd_dfu.c  | 31 +++
 common/cmd_usb_mass_storage.c | 44 ++-
 common/usb.c  |  5 +++
 drivers/dfu/dfu.c |  2 +-
 drivers/usb/host/ehci-omap.c  | 12 ++--
 drivers/usb/host/ehci-tegra.c |  2 +-
 drivers/usb/host/ohci-hcd.c   |  4 +--
 drivers/usb/host/ohci.h   | 11 +++
 include/g_dnl.h   |  2 --
 include/usb.h | 30 --
 include/usb_mass_storage.h| 13 +++-
 30 files changed, 137 insertions(+), 105 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/usb.h 
b/arch/arm/include/asm/arch-tegra/usb.h
index f66257c..a1efd07 100644
--- a/arch/arm/include/asm/arch-tegra/usb.h
+++ b/arch/arm/include/asm/arch-tegra/usb.h
@@ -131,8 +131,7 @@
 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
 #define VBUS_VLD_STS   (1  26)
 
-
 /* Setup USB on the board */
-int board_usb_init(const void *blob);
+int usb_process_devicetree(const void *blob);
 
 #endif /* _TEGRA_USB_H_ */
diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h
index ac83a53..c7bca05 100644
--- a/arch/arm/include/asm/ehci-omap.h
+++ b/arch/arm/include/asm/ehci-omap.h
@@ -145,8 +145,8 @@ struct omap_ehci {
 struct ehci_hccr;
 struct ehci_hcor;
 
-int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor);
+int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
+  struct ehci_hccr **hccr, struct ehci_hcor **hcor);
 int omap_ehci_hcd_stop(void);
 
 #endif /* _OMAP_COMMON_EHCI_H_ */
diff --git a/board/amcc/canyonlands/canyonlands.c 
b/board/amcc/canyonlands/canyonlands.c
index cc36f45..395095e 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -16,6 +16,7 @@
 #include asm/4xx_pcie.h
 #include asm/ppc4xx-gpio.h
 #include asm/errno.h
+#include usb.h
 
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH 
chips */
 
@@ -188,7 +189,7 @@ int board_early_init_f(void)
 }
 
 #if defined(CONFIG_USB_OHCI_NEW)  defined(CONFIG_SYS_USB_OHCI_BOARD_INIT)
-int usb_board_init(void)
+int board_usb_init(int index, enum board_usb_init_type init)
 {
struct board_bcsr *bcsr_data =
(struct board_bcsr *)CONFIG_SYS_BCSR_BASE;
@@ -229,7 +230,7 @@ int usb_board_stop(void)
return 0;
 }
 
-int usb_board_init_fail(void)
+int board_usb_cleanup(int index, enum board_usb_init_type init)
 {
return usb_board_stop();
 }
diff --git

Re: [U-Boot] [PATCH v4] usb: new board-specific USB init interface

2013-09-26 Thread Mateusz Zalega
On 09/26/13 03:50, Marek Vasut wrote:
 Dear Mateusz Zalega,
 
 On 09/19/13 16:34, Marek Vasut wrote:
 I checked powerpc and arches glacier and glacier_nand don't build.
 Can you please check and fix ? You can get the ELDK 5.4 PPC toolchain
 from [1].

 http://www.denx.de/wiki/ELDK-5/

 Hello,
 it's because I moved some function declarations and had to include usb.h
 in their code.
 
 Can you please elabore which functions did you exactly move that cause this 
 to 
 fail now ?

172 /*
173  * You can initialize platform's USB host or device
174  * ports by passing this enum as an argument to
175  * board_usb_init().
176  */
177 enum board_usb_init_type {
178 USB_INIT_HOST,
179 USB_INIT_DEVICE
180 };
181
182 /*
183  * board-specific hardware initialization, called by
184  * usb drivers and u-boot commands
185  *
186  * @param index USB controller number
187  * @param init initializes controller as USB host or device
188  */
189 int board_usb_init(int index, enum board_usb_init_type init);
190
191 /*
192  * can be used to clean up after failed USB initialization attempt
193  * vide: board_usb_init()
194  *
195  * @param index USB controller number for selective cleanup
196  * @param init board_usb_init_type passed to board_usb_init()
197  */
198 int board_usb_cleanup(int index, enum board_usb_init_type init);

 @usb.h, this giant ifdef fails:
 134 #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
 135 defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
 136 defined(CONFIG_USB_SL811HS) ||
 defined(CONFIG_USB_ISP116X_HCD) || \
 137 defined(CONFIG_USB_R8A66597_HCD) ||
 defined(CONFIG_USB_DAVINCI) || \
 138 defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
 139 defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \
 140 defined(CONFIG_USB_MUSB_DSPS) ||
 defined(CONFIG_USB_MUSB_AM35X) || \
 141 defined(CONFIG_USB_MUSB_OMAP2PLUS)

 and results in:
 169 #error USB Lowlevel not defined

 I don't like the notion of using board-specific CONFIG_* defines in
 usb.h. Any ideas on where can we move it? Maybe one generic
 CONFIG_USB_HOST specified in board code would do?
 
 The ifdef is pretty much what would CONFIG_USB_HOST do.

Yeah, but it would be nice to be able to add more boards to u-boot
without touching usb.h.

CONFIG_USB_OMAP3 -- what happens in arch/board code should stay there

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] usb: new board-specific USB init interface

2013-09-25 Thread Mateusz Zalega
On 09/19/13 16:34, Marek Vasut wrote:
 I checked powerpc and arches glacier and glacier_nand don't build. Can 
 you 
 please check and fix ? You can get the ELDK 5.4 PPC toolchain from [1].
 
 http://www.denx.de/wiki/ELDK-5/

Hello,
it's because I moved some function declarations and had to include usb.h
in their code.

@usb.h, this giant ifdef fails:
134 #if defined(CONFIG_USB_UHCI) || defined(CONFIG_USB_OHCI) || \
135 defined(CONFIG_USB_EHCI) || defined(CONFIG_USB_OHCI_NEW) || \
136 defined(CONFIG_USB_SL811HS) ||
defined(CONFIG_USB_ISP116X_HCD) || \
137 defined(CONFIG_USB_R8A66597_HCD) ||
defined(CONFIG_USB_DAVINCI) || \
138 defined(CONFIG_USB_OMAP3) || defined(CONFIG_USB_DA8XX) || \
139 defined(CONFIG_USB_BLACKFIN) || defined(CONFIG_USB_AM35X) || \
140 defined(CONFIG_USB_MUSB_DSPS) ||
defined(CONFIG_USB_MUSB_AM35X) || \
141 defined(CONFIG_USB_MUSB_OMAP2PLUS)

and results in:
169 #error USB Lowlevel not defined

I don't like the notion of using board-specific CONFIG_* defines in
usb.h. Any ideas on where can we move it? Maybe one generic
CONFIG_USB_HOST specified in board code would do?

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] usb: new board-specific USB init interface

2013-09-18 Thread Mateusz Zalega
On 09/17/13 18:11, Igor Grinberg wrote:
 Hello,
 
 On 09/10/2013 06:10 PM, Mateusz Zalega wrote:
 This commit unifies board-specific USB initialization implementations
 under one symbol (usb_board_init), declaration of which is available in
 usb.h.

 New API allows selective initialization of USB controllers whenever needed.

 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 Reviewed-by: Lukasz Majewski l.majew...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 
 I think, you should Cc respective board maintainers as well.

Right, I forgot about it. I'll forward last Marek's response to them.

Thanks.

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-16 Thread Mateusz Zalega
On 09/15/13 16:21, Marek Vasut wrote:
 I suppose this thread can be concluded by droping the INIT_ALL stuff 
 entirely. 
 Afterall, we do not want to init _ALL_ ports at once, but we want to init 
 them 
 selectively.
 
 Best regards,
 Marek Vasut

+1

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] usb: new board-specific USB init interface

2013-09-16 Thread Mateusz Zalega
On 09/15/13 18:44, Marek Vasut wrote:
 Dear Mateusz Zalega,
 
 This commit unifies board-specific USB initialization implementations
 under one symbol (usb_board_init), declaration of which is available in
 usb.h.

 New API allows selective initialization of USB controllers whenever needed.

 Signed-off-by: Mateusz Zalega m.zal...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 Reviewed-by: Lukasz Majewski l.majew...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 Cc: Lukasz Majewski l.majew...@samsung.com
 Change-Id: Ia78a1378f30a55dd14598c9a1a1b4b8a762e2cd8
 ---
 Changes since RFC (v1):
 - NVIDIA Tegra doesn't postpone its USB init anymore
 - board_usb_init()'s sole argument name was shortened
 - networking code comment style (/* blurb...) dropped
 - squashed RFC changes so that patch won't break bisect

 v2 changes:
 - commit message fixup

 v3 changes:
 - added 'index' argument to perform selective port initialization

 v4 changes:
 - board_usb_init_fail() renamed to board_usb_cleanup()
 - board_usb_cleanup() accepts controller index and init type
 - DFU and UMS commands don't init all USB controllers anymore
 - minor related fixes  refactorization
 ---
 
 Looks pretty much OK. Did you test it on a few platforms? I'd like to apply 
 this 
 for -next anyway, since the MW is long closed.
 
 Best regards,
 Marek Vasut

I've ran MAKEALL on all arm boards and tested it on Samsung Goni.
Everything seems to be OK.

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v4] usb: new board-specific USB init interface

2013-09-10 Thread Mateusz Zalega
This commit unifies board-specific USB initialization implementations
under one symbol (usb_board_init), declaration of which is available in
usb.h.

New API allows selective initialization of USB controllers whenever needed.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
Cc: Marek Vasut ma...@denx.de
Cc: Lukasz Majewski l.majew...@samsung.com
Change-Id: Ia78a1378f30a55dd14598c9a1a1b4b8a762e2cd8
---
Changes since RFC (v1):
- NVIDIA Tegra doesn't postpone its USB init anymore
- board_usb_init()'s sole argument name was shortened
- networking code comment style (/* blurb...) dropped
- squashed RFC changes so that patch won't break bisect

v2 changes:
- commit message fixup

v3 changes:
- added 'index' argument to perform selective port initialization

v4 changes:
- board_usb_init_fail() renamed to board_usb_cleanup()
- board_usb_cleanup() accepts controller index and init type
- DFU and UMS commands don't init all USB controllers anymore
- minor related fixes  refactorization
---
 arch/arm/include/asm/arch-tegra/usb.h |  3 +-
 arch/arm/include/asm/ehci-omap.h  |  4 +--
 board/amcc/canyonlands/canyonlands.c  |  5 +--
 board/balloon3/balloon3.c |  7 +++--
 board/compulab/cm_t35/cm_t35.c|  2 +-
 board/esd/apc405/apc405.c |  8 ++---
 board/esd/pmc440/pmc440.c |  8 ++---
 board/htkw/mcx/mcx.c  |  2 +-
 board/icpdas/lp8x4x/lp8x4x.c  |  7 +++--
 board/nvidia/common/board.c   |  4 ++-
 board/samsung/trats/trats.c   |  5 +--
 board/technexion/twister/twister.c|  2 +-
 board/teejet/mt_ventoux/mt_ventoux.c  |  2 +-
 board/ti/beagle/beagle.c  |  2 +-
 board/ti/omap5_uevm/evm.c |  2 +-
 board/ti/panda/panda.c|  2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |  7 +++--
 board/trizepsiv/conxs.c   |  7 +++--
 board/vpac270/vpac270.c   |  7 +++--
 common/cmd_dfu.c  | 31 +++
 common/cmd_usb_mass_storage.c | 44 ++-
 common/usb.c  |  5 +++
 drivers/dfu/dfu.c |  2 +-
 drivers/usb/host/ehci-omap.c  | 12 ++--
 drivers/usb/host/ehci-tegra.c |  2 +-
 drivers/usb/host/ohci-hcd.c   |  4 +--
 drivers/usb/host/ohci.h   | 11 +++
 include/g_dnl.h   |  2 --
 include/usb.h | 30 +-
 include/usb_mass_storage.h| 13 +++-
 30 files changed, 138 insertions(+), 104 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/usb.h 
b/arch/arm/include/asm/arch-tegra/usb.h
index f66257c..a1efd07 100644
--- a/arch/arm/include/asm/arch-tegra/usb.h
+++ b/arch/arm/include/asm/arch-tegra/usb.h
@@ -131,8 +131,7 @@
 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
 #define VBUS_VLD_STS   (1  26)
 
-
 /* Setup USB on the board */
-int board_usb_init(const void *blob);
+int usb_process_devicetree(const void *blob);
 
 #endif /* _TEGRA_USB_H_ */
diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h
index ac83a53..c7bca05 100644
--- a/arch/arm/include/asm/ehci-omap.h
+++ b/arch/arm/include/asm/ehci-omap.h
@@ -145,8 +145,8 @@ struct omap_ehci {
 struct ehci_hccr;
 struct ehci_hcor;
 
-int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor);
+int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
+  struct ehci_hccr **hccr, struct ehci_hcor **hcor);
 int omap_ehci_hcd_stop(void);
 
 #endif /* _OMAP_COMMON_EHCI_H_ */
diff --git a/board/amcc/canyonlands/canyonlands.c 
b/board/amcc/canyonlands/canyonlands.c
index cc36f45..395095e 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -16,6 +16,7 @@
 #include asm/4xx_pcie.h
 #include asm/ppc4xx-gpio.h
 #include asm/errno.h
+#include usb.h
 
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH 
chips */
 
@@ -188,7 +189,7 @@ int board_early_init_f(void)
 }
 
 #if defined(CONFIG_USB_OHCI_NEW)  defined(CONFIG_SYS_USB_OHCI_BOARD_INIT)
-int usb_board_init(void)
+int board_usb_init(int index, enum board_usb_init_type init)
 {
struct board_bcsr *bcsr_data =
(struct board_bcsr *)CONFIG_SYS_BCSR_BASE;
@@ -229,7 +230,7 @@ int usb_board_stop(void)
return 0;
 }
 
-int usb_board_init_fail(void)
+int board_usb_cleanup(int index, enum board_usb_init_type init)
 {
return usb_board_stop();
 }
diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c

Re: [U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-06 Thread Mateusz Zalega
On 09/05/13 19:51, Marek Vasut wrote:
 Why not wrap board_usb_init() and board_usb_init_fail() into single call.
 You now pass some flags to board_usb_init() already, so just add another
 for the fail case. How does it sound to you?

 Like overengineering. It would lead to board_usb_init(USB_INIT_ALL,
 USB_INIT_DEVICE, USB_CLEANUP) calls, which are not very readable.
 
 This is not what I mean, see this:
 
 int board_usb_init(int index, enum board_usb_init_type init)
 
 Add a new init type (or maybe change the init field to be flags) that will 
 say 
 OK, do a fail init ?

As for providing a way to do a selective cleanup if anything gone wrong,
it's a good idea, but adding such functionality to board_usb_init()
would be confusing, especially for newcomers. Why not do this in
board_usb_init_fail(int index, enum board_usb_init_type)?

...and maybe rename board_usb_init_fail to board_usb_cleanup.

 Moreover, the 'int index' should likely be unsigned int and the special
 value to init all controllers at once should probably then be 0x

 Despite our greatest ambitions, I don't think we're likely to use more
 than 2^31-1 USB controllers at a time. Besides, negative values look
 better both in code and debugger session.
 
 Thinking of it further, instead of using negative value here, like I 
 mentioned 
 above, why not make the board_usb_init_type into a field of flags , then 
 add 
 flag to init all controllers at once ?

That's unnecessary. It wouldn't lead to any practical advantage over
existing interface.

Best Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-06 Thread Mateusz Zalega
On 09/06/13 13:24, Marek Vasut wrote:
 Moreover, the 'int index' should likely be unsigned int and the special
 value to init all controllers at once should probably then be
 0x

 Despite our greatest ambitions, I don't think we're likely to use more
 than 2^31-1 USB controllers at a time. Besides, negative values look
 better both in code and debugger session.

 Thinking of it further, instead of using negative value here, like I
 mentioned above, why not make the board_usb_init_type into a field of
 flags , then add flag to init all controllers at once ?

 That's unnecessary. It wouldn't lead to any practical advantage over
 existing interface.
 
 The advantage would be you won't be mixing two things (value AND value with 
 special meaning) into the index parameter.

Alright, provide a use-case. The only 'special' value we have now
doesn't interfere with controller index. Why write code or interfaces
that won't ever be used?

Best regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-06 Thread Mateusz Zalega
On 09/06/13 13:40, Marek Vasut wrote:
 Moreover, the 'int index' should likely be unsigned int and the
 special value to init all controllers at once should probably then
 be 0x

 Despite our greatest ambitions, I don't think we're likely to use more
 than 2^31-1 USB controllers at a time. Besides, negative values look
 better both in code and debugger session.

 Thinking of it further, instead of using negative value here, like I
 mentioned above, why not make the board_usb_init_type into a field of
 flags , then add flag to init all controllers at once ?

 That's unnecessary. It wouldn't lead to any practical advantage over
 existing interface.

 The advantage would be you won't be mixing two things (value AND value
 with special meaning) into the index parameter.

 Alright, provide a use-case. The only 'special' value we have now
 doesn't interfere with controller index. Why write code or interfaces
 that won't ever be used?
 
 Look, abusing the index field with a special value is moronic, especially if 
 you 

I wouldn't call a de-facto standard abusive or moronic.
On the other hand, contributing to unnecessary code bloat would be.

 _do_ have another field that can very well be turned into a block of flags 

Have you provided another use-case for that, as I asked?

 instead of enum right next to it.
 
 function(int foo , enum bar)
 | ^
 | |
 `-'
  flags go
here
 
 Then int foo can be turned into unsigned int foo _and_ be used for it's one 
 singular purpose. Likewise, enum bar will now be unsigned int flags . Do 
 you 
 see the separation now ?

Read your mail carefully - at this point I don't have any problems
understanding what you wish to do, but I see your API changes as
unjustified. Can you justify them without appealing to your authority
and maybe inserting a couple of ad-hominems here and there?

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-05 Thread Mateusz Zalega
On 09/05/13 17:50, Marek Vasut wrote:
 v3 changes:
 - added 'index' argument to perform selective port initialization
 
 OK, a few general ideas again:
 
 Why not wrap board_usb_init() and board_usb_init_fail() into single call. You 
 now pass some flags to board_usb_init() already, so just add another for the 
 fail case. How does it sound to you?

Like overengineering. It would lead to board_usb_init(USB_INIT_ALL,
USB_INIT_DEVICE, USB_CLEANUP) calls, which are not very readable.

 Moreover, the 'int index' should likely be unsigned int and the special value 
 to 
 init all controllers at once should probably then be 0x

Despite our greatest ambitions, I don't think we're likely to use more
than 2^31-1 USB controllers at a time. Besides, negative values look
better both in code and debugger session.

Best Regards,

-- 
Mateusz Zalega
Samsung RD Institute Poland
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3] usb: new board-specific USB init interface

2013-09-03 Thread Mateusz Zalega
This commit unifies board-specific USB initialization implementations
under one symbol (usb_board_init), declaration of which is available in
usb.h.

Signed-off-by: Mateusz Zalega m.zal...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
Reviewed-by: Lukasz Majewski l.majew...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
Changes since RFC (v1):
- NVIDIA Tegra doesn't postpone its USB init anymore
- board_usb_init()'s sole argument name was shortened
- networking code comment style (/* blurb...) dropped
- squashed RFC changes so that patch won't break bisect

v2 changes:
- commit message fixup

v3 changes:
- added 'index' argument to perform selective port initialization
---
 arch/arm/include/asm/arch-tegra/usb.h |  3 +--
 arch/arm/include/asm/ehci-omap.h  |  4 ++--
 board/amcc/canyonlands/canyonlands.c  |  5 +++--
 board/balloon3/balloon3.c |  5 +++--
 board/compulab/cm_t35/cm_t35.c|  2 +-
 board/esd/apc405/apc405.c |  5 +++--
 board/esd/pmc440/pmc440.c |  5 +++--
 board/htkw/mcx/mcx.c  |  2 +-
 board/icpdas/lp8x4x/lp8x4x.c  |  5 +++--
 board/nvidia/common/board.c   |  4 +++-
 board/samsung/trats/trats.c   |  5 +++--
 board/technexion/twister/twister.c|  2 +-
 board/teejet/mt_ventoux/mt_ventoux.c  |  2 +-
 board/ti/beagle/beagle.c  |  2 +-
 board/ti/panda/panda.c|  2 +-
 board/toradex/colibri_pxa270/colibri_pxa270.c |  5 +++--
 board/trizepsiv/conxs.c   |  5 +++--
 board/vpac270/vpac270.c   |  5 +++--
 common/cmd_dfu.c  |  5 ++---
 common/cmd_usb_mass_storage.c |  3 ++-
 common/usb.c  |  5 +
 drivers/usb/host/ehci-omap.c  | 12 +++-
 drivers/usb/host/ehci-tegra.c |  2 +-
 drivers/usb/host/ohci-hcd.c   |  4 ++--
 drivers/usb/host/ohci.h   | 12 +---
 include/g_dnl.h   |  2 --
 include/usb.h | 28 ++-
 include/usb_mass_storage.h| 14 ++
 28 files changed, 92 insertions(+), 63 deletions(-)

diff --git a/arch/arm/include/asm/arch-tegra/usb.h 
b/arch/arm/include/asm/arch-tegra/usb.h
index f66257c..a1efd07 100644
--- a/arch/arm/include/asm/arch-tegra/usb.h
+++ b/arch/arm/include/asm/arch-tegra/usb.h
@@ -131,8 +131,7 @@
 /* USB3_IF_USB_PHY_VBUS_SENSORS_0 */
 #define VBUS_VLD_STS   (1  26)
 
-
 /* Setup USB on the board */
-int board_usb_init(const void *blob);
+int usb_process_devicetree(const void *blob);
 
 #endif /* _TEGRA_USB_H_ */
diff --git a/arch/arm/include/asm/ehci-omap.h b/arch/arm/include/asm/ehci-omap.h
index ac83a53..c7bca05 100644
--- a/arch/arm/include/asm/ehci-omap.h
+++ b/arch/arm/include/asm/ehci-omap.h
@@ -145,8 +145,8 @@ struct omap_ehci {
 struct ehci_hccr;
 struct ehci_hcor;
 
-int omap_ehci_hcd_init(struct omap_usbhs_board_data *usbhs_pdata,
-   struct ehci_hccr **hccr, struct ehci_hcor **hcor);
+int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
+  struct ehci_hccr **hccr, struct ehci_hcor **hcor);
 int omap_ehci_hcd_stop(void);
 
 #endif /* _OMAP_COMMON_EHCI_H_ */
diff --git a/board/amcc/canyonlands/canyonlands.c 
b/board/amcc/canyonlands/canyonlands.c
index cc36f45..8e85bee 100644
--- a/board/amcc/canyonlands/canyonlands.c
+++ b/board/amcc/canyonlands/canyonlands.c
@@ -16,6 +16,7 @@
 #include asm/4xx_pcie.h
 #include asm/ppc4xx-gpio.h
 #include asm/errno.h
+#include usb.h
 
 extern flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS]; /* info for FLASH 
chips */
 
@@ -188,7 +189,7 @@ int board_early_init_f(void)
 }
 
 #if defined(CONFIG_USB_OHCI_NEW)  defined(CONFIG_SYS_USB_OHCI_BOARD_INIT)
-int usb_board_init(void)
+int board_usb_init(int index, enum board_usb_init_type init)
 {
struct board_bcsr *bcsr_data =
(struct board_bcsr *)CONFIG_SYS_BCSR_BASE;
@@ -229,7 +230,7 @@ int usb_board_stop(void)
return 0;
 }
 
-int usb_board_init_fail(void)
+int board_usb_init_fail(void)
 {
return usb_board_stop();
 }
diff --git a/board/balloon3/balloon3.c b/board/balloon3/balloon3.c
index ecbac16..891e48a 100644
--- a/board/balloon3/balloon3.c
+++ b/board/balloon3/balloon3.c
@@ -13,6 +13,7 @@
 #include asm/io.h
 #include spartan3.h
 #include command.h
+#include usb.h
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -59,7 +60,7 @@ void dram_init_banksize(void)
 }
 
 #ifdef CONFIG_CMD_USB
-int usb_board_init(void)
+int board_usb_init(int index, enum board_usb_init_type init)
 {
writel((readl(UHCHR) | UHCHR_PCPL | UHCHR_PSPL) 
~(UHCHR_SSEP0 | UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSE

  1   2   >