[PATCH 01/12] add barebox logo

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
in logo/ you will found the barebox logo with color or white
in:
 - bmp (black background)
 - png24 (transparent or black background)
 - png8 (black background)

for the following size
 - 100x100
 - 200x200
 - 400x400
 - 600x600
 - 800x800
 - 900x900

The logo are origanize in a way to be able to include them in the envfs
by just point as it.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 logo/bmp/100x100/color/blackbg/barebox.bmp   |  Bin 0 - 30056 bytes
 logo/bmp/100x100/white/blackbg/barebox.bmp   |  Bin 0 - 30056 bytes
 logo/bmp/200x200/color/blackbg/barebox.bmp   |  Bin 0 - 120056 bytes
 logo/bmp/200x200/white/blackbg/barebox.bmp   |  Bin 0 - 120056 bytes
 logo/bmp/400x400/color/blackbg/barebox.bmp   |  Bin 0 - 480056 bytes
 logo/bmp/400x400/white/blackbg/barebox.bmp   |  Bin 0 - 480056 bytes
 logo/bmp/600x600/color/blackbg/barebox.bmp   |  Bin 0 - 1080056 bytes
 logo/bmp/600x600/while/blackbg/barebox.bmp   |  Bin 0 - 1080056 bytes
 logo/bmp/800x800/color/blackbg/barebox.bmp   |  Bin 0 - 1920056 bytes
 logo/bmp/800x800/white/blackbg/barebox.bmp   |  Bin 0 - 1920056 bytes
 logo/bmp/900x900/color/blackbg/barebox.bmp   |  Bin 0 - 2430056 bytes
 logo/bmp/900x900/white/blackbg/barebox.bmp   |  Bin 0 - 2430056 bytes
 logo/png24/100x100/color/barebox.png |  Bin 0 - 22724 bytes
 logo/png24/100x100/color/blackbg/barebox.png |  Bin 0 - 19254 bytes
 logo/png24/100x100/white/barebox.png |  Bin 0 - 12053 bytes
 logo/png24/100x100/white/blackbg/barebox.png |  Bin 0 - 10940 bytes
 logo/png24/200x200/color/barebox.png |  Bin 0 - 71557 bytes
 logo/png24/200x200/color/blackbg/barebox.png |  Bin 0 - 60836 bytes
 logo/png24/200x200/white/barebox.png |  Bin 0 - 31132 bytes
 logo/png24/200x200/white/blackbg/barebox.png |  Bin 0 - 28578 bytes
 logo/png24/400x400/color/barebox.png |  Bin 0 - 217170 bytes
 logo/png24/400x400/color/blackbg/barebox.png |  Bin 0 - 188172 bytes
 logo/png24/400x400/white/barebox.png |  Bin 0 - 78591 bytes
 logo/png24/400x400/white/blackbg/barebox.png |  Bin 0 - 72957 bytes
 logo/png24/600x600/color/barebox.png |  Bin 0 - 406788 bytes
 logo/png24/600x600/color/blackbg/barebox.png |  Bin 0 - 353328 bytes
 logo/png24/600x600/while/barebox.png |  Bin 0 - 137235 bytes
 logo/png24/600x600/while/blackbg/barebox.png |  Bin 0 - 130454 bytes
 logo/png24/800x800/color/barebox.png |  Bin 0 - 627433 bytes
 logo/png24/800x800/color/blackbg/barebox.png |  Bin 0 - 547772 bytes
 logo/png24/800x800/white/barebox.png |  Bin 0 - 210397 bytes
 logo/png24/800x800/white/blackbg/barebox.png |  Bin 0 - 198356 bytes
 logo/png24/900x900/color/barebox.png |  Bin 0 - 713120 bytes
 logo/png24/900x900/color/blackbg/barebox.png |  Bin 0 - 611586 bytes
 logo/png24/900x900/white/barebox.png |  Bin 0 - 204449 bytes
 logo/png24/900x900/white/blackbg/barebox.png |  Bin 0 - 190770 bytes
 logo/png8/100x100/color/blackbg/barebox.png  |  Bin 0 - 8279 bytes
 logo/png8/100x100/white/blackbg/barebox.png  |  Bin 0 - 6089 bytes
 logo/png8/200x200/color/blackbg/barebox.png  |  Bin 0 - 23616 bytes
 logo/png8/200x200/white/blackbg/barebox.png  |  Bin 0 - 14838 bytes
 logo/png8/400x400/color/blackbg/barebox.png  |  Bin 0 - 71295 bytes
 logo/png8/400x400/white/blackbg/barebox.png  |  Bin 0 - 38480 bytes
 logo/png8/600x600/color/blackbg/barebox.png  |  Bin 0 - 130709 bytes
 logo/png8/600x600/while/blackbg/barebox.png  |  Bin 0 - 68648 bytes
 logo/png8/800x800/color/blackbg/barebox.png  |  Bin 0 - 205281 bytes
 logo/png8/800x800/white/blackbg/barebox.png  |  Bin 0 - 104173 bytes
 logo/png8/900x900/color/blackbg/barebox.png  |  Bin 0 - 236679 bytes
 logo/png8/900x900/white/blackbg/barebox.png  |  Bin 0 - 106472 bytes
 48 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 logo/bmp/100x100/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/100x100/white/blackbg/barebox.bmp
 create mode 100644 logo/bmp/200x200/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/200x200/white/blackbg/barebox.bmp
 create mode 100644 logo/bmp/400x400/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/400x400/white/blackbg/barebox.bmp
 create mode 100644 logo/bmp/600x600/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/600x600/while/blackbg/barebox.bmp
 create mode 100644 logo/bmp/800x800/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/800x800/white/blackbg/barebox.bmp
 create mode 100644 logo/bmp/900x900/color/blackbg/barebox.bmp
 create mode 100644 logo/bmp/900x900/white/blackbg/barebox.bmp
 create mode 100644 logo/png24/100x100/color/barebox.png
 create mode 100644 logo/png24/100x100/color/blackbg/barebox.png
 create mode 100644 logo/png24/100x100/white/barebox.png
 create mode 100644 logo/png24/100x100/white/blackbg/barebox.png
 create mode 100644 logo/png24/200x200/color/barebox.png
 create mode 100644 logo/png24/200x200/color/blackbg/barebox.png
 create mode 100644 logo/png24/200x200/white/barebox.png
 

[PATCH 04/12] introduce image_renderer framework

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to support bmp and png

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 include/image_renderer.h |   62 +++
 lib/Kconfig  |3 ++
 lib/Makefile |1 +
 lib/image_renderer.c |   73 ++
 4 files changed, 139 insertions(+)
 create mode 100644 include/image_renderer.h
 create mode 100644 lib/image_renderer.c

diff --git a/include/image_renderer.h b/include/image_renderer.h
new file mode 100644
index 000..a93242c
--- /dev/null
+++ b/include/image_renderer.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
+ *
+ * GPL v2
+ */
+
+#ifndef __IMAGE_RENDER_H__
+#define __IMAGE_RENDER_H__
+
+#include filetype.h
+#include linux/list.h
+#include errno.h
+
+struct image_renderer {
+   enum filetype type;
+   int (*renderer)(struct fb_info *info, void* data, int size, void* fb,
+   int startx, int starty, void* offscreenbuf);
+
+   struct list_head list;
+};
+
+static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, 
int b)
+{
+   u32 px;
+
+   px = (r  (8 - info-red.length))  info-red.offset |
+   (g  (8 - info-green.length))  info-green.offset |
+   (b  (8 - info-blue.length))  info-blue.offset;
+
+   switch (info-bits_per_pixel) {
+   case 8:
+   break;
+   case 16:
+   *(u16 *)adr = px;
+   break;
+   case 32:
+   *(u32 *)adr = px;
+   break;
+   }
+}
+
+#ifdef CONFIG_IMAGE_RENDERER
+int image_renderer_register(struct image_renderer *ir);
+void image_render_unregister(struct image_renderer *ir);
+
+int image_renderer_file(struct fb_info *info, const char* bmpfile, void* fb,
+   int startx, int starty, void* offscreenbuf);
+#else
+static inline int image_renderer_register(struct image_renderer *ir)
+{
+   return -EINVAL;
+}
+static inline void image_renderer_unregister(struct image_renderer *ir) {}
+
+static inline int image_renderer_file(struct fb_info *info, const char* file, 
void* fb,
+   int startx, int starty, void* offscreenbuf)
+{
+   return -EINVAL;
+}
+#endif
+
+#endif /* __IMAGE_RENDERER_H__ */
diff --git a/lib/Kconfig b/lib/Kconfig
index 93e360b..e74189d 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -38,6 +38,9 @@ config BITREV
 config QSORT
bool
 
+config IMAGE_RENDERER
+   bool
+
 config BMP
bool
 
diff --git a/lib/Makefile b/lib/Makefile
index df4b5e5..8fbae8a 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -35,3 +35,4 @@ obj-$(CONFIG_BCH) += bch.o
 obj-$(CONFIG_BITREV)   += bitrev.o
 obj-$(CONFIG_QSORT)+= qsort.o
 obj-$(CONFIG_BMP)  += bmp.o
+obj-$(CONFIG_IMAGE_RENDERER)   += image_renderer.o
diff --git a/lib/image_renderer.c b/lib/image_renderer.c
new file mode 100644
index 000..e8d4ab5
--- /dev/null
+++ b/lib/image_renderer.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
+ *
+ * GPL v2
+ */
+
+#include common.h
+#include fb.h
+#include image_renderer.h
+#include errno.h
+#include fs.h
+#include malloc.h
+
+static LIST_HEAD(image_renderers);
+
+static struct image_renderer *get_renderer(void* buf)
+{
+   struct image_renderer *ir;
+   enum filetype type = file_detect_type(buf);
+
+   list_for_each_entry(ir, image_renderers, list) {
+   if (ir-type == type)
+   return ir;
+   }
+
+   return NULL;
+}
+
+int image_renderer_file(struct fb_info *info, const char* file, void* fb,
+   int startx, int starty, void* offscreenbuf)
+{
+   void *data;
+   int size;
+   struct image_renderer *ir;
+   int ret;
+
+   data = read_file(file, size);
+   if (!data) {
+   printf(unable to read %s\n, file);
+   return -ENOMEM;
+   }
+
+   ir = get_renderer(data);
+   if (!ir) {
+   ret = -ENOENT;
+   goto out;
+   }
+
+   ret = ir-renderer(info, data, size, fb, startx, starty, offscreenbuf);
+
+out:
+   free(data);
+
+   return ret;
+}
+
+int image_renderer_register(struct image_renderer *ir)
+{
+   if (!ir || !ir-type || !ir-renderer)
+   return -EIO;
+
+   list_add_tail(ir-list, image_renderers);
+
+   return 0;
+}
+
+void image_renderer_unregister(struct image_renderer *ir)
+{
+   if (!ir)
+   return;
+
+   list_del(ir-list);
+}
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 03/12] bmp: split bmp rending in lib/bmp.c

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
So we can add other format support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 commands/Kconfig |1 +
 commands/splash.c|  124 +--
 include/bmp_layout.h |   11 +
 lib/Kconfig  |3 ++
 lib/Makefile |1 +
 lib/bmp.c|  132 ++
 6 files changed, 159 insertions(+), 113 deletions(-)
 create mode 100644 lib/bmp.c

diff --git a/commands/Kconfig b/commands/Kconfig
index c4623fa..9107a3e 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -538,6 +538,7 @@ config CMD_LSMOD
 config CMD_SPLASH
bool
depends on VIDEO
+   select BMP
prompt splash
help
  show bmp files on framebuffer devices
diff --git a/commands/splash.c b/commands/splash.c
index 6526b20..ad73778 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -8,43 +8,18 @@
 #include fcntl.h
 #include fb.h
 #include bmp_layout.h
-#include asm/byteorder.h
-
-static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, 
int b)
-{
-   u32 px;
-
-   px = (r  (8 - info-red.length))  info-red.offset |
-   (g  (8 - info-green.length))  info-green.offset |
-   (b  (8 - info-blue.length))  info-blue.offset;
-
-   switch (info-bits_per_pixel) {
-   case 8:
-   break;
-   case 16:
-   *(u16 *)adr = px;
-   break;
-   case 32:
-   *(u32 *)adr = px;
-   break;
-   }
-}
 
 static int do_splash(int argc, char *argv[])
 {
int ret, opt, fd;
char *fbdev = /dev/fb0;
-   void *fb, *offscreenbuf = NULL;
+   void *fb;
struct fb_info info;
-   struct bmp_image *bmp;
char *bmpfile;
-   int bmpsize;
-   char *image;
-   int sw, sh, width, height, startx = -1, starty = -1;
-   int bits_per_pixel, fbsize;
+   int startx = -1, starty = -1;
int xres, yres;
int offscreen = 0;
-   void *adr, *buf;
+   void *offscreenbuf = NULL;
 
while((opt = getopt(argc, argv, f:x:y:o))  0) {
switch(opt) {
@@ -88,105 +63,28 @@ static int do_splash(int argc, char *argv[])
xres = info.xres;
yres = info.yres;
 
-   bmp = read_file(bmpfile, bmpsize);
-   if (!bmp) {
-   printf(unable to read %s\n, bmpfile);
-   goto failed_memmap;
-   }
-
-   if (bmp-header.signature[0] != 'B' ||
- bmp-header.signature[1] != 'M') {
-   printf(No valid bmp file\n);
-   }
-
-   sw = le32_to_cpu(bmp-header.width);
-   sh = le32_to_cpu(bmp-header.height);
-
-   if (startx  0) {
-   startx = (xres - sw) / 2;
-   if (startx  0)
-   startx = 0;
-   }
-
-   if (starty  0) {
-   starty = (yres - sh) / 2;
-   if (starty  0)
-   starty = 0;
-   }
-
-   width = min(sw, xres - startx);
-   height = min(sh, yres - starty);
-
-   bits_per_pixel = le16_to_cpu(bmp-header.bit_count);
-   fbsize = xres * yres * (info.bits_per_pixel  3);
-
if (offscreen) {
+   int fbsize;
/* Don't fail if malloc fails, just continue rendering directly
 * on the framebuffer
 */
+
+   fbsize = xres * yres * (info.bits_per_pixel  3);
offscreenbuf = malloc(fbsize);
if (offscreenbuf)
memcpy(offscreenbuf, fb, fbsize);
}
 
-   buf = offscreenbuf ? offscreenbuf : fb;
-
-   if (bits_per_pixel == 8) {
-   int x, y;
-   struct bmp_color_table_entry *color_table = bmp-color_table;
-
-   for (y = 0; y  height; y++) {
-   image = (char *)bmp +
-   le32_to_cpu(bmp-header.data_offset);
-   image += (sh - y - 1) * sw * (bits_per_pixel  3);
-   adr = buf + ((y + starty) * xres + startx) *
-   (info.bits_per_pixel  3);
-   for (x = 0; x  width; x++) {
-   int pixel;
+   if (bmp_render_file(info, bmpfile, fb, startx, starty, xres, yres,
+   offscreenbuf)  0)
+   ret = 1;
 
-   pixel = *image;
-
-   set_pixel(info, adr, color_table[pixel].red,
-   color_table[pixel].green,
-   color_table[pixel].blue);
-   adr += info.bits_per_pixel  3;
-
-   image += bits_per_pixel  3;
-   }
-   }
-   } else if (bits_per_pixel == 24) {
-   int x, y;
-
-   for (y = 0; y  height; y++) {
- 

[PATCH 07/12] splash: add support to set a background color

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
This will allow to reset the screen to a default color when using transparent
PNG.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 commands/splash.c |   79 +++--
 1 file changed, 76 insertions(+), 3 deletions(-)

diff --git a/commands/splash.c b/commands/splash.c
index 88a6cf1..4bddc6c 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -9,6 +9,66 @@
 #include fb.h
 #include image_renderer.h
 
+static u32 get_pixel(struct fb_info *info, u32 color)
+{
+   u32 px;
+   u8 t = (color  24)  0xff;
+   u8 r = (color  16)  0xff;
+   u8 g = (color  8 )  0xff;
+   u8 b = (color  0 )  0xff;
+
+   if (info-grayscale) {
+px = (r | g | b) ? 0x : 0x0;
+return px;
+   }
+
+   px = (t  (8 - info-transp.length))  info-transp.offset |
+(r  (8 - info-red.length))  info-red.offset |
+(g  (8 - info-green.length))  info-green.offset |
+(b  (8 - info-blue.length))  info-blue.offset;
+
+   return px;
+}
+
+static void memsetw(void *s, u16 c, size_t n)
+{
+   size_t i;
+   u16* tmp = s;
+
+   for (i = 0; i  n; i++)
+   *tmp++ = c;
+}
+
+static void memsetl(void *s, u32 c, size_t n)
+{
+   size_t i;
+   u32* tmp = s;
+
+   for (i = 0; i  n; i++)
+   *tmp++ = c;
+}
+
+static void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t 
size)
+{
+   u32 px;
+   u8 *screen = buf;
+
+   px = get_pixel(info, color);
+
+   switch (info-bits_per_pixel) {
+   case 8:
+   memset(screen, (uint8_t)px, size);
+   break;
+   case 16:
+   memsetw(screen, (uint16_t)px, size);
+   break;
+   case 32:
+   case 24:
+   memsetl(screen, px, size);
+   break;
+   }
+}
+
 static int do_splash(int argc, char *argv[])
 {
int ret, opt, fd;
@@ -19,13 +79,19 @@ static int do_splash(int argc, char *argv[])
int startx = -1, starty = -1;
int xres, yres;
int offscreen = 0;
+   u32 bg_color = 0x;
+   bool do_bg = false;
void *offscreenbuf = NULL;
 
-   while((opt = getopt(argc, argv, f:x:y:o))  0) {
+   while((opt = getopt(argc, argv, f:x:y:ob:))  0) {
switch(opt) {
case 'f':
fbdev = optarg;
break;
+   case 'b':
+   bg_color = simple_strtoul(optarg, NULL, 0);
+   do_bg = true;
+   break;
case 'x':
startx = simple_strtoul(optarg, NULL, 0);
break;
@@ -71,8 +137,14 @@ static int do_splash(int argc, char *argv[])
 
fbsize = xres * yres * (info.bits_per_pixel  3);
offscreenbuf = malloc(fbsize);
-   if (offscreenbuf)
-   memcpy(offscreenbuf, fb, fbsize);
+   if (offscreenbuf) {
+   if (do_bg)
+   memset_pixel(info, offscreenbuf, bg_color, 
xres * yres);
+   else
+   memcpy(offscreenbuf, fb, fbsize);
+   }
+   } else if (do_bg) {
+   memset_pixel(info, fb, bg_color, xres * yres);
}
 
if (image_renderer_file(info, image_file, fb, startx, starty,
@@ -98,6 +170,7 @@ BAREBOX_CMD_HELP_SHORT(Show the bitmap FILE on the 
framebuffer.\n)
 BAREBOX_CMD_HELP_OPT  (-f fb,   framebuffer device (/dev/fb0)\n)
 BAREBOX_CMD_HELP_OPT  (-x xofs, x offset (default center)\n)
 BAREBOX_CMD_HELP_OPT  (-y yofs, y offset (default center)\n)
+BAREBOX_CMD_HELP_OPT  (-b backgroung, backgroung color\n)
 BAREBOX_CMD_HELP_OPT  (-o,render offscreen\n)
 BAREBOX_CMD_HELP_END
 
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 06/12] splash/bmp: switch to image_renderer

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 commands/Kconfig  |1 +
 commands/splash.c |   10 +++
 lib/Kconfig   |1 +
 lib/bmp.c |   63 +
 {include = lib}/bmp_layout.h |0
 5 files changed, 26 insertions(+), 49 deletions(-)
 rename {include = lib}/bmp_layout.h (100%)

diff --git a/commands/Kconfig b/commands/Kconfig
index 9107a3e..97993c1 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -538,6 +538,7 @@ config CMD_LSMOD
 config CMD_SPLASH
bool
depends on VIDEO
+   select IMAGE_RENDERER
select BMP
prompt splash
help
diff --git a/commands/splash.c b/commands/splash.c
index ad73778..88a6cf1 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -7,7 +7,7 @@
 #include getopt.h
 #include fcntl.h
 #include fb.h
-#include bmp_layout.h
+#include image_renderer.h
 
 static int do_splash(int argc, char *argv[])
 {
@@ -15,7 +15,7 @@ static int do_splash(int argc, char *argv[])
char *fbdev = /dev/fb0;
void *fb;
struct fb_info info;
-   char *bmpfile;
+   char *image_file;
int startx = -1, starty = -1;
int xres, yres;
int offscreen = 0;
@@ -40,7 +40,7 @@ static int do_splash(int argc, char *argv[])
printf(no filename given\n);
return 1;
}
-   bmpfile = argv[optind];
+   image_file = argv[optind];
 
fd = open(fbdev, O_RDWR);
if (fd  0) {
@@ -75,8 +75,8 @@ static int do_splash(int argc, char *argv[])
memcpy(offscreenbuf, fb, fbsize);
}
 
-   if (bmp_render_file(info, bmpfile, fb, startx, starty, xres, yres,
-   offscreenbuf)  0)
+   if (image_renderer_file(info, image_file, fb, startx, starty,
+   offscreenbuf)  0)
ret = 1;
 
if (offscreenbuf)
diff --git a/lib/Kconfig b/lib/Kconfig
index e74189d..9ec2095 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -43,5 +43,6 @@ config IMAGE_RENDERER
 
 config BMP
bool
+   depends on IMAGE_RENDERER
 
 endmenu
diff --git a/lib/bmp.c b/lib/bmp.c
index 776d3b3..573cf97 100644
--- a/lib/bmp.c
+++ b/lib/bmp.c
@@ -1,54 +1,23 @@
 #include common.h
-#include fs.h
 #include errno.h
-#include malloc.h
 #include fb.h
-#include bmp_layout.h
+#include bmp_layout.h
 #include asm/byteorder.h
+#include init.h
+#include image_renderer.h
 
-static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, 
int b)
+static int bmp_renderer(struct fb_info *info, void* data, int size, void* fb,
+   int startx, int starty, void* offscreenbuf)
 {
-   u32 px;
-
-   px = (r  (8 - info-red.length))  info-red.offset |
-   (g  (8 - info-green.length))  info-green.offset |
-   (b  (8 - info-blue.length))  info-blue.offset;
-
-   switch (info-bits_per_pixel) {
-   case 8:
-   break;
-   case 16:
-   *(u16 *)adr = px;
-   break;
-   case 32:
-   *(u32 *)adr = px;
-   break;
-   }
-}
-
-int bmp_render_file(struct fb_info *info, const char* bmpfile, void* fb,
-   int startx, int starty, int xres, int yres, void* 
offscreenbuf)
-{
-   struct bmp_image *bmp;
+   struct bmp_image *bmp = data;
int sw, sh, width, height;
int bits_per_pixel, fbsize;
-   int bmpsize;
-   int ret = 0;
void *adr, *buf;
char *image;
+   int xres, yres;
 
-   bmp = read_file(bmpfile, bmpsize);
-   if (!bmp) {
-   printf(unable to read %s\n, bmpfile);
-   return -ENOMEM;
-   }
-
-   if (bmp-header.signature[0] != 'B' ||
- bmp-header.signature[1] != 'M') {
-   printf(No valid bmp file\n);
-   ret = -EINVAL;
-   goto err;
-   }
+   xres = info-xres;
+   yres = info-yres;
 
sw = le32_to_cpu(bmp-header.width);
sh = le32_to_cpu(bmp-header.height);
@@ -123,10 +92,16 @@ int bmp_render_file(struct fb_info *info, const char* 
bmpfile, void* fb,
if (offscreenbuf)
memcpy(fb, offscreenbuf, fbsize);
 
-   free(bmp);
return sh;
+}
 
-err:
-   free(bmp);
-   return ret;
+static struct image_renderer bmp = {
+   .type = filetype_bmp,
+   .renderer = bmp_renderer,
+};
+
+static int bmp_init(void)
+{
+   return image_renderer_register(bmp);
 }
+fs_initcall(bmp_init);
diff --git a/include/bmp_layout.h b/lib/bmp_layout.h
similarity index 100%
rename from include/bmp_layout.h
rename to lib/bmp_layout.h
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 02/12] bmp: rename it to splash

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
so be can add more format support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 Documentation/commands.dox |2 +-
 arch/arm/boards/eukrea_cpuimx25/env/bin/init_board |4 ++--
 arch/arm/boards/eukrea_cpuimx27/env/bin/init   |4 ++--
 arch/arm/boards/eukrea_cpuimx35/env/bin/init_board |4 ++--
 arch/arm/boards/eukrea_cpuimx51/env/bin/init_board |4 ++--
 arch/arm/boards/karo-tx25/env/bin/init_board   |2 +-
 arch/arm/boards/mioa701/env/bin/init   |2 +-
 arch/arm/configs/chumbyone_defconfig   |2 +-
 arch/arm/configs/cupid_defconfig   |2 +-
 arch/arm/configs/eukrea_cpuimx25_defconfig |2 +-
 arch/arm/configs/eukrea_cpuimx27_defconfig |2 +-
 arch/arm/configs/eukrea_cpuimx35_defconfig |2 +-
 arch/arm/configs/freescale_mx35_3stack_defconfig   |2 +-
 arch/arm/configs/imx28evk_defconfig|2 +-
 arch/arm/configs/mioa701_defconfig |2 +-
 arch/arm/configs/neso_defconfig|2 +-
 arch/arm/configs/pcm027_defconfig  |2 +-
 arch/arm/configs/pcm038_defconfig  |2 +-
 arch/arm/configs/tx25stk5_defconfig|2 +-
 arch/arm/configs/tx28stk5_defconfig|2 +-
 commands/Kconfig   |4 ++--
 commands/Makefile  |2 +-
 commands/{bmp.c = splash.c}   |   12 ++--
 23 files changed, 33 insertions(+), 33 deletions(-)
 rename commands/{bmp.c = splash.c} (95%)

diff --git a/Documentation/commands.dox b/Documentation/commands.dox
index 5ef7829..d8cfa6b 100644
--- a/Documentation/commands.dox
+++ b/Documentation/commands.dox
@@ -18,7 +18,6 @@ available in @a Barebox:
 @li @subpage _name
 @li @subpage addpart_command
 @li @subpage alternate
-@li @subpage bmp_command
 @li @subpage bootm_command
 @li @subpage bootu
 @li @subpage bootz
@@ -95,6 +94,7 @@ available in @a Barebox:
 @li @subpage sh
 @li @subpage sleep
 @li @subpage source
+@li @subpage splash_command
 @li @subpage test
 @li @subpage timeout
 @li @subpage true
diff --git a/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board 
b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
index ff3365d..58e07e0 100644
--- a/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
+++ b/arch/arm/boards/eukrea_cpuimx25/env/bin/init_board
@@ -1,11 +1,11 @@
 #!/bin/sh
 
 if [ -f /env/logo.bmp ]; then
-   bmp /env/logo.bmp
+   splash /env/logo.bmp
fb0.enable=1
 elif [ -f /env/logo.bmp.lzo ]; then
uncompress /env/logo.bmp.lzo /logo.bmp
-   bmp /logo.bmp
+   splash /logo.bmp
fb0.enable=1
 fi
 
diff --git a/arch/arm/boards/eukrea_cpuimx27/env/bin/init 
b/arch/arm/boards/eukrea_cpuimx27/env/bin/init
index f84ace9..cd74974 100644
--- a/arch/arm/boards/eukrea_cpuimx27/env/bin/init
+++ b/arch/arm/boards/eukrea_cpuimx27/env/bin/init
@@ -17,11 +17,11 @@ if [ -e /dev/nand0 ]; then
 fi
 
 if [ -f /env/logo.bmp ]; then
-   bmp /env/logo.bmp
+   splash /env/logo.bmp
fb0.enable=1
 elif [ -f /env/logo.bmp.lzo ]; then
uncompress /env/logo.bmp.lzo /logo.bmp
-   bmp /logo.bmp
+   splash /logo.bmp
fb0.enable=1
 fi
 
diff --git a/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board 
b/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
index 89fd9a9..2a07a84 100644
--- a/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
+++ b/arch/arm/boards/eukrea_cpuimx35/env/bin/init_board
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 if [ -f /env/logo.bmp ]; then
-   bmp /env/logo.bmp
+   splash /env/logo.bmp
fb0.enable=1
gpio_set_value 1 1
 elif [ -f /env/logo.bmp.lzo ]; then
uncompress /env/logo.bmp.lzo /logo.bmp
-   bmp /logo.bmp
+   splash /logo.bmp
fb0.enable=1
gpio_set_value 1 1
 fi
diff --git a/arch/arm/boards/eukrea_cpuimx51/env/bin/init_board 
b/arch/arm/boards/eukrea_cpuimx51/env/bin/init_board
index cb624e5..0af6582 100644
--- a/arch/arm/boards/eukrea_cpuimx51/env/bin/init_board
+++ b/arch/arm/boards/eukrea_cpuimx51/env/bin/init_board
@@ -1,12 +1,12 @@
 #!/bin/sh
 
 if [ -f /env/logo.bmp ]; then
-   bmp /env/logo.bmp
+   splash /env/logo.bmp
fb0.enable=1
gpio_set_value 1 1
 elif [ -f /env/logo.bmp.lzo ]; then
uncompress /env/logo.bmp.lzo /logo.bmp
-   bmp /logo.bmp
+   splash /logo.bmp
fb0.enable=1
gpio_set_value 1 1
 fi
diff --git a/arch/arm/boards/karo-tx25/env/bin/init_board 
b/arch/arm/boards/karo-tx25/env/bin/init_board
index b17c55d..1f35c96 100644
--- a/arch/arm/boards/karo-tx25/env/bin/init_board
+++ b/arch/arm/boards/karo-tx25/env/bin/init_board
@@ -1,6 +1,6 @@
 
 if [ -e /dev/fb0 -a -e /env/splash.bmp ]; then
-   bmp /env/splash.bmp
+   splash /env/splash.bmp
fb0.enable=1
 fi
 
diff --git a/arch/arm/boards/mioa701/env/bin/init 

[PATCH 08/12] Introduce graphic utils

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
to Factorise pixel rendering

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 commands/splash.c|   61 +-
 include/graphic_utils.h  |   13 
 include/image_renderer.h |   20 ---
 lib/Makefile |1 +
 lib/bmp.c|5 +--
 lib/graphic_utils.c  |   83 ++
 6 files changed, 101 insertions(+), 82 deletions(-)
 create mode 100644 include/graphic_utils.h
 create mode 100644 lib/graphic_utils.c

diff --git a/commands/splash.c b/commands/splash.c
index 4bddc6c..f4b975b 100644
--- a/commands/splash.c
+++ b/commands/splash.c
@@ -8,66 +8,7 @@
 #include fcntl.h
 #include fb.h
 #include image_renderer.h
-
-static u32 get_pixel(struct fb_info *info, u32 color)
-{
-   u32 px;
-   u8 t = (color  24)  0xff;
-   u8 r = (color  16)  0xff;
-   u8 g = (color  8 )  0xff;
-   u8 b = (color  0 )  0xff;
-
-   if (info-grayscale) {
-px = (r | g | b) ? 0x : 0x0;
-return px;
-   }
-
-   px = (t  (8 - info-transp.length))  info-transp.offset |
-(r  (8 - info-red.length))  info-red.offset |
-(g  (8 - info-green.length))  info-green.offset |
-(b  (8 - info-blue.length))  info-blue.offset;
-
-   return px;
-}
-
-static void memsetw(void *s, u16 c, size_t n)
-{
-   size_t i;
-   u16* tmp = s;
-
-   for (i = 0; i  n; i++)
-   *tmp++ = c;
-}
-
-static void memsetl(void *s, u32 c, size_t n)
-{
-   size_t i;
-   u32* tmp = s;
-
-   for (i = 0; i  n; i++)
-   *tmp++ = c;
-}
-
-static void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t 
size)
-{
-   u32 px;
-   u8 *screen = buf;
-
-   px = get_pixel(info, color);
-
-   switch (info-bits_per_pixel) {
-   case 8:
-   memset(screen, (uint8_t)px, size);
-   break;
-   case 16:
-   memsetw(screen, (uint16_t)px, size);
-   break;
-   case 32:
-   case 24:
-   memsetl(screen, px, size);
-   break;
-   }
-}
+#include graphic_utils.h
 
 static int do_splash(int argc, char *argv[])
 {
diff --git a/include/graphic_utils.h b/include/graphic_utils.h
new file mode 100644
index 000..6d555b2
--- /dev/null
+++ b/include/graphic_utils.h
@@ -0,0 +1,13 @@
+/*
+ * Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
+ *
+ * GPL v2
+ */
+
+#ifndef __GRAPHIC_UTILS_H__
+#define __GRAPHIC_UTILS_H__
+
+void set_rgb_pixel(struct fb_info *info, void *adr, int r, int g, int b);
+void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size);
+
+#endif /* __GRAPHIC_UTILS_H__ */
diff --git a/include/image_renderer.h b/include/image_renderer.h
index a93242c..d735cf7 100644
--- a/include/image_renderer.h
+++ b/include/image_renderer.h
@@ -19,26 +19,6 @@ struct image_renderer {
struct list_head list;
 };
 
-static inline void set_pixel(struct fb_info *info, void *adr, int r, int g, 
int b)
-{
-   u32 px;
-
-   px = (r  (8 - info-red.length))  info-red.offset |
-   (g  (8 - info-green.length))  info-green.offset |
-   (b  (8 - info-blue.length))  info-blue.offset;
-
-   switch (info-bits_per_pixel) {
-   case 8:
-   break;
-   case 16:
-   *(u16 *)adr = px;
-   break;
-   case 32:
-   *(u32 *)adr = px;
-   break;
-   }
-}
-
 #ifdef CONFIG_IMAGE_RENDERER
 int image_renderer_register(struct image_renderer *ir);
 void image_render_unregister(struct image_renderer *ir);
diff --git a/lib/Makefile b/lib/Makefile
index 8fbae8a..96b7c56 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -35,4 +35,5 @@ obj-$(CONFIG_BCH) += bch.o
 obj-$(CONFIG_BITREV)   += bitrev.o
 obj-$(CONFIG_QSORT)+= qsort.o
 obj-$(CONFIG_BMP)  += bmp.o
+obj-$(CONFIG_IMAGE_RENDERER)   += image_renderer.o graphic_utils.o
 obj-$(CONFIG_IMAGE_RENDERER)   += image_renderer.o
diff --git a/lib/bmp.c b/lib/bmp.c
index 573cf97..8986930 100644
--- a/lib/bmp.c
+++ b/lib/bmp.c
@@ -5,6 +5,7 @@
 #include asm/byteorder.h
 #include init.h
 #include image_renderer.h
+#include graphic_utils.h
 
 static int bmp_renderer(struct fb_info *info, void* data, int size, void* fb,
int startx, int starty, void* offscreenbuf)
@@ -57,7 +58,7 @@ static int bmp_renderer(struct fb_info *info, void* data, int 
size, void* fb,
 
pixel = *image;
 
-   set_pixel(info, adr, color_table[pixel].red,
+   set_rgb_pixel(info, adr, color_table[pixel].red,
color_table[pixel].green,
color_table[pixel].blue);
adr += info-bits_per_pixel  3;
@@ -79,7 +80,7 @@ static int 

[PATCH 09/12] graphic_utils: add rgba support

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
this will allow to render rgba image with or without hw support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 include/graphic_utils.h |4 ++
 lib/graphic_utils.c |  116 +--
 2 files changed, 116 insertions(+), 4 deletions(-)

diff --git a/include/graphic_utils.h b/include/graphic_utils.h
index 6d555b2..7cb0b2f 100644
--- a/include/graphic_utils.h
+++ b/include/graphic_utils.h
@@ -7,7 +7,11 @@
 #ifndef __GRAPHIC_UTILS_H__
 #define __GRAPHIC_UTILS_H__
 
+void rgba_blend(struct fb_info *info, void *image, void* dest, int height,
+   int width, int startx, int starty, bool is_rgba);
+void set_pixel(struct fb_info *info, void *adr, u32 px);
 void set_rgb_pixel(struct fb_info *info, void *adr, int r, int g, int b);
+void set_rgba_pixel(struct fb_info *info, void *adr, int r, int g, int b, int 
a);
 void memset_pixel(struct fb_info *info, void* buf, u32 color, size_t size);
 
 #endif /* __GRAPHIC_UTILS_H__ */
diff --git a/lib/graphic_utils.c b/lib/graphic_utils.c
index 2e174d8..4d627b2 100644
--- a/lib/graphic_utils.c
+++ b/lib/graphic_utils.c
@@ -62,14 +62,39 @@ void memset_pixel(struct fb_info *info, void* buf, u32 
color, size_t size)
}
 }
 
-void set_rgb_pixel(struct fb_info *info, void *adr, int r, int g, int b)
+static void get_rgb_pixel(struct fb_info *info, void *adr, int *r ,int *g, int 
*b)
 {
u32 px;
+   u32 rmask, gmask, bmask;
 
-   px = (r  (8 - info-red.length))  info-red.offset |
-   (g  (8 - info-green.length))  info-green.offset |
-   (b  (8 - info-blue.length))  info-blue.offset;
+   switch (info-bits_per_pixel) {
+   case 16:
+   px = *(u16 *)adr;
+   break;
+   case 32:
+   px = *(u32 *)adr;
+   break;
+   case 8:
+   default:
+   return;
+   }
+
+   rmask = (0xff  (8 - info-blue.length))  info-blue.offset |
+   (0xff  (8 - info-green.length))  info-green.offset;
+
+   gmask = (0xff  (8 - info-red.length))  info-red.offset |
+   (0xff  (8 - info-blue.length))  info-blue.offset;
+
+   bmask = (0xff  (8 - info-red.length))  info-red.offset |
+   (0xff  (8 - info-green.length))  info-green.offset;
 
+   *r = ((px  ~rmask)  info-red.offset)  (8 - info-red.length);
+   *g = ((px  ~gmask)  info-green.offset)  (8 - info-green.length);
+   *b = ((px  ~bmask)  info-blue.offset)  (8 - info-blue.length);
+}
+
+void set_pixel(struct fb_info *info, void *adr, u32 px)
+{
switch (info-bits_per_pixel) {
case 8:
break;
@@ -81,3 +106,86 @@ void set_rgb_pixel(struct fb_info *info, void *adr, int r, 
int g, int b)
break;
}
 }
+
+void set_rgb_pixel(struct fb_info *info, void *adr, int r, int g, int b)
+{
+   u32 px;
+
+   px = (r  (8 - info-red.length))  info-red.offset |
+   (g  (8 - info-green.length))  info-green.offset |
+   (b  (8 - info-blue.length))  info-blue.offset;
+
+   set_pixel(info, adr, px);
+}
+
+static int alpha_mux(int s, int d, int a)
+{
+   return (d * a + s * (255 - a))  8;
+}
+
+void set_rgba_pixel(struct fb_info *info, void *adr, int r, int g, int b, int 
a)
+{
+   u32 px = 0x0;
+
+   if (!a)
+   return;
+
+   if (a != 0xff) {
+   if (info-transp.length) {
+   px |= (a  (8 - info-transp.length))  
info-transp.offset;
+   } else {
+   int sr = 0;
+   int sg = 0;
+   int sb = 0;
+
+   get_rgb_pixel(info, adr, sr, sg, sb);
+
+   r = alpha_mux(sr, r, a);
+   g = alpha_mux(sg, g, a);
+   b = alpha_mux(sb, b, a);
+
+   set_rgb_pixel(info, adr, r, g, b);
+
+   return;
+   }
+   }
+
+   px |= (r  (8 - info-red.length))  info-red.offset |
+   (g  (8 - info-green.length))  info-green.offset |
+   (b  (8 - info-blue.length))  info-blue.offset;
+
+   set_pixel(info, adr, px);
+}
+
+void rgba_blend(struct fb_info *info, void *image, void* buf, int height,
+   int width, int startx, int starty, bool is_rgba)
+{
+   unsigned char *adr;
+   int x, y;
+   int xres;
+   int img_byte_per_pixel = 3;
+
+   if (is_rgba)
+   img_byte_per_pixel++;
+
+   xres = info-xres;
+
+   for (y = 0; y  height; y++) {
+   adr = buf + ((y + starty) * xres + startx) *
+   (info-bits_per_pixel  3);
+
+   for (x = 0; x  width; x++) {
+   char *pixel;
+
+   pixel = image;
+   if (is_rgba)
+   set_rgba_pixel(info, adr, pixel[0], pixel[1],
+   

Re: [PATCH 6/8] drivers/net: add driver for the EMAC device found in some TI SoCs

2012-09-06 Thread Sascha Hauer
On Wed, Sep 05, 2012 at 08:03:20PM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 On 17:52 Wed 05 Sep , Jan Luebbe wrote:
  Signed-off-by: Jan Luebbe j...@pengutronix.de
 Again NACK
 
 drop the struct  on hte reg

I also don't like it, but let's not be religious about it.
Wolfgang currently forces all people to use structs for registers.
Forcing exactly the opposite is counterproductive I think. The original
drivers uses the structs and at some point it can be useful to compare
to this driver.

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] [OpenRISC] Add __ashrdi3 and remove link to libgcc

2012-09-06 Thread Franck Jullien
2012/9/6 Sascha Hauer s.ha...@pengutronix.de:
 Hi Franck,

 On Wed, Sep 05, 2012 at 10:37:26PM +0200, Franck Jullien wrote:
 In a previous patch, Sascha needed to add __ashrdi3 and then linked to
 libgcc. This patch add the ashrdi3 function in the arch/openrisc/lib
 directory and remove the libgcc link.

 Does this fix any regressions or is it just a do-the-right-thing patch?


No, it doesn't fix anything. I just did the same thing I did for
others libgcc functions.


 Signed-off-by: Franck Jullien franck.jull...@gmail.com
 ---
  arch/openrisc/Makefile  |4 +-
  arch/openrisc/lib/Makefile  |1 +
  arch/openrisc/lib/ashrdi3.S |   59 
 +++
  3 files changed, 62 insertions(+), 2 deletions(-)
  create mode 100644 arch/openrisc/lib/ashrdi3.S

 diff --git a/arch/openrisc/Makefile b/arch/openrisc/Makefile
 index 1f4b175..9e88a51 100644
 --- a/arch/openrisc/Makefile
 +++ b/arch/openrisc/Makefile
 @@ -1,6 +1,6 @@
  CPPFLAGS += -D__OR1K__ -ffixed-r10 -mhard-mul -mhard-div

 -LIBGCC  := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
 +#LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)

 Can we remove the line instead?

I wanted to keep it in case we have the problem again (need to link to
libgcc).



  board-$(CONFIG_GENERIC) := generic

 @@ -20,6 +20,6 @@ common-y += $(BOARD)
  common-y += arch/openrisc/lib/
  common-y += arch/openrisc/cpu/

 -common-y  += $(LIBGCC)
 +#common-y += $(LIBGCC)

 ditto.

But I could remove it of course.


 Sascha

 --
 Pengutronix e.K.   | |
 Industrial Linux Solutions | http://www.pengutronix.de/  |
 Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
 Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 12/12] png: add picoPNG lib support

2012-09-06 Thread Antony Pavlov
On 6 September 2012 10:05, Jean-Christophe PLAGNIOL-VILLARD
plagn...@jcrosoft.com wrote:
 This is an alternative to LodePNG take from http://forge.voodooprojects.org/
 which is base on picoPNG C++ wrote by Lode Vandevenne. The same author as
 LodePNG.

 PicoPNG only support RGBA PNG8

 The source code of picopng.c was just adapat to be compliant to C89 and drop
 the interanal ZLIB support. Coding style untouched.
 ^^^

:) the internal?


 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
 ---
  lib/Kconfig|   19 ++
  lib/Makefile   |3 +-
  lib/picopng.c  |  810 
 
  lib/picopng.h  |   34 +++
  lib/png_pico.c |  152 +++
  5 files changed, 1017 insertions(+), 1 deletion(-)
  create mode 100644 lib/picopng.c
  create mode 100644 lib/picopng.h
  create mode 100644 lib/png_pico.c

 diff --git a/lib/Kconfig b/lib/Kconfig
 index 0013b5a..8f05fa4 100644
 --- a/lib/Kconfig
 +++ b/lib/Kconfig
 @@ -51,6 +51,25 @@ config PNG
 bool png
 select ZLIB

 +if PNG
 +
 +choice
 +   prompt PNG Lib
 +
 +config LODEPNG
 +   bool lodePNG
 +   help
 + Mostly PNG support
 +
 +config PICOPNG
 +   bool picoPNG
 +   help
 + Support only RGBA PNG8
 +
 +endchoice
 +
 +endif
 +
  endif

  endmenu
 diff --git a/lib/Makefile b/lib/Makefile
 index 4944319..733bd8c 100644
 --- a/lib/Makefile
 +++ b/lib/Makefile
 @@ -37,4 +37,5 @@ obj-$(CONFIG_QSORT)   += qsort.o
  obj-$(CONFIG_BMP)  += bmp.o
  obj-$(CONFIG_IMAGE_RENDERER)   += image_renderer.o graphic_utils.o
  obj-$(CONFIG_IMAGE_RENDERER)   += image_renderer.o
 -obj-$(CONFIG_PNG)  += png.o lodepng.o
 +obj-$(CONFIG_LODEPNG)  += png_lode.o lodepng.o
 +obj-$(CONFIG_PICOPNG)  += png_pico.o picopng.o
 diff --git a/lib/picopng.c b/lib/picopng.c
 new file mode 100644
 index 000..77cd81c
 --- /dev/null
 +++ b/lib/picopng.c
 @@ -0,0 +1,810 @@
 +// picoPNG version 20080503 (cleaned up and ported to c by kaitek)
 +// Copyright (c) 2005-2008 Lode Vandevenne
 +//
 +// This software is provided 'as-is', without any express or implied
 +// warranty. In no event will the authors be held liable for any damages
 +// arising from the use of this software.
 +//
 +// Permission is granted to anyone to use this software for any purpose,
 +// including commercial applications, and to alter it and redistribute it
 +// freely, subject to the following restrictions:
 +//
 +//   1. The origin of this software must not be misrepresented; you must not
 +//  claim that you wrote the original software. If you use this software
 +//  in a product, an acknowledgment in the product documentation would be
 +//  appreciated but is not required.
 +//   2. Altered source versions must be plainly marked as such, and must not 
 be
 +//  misrepresented as being the original software.
 +//   3. This notice may not be removed or altered from any source 
 distribution.
 +
 +#include common.h
 +#include malloc.h
 +#include picopng.h
 +
 +/*/
 +
 +typedef struct png_alloc_node {
 +   struct png_alloc_node *prev, *next;
 +   void *addr;
 +   size_t size;
 +} png_alloc_node_t;
 +
 +png_alloc_node_t *png_alloc_head = NULL;
 +png_alloc_node_t *png_alloc_tail = NULL;
 +
 +png_alloc_node_t *png_alloc_find_node(void *addr)
 +{
 +   png_alloc_node_t *node;
 +   for (node = png_alloc_head; node; node = node-next)
 +   if (node-addr == addr)
 +   break;
 +   return node;
 +}
 +
 +void png_alloc_add_node(void *addr, size_t size)
 +{
 +   png_alloc_node_t *node;
 +   if (png_alloc_find_node(addr))
 +   return;
 +   node = malloc(sizeof (png_alloc_node_t));
 +   node-addr = addr;
 +   node-size = size;
 +   node-prev = png_alloc_tail;
 +   node-next = NULL;
 +   png_alloc_tail = node;
 +   if (node-prev)
 +   node-prev-next = node;
 +   if (!png_alloc_head)
 +   png_alloc_head = node;
 +}
 +
 +void png_alloc_remove_node(png_alloc_node_t *node)
 +{
 +   if (node-prev)
 +   node-prev-next = node-next;
 +   if (node-next)
 +   node-next-prev = node-prev;
 +   if (node == png_alloc_head)
 +   png_alloc_head = node-next;
 +   if (node == png_alloc_tail)
 +   png_alloc_tail = node-prev;
 +   node-prev = node-next = node-addr = NULL;
 +   free(node);
 +}
 +
 +void *png_alloc_malloc(size_t size)
 +{
 +   void *addr = malloc(size);
 +   png_alloc_add_node(addr, size);
 +   return addr;
 +}
 +
 +void *png_alloc_realloc(void *addr, size_t size)
 +{
 +   void *new_addr;
 +   if (!addr)
 +   return png_alloc_malloc(size);
 +   new_addr = realloc(addr, size);
 +   if (new_addr != addr) {
 +   png_alloc_node_t *old_node;
 +  

Re: [PATCH 6/8] drivers/net: add driver for the EMAC device found in some TI SoCs

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 09:20 Thu 06 Sep , Sascha Hauer wrote:
 On Wed, Sep 05, 2012 at 08:03:20PM +0200, Jean-Christophe PLAGNIOL-VILLARD 
 wrote:
  On 17:52 Wed 05 Sep , Jan Luebbe wrote:
   Signed-off-by: Jan Luebbe j...@pengutronix.de
  Again NACK
  
  drop the struct  on hte reg
 
 I also don't like it, but let's not be religious about it.
 Wolfgang currently forces all people to use structs for registers.
 Forcing exactly the opposite is counterproductive I think. The original
 drivers uses the structs and at some point it can be useful to compare
 to this driver.
this is really a shit to read the code is horible

So at the point we need to sync with the kernel

I'm working on the amba pl180 driver currently if I use the u-boot one my
board boot in 11s (just U-Boot), I re-write basing on linux I'm booting in 
arround
2s.

So I do not see the point to share the driver with u-boot, I prefer to have a
well writted one and optimised

Best Regards,
J.
 
 Sascha
 
 
 -- 
 Pengutronix e.K.   | |
 Industrial Linux Solutions | http://www.pengutronix.de/  |
 Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
 Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC] spi: add demo bitbang driver based on code from linux

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 11:53 Thu 06 Sep , Antony Pavlov wrote:
 It not the real driver but demonstration of the conception.
 The code was tested on real hardware, but the code for
 this hardware can't be published just now.
 
 Usage of bitbang framework is very easy.
 You must declare the functions for setting CLK and MOSI signals,
 and the function for reading MISO signal:
 
  * void setsck(struct spi_device *, int is_on);
  * void setmosi(struct spi_device *, int is_on);
  * int getmiso(struct spi_device *);
 
 Next include the spi-bitbang-txrx.h header. The header
 will give you the functions for reading/writing u32 words from/to spi.
 
 Signed-off-by: Antony Pavlov antonynpav...@gmail.com
can you implement the gpio driver base on it

so we can test it and ack it

and does this work owith mmc-spi?

Best Regards,
J.
 ---
  arch/mips/boards/qemu-malta/init.c |   31 +++
  drivers/spi/Kconfig|4 +
  drivers/spi/Makefile   |1 +
  drivers/spi/bitbang_demo_spi.c |  176 
 
  drivers/spi/spi-bitbang-txrx.h |   93 +++
  5 files changed, 305 insertions(+)
  create mode 100644 drivers/spi/bitbang_demo_spi.c
  create mode 100644 drivers/spi/spi-bitbang-txrx.h
 
 diff --git a/arch/mips/boards/qemu-malta/init.c 
 b/arch/mips/boards/qemu-malta/init.c
 index 45f66f2..314ca88 100644
 --- a/arch/mips/boards/qemu-malta/init.c
 +++ b/arch/mips/boards/qemu-malta/init.c
 @@ -30,6 +30,8 @@
  #include partition.h
  #include sizes.h
  #include asm/common.h
 +#include spi/spi.h
 +#include spi/flash.h
  
  static int malta_mem_init(void)
  {
 @@ -64,3 +66,32 @@ static int malta_console_init(void)
   return 0;
  }
  console_initcall(malta_console_init);
 +
 +static struct flash_platform_data malta_spi_demo_flash_data = {
 + .name   = spi,
 + .type   = s25sl004a,
 +};
 +
 +static struct spi_board_info malta_spi_demo_devs[] __initdata = {
 + {
 + /* Spansion S25FL004A SPI flash */
 + .name   = m25p,
 + .max_speed_hz   = 5000,
 + .bus_num= 0,
 + .chip_select= 0,
 + .mode   = SPI_MODE_3,
 + .platform_data  = malta_spi_demo_flash_data,
 + },
 +};
 +
 +static int malta_spi_demo_init(void)
 +{
 +
 + spi_register_board_info(malta_spi_demo_devs,
 + ARRAY_SIZE(malta_spi_demo_devs));
 + add_generic_device(bitbang_demo_spi, -1, NULL,
 + 0, 0, IORESOURCE_MEM, NULL);
 +
 + return 0;
 +}
 +device_initcall(malta_spi_demo_init);
 diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
 index b5c55a4..d883cd4 100644
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
 @@ -34,4 +34,8 @@ config DRIVER_SPI_ATMEL
   depends on ARCH_AT91
   depends on SPI
  
 +config DRIVER_SPI_BITBANG_DEMO
 + bool BITBANG DEMO SPI controller
 + depends on SPI
 +
  endmenu
 diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
 index 101652f..087a982 100644
 --- a/drivers/spi/Makefile
 +++ b/drivers/spi/Makefile
 @@ -2,3 +2,4 @@ obj-$(CONFIG_SPI) += spi.o
  obj-$(CONFIG_DRIVER_SPI_IMX) += imx_spi.o
  obj-$(CONFIG_DRIVER_SPI_ALTERA) += altera_spi.o
  obj-$(CONFIG_DRIVER_SPI_ATMEL) += atmel_spi.o
 +obj-$(CONFIG_DRIVER_SPI_BITBANG_DEMO) += bitbang_demo_spi.o
 diff --git a/drivers/spi/bitbang_demo_spi.c b/drivers/spi/bitbang_demo_spi.c
 new file mode 100644
 index 000..76abf98
 --- /dev/null
 +++ b/drivers/spi/bitbang_demo_spi.c
 @@ -0,0 +1,176 @@
 +/*
 + * Copyright (C) 2012 Antony Pavlov antonynpav...@gmail.com
 + *
 + * This file is part of barebox.
 + * See file CREDITS for list of people who contributed to this project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + *
 + */
 +
 +#define DEBUG
 +
 +#include common.h
 +#include init.h
 +#include driver.h
 +#include spi/spi.h
 +#include io.h
 +#include clock.h
 +
 +struct spi_bitbang_demo_master {
 + int num_chipselect;
 + int spi_mode;
 + int databits;
 + int speed;
 + int bus_num;
 +};
 +
 +struct bitbang_demo_spi {
 + struct spi_master   master;
 + int databits;
 + int speed;
 + int mode;
 +};
 +
 +static inline void 

Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Eric Bénard
Le Thu, 6 Sep 2012 10:55:00 +0200,
Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com a écrit :
 On 09:37 Thu 06 Sep , Eric Bénard wrote:
  Barebox being an OpenSource project, is it possible to have these
  images created by a free tool and not including Adobe Photoshop CS5
  Macintosh tags (proprietary software on a proprietary OS on a
  proprietary platform ;-) ?
 Sorry no The logo is not OpenSource it's copyrighted
 
so that's another problem.

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/2] Calao boards: enable the pbl

2012-09-06 Thread Sascha Hauer
On Sat, Sep 01, 2012 at 02:45:12PM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 so we are smaller than the 256KiB reserved for barebox
 
 Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

Applied, thanks

Sascha

 ---
  arch/arm/configs/qil_a9260_128mib_defconfig |1 +
  arch/arm/configs/qil_a9260_defconfig|1 +
  arch/arm/configs/tny_a9260_defconfig|1 +
  arch/arm/configs/tny_a9263_defconfig|1 +
  arch/arm/configs/tny_a9g20_defconfig|1 +
  arch/arm/configs/usb_a9260_defconfig|1 +
  arch/arm/configs/usb_a9263_128mib_defconfig |1 +
  arch/arm/configs/usb_a9263_defconfig|1 +
  arch/arm/configs/usb_a9g20_128mib_defconfig |1 +
  arch/arm/configs/usb_a9g20_defconfig|1 +
  10 files changed, 10 insertions(+)
 
 diff --git a/arch/arm/configs/qil_a9260_128mib_defconfig 
 b/arch/arm/configs/qil_a9260_128mib_defconfig
 index 555d94f..cc2c6ac 100644
 --- a/arch/arm/configs/qil_a9260_128mib_defconfig
 +++ b/arch/arm/configs/qil_a9260_128mib_defconfig
 @@ -5,6 +5,7 @@ CONFIG_CALAO_MB_QIL_A9260=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/qil_a9260_defconfig 
 b/arch/arm/configs/qil_a9260_defconfig
 index 9e54a14..225f785 100644
 --- a/arch/arm/configs/qil_a9260_defconfig
 +++ b/arch/arm/configs/qil_a9260_defconfig
 @@ -4,6 +4,7 @@ CONFIG_CALAO_MB_QIL_A9260=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/tny_a9260_defconfig 
 b/arch/arm/configs/tny_a9260_defconfig
 index 83293fb..e525966 100644
 --- a/arch/arm/configs/tny_a9260_defconfig
 +++ b/arch/arm/configs/tny_a9260_defconfig
 @@ -4,6 +4,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/tny_a9263_defconfig 
 b/arch/arm/configs/tny_a9263_defconfig
 index dd68ba4..0a83b05 100644
 --- a/arch/arm/configs/tny_a9263_defconfig
 +++ b/arch/arm/configs/tny_a9263_defconfig
 @@ -4,6 +4,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/tny_a9g20_defconfig 
 b/arch/arm/configs/tny_a9g20_defconfig
 index 62250cb..8d606d1 100644
 --- a/arch/arm/configs/tny_a9g20_defconfig
 +++ b/arch/arm/configs/tny_a9g20_defconfig
 @@ -4,6 +4,7 @@ CONFIG_CALAO_MOB_TNY_MD2=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/usb_a9260_defconfig 
 b/arch/arm/configs/usb_a9260_defconfig
 index a9574c4..8fd2a18 100644
 --- a/arch/arm/configs/usb_a9260_defconfig
 +++ b/arch/arm/configs/usb_a9260_defconfig
 @@ -3,6 +3,7 @@ CONFIG_MACH_USB_A9260=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/usb_a9263_128mib_defconfig 
 b/arch/arm/configs/usb_a9263_128mib_defconfig
 index d31057f..efd68a8 100644
 --- a/arch/arm/configs/usb_a9263_128mib_defconfig
 +++ b/arch/arm/configs/usb_a9263_128mib_defconfig
 @@ -4,6 +4,7 @@ CONFIG_AT91_HAVE_SRAM_128M=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/usb_a9263_defconfig 
 b/arch/arm/configs/usb_a9263_defconfig
 index b57c300..9706d65 100644
 --- a/arch/arm/configs/usb_a9263_defconfig
 +++ b/arch/arm/configs/usb_a9263_defconfig
 @@ -3,6 +3,7 @@ CONFIG_MACH_USB_A9263=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git a/arch/arm/configs/usb_a9g20_128mib_defconfig 
 b/arch/arm/configs/usb_a9g20_128mib_defconfig
 index 6b02342..026cbcc 100644
 --- a/arch/arm/configs/usb_a9g20_128mib_defconfig
 +++ b/arch/arm/configs/usb_a9g20_128mib_defconfig
 @@ -4,6 +4,7 @@ CONFIG_AT91_HAVE_SRAM_128M=y
  CONFIG_AEABI=y
  # CONFIG_CMD_ARM_CPUINFO is not set
  CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 +CONFIG_PBL_IMAGE=y
  CONFIG_MMU=y
  CONFIG_BAREBOX_MAX_IMAGE_SIZE=0x4
  CONFIG_EXPERIMENTAL=y
 diff --git 

Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Eric Bénard
Le Thu, 6 Sep 2012 12:03:04 +0200,
Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com a écrit :
 On 11:55 Thu 06 Sep , Eric Bénard wrote:
  check in Linux in drivers/video/logo/
  I don't see any restriction but I may not have looked at the right
  place.
 Sorry the copyright are present the blackfin logo is a company logo 
 Copyrighted
 SH, m32r too. This deos not mean you are not free to use this just mean they 
 are
 protected.

where do you see these copyrights in Linux's source tree ?

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 1/2] kbuild: keep the barebox binary accessible

2012-09-06 Thread Jan Luebbe
When building a special image  from the original (compressed or
not) binary, to not overwrite KBUILD_BINARY.

This allows producing multiple images (such as MLO, UBL, ...)
from the (z)barebox.bin. In the case where no special image is
used, KBUILD_IMAGE is set to KBUILD_BINARY.

This patch was developed together with Sascha Hauer. Thanks!

Signed-off-by: Jan Luebbe j...@pengutronix.de
---
 Makefile  |   16 +++-
 arch/arm/Makefile |   10 +-
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index c6264d3..0f1a319 100644
--- a/Makefile
+++ b/Makefile
@@ -462,12 +462,18 @@ CFLAGS += $(call cc-option,-Wdeclaration-after-statement,)
 # disable pointer signed / unsigned warnings in gcc 4.0
 CFLAGS += $(call cc-option,-Wno-pointer-sign,)
 
-# Default kernel image to build when no specific target is given.
-# KBUILD_IMAGE may be overruled on the command line or
-# set in the environment
-# Also any assignments in arch/$(ARCH)/Makefile take precedence over
-# this default value
+# KBUILD_IMAGE: Default barebox image to build
+# Depending on the architecture, this can be either compressed or not.
+# It will also include any necessary headers to be bootable.
 export KBUILD_IMAGE ?= barebox.bin
+# KBUILD_BINARY: Raw barebox binary
+# This variable is set in case the architecture prepends a header and
+# points to a binary that can be loaded directly into RAM and executed.
+export KBUILD_BINARY ?= barebox.bin
+# KBUILD_IMAGE and _BINARY may be overruled on the command line or
+# set in the environment.
+# Also any assignments in arch/$(ARCH)/Makefile take precedence over
+# the default value.
 
 barebox-flash-image: $(KBUILD_IMAGE)
$(call if_changed,ln)
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 8e660be..94ee073 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -179,7 +179,7 @@ barebox.netx: $(KBUILD_BINARY)
 
 ifeq ($(machine-y),netx)
 KBUILD_TARGET := barebox.netx
-KBUILD_BINARY := $(KBUILD_TARGET)
+KBUILD_IMAGE := barebox.netx
 endif
 
 barebox.s5p: $(KBUILD_BINARY)
@@ -187,7 +187,7 @@ barebox.s5p: $(KBUILD_BINARY)
 
 ifeq ($(CONFIG_ARCH_S5PCxx),y)
 KBUILD_TARGET := barebox.s5p
-KBUILD_BINARY := $(KBUILD_TARGET)
+KBUILD_IMAGE := barebox.s5p
 endif
 
 quiet_cmd_mlo ?= IFT $@
@@ -199,7 +199,7 @@ MLO: $(KBUILD_BINARY)
 
 ifeq ($(CONFIG_OMAP_BUILD_IFT),y)
 KBUILD_TARGET := MLO
-KBUILD_BINARY := $(KBUILD_TARGET)
+KBUILD_IMAGE := MLO
 endif
 
 barebox.ubl: $(KBUILD_BINARY)
@@ -209,7 +209,7 @@ barebox.ubl: $(KBUILD_BINARY)
 
 ifeq ($(CONFIG_ARCH_DAVINCI),y)
 KBUILD_TARGET := barebox.ubl
-KBUILD_BINARY := $(KBUILD_TARGET)
+KBUILD_IMAGE := barebox.ubl
 endif
 
 pbl := arch/arm/pbl
@@ -219,7 +219,7 @@ zbarebox.S zbarebox.bin zbarebox: barebox.bin
 archclean:
$(MAKE) $(clean)=$(pbl)
 
-KBUILD_IMAGE := $(KBUILD_BINARY)
+KBUILD_IMAGE ?= $(KBUILD_BINARY)
 
 archprepare: maketools
 maketools:
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:12 Thu 06 Sep , Eric Bénard wrote:
 Le Thu, 6 Sep 2012 12:03:04 +0200,
 Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com a écrit :
  On 11:55 Thu 06 Sep , Eric Bénard wrote:
   check in Linux in drivers/video/logo/
   I don't see any restriction but I may not have looked at the right
   place.
  Sorry the copyright are present the blackfin logo is a company logo 
  Copyrighted
  SH, m32r too. This deos not mean you are not free to use this just mean 
  they are
  protected.
 
 where do you see these copyrights in Linux's source tree ?
they are on the web ase the logo have a trademark

Best Regards,
J.

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 2/2] Makefile: add target to produce a SPL compatible uImage

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:20 Thu 06 Sep , Jan Luebbe wrote:
 This is mostly useful during the initial port of barebox to a new
 board which is supported by u-boot. It also allows starting barebox
 from a SRAM-based u-boot SPL.
 
 A different load address can be set like this:
 make barebox.uimage UIMAGE_BASE=0x8000
 
 This patch was developed together with Sascha Hauer. Thanks!
 
 Signed-off-by: Jan Luebbe j...@pengutronix.de
 ---
  Makefile |   16 
missing gitignore and clean

Best Regards,
J.

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 01/12] add barebox logo

2012-09-06 Thread Jan Lübbe
Hi,

On Thu, 2012-09-06 at 08:04 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:
 skip as too big

This adds 18MB of binary logos to the tree, which is larger than the
complete current tree. Is this really necessary?

Perhaps we could build the required files on demand from an SVG or
something?

Regards,
Jan
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 04/12] introduce image_renderer framework

2012-09-06 Thread Jan Lübbe
Hi!

On Thu, 2012-09-06 at 08:04 +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
 diff --git a/lib/Kconfig b/lib/Kconfig
 index 93e360b..e74189d 100644
 --- a/lib/Kconfig
 +++ b/lib/Kconfig
 @@ -38,6 +38,9 @@ config BITREV
  config QSORT
   bool
  
 +config IMAGE_RENDERER
 + bool
 +
  config BMP
   bool
  

 + enum filetype type = file_detect_type(buf);

You're using functions from common/filetype.c but you do not declare the
dependency on FILETYPE in Kconfig.

Regards,
Jan
-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 01/12] add barebox logo

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:37 Thu 06 Sep , Jan Lübbe wrote:
 Hi,
 
 On Thu, 2012-09-06 at 08:04 +0200, Jean-Christophe PLAGNIOL-VILLARD
 wrote:
  skip as too big
 
 This adds 18MB of binary logos to the tree, which is larger than the
 complete current tree. Is this really necessary?
I put the bmp that's why if we drop it we have just 7MiB

and compare tot he linux tree we have a small tree

 
 Perhaps we could build the required files on demand from an SVG or
 something?
no sorry no svg availlable

Best Regards,
J.

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [RFC] spi: add demo bitbang driver based on code from linux

2012-09-06 Thread Antony Pavlov
On 6 September 2012 13:09, Jean-Christophe PLAGNIOL-VILLARD
plagn...@jcrosoft.com wrote:
 On 11:53 Thu 06 Sep , Antony Pavlov wrote:
 It not the real driver but demonstration of the conception.
 The code was tested on real hardware, but the code for
 this hardware can't be published just now.

 Usage of bitbang framework is very easy.
 You must declare the functions for setting CLK and MOSI signals,
 and the function for reading MISO signal:

  * void setsck(struct spi_device *, int is_on);
  * void setmosi(struct spi_device *, int is_on);
  * int getmiso(struct spi_device *);

 Next include the spi-bitbang-txrx.h header. The header
 will give you the functions for reading/writing u32 words from/to spi.

 Signed-off-by: Antony Pavlov antonynpav...@gmail.com
 can you implement the gpio driver base on it

 so we can test it and ack it

Do you mean to make spi-bitbang work over gpio driver?

Just now I has no gpio driver for my hardware; first I must write a gpio driver.
I think I can do the work in a one or two weeks.

 and does this work owith mmc-spi?

I have not checked it.
I have a board with bitbang-capable SPI controller and MMC-card
connected to it, so I can make the checks in the near future.


 Best Regards,
 J.
 ---
  arch/mips/boards/qemu-malta/init.c |   31 +++
  drivers/spi/Kconfig|4 +
  drivers/spi/Makefile   |1 +
  drivers/spi/bitbang_demo_spi.c |  176 
 
  drivers/spi/spi-bitbang-txrx.h |   93 +++
  5 files changed, 305 insertions(+)
  create mode 100644 drivers/spi/bitbang_demo_spi.c
  create mode 100644 drivers/spi/spi-bitbang-txrx.h

 diff --git a/arch/mips/boards/qemu-malta/init.c 
 b/arch/mips/boards/qemu-malta/init.c
 index 45f66f2..314ca88 100644
 --- a/arch/mips/boards/qemu-malta/init.c
 +++ b/arch/mips/boards/qemu-malta/init.c
 @@ -30,6 +30,8 @@
  #include partition.h
  #include sizes.h
  #include asm/common.h
 +#include spi/spi.h
 +#include spi/flash.h

  static int malta_mem_init(void)
  {
 @@ -64,3 +66,32 @@ static int malta_console_init(void)
   return 0;
  }
  console_initcall(malta_console_init);
 +
 +static struct flash_platform_data malta_spi_demo_flash_data = {
 + .name   = spi,
 + .type   = s25sl004a,
 +};
 +
 +static struct spi_board_info malta_spi_demo_devs[] __initdata = {
 + {
 + /* Spansion S25FL004A SPI flash */
 + .name   = m25p,
 + .max_speed_hz   = 5000,
 + .bus_num= 0,
 + .chip_select= 0,
 + .mode   = SPI_MODE_3,
 + .platform_data  = malta_spi_demo_flash_data,
 + },
 +};
 +
 +static int malta_spi_demo_init(void)
 +{
 +
 + spi_register_board_info(malta_spi_demo_devs,
 + ARRAY_SIZE(malta_spi_demo_devs));
 + add_generic_device(bitbang_demo_spi, -1, NULL,
 + 0, 0, IORESOURCE_MEM, NULL);
 +
 + return 0;
 +}
 +device_initcall(malta_spi_demo_init);
 diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig
 index b5c55a4..d883cd4 100644
 --- a/drivers/spi/Kconfig
 +++ b/drivers/spi/Kconfig
 @@ -34,4 +34,8 @@ config DRIVER_SPI_ATMEL
   depends on ARCH_AT91
   depends on SPI

 +config DRIVER_SPI_BITBANG_DEMO
 + bool BITBANG DEMO SPI controller
 + depends on SPI
 +
  endmenu
 diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
 index 101652f..087a982 100644
 --- a/drivers/spi/Makefile
 +++ b/drivers/spi/Makefile
 @@ -2,3 +2,4 @@ obj-$(CONFIG_SPI) += spi.o
  obj-$(CONFIG_DRIVER_SPI_IMX) += imx_spi.o
  obj-$(CONFIG_DRIVER_SPI_ALTERA) += altera_spi.o
  obj-$(CONFIG_DRIVER_SPI_ATMEL) += atmel_spi.o
 +obj-$(CONFIG_DRIVER_SPI_BITBANG_DEMO) += bitbang_demo_spi.o
 diff --git a/drivers/spi/bitbang_demo_spi.c b/drivers/spi/bitbang_demo_spi.c
 new file mode 100644
 index 000..76abf98
 --- /dev/null
 +++ b/drivers/spi/bitbang_demo_spi.c
 @@ -0,0 +1,176 @@
 +/*
 + * Copyright (C) 2012 Antony Pavlov antonynpav...@gmail.com
 + *
 + * This file is part of barebox.
 + * See file CREDITS for list of people who contributed to this project.
 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License as
 + * published by the Free Software Foundation; either version 2 of
 + * the License, or (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 + * MA 02111-1307 USA
 + *
 + */
 +
 +#define DEBUG
 +
 +#include common.h
 +#include init.h
 +#include driver.h
 +#include spi/spi.h
 

Re: [PATCH 01/12] add barebox logo

2012-09-06 Thread Eric Bénard
Le Thu, 6 Sep 2012 12:44:55 +0200,
Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com a écrit :

 On 12:37 Thu 06 Sep , Jan Lübbe wrote:
  Hi,
  
  On Thu, 2012-09-06 at 08:04 +0200, Jean-Christophe PLAGNIOL-VILLARD
  wrote:
   skip as too big
  
  This adds 18MB of binary logos to the tree, which is larger than the
  complete current tree. Is this really necessary?
 I put the bmp that's why if we drop it we have just 7MiB
 
 and compare tot he linux tree we have a small tree
 
barebox is not Linux and with such arguments you will always find a
good reason to include whatever you want in the project.

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 01/12] add barebox logo

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 08:04:49AM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 in logo/ you will found the barebox logo with color or white
 in:
  - bmp (black background)
  - png24 (transparent or black background)
  - png8 (black background)
 
 for the following size
  - 100x100
  - 200x200
  - 400x400
  - 600x600
  - 800x800
  - 900x900
 
 The logo are origanize in a way to be able to include them in the envfs
 by just point as it.

No. It's ok to have a small logo in the tree, but I won't commit a bunch
of big binaries to the tree.

Most people probably want to use their own logo for a product anyway.
I'm fine with uploading the logos to some website and wget them
automatically when necessary.

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH v5] xload: get barebox size from barebox_arm_head

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 14:41 Thu 06 Sep , Jan Weitzel wrote:
 Add functions to read the barebox_arm_head, check barebox magicword
 and read out the barebox image size.
 Create a inital partion of 1Mb to access the barebox image on nand.
 
 Signed-off-by: Jan Weitzel j.weit...@phytec.de
 ---
 v2: remove fall back if header read fail 
 v3: fix header check, rebase master 
 v4: factorize barebox detection
 v5: mv devines to include/filetype.h
 
  arch/arm/include/asm/barebox-arm-head.h |9 +
  arch/arm/mach-omap/include/mach/xload.h |2 +-
  arch/arm/mach-omap/xload.c  |   57 --
  common/filetype.c   |2 +-
  include/filetype.h  |   16 +
  4 files changed, 71 insertions(+), 6 deletions(-)
 
 diff --git a/arch/arm/mach-omap/include/mach/xload.h 
 b/arch/arm/mach-omap/include/mach/xload.h
 index 844b57f..26f1b68 100644
 --- a/arch/arm/mach-omap/include/mach/xload.h
 +++ b/arch/arm/mach-omap/include/mach/xload.h
 @@ -1,7 +1,7 @@
  #ifndef _MACH_XLOAD_H
  #define _MACH_XLOAD_H
  
 -void *omap_xload_boot_nand(int offset, int size);
 +void *omap_xload_boot_nand(int offset);
  void *omap_xload_boot_mmc(void);
  
  enum omap_boot_src {
 diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
 index 13024ab..0afeea9 100644
 --- a/arch/arm/mach-omap/xload.c
 +++ b/arch/arm/mach-omap/xload.c
 @@ -7,16 +7,65 @@
  #include fcntl.h
  #include mach/xload.h
  #include sizes.h
 +#include filetype.h
  
 -void *omap_xload_boot_nand(int offset, int size)
 +void *read_image_head(const char *name)
  {
 + void *header = xmalloc(ARM_HEAD_SIZE);
 + struct cdev *cdev;
   int ret;
 - void *to = xmalloc(size);
 +
 + cdev = cdev_open(name, O_RDONLY);
 + if (!cdev) {
 + printf(failed to open partition\n);
 + return NULL;
 + }
 +
 + ret = cdev_read(cdev, header, ARM_HEAD_SIZE, 0, 0);
 + cdev_close(cdev);
 +
 + if (ret != ARM_HEAD_SIZE) {
 + printf(failed to read from partition\n);
 + return NULL;
 + }
 +
 + return header;
 +}
 +
 +unsigned int get_image_size(void *head)
 +{
 + unsigned int ret = 0;
 + unsigned int *psize = head + ARM_HEAD_SIZE_OFFSET;
 +
 + if (is_barebox_arm_head(head))
 + ret = *psize;
 + debug(Detected barebox image size %u\n, ret);
 +
 + return ret;
 +}
 +
 +void *omap_xload_boot_nand(int offset)
 +{
 + int ret;
 + int size;
 + void *to, *header;
   struct cdev *cdev;
  
 - devfs_add_partition(nand0, offset, size, DEVFS_PARTITION_FIXED, x);
 + devfs_add_partition(nand0, offset, SZ_1M, DEVFS_PARTITION_FIXED, x);
I'd map 8M so can boot a kernel directly too

Best Regards,
J.

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Eric Bénard
Le Thu, 6 Sep 2012 15:48:30 +0300,
Alex Gershgorin al...@meprolight.com a écrit :

 Without this patch I get following messages
 
 Board: Freescale MX35 3Stack   
 NAND type unknown: ec,d7
 No NAND device found (-19)!
 
what is the part number of the NAND ?

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] PCM049: nand_bootstrap add shebang

2012-09-06 Thread Jan Weitzel

Signed-off-by: Jan Weitzel j.weit...@phytec.de
---
 arch/arm/boards/pcm049/env/bin/nand_bootstrap |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boards/pcm049/env/bin/nand_bootstrap 
b/arch/arm/boards/pcm049/env/bin/nand_bootstrap
index f8873fa..49e38dc 100644
--- a/arch/arm/boards/pcm049/env/bin/nand_bootstrap
+++ b/arch/arm/boards/pcm049/env/bin/nand_bootstrap
@@ -1,4 +1,4 @@
-
+#!/bin/sh
 echo copying barebox to nand...
 
 mci0.probe=1
-- 
1.7.0.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 03:48:30PM +0300, Alex Gershgorin wrote:
 Without this patch I get following messages
 
 Board: Freescale MX35 3Stack   
 NAND type unknown: ec,d7
 No NAND device found (-19)!

Please replace the subject with something like:

mtd nand: Add blachip to flash ids

Having 'i.mx35pdk' seems to imply this affects only i.MX users.

Sascha

 
 Signed-off-by: Alex Gershgorin al...@meprolight.com
 ---
  drivers/mtd/nand/nand_ids.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
 index cb53fc6..5f184bd 100644
 --- a/drivers/mtd/nand/nand_ids.c
 +++ b/drivers/mtd/nand/nand_ids.c
 @@ -103,6 +103,7 @@ struct nand_flash_dev nand_flash_ids[] = {
   /* 4 Gigabit */
   {__NANDSTR(NAND 512MiB 1,8V 8-bit),   0xAC, 0, 512, 0, LP_OPTIONS},
   {__NANDSTR(NAND 512MiB 3,3V 8-bit),   0xDC, 0, 512, 0, LP_OPTIONS},
 + {__NANDSTR(NAND 512MiB 3,3V 8-bit),   0xD7, 0, 512, 0, LP_OPTIONS},
   {__NANDSTR(NAND 512MiB 1,8V 16-bit),  0xBC, 0, 512, 0, LP_OPTIONS16},
   {__NANDSTR(NAND 512MiB 3,3V 16-bit),  0xCC, 0, 512, 0, LP_OPTIONS16},
  
 -- 
 1.7.0.4
 
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] [RFC] fec: fix calculation of mii bus speed on mxs

2012-09-06 Thread Uwe Kleine-König
According to a comment in Linux' fec driver, i.MX28 uses the same
formula for determination of the frequency divider as i.MX6, that is
(different from the i.MX28 manual):

parent clock / ((MII_SPEED + 1) * 2)

instead of

parent clock / (MII_SPEED * 2)

on the older i.MX SoCs. Fix the calculation accordingly.

Signed-off-by: Uwe Kleine-König u.kleine-koe...@pengutronix.de
--
But note that this doesn't fix accessing the phy on my machine. The
calculated value is 9 (with and without this patch btw) but accessing
the phy only gets reliable with a value of =20 or alternatively don't
set the SPEED value before reading and writing a mii register but only
on probe.

The Freescale kernel 2.6.35_10.12.01 does the following instead (in
fec_switch.c):

fep-phy_speed = DIV_ROUND_UP(clk_get_rate(fep-clk), 500)  1;
#ifdef CONFIG_ARCH_MXS
/* Can't get phy(8720) ID when set to 2.5M on MX28, lower it */
fep-phy_speed = 2;
#endif

which would result in 40 (and is unaware of the changed formula).

I didn't have an opportunity to check the signals with an oszilloscope, but
intend to fetch that later.
---
 drivers/net/fec_imx.c |   48 ++--
 1 file changed, 38 insertions(+), 10 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 599a9b4..969c903 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -47,6 +47,41 @@ struct fec_frame {
uint8_t head[16];   /* MAC header(6 + 6 + 2) + 2(aligned) */
 };
 
+static void fec_miidev_setspeed(struct fec_priv *fec)
+{
+   u32 mii_speed;
+
+   mii_speed = DIV_ROUND_UP(imx_get_fecclk(), 500);
+
+#ifdef CONFIG_ARCH_MXS
+   /*
+* Compared to the other imx socs imx28 and imx6 have an additional +1
+* in the formula for MII_SPEED. In MCIMX28RM Rev.1, 2010 this is not
+* documented though.
+*/
+   mii_speed -= 1;
+#endif
+   if (!mii_speed)
+   /* Can this happen? */
+   mii_speed = 1;
+   if (mii_speed  0x3f) {
+   static int once = 0;
+   if (!once)
+   printf(Warning: fec clk too high to get mii clk\n);
+   mii_speed = 0x3f;
+   }
+
+   /*
+* XXX: some SoCs (at least i.MX28 and i.MX6, but not .iMX27) have an
+* bitfield in ENET_MSCR (aka MII_SPEED) called HOLDTIME that needs to
+* be 0 for imx_get_fecclk()  100 MHz.
+*/
+
+   writel(mii_speed  1, fec-regs + FEC_MII_SPEED);
+
+   return 0;
+}
+
 /*
  * MII-interface related functions
  */
@@ -59,8 +94,7 @@ static int fec_miidev_read(struct mii_device *mdev, int 
phyAddr, int regAddr)
uint32_t phy;   /* convenient holder for the PHY */
uint64_t start;
 
-   writel(((imx_get_fecclk()  20) / 5)  1,
-   fec-regs + FEC_MII_SPEED);
+   fec_miidev_setspeed(fec);
/*
 * reading from any PHY's register is done by properly
 * programming the FEC's MII data register.
@@ -103,8 +137,7 @@ static int fec_miidev_write(struct mii_device *mdev, int 
phyAddr,
uint32_t phy;   /* convenient holder for the PHY */
uint64_t start;
 
-   writel(((imx_get_fecclk()  20) / 5)  1,
-   fec-regs + FEC_MII_SPEED);
+   fec_miidev_setspeed(fec);
 
reg = regAddr  FEC_MII_DATA_RA_SHIFT;
phy = phyAddr  FEC_MII_DATA_PA_SHIFT;
@@ -292,12 +325,7 @@ static int fec_init(struct eth_device *dev)
rcntl = FEC_R_CNTRL_MAX_FL(1518);
if (fec-xcv_type != SEVENWIRE) {
rcntl |= FEC_R_CNTRL_MII_MODE;
-   /*
-* Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
-* and do not drop the Preamble.
-*/
-   writel(((imx_get_fecclk()  20) / 5)  1,
-   fec-regs + FEC_MII_SPEED);
+   fec_miidev_setspeed(fec);
}
 
if (fec-xcv_type == RMII) {
-- 
1.7.10.4


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Eric Bénard
Hi Alex,

Le Thu, 6 Sep 2012 16:39:33 +0300,
Alex Gershgorin al...@meprolight.com a écrit :
  Without this patch I get following messages
 
  Board: Freescale MX35 3Stack
  NAND type unknown: ec,d7
  No NAND device found (-19)!
 
 what is the part number of the NAND ?
 
 If I'm not mistaken
  K9LBG08U0D-PCB0
  
this seems to be a 4GiB flash with 4k page + 218 OOB, not a 512MiB

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


RE: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Alex Gershgorin
Hi Sascha,

Thanks for your comments.
 
On Thu, Sep 06, 2012 at 03:48:30PM +0300, Alex Gershgorin wrote:
 Without this patch I get following messages

 Board: Freescale MX35 3Stack
 NAND type unknown: ec,d7
 No NAND device found (-19)!

 Please replace the subject with something like:

 mtd nand: Add blachip to flash ids

 Having 'i.mx35pdk' seems to imply this affects only i.MX users.

You are absolutely right, I will correct it. 

Regards,
Alex


 Signed-off-by: Alex Gershgorin al...@meprolight.com
 ---
  drivers/mtd/nand/nand_ids.c |1 +
  1 files changed, 1 insertions(+), 0 deletions(-)

 diff --git a/drivers/mtd/nand/nand_ids.c b/drivers/mtd/nand/nand_ids.c
 index cb53fc6..5f184bd 100644
 --- a/drivers/mtd/nand/nand_ids.c
 +++ b/drivers/mtd/nand/nand_ids.c
 @@ -103,6 +103,7 @@ struct nand_flash_dev nand_flash_ids[] = {
   /* 4 Gigabit */
   {__NANDSTR(NAND 512MiB 1,8V 8-bit),   0xAC, 0, 512, 0, LP_OPTIONS},
   {__NANDSTR(NAND 512MiB 3,3V 8-bit),   0xDC, 0, 512, 0, LP_OPTIONS},
 + {__NANDSTR(NAND 512MiB 3,3V 8-bit),   0xD7, 0, 512, 0, LP_OPTIONS},
   {__NANDSTR(NAND 512MiB 1,8V 16-bit),  0xBC, 0, 512, 0, LP_OPTIONS16},
   {__NANDSTR(NAND 512MiB 3,3V 16-bit),  0xCC, 0, 512, 0, LP_OPTIONS16},

 --
 1.7.0.4



--
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH] drivers/net: add driver for the EMAC device found in some TI SoCs

2012-09-06 Thread Jan Luebbe
Signed-off-by: Jan Luebbe j...@pengutronix.de
---
 arch/arm/mach-omap/include/mach/emac_defs.h |   48 +++
 drivers/net/Kconfig |5 +
 drivers/net/Makefile|1 +
 drivers/net/davinci_emac.c  |  618 +++
 drivers/net/davinci_emac.h  |  289 +
 5 files changed, 961 insertions(+)
 create mode 100644 arch/arm/mach-omap/include/mach/emac_defs.h
 create mode 100644 drivers/net/davinci_emac.c
 create mode 100644 drivers/net/davinci_emac.h

diff --git a/arch/arm/mach-omap/include/mach/emac_defs.h 
b/arch/arm/mach-omap/include/mach/emac_defs.h
new file mode 100644
index 000..568de6a
--- /dev/null
+++ b/arch/arm/mach-omap/include/mach/emac_defs.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
+ *
+ * Based on:
+ *
+ * 
+ *
+ * dm644x_emac.h
+ *
+ * TI DaVinci (DM644X) EMAC peripheral driver header for DV-EVM
+ *
+ * Copyright (C) 2005 Texas Instruments.
+ *
+ * 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * 
+
+ * Modifications:
+ * ver. 1.0: Sep 2005, TI PSP Team - Created EMAC version for uBoot.
+ *
+ */
+
+#ifndef _AM3517_EMAC_H_
+#define _AM3517_EMAC_H_
+
+#define EMAC_BASE_ADDR 0x5C01
+#define EMAC_WRAPPER_BASE_ADDR 0x5C00
+#define EMAC_WRAPPER_RAM_ADDR  0x5C02
+#define EMAC_MDIO_BASE_ADDR0x5C03
+#define EMAC_HW_RAM_ADDR   0x01E2
+
+#define EMAC_MDIO_BUS_FREQ 16600   /* 166 MHZ check */
+#define EMAC_MDIO_CLOCK_FREQ   100 /* 2.0 MHz */
+
+#endif  /* _AM3517_EMAC_H_ */
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index dac1eb9..bfde54b 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -43,6 +43,11 @@ config DRIVER_NET_SMC9
  This option enables support for the SMSC LAN91C111
  ethernet chip.
 
+config DRIVER_NET_DAVINCI_EMAC
+   bool TI Davinci/OMAP EMAC ethernet driver
+   depends on ARCH_DAVINCI || ARCH_OMAP3
+   select MIIDEV
+
 config DRIVER_NET_DM9K
bool Davicom dm9k[E|A|B] ethernet driver
depends on HAS_DM9000
diff --git a/drivers/net/Makefile b/drivers/net/Makefile
index 951a220..52611f8 100644
--- a/drivers/net/Makefile
+++ b/drivers/net/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_DRIVER_NET_CS8900)+= cs8900.o
 obj-$(CONFIG_DRIVER_NET_SMC911X)   += smc911x.o
 obj-$(CONFIG_DRIVER_NET_SMC9)  += smc9.o
+obj-$(CONFIG_DRIVER_NET_DAVINCI_EMAC)  += davinci_emac.o
 obj-$(CONFIG_DRIVER_NET_DM9K)  += dm9k.o
 obj-$(CONFIG_DRIVER_NET_NETX)  += netx_eth.o
 obj-$(CONFIG_DRIVER_NET_AT91_ETHER)+= at91_ether.o
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
new file mode 100644
index 000..09fcb63
--- /dev/null
+++ b/drivers/net/davinci_emac.c
@@ -0,0 +1,618 @@
+/*
+ * Copyright (C) 2012 Jan Luebbe j.lue...@pengutronix.de
+ *
+ * Ethernet driver for TI TMS320DM644x (DaVinci) chips.
+ *
+ * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
+ *
+ * Parts shamelessly stolen from TI's dm644x_emac.c. Original copyright
+ * follows:
+ *
+ * 
+ *
+ * dm644x_emac.c
+ *
+ * TI DaVinci (DM644X) EMAC peripheral driver source for DV-EVM
+ *
+ * Copyright (C) 2005 Texas Instruments.
+ *
+ * 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if 

RE: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Alex Gershgorin
 
  Hi Alex,

Le Thu, 6 Sep 2012 16:39:33 +0300,
Alex Gershgorin al...@meprolight.com a écrit :
  Without this patch I get following messages
 
  Board: Freescale MX35 3Stack
  NAND type unknown: ec,d7
  No NAND device found (-19)!
 
 what is the part number of the NAND ?

 If I'm not mistaken
  K9LBG08U0D-PCB0

   this seems to be a 4GiB flash with 4k page + 218 OOB, not a 512MiB

If I understand correctly it should look like

{__NANDSTR(NAND 4GiB 3,3V 8-bit), 0xD7, 0, 2048, 0, LP_OPTIONS}


Right?
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


RE: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Alex Gershgorin



From: Alex Gershgorin
Sent: Thursday, September 06, 2012 5:20 PM
To: Eric Bénard
Cc: Sascha Hauer; barebox@lists.infradead.org
Subject: RE: [PATCH] i.mx35pdk add nand identification

  Hi Alex,

Le Thu, 6 Sep 2012 16:39:33 +0300,
Alex Gershgorin al...@meprolight.com a écrit :
  Without this patch I get following messages
 
  Board: Freescale MX35 3Stack
  NAND type unknown: ec,d7
  No NAND device found (-19)!
 
 what is the part number of the NAND ?

 If I'm not mistaken
  K9LBG08U0D-PCB0

   this seems to be a 4GiB flash with 4k page + 218 OOB, not a 512MiB

Sorry my mistake in the previous mail :-(

{__NANDSTR(NAND 4GiB 3,3V 8-bit), 0xD7, 0, 4096, 0, LP_OPTIONS}


Right?
___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] i.mx35pdk add nand identification

2012-09-06 Thread Eric Bénard
Hi,

Le Thu, 6 Sep 2012 17:20:41 +0300,
Alex Gershgorin al...@meprolight.com a écrit :

  
   Hi Alex,
 
 Le Thu, 6 Sep 2012 16:39:33 +0300,
 Alex Gershgorin al...@meprolight.com a écrit :
   Without this patch I get following messages
  
   Board: Freescale MX35 3Stack
   NAND type unknown: ec,d7
   No NAND device found (-19)!
  
  what is the part number of the NAND ?
 
  If I'm not mistaken
   K9LBG08U0D-PCB0
 
this seems to be a 4GiB flash with 4k page + 218 OOB, not a 512MiB
 
 If I understand correctly it should look like
 
 {__NANDSTR(NAND 4GiB 3,3V 8-bit), 0xD7, 0, 2048, 0, LP_OPTIONS}
 
 
 Right?
no 2048 means 2k page, this nand has 4k page.

kernel has :
{NAND 4GiB 3,3V 8-bit,0xD7, 0, 4096, 0, LP_OPTIONS},

which should be the right configuration.

Eric

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] drivers/net: add driver for the EMAC device found in some TI SoCs

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 16:10 Thu 06 Sep , Jan Luebbe wrote:
 Signed-off-by: Jan Luebbe j...@pengutronix.de
 ---
  arch/arm/mach-omap/include/mach/emac_defs.h |   48 +++
  drivers/net/Kconfig |5 +
  drivers/net/Makefile|1 +
  drivers/net/davinci_emac.c  |  618 
 +++
  drivers/net/davinci_emac.h  |  289 +
  5 files changed, 961 insertions(+)
  create mode 100644 arch/arm/mach-omap/include/mach/emac_defs.h
  create mode 100644 drivers/net/davinci_emac.c
  create mode 100644 drivers/net/davinci_emac.h
finally we can read the driver tks
 
 diff --git a/arch/arm/mach-omap/include/mach/emac_defs.h 
 b/arch/arm/mach-omap/include/mach/emac_defs.h
 new file mode 100644
 index 000..568de6a
 --- /dev/null
 +++ b/arch/arm/mach-omap/include/mach/emac_defs.h
 @@ -0,0 +1,48 @@
 +/*
 + * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
 + *
 + * Based on:
 + *
 + * 
 
 + *
 + * dm644x_emac.h
 + *
 + * TI DaVinci (DM644X) EMAC peripheral driver header for DV-EVM
 + *
 + * Copyright (C) 2005 Texas Instruments.
 + *
 + * 
 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 + * 
 
 +
 + * Modifications:
 + * ver. 1.0: Sep 2005, TI PSP Team - Created EMAC version for uBoot.
 + *
 + */
 +
 +#ifndef _AM3517_EMAC_H_
 +#define _AM3517_EMAC_H_
 +
 +#define EMAC_BASE_ADDR 0x5C01
 +#define EMAC_WRAPPER_BASE_ADDR 0x5C00
 +#define EMAC_WRAPPER_RAM_ADDR  0x5C02
 +#define EMAC_MDIO_BASE_ADDR0x5C03
 +#define EMAC_HW_RAM_ADDR   0x01E2
 +
 +#define EMAC_MDIO_BUS_FREQ 16600   /* 166 MHZ check */
 +#define EMAC_MDIO_CLOCK_FREQ   100 /* 2.0 MHz */
no with the driver as it's mach specific
 +
 +#endif  /* _AM3517_EMAC_H_ */
 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
 index dac1eb9..bfde54b 100644
 --- a/drivers/net/Kconfig
 +++ b/drivers/net/Kconfig
 @@ -43,6 +43,11 @@ config DRIVER_NET_SMC9
 This option enables support for the SMSC LAN91C111
 ethernet chip.
  
 +config DRIVER_NET_DAVINCI_EMAC
 + bool TI Davinci/OMAP EMAC ethernet driver
 + depends on ARCH_DAVINCI || ARCH_OMAP3
 + select MIIDEV
 +
  config DRIVER_NET_DM9K
   bool Davicom dm9k[E|A|B] ethernet driver
   depends on HAS_DM9000
 diff --git a/drivers/net/Makefile b/drivers/net/Makefile
 index 951a220..52611f8 100644
 --- a/drivers/net/Makefile
 +++ b/drivers/net/Makefile
 @@ -1,6 +1,7 @@
  obj-$(CONFIG_DRIVER_NET_CS8900)  += cs8900.o
  obj-$(CONFIG_DRIVER_NET_SMC911X) += smc911x.o
  obj-$(CONFIG_DRIVER_NET_SMC9)+= smc9.o
 +obj-$(CONFIG_DRIVER_NET_DAVINCI_EMAC)+= davinci_emac.o
  obj-$(CONFIG_DRIVER_NET_DM9K)+= dm9k.o
  obj-$(CONFIG_DRIVER_NET_NETX)+= netx_eth.o
  obj-$(CONFIG_DRIVER_NET_AT91_ETHER)  += at91_ether.o
 diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
 new file mode 100644
 index 000..09fcb63
 --- /dev/null
 +++ b/drivers/net/davinci_emac.c
 @@ -0,0 +1,618 @@
 +/*
 + * Copyright (C) 2012 Jan Luebbe j.lue...@pengutronix.de
 + *
 + * Ethernet driver for TI TMS320DM644x (DaVinci) chips.
 + *
 + * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
 + *
 + * Parts shamelessly stolen from TI's dm644x_emac.c. Original copyright
 + * follows:
 + *
 + * 
 
 + *
 + * dm644x_emac.c
 + *
 + * TI DaVinci (DM644X) EMAC peripheral driver source for DV-EVM
 + *
 + * Copyright (C) 2005 Texas Instruments.
 + *
 + * 
 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; 

Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Sascha Hauer
The discussion in this thread makes it clear that there are two problems
with this logo, one technical and one political.

The technical problem:

From a technical pov it makes no sense to put big image binaries into
the repository when a small svg image would be sufficient to generate
all other images.

The political problem:

For an open source project a closed image is a no go. We (and by we I
mean we as the community, not we as Pengutronix) must for example be
able to:

- generate versions with different colors, sizes, dimensions
- generate a logo without text
- modify the image and to redistribute without limitations
- add a journal to the logo and use it for bwn.org (barebox weekly news) ;)

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 1/2] kbuild: keep the barebox binary accessible

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 12:20:15PM +0200, Jan Luebbe wrote:
 When building a special image  from the original (compressed or
 not) binary, to not overwrite KBUILD_BINARY.
 
 This allows producing multiple images (such as MLO, UBL, ...)
 from the (z)barebox.bin. In the case where no special image is
 used, KBUILD_IMAGE is set to KBUILD_BINARY.
 
 This patch was developed together with Sascha Hauer. Thanks!
 
 Signed-off-by: Jan Luebbe j...@pengutronix.de

Applied (only this one for now), thanks

Sascha

 ---
  Makefile  |   16 +++-
  arch/arm/Makefile |   10 +-
  2 files changed, 16 insertions(+), 10 deletions(-)
 
 diff --git a/Makefile b/Makefile
 index c6264d3..0f1a319 100644
 --- a/Makefile
 +++ b/Makefile
 @@ -462,12 +462,18 @@ CFLAGS += $(call 
 cc-option,-Wdeclaration-after-statement,)
  # disable pointer signed / unsigned warnings in gcc 4.0
  CFLAGS += $(call cc-option,-Wno-pointer-sign,)
  
 -# Default kernel image to build when no specific target is given.
 -# KBUILD_IMAGE may be overruled on the command line or
 -# set in the environment
 -# Also any assignments in arch/$(ARCH)/Makefile take precedence over
 -# this default value
 +# KBUILD_IMAGE: Default barebox image to build
 +# Depending on the architecture, this can be either compressed or not.
 +# It will also include any necessary headers to be bootable.
  export KBUILD_IMAGE ?= barebox.bin
 +# KBUILD_BINARY: Raw barebox binary
 +# This variable is set in case the architecture prepends a header and
 +# points to a binary that can be loaded directly into RAM and executed.
 +export KBUILD_BINARY ?= barebox.bin
 +# KBUILD_IMAGE and _BINARY may be overruled on the command line or
 +# set in the environment.
 +# Also any assignments in arch/$(ARCH)/Makefile take precedence over
 +# the default value.
  
  barebox-flash-image: $(KBUILD_IMAGE)
   $(call if_changed,ln)
 diff --git a/arch/arm/Makefile b/arch/arm/Makefile
 index 8e660be..94ee073 100644
 --- a/arch/arm/Makefile
 +++ b/arch/arm/Makefile
 @@ -179,7 +179,7 @@ barebox.netx: $(KBUILD_BINARY)
  
  ifeq ($(machine-y),netx)
  KBUILD_TARGET := barebox.netx
 -KBUILD_BINARY := $(KBUILD_TARGET)
 +KBUILD_IMAGE := barebox.netx
  endif
  
  barebox.s5p: $(KBUILD_BINARY)
 @@ -187,7 +187,7 @@ barebox.s5p: $(KBUILD_BINARY)
  
  ifeq ($(CONFIG_ARCH_S5PCxx),y)
  KBUILD_TARGET := barebox.s5p
 -KBUILD_BINARY := $(KBUILD_TARGET)
 +KBUILD_IMAGE := barebox.s5p
  endif
  
  quiet_cmd_mlo ?= IFT $@
 @@ -199,7 +199,7 @@ MLO: $(KBUILD_BINARY)
  
  ifeq ($(CONFIG_OMAP_BUILD_IFT),y)
  KBUILD_TARGET := MLO
 -KBUILD_BINARY := $(KBUILD_TARGET)
 +KBUILD_IMAGE := MLO
  endif
  
  barebox.ubl: $(KBUILD_BINARY)
 @@ -209,7 +209,7 @@ barebox.ubl: $(KBUILD_BINARY)
  
  ifeq ($(CONFIG_ARCH_DAVINCI),y)
  KBUILD_TARGET := barebox.ubl
 -KBUILD_BINARY := $(KBUILD_TARGET)
 +KBUILD_IMAGE := barebox.ubl
  endif
  
  pbl := arch/arm/pbl
 @@ -219,7 +219,7 @@ zbarebox.S zbarebox.bin zbarebox: barebox.bin
  archclean:
   $(MAKE) $(clean)=$(pbl)
  
 -KBUILD_IMAGE := $(KBUILD_BINARY)
 +KBUILD_IMAGE ?= $(KBUILD_BINARY)
  
  archprepare: maketools
  maketools:
 -- 
 1.7.10.4
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox
 

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH] drivers/net: add driver for the EMAC device found in some TI SoCs

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 04:10:21PM +0200, Jan Luebbe wrote:
 Signed-off-by: Jan Luebbe j...@pengutronix.de

Applied, thanks

Sascha

 ---
  arch/arm/mach-omap/include/mach/emac_defs.h |   48 +++
  drivers/net/Kconfig |5 +
  drivers/net/Makefile|1 +
  drivers/net/davinci_emac.c  |  618 
 +++
  drivers/net/davinci_emac.h  |  289 +
  5 files changed, 961 insertions(+)
  create mode 100644 arch/arm/mach-omap/include/mach/emac_defs.h
  create mode 100644 drivers/net/davinci_emac.c
  create mode 100644 drivers/net/davinci_emac.h
 
 diff --git a/arch/arm/mach-omap/include/mach/emac_defs.h 
 b/arch/arm/mach-omap/include/mach/emac_defs.h
 new file mode 100644
 index 000..568de6a
 --- /dev/null
 +++ b/arch/arm/mach-omap/include/mach/emac_defs.h
 @@ -0,0 +1,48 @@
 +/*
 + * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
 + *
 + * Based on:
 + *
 + * 
 
 + *
 + * dm644x_emac.h
 + *
 + * TI DaVinci (DM644X) EMAC peripheral driver header for DV-EVM
 + *
 + * Copyright (C) 2005 Texas Instruments.
 + *
 + * 
 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + *  You should have received a copy of the GNU General Public License
 + *  along with this program; if not, write to the Free Software
 + *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 + * 
 
 +
 + * Modifications:
 + * ver. 1.0: Sep 2005, TI PSP Team - Created EMAC version for uBoot.
 + *
 + */
 +
 +#ifndef _AM3517_EMAC_H_
 +#define _AM3517_EMAC_H_
 +
 +#define EMAC_BASE_ADDR 0x5C01
 +#define EMAC_WRAPPER_BASE_ADDR 0x5C00
 +#define EMAC_WRAPPER_RAM_ADDR  0x5C02
 +#define EMAC_MDIO_BASE_ADDR0x5C03
 +#define EMAC_HW_RAM_ADDR   0x01E2
 +
 +#define EMAC_MDIO_BUS_FREQ 16600   /* 166 MHZ check */
 +#define EMAC_MDIO_CLOCK_FREQ   100 /* 2.0 MHz */
 +
 +#endif  /* _AM3517_EMAC_H_ */
 diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
 index dac1eb9..bfde54b 100644
 --- a/drivers/net/Kconfig
 +++ b/drivers/net/Kconfig
 @@ -43,6 +43,11 @@ config DRIVER_NET_SMC9
 This option enables support for the SMSC LAN91C111
 ethernet chip.
  
 +config DRIVER_NET_DAVINCI_EMAC
 + bool TI Davinci/OMAP EMAC ethernet driver
 + depends on ARCH_DAVINCI || ARCH_OMAP3
 + select MIIDEV
 +
  config DRIVER_NET_DM9K
   bool Davicom dm9k[E|A|B] ethernet driver
   depends on HAS_DM9000
 diff --git a/drivers/net/Makefile b/drivers/net/Makefile
 index 951a220..52611f8 100644
 --- a/drivers/net/Makefile
 +++ b/drivers/net/Makefile
 @@ -1,6 +1,7 @@
  obj-$(CONFIG_DRIVER_NET_CS8900)  += cs8900.o
  obj-$(CONFIG_DRIVER_NET_SMC911X) += smc911x.o
  obj-$(CONFIG_DRIVER_NET_SMC9)+= smc9.o
 +obj-$(CONFIG_DRIVER_NET_DAVINCI_EMAC)+= davinci_emac.o
  obj-$(CONFIG_DRIVER_NET_DM9K)+= dm9k.o
  obj-$(CONFIG_DRIVER_NET_NETX)+= netx_eth.o
  obj-$(CONFIG_DRIVER_NET_AT91_ETHER)  += at91_ether.o
 diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
 new file mode 100644
 index 000..09fcb63
 --- /dev/null
 +++ b/drivers/net/davinci_emac.c
 @@ -0,0 +1,618 @@
 +/*
 + * Copyright (C) 2012 Jan Luebbe j.lue...@pengutronix.de
 + *
 + * Ethernet driver for TI TMS320DM644x (DaVinci) chips.
 + *
 + * Copyright (C) 2007 Sergey Kubushyn k...@koi8.net
 + *
 + * Parts shamelessly stolen from TI's dm644x_emac.c. Original copyright
 + * follows:
 + *
 + * 
 
 + *
 + * dm644x_emac.c
 + *
 + * TI DaVinci (DM644X) EMAC peripheral driver source for DV-EVM
 + *
 + * Copyright (C) 2005 Texas Instruments.
 + *
 + * 
 
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 

Re: [PATCH v5] xload: get barebox size from barebox_arm_head

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 02:41:11PM +0200, Jan Weitzel wrote:
 Add functions to read the barebox_arm_head, check barebox magicword
 and read out the barebox image size.
 Create a inital partion of 1Mb to access the barebox image on nand.
 
 Signed-off-by: Jan Weitzel j.weit...@phytec.de

Applied, thanks.

The current code explicitely checks for a barebox image, so no need to
increase the partition size. If someone wants to boot the kernel
directly here there's more work to do anyway.

Sascha


 ---
 v2: remove fall back if header read fail 
 v3: fix header check, rebase master 
 v4: factorize barebox detection
 v5: mv devines to include/filetype.h
 
  arch/arm/include/asm/barebox-arm-head.h |9 +
  arch/arm/mach-omap/include/mach/xload.h |2 +-
  arch/arm/mach-omap/xload.c  |   57 --
  common/filetype.c   |2 +-
  include/filetype.h  |   16 +
  4 files changed, 71 insertions(+), 6 deletions(-)
 
 diff --git a/arch/arm/mach-omap/include/mach/xload.h 
 b/arch/arm/mach-omap/include/mach/xload.h
 index 844b57f..26f1b68 100644
 --- a/arch/arm/mach-omap/include/mach/xload.h
 +++ b/arch/arm/mach-omap/include/mach/xload.h
 @@ -1,7 +1,7 @@
  #ifndef _MACH_XLOAD_H
  #define _MACH_XLOAD_H
  
 -void *omap_xload_boot_nand(int offset, int size);
 +void *omap_xload_boot_nand(int offset);
  void *omap_xload_boot_mmc(void);
  
  enum omap_boot_src {
 diff --git a/arch/arm/mach-omap/xload.c b/arch/arm/mach-omap/xload.c
 index 13024ab..0afeea9 100644
 --- a/arch/arm/mach-omap/xload.c
 +++ b/arch/arm/mach-omap/xload.c
 @@ -7,16 +7,65 @@
  #include fcntl.h
  #include mach/xload.h
  #include sizes.h
 +#include filetype.h
  
 -void *omap_xload_boot_nand(int offset, int size)
 +void *read_image_head(const char *name)
  {
 + void *header = xmalloc(ARM_HEAD_SIZE);
 + struct cdev *cdev;
   int ret;
 - void *to = xmalloc(size);
 +
 + cdev = cdev_open(name, O_RDONLY);
 + if (!cdev) {
 + printf(failed to open partition\n);
 + return NULL;
 + }
 +
 + ret = cdev_read(cdev, header, ARM_HEAD_SIZE, 0, 0);
 + cdev_close(cdev);
 +
 + if (ret != ARM_HEAD_SIZE) {
 + printf(failed to read from partition\n);
 + return NULL;
 + }
 +
 + return header;
 +}
 +
 +unsigned int get_image_size(void *head)
 +{
 + unsigned int ret = 0;
 + unsigned int *psize = head + ARM_HEAD_SIZE_OFFSET;
 +
 + if (is_barebox_arm_head(head))
 + ret = *psize;
 + debug(Detected barebox image size %u\n, ret);
 +
 + return ret;
 +}
 +
 +void *omap_xload_boot_nand(int offset)
 +{
 + int ret;
 + int size;
 + void *to, *header;
   struct cdev *cdev;
  
 - devfs_add_partition(nand0, offset, size, DEVFS_PARTITION_FIXED, x);
 + devfs_add_partition(nand0, offset, SZ_1M, DEVFS_PARTITION_FIXED, x);
   dev_add_bb_dev(x, bbx);
  
 + header = read_image_head(bbx);
 + if (header == NULL)
 + return NULL;
 +
 + size = get_image_size(header);
 + if (!size) {
 + printf(failed to get image size\n);
 + return NULL;
 + }
 +
 + to = xmalloc(size);
 +
   cdev = cdev_open(bbx, O_RDONLY);
   if (!cdev) {
   printf(failed to open nand\n);
 @@ -80,7 +129,7 @@ int run_shell(void)
   printf(unknown boot source. Fall back to nand\n);
   case OMAP_BOOTSRC_NAND:
   printf(booting from NAND\n);
 - func = omap_xload_boot_nand(SZ_128K, SZ_256K);
 + func = omap_xload_boot_nand(SZ_128K);
   break;
   }
  
 diff --git a/common/filetype.c b/common/filetype.c
 index e736d43..6306fdc 100644
 --- a/common/filetype.c
 +++ b/common/filetype.c
 @@ -75,7 +75,7 @@ enum filetype file_detect_type(void *_buf)
  
   if (strncmp(buf8, #!/bin/sh, 9) == 0)
   return filetype_sh;
 - if (buf[8] == 0x65726162  buf[9] == 0x00786f62)
 + if (is_barebox_arm_head(_buf))
   return filetype_arm_barebox;
   if (buf[9] == 0x016f2818 || buf[9] == 0x18286f01)
   return filetype_arm_zimage;
 diff --git a/include/filetype.h b/include/filetype.h
 index 179ec0f..6ac1c1c 100644
 --- a/include/filetype.h
 +++ b/include/filetype.h
 @@ -25,4 +25,20 @@ const char *file_type_to_string(enum filetype f);
  enum filetype file_detect_type(void *_buf);
  enum filetype file_name_detect_type(const char *filename);
  
 +#define ARM_HEAD_SIZE0x30
 +#define ARM_HEAD_MAGICWORD_OFFSET0x20
 +#define ARM_HEAD_SIZE_OFFSET 0x2C
 +
 +#ifdef CONFIG_ARM
 +static inline int is_barebox_arm_head(const char *head)
 +{
 + return !strcmp(head + ARM_HEAD_MAGICWORD_OFFSET, barebox);
 +}
 +#else
 +static inline int is_barebox_arm_head(const char *head)
 +{
 + return 0
 +}
 +#endif
 +
  #endif /* __FILE_TYPE_H */
 -- 
 1.7.0.4
 
 
 ___
 barebox 

[PATCH 1/3] fec: restart autoneg at open instead of init

2012-09-06 Thread Eric Bénard
this saves some time during boot when ethernet is not needed in barebox

Signed-off-by: Eric Bénard e...@eukrea.com
---
 drivers/net/fec_imx.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 599a9b4..2bc06a9 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -347,9 +347,6 @@ static int fec_init(struct eth_device *dev)
/* size of each buffer */
writel(FEC_MAX_PKT_SIZE, fec-regs + FEC_EMRBR);
 
-   if (fec-xcv_type != SEVENWIRE)
-   miidev_restart_aneg(fec-miidev);
-
return 0;
 }
 
@@ -363,6 +360,9 @@ static int fec_open(struct eth_device *edev)
int ret;
u32 ecr;
 
+   if (fec-xcv_type != SEVENWIRE)
+   miidev_restart_aneg(fec-miidev);
+
/*
 * Initialize RxBD/TxBD rings
 */
-- 
1.7.7.6


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 3/3] miidev: fix 1G wrong detection

2012-09-06 Thread Eric Bénard
since 99e72c8bbdbdc690025a5868d831f1fe79ad56fc on an i.MX51 based board,
I get : phy0: Link is up - 1000/Full. It seems miidev tries to probe
the PHY to early and gets 0x3 which leads to the wrong capabilities
setting.

Signed-off-by: Eric Bénard e...@eukrea.com
---
 drivers/net/miidev.c |   33 +
 1 files changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
index 75b53e3..e0f9d67 100644
--- a/drivers/net/miidev.c
+++ b/drivers/net/miidev.c
@@ -131,6 +131,14 @@ int miidev_get_status(struct mii_device *mdev)
 
status = ret  BMSR_LSTATUS ? MIIDEV_STATUS_IS_UP : 0;
 
+   if (ret  BMSR_ESTATEN) {
+   ret = mii_read(mdev, mdev-address, MII_ESTATUS);
+   if (ret  0)
+   goto err_out;
+   if (ret  (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
+   mdev-capabilities = MIIDEV_CAPABLE_1000M;
+   }
+
ret = mii_read(mdev, mdev-address, MII_BMCR);
if (ret  0)
goto err_out;
@@ -239,27 +247,8 @@ static struct file_operations miidev_ops = {
 static int miidev_probe(struct device_d *dev)
 {
struct mii_device *mdev = dev-priv;
-   int val;
-   int caps = 0;
 
-   val = mii_read(mdev, mdev-address, MII_PHYSID1);
-   if (val  0 || val == 0x)
-   goto err_out;
-   val = mii_read(mdev, mdev-address, MII_PHYSID2);
-   if (val  0 || val == 0x)
-   goto err_out;
-   val = mii_read(mdev, mdev-address, MII_BMSR);
-   if (val  0)
-   goto err_out;
-   if (val  BMSR_ESTATEN) {
-   val = mii_read(mdev, mdev-address, MII_ESTATUS);
-   if (val  0)
-   goto err_out;
-   if (val  (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
-   caps = MIIDEV_CAPABLE_1000M;
-   }
-
-   mdev-capabilities = caps;
+   mdev-capabilities = 0;
mdev-cdev.name = asprintf(phy%d, dev-id);
mdev-cdev.size = 64;
mdev-cdev.ops = miidev_ops;
@@ -268,10 +257,6 @@ static int miidev_probe(struct device_d *dev)
devfs_create(mdev-cdev);
list_add_tail(mdev-list, miidev_list);
return 0;
-
-err_out:
-   dev_err(dev, cannot read PHY registers (addr %d)\n, mdev-address);
-   return -ENODEV;
 }
 
 static void miidev_remove(struct device_d *dev)
-- 
1.7.7.6


___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


[PATCH 2/3] i.MX51: unbreak FEC iomux

2012-09-06 Thread Eric Bénard
in commit 2bdc9f57a86dff41cfc1f87b644a2e53fdcce2b6 the iomux was synced
with the kernel but this leads to some changes in the PAD_CTRL of some
FEC pins leading to a non working FEC on our cpuimx51 board.

This patch set back the PAD_CTRL of the missing pins to the initial
value.

Signed-off-by: Eric Bénard e...@eukrea.com
---
 arch/arm/mach-imx/include/mach/iomux-mx51.h |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-imx/include/mach/iomux-mx51.h 
b/arch/arm/mach-imx/include/mach/iomux-mx51.h
index 36c8989..0252d41 100644
--- a/arch/arm/mach-imx/include/mach/iomux-mx51.h
+++ b/arch/arm/mach-imx/include/mach/iomux-mx51.h
@@ -649,20 +649,20 @@
 #define MX51_PAD_DI2_PIN2__DI2_PIN2IOMUX_PAD(0x74c, 0x344, 0, 
__NA_, 0, NO_PAD_CTRL)
 #define MX51_PAD_DI2_PIN2__FEC_MDC IOMUX_PAD(0x74c, 0x344, 2, 
__NA_, 0, MX51_PAD_CTRL_5)
 #define MX51_PAD_DI2_PIN3__DI2_PIN3IOMUX_PAD(0x750, 0x348, 0, 
__NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DI2_PIN3__FEC_MDIOIOMUX_PAD(0x750, 0x348, 2, 
0x954, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI2_PIN3__FEC_MDIOIOMUX_PAD(0x750, 0x348, 2, 
0x954, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLKIOMUX_PAD(0x754, 0x34c, 0, 
__NA_, 0, NO_PAD_CTRL)
 #define MX51_PAD_DI2_DISP_CLK__FEC_RDATA1  IOMUX_PAD(0x754, 0x34c, 2, 
0x95c, 1, NO_PAD_CTRL)
 #define MX51_PAD_DI_GP4__DI2_PIN15 IOMUX_PAD(0x758, 0x350, 4, 
__NA_, 0, NO_PAD_CTRL)
 #define MX51_PAD_DI_GP4__DISP1_SER_DIN IOMUX_PAD(0x758, 0x350, 0, 
0x9c0, 1, NO_PAD_CTRL)
 #define MX51_PAD_DI_GP4__DISP2_PIN1IOMUX_PAD(0x758, 0x350, 3, 
__NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DI_GP4__FEC_RDATA2IOMUX_PAD(0x758, 0x350, 2, 
0x960, 1, NO_PAD_CTRL)
+#define MX51_PAD_DI_GP4__FEC_RDATA2IOMUX_PAD(0x758, 0x350, 2, 
0x960, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT0__DISP2_DAT0IOMUX_PAD(0x75c, 0x354, 
0, __NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DISP2_DAT0__FEC_RDATA3IOMUX_PAD(0x75c, 0x354, 
2, 0x964, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT0__FEC_RDATA3IOMUX_PAD(0x75c, 0x354, 
2, 0x964, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT0__KEY_COL6  IOMUX_PAD(0x75c, 0x354, 4, 
0x9c8, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT0__UART3_RXD IOMUX_PAD(0x75c, 0x354, 5, 
0x9f4, 8, MX51_UART_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT0__USBH3_CLK IOMUX_PAD(0x75c, 0x354, 3, 
0x9f8, 1, MX51_UART_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT1__DISP2_DAT1IOMUX_PAD(0x760, 0x358, 
0, __NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DISP2_DAT1__FEC_RX_ER IOMUX_PAD(0x760, 0x358, 2, 
0x970, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT1__FEC_RX_ER IOMUX_PAD(0x760, 0x358, 2, 
0x970, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT1__KEY_COL7  IOMUX_PAD(0x760, 0x358, 4, 
0x9cc, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT1__UART3_TXD IOMUX_PAD(0x760, 0x358, 5, 
__NA_, 0, MX51_UART_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT1__USBH3_DIR IOMUX_PAD(0x760, 0x358, 3, 
0xa1c, 1, NO_PAD_CTRL)
@@ -692,17 +692,17 @@
 #define MX51_PAD_DISP2_DAT9__USBH3_DATA1   IOMUX_PAD(0x780, 0x378, 3, 
0xa00, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT10__DISP2_DAT10  IOMUX_PAD(0x784, 0x37c, 0, 
__NA_, 0, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT10__DISP2_SER_CS IOMUX_PAD(0x784, 0x37c, 5, 
__NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DISP2_DAT10__FEC_COL  IOMUX_PAD(0x784, 0x37c, 2, 
0x94c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT10__FEC_COL  IOMUX_PAD(0x784, 0x37c, 2, 
0x94c, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT10__KEY_ROW7 IOMUX_PAD(0x784, 0x37c, 4, 
0x9dc, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT10__USBH3_DATA2  IOMUX_PAD(0x784, 0x37c, 3, 
0xa04, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT11__AUD6_TXD IOMUX_PAD(0x788, 0x380, 4, 
0x8f0, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT11__DISP2_DAT11  IOMUX_PAD(0x788, 0x380, 0, 
__NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK   IOMUX_PAD(0x788, 0x380, 2, 
0x968, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT11__FEC_RX_CLK   IOMUX_PAD(0x788, 0x380, 2, 
0x968, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT11__GPIO1_10 IOMUX_PAD(0x788, 0x380, 7, 
__NA_, 0, MX51_GPIO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT11__USBH3_DATA3  IOMUX_PAD(0x788, 0x380, 3, 
0xa08, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT12__AUD6_RXD IOMUX_PAD(0x78c, 0x384, 4, 
0x8ec, 1, NO_PAD_CTRL)
 #define MX51_PAD_DISP2_DAT12__DISP2_DAT12  IOMUX_PAD(0x78c, 0x384, 0, 
__NA_, 0, NO_PAD_CTRL)
-#define MX51_PAD_DISP2_DAT12__FEC_RX_DVIOMUX_PAD(0x78c, 0x384, 
2, 0x96c, 1, NO_PAD_CTRL)
+#define MX51_PAD_DISP2_DAT12__FEC_RX_DVIOMUX_PAD(0x78c, 0x384, 
2, 0x96c, 1, MX51_PAD_CTRL_5)
 #define MX51_PAD_DISP2_DAT12__USBH3_DATA4  IOMUX_PAD(0x78c, 0x384, 3, 
0xa0c, 1, NO_PAD_CTRL)
 #define 

Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 18:03 Thu 06 Sep , Sascha Hauer wrote:
 The discussion in this thread makes it clear that there are two problems
 with this logo, one technical and one political.
 
 The technical problem:
 
 From a technical pov it makes no sense to put big image binaries into
 the repository when a small svg image would be sufficient to generate
 all other images.
 
 The political problem:
 
 For an open source project a closed image is a no go. We (and by we I
 mean we as the community, not we as Pengutronix) must for example be
 able to:
 
 - generate versions with different colors, sizes, dimensions
 - generate a logo without text
 - modify the image and to redistribute without limitations
 - add a journal to the logo and use it for bwn.org (barebox weekly news) ;)
As on Linux, Meego , Mozilla, Coreboot and others Logo are copyrighted and 
protected

This is a standard for project image protection

Modify the image means the image is not Barebox Logo
(Modify in the limit of the Licence)

This is the full meaning of the Copyright.

The redistribution are without limitation

Best Regards,
J.

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 3/3] miidev: fix 1G wrong detection

2012-09-06 Thread Jean-Christophe PLAGNIOL-VILLARD
On 21:39 Thu 06 Sep , Eric Bénard wrote:
 since 99e72c8bbdbdc690025a5868d831f1fe79ad56fc on an i.MX51 based board,
 I get : phy0: Link is up - 1000/Full. It seems miidev tries to probe
 the PHY to early and gets 0x3 which leads to the wrong capabilities
 setting.
 
 Signed-off-by: Eric Bénard e...@eukrea.com
Wait I going to drop this code instead of the phylib

Best Regards,
J.
 ---
  drivers/net/miidev.c |   33 +
  1 files changed, 9 insertions(+), 24 deletions(-)
 
 diff --git a/drivers/net/miidev.c b/drivers/net/miidev.c
 index 75b53e3..e0f9d67 100644
 --- a/drivers/net/miidev.c
 +++ b/drivers/net/miidev.c
 @@ -131,6 +131,14 @@ int miidev_get_status(struct mii_device *mdev)
  
   status = ret  BMSR_LSTATUS ? MIIDEV_STATUS_IS_UP : 0;
  
 + if (ret  BMSR_ESTATEN) {
 + ret = mii_read(mdev, mdev-address, MII_ESTATUS);
 + if (ret  0)
 + goto err_out;
 + if (ret  (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
 + mdev-capabilities = MIIDEV_CAPABLE_1000M;
 + }
 +
   ret = mii_read(mdev, mdev-address, MII_BMCR);
   if (ret  0)
   goto err_out;
 @@ -239,27 +247,8 @@ static struct file_operations miidev_ops = {
  static int miidev_probe(struct device_d *dev)
  {
   struct mii_device *mdev = dev-priv;
 - int val;
 - int caps = 0;
  
 - val = mii_read(mdev, mdev-address, MII_PHYSID1);
 - if (val  0 || val == 0x)
 - goto err_out;
 - val = mii_read(mdev, mdev-address, MII_PHYSID2);
 - if (val  0 || val == 0x)
 - goto err_out;
 - val = mii_read(mdev, mdev-address, MII_BMSR);
 - if (val  0)
 - goto err_out;
 - if (val  BMSR_ESTATEN) {
 - val = mii_read(mdev, mdev-address, MII_ESTATUS);
 - if (val  0)
 - goto err_out;
 - if (val  (ESTATUS_1000_TFULL | ESTATUS_1000_THALF))
 - caps = MIIDEV_CAPABLE_1000M;
 - }
 -
 - mdev-capabilities = caps;
 + mdev-capabilities = 0;
   mdev-cdev.name = asprintf(phy%d, dev-id);
   mdev-cdev.size = 64;
   mdev-cdev.ops = miidev_ops;
 @@ -268,10 +257,6 @@ static int miidev_probe(struct device_d *dev)
   devfs_create(mdev-cdev);
   list_add_tail(mdev-list, miidev_list);
   return 0;
 -
 -err_out:
 - dev_err(dev, cannot read PHY registers (addr %d)\n, mdev-address);
 - return -ENODEV;
  }
  
  static void miidev_remove(struct device_d *dev)
 -- 
 1.7.7.6
 
 
 ___
 barebox mailing list
 barebox@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/barebox

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


Re: [PATCH 00/12] add PNG support

2012-09-06 Thread Sascha Hauer
On Thu, Sep 06, 2012 at 11:50:50PM +0200, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
 On 18:03 Thu 06 Sep , Sascha Hauer wrote:
  The discussion in this thread makes it clear that there are two problems
  with this logo, one technical and one political.
  
  The technical problem:
  
  From a technical pov it makes no sense to put big image binaries into
  the repository when a small svg image would be sufficient to generate
  all other images.
  
  The political problem:
  
  For an open source project a closed image is a no go. We (and by we I
  mean we as the community, not we as Pengutronix) must for example be
  able to:
  
  - generate versions with different colors, sizes, dimensions
  - generate a logo without text
  - modify the image and to redistribute without limitations
  - add a journal to the logo and use it for bwn.org (barebox weekly news) ;)
 As on Linux, Meego , Mozilla, Coreboot and others Logo are copyrighted and 
 protected

From http://commons.wikimedia.org/wiki/File:Tux.svg:

| The copyright holder of this file allows anyone to use it for any
| purpose, provided that the copyright holder is properly attributed.
| Redistribution, derivative work, commercial use, and all other use is
| permitted.

So the Linux logo can explicitely be modified (derivative work)

You mentioned that:
 It's free to USE without modification for the Barebox Project
   

Whereas is coreboot we have (from http://www.coreboot.org/Logo):

| This logo or a modified version may be used by anyone to refer to the
| coreboot project

btw, the mentioned projects do not seem to have a problem with svg
files:

http://upload.wikimedia.org/wikipedia/commons/1/14/MeeGo_logo.svg
http://commons.wikimedia.org/wiki/File:Tux.svg
http://upload.wikimedia.org/wikipedia/en/7/74/Mozilla_Foundation_logo.svg
http://upload.wikimedia.org/wikipedia/de/e/ec/Coreboot_logo.svg

 
 This is a standard for project image protection
 
 Modify the image means the image is not Barebox Logo
 (Modify in the limit of the Licence)

Does this mean it can be modified or exactly the opposite?

Could you send a license text?

Thanks
 Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |

___
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox