aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch
diff options
context:
space:
mode:
authorFlorian Fainelli <florian@openwrt.org>2009-09-01 15:36:04 +0000
committerFlorian Fainelli <florian@openwrt.org>2009-09-01 15:36:04 +0000
commitfe06ed1aaf82a055de0f0ef722ace971aeab0812 (patch)
tree8d93ba57656f4bc20cdc535d741fd53f7fd0be88 /target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch
parentcd736b93929980d9364a24e0a4f1a06a3d03353d (diff)
downloadupstream-fe06ed1aaf82a055de0f0ef722ace971aeab0812.tar.gz
upstream-fe06ed1aaf82a055de0f0ef722ace971aeab0812.tar.bz2
upstream-fe06ed1aaf82a055de0f0ef722ace971aeab0812.zip
[olpc] add experimental 2.6.30 support
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@17459 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch')
-rw-r--r--target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch210
1 files changed, 210 insertions, 0 deletions
diff --git a/target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch b/target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch
new file mode 100644
index 0000000000..12165b52b5
--- /dev/null
+++ b/target/linux/olpc/patches-2.6.30/300-block2mtd_init.patch
@@ -0,0 +1,210 @@
+--- a/arch/x86/kernel/vmlinux_32.lds.S
++++ b/arch/x86/kernel/vmlinux_32.lds.S
+@@ -136,6 +136,12 @@ SECTIONS
+ INITCALLS
+ __initcall_end = .;
+ }
++ .root_initcall.init : AT(ADDR(.root_initcall.init) - LOAD_OFFSET) {
++ __root_initcall_start = .;
++ INITCALLS_ROOT
++ __root_initcall_end = .;
++ }
++
+ .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
+ __con_initcall_start = .;
+ *(.con_initcall.init)
+--- a/drivers/mtd/devices/block2mtd.c
++++ b/drivers/mtd/devices/block2mtd.c
+@@ -18,10 +18,18 @@
+ #include <linux/buffer_head.h>
+ #include <linux/mutex.h>
+ #include <linux/mount.h>
++#include <linux/list.h>
++#include <linux/delay.h>
+
+ #define ERROR(fmt, args...) printk(KERN_ERR "block2mtd: " fmt "\n" , ## args)
+ #define INFO(fmt, args...) printk(KERN_INFO "block2mtd: " fmt "\n" , ## args)
+
++struct retry {
++ struct list_head list;
++ const char *val;
++};
++
++static LIST_HEAD(retry_list);
+
+ /* Info for the block device */
+ struct block2mtd_dev {
+@@ -33,10 +41,34 @@ struct block2mtd_dev {
+ char devname[0];
+ };
+
++static int block2mtd_setup2(const char *val);
+
+ /* Static info about the MTD, used in cleanup_module */
+ static LIST_HEAD(blkmtd_device_list);
+
++static int add_retry(const char *val) {
++ struct retry *r = kmalloc(sizeof(struct retry), GFP_KERNEL);
++
++ INIT_LIST_HEAD(&r->list);
++ r->val = val;
++ list_add(&r->list, &retry_list);
++
++ return 0;
++}
++
++static int __init process_retries(void) {
++ struct list_head *p, *tmp;
++
++ list_for_each_safe(p, tmp, &retry_list) {
++ struct retry *r = list_entry(p, struct retry, list);
++ block2mtd_setup2(r->val);
++ msleep(100);
++ list_del(p);
++ kfree(r);
++ }
++ return 0;
++}
++rootfs_initcall(process_retries);
+
+ static struct page *page_read(struct address_space *mapping, int index)
+ {
+@@ -510,7 +542,9 @@ static int block2mtd_setup2(const char *
+ if (token[2] && (strlen(token[2]) + 1 > 80))
+ parse_err("mtd device name too long");
+
+- add_device(name, erase_size, token[2]);
++ if (add_device(name, erase_size, token[2]) == NULL) {
++ add_retry(val);
++ }
+
+ return 0;
+ }
+--- a/include/asm-generic/vmlinux.lds.h
++++ b/include/asm-generic/vmlinux.lds.h
+@@ -447,12 +447,14 @@
+ *(.initcall4s.init) \
+ *(.initcall5.init) \
+ *(.initcall5s.init) \
+- *(.initcallrootfs.init) \
+ *(.initcall6.init) \
+ *(.initcall6s.init) \
+ *(.initcall7.init) \
+ *(.initcall7s.init)
+
++#define INITCALLS_ROOT \
++ *(.initcallrootfs.init)
++
+ /**
+ * PERCPU_VADDR - define output section for percpu area
+ * @vaddr: explicit base address (optional)
+--- a/init/do_mounts.c
++++ b/init/do_mounts.c
+@@ -176,16 +176,8 @@ static int __init fs_names_setup(char *s
+ return 1;
+ }
+
+-static unsigned int __initdata root_delay;
+-static int __init root_delay_setup(char *str)
+-{
+- root_delay = simple_strtoul(str, NULL, 0);
+- return 1;
+-}
+-
+ __setup("rootflags=", root_data_setup);
+ __setup("rootfstype=", fs_names_setup);
+-__setup("rootdelay=", root_delay_setup);
+
+ static void __init get_fs_names(char *page)
+ {
+@@ -365,23 +357,6 @@ void __init prepare_namespace(void)
+ {
+ int is_floppy;
+
+- if (root_delay) {
+- printk(KERN_INFO "Waiting %dsec before mounting root device...\n",
+- root_delay);
+- ssleep(root_delay);
+- }
+-
+- /*
+- * wait for the known devices to complete their probing
+- *
+- * Note: this is a potential source of long boot delays.
+- * For example, it is not atypical to wait 5 seconds here
+- * for the touchpad of a laptop to initialize.
+- */
+- wait_for_device_probe();
+-
+- md_run_setup();
+-
+ if (saved_root_name[0]) {
+ root_device_name = saved_root_name;
+ if (!strncmp(root_device_name, "mtd", 3) ||
+--- a/init/main.c
++++ b/init/main.c
+@@ -76,6 +76,7 @@
+ #ifdef CONFIG_X86_LOCAL_APIC
+ #include <asm/smp.h>
+ #endif
++#include "do_mounts.h"
+
+ static int kernel_init(void *);
+
+@@ -752,12 +753,13 @@ int do_one_initcall(initcall_t fn)
+
+
+ extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
++extern initcall_t __root_initcall_start[], __root_initcall_end[];
+
+-static void __init do_initcalls(void)
++static void __init do_initcalls(initcall_t *start, initcall_t *end)
+ {
+ initcall_t *call;
+
+- for (call = __early_initcall_end; call < __initcall_end; call++)
++ for (call = start; call < end; call++)
+ do_one_initcall(*call);
+
+ /* Make sure there is no pending stuff from the initcall sequence */
+@@ -779,7 +781,7 @@ static void __init do_basic_setup(void)
+ usermodehelper_init();
+ driver_init();
+ init_irq_proc();
+- do_initcalls();
++ do_initcalls(__early_initcall_end, __initcall_end);
+ }
+
+ static void __init do_pre_smp_initcalls(void)
+@@ -840,6 +842,13 @@ static noinline int init_post(void)
+ panic("No init found. Try passing init= option to kernel.");
+ }
+
++static unsigned int __initdata root_delay;
++static int __init root_delay_setup(char *str)
++{
++ root_delay = simple_strtoul(str, NULL, 0);
++ return 1;
++}
++__setup("rootdelay=", root_delay_setup);
+ static int __init kernel_init(void * unused)
+ {
+ lock_kernel();
+@@ -879,7 +888,16 @@ static int __init kernel_init(void * unu
+
+ if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
+ ramdisk_execute_command = NULL;
+- prepare_namespace();
++ if (root_delay) {
++ printk(KERN_INFO "Waiting %desc before mounting root device...\n",
++ root_delay);
++ ssleep(root_delay);
++ }
++ while (driver_probe_done() != 0)
++ msleep(100);
++ md_run_setup();
++ do_initcalls(__root_initcall_start, __root_initcall_end);
++ prepare_namespace();
+ }
+
+ /*