All of lore.kernel.org
 help / color / mirror / Atom feed
* i.MX28 patches v2
@ 2011-01-17 10:22 Sascha Hauer
  2011-01-17 10:22 ` [PATCH 1/4] video stm/mx2x: simplify memory allocation Sascha Hauer
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:22 UTC (permalink / raw)
  To: barebox

This is the second version of these patches with the comments
from Jürgen integrated and rebased on the other series I just
sent.

Sascha

The following changes since commit 3e892255b3071d4d624edb3d829eee1d579edc27:

  startup: make debug printing of linker variables work again (2011-01-17 11:05:14 +0100)

are available in the git repository at:
  ..BRANCH.NOT.VERIFIED..

Sascha Hauer (4):
      video stm/mx2x: simplify memory allocation
      video stm/mx2x: allow to pass in fb memory from platform data
      ARM i.MX28 tx28: use a fixed framebuffer address
      ARM i.MX28 tx28 defconfig: enable MMU

 arch/arm/boards/karo-tx28/tx28-stk5.c |   12 +++++++++++
 arch/arm/configs/tx28stk5_defconfig   |    1 +
 arch/arm/mach-stm/include/mach/fb.h   |    3 ++
 drivers/video/stm.c                   |   34 ++++++++++----------------------
 4 files changed, 27 insertions(+), 23 deletions(-)



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] video stm/mx2x: simplify memory allocation
  2011-01-17 10:22 i.MX28 patches v2 Sascha Hauer
@ 2011-01-17 10:22 ` Sascha Hauer
  2011-01-17 10:22 ` [PATCH 2/4] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:22 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/stm.c |   29 +++++------------------------
 1 files changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index f0abe4c..ecf450c 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -209,24 +209,6 @@ static inline unsigned calc_line_length(unsigned ppl, unsigned bpp)
 	return (ppl * bpp) >> 3;
 }
 
-static int stmfb_memory_mmgt(struct fb_info *fb_info, unsigned size)
-{
-	struct imxfb_info *fbi = fb_info->priv;
-
-	if (fbi->memory_size != 0) {
-		free(fb_info->screen_base);
-		fb_info->screen_base = NULL;
-		fbi->memory_size = 0;
-	}
-
-	if (fbi->memory_size == 0) {
-		fb_info->screen_base = xzalloc(size);
-		fbi->memory_size = size;
-	}
-
-	return 0;
-}
-
 static void stmfb_enable_controller(struct fb_info *fb_info)
 {
 	struct imxfb_info *fbi = fb_info->priv;
@@ -308,7 +290,6 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	struct imx_fb_videomode *pdata = fbi->pdata;
 	struct fb_videomode *mode = fb_info->mode;
 	uint32_t reg;
-	int ret;
 	unsigned size;
 
 	/*
@@ -317,11 +298,11 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	size = calc_line_length(mode->xres, fb_info->bits_per_pixel) *
 		mode->yres;
 
-	ret = stmfb_memory_mmgt(fb_info, size);
-	if (ret != 0) {
-		dev_err(fbi->hw_dev, "Cannot allocate framebuffer memory\n");
-		return ret;
-	}
+	fb_info->screen_base = realloc(fb_info->screen_base, size);
+	if (!fb_info->screen_base)
+		return -ENOMEM;
+	memset(fb_info->screen_base, 0, size);
+	fbi->memory_size = size;
 
 	/** @todo ensure HCLK is active at this point of time! */
 
-- 
1.7.2.3


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] video stm/mx2x: allow to pass in fb memory from platform data
  2011-01-17 10:22 i.MX28 patches v2 Sascha Hauer
  2011-01-17 10:22 ` [PATCH 1/4] video stm/mx2x: simplify memory allocation Sascha Hauer
@ 2011-01-17 10:22 ` Sascha Hauer
  2011-01-17 17:56   ` [PATCH 2/4 v2] " Sascha Hauer
  2011-01-17 10:22 ` [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
  2011-01-17 10:22 ` [PATCH 4/4] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer
  3 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:22 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-stm/include/mach/fb.h |    3 +++
 drivers/video/stm.c                 |   17 ++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-stm/include/mach/fb.h b/arch/arm/mach-stm/include/mach/fb.h
index 65e3be2..2eade76 100644
--- a/arch/arm/mach-stm/include/mach/fb.h
+++ b/arch/arm/mach-stm/include/mach/fb.h
@@ -37,6 +37,9 @@ struct imx_fb_videomode {
 
 	unsigned dotclk_delay;	/**< refer manual HW_LCDIF_VDCTRL4 register */
 	unsigned ld_intf_width;	/**< refer STMLCDIF_* macros */
+
+	void *fixed_screen;	/**< if != NULL use this as framebuffer memory */
+	unsigned fixed_screen_size; /**< framebuffer memory size for fixed_screen */
 };
 
 #endif /* __MACH_FB_H */
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index ecf450c..a665850 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -298,11 +298,18 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	size = calc_line_length(mode->xres, fb_info->bits_per_pixel) *
 		mode->yres;
 
-	fb_info->screen_base = realloc(fb_info->screen_base, size);
-	if (!fb_info->screen_base)
-		return -ENOMEM;
-	memset(fb_info->screen_base, 0, size);
-	fbi->memory_size = size;
+	if (pdata->fixed_screen) {
+		if (pdata->fixed_screen_size < size)
+			return -ENOMEM;
+		fb_info->screen_base = pdata->fixed_screen;
+		fbi->memory_size = pdata->fixed_screen_size;
+	} else {
+		fb_info->screen_base = realloc(fb_info->screen_base, size);
+		if (!fb_info->screen_base)
+			return -ENOMEM;
+		memset(fb_info->screen_base, 0, size);
+		fbi->memory_size = size;
+	}
 
 	/** @todo ensure HCLK is active at this point of time! */
 
-- 
1.7.2.3


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address
  2011-01-17 10:22 i.MX28 patches v2 Sascha Hauer
  2011-01-17 10:22 ` [PATCH 1/4] video stm/mx2x: simplify memory allocation Sascha Hauer
  2011-01-17 10:22 ` [PATCH 2/4] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
@ 2011-01-17 10:22 ` Sascha Hauer
  2011-01-17 10:59   ` Juergen Beisert
  2011-01-17 10:22 ` [PATCH 4/4] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer
  3 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:22 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/karo-tx28/tx28-stk5.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c b/arch/arm/boards/karo-tx28/tx28-stk5.c
index 6de41f7..adad8b9 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -19,11 +19,13 @@
 #include <errno.h>
 #include <mci.h>
 #include <fec.h>
+#include <sizes.h>
 #include <asm/io.h>
 #include <mach/imx-regs.h>
 #include <mach/clock.h>
 #include <mach/mci.h>
 #include <mach/fb.h>
+#include <asm/sections.h>
 
 static struct stm_mci_platform_data mci_pdata = {
 	.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
@@ -181,11 +183,15 @@ static struct fb_videomode tx28evk_vmodes[] = {
 	},
 };
 
+#define MAX_FB_SIZE SZ_2M
+
 static struct imx_fb_videomode imxfb_mode = {
 	.mode_list = tx28evk_vmodes,
 	.mode_cnt = ARRAY_SIZE(tx28evk_vmodes),
 	.dotclk_delay = 0,	/* no adaption required */
 	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
+	.fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE),
+	.fixed_screen_size = MAX_FB_SIZE,
 };
 
 static struct device_d ldcif_dev = {
@@ -352,6 +358,12 @@ void base_board_init(void)
 	imx_set_sspclk(0, 100000000, 1);
 
 	register_device(&mci_socket);
+
+	if (imxfb_mode.fixed_screen < (void *)_end) {
+		printf("Warning: fixed_screen overlaps barebox\n");
+		imxfb_mode.fixed_screen = NULL;
+	}
+
 	register_device(&ldcif_dev);
 
 	imx_enable_enetclk();
-- 
1.7.2.3


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] ARM i.MX28 tx28 defconfig: enable MMU
  2011-01-17 10:22 i.MX28 patches v2 Sascha Hauer
                   ` (2 preceding siblings ...)
  2011-01-17 10:22 ` [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
@ 2011-01-17 10:22 ` Sascha Hauer
  3 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 10:22 UTC (permalink / raw)
  To: barebox

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/configs/tx28stk5_defconfig |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/configs/tx28stk5_defconfig b/arch/arm/configs/tx28stk5_defconfig
index 0851d5e..88ace35 100644
--- a/arch/arm/configs/tx28stk5_defconfig
+++ b/arch/arm/configs/tx28stk5_defconfig
@@ -2,6 +2,7 @@ CONFIG_ARCH_STM=y
 CONFIG_ARCH_IMX28=y
 CONFIG_AEABI=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
+CONFIG_MMU=y
 CONFIG_MALLOC_SIZE=0x800000
 CONFIG_BROKEN=y
 CONFIG_LONGHELP=y
-- 
1.7.2.3


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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address
  2011-01-17 10:22 ` [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
@ 2011-01-17 10:59   ` Juergen Beisert
  2011-01-17 22:49     ` Marc Reilly
  0 siblings, 1 reply; 10+ messages in thread
From: Juergen Beisert @ 2011-01-17 10:59 UTC (permalink / raw)
  To: barebox

Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/boards/karo-tx28/tx28-stk5.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/boards/karo-tx28/tx28-stk5.c
> b/arch/arm/boards/karo-tx28/tx28-stk5.c index 6de41f7..adad8b9 100644
> --- a/arch/arm/boards/karo-tx28/tx28-stk5.c
> +++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
> @@ -19,11 +19,13 @@
>  #include <errno.h>
>  #include <mci.h>
>  #include <fec.h>
> +#include <sizes.h>
>  #include <asm/io.h>
>  #include <mach/imx-regs.h>
>  #include <mach/clock.h>
>  #include <mach/mci.h>
>  #include <mach/fb.h>
> +#include <asm/sections.h>
>
>  static struct stm_mci_platform_data mci_pdata = {
>  	.caps = MMC_MODE_4BIT | MMC_MODE_HS | MMC_MODE_HS_52MHz,
> @@ -181,11 +183,15 @@ static struct fb_videomode tx28evk_vmodes[] = {
>  	},
>  };
>
> +#define MAX_FB_SIZE SZ_2M
> +
>  static struct imx_fb_videomode imxfb_mode = {
>  	.mode_list = tx28evk_vmodes,
>  	.mode_cnt = ARRAY_SIZE(tx28evk_vmodes),
>  	.dotclk_delay = 0,	/* no adaption required */
>  	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
> +	.fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE),
> +	.fixed_screen_size = MAX_FB_SIZE,
>  };

Question only: Any idea how we could make this setup (base address and size of 
the fixed screen) a runtime feature? This would be a nice feature like most 
modern BIOS also have: Make the size of the video memory shared with the CPU 
selectable at runtime.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/4 v2] video stm/mx2x: allow to pass in fb memory from platform data
  2011-01-17 10:22 ` [PATCH 2/4] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
@ 2011-01-17 17:56   ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2011-01-17 17:56 UTC (permalink / raw)
  To: barebox



Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---

v2: do not forget to set the framebuffer to zero in case of platform
    provided fb address

 arch/arm/mach-stm/include/mach/fb.h |    3 +++
 drivers/video/stm.c                 |   16 ++++++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-stm/include/mach/fb.h b/arch/arm/mach-stm/include/mach/fb.h
index 65e3be2..2eade76 100644
--- a/arch/arm/mach-stm/include/mach/fb.h
+++ b/arch/arm/mach-stm/include/mach/fb.h
@@ -37,6 +37,9 @@ struct imx_fb_videomode {
 
 	unsigned dotclk_delay;	/**< refer manual HW_LCDIF_VDCTRL4 register */
 	unsigned ld_intf_width;	/**< refer STMLCDIF_* macros */
+
+	void *fixed_screen;	/**< if != NULL use this as framebuffer memory */
+	unsigned fixed_screen_size; /**< framebuffer memory size for fixed_screen */
 };
 
 #endif /* __MACH_FB_H */
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index ecf450c..3ccb309 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -298,11 +298,19 @@ static int stmfb_activate_var(struct fb_info *fb_info)
 	size = calc_line_length(mode->xres, fb_info->bits_per_pixel) *
 		mode->yres;
 
-	fb_info->screen_base = realloc(fb_info->screen_base, size);
-	if (!fb_info->screen_base)
-		return -ENOMEM;
+	if (pdata->fixed_screen) {
+		if (pdata->fixed_screen_size < size)
+			return -ENOMEM;
+		fb_info->screen_base = pdata->fixed_screen;
+		fbi->memory_size = pdata->fixed_screen_size;
+	} else {
+		fb_info->screen_base = realloc(fb_info->screen_base, size);
+		if (!fb_info->screen_base)
+			return -ENOMEM;
+		fbi->memory_size = size;
+	}
+
 	memset(fb_info->screen_base, 0, size);
-	fbi->memory_size = size;
 
 	/** @todo ensure HCLK is active at this point of time! */
 
-- 
1.7.2.3

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

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address
  2011-01-17 10:59   ` Juergen Beisert
@ 2011-01-17 22:49     ` Marc Reilly
  2011-01-18  7:48       ` Peter Korsgaard
  0 siblings, 1 reply; 10+ messages in thread
From: Marc Reilly @ 2011-01-17 22:49 UTC (permalink / raw)
  To: barebox


> >  static struct imx_fb_videomode imxfb_mode = {
> >  
> >  	.mode_list = tx28evk_vmodes,
> >  	.mode_cnt = ARRAY_SIZE(tx28evk_vmodes),
> >  	.dotclk_delay = 0,	/* no adaption required */
> >  	.ld_intf_width = STMLCDIF_24BIT,	/* full 24 bit */
> > 
> > +	.fixed_screen = (void *)(0x40000000 + SZ_128M - MAX_FB_SIZE),
> > +	.fixed_screen_size = MAX_FB_SIZE,
> > 
> >  };
> 
> Question only: Any idea how we could make this setup (base address and size
> of the fixed screen) a runtime feature? This would be a nice feature like
> most modern BIOS also have: Make the size of the video memory shared with
> the CPU selectable at runtime.
> 

Purely out of interest, what is the advantage/necessity for having the frame 
buffer at a fixed address?

Cheers
Marc

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address
  2011-01-17 22:49     ` Marc Reilly
@ 2011-01-18  7:48       ` Peter Korsgaard
  2011-01-18  9:41         ` Juergen Beisert
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Korsgaard @ 2011-01-18  7:48 UTC (permalink / raw)
  To: Marc Reilly; +Cc: barebox

>>>>> "Marc" == Marc Reilly <marc@cpdesign.com.au> writes:

Hi,

 Marc> Purely out of interest, what is the advantage/necessity for
 Marc> having the frame buffer at a fixed address?

Presumably to be able to reuse the buffer in Linux for flicker free
booting.

-- 
Bye, Peter Korsgaard

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address
  2011-01-18  7:48       ` Peter Korsgaard
@ 2011-01-18  9:41         ` Juergen Beisert
  0 siblings, 0 replies; 10+ messages in thread
From: Juergen Beisert @ 2011-01-18  9:41 UTC (permalink / raw)
  To: barebox

Peter Korsgaard wrote:
> >>>>> "Marc" == Marc Reilly <marc@cpdesign.com.au> writes:
>
> Hi,
>
>  Marc> Purely out of interest, what is the advantage/necessity for
>  Marc> having the frame buffer at a fixed address?
>
> Presumably to be able to reuse the buffer in Linux for flicker free
> booting.

Yes.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-01-18  9:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-17 10:22 i.MX28 patches v2 Sascha Hauer
2011-01-17 10:22 ` [PATCH 1/4] video stm/mx2x: simplify memory allocation Sascha Hauer
2011-01-17 10:22 ` [PATCH 2/4] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
2011-01-17 17:56   ` [PATCH 2/4 v2] " Sascha Hauer
2011-01-17 10:22 ` [PATCH 3/4] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
2011-01-17 10:59   ` Juergen Beisert
2011-01-17 22:49     ` Marc Reilly
2011-01-18  7:48       ` Peter Korsgaard
2011-01-18  9:41         ` Juergen Beisert
2011-01-17 10:22 ` [PATCH 4/4] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.