* some i.MX28 related patches
@ 2011-01-14 19:51 Sascha Hauer
2011-01-14 19:51 ` [PATCH 1/7] fec i.MX28: Make it work with MMU on Sascha Hauer
` (6 more replies)
0 siblings, 7 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 UTC (permalink / raw)
To: barebox
The following patches make the MMU usable on the tx28 board and allow
to pass in framebuffer addresses from platform data on i.MX28.
The following changes since commit 0327e12f068471dc03577407b8f8915914c2be32:
fb: update cdev map_base (2011-01-14 20:42:17 +0100)
are available in the git repository at:
none ..BRANCH.NOT.VERIFIED..
Sascha Hauer (7):
fec i.MX28: Make it work with MMU on
ARM tx28: Add mmu support
video stm/mx2x: simplify memory allocation
video stm/mx2x: allow to pass in fb memory from platform data
provide real barebox end variable
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/boards/karo-tx28/tx28.c | 23 +++++++++++++++++++++++
arch/arm/configs/tx28stk5_defconfig | 1 +
arch/arm/mach-stm/Kconfig | 1 +
arch/arm/mach-stm/include/mach/fb.h | 3 +++
drivers/net/fec_imx.c | 2 +-
drivers/video/stm.c | 31 ++++++++-----------------------
include/reloc.h | 2 +-
8 files changed, 50 insertions(+), 25 deletions(-)
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/7] fec i.MX28: Make it work with MMU on
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-14 19:51 ` [PATCH 2/7] ARM tx28: Add mmu support Sascha Hauer
` (5 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/fec_imx.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index 51cdb40..440ef1f 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -565,7 +565,7 @@ static int fec_recv(struct eth_device *dev)
if (cpu_is_mx28())
imx28_fix_endianess_rd(
- (void *)readl(&rbd->data_pointer),
+ phys_to_virt(readl(&rbd->data_pointer)),
(readw(&rbd->data_length) + 3) >> 2);
/*
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 2/7] ARM tx28: Add mmu support
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
2011-01-14 19:51 ` [PATCH 1/7] fec i.MX28: Make it work with MMU on Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-14 19:51 ` [PATCH 3/7] video stm/mx2x: simplify memory allocation Sascha Hauer
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/boards/karo-tx28/tx28.c | 23 +++++++++++++++++++++++
arch/arm/mach-stm/Kconfig | 1 +
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boards/karo-tx28/tx28.c b/arch/arm/boards/karo-tx28/tx28.c
index 6f4ef4e..5692171 100644
--- a/arch/arm/boards/karo-tx28/tx28.c
+++ b/arch/arm/boards/karo-tx28/tx28.c
@@ -21,6 +21,7 @@
#include <asm/io.h>
#include <generated/mach-types.h>
#include <mach/imx-regs.h>
+#include <asm/mmu.h>
static struct memory_platform_data ram_pdata = {
.name = "ram0",
@@ -82,6 +83,28 @@ static const uint32_t tx28_pad_setup[] = {
extern void base_board_init(void);
+#ifdef CONFIG_MMU
+static int tx28_mmu_init(void)
+{
+ mmu_init();
+
+ arm_create_section(0x40000000, 0x40000000, 128, PMD_SECT_DEF_CACHED);
+ arm_create_section(0x50000000, 0x40000000, 128, PMD_SECT_DEF_UNCACHED);
+
+ setup_dma_coherent(0x10000000);
+
+#if TEXT_BASE & (0x100000 - 1)
+#warning cannot create vector section. Adjust TEXT_BASE to a 1M boundary
+#else
+ arm_create_section(0x0, TEXT_BASE, 1, PMD_SECT_DEF_UNCACHED);
+#endif
+ mmu_enable();
+
+ return 0;
+}
+postcore_initcall(tx28_mmu_init);
+#endif
+
static int tx28_devices_init(void)
{
int i;
diff --git a/arch/arm/mach-stm/Kconfig b/arch/arm/mach-stm/Kconfig
index e47d9f1..402a9b7 100644
--- a/arch/arm/mach-stm/Kconfig
+++ b/arch/arm/mach-stm/Kconfig
@@ -55,6 +55,7 @@ choice
config MACH_TX28
bool "KARO tx28"
+ select HAVE_MMU
help
Say Y here if you are using the KARO TX28 CPU module.
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 3/7] video stm/mx2x: simplify memory allocation
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
2011-01-14 19:51 ` [PATCH 1/7] fec i.MX28: Make it work with MMU on Sascha Hauer
2011-01-14 19:51 ` [PATCH 2/7] ARM tx28: Add mmu support Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-15 15:00 ` Juergen Beisert
2011-01-14 19:51 ` [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 UTC (permalink / raw)
To: barebox
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/video/stm.c | 26 ++------------------------
1 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/drivers/video/stm.c b/drivers/video/stm.c
index f0abe4c..d2add41 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,8 @@ 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 = xrealloc(fb_info->screen_base, 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 [flat|nested] 13+ messages in thread
* [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
` (2 preceding siblings ...)
2011-01-14 19:51 ` [PATCH 3/7] video stm/mx2x: simplify memory allocation Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-15 15:04 ` Juergen Beisert
2011-01-14 19:51 ` [PATCH 5/7] provide real barebox end variable Sascha Hauer
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 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 | 11 +++++++++--
2 files changed, 12 insertions(+), 2 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 d2add41..fc90b6a 100644
--- a/drivers/video/stm.c
+++ b/drivers/video/stm.c
@@ -298,8 +298,15 @@ 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 = xrealloc(fb_info->screen_base, 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 = xrealloc(fb_info->screen_base, 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 [flat|nested] 13+ messages in thread
* [PATCH 5/7] provide real barebox end variable
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
` (3 preceding siblings ...)
2011-01-14 19:51 ` [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-15 1:50 ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-14 19:51 ` [PATCH 6/7] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
2011-01-14 19:51 ` [PATCH 7/7] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer
6 siblings, 1 reply; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 UTC (permalink / raw)
To: barebox
Sometimes it's useful to have the memory end address barebox uses.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
include/reloc.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/reloc.h b/include/reloc.h
index 22cb886..a0bf15f 100644
--- a/include/reloc.h
+++ b/include/reloc.h
@@ -1,7 +1,7 @@
#ifndef __RELOC_H
#define __RELOC_H
-extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base;
+extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base, _end;
#ifdef CONFIG_HAS_EARLY_INIT
--
1.7.2.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 6/7] ARM i.MX28 tx28: use a fixed framebuffer address
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
` (4 preceding siblings ...)
2011-01-14 19:51 ` [PATCH 5/7] provide real barebox end variable Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
2011-01-14 19:51 ` [PATCH 7/7] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer
6 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 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..b4dd65d 100644
--- a/arch/arm/boards/karo-tx28/tx28-stk5.c
+++ b/arch/arm/boards/karo-tx28/tx28-stk5.c
@@ -19,6 +19,8 @@
#include <errno.h>
#include <mci.h>
#include <fec.h>
+#include <sizes.h>
+#include <reloc.h>
#include <asm/io.h>
#include <mach/imx-regs.h>
#include <mach/clock.h>
@@ -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 [flat|nested] 13+ messages in thread
* [PATCH 7/7] ARM i.MX28 tx28 defconfig: enable MMU
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
` (5 preceding siblings ...)
2011-01-14 19:51 ` [PATCH 6/7] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
@ 2011-01-14 19:51 ` Sascha Hauer
6 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-14 19:51 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 [flat|nested] 13+ messages in thread
* Re: [PATCH 5/7] provide real barebox end variable
2011-01-14 19:51 ` [PATCH 5/7] provide real barebox end variable Sascha Hauer
@ 2011-01-15 1:50 ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-15 14:48 ` Sascha Hauer
0 siblings, 1 reply; 13+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-01-15 1:50 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
On 20:51 Fri 14 Jan , Sascha Hauer wrote:
> Sometimes it's useful to have the memory end address barebox uses.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> include/reloc.h | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/include/reloc.h b/include/reloc.h
> index 22cb886..a0bf15f 100644
> --- a/include/reloc.h
> +++ b/include/reloc.h
> @@ -1,7 +1,7 @@
> #ifndef __RELOC_H
> #define __RELOC_H
>
> -extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base;
> +extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base, _end;
how about _barebox_end
Best Regards,
J.
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 5/7] provide real barebox end variable
2011-01-15 1:50 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-01-15 14:48 ` Sascha Hauer
0 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-15 14:48 UTC (permalink / raw)
To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox
On Sat, Jan 15, 2011 at 02:50:23AM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 20:51 Fri 14 Jan , Sascha Hauer wrote:
> > Sometimes it's useful to have the memory end address barebox uses.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > include/reloc.h | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/include/reloc.h b/include/reloc.h
> > index 22cb886..a0bf15f 100644
> > --- a/include/reloc.h
> > +++ b/include/reloc.h
> > @@ -1,7 +1,7 @@
> > #ifndef __RELOC_H
> > #define __RELOC_H
> >
> > -extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base;
> > +extern unsigned long _barebox_start, _bss_start, _bss_end, _text_base, _end;
> how about _barebox_end
Agreed. I just used this name because I didn't want to change all linker
scripts, but laziness is not a good argument for introducing a global variable
with such a generic name.
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-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 3/7] video stm/mx2x: simplify memory allocation
2011-01-14 19:51 ` [PATCH 3/7] video stm/mx2x: simplify memory allocation Sascha Hauer
@ 2011-01-15 15:00 ` Juergen Beisert
2011-01-15 15:10 ` Sascha Hauer
0 siblings, 1 reply; 13+ messages in thread
From: Juergen Beisert @ 2011-01-15 15:00 UTC (permalink / raw)
To: barebox
Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/video/stm.c | 26 ++------------------------
> 1 files changed, 2 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/video/stm.c b/drivers/video/stm.c
> index f0abe4c..d2add41 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,8 @@ 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 = xrealloc(fb_info->screen_base, size);
> + fbi->memory_size = size;
>
> /** @todo ensure HCLK is active at this point of time! */
Maybe we should change here from the x-functions to an allocation routine that
returns NULL when there is not enough memory. When you define the malloc area
to small and setup an SXGA resolution with 16 bit colour depth, barebox
should IMHO bark with a useful error message than rebooting...
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] 13+ messages in thread
* Re: [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data
2011-01-14 19:51 ` [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
@ 2011-01-15 15:04 ` Juergen Beisert
0 siblings, 0 replies; 13+ messages in thread
From: Juergen Beisert @ 2011-01-15 15:04 UTC (permalink / raw)
To: barebox
Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/mach-stm/include/mach/fb.h | 3 +++
> drivers/video/stm.c | 11 +++++++++--
> 2 files changed, 12 insertions(+), 2 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 d2add41..fc90b6a 100644
> --- a/drivers/video/stm.c
> +++ b/drivers/video/stm.c
> @@ -298,8 +298,15 @@ 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 = xrealloc(fb_info->screen_base, 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 = xrealloc(fb_info->screen_base, size);
> + fbi->memory_size = size;
> + }
>
> /** @todo ensure HCLK is active at this point of time! */
Here for the case a user selects a screen resolution and colour depth that
needs more memory than available, the routine returns with an error message
for the fixed sized screen and with a reboot for the dynamic allocation case.
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] 13+ messages in thread
* Re: [PATCH 3/7] video stm/mx2x: simplify memory allocation
2011-01-15 15:00 ` Juergen Beisert
@ 2011-01-15 15:10 ` Sascha Hauer
0 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2011-01-15 15:10 UTC (permalink / raw)
To: Juergen Beisert; +Cc: barebox
On Sat, Jan 15, 2011 at 04:00:26PM +0100, Juergen Beisert wrote:
> Sascha Hauer wrote:
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> > drivers/video/stm.c | 26 ++------------------------
> > 1 files changed, 2 insertions(+), 24 deletions(-)
> >
> > diff --git a/drivers/video/stm.c b/drivers/video/stm.c
> > index f0abe4c..d2add41 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,8 @@ 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 = xrealloc(fb_info->screen_base, size);
> > + fbi->memory_size = size;
> >
> > /** @todo ensure HCLK is active at this point of time! */
>
> Maybe we should change here from the x-functions to an allocation routine that
> returns NULL when there is not enough memory. When you define the malloc area
> to small and setup an SXGA resolution with 16 bit colour depth, barebox
> should IMHO bark with a useful error message than rebooting...
Agreed.
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-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2011-01-15 15:10 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 19:51 some i.MX28 related patches Sascha Hauer
2011-01-14 19:51 ` [PATCH 1/7] fec i.MX28: Make it work with MMU on Sascha Hauer
2011-01-14 19:51 ` [PATCH 2/7] ARM tx28: Add mmu support Sascha Hauer
2011-01-14 19:51 ` [PATCH 3/7] video stm/mx2x: simplify memory allocation Sascha Hauer
2011-01-15 15:00 ` Juergen Beisert
2011-01-15 15:10 ` Sascha Hauer
2011-01-14 19:51 ` [PATCH 4/7] video stm/mx2x: allow to pass in fb memory from platform data Sascha Hauer
2011-01-15 15:04 ` Juergen Beisert
2011-01-14 19:51 ` [PATCH 5/7] provide real barebox end variable Sascha Hauer
2011-01-15 1:50 ` Jean-Christophe PLAGNIOL-VILLARD
2011-01-15 14:48 ` Sascha Hauer
2011-01-14 19:51 ` [PATCH 6/7] ARM i.MX28 tx28: use a fixed framebuffer address Sascha Hauer
2011-01-14 19:51 ` [PATCH 7/7] ARM i.MX28 tx28 defconfig: enable MMU Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox