]> git.zerfleddert.de Git - ms2-kexec/commitdiff
update offsets to new european GB kernel, set software booting from USB master
authorMichael Gernoth <michael@gernoth.net>
Fri, 20 Jan 2012 15:43:16 +0000 (16:43 +0100)
committerMichael Gernoth <michael@gernoth.net>
Fri, 20 Jan 2012 15:43:16 +0000 (16:43 +0100)
.gitignore
Makefile
board-mapphone-emu_uart.c
boot_usb.c [new file with mode: 0644]
hs_cons.c
omap2_serial.c

index fb191eca765300dc145ae52d40db2c05f40dd73e..5598ab39282c792aa488db8a65671673c46c99e6 100644 (file)
@@ -1,5 +1,9 @@
 .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
index af055c910ae33b6135e38098be3f3cda6eb4fd1a..0b62e2715ea262de38556992e6c07fedd5a5797b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -8,10 +8,11 @@ KERNEL_RESTART_PREPARE := $(shell grep ' T kernel_restart_prepare$$' $(KDIR)/Sys
 
 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
index 75752ba4c4329bff7558048f9986cf2bfd321b95..9308f150419410c157b5eac4cc53b8f16901221a 100644 (file)
@@ -550,16 +550,16 @@ static int find_ms2_dev(struct device *dev, void *data)
 }
 
 /*
- * 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)
diff --git a/boot_usb.c b/boot_usb.c
new file mode 100644 (file)
index 0000000..dae9869
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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>");
index 2aecae998524c0d837bd7692f3c7c89078c2dc4e..c5c182f59b9835965b1afe502adb8427ed96e7cf 100644 (file)
--- a/hs_cons.c
+++ b/hs_cons.c
 #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);
@@ -46,21 +52,35 @@ static int find_ms2_dev(struct device *dev, void *data)
        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)
@@ -70,9 +90,7 @@ static int __init headphone_cons_init(void)
 
        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");
@@ -82,11 +100,18 @@ static int __init headphone_cons_init(void)
        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;
 }
 
index 9d20bccbe7dd6d682ecfd6e50817ee264120892e..380e10086d441733248013abb5dd7bd12ad29c76 100644 (file)
@@ -40,7 +40,7 @@
 
 #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)
Impressum, Datenschutz