Generic gpmc-onenand initialization, v2
Subsystems (5)
Tony Lindgren
maintainercover Generic gpmc-onenand initialization, v2
Hi all,
Please ignore the previous message, I had a typo in my stg mail options..
This series creates a generic gpmc-onenand.c from the board-n800-flash.c. Eventually we should be able to use this for all boards with onenand connected.
This should allow us to start syncing up the mach-omap2/board-*.c files with mainline, and the the gpmc-onenand code into the mainline.
Testing & patches welcome to convert more boards! Adrian & Artem, could you guys please check the partition tables I created in these patches?
Regards,
Tony
---
Tony Lindgren (4):
onenand init: Pass configuration data from board-*.c files onenand init: Rename n800_* functions to gpmc_onenand_* functions onenand init: Build gpmc-onenand.o based on CONFIG_MTD_ONENAND_OMAP2 onenand init: Rename board-n800-flash.c to gpmc-onenand.c
arch/arm/mach-omap2/Makefile | 7 ++-
arch/arm/mach-omap2/board-n800.c | 49 ++++++++++++++++++++++++
arch/arm/mach-omap2/board-rx51-flash.c | 21 ----------
arch/arm/mach-omap2/board-rx51-peripherals.c | 46 +++++++++++++++++++++++
arch/arm/mach-omap2/board-rx51.c | 2 -
arch/arm/mach-omap2/gpmc-onenand.c | 53 ++++++--------------------
arch/arm/plat-omap/include/mach/board.h | 8 ----
arch/arm/plat-omap/include/mach/onenand.h | 22 +++++++++++
8 files changed, 132 insertions(+), 76 deletions(-)
delete mode 100644 arch/arm/mach-omap2/board-rx51-flash.c
rename arch/arm/mach-omap2/{board-n800-flash.c => gpmc-onenand.c} (85%)Signature · 1 line
Signature
Tony Lindgren
maintainerPATCH 1/4 onenand init: Rename board-n800-flash.c to gpmc-onenand.c
Rename board-n800-flash.c to gpmc-onenand.c.
---
arch/arm/mach-omap2/Makefile | 4 ++--
arch/arm/mach-omap2/gpmc-onenand.c | 0
2 files changed, 2 insertions(+), 2 deletions(-)
rename arch/arm/mach-omap2/{board-n800-flash.c => gpmc-onenand.c} (100%)arch/arm/mach-omap2/Makefile +2 -2
@@ -55,14 +55,14 @@ obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \ obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o \ board-apollon-mmc.o \ board-apollon-keys.o -obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o board-n800-flash.o \ +obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o gpmc-onenand.o \ board-n800-mmc.o board-n800-bt.o \ board-n800-usb.o \ board-n800-dsp.o \ board-n800-camera.o obj-$(CONFIG_MACH_NOKIA_N810) += board-n810.o obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ - board-n800-flash.o \ + gpmc-onenand.o \ board-rx51-flash.o \ board-rx51-sdram.o \ board-rx51-video.o \
arch/arm/mach-omap2/gpmc-onenand.c renamed from arch/arm/mach-omap2/board-n800-flash.c +0 -0
Tony Lindgren
maintainerPATCH 2/4 onenand init: Build gpmc-onenand.o based on CONFIG_MTD_ONENAND_OMAP2
In reply to Tony LindgrenBuild gpmc-onenand.o based on CONFIG_MTD_ONENAND_OMAP2
--- arch/arm/mach-omap2/Makefile | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/Makefile +4 -2
@@ -55,14 +55,13 @@ obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \ obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o \ board-apollon-mmc.o \ board-apollon-keys.o -obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o gpmc-onenand.o \ +obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o \ board-n800-mmc.o board-n800-bt.o \ board-n800-usb.o \ board-n800-dsp.o \ board-n800-camera.o obj-$(CONFIG_MACH_NOKIA_N810) += board-n810.o obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ - gpmc-onenand.o \ board-rx51-flash.o \ board-rx51-sdram.o \ board-rx51-video.o \
@@ -79,6 +78,9 @@ obj-$(CONFIG_MACH_OMAP3_PANDORA) += board-omap3pandora.o \ obj-$(CONFIG_USB_MUSB_SOC) += usb-musb.o obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o +onenand-$(CONFIG_MTD_ONENAND_OMAP2) := gpmc-onenand.o +obj-y += $(onenand-m) $(onenand-y) + ifneq ($(CONFIG_USB_EHCI_HCD),) obj-y += usb-ehci.o endif
Tony Lindgren
maintainerPATCH 3/4 onenand init: Rename n800_* functions to gpmc_onenand_* functions
In reply to Tony LindgrenRename n800_* functions to gpmc_onenand_* functions
--- arch/arm/mach-omap2/Makefile | 1 - arch/arm/mach-omap2/board-n800.c | 2 +- arch/arm/mach-omap2/board-rx51-flash.c | 21 ------------------- arch/arm/mach-omap2/board-rx51.c | 4 ++-- arch/arm/mach-omap2/gpmc-onenand.c | 32 +++++++++++++++-------------- arch/arm/plat-omap/include/mach/onenand.h | 12 +++++++++++ 6 files changed, 31 insertions(+), 41 deletions(-) delete mode 100644 arch/arm/mach-omap2/board-rx51-flash.c
arch/arm/mach-omap2/Makefile +0 -1
@@ -62,7 +62,6 @@ obj-$(CONFIG_MACH_NOKIA_N800) += board-n800.o \ board-n800-camera.o obj-$(CONFIG_MACH_NOKIA_N810) += board-n810.o obj-$(CONFIG_MACH_NOKIA_RX51) += board-rx51.o \ - board-rx51-flash.o \ board-rx51-sdram.o \ board-rx51-video.o \ board-rx51-peripherals.o \
arch/arm/mach-omap2/board-n800.c +1 -1
@@ -689,7 +689,7 @@ void __init nokia_n800_common_init(void) {platform_add_devices (n800_devices,ARRAY_SIZE (n800_devices)); -n800_flash_init (); +gpmc_onenand_init ();n800_mmc_init ();n800_bt_init ();n800_dsp_init ();
arch/arm/mach-omap2/board-rx51-flash.c deleted +0 -21
@@ -1,21 +0,0 @@ -/* -* linux/arch/arm/mach-omap2/board-rx51-flash.c -* -* Copyright (C) 2008 Nokia -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -*/ - -#include <linux/kernel.h> -#include <linux/init.h> -#include <mach/board-rx51.h> - -extern void __init n800_flash_init (void ); - -void __init rx51_flash_init (void ) -{ -n800_flash_init (); -} -
arch/arm/mach-omap2/board-rx51.c +2 -2
@@ -30,6 +30,7 @@#include <mach/dma.h> #include <mach/gpmc.h> #include <mach/usb.h> +#include <mach/onenand.h> #include <mach/board-rx51.h> static struct omap_uart_config rx51_uart_config = {
@@ -67,7 +68,6 @@ static void __init rx51_init_irq(void)omap_gpio_init (); } -extern void __init rx51_flash_init (void );extern void __init rx51_peripherals_init (void );extern void __init rx51_video_init (void );
@@ -77,7 +77,7 @@ static void __init rx51_init(void) omap_board_config_size =ARRAY_SIZE (rx51_config);omap_serial_init ();usb_musb_init (); -rx51_flash_init (); +gpmc_onenand_init ();rx51_peripherals_init ();rx51_video_init (); }
arch/arm/mach-omap2/gpmc-onenand.c +16 -16
@@ -19,22 +19,22 @@#include <mach/board.h> #include <mach/gpmc.h> -struct mtd_partition n800_partitions[ONENAND_MAX_PARTITIONS ]; +struct mtd_partition gpmc_onenand_partitions[ONENAND_MAX_PARTITIONS ]; -int n800_onenand_setup (void __iomem *,int freq); +int gpmc_onenand_setup (void __iomem *,int freq); -static struct omap_onenand_platform_data n800_onenand_data = { +static struct omap_onenand_platform_data gpmc_onenand_data = { .cs =0 , - .parts = n800_partitions, + .parts = gpmc_onenand_partitions, .nr_parts =0 ,/* filled later */ - .onenand_setup = n800_onenand_setup, + .onenand_setup = gpmc_onenand_setup, }; -static struct platform_device n800_onenand_device = { +static struct platform_device gpmc_onenand_device = { .name ="omap2-onenand" , .id =-1 , .dev = { - .platform_data = &n800_onenand_data, + .platform_data = &gpmc_onenand_data, }, };
@@ -305,10 +305,10 @@ static int omap2_onenand_set_sync_mode(int cs, void __iomem *onenand_base,return 0 ; } -int n800_onenand_setup (void __iomem *onenand_base,int freq) +int gpmc_onenand_setup (void __iomem *onenand_base,int freq) { -struct omap_onenand_platform_data *datap = &n800_onenand_data; -struct device *dev = &n800_onenand_device.dev; +struct omap_onenand_platform_data *datap = &gpmc_onenand_data; +struct device *dev = &gpmc_onenand_device.dev;/* Set sync timings in GPMC */ if (omap2_onenand_set_sync_mode (datap->cs, onenand_base, freq) <0 ) {
@@ -319,30 +319,30 @@ int n800_onenand_setup(void __iomem *onenand_base, int freq)return 0 ; } -void __init n800_flash_init (void ) +void __init gpmc_flash_init (void ) {const struct omap_partition_config *part;int i =0 ; - n800_onenand_data.gpio_irq =cpu_is_omap34xx () ?65 :26 ; + gpmc_onenand_data.gpio_irq =cpu_is_omap34xx () ?65 :26 ;while ((part =omap_get_nr_config (OMAP_TAG_PARTITION , struct omap_partition_config, i)) != NULL) {struct mtd_partition *mpart; - mpart = n800_partitions + i; + mpart = gpmc_onenand_partitions + i; mpart->name = (char *) part->name; mpart->size = part->size; mpart->offset = part->offset; mpart->mask_flags = part->mask_flags; i++; -if (i ==ARRAY_SIZE (n800_partitions)) { +if (i ==ARRAY_SIZE (gpmc_onenand_partitions)) {printk (KERN_ERR "Too many partitions supplied\n" );return ; } } - n800_onenand_data.nr_parts = i; -if (platform_device_register (&n800_onenand_device) <0 ) { + gpmc_onenand_data.nr_parts = i; +if (platform_device_register (&gpmc_onenand_device) <0 ) {printk (KERN_ERR "Unable to register OneNAND device\n" );return ; }
arch/arm/plat-omap/include/mach/onenand.h +12 -0
@@ -23,3 +23,15 @@ struct omap_onenand_platform_data {int omap2_onenand_rephase (void );#define ONENAND_MAX_PARTITIONS 8 + +#if defined(CONFIG_MTD_ONENAND ) || defined(CONFIG_MTD_ONENAND_MODULE ) + +extern void gpmc_onenand_init (void ); + +#else + +static inline void gpmc_onenand_init (void ) +{ +} + +#endif
Tony Lindgren
maintainerPATCH 4/4 onenand init: Pass configuration data from board-*.c files
In reply to Tony LindgrenPass configuration data from board-*.c files.
Also remove support for the OMAP_TAG_PARTITION tag. If the partition info is passed, it should be passed from cmdline, and probably should be done in a generic way in the drivers/mtd.
--- arch/arm/mach-omap2/board-n800.c | 49 +++++++++++++++++++++++++- arch/arm/mach-omap2/board-rx51-peripherals.c | 46 ++++++++++++++++++++++++ arch/arm/mach-omap2/board-rx51.c | 2 - arch/arm/mach-omap2/gpmc-onenand.c | 47 +++++-------------------- arch/arm/plat-omap/include/mach/board.h | 8 ---- arch/arm/plat-omap/include/mach/onenand.h | 16 +++++++- 6 files changed, 116 insertions(+), 52 deletions(-)
arch/arm/mach-omap2/board-n800.c +48 -1
@@ -41,6 +41,7 @@#include <mach/gpio-switch.h> #include <mach/omapfb.h> #include <mach/blizzard.h> +#include <mach/onenand.h> #include <mach/board-nokia.h> #include <../drivers/cbus/tahvo.h>
@@ -685,11 +686,55 @@ static struct i2c_board_info __initdata_or_module n810_i2c_board_info_2[] = { }, }; +#if defined(CONFIG_MTD_ONENAND_OMAP2 ) || defined(CONFIG_MTD_ONENAND_OMAP2_MODULE ) + +static struct mtd_partition onenand_partitions[] = { + { + .name ="bootloader" , + .offset =0 , + .size =0x20000 , + .mask_flags =MTD_WRITEABLE ,/* Force read-only */ + }, + { + .name ="config" , + .offset =MTDPART_OFS_APPEND , + .size =0x60000 , + }, + { + .name ="kernel" , + .offset =MTDPART_OFS_APPEND , + .size =0x200000 , + }, + { + .name ="initfs" , + .offset =MTDPART_OFS_APPEND , + .size =0x400000 , + }, + { + .name ="rootfs" , + .offset =MTDPART_OFS_APPEND , + .size =MTDPART_SIZ_FULL , + }, +}; + +static struct omap_onenand_platform_data board_onenand_data = { + .cs =0 , + .gpio_irq =26 , + .parts = onenand_partitions, + .nr_parts =ARRAY_SIZE (onenand_partitions), +}; + +static void __init board_onenand_init (void ) +{ +gpmc_onenand_init (&board_onenand_data); +} + +#endif +void __init nokia_n800_common_init (void ) {platform_add_devices (n800_devices,ARRAY_SIZE (n800_devices)); -gpmc_onenand_init ();n800_mmc_init ();n800_bt_init ();n800_dsp_init ();
@@ -717,6 +762,7 @@ void __init nokia_n800_common_init(void)mipid_dev_init ();blizzard_dev_init (); +board_onenand_init (); }static void __init nokia_n800_init (void )
@@ -728,6 +774,7 @@ static void __init nokia_n800_init(void)tea5761_dev_init ();omap_register_gpio_switches (n800_gpio_switches,ARRAY_SIZE (n800_gpio_switches)); +board_onenand_init (); }void __init nokia_n800_map_io (void )
arch/arm/mach-omap2/board-rx51-peripherals.c +46 -0
63 lines not on this page · raw message
arch/arm/mach-omap2/board-rx51.c +0 -2
@@ -30,7 +30,6 @@#include <mach/dma.h> #include <mach/gpmc.h> #include <mach/usb.h> -#include <mach/onenand.h> #include <mach/board-rx51.h> static struct omap_uart_config rx51_uart_config = {
@@ -77,7 +76,6 @@ static void __init rx51_init(void) omap_board_config_size =ARRAY_SIZE (rx51_config);omap_serial_init ();usb_musb_init (); -gpmc_onenand_init ();rx51_peripherals_init ();rx51_video_init (); }
arch/arm/mach-omap2/gpmc-onenand.c +9 -38
74 lines not on this page · raw message
arch/arm/plat-omap/include/mach/board.h +0 -8
@@ -125,14 +125,6 @@ struct omap_tmp105_config {int (* set_power)(int enable); }; -struct omap_partition_config { -char name[16 ]; -unsigned int size; -unsigned int offset; -/* same as in include/linux/mtd/partitions.h */ -unsigned int mask_flags; -}; -struct omap_flash_part_str_config {char part_table[0 ]; };
arch/arm/plat-omap/include/mach/onenand.h +13 -3
@@ -9,8 +9,11 @@* published by the Free Software Foundation. */ +#include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> +#ifndef __ASM_ARCH_OMAP_ONENAND_H__ + struct omap_onenand_platform_data { int cs; int gpio_irq;
@@ -24,14 +27,21 @@ int omap2_onenand_rephase(void);#define ONENAND_MAX_PARTITIONS 8 -#if defined(CONFIG_MTD_ONENAND ) || defined(CONFIG_MTD_ONENAND_MODULE ) +#if defined(CONFIG_MTD_ONENAND_OMAP2 ) || defined(CONFIG_MTD_ONENAND_OMAP2_MODULE ) -extern void gpmc_onenand_init (void ); +extern void gpmc_onenand_init (struct omap_onenand_platform_data *d);#else -static inline void gpmc_onenand_init (void ) +#define board_onenand_data NULL + +static inline void board_onenand_init (void ) +{ +} + +static inline void gpmc_onenand_init (struct omap_onenand_platform_data *d) { }#endif +#endif
Tony Lindgren
maintainer[PATCH 5/4] onenand init: Debug patch to print out the onenand partitions from bootloader
FYI, here's the debug patch I used to dump the ATAG partitions.
Tony
Quoted 1 line
From
b65441b89ae7003adb983ac2f225f0bc1ddfba76Mon Sep 17 00:00:00 2001
From: Tony Lindgren <[email protected]>
Date: Wed, 29 Apr 2009 14:52:20 -0700
Subject: [PATCH] onenand init: Debug patch to print out the onenand partitions from bootloader
Not for merging
arch/arm/mach-omap2/board-n800.c +1 -0
@@ -726,6 +726,7 @@ static struct omap_onenand_platform_data board_onenand_data = {static void __init board_onenand_init (void ) { +gpmc_set_atag_partitions (onenand_partitions,ONENAND_MAX_PARTITIONS );gpmc_onenand_init (&board_onenand_data); }
arch/arm/mach-omap2/board-rx51-peripherals.c +1 -0
@@ -519,6 +519,7 @@ static struct omap_onenand_platform_data board_onenand_data = {static void __init board_onenand_init (void ) { +gpmc_set_atag_partitions (onenand_partitions,ONENAND_MAX_PARTITIONS );gpmc_onenand_init (&board_onenand_data); }
arch/arm/mach-omap2/gpmc-onenand.c +27 -0
@@ -327,3 +327,30 @@ void __init gpmc_onenand_init(struct omap_onenand_platform_data *_onenand_data)return ; } } + +void __init gpmc_set_atag_partitions (struct mtd_partition *parts,int nr_parts) +{ +const struct omap_partition_config *part; +int i =0 ; + +while ((part =omap_get_nr_config (OMAP_TAG_PARTITION , + struct omap_partition_config, i)) != NULL) { +struct mtd_partition *mpart; + + mpart = parts; + mpart->name = (char *)part->name; + mpart->size = part->size; + mpart->offset = part->offset; + mpart->mask_flags = part->mask_flags; +printk (KERN_INFO "Partition%i\n" , i); +printk (KERN_INFO "\t{\n" ); +printk (KERN_INFO "\t\t.name\t\t= \"%s\",\n" , mpart->name); +printk (KERN_INFO "\t\t.offset\t\t= 0x%llx,\n" , mpart->offset); +printk (KERN_INFO "\t\t.size\t\t= 0x%llx,\n" , mpart->size); +printk (KERN_INFO "\t\t.mask_flags\t= 0x%x,\n" , + mpart->mask_flags); +printk (KERN_INFO "\t},\n" ); + i++; + parts++; + } +}
arch/arm/plat-omap/include/mach/board.h +8 -0
@@ -125,6 +125,14 @@ struct omap_tmp105_config {int (* set_power)(int enable); }; +struct omap_partition_config { +char name[16 ]; +unsigned int size; +unsigned int offset; +/* same as in include/linux/mtd/partitions.h */ +unsigned int mask_flags; +}; +struct omap_flash_part_str_config {char part_table[0 ]; };
arch/arm/plat-omap/include/mach/onenand.h +7 -0
@@ -30,6 +30,8 @@ int omap2_onenand_rephase(void);#if defined(CONFIG_MTD_ONENAND_OMAP2 ) || defined(CONFIG_MTD_ONENAND_OMAP2_MODULE )extern void gpmc_onenand_init (struct omap_onenand_platform_data *d); +extern void gpmc_set_atag_partitions (struct mtd_partition *parts, +int nr_parts);#else
@@ -43,5 +45,10 @@ static inline void gpmc_onenand_init(struct omap_onenand_platform_data *d) { } +static inline void gpmc_set_atag_partitions (struct mtd_partition *parts, +int nr_parts) +{ +} +#endif #endif
Adrian Hunter
NAKRe: [PATCH 4/4] onenand init: Pass configuration data from board-*.c files
In reply to Tony LindgrenQuoted 9 lines · Tony Lindgren
Pass configuration data from board-*.c files.
Also remove support for the
OMAP_TAG_PARTITIONtag. If the partition info is passed, it should be passed from cmdline, and probably should be done in a generic way in thedrivers/mtd.Signed-off-by Tony Lindgren <[email protected]>---
NAK
This would break all our flashing infrastructure.
Tony Lindgren
maintainerRe: [PATCH 4/4] onenand init: Pass configuration data from board-*.c files
Quoted 8 lines · Adrian Hunter
Quoted 7 lines · Tony Lindgren
Pass configuration data from board-*.c files.
Also remove support for the
OMAP_TAG_PARTITIONtag. If the partition info is passed, it should be passed from cmdline, and probably should be done in a generic way in thedrivers/mtd.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Tony Lindgren <[email protected]>---
NAK
This would break all our flashing infrastructure.
The OMAP_TAG_PARTITION and others will have to go, the omap tags have been rejected several times by RMK.
The right solution is to follow Linux standards and pass the options from the cmdline.
Tony