[PATCH 2/3] MIPS: Alchemy: devboards: register CMA memory for Au1200 framebuffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the newly introduced CMA memory setup hook to register a few
megabytes for the Au1200/Au1300 framebuffer.

Signed-off-by: Manuel Lauss <manuel.lauss@xxxxxxxxx>
---
Tested on Db1200 and Db1300.

 arch/mips/alchemy/devboards/db1200.c | 62 +++++++++++++++++++++++-------------
 arch/mips/alchemy/devboards/db1300.c | 13 ++++++++
 2 files changed, 52 insertions(+), 23 deletions(-)

diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
index bfc2797..eb46676 100644
--- a/arch/mips/alchemy/devboards/db1200.c
+++ b/arch/mips/alchemy/devboards/db1200.c
@@ -19,6 +19,7 @@
  */
 
 #include <linux/clk.h>
+#include <linux/dma-contiguous.h>
 #include <linux/dma-mapping.h>
 #include <linux/gpio.h>
 #include <linux/i2c.h>
@@ -37,6 +38,7 @@
 #include <linux/spi/flash.h>
 #include <linux/smc91x.h>
 #include <linux/ata_platform.h>
+#include <asm/bootinfo.h>		/* plat_reserve_mem hook */
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
 #include <asm/mach-au1x00/au1xxx_dbdma.h>
@@ -128,29 +130,6 @@ static int __init db1200_detect_board(void)
 	return 1;	/* it's neither */
 }
 
-int __init db1200_board_setup(void)
-{
-	unsigned short whoami;
-
-	if (db1200_detect_board())
-		return -ENODEV;
-
-	whoami = bcsr_read(BCSR_WHOAMI);
-	switch (BCSR_WHOAMI_BOARD(whoami)) {
-	case BCSR_WHOAMI_PB1200_DDR1:
-	case BCSR_WHOAMI_PB1200_DDR2:
-	case BCSR_WHOAMI_DB1200:
-		break;
-	default:
-		return -ENODEV;
-	}
-
-	printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
-		"  Board-ID %d	Daughtercard ID %d\n", get_system_type(),
-		(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
-
-	return 0;
-}
 
 /******************************************************************************/
 
@@ -961,3 +940,40 @@ int __init db1200_dev_setup(void)
 
 	return 0;
 }
+
+static void __init db1200_reserve_mem(void)
+{
+	int ret;
+
+	/* reserve 64MB for the framebuffer (2048x2048x32 * 4 windows) */
+	ret = dma_declare_contiguous(&au1200_lcd_dev.dev, 64 << 20, 0, 0);
+	if (ret)
+		pr_err("DB1200: failed to reserve 64MB for LCD\n");
+}
+
+int __init db1200_board_setup(void)
+{
+	unsigned short whoami;
+
+	if (db1200_detect_board())
+		return -ENODEV;
+
+	whoami = bcsr_read(BCSR_WHOAMI);
+	switch (BCSR_WHOAMI_BOARD(whoami)) {
+	case BCSR_WHOAMI_PB1200_DDR1:
+	case BCSR_WHOAMI_PB1200_DDR2:
+	case BCSR_WHOAMI_DB1200:
+		break;
+	default:
+		return -ENODEV;
+	}
+
+	printk(KERN_INFO "Alchemy/AMD/RMI %s Board, CPLD Rev %d"
+		"  Board-ID %d	Daughtercard ID %d\n", get_system_type(),
+		(whoami >> 4) & 0xf, (whoami >> 8) & 0xf, whoami & 0xf);
+
+
+	plat_reserve_mem = db1200_reserve_mem;
+
+	return 0;
+}
diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c
index 751a1e2..a844c04 100644
--- a/arch/mips/alchemy/devboards/db1300.c
+++ b/arch/mips/alchemy/devboards/db1300.c
@@ -6,6 +6,7 @@
 
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
+#include <linux/dma-contiguous.h>
 #include <linux/gpio.h>
 #include <linux/gpio_keys.h>
 #include <linux/init.h>
@@ -23,6 +24,7 @@
 #include <linux/smsc911x.h>
 #include <linux/wm97xx.h>
 
+#include <asm/bootinfo.h>	/* plat_reserve_mem hook */
 #include <asm/mach-au1x00/au1000.h>
 #include <asm/mach-au1x00/gpio-au1300.h>
 #include <asm/mach-au1x00/au1100_mmc.h>
@@ -841,6 +843,15 @@ int __init db1300_dev_setup(void)
 	return platform_add_devices(db1300_dev, ARRAY_SIZE(db1300_dev));
 }
 
+static void __init db1300_reserve_mem(void)
+{
+	int ret;
+
+	/* reserve 64MB for the framebuffer (2048x2048x32 * 4 windows) */
+	ret = dma_declare_contiguous(&db1300_lcd_dev.dev, 64 << 20, 0, 0);
+	if (ret)
+		pr_err("DB1300: failed to reserve 64MB for LCD\n");
+}
 
 int __init db1300_board_setup(void)
 {
@@ -865,5 +876,7 @@ int __init db1300_board_setup(void)
 	alchemy_uart_enable(AU1300_UART1_PHYS_ADDR);
 	alchemy_uart_enable(AU1300_UART3_PHYS_ADDR);
 
+	plat_reserve_mem = db1300_reserve_mem;
+
 	return 0;
 }
-- 
2.5.3





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux