Re: [PATCH] lseek: ensure errno is set on failure and return -1

2017-02-23 Thread Sascha Hauer
On Thu, Feb 23, 2017 at 10:28:41PM +0100, Uwe Kleine-König wrote:
> All error paths before calling the driver's lseek callback return -1 and
> set errno. Do the same if the callback returns an error.
> 
> Signed-off-by: Uwe Kleine-König 
> ---
>  fs/fs.c | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/fs.c b/fs/fs.c
> index 2b4659cfbb76..e7b696591433 100644
> --- a/fs/fs.c
> +++ b/fs/fs.c
> @@ -926,7 +926,13 @@ loff_t lseek(int fildes, loff_t offset, int whence)
>   goto out;
>   }
>  
> - return fsdrv->lseek(>fsdev->dev, f, pos);
> + pos = fsdrv->lseek(>fsdev->dev, f, pos);
> + if (pos < 0) {
> + errno = -pos;
> + return -1;
> + }

Before calling into the drivers lseek checks if the position is within
the bounds of the file. So when fsdrv->lseek() returns successfully then
the position must be the same that was passed in. I think we can just
let fsdrv->lseek() return an error code rather than the file position.

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] fbconsole: check cursor position before moving

2017-02-23 Thread Sascha Hauer
On Thu, Feb 23, 2017 at 06:20:21PM +0100, Bastian Stender wrote:
> Moving the cursor to x=2, y=2 with "\e[3;3H" on a 12x2 framebuffer
> console lead to a barebox crash while drawing the cursor. The cursor can
> only be moved to a valid position between (0,0) and (priv->cols,
> priv->rows) now.
> 
> Signed-off-by: Bastian Stender 
> ---
>  drivers/video/fbconsole.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
> index 64f7d7364e..3879741b2a 100644
> --- a/drivers/video/fbconsole.c
> +++ b/drivers/video/fbconsole.c
> @@ -264,10 +264,13 @@ static void fbc_parse_csi(struct fbc_priv *priv)
>   return;
>   case 'H':
>   video_invertchar(priv, priv->x, priv->y);
> +
>   pos = simple_strtoul(priv->csi, , 10);
> - priv->y = pos ? pos - 1 : 0;
> + priv->y = (pos && pos <= priv->rows + 1) ? pos - 1 : 0;
> +
>   pos = simple_strtoul(end + 1, NULL, 10);
> - priv->x = pos ? pos - 1 : 0;
> + priv->x = (pos && pos <= priv->cols + 1) ? pos - 1 : 0;
> +

When moving out of the screen shouldn't we place the cursor on the
bottom right corner of the screen? With this patch we move it to the top
left corner.

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] lib/fonts: add VGA8x8 font

2017-02-23 Thread Sascha Hauer
On Thu, Feb 23, 2017 at 06:03:21PM +0100, Bastian Stender wrote:
> Ported from Linux v4.10.
> 
> This font is ideal for displaying a framebuffer console on a small display.
> 
> Signed-off-by: Bastian Stender 

Applied, thanks

Sascha

> ---
>  lib/fonts/Kconfig|4 +
>  lib/fonts/Makefile   |1 +
>  lib/fonts/font_8x8.c | 2587 
> ++
>  3 files changed, 2592 insertions(+)
>  create mode 100644 lib/fonts/font_8x8.c
> 
> diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig
> index d23b283964..3cd8d7698b 100644
> --- a/lib/fonts/Kconfig
> +++ b/lib/fonts/Kconfig
> @@ -14,6 +14,9 @@ config FONT_8x16
> This is the "high resolution" font for the VGA frame buffer (the one
> provided by the VGA text console 80x25 mode).
>  
> +config FONT_8x8
> + bool "VGA 8x8 font"
> +
>  config FONT_7x14
>   bool "7x14 font"
>  
> @@ -27,6 +30,7 @@ config FONT_CUSTOM_16X
>  
>  config FONT_AUTOSELECT
>   def_bool y
> + depends on !FONT_MINI_8x8
>   depends on !FONT_MINI_4x6
>   depends on !FONT_7x14
>   select FONT_8x16
> diff --git a/lib/fonts/Makefile b/lib/fonts/Makefile
> index 98245b3d65..9e63ce6303 100644
> --- a/lib/fonts/Makefile
> +++ b/lib/fonts/Makefile
> @@ -3,6 +3,7 @@
>  font-objs := fonts.o
>  
>  font-objs-$(CONFIG_FONT_8x16)  += font_8x16.o
> +font-objs-$(CONFIG_FONT_8x8)   += font_8x8.o
>  font-objs-$(CONFIG_FONT_7x14)  += font_7x14.o
>  font-objs-$(CONFIG_FONT_MINI_4x6)  += font_mini_4x6.o
>  font-objs-$(CONFIG_FONT_CUSTOM_16X)+= font_custom_16x.o
> diff --git a/lib/fonts/font_8x8.c b/lib/fonts/font_8x8.c
> new file mode 100644
> index 00..24216a68a2
> --- /dev/null
> +++ b/lib/fonts/font_8x8.c
> @@ -0,0 +1,2587 @@
> +/**/
> +/**/
> +/*   Font file generated by cpi2fnt   */
> +/**/
> +/**/
> +
> +#include 
> +#include 
> +
> +#define FONTDATAMAX 2048
> +
> +static const unsigned char fontdata_8x8[FONTDATAMAX] = {
> +
> + /* 0 0x00 '^@' */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x00, /*  */
> +
> + /* 1 0x01 '^A' */
> + 0x7e, /* 0110 */
> + 0x81, /* 1001 */
> + 0xa5, /* 10100101 */
> + 0x81, /* 1001 */
> + 0xbd, /* 1001 */
> + 0x99, /* 10011001 */
> + 0x81, /* 1001 */
> + 0x7e, /* 0110 */
> +
> + /* 2 0x02 '^B' */
> + 0x7e, /* 0110 */
> + 0xff, /*  */
> + 0xdb, /* 11011011 */
> + 0xff, /*  */
> + 0xc3, /* 1111 */
> + 0xe7, /* 11100111 */
> + 0xff, /*  */
> + 0x7e, /* 0110 */
> +
> + /* 3 0x03 '^C' */
> + 0x6c, /* 01101100 */
> + 0xfe, /* 1110 */
> + 0xfe, /* 1110 */
> + 0xfe, /* 1110 */
> + 0x7c, /* 0100 */
> + 0x38, /* 00111000 */
> + 0x10, /* 0001 */
> + 0x00, /*  */
> +
> + /* 4 0x04 '^D' */
> + 0x10, /* 0001 */
> + 0x38, /* 00111000 */
> + 0x7c, /* 0100 */
> + 0xfe, /* 1110 */
> + 0x7c, /* 0100 */
> + 0x38, /* 00111000 */
> + 0x10, /* 0001 */
> + 0x00, /*  */
> +
> + /* 5 0x05 '^E' */
> + 0x38, /* 00111000 */
> + 0x7c, /* 0100 */
> + 0x38, /* 00111000 */
> + 0xfe, /* 1110 */
> + 0xfe, /* 1110 */
> + 0xd6, /* 11010110 */
> + 0x10, /* 0001 */
> + 0x38, /* 00111000 */
> +
> + /* 6 0x06 '^F' */
> + 0x10, /* 0001 */
> + 0x38, /* 00111000 */
> + 0x7c, /* 0100 */
> + 0xfe, /* 1110 */
> + 0xfe, /* 1110 */
> + 0x7c, /* 0100 */
> + 0x10, /* 0001 */
> + 0x38, /* 00111000 */
> +
> + /* 7 0x07 '^G' */
> + 0x00, /*  */
> + 0x00, /*  */
> + 0x18, /* 00011000 */
> + 0x3c, /* 0000 */
> + 0x3c, /* 0000 */
> + 0x18, /* 00011000 */
> + 0x00, /*  */
> + 0x00, /*  */
> +
> + /* 8 0x08 '^H' */
> + 0xff, /*  */
> + 0xff, /*  */
> + 0xe7, /* 11100111 */
> + 0xc3, /* 1111 */
> + 0xc3, /* 1111 */
> + 0xe7, /* 11100111 */
> + 0xff, /*  */
> + 0xff, /*  */
> +
> + /* 9 0x09 '^I' */
> + 0x00, /*  */
> + 0x3c, /* 0000 */
> + 0x66, /* 01100110 */
> + 0x42, /* 0110 */
> + 0x42, /* 0110 */
> + 0x66, /* 01100110 */
> + 0x3c, /* 0000 */
> + 0x00, /*  */
> +
> + /* 10 0x0a '^J' */
> + 0xff, /*  */
> + 0xc3, /* 1111 */
> + 0x99, /* 10011001 */
> + 0xbd, /* 1001 */
> + 0xbd, /* 1001 */
> + 0x99, /* 10011001 */
> + 

Re: [PATCH 1/3] graphic_utils: implement 8 bpp color depth in gu_set_pixel

2017-02-23 Thread Sascha Hauer
On Thu, Feb 23, 2017 at 05:45:25PM +0100, Bastian Stender wrote:
> Signed-off-by: Bastian Stender 
> ---
>  lib/gui/graphic_utils.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thanks

Sascha

> 
> diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
> index d3f5cce4b7..f6ab5ea0d1 100644
> --- a/lib/gui/graphic_utils.c
> +++ b/lib/gui/graphic_utils.c
> @@ -132,6 +132,7 @@ void gu_set_pixel(struct fb_info *info, void *adr, u32 px)
>  {
>   switch (info->bits_per_pixel) {
>   case 8:
> + *(u8 *)adr = px & 0xff;
>   break;
>   case 16:
>   *(u16 *)adr = px & 0x;
> -- 
> 2.11.0
> 
> 
> ___
> 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 1/2] i2c: mv64xxx: add software delays

2017-02-23 Thread Sascha Hauer
On Thu, Feb 23, 2017 at 05:34:49PM +0100, Bastian Stender wrote:
> As stated in Marvell's Functional Specifications in MV-S107021-U0 Rev. A
> on page 420 ff. software delays are needed. "SW delay represent a delay
> of at least 2 internal clock cycles". These delays are hereby
> implemented.
> 
> The original kernel driver compensates the needed software delays with
> the time the interrupts take.
> 
> Signed-off-by: Bastian Stender 

Applied, thanks

Sascha

> ---
>  drivers/i2c/busses/i2c-mv64xxx.c | 12 ++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mv64xxx.c 
> b/drivers/i2c/busses/i2c-mv64xxx.c
> index 9b9e6c953f..45d5a2b6dc 100644
> --- a/drivers/i2c/busses/i2c-mv64xxx.c
> +++ b/drivers/i2c/busses/i2c-mv64xxx.c
> @@ -270,6 +270,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 
> status)
>   }
>   /* FALLTHRU */
>   case STATUS_MAST_RD_DATA_ACK: /* 0x50 */
> + udelay(2);
>   if (status != STATUS_MAST_RD_DATA_ACK)
>   drv_data->action = ACTION_CONTINUE;
>   else {
> @@ -280,6 +281,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 
> status)
>  
>   if (drv_data->bytes_left == 1)
>   drv_data->cntl_bits &= ~REG_CONTROL_ACK;
> + udelay(2);
>   break;
>  
>   case STATUS_MAST_RD_DATA_NO_ACK: /* 0x58 */
> @@ -318,6 +320,8 @@ static void mv64xxx_i2c_send_start(struct 
> mv64xxx_i2c_data *drv_data)
>   mv64xxx_i2c_prepare_for_io(drv_data, drv_data->msgs);
>   mv64xxx_write(drv_data, drv_data->cntl_bits | REG_CONTROL_START,
>   drv_data->reg_offsets.control);
> +
> + udelay(2);
>  }
>  
>  static void
> @@ -333,7 +337,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
>   mv64xxx_i2c_send_start(drv_data);
>  
>   if (drv_data->errata_delay)
> - udelay(5);
> + udelay(3);
>  
>   /*
>* We're never at the start of the message here, and by this
> @@ -349,6 +353,7 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
>   break;
>  
>   case ACTION_SEND_ADDR_1:
> + udelay(2);
>   mv64xxx_write(drv_data, drv_data->addr1,
>   drv_data->reg_offsets.data);
>   mv64xxx_write(drv_data, drv_data->cntl_bits,
> @@ -360,9 +365,11 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
>   drv_data->reg_offsets.data);
>   mv64xxx_write(drv_data, drv_data->cntl_bits,
>   drv_data->reg_offsets.control);
> + udelay(2);
>   break;
>  
>   case ACTION_SEND_DATA:
> + udelay(2);
>   mv64xxx_write(drv_data, 
> drv_data->msg->buf[drv_data->byte_posn++],
>   drv_data->reg_offsets.data);
>   mv64xxx_write(drv_data, drv_data->cntl_bits,
> @@ -383,8 +390,9 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
>   mv64xxx_write(drv_data, drv_data->cntl_bits | REG_CONTROL_STOP,
>   drv_data->reg_offsets.control);
>   drv_data->block = false;
> + udelay(2);
>   if (drv_data->errata_delay)
> - udelay(5);
> + udelay(3);
>  
>   break;
>  
> -- 
> 2.11.0
> 
> 
> ___
> 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] ata: new driver to support the internal sata controller on Armada-XP

2017-02-23 Thread Sascha Hauer
On Thu, Jan 26, 2017 at 11:01:59AM +0100, Uwe Kleine-König wrote:
> Signed-off-by: Uwe Kleine-König 
> ---
>  drivers/ata/Kconfig   |   5 ++
>  drivers/ata/Makefile  |   1 +
>  drivers/ata/sata_mv.c | 126 
> ++
>  3 files changed, 132 insertions(+)
>  create mode 100644 drivers/ata/sata_mv.c

I also think that it's better to have a driver that does the
initialization than to do in board specific code where it gets
duplicated from board to board.
Applied this patch.

Sascha

> 
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 7850e4a9c967..0234c66c8ec8 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -42,6 +42,11 @@ config DISK_AHCI_IMX
>   depends on DISK_AHCI
>   bool "i.MX AHCI support"
>  
> +config DISK_SATA_MV
> + depends on ARCH_MVEBU
> + select DISK_IDE_SFF
> + bool "Marvell SATA support"
> +
>  comment "interface types"
>  
>  config DISK_INTF_PLATFORM_IDE
> diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
> index c444c4d1962e..6b83ae2ef542 100644
> --- a/drivers/ata/Makefile
> +++ b/drivers/ata/Makefile
> @@ -5,6 +5,7 @@ obj-$(CONFIG_DISK_IDE_SFF) += ide-sff.o
>  obj-$(CONFIG_DISK_ATA) += disk_ata_drive.o
>  obj-$(CONFIG_DISK_AHCI) += ahci.o
>  obj-$(CONFIG_DISK_AHCI_IMX) += sata-imx.o
> +obj-$(CONFIG_DISK_SATA_MV) += sata_mv.o
>  
>  # interface types
>  
> diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
> new file mode 100644
> index ..22b29d08a579
> --- /dev/null
> +++ b/drivers/ata/sata_mv.c
> @@ -0,0 +1,126 @@
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +
> +/* This can/should be moved to a more generic place */
> +static void ata_ioports_init(struct ata_ioports *io,
> +  void *base_data, void *base_reg, void *base_alt,
> +  unsigned stride)
> +{
> + /* io->cmd_addr is unused */;
> + io->data_addr = base_data;
> + io->error_addr = base_reg + 1 * stride;
> + /* io->feature_addr is unused */
> + io->nsect_addr = base_reg + 2 * stride;
> + io->lbal_addr = base_reg + 3 * stride;
> + io->lbam_addr = base_reg + 4 * stride;
> + io->lbah_addr = base_reg + 5 * stride;
> + io->device_addr = base_reg + 6 * stride;
> + io->status_addr = base_reg + 7 * stride;
> + io->command_addr = base_reg + 7 * stride;
> + /* io->altstatus_addr is unused */
> +
> + if (base_alt)
> + io->ctl_addr = base_alt;
> + else
> + io->ctl_addr = io->status_addr;
> +
> + /* io->alt_dev_addr is unused */
> +}
> +
> +#define REG_WINDOW_CONTROL(n)((n) * 0x10 + 0x30)
> +#define REG_WINDOW_BASE(n)   ((n) * 0x10 + 0x34)
> +
> +#define REG_EDMA_COMMAND(n)  ((n) * 0x2000 + 0x2028)
> +#define REG_EDMA_COMMAND__EATARST0x0004
> +
> +#define REG_ATA_BASE 0x2100
> +#define REG_SSTATUS(n)   ((n) * 0x2000 + 0x2300)
> +#define REG_SCONTROL(n)  ((n) * 0x2000 + 0x2308)
> +#define REG_SCONTROL__DET0x000f
> +#define REG_SCONTROL__DET__INIT  0x0001
> +#define REG_SCONTROL__DET__PHYOK 0x0002
> +#define REG_SCONTROL__IPM0x0f00
> +#define REG_SCONTROL__IPM__PARTIAL   0x0100
> +#define REG_SCONTROL__IPM__SLUMBER   0x0200
> +
> +static int mv_sata_probe(struct device_d *dev)
> +{
> + struct resource *iores;
> + void __iomem *base;
> + struct ide_port *ide;
> + u32 scontrol;
> + int ret, i;
> +
> + iores = dev_request_mem_resource(dev, 0);
> + if (IS_ERR(iores)) {
> + dev_err(dev, "Failed to request mem resources\n");
> + return PTR_ERR(iores);
> + }
> + base = IOMEM(iores->start);
> +
> + /* disable MBus windows */
> + for (i = 0; i < 4; ++i) {
> + writel(0, base + REG_WINDOW_CONTROL(i));
> + writel(0, base + REG_WINDOW_BASE(i));
> + }
> +
> + /* enable first window */
> + writel(0x7fff0e01, base + REG_WINDOW_CONTROL(0));
> + writel(0, base + REG_WINDOW_BASE(0));
> +
> + writel(REG_EDMA_COMMAND__EATARST, base + REG_EDMA_COMMAND(0));
> + udelay(25);
> + writel(0x0, base + REG_EDMA_COMMAND(0));
> +
> + scontrol = readl(base + REG_SCONTROL(0));
> + scontrol &= ~(REG_SCONTROL__DET | REG_SCONTROL__IPM);
> + /* disable power management */
> + scontrol |= REG_SCONTROL__IPM__PARTIAL | REG_SCONTROL__IPM__SLUMBER;
> +
> + /* perform interface communication initialization */
> + writel(scontrol | REG_SCONTROL__DET__INIT, base + REG_SCONTROL(0));
> + writel(scontrol, base + REG_SCONTROL(0));
> +
> + ret = wait_on_timeout(10 * MSECOND,
> +   (readl(base + REG_SSTATUS(0)) & 
> REG_SCONTROL__DET) == (REG_SCONTROL__DET__INIT | REG_SCONTROL__DET__PHYOK));
> + if (ret) {
> + dev_err(dev, "Failed to wait for phy (sstatus=0x%08x)\n",
> + 

Re: [PATCH] mvebu: Fix fixup of mbus device-tree ranges

2017-02-23 Thread Sascha Hauer
On Wed, Feb 22, 2017 at 09:06:18PM +0100, Uwe Kleine-König wrote:
> Commits "mvebu: {armada-370-xp,dove,kirkwood}: simplify soc init code
> flow" simplified too much. The problem is that if the dtb used for
> probing doesn't use the same mbus window address as barebox (i.e.
> 0xf100) the fixup fails because above commits moved the information
> about the real position to a postcore initcall which is too late because
> the fixup happens in of_arm_init which runs as core initcall.

Said patches are currently in -next, so you could send a fixup patch
instead or I could just remove the patches.

Sascha

> 
> Signed-off-by: Uwe Kleine-König 
> ---
>  arch/arm/mach-mvebu/armada-370-xp.c |  3 ---
>  arch/arm/mach-mvebu/dove.c  |  5 -
>  arch/arm/mach-mvebu/kirkwood.c  |  2 --
>  drivers/bus/mvebu-mbus.c| 22 +-
>  4 files changed, 21 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm/mach-mvebu/armada-370-xp.c 
> b/arch/arm/mach-mvebu/armada-370-xp.c
> index 196b770277f3..93ad955a6e49 100644
> --- a/arch/arm/mach-mvebu/armada-370-xp.c
> +++ b/arch/arm/mach-mvebu/armada-370-xp.c
> @@ -90,9 +90,6 @@ static int armada_370_xp_init_soc(void)
>   if (!of_machine_is_compatible("marvell,armada-370-xp"))
>   return 0;
>  
> - mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
> -  MVEBU_REMAP_INT_REG_BASE);
> -
>   restart_handler_register_fn(armada_370_xp_restart_soc);
>  
>   barebox_set_model("Marvell Armada 370/XP");
> diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
> index 54da0d785490..1cdb7e1b8296 100644
> --- a/arch/arm/mach-mvebu/dove.c
> +++ b/arch/arm/mach-mvebu/dove.c
> @@ -57,11 +57,6 @@ static int dove_init_soc(void)
>   if (!of_machine_is_compatible("marvell,dove"))
>   return 0;
>  
> - mvebu_mbus_add_range("marvell,dove", 0xf0, 0x01,
> -  MVEBU_REMAP_INT_REG_BASE);
> - mvebu_mbus_add_range("marvell,dove", 0xf0, 0x02,
> -  DOVE_REMAP_MC_REGS);
> -
>   restart_handler_register_fn(dove_restart_soc);
>  
>   barebox_set_model("Marvell Dove");
> diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
> index 36cd2a84a6f5..59fb95ff4adf 100644
> --- a/arch/arm/mach-mvebu/kirkwood.c
> +++ b/arch/arm/mach-mvebu/kirkwood.c
> @@ -34,8 +34,6 @@ static int kirkwood_init_soc(void)
>   if (!of_machine_is_compatible("marvell,kirkwood"))
>   return 0;
>  
> - mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
> -  MVEBU_REMAP_INT_REG_BASE);
>   restart_handler_register_fn(kirkwood_restart_soc);
>  
>   barebox_set_model("Marvell Kirkwood");
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index df5f7a32d346..79c80cf52115 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -59,6 +59,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  /* DDR target is the same on all platforms */
>  #define TARGET_DDR   0
> @@ -810,7 +811,26 @@ static int mvebu_mbus_of_fixup(struct device_node *root, 
> void *context)
>   return 0;
>  }
>  
> -static int mvebu_mbus_fixup_register(void) {
> +#define DOVE_REMAP_MC_REGS   0xf180
> +
> +static int mvebu_mbus_fixup_register(void)
> +{
> + if (IS_ENABLED(CONFIG_ARCH_DOVE)) {
> + mvebu_mbus_add_range("marvell,dove", 0xf0, 0x01,
> +  MVEBU_REMAP_INT_REG_BASE);
> + mvebu_mbus_add_range("marvell,dove", 0xf0, 0x02,
> +  DOVE_REMAP_MC_REGS);
> + }
> +
> + if (IS_ENABLED(CONFIG_ARCH_KIRKWOOD))
> + mvebu_mbus_add_range("marvell,kirkwood", 0xf0, 0x01,
> +  MVEBU_REMAP_INT_REG_BASE);
> +
> + if (IS_ENABLED(CONFIG_ARCH_ARMADA_370) ||
> + IS_ENABLED(CONFIG_ARCH_ARMADA_XP))
> + mvebu_mbus_add_range("marvell,armada-370-xp", 0xf0, 0x01,
> +  MVEBU_REMAP_INT_REG_BASE);
> +
>   return of_register_fixup(mvebu_mbus_of_fixup, NULL);
>  }
>  pure_initcall(mvebu_mbus_fixup_register);
> -- 
> 2.11.0
> 
> 
> ___
> 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 v2] lib: xz: add support for bcj filters

2017-02-23 Thread Sascha Hauer
On Wed, Feb 22, 2017 at 11:33:19AM +0100, yegorsli...@googlemail.com wrote:
> From: Yegor Yefremov 
> 
> Add missing configuration options for various bcj filters. Without
> these options the lib/xz/xz_dec_bcj.c file will be compiled, but all
> filters will be disabled.
> 
> Signed-off-by: Yegor Yefremov 

Applied, thanks

Sascha

> ---
> Changes v1 -> v2:
>   - always select all filters (Sascha Hauer)
> 
>  lib/Kconfig | 24 
>  1 file changed, 24 insertions(+)
> 
> diff --git a/lib/Kconfig b/lib/Kconfig
> index f9f25bdef..8a94ce09f 100644
> --- a/lib/Kconfig
> +++ b/lib/Kconfig
> @@ -21,6 +21,30 @@ config LZ4_DECOMPRESS
>  config XZ_DECOMPRESS
>   bool "include xz uncompression support"
>   select UNCOMPRESS
> + select XZ_DEC_X86
> + select XZ_DEC_POWERPC
> + select XZ_DEC_IA64
> + select XZ_DEC_ARM
> + select XZ_DEC_ARMTHUMB
> + select XZ_DEC_SPARC
> +
> +config XZ_DEC_X86
> +bool
> +
> +config XZ_DEC_POWERPC
> +bool
> +
> +config XZ_DEC_IA64
> +bool
> +
> +config XZ_DEC_ARM
> +bool
> +
> +config XZ_DEC_ARMTHUMB
> +bool
> +
> +config XZ_DEC_SPARC
> +bool
>  
>  config REED_SOLOMON
>   bool
> -- 
> 2.11.0
> 
> 

-- 
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


mw crash

2017-02-23 Thread Chris Healy
I mistakenly used the wrong set of command line arguments when using
the mw command and it resulted in the following crash:

barebox@ZII RDU2 Board:/ mw -b -l /dev/pic_eeprom_rdu 0x50 3
unable to handle NULL pointer dereference at address 0x
pc : [<8fe45134>]lr : [<8fe45107>]
sp : 8ffef870  ip : 4ff9def8  fp : 
r10: 0006  r9 :   r8 : 
r7 : 8ffef91c  r6 : 8ffef91c  r5 :   r4 : 0004
r3 : 0050  r2 : 0003  r1 : 0003  r0 : 
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
[<8fe45134>] (memcpy_sz+0x48/0x54) from [<8fe46119>] (mem_write+0x39/0x44)
[<8fe46119>] (mem_write+0x39/0x44) from [<8fe42f35>] (devfs_write+0x21/0x2a)
[<8fe42f35>] (devfs_write+0x21/0x2a) from [<8fe44ea1>] (__write+0x79/0x94)
[<8fe44ea1>] (__write+0x79/0x94) from [<8fe45587>] (write+0x2b/0x48)
[<8fe45587>] (write+0x2b/0x48) from [<8fe2c813>] (do_mem_mw+0x10f/0x14c)
[<8fe2c813>] (do_mem_mw+0x10f/0x14c) from [<8fe0324d>]
(execute_command+0x21/0x48)
[<8fe0324d>] (execute_command+0x21/0x48) from [<8fe087eb>]
(run_list_real+0x55b/0x618)
[<8fe087eb>] (run_list_real+0x55b/0x618) from [<8fe08161>]
(parse_stream_outer+0xd9/0x164)
[<8fe08161>] (parse_stream_outer+0xd9/0x164) from [<8fe08a6b>]
(run_shell+0x33/0x60)
[<8fe08a6b>] (run_shell+0x33/0x60) from [<8fe0324d>] (execute_command+0x21/0x48)
[<8fe0324d>] (execute_command+0x21/0x48) from [<8fe087eb>]
(run_list_real+0x55b/0x618)
[<8fe087eb>] (run_list_real+0x55b/0x618) from [<8fe08509>]
(run_list_real+0x279/0x618)

[<8fe4cbe9>] (unwind_backtrace+0x1/0x58) from [<8fe00d39>] (panic+0x1d/0x34)
[<8fe00d39>] (panic+0x1d/0x34) from [<8fe4b20d>] (do_exception+0xd/0x10)
[<8fe4b20d>] (do_exception+0xd/0x10) from [<8fe4b26d>] (do_data_abort+0x21/0x2c)
[<8fe4b26d>] (do_data_abort+0x21/0x2c) from [<8fe4ab34>] (do_abort_6+0x48/0x54)


I haven't dug in to figure it out but I figured it would be good to report.

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


[PATCH] lseek: ensure errno is set on failure and return -1

2017-02-23 Thread Uwe Kleine-König
All error paths before calling the driver's lseek callback return -1 and
set errno. Do the same if the callback returns an error.

Signed-off-by: Uwe Kleine-König 
---
 fs/fs.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fs/fs.c b/fs/fs.c
index 2b4659cfbb76..e7b696591433 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -926,7 +926,13 @@ loff_t lseek(int fildes, loff_t offset, int whence)
goto out;
}
 
-   return fsdrv->lseek(>fsdev->dev, f, pos);
+   pos = fsdrv->lseek(>fsdev->dev, f, pos);
+   if (pos < 0) {
+   errno = -pos;
+   return -1;
+   }
+
+   return pos;
 
 out:
if (ret)
-- 
2.11.0


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


[PATCH 2/2] fbconsole: implement vt100 cursor shown/hidden

2017-02-23 Thread Bastian Stender
This implements the vt100 show cursor command '[?25h' and the hide
cursor command '[?25l'. It is useful for displaying text on a non-active
(no stdout/stdin/stderr) console with 'echo'.

Signed-off-by: Bastian Stender 
---
 drivers/video/fbconsole.c | 55 ++-
 1 file changed, 50 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 3879741b2a..b6059e86f5 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -11,6 +11,7 @@ enum state_t {
LIT,/* Literal input */
ESC,/* Start of escape sequence */
CSI,/* Reading arguments in "CSI Pn ;...*/
+   CSI_CNT,
 };
 
 struct fbc_priv {
@@ -34,10 +35,12 @@ struct fbc_priv {
 
 #define ANSI_FLAG_INVERT   (1 << 0)
 #define ANSI_FLAG_BRIGHT   (1 << 1)
+#define HIDE_CURSOR(1 << 2)
unsigned flags;
 
int csipos;
u8 csi[256];
+   unsigned char csi_cmd;
 
int active;
int in_console;
@@ -144,6 +147,12 @@ static void video_invertchar(struct fbc_priv *priv, int x, 
int y)
priv->font->width, priv->font->height);
 }
 
+static void show_cursor(struct fbc_priv *priv, int x, int y)
+{
+   if (!(priv->flags & HIDE_CURSOR))
+   video_invertchar(priv, x, y);
+}
+
 static void printchar(struct fbc_priv *priv, int c)
 {
video_invertchar(priv, priv->x, priv->y);
@@ -200,7 +209,7 @@ static void printchar(struct fbc_priv *priv, int c)
priv->y = priv->rows;
}
 
-   video_invertchar(priv, priv->x, priv->y);
+   show_cursor(priv, priv->x, priv->y);
 
return;
 }
@@ -258,12 +267,43 @@ static void fbc_parse_csi(struct fbc_priv *priv)
case 'm':
fbc_parse_colors(priv);
return;
+   case '?': /* vt100: show/hide cursor */
+   priv->csi_cmd = last;
+   priv->state = CSI_CNT;
+   return;
+   case 'h':
+   /* suffix for vt100 "[?25h" */
+   switch (priv->csi_cmd) {
+   case '?': /* cursor visible */
+   priv->csi_cmd = -1;
+   if (!(priv->flags & HIDE_CURSOR))
+   break;
+
+   priv->flags &= ~HIDE_CURSOR;
+   /* show cursor now */
+   show_cursor(priv, priv->x, priv->y);
+   break;
+   }
+   break;
+   case 'l':
+   /* suffix for vt100 "[?25l" */
+   switch (priv->csi_cmd) {
+   case '?': /* cursor invisible */
+   priv->csi_cmd = -1;
+
+   /* hide cursor now */
+   video_invertchar(priv, priv->x, priv->y);
+   priv->flags |= HIDE_CURSOR;
+
+   break;
+   }
+   break;
case 'J':
cls(priv);
-   video_invertchar(priv, priv->x, priv->y);
+   show_cursor(priv, priv->x, priv->y);
return;
case 'H':
-   video_invertchar(priv, priv->x, priv->y);
+   show_cursor(priv, priv->x, priv->y);
 
pos = simple_strtoul(priv->csi, , 10);
priv->y = (pos && pos <= priv->rows + 1) ? pos - 1 : 0;
@@ -271,7 +311,7 @@ static void fbc_parse_csi(struct fbc_priv *priv)
pos = simple_strtoul(end + 1, NULL, 10);
priv->x = (pos && pos <= priv->cols + 1) ? pos - 1 : 0;
 
-   video_invertchar(priv, priv->x, priv->y);
+   show_cursor(priv, priv->x, priv->y);
case 'K':
pos = simple_strtoul(priv->csi, , 10);
video_invertchar(priv, priv->x, priv->y);
@@ -343,9 +383,14 @@ static void fbc_putc(struct console_device *cdev, char c)
break;
default:
fbc_parse_csi(priv);
-   priv->state = LIT;
+   if (priv->state != CSI_CNT)
+   priv->state = LIT;
}
break;
+   case CSI_CNT:
+   priv->state = CSI;
+   break;
+
}
priv->in_console = 0;
 }
-- 
2.11.0


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


[PATCH 1/2] fbconsole: check cursor position before moving

2017-02-23 Thread Bastian Stender
Moving the cursor to x=2, y=2 with "\e[3;3H" on a 12x2 framebuffer
console lead to a barebox crash while drawing the cursor. The cursor can
only be moved to a valid position between (0,0) and (priv->cols,
priv->rows) now.

Signed-off-by: Bastian Stender 
---
 drivers/video/fbconsole.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/video/fbconsole.c b/drivers/video/fbconsole.c
index 64f7d7364e..3879741b2a 100644
--- a/drivers/video/fbconsole.c
+++ b/drivers/video/fbconsole.c
@@ -264,10 +264,13 @@ static void fbc_parse_csi(struct fbc_priv *priv)
return;
case 'H':
video_invertchar(priv, priv->x, priv->y);
+
pos = simple_strtoul(priv->csi, , 10);
-   priv->y = pos ? pos - 1 : 0;
+   priv->y = (pos && pos <= priv->rows + 1) ? pos - 1 : 0;
+
pos = simple_strtoul(end + 1, NULL, 10);
-   priv->x = pos ? pos - 1 : 0;
+   priv->x = (pos && pos <= priv->cols + 1) ? pos - 1 : 0;
+
video_invertchar(priv, priv->x, priv->y);
case 'K':
pos = simple_strtoul(priv->csi, , 10);
-- 
2.11.0


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


[PATCH] lib/fonts: add VGA8x8 font

2017-02-23 Thread Bastian Stender
Ported from Linux v4.10.

This font is ideal for displaying a framebuffer console on a small display.

Signed-off-by: Bastian Stender 
---
 lib/fonts/Kconfig|4 +
 lib/fonts/Makefile   |1 +
 lib/fonts/font_8x8.c | 2587 ++
 3 files changed, 2592 insertions(+)
 create mode 100644 lib/fonts/font_8x8.c

diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig
index d23b283964..3cd8d7698b 100644
--- a/lib/fonts/Kconfig
+++ b/lib/fonts/Kconfig
@@ -14,6 +14,9 @@ config FONT_8x16
  This is the "high resolution" font for the VGA frame buffer (the one
  provided by the VGA text console 80x25 mode).
 
+config FONT_8x8
+   bool "VGA 8x8 font"
+
 config FONT_7x14
bool "7x14 font"
 
@@ -27,6 +30,7 @@ config FONT_CUSTOM_16X
 
 config FONT_AUTOSELECT
def_bool y
+   depends on !FONT_MINI_8x8
depends on !FONT_MINI_4x6
depends on !FONT_7x14
select FONT_8x16
diff --git a/lib/fonts/Makefile b/lib/fonts/Makefile
index 98245b3d65..9e63ce6303 100644
--- a/lib/fonts/Makefile
+++ b/lib/fonts/Makefile
@@ -3,6 +3,7 @@
 font-objs := fonts.o
 
 font-objs-$(CONFIG_FONT_8x16)  += font_8x16.o
+font-objs-$(CONFIG_FONT_8x8)   += font_8x8.o
 font-objs-$(CONFIG_FONT_7x14)  += font_7x14.o
 font-objs-$(CONFIG_FONT_MINI_4x6)  += font_mini_4x6.o
 font-objs-$(CONFIG_FONT_CUSTOM_16X)+= font_custom_16x.o
diff --git a/lib/fonts/font_8x8.c b/lib/fonts/font_8x8.c
new file mode 100644
index 00..24216a68a2
--- /dev/null
+++ b/lib/fonts/font_8x8.c
@@ -0,0 +1,2587 @@
+/**/
+/**/
+/*   Font file generated by cpi2fnt   */
+/**/
+/**/
+
+#include 
+#include 
+
+#define FONTDATAMAX 2048
+
+static const unsigned char fontdata_8x8[FONTDATAMAX] = {
+
+   /* 0 0x00 '^@' */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+   0x00, /*  */
+
+   /* 1 0x01 '^A' */
+   0x7e, /* 0110 */
+   0x81, /* 1001 */
+   0xa5, /* 10100101 */
+   0x81, /* 1001 */
+   0xbd, /* 1001 */
+   0x99, /* 10011001 */
+   0x81, /* 1001 */
+   0x7e, /* 0110 */
+
+   /* 2 0x02 '^B' */
+   0x7e, /* 0110 */
+   0xff, /*  */
+   0xdb, /* 11011011 */
+   0xff, /*  */
+   0xc3, /* 1111 */
+   0xe7, /* 11100111 */
+   0xff, /*  */
+   0x7e, /* 0110 */
+
+   /* 3 0x03 '^C' */
+   0x6c, /* 01101100 */
+   0xfe, /* 1110 */
+   0xfe, /* 1110 */
+   0xfe, /* 1110 */
+   0x7c, /* 0100 */
+   0x38, /* 00111000 */
+   0x10, /* 0001 */
+   0x00, /*  */
+
+   /* 4 0x04 '^D' */
+   0x10, /* 0001 */
+   0x38, /* 00111000 */
+   0x7c, /* 0100 */
+   0xfe, /* 1110 */
+   0x7c, /* 0100 */
+   0x38, /* 00111000 */
+   0x10, /* 0001 */
+   0x00, /*  */
+
+   /* 5 0x05 '^E' */
+   0x38, /* 00111000 */
+   0x7c, /* 0100 */
+   0x38, /* 00111000 */
+   0xfe, /* 1110 */
+   0xfe, /* 1110 */
+   0xd6, /* 11010110 */
+   0x10, /* 0001 */
+   0x38, /* 00111000 */
+
+   /* 6 0x06 '^F' */
+   0x10, /* 0001 */
+   0x38, /* 00111000 */
+   0x7c, /* 0100 */
+   0xfe, /* 1110 */
+   0xfe, /* 1110 */
+   0x7c, /* 0100 */
+   0x10, /* 0001 */
+   0x38, /* 00111000 */
+
+   /* 7 0x07 '^G' */
+   0x00, /*  */
+   0x00, /*  */
+   0x18, /* 00011000 */
+   0x3c, /* 0000 */
+   0x3c, /* 0000 */
+   0x18, /* 00011000 */
+   0x00, /*  */
+   0x00, /*  */
+
+   /* 8 0x08 '^H' */
+   0xff, /*  */
+   0xff, /*  */
+   0xe7, /* 11100111 */
+   0xc3, /* 1111 */
+   0xc3, /* 1111 */
+   0xe7, /* 11100111 */
+   0xff, /*  */
+   0xff, /*  */
+
+   /* 9 0x09 '^I' */
+   0x00, /*  */
+   0x3c, /* 0000 */
+   0x66, /* 01100110 */
+   0x42, /* 0110 */
+   0x42, /* 0110 */
+   0x66, /* 01100110 */
+   0x3c, /* 0000 */
+   0x00, /*  */
+
+   /* 10 0x0a '^J' */
+   0xff, /*  */
+   0xc3, /* 1111 */
+   0x99, /* 10011001 */
+   0xbd, /* 1001 */
+   0xbd, /* 1001 */
+   0x99, /* 10011001 */
+   0xc3, /* 1111 */
+   0xff, /*  */
+
+   /* 11 0x0b '^K' */
+   0x0f, /*  */
+   0x07, /* 0111 */
+   0x0f, /*  */
+   0x7d, /* 0101 */
+   0xcc, /* 11001100 */
+  

[PATCH 2/3] graphic_utils: do not allocate info in fb_open

2017-02-23 Thread Bastian Stender
info was errorneously allocated, but it really is a pointer to a fb_info
struct from the framebuffer. This fixes a memory leak.

Signed-off-by: Bastian Stender 
---
 lib/gui/graphic_utils.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index f6ab5ea0d1..7d238e9ff9 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -277,8 +277,6 @@ struct screen *fb_open(const char * fbdev)
if (fd < 0)
return ERR_PTR(fd);
 
-   info = xzalloc(sizeof(*info));
-
ret = ioctl(fd, FBIOGET_SCREENINFO, );
if (ret) {
goto failed_screeninfo;
@@ -291,7 +289,6 @@ struct screen *fb_open(const char * fbdev)
}
 
sc->fd = fd;
-   sc->info = info;
 
return sc;
 
-- 
2.11.0


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


[PATCH 3/3] 2d-primitives: check dimensions in __illuminate

2017-02-23 Thread Bastian Stender
gl_draw_circle draws outside of the screen if the resolution is too low.
This lead to memory corruption. Check the dimensions before drawing.

Signed-off-by: Bastian Stender 
---
 lib/gui/2d-primitives.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/gui/2d-primitives.c b/lib/gui/2d-primitives.c
index f3814eea44..0f29b32bab 100644
--- a/lib/gui/2d-primitives.c
+++ b/lib/gui/2d-primitives.c
@@ -13,6 +13,9 @@ static void __illuminate(struct fb_info *info,
 {
void *pixel;
 
+   if (x < 0 || y < 0 || x >= info->xres || y >= info->yres)
+   return;
+
pixel  = fb_get_screen_base(info);
pixel += y * info->line_length + x * (info->bits_per_pixel >> 3);
 
-- 
2.11.0


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


[PATCH 1/3] graphic_utils: implement 8 bpp color depth in gu_set_pixel

2017-02-23 Thread Bastian Stender
Signed-off-by: Bastian Stender 
---
 lib/gui/graphic_utils.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/gui/graphic_utils.c b/lib/gui/graphic_utils.c
index d3f5cce4b7..f6ab5ea0d1 100644
--- a/lib/gui/graphic_utils.c
+++ b/lib/gui/graphic_utils.c
@@ -132,6 +132,7 @@ void gu_set_pixel(struct fb_info *info, void *adr, u32 px)
 {
switch (info->bits_per_pixel) {
case 8:
+   *(u8 *)adr = px & 0xff;
break;
case 16:
*(u16 *)adr = px & 0x;
-- 
2.11.0


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


[PATCH 2/2] i2c: mv64xxx: simplify mv64xxx_i2c_wait_for_completion

2017-02-23 Thread Bastian Stender
Two nested while loops are not necessary here, so integrate the read,
i2c_fsm and i2c_do_action calls into mv64xxx_i2c_wait_for_completion()
and remove the obsolete interrupt remains.

Signed-off-by: Bastian Stender 
---
 drivers/i2c/busses/i2c-mv64xxx.c | 29 -
 1 file changed, 8 insertions(+), 21 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index 45d5a2b6dc..caece3b78e 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -414,26 +414,6 @@ mv64xxx_i2c_do_action(struct mv64xxx_i2c_data *drv_data)
}
 }
 
-static void mv64xxx_i2c_intr(struct mv64xxx_i2c_data *drv_data)
-{
-   u32 status;
-   uint64_t start;
-
-   start = get_time_ns();
-
-   while (mv64xxx_read(drv_data, drv_data->reg_offsets.control) &
-   REG_CONTROL_IFLG) {
-   status = mv64xxx_read(drv_data, drv_data->reg_offsets.status);
-   mv64xxx_i2c_fsm(drv_data, status);
-   mv64xxx_i2c_do_action(drv_data);
-
-   if (is_timeout_non_interruptible(start, 3 * SECOND)) {
-   drv_data->rc = -EIO;
-   break;
-   }
-   }
-}
-
 /*
  *
  *
@@ -444,8 +424,15 @@ static void mv64xxx_i2c_intr(struct mv64xxx_i2c_data 
*drv_data)
 static void
 mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
 {
+   u32 status;
do {
-   mv64xxx_i2c_intr(drv_data);
+   if (mv64xxx_read(drv_data, drv_data->reg_offsets.control) &
+   REG_CONTROL_IFLG) {
+   status = mv64xxx_read(drv_data,
+ drv_data->reg_offsets.status);
+   mv64xxx_i2c_fsm(drv_data, status);
+   mv64xxx_i2c_do_action(drv_data);
+   }
if (drv_data->rc) {
drv_data->state = STATE_IDLE;
dev_err(_data->adapter.dev, "I2C bus error\n");
-- 
2.11.0


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


[PATCH] usb: gadget: fastboot: close fd after download

2017-02-23 Thread Sascha Hauer
The fd for the downloaded file is never closed. Fix this.

Signed-off-by: Sascha Hauer 
---
 drivers/usb/gadget/f_fastboot.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index a6192b9ebd..974b0b32eb 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -597,6 +597,7 @@ static void rx_handler_dl_image(struct usb_ep *ep, struct 
usb_request *req)
if (f_fb->download_bytes >= f_fb->download_size) {
req->complete = rx_handler_command;
req->length = EP_BUFFER_SIZE;
+   close(f_fb->download_fd);
 
fastboot_tx_print(f_fb, "INFODownloading %d bytes finished",
f_fb->download_bytes);
-- 
2.11.0


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


Re: [PATCH 07/12] efi: move x86 efi boot support to x86 arch

2017-02-23 Thread Jean-Christophe PLAGNIOL-VILLARD
On 08:27 Thu 16 Feb , Michael Olbrich wrote:
> On Wed, Feb 15, 2017 at 08:34:15PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
> wrote:
> > prepare to drop the efi arch as efi boot up is not arch sepecific
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
> > ---
> >  Documentation/boards/efi.rst |   2 +-
> >  arch/x86/Kconfig |  53 --
> >  arch/x86/Makefile|  74 +--
> >  arch/x86/configs/efi_defconfig   |  78 
> >  arch/x86/configs/generic_defconfig   |   1 +
> >  arch/x86/include/asm/elf.h   |  86 +++---
> >  arch/x86/include/asm/io.h|  71 +-
> >  arch/x86/include/asm/types.h |  51 -
> >  arch/x86/include/asm/unaligned.h |   5 ++
> >  arch/x86/lib/Makefile|   2 +
> >  arch/x86/lib/asm-offsets.c   |   7 ++
> >  arch/x86/mach-efi/.gitignore |   2 +
> >  arch/x86/mach-efi/Makefile   |   4 +
> >  arch/x86/mach-efi/crt0-efi-ia32.S|  76 +++
> >  arch/x86/mach-efi/crt0-efi-x86_64.S  |  75 +++
> >  arch/x86/mach-efi/elf_ia32_efi.lds.S | 106 
> > +++
> >  arch/x86/mach-efi/elf_x86_64_efi.lds.S   |  99 
> > +
> >  arch/x86/mach-efi/include/mach/barebox.lds.h |   0
> 
> I think this should be done instead of adding an empty file:
> 
> diff --git a/include/asm-generic/barebox.lds.h 
> b/include/asm-generic/barebox.lds.h
> index c8a919b928c9..dd2d286d32ec 100644
> --- a/include/asm-generic/barebox.lds.h
> +++ b/include/asm-generic/barebox.lds.h
> @@ -6,7 +6,7 @@
>  #define STRUCT_ALIGNMENT 32
>  #define STRUCT_ALIGN() . = ALIGN(STRUCT_ALIGNMENT)
>  
> -#if defined CONFIG_X86 || \
> +#if defined CONFIG_X86_32 || \
>   defined CONFIG_ARCH_EP93XX || \
>   defined CONFIG_ARCH_ZYNQ

I don't like the idead to add more and more ifdef

It's better to switch to a Kconfig instead

and as we can build EFI for X86 32 this will not work anyway

Best Regards,
J.

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