]>
Commit | Line | Data |
---|---|---|
1 | /* | |
2 | * Set software booting from USB | |
3 | * | |
4 | * From: | |
5 | * http://www.droid-developers.org/wiki/How_to_load_mbmloader_from_SD_card | |
6 | */ | |
7 | ||
8 | #include <linux/module.h> | |
9 | #include <linux/gpio_mapping.h> | |
10 | #include <linux/gpio.h> | |
11 | #include <linux/platform_device.h> | |
12 | #include <linux/serial_reg.h> | |
13 | #include <linux/clk.h> | |
14 | ||
15 | #include <plat/board.h> | |
16 | #include <plat/control.h> | |
17 | #include <asm/mach/serial_omap.h> | |
18 | ||
19 | #include "prm.h" | |
20 | #include "prm-regbits-34xx.h" | |
21 | ||
22 | #define SCRATCH_MEM 0x48002910 | |
23 | #define GLOBAL_REG_PRM 0x48307200 | |
24 | ||
25 | static int __init boot_usb_init(void) | |
26 | { | |
27 | void *scratch_mem, *global_reg_prm; | |
28 | ||
29 | scratch_mem = ioremap(SCRATCH_MEM, 240); | |
30 | global_reg_prm = ioremap(GLOBAL_REG_PRM, 256); | |
31 | ||
32 | // Disable IRQ | |
33 | local_irq_disable(); | |
34 | local_fiq_disable(); | |
35 | ||
36 | // Store address of booting configuration structure | |
37 | __raw_writel(SCRATCH_MEM+0xA0, scratch_mem + 0); | |
38 | ||
39 | // Header of booting config | |
40 | __raw_writel(0xCF00AA01, scratch_mem + 0xA0); | |
41 | // Size of booting config | |
42 | __raw_writel(0xC, scratch_mem + 0xA4); | |
43 | // First booting device is 0x11 (USB), Flags 0x00 | |
44 | __raw_writel(0x00110000, scratch_mem + 0xA8); | |
45 | // Second is 0x11, third is 0x11 | |
46 | __raw_writel(0x00110011, scratch_mem + 0xAC); | |
47 | // Fourth is 0x11 | |
48 | __raw_writel(0x00000011, scratch_mem + 0xB0); | |
49 | ||
50 | // software reset | |
51 | __raw_writel(0x04, global_reg_prm + 0x50); | |
52 | return 0; | |
53 | } | |
54 | ||
55 | static void __exit boot_usb_exit(void) | |
56 | { | |
57 | return; | |
58 | } | |
59 | ||
60 | ||
61 | module_init(boot_usb_init); | |
62 | module_exit(boot_usb_exit); | |
63 | ||
64 | MODULE_LICENSE("GPL"); | |
65 | MODULE_AUTHOR("Michael Gernoth <michael@gernoth.net>"); |