All of lore.kernel.org
 help / color / mirror / Atom feed
* [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
@ 2012-03-23  6:37 ` Afzal Mohammed
  0 siblings, 0 replies; 8+ messages in thread
From: Afzal Mohammed @ 2012-03-23  6:37 UTC (permalink / raw)
  To: linux-omap, linux-arm-kernel; +Cc: Afzal Mohammed

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 arch/arm/mach-omap2/board-omap3evm.c |   82 ++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a659e19..9ed48d4 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -23,6 +23,7 @@
 #include <linux/input/matrix_keypad.h>
 #include <linux/leds.h>
 #include <linux/interrupt.h>
+#include <linux/mtd/nand.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
@@ -41,6 +42,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <plat/nand.h>
 #include <plat/board.h>
 #include <plat/usb.h>
 #include "common.h"
@@ -52,6 +54,7 @@
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "board-flash.h"
 
 #define OMAP3_EVM_TS_GPIO	175
 #define OMAP3_EVM_EHCI_VBUS	22
@@ -102,6 +105,9 @@ static void __init omap3_evm_get_revision(void)
 	}
 }
 
+#undef CONFIG_SMSC911X
+#undef CONFIG_SMSC911X_MODULE
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include <plat/gpmc-smsc911x.h>
 
@@ -533,6 +539,41 @@ static struct usbhs_omap_board_data usbhs_bdata __initdata = {
 	.reset_gpio_port[2]  = -EINVAL
 };
 
+/*
+ * NAND
+ */
+static struct mtd_partition omap3_evm_nand_partitions[] = {
+	/* All the partition sizes are listed in terms of NAND block size */
+	{
+		.name		= "X-Loader-NAND",
+		.offset		= 0,
+		.size		= 4 * (64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
+		.size		= 10 * (64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "Boot Env-NAND",
+
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x1c0000 */
+		.size		= 6 * (64 * 2048),
+	},
+	{
+		.name		= "Kernel-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
+		.size		= 40 * (64 * 2048),
+	},
+	{
+		.name		= "File System - NAND",
+		.size		= MTDPART_SIZ_FULL,
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x780000 */
+	},
+};
+
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux omap35x_board_mux[] __initdata = {
 	OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
@@ -632,8 +673,30 @@ static void __init omap3_evm_wl12xx_init(void)
 #endif
 }
 
+static struct gpmc_pdata gpmc_data;
+
+static struct resource gpmc_resources[] = {
+	{
+		.start = OMAP34XX_GPMC_BASE,
+		.end   = OMAP34XX_GPMC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device gpmc_device = {
+	.name		= "omap-gpmc",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(gpmc_resources),
+	.resource	= gpmc_resources,
+	.dev	= {
+		.platform_data = &gpmc_data,
+	}
+};
+
 static void __init omap3_evm_init(void)
 {
+	struct omap_nand_platform_data *nand_data;
+
 	omap3_evm_get_revision();
 
 	if (cpu_is_omap3630())
@@ -684,6 +747,25 @@ static void __init omap3_evm_init(void)
 	omap3evm_init_smsc911x();
 	omap3_evm_display_init();
 	omap3_evm_wl12xx_init();
+	/* NAND */
+	nand_data = omap_nand_init(omap3_evm_nand_partitions,
+			ARRAY_SIZE(omap3_evm_nand_partitions),
+			0, NAND_BUSWIDTH_16, nand_default_timings);
+	if (nand_data == NULL) {
+		pr_err("omap_nand_init() failed\n");
+		return;
+	}
+
+	gpmc_data.device_pdata = gpmc_nand_init(nand_data);
+	if (gpmc_data.device_pdata == NULL) {
+		pr_err("gpmc_nand_init() failed\n");
+		return;
+	}
+
+	gpmc_data.num_device++;
+	gpmc_data.fclk_rate = gpmc_get_fclk_period();
+
+	platform_device_register(&gpmc_device);
 }
 
 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
-- 
1.7.9.3


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

* [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
@ 2012-03-23  6:37 ` Afzal Mohammed
  0 siblings, 0 replies; 8+ messages in thread
From: Afzal Mohammed @ 2012-03-23  6:37 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Afzal Mohammed <afzal@ti.com>
---
 arch/arm/mach-omap2/board-omap3evm.c |   82 ++++++++++++++++++++++++++++++++++
 1 file changed, 82 insertions(+)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index a659e19..9ed48d4 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -23,6 +23,7 @@
 #include <linux/input/matrix_keypad.h>
 #include <linux/leds.h>
 #include <linux/interrupt.h>
+#include <linux/mtd/nand.h>
 
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
@@ -41,6 +42,7 @@
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
 
+#include <plat/nand.h>
 #include <plat/board.h>
 #include <plat/usb.h>
 #include "common.h"
@@ -52,6 +54,7 @@
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "hsmmc.h"
 #include "common-board-devices.h"
+#include "board-flash.h"
 
 #define OMAP3_EVM_TS_GPIO	175
 #define OMAP3_EVM_EHCI_VBUS	22
@@ -102,6 +105,9 @@ static void __init omap3_evm_get_revision(void)
 	}
 }
 
+#undef CONFIG_SMSC911X
+#undef CONFIG_SMSC911X_MODULE
+
 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
 #include <plat/gpmc-smsc911x.h>
 
@@ -533,6 +539,41 @@ static struct usbhs_omap_board_data usbhs_bdata __initdata = {
 	.reset_gpio_port[2]  = -EINVAL
 };
 
+/*
+ * NAND
+ */
+static struct mtd_partition omap3_evm_nand_partitions[] = {
+	/* All the partition sizes are listed in terms of NAND block size */
+	{
+		.name		= "X-Loader-NAND",
+		.offset		= 0,
+		.size		= 4 * (64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "U-Boot-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x80000 */
+		.size		= 10 * (64 * 2048),
+		.mask_flags	= MTD_WRITEABLE,	/* force read-only */
+	},
+	{
+		.name		= "Boot Env-NAND",
+
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x1c0000 */
+		.size		= 6 * (64 * 2048),
+	},
+	{
+		.name		= "Kernel-NAND",
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x280000 */
+		.size		= 40 * (64 * 2048),
+	},
+	{
+		.name		= "File System - NAND",
+		.size		= MTDPART_SIZ_FULL,
+		.offset		= MTDPART_OFS_APPEND,	/* Offset = 0x780000 */
+	},
+};
+
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux omap35x_board_mux[] __initdata = {
 	OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
@@ -632,8 +673,30 @@ static void __init omap3_evm_wl12xx_init(void)
 #endif
 }
 
+static struct gpmc_pdata gpmc_data;
+
+static struct resource gpmc_resources[] = {
+	{
+		.start = OMAP34XX_GPMC_BASE,
+		.end   = OMAP34XX_GPMC_BASE + SZ_4K - 1,
+		.flags = IORESOURCE_MEM,
+	},
+};
+
+static struct platform_device gpmc_device = {
+	.name		= "omap-gpmc",
+	.id		= -1,
+	.num_resources	= ARRAY_SIZE(gpmc_resources),
+	.resource	= gpmc_resources,
+	.dev	= {
+		.platform_data = &gpmc_data,
+	}
+};
+
 static void __init omap3_evm_init(void)
 {
+	struct omap_nand_platform_data *nand_data;
+
 	omap3_evm_get_revision();
 
 	if (cpu_is_omap3630())
@@ -684,6 +747,25 @@ static void __init omap3_evm_init(void)
 	omap3evm_init_smsc911x();
 	omap3_evm_display_init();
 	omap3_evm_wl12xx_init();
+	/* NAND */
+	nand_data = omap_nand_init(omap3_evm_nand_partitions,
+			ARRAY_SIZE(omap3_evm_nand_partitions),
+			0, NAND_BUSWIDTH_16, nand_default_timings);
+	if (nand_data == NULL) {
+		pr_err("omap_nand_init() failed\n");
+		return;
+	}
+
+	gpmc_data.device_pdata = gpmc_nand_init(nand_data);
+	if (gpmc_data.device_pdata == NULL) {
+		pr_err("gpmc_nand_init() failed\n");
+		return;
+	}
+
+	gpmc_data.num_device++;
+	gpmc_data.fclk_rate = gpmc_get_fclk_period();
+
+	platform_device_register(&gpmc_device);
 }
 
 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
-- 
1.7.9.3

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

* Re: [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
  2012-03-23  6:37 ` Afzal Mohammed
@ 2012-03-26 17:51   ` Jon Hunter
  -1 siblings, 0 replies; 8+ messages in thread
From: Jon Hunter @ 2012-03-26 17:51 UTC (permalink / raw)
  To: Afzal Mohammed; +Cc: linux-omap, linux-arm-kernel

Hi Afzal,

On 3/23/2012 1:37, Afzal Mohammed wrote:

[snip]

>   static void __init omap3_evm_init(void)
>   {
> +	struct omap_nand_platform_data *nand_data;
> +
>   	omap3_evm_get_revision();
>
>   	if (cpu_is_omap3630())
> @@ -684,6 +747,25 @@ static void __init omap3_evm_init(void)
>   	omap3evm_init_smsc911x();
>   	omap3_evm_display_init();
>   	omap3_evm_wl12xx_init();
> +	/* NAND */
> +	nand_data = omap_nand_init(omap3_evm_nand_partitions,
> +			ARRAY_SIZE(omap3_evm_nand_partitions),
> +			0, NAND_BUSWIDTH_16, nand_default_timings);
> +	if (nand_data == NULL) {
> +		pr_err("omap_nand_init() failed\n");
> +		return;
> +	}
> +
> +	gpmc_data.device_pdata = gpmc_nand_init(nand_data);
> +	if (gpmc_data.device_pdata == NULL) {
> +		pr_err("gpmc_nand_init() failed\n");
> +		return;
> +	}
> +
> +	gpmc_data.num_device++;
> +	gpmc_data.fclk_rate = gpmc_get_fclk_period();
> +
> +	platform_device_register(&gpmc_device);
>   }

I see this is marked as a temp patch, but this is actually needed to 
register the device. Actually, we would need to do this for all boards, 
right?

Rather than registering the device here, may be we should add a function 
in arch/arm/mach-omap2/devices.c called "omap_gpmc_init()" that is 
called from all of the boards files passing the pdata structure. Then 
the omap_gmpc_init() function should use omap_device_build() API to 
register the device. If you look at arch/arm/mach-omap2/devices.c you 
can look at omap4_keyboard_init() as an example. Let me know if this is 
clear.

Cheers
Jon

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

* [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
@ 2012-03-26 17:51   ` Jon Hunter
  0 siblings, 0 replies; 8+ messages in thread
From: Jon Hunter @ 2012-03-26 17:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Afzal,

On 3/23/2012 1:37, Afzal Mohammed wrote:

[snip]

>   static void __init omap3_evm_init(void)
>   {
> +	struct omap_nand_platform_data *nand_data;
> +
>   	omap3_evm_get_revision();
>
>   	if (cpu_is_omap3630())
> @@ -684,6 +747,25 @@ static void __init omap3_evm_init(void)
>   	omap3evm_init_smsc911x();
>   	omap3_evm_display_init();
>   	omap3_evm_wl12xx_init();
> +	/* NAND */
> +	nand_data = omap_nand_init(omap3_evm_nand_partitions,
> +			ARRAY_SIZE(omap3_evm_nand_partitions),
> +			0, NAND_BUSWIDTH_16, nand_default_timings);
> +	if (nand_data == NULL) {
> +		pr_err("omap_nand_init() failed\n");
> +		return;
> +	}
> +
> +	gpmc_data.device_pdata = gpmc_nand_init(nand_data);
> +	if (gpmc_data.device_pdata == NULL) {
> +		pr_err("gpmc_nand_init() failed\n");
> +		return;
> +	}
> +
> +	gpmc_data.num_device++;
> +	gpmc_data.fclk_rate = gpmc_get_fclk_period();
> +
> +	platform_device_register(&gpmc_device);
>   }

I see this is marked as a temp patch, but this is actually needed to 
register the device. Actually, we would need to do this for all boards, 
right?

Rather than registering the device here, may be we should add a function 
in arch/arm/mach-omap2/devices.c called "omap_gpmc_init()" that is 
called from all of the boards files passing the pdata structure. Then 
the omap_gmpc_init() function should use omap_device_build() API to 
register the device. If you look at arch/arm/mach-omap2/devices.c you 
can look at omap4_keyboard_init() as an example. Let me know if this is 
clear.

Cheers
Jon

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

* RE: [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
  2012-03-26 17:51   ` Jon Hunter
@ 2012-03-27  5:19     ` Mohammed, Afzal
  -1 siblings, 0 replies; 8+ messages in thread
From: Mohammed, Afzal @ 2012-03-27  5:19 UTC (permalink / raw)
  To: Hunter, Jon; +Cc: linux-omap, linux-arm-kernel

Hi Jon,

On Mon, Mar 26, 2012 at 23:21:50, Hunter, Jon wrote:
> I see this is marked as a temp patch, but this is actually needed to 
> register the device. Actually, we would need to do this for all boards, 
> right?

Yes, as NAND support on OMAP3EVM was not in mainline, made it TMP.
Once GPMC driver interfaces are acceptable, other boards too will
be modified accordingly.

> Rather than registering the device here, may be we should add a function 
> in arch/arm/mach-omap2/devices.c called "omap_gpmc_init()" that is 
> called from all of the boards files passing the pdata structure. Then 
> the omap_gmpc_init() function should use omap_device_build() API to 
> register the device. If you look at arch/arm/mach-omap2/devices.c you 
> can look at omap4_keyboard_init() as an example. Let me know if this is 
> clear.

Yes that is the final plan, i.e. once driver is ok, it has to be adapted
to HWMOD, and this will be taken care.

Regards
Afzal

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

* [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
@ 2012-03-27  5:19     ` Mohammed, Afzal
  0 siblings, 0 replies; 8+ messages in thread
From: Mohammed, Afzal @ 2012-03-27  5:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jon,

On Mon, Mar 26, 2012 at 23:21:50, Hunter, Jon wrote:
> I see this is marked as a temp patch, but this is actually needed to 
> register the device. Actually, we would need to do this for all boards, 
> right?

Yes, as NAND support on OMAP3EVM was not in mainline, made it TMP.
Once GPMC driver interfaces are acceptable, other boards too will
be modified accordingly.

> Rather than registering the device here, may be we should add a function 
> in arch/arm/mach-omap2/devices.c called "omap_gpmc_init()" that is 
> called from all of the boards files passing the pdata structure. Then 
> the omap_gmpc_init() function should use omap_device_build() API to 
> register the device. If you look at arch/arm/mach-omap2/devices.c you 
> can look at omap4_keyboard_init() as an example. Let me know if this is 
> clear.

Yes that is the final plan, i.e. once driver is ok, it has to be adapted
to HWMOD, and this will be taken care.

Regards
Afzal

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

* RE: [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
  2012-03-27  5:19     ` Mohammed, Afzal
@ 2012-03-27  5:38       ` Mohammed, Afzal
  -1 siblings, 0 replies; 8+ messages in thread
From: Mohammed, Afzal @ 2012-03-27  5:38 UTC (permalink / raw)
  To: Hunter, Jon; +Cc: linux-omap, linux-arm-kernel

Hi Jon,

On Tue, Mar 27, 2012 at 10:49:32, Mohammed, Afzal wrote:
> Hi Jon,
> 
> On Mon, Mar 26, 2012 at 23:21:50, Hunter, Jon wrote:
> > I see this is marked as a temp patch, but this is actually needed to 
> > register the device. Actually, we would need to do this for all boards, 
> > right?
> 
> Yes, as NAND support on OMAP3EVM was not in mainline, made it TMP.
> Once GPMC driver interfaces are acceptable, other boards too will
> be modified accordingly.

Forgot to add that this patch was meant for testing and as the way
platforms deal with GPMC may change, this was kept as TMP for now.

Regards
Afzal

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

* [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand
@ 2012-03-27  5:38       ` Mohammed, Afzal
  0 siblings, 0 replies; 8+ messages in thread
From: Mohammed, Afzal @ 2012-03-27  5:38 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jon,

On Tue, Mar 27, 2012 at 10:49:32, Mohammed, Afzal wrote:
> Hi Jon,
> 
> On Mon, Mar 26, 2012 at 23:21:50, Hunter, Jon wrote:
> > I see this is marked as a temp patch, but this is actually needed to 
> > register the device. Actually, we would need to do this for all boards, 
> > right?
> 
> Yes, as NAND support on OMAP3EVM was not in mainline, made it TMP.
> Once GPMC driver interfaces are acceptable, other boards too will
> be modified accordingly.

Forgot to add that this patch was meant for testing and as the way
platforms deal with GPMC may change, this was kept as TMP for now.

Regards
Afzal

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

end of thread, other threads:[~2012-03-27  5:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-23  6:37 [TMP][PATCH 5/5] OMAP3EVM: Test gpmc-nand Afzal Mohammed
2012-03-23  6:37 ` Afzal Mohammed
2012-03-26 17:51 ` Jon Hunter
2012-03-26 17:51   ` Jon Hunter
2012-03-27  5:19   ` Mohammed, Afzal
2012-03-27  5:19     ` Mohammed, Afzal
2012-03-27  5:38     ` Mohammed, Afzal
2012-03-27  5:38       ` Mohammed, Afzal

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.