diff options
| -rw-r--r-- | arch/x86/Kconfig.debug | 4 | ||||
| -rw-r--r-- | arch/x86/include/asm/mrst.h | 5 | ||||
| -rw-r--r-- | arch/x86/kernel/Makefile | 1 | ||||
| -rw-r--r-- | arch/x86/kernel/early_printk.c | 7 | ||||
| -rw-r--r-- | arch/x86/kernel/early_printk_mrst.c | 232 |
5 files changed, 249 insertions, 0 deletions
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index 75085080b63e..e5bb96b10f1a 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug | |||
| @@ -43,6 +43,10 @@ config EARLY_PRINTK | |||
| 43 | with klogd/syslogd or the X server. You should normally N here, | 43 | with klogd/syslogd or the X server. You should normally N here, |
| 44 | unless you want to debug such a crash. | 44 | unless you want to debug such a crash. |
| 45 | 45 | ||
| 46 | config EARLY_PRINTK_MRST | ||
| 47 | bool "Early printk for MRST platform support" | ||
| 48 | depends on EARLY_PRINTK && X86_MRST | ||
| 49 | |||
| 46 | config EARLY_PRINTK_DBGP | 50 | config EARLY_PRINTK_DBGP |
| 47 | bool "Early printk via EHCI debug port" | 51 | bool "Early printk via EHCI debug port" |
| 48 | depends on EARLY_PRINTK && PCI | 52 | depends on EARLY_PRINTK && PCI |
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h index 33fc2966beb7..d0ea5bc505a3 100644 --- a/arch/x86/include/asm/mrst.h +++ b/arch/x86/include/asm/mrst.h | |||
| @@ -10,6 +10,9 @@ | |||
| 10 | */ | 10 | */ |
| 11 | #ifndef _ASM_X86_MRST_H | 11 | #ifndef _ASM_X86_MRST_H |
| 12 | #define _ASM_X86_MRST_H | 12 | #define _ASM_X86_MRST_H |
| 13 | |||
| 14 | #include <linux/sfi.h> | ||
| 15 | |||
| 13 | extern int pci_mrst_init(void); | 16 | extern int pci_mrst_init(void); |
| 14 | int __init sfi_parse_mrtc(struct sfi_table_header *table); | 17 | int __init sfi_parse_mrtc(struct sfi_table_header *table); |
| 15 | 18 | ||
| @@ -42,4 +45,6 @@ extern enum mrst_timer_options mrst_timer_options; | |||
| 42 | #define SFI_MTMR_MAX_NUM 8 | 45 | #define SFI_MTMR_MAX_NUM 8 |
| 43 | #define SFI_MRTC_MAX 8 | 46 | #define SFI_MRTC_MAX 8 |
| 44 | 47 | ||
| 48 | extern struct console early_mrst_console; | ||
| 49 | extern void mrst_early_console_init(void); | ||
| 45 | #endif /* _ASM_X86_MRST_H */ | 50 | #endif /* _ASM_X86_MRST_H */ |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index fedf32a8c3ec..3cd01d04613d 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
| @@ -85,6 +85,7 @@ obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o | |||
| 85 | obj-$(CONFIG_KGDB) += kgdb.o | 85 | obj-$(CONFIG_KGDB) += kgdb.o |
| 86 | obj-$(CONFIG_VM86) += vm86_32.o | 86 | obj-$(CONFIG_VM86) += vm86_32.o |
| 87 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 87 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
| 88 | obj-$(CONFIG_EARLY_PRINTK_MRST) += early_printk_mrst.o | ||
| 88 | 89 | ||
| 89 | obj-$(CONFIG_HPET_TIMER) += hpet.o | 90 | obj-$(CONFIG_HPET_TIMER) += hpet.o |
| 90 | obj-$(CONFIG_APB_TIMER) += apb_timer.o | 91 | obj-$(CONFIG_APB_TIMER) += apb_timer.o |
diff --git a/arch/x86/kernel/early_printk.c b/arch/x86/kernel/early_printk.c index fa99bae75ace..6082463768a2 100644 --- a/arch/x86/kernel/early_printk.c +++ b/arch/x86/kernel/early_printk.c | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <xen/hvc-console.h> | 14 | #include <xen/hvc-console.h> |
| 15 | #include <asm/pci-direct.h> | 15 | #include <asm/pci-direct.h> |
| 16 | #include <asm/fixmap.h> | 16 | #include <asm/fixmap.h> |
| 17 | #include <asm/mrst.h> | ||
| 17 | #include <asm/pgtable.h> | 18 | #include <asm/pgtable.h> |
| 18 | #include <linux/usb/ehci_def.h> | 19 | #include <linux/usb/ehci_def.h> |
| 19 | 20 | ||
| @@ -239,6 +240,12 @@ static int __init setup_early_printk(char *buf) | |||
| 239 | if (!strncmp(buf, "xen", 3)) | 240 | if (!strncmp(buf, "xen", 3)) |
| 240 | early_console_register(&xenboot_console, keep); | 241 | early_console_register(&xenboot_console, keep); |
| 241 | #endif | 242 | #endif |
| 243 | #ifdef CONFIG_X86_MRST_EARLY_PRINTK | ||
| 244 | if (!strncmp(buf, "mrst", 4)) { | ||
| 245 | mrst_early_console_init(); | ||
| 246 | early_console_register(&early_mrst_console, keep); | ||
| 247 | } | ||
| 248 | #endif | ||
| 242 | buf++; | 249 | buf++; |
| 243 | } | 250 | } |
| 244 | return 0; | 251 | return 0; |
diff --git a/arch/x86/kernel/early_printk_mrst.c b/arch/x86/kernel/early_printk_mrst.c new file mode 100644 index 000000000000..05d27e1e2b62 --- /dev/null +++ b/arch/x86/kernel/early_printk_mrst.c | |||
| @@ -0,0 +1,232 @@ | |||
| 1 | /* | ||
| 2 | * early_printk_mrst.c - spi-uart early printk for Intel Moorestown platform | ||
| 3 | * | ||
| 4 | * Copyright (c) 2008-2010, Intel Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or | ||
| 7 | * modify it under the terms of the GNU General Public License | ||
| 8 | * as published by the Free Software Foundation; version 2 | ||
| 9 | * of the License. | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <linux/kmsg_dump.h> | ||
| 13 | #include <linux/console.h> | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/io.h> | ||
| 17 | |||
| 18 | #include <asm/fixmap.h> | ||
| 19 | #include <asm/pgtable.h> | ||
| 20 | #include <asm/mrst.h> | ||
| 21 | |||
| 22 | #define MRST_SPI_TIMEOUT 0x200000 | ||
| 23 | #define MRST_REGBASE_SPI0 0xff128000 | ||
| 24 | #define MRST_REGBASE_SPI1 0xff128400 | ||
| 25 | #define MRST_CLK_SPI0_REG 0xff11d86c | ||
| 26 | |||
| 27 | /* Bit fields in CTRLR0 */ | ||
| 28 | #define SPI_DFS_OFFSET 0 | ||
| 29 | |||
| 30 | #define SPI_FRF_OFFSET 4 | ||
| 31 | #define SPI_FRF_SPI 0x0 | ||
| 32 | #define SPI_FRF_SSP 0x1 | ||
| 33 | #define SPI_FRF_MICROWIRE 0x2 | ||
| 34 | #define SPI_FRF_RESV 0x3 | ||
| 35 | |||
| 36 | #define SPI_MODE_OFFSET 6 | ||
| 37 | #define SPI_SCPH_OFFSET 6 | ||
| 38 | #define SPI_SCOL_OFFSET 7 | ||
| 39 | #define SPI_TMOD_OFFSET 8 | ||
| 40 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ | ||
| 41 | #define SPI_TMOD_TO 0x1 /* xmit only */ | ||
| 42 | #define SPI_TMOD_RO 0x2 /* recv only */ | ||
| 43 | #define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */ | ||
| 44 | |||
| 45 | #define SPI_SLVOE_OFFSET 10 | ||
| 46 | #define SPI_SRL_OFFSET 11 | ||
| 47 | #define SPI_CFS_OFFSET 12 | ||
| 48 | |||
| 49 | /* Bit fields in SR, 7 bits */ | ||
| 50 | #define SR_MASK 0x7f /* cover 7 bits */ | ||
| 51 | #define SR_BUSY (1 << 0) | ||
| 52 | #define SR_TF_NOT_FULL (1 << 1) | ||
| 53 | #define SR_TF_EMPT (1 << 2) | ||
| 54 | #define SR_RF_NOT_EMPT (1 << 3) | ||
| 55 | #define SR_RF_FULL (1 << 4) | ||
| 56 | #define SR_TX_ERR (1 << 5) | ||
| 57 | #define SR_DCOL (1 << 6) | ||
| 58 | |||
| 59 | struct dw_spi_reg { | ||
| 60 | u32 ctrl0; | ||
| 61 | u32 ctrl1; | ||
| 62 | u32 ssienr; | ||
| 63 | u32 mwcr; | ||
| 64 | u32 ser; | ||
| 65 | u32 baudr; | ||
| 66 | u32 txfltr; | ||
| 67 | u32 rxfltr; | ||
| 68 | u32 txflr; | ||
| 69 | u32 rxflr; | ||
| 70 | u32 sr; | ||
| 71 | u32 imr; | ||
| 72 | u32 isr; | ||
| 73 | u32 risr; | ||
| 74 | u32 txoicr; | ||
| 75 | u32 rxoicr; | ||
| 76 | u32 rxuicr; | ||
| 77 | u32 msticr; | ||
| 78 | u32 icr; | ||
| 79 | u32 dmacr; | ||
| 80 | u32 dmatdlr; | ||
| 81 | u32 dmardlr; | ||
| 82 | u32 idr; | ||
| 83 | u32 version; | ||
| 84 | |||
| 85 | /* Currently operates as 32 bits, though only the low 16 bits matter */ | ||
| 86 | u32 dr; | ||
| 87 | } __packed; | ||
| 88 | |||
| 89 | #define dw_readl(dw, name) __raw_readl(&(dw)->name) | ||
| 90 | #define dw_writel(dw, name, val) __raw_writel((val), &(dw)->name) | ||
| 91 | |||
| 92 | /* Default use SPI0 register for mrst, we will detect Penwell and use SPI1 */ | ||
| 93 | static unsigned long mrst_spi_paddr = MRST_REGBASE_SPI0; | ||
| 94 | |||
| 95 | static u32 *pclk_spi0; | ||
| 96 | /* Always contains an accessable address, start with 0 */ | ||
| 97 | static struct dw_spi_reg *pspi; | ||
| 98 | |||
| 99 | static struct kmsg_dumper dw_dumper; | ||
| 100 | static int dumper_registered; | ||
| 101 | |||
| 102 | static void dw_kmsg_dump(struct kmsg_dumper *dumper, | ||
| 103 | enum kmsg_dump_reason reason, | ||
| 104 | const char *s1, unsigned long l1, | ||
| 105 | const char *s2, unsigned long l2) | ||
| 106 | { | ||
| 107 | int i; | ||
| 108 | |||
| 109 | /* When run to this, we'd better re-init the HW */ | ||
| 110 | mrst_early_console_init(); | ||
| 111 | |||
| 112 | for (i = 0; i < l1; i++) | ||
| 113 | early_mrst_console.write(&early_mrst_console, s1 + i, 1); | ||
