.abort-ev7.o.cmd
.board-mapphone-emu_uart.o.cmd
+.boot.ko.cmd
+.boot.mod.o.cmd
+.boot.o.cmd
+.boot_usb.o.cmd
.cache-v7.o.cmd
.copypage-v6.o.cmd
.core.o.cmd
Module.symvers
abort-ev7.o
board-mapphone-emu_uart.o
+boot.ko
+boot.mod.c
+boot.mod.o
+boot.o
+boot_usb.o
cache-v7.o
copypage-v6.o
core.o
EXTRA_CFLAGS += -DCONFIG_KEXEC -Wall -DSYS_CALL_TABLE=0x$(SYS_CALL_TABLE) -DKERNEL_RESTART_PREPARE=0x$(KERNEL_RESTART_PREPARE)
-obj-m += kexec_load.o headphone_cons.o
+obj-m += kexec_load.o headphone_cons.o boot.o
kexec_load-objs := kexec.o machine_kexec.o mmu.o sys.o core.o relocate_kernel.o \
proc-v7.o tlb-v7.o cache-v7.o abort-ev7.o pabort-v7.o copypage-v6.o driver_sys.o
headphone_cons-objs := hs_cons.o omap2_serial.o board-mapphone-emu_uart.o
+boot-objs := boot_usb.o
all:
PATH=$(CROSS_PATH):$(PATH) CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH) make -C $(KDIR) M=$(PWD) modules
}
/*
- * c01fcb98 T cpcap_regacc_read
- * c01fcc04 T cpcap_regacc_write
+ * c021544c T cpcap_regacc_read
+ * c02154b8 T cpcap_regacc_write
*/
static int (*my_cpcap_regacc_read)(struct cpcap_device *, enum cpcap_reg, unsigned short *) =
- (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short *))0xc01fcb98;
+ (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short *))0xc021544c;
static int (*my_cpcap_regacc_write)(struct cpcap_device *, enum cpcap_reg, unsigned short, unsigned short) =
- (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short, unsigned short))0xc01fcc04;
+ (int (*)(struct cpcap_device *, enum cpcap_reg, unsigned short, unsigned short))0xc02154b8;
void activate_emu_uart(void)
--- /dev/null
+/*
+ * Set software booting from USB
+ *
+ * From:
+ * http://www.droid-developers.org/wiki/How_to_load_mbmloader_from_SD_card
+ */
+
+#include <linux/module.h>
+#include <linux/gpio_mapping.h>
+#include <linux/gpio.h>
+#include <linux/platform_device.h>
+#include <linux/serial_reg.h>
+#include <linux/clk.h>
+
+#include <plat/board.h>
+#include <plat/control.h>
+#include <asm/mach/serial_omap.h>
+
+#include "prm.h"
+#include "prm-regbits-34xx.h"
+
+#define SCRATCH_MEM 0x48002910
+#define GLOBAL_REG_PRM 0x48307200
+
+static int __init boot_usb_init(void)
+{
+ void *scratch_mem, *global_reg_prm;
+
+ scratch_mem = ioremap(SCRATCH_MEM, 240);
+ global_reg_prm = ioremap(GLOBAL_REG_PRM, 256);
+
+ // Disable IRQ
+ local_irq_disable();
+ local_fiq_disable();
+
+ // Store address of booting configuration structure
+ __raw_writel(SCRATCH_MEM+0xA0, scratch_mem + 0);
+
+ // Header of booting config
+ __raw_writel(0xCF00AA01, scratch_mem + 0xA0);
+ // Size of booting config
+ __raw_writel(0xC, scratch_mem + 0xA4);
+ // First booting device is 0x11 (USB), Flags 0x00
+ __raw_writel(0x00110000, scratch_mem + 0xA8);
+ // Second is 0x11, third is 0x11
+ __raw_writel(0x00110011, scratch_mem + 0xAC);
+ // Fourth is 0x11
+ __raw_writel(0x00000011, scratch_mem + 0xB0);
+
+ // software reset
+ __raw_writel(0x04, global_reg_prm + 0x50);
+ return 0;
+}
+
+static void __exit boot_usb_exit(void)
+{
+ return;
+}
+
+
+module_init(boot_usb_init);
+module_exit(boot_usb_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Michael Gernoth <michael@gernoth.net>");
#include "prm.h"
#include "prm-regbits-34xx.h"
+#define USB_CONSOLE 1
+
+#ifndef USB_CONSOLE
static int hs_switch = -1;
+#endif
+#if 0
/*
* int add_preferred_console(char *name, int idx, char *options)
- * c0069208 T add_preferred_console
+ * c006bec0 T add_preferred_console
*/
-static int (*add_preferred_console)(char *, int, char*) = (int (*)(char*, int, char*))0xc0069208;
+static int (*add_preferred_console)(char *, int, char*) = (int (*)(char*, int, char*))0xc006bec0;
+#endif
void my_omap_serial_init(int wake_gpio_strobe, unsigned int wake_strobe_enable_mask);
int my_omap_hs_init(void);
return 0;
}
+#define OMAP_CTRL_REGADDR(reg) (OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE) + (reg))
+
+u32 omap_ctrl_readl(u16 offset)
+{
+ return __raw_readl(OMAP_CTRL_REGADDR(offset));
+}
+
static int __init headphone_cons_init(void)
{
int bpwake_strobe_gpio;
struct device *uart3 = NULL;
+ printk("CONTROL_STATUS: 0x%08x\n", omap_ctrl_readl(OMAP343X_CONTROL_STATUS));
+ //<4>[81323.057830] CONTROL_STATUS: 0x00000205
+ // 01000000101
+ // DEVICETYPE[10:8]: 010 -> Reserved (High Security)
+ // SYSBOOT[5:0]: 000101 -> MMC2 USB
+
/* Remove old uart3 device which was disabled... */
printk(KERN_INFO "Searching for omap-uart.3...\n");
uart3 = device_find_child(&platform_bus, "omap-uart.3", find_ms2_dev);
if (uart3 == NULL)
- return-ENODEV;
+ return -ENODEV;
printk(KERN_INFO "Deleting old device...\n");
device_del(uart3);
+#ifndef USB_CONSOLE
/* Get the headset switch gpio number from devtree */
hs_switch = get_gpio_by_name("headset_uart_switch");
if (hs_switch < 0)
if (!gpio_get_value(hs_switch))
return -ENODEV;
-
- printk(KERN_INFO "Activating emu_uart on mini-usb port\n");
- activate_emu_uart();
+#endif
printk(KERN_INFO "Enabling UART3...\n");
bpwake_strobe_gpio = get_gpio_by_name("ipc_bpwake_strobe");
my_omap_serial_init(bpwake_strobe_gpio, 0x01);
my_omap_hs_init();
+#ifdef USB_CONSOLE
+ printk(KERN_INFO "Activating emu_uart on mini-usb port\n");
+ activate_emu_uart();
+#else
/* route kernel uart out headset jack */
gpio_set_value(hs_switch, 0);
printk(KERN_INFO "headset_uart_switch: %d, value: %d\n", hs_switch, gpio_get_value(hs_switch));
+#endif
+#if 0
add_preferred_console("ttyS", 2, "115200");
+#endif
return 0;
}
#define OMAP_CTRL_REGADDR(reg) (OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE) + (reg))
-static int (*my_pwrdm_clkdm_state_switch)(struct clockdomain *) = (int (*)(struct clockdomain *))0xc0041370;
+static int (*my_pwrdm_clkdm_state_switch)(struct clockdomain *) = (int (*)(struct clockdomain *))0xc0042458;
void omap_ctrl_writew(u16 val, u16 offset)