📄 update-2.4.19-axis.patch
字号:
+if [ "$CONFIG_ETRAX_RTC" = "y" ]; then+ choice ' RTC chip' \+ "DS1302 CONFIG_ETRAX_DS1302 \+ PCF8563 CONFIG_ETRAX_PCF8563" DS1302+fi+ if [ "$CONFIG_ETRAX_DS1302" = "y" ]; then bool ' DS1302 RST on Generic Port' CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT int ' DS1302 RST bit number' CONFIG_ETRAX_DS1302_RSTBIT 2 int ' DS1302 SCL bit number' CONFIG_ETRAX_DS1302_SCLBIT 1 int ' DS1302 SDA bit number' CONFIG_ETRAX_DS1302_SDABIT 0+ int ' DS1302 Trickle charger value' CONFIG_ETRAX_DS1302_TRICKLE_CHARGE 0 fi endmenudiff -Nur /home/starvik/download/kernel/linux-2.4.19/arch/cris/drivers/axisflashmap.c ./arch/cris/drivers/axisflashmap.c--- /home/starvik/download/kernel/linux-2.4.19/arch/cris/drivers/axisflashmap.c Sat Aug 3 02:39:42 2002+++ ./arch/cris/drivers/axisflashmap.c Wed Oct 23 12:28:59 2002@@ -11,6 +11,26 @@ * partition split defined below. * * $Log: update-2.4.19-axis.patch,v $ * Revision 1.1.1.1 2004/06/06 14:14:02 rpm * Vesuvio baseline * * Revision 1.1.1.1 2004/04/04 19:00:54 pgerum * Vesuvio baseline * * Revision 1.1.1.1 2004/02/15 11:56:24 pgerum * Magma baseline * * Revision 1.1 2004/01/02 15:11:03 pgerum * Add Axis update to 2.4.19 *+ * Revision 1.28 2002/10/01 08:08:43 jonashg+ * The first partition ends at the start of the partition table.+ *+ * Revision 1.27 2002/08/21 09:23:13 jonashg+ * Speling.+ *+ * Revision 1.26 2002/08/21 08:35:20 jonashg+ * Cosmetic change to printouts.+ *+ * Revision 1.25 2002/08/21 08:15:42 jonashg+ * Made it compile even without CONFIG_MTD_CONCAT defined.+ *+ * Revision 1.24 2002/08/20 13:12:35 jonashg+ * * New approach to probing. Probe cse0 and cse1 separately and (mtd)concat+ * the results.+ * * Removed compile time tests concerning how the mtdram driver has been+ * configured. The user will know about the misconfiguration at runtime+ * instead. (The old approach made it impossible to use mtdram for anything+ * else than RAM boot).+ * * Revision 1.23 2002/05/13 12:12:28 johana * Allow compile without CONFIG_MTD_MTDRAM but warn at compiletime and * be informative at runtime.@@ -98,13 +118,15 @@ #include <linux/kernel.h> #include <linux/config.h> -#include <linux/mtd/mtd.h>+#include <linux/mtd/concat.h> #include <linux/mtd/map.h>-#include <linux/mtd/partitions.h>+#include <linux/mtd/mtd.h> #include <linux/mtd/mtdram.h>+#include <linux/mtd/partitions.h> #include <asm/axisflashmap.h> #include <asm/mmu.h>+#include <asm/sv_addr_ag.h> #ifdef CONFIG_CRIS_LOW_MAP #define FLASH_UNCACHED_ADDR KSEG_8@@ -114,63 +136,65 @@ #define FLASH_CACHED_ADDR KSEG_F #endif -/*- * WINDOW_SIZE is the total size where the flash chips may be mapped.- * MTD probes should find all devices there and it does not matter- * if there are unmapped gaps or aliases (mirrors of flash devices).- * The MTD probes will ignore them.- */--#define WINDOW_SIZE (128 * 1024 * 1024)--extern unsigned long romfs_start, romfs_length, romfs_in_flash; /* From head.S */+/* From head.S */+extern unsigned long romfs_start, romfs_length, romfs_in_flash; -/* - * Map driver- *- * We run into tricky coherence situations if we mix cached with uncached- * accesses to we use the uncached version here.- */+/* Map driver functions. */ static __u8 flash_read8(struct map_info *map, unsigned long ofs) {- return *(__u8 *)(FLASH_UNCACHED_ADDR + ofs);+ return *(__u8 *)(map->map_priv_1 + ofs); } static __u16 flash_read16(struct map_info *map, unsigned long ofs) {- return *(__u16 *)(FLASH_UNCACHED_ADDR + ofs);+ return *(__u16 *)(map->map_priv_1 + ofs); } static __u32 flash_read32(struct map_info *map, unsigned long ofs) {- return *(volatile unsigned int *)(FLASH_UNCACHED_ADDR + ofs);+ return *(volatile unsigned int *)(map->map_priv_1 + ofs); } static void flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) {- memcpy(to, (void *)(FLASH_UNCACHED_ADDR + from), len);+ memcpy(to, (void *)(map->map_priv_1 + from), len); } static void flash_write8(struct map_info *map, __u8 d, unsigned long adr) {- *(__u8 *)(FLASH_UNCACHED_ADDR + adr) = d;+ *(__u8 *)(map->map_priv_1 + adr) = d; } static void flash_write16(struct map_info *map, __u16 d, unsigned long adr) {- *(__u16 *)(FLASH_UNCACHED_ADDR + adr) = d;+ *(__u16 *)(map->map_priv_1 + adr) = d; } static void flash_write32(struct map_info *map, __u32 d, unsigned long adr) {- *(__u32 *)(FLASH_UNCACHED_ADDR + adr) = d;+ *(__u32 *)(map->map_priv_1 + adr) = d; } -static struct map_info axis_map = {- name: "Axis flash",- size: WINDOW_SIZE,+/*+ * The map for chip select e0.+ *+ * We run into tricky coherence situations if we mix cached with uncached+ * accesses to we only use the uncached version here.+ *+ * The size field is the total size where the flash chips may be mapped on the+ * chip select. MTD probes should find all devices there and it does not matter+ * if there are unmapped gaps or aliases (mirrors of flash devices). The MTD+ * probes will ignore them.+ *+ * The start address in map_priv_1 is in virtual memory so we cannot use+ * MEM_CSE0_START but must rely on that FLASH_UNCACHED_ADDR is the start+ * address of cse0.+ */+static struct map_info map_cse0 = {+ name: "cse0",+ size: MEM_CSE0_SIZE, buswidth: CONFIG_ETRAX_FLASH_BUSWIDTH, read8: flash_read8, read16: flash_read16,@@ -179,15 +203,35 @@ write8: flash_write8, write16: flash_write16, write32: flash_write32,+ map_priv_1: FLASH_UNCACHED_ADDR }; -/* If no partition-table was found, we use this default-set.+/*+ * The map for chip select e1.+ *+ * If there was a gap between cse0 and cse1, map_priv_1 would get the wrong+ * address, but there isn't. */+static struct map_info map_cse1 = {+ name: "cse1",+ size: MEM_CSE1_SIZE,+ buswidth: CONFIG_ETRAX_FLASH_BUSWIDTH,+ read8: flash_read8,+ read16: flash_read16,+ read32: flash_read32,+ copy_from: flash_copy_from,+ write8: flash_write8,+ write16: flash_write16,+ write32: flash_write32,+ map_priv_1: FLASH_UNCACHED_ADDR + MEM_CSE0_SIZE+}; +/* If no partition-table was found, we use this default-set. */ #define MAX_PARTITIONS 7 #define NUM_DEFAULT_PARTITIONS 3 -/* Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the+/*+ * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the * size of one flash block and "filesystem"-partition needs 5 blocks to be able * to use JFFS. */@@ -209,10 +253,11 @@ } }; +/* Initialize the ones normally used. */ static struct mtd_partition axis_partitions[MAX_PARTITIONS] = { { name: "part0",- size: 0,+ size: CONFIG_ETRAX_PTABLE_SECTOR, offset: 0 }, {@@ -247,48 +292,118 @@ }, }; +/*+ * Probe a chip select for AMD-compatible (JEDEC) or CFI-compatible flash+ * chips in that order (because the amd_flash-driver is faster).+ */+static struct mtd_info *probe_cs(struct map_info *map_cs)+{+ struct mtd_info *mtd_cs = NULL;++ printk("%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",+ map_cs->name, map_cs->size, map_cs->map_priv_1);++#ifdef CONFIG_MTD_AMDSTD+ mtd_cs = do_map_probe("amd_flash", map_cs);+#endif+#ifdef CONFIG_MTD_CFI+ if (!mtd_cs) {+ mtd_cs = do_map_probe("cfi_probe", map_cs);+ }+#endif++ return mtd_cs;+}+ /* - * This is the master MTD device for which all the others are just- * auto-relocating aliases.+ * Probe each chip select individually for flash chips. If there are chips on+ * both cse0 and cse1, the mtd_info structs will be concatenated to one struct+ * so that MTD partitions can cross chip boundries.+ *+ * The only known restriction to how you can mount your chips is that each+ * chip select must hold similar flash chips. But you need external hardware+ * to do that anyway and you can put totally different chips on cse0 and cse1+ * so it isn't really much of a restriction. */-static struct mtd_info *mymtd;+static struct mtd_info *flash_probe(void)+{+ struct mtd_info *mtd_cse0;+ struct mtd_info *mtd_cse1;+ struct mtd_info *mtd_cse;++ mtd_cse0 = probe_cs(&map_cse0);+ mtd_cse1 = probe_cs(&map_cse1);++ if (!mtd_cse0 && !mtd_cse1) {+ /* No chip found. */+ return NULL;+ }++ if (mtd_cse0 && mtd_cse1) {+#ifdef CONFIG_MTD_CONCAT+ struct mtd_info *mtds[] = { mtd_cse0, mtd_cse1 };+ + /* Since the concatenation layer adds a small overhead we+ * could try to figure out if the chips in cse0 and cse1 are+ * identical and reprobe the whole cse0+cse1 window. But since+ * flash chips are slow, the overhead is relatively small.+ * So we use the MTD concatenation layer instead of further+ * complicating the probing procedure.+ */+ mtd_cse = mtd_concat_create(mtds,+ sizeof(mtds) / sizeof(mtds[0]),+ "cse0+cse1");+#else+ printk(KERN_ERR "%s and %s: Cannot concatenate due to kernel "+ "(mis)configuration!\n", map_cse0.name, map_cse1.name);+ mtd_cse = NULL;+#endif+ if (!mtd_cse) {+ printk(KERN_ERR "%s and %s: Concatenation failed!\n",+ map_cse0.name, map_cse1.name);++ /* The best we can do now is to only use what we found+ * at cse0.+ */ + mtd_cse = mtd_cse0;+ map_destroy(mtd_cse1);+ }+ } else {+ mtd_cse = mtd_cse0? mtd_cse0 : mtd_cse1;+ }++ return mtd_cse;+} -/* CFI-scan the flash, and if there was a chip, read the partition-table+/*+ * Probe the flash chip(s) and, if it succeeds, read the partition-table * and register the partitions with MTD. */--static int __init-init_axis_flash(void)+static int __init init_axis_flash(void) {+ struct mtd_info *mymtd; int err = 0; int pidx = 0; struct partitiontable_head *ptable_head; struct partitiontable_entry *ptable;- int use_default_ptable = 1; /* Until proven otherwise */- const char *pmsg = " /dev/flash%d at 0x%x, size 0x%x\n";-- printk(KERN_NOTICE "Axis flash mapping: %x at %lx\n",- WINDOW_SIZE, FLASH_CACHED_ADDR);-#ifdef CONFIG_MTD_AMDSTD- mymtd = (struct mtd_info *)do_map_probe("amd_flash", &axis_map);-#endif+ int use_default_ptable = 1; /* Until proven otherwise. */+ const char *pmsg = " /dev/flash%d at 0x%08x, size 0x%08x\n"; -#ifdef CONFIG_MTD_CFI- if (!mymtd) {- mymtd = (struct mtd_info *)do_map_probe("cfi_probe", &axis_map);+ if (!(mymtd = flash_probe())) {+ /* There's no reason to use this module if no flash chip can+ * be identified. Make sure that's understood.+ */+ panic("axisflashmap found no flash chip!\n"); }-#endif - if(!mymtd) {- printk("%s: No flash chip found!\n", axis_map.name);- return -ENXIO;- }+ printk("%s: 0x%08x bytes of flash memory.\n",+ mymtd->name, mymtd->size); mymtd->module = THIS_MODULE; ptable_head = (struct partitiontable_head *)(FLASH_CACHED_ADDR +- CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET);- pidx++; /* first partition is always set to the default */+ CONFIG_ETRAX_PTABLE_SECTOR + PARTITION_TABLE_OFFSET);+ pidx++; /* First partition is always set to the default. */ if ((ptable_head->magic == PARTITION_TABLE_MAGIC) && (ptable_head->size <@@ -322,20 +437,17 @@ csum += *p++; csum += *p++; }- /* printk(" total csum: 0x%08X 0x%08X\n",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -