Comments
Patch
===================================================================
@@ -168,7 +168,7 @@
{
.name = "serprog",
.init = serprog_init,
- .map_flash_region = fallback_map,
+ .map_flash_region = serprog_map,
.unmap_flash_region = fallback_unmap,
.delay = serprog_delay,
},
===================================================================
@@ -635,6 +635,7 @@
/* serprog.c */
#if CONFIG_SERPROG == 1
int serprog_init(void);
+void *serprog_map(const char *descr, unsigned long phys_addr, size_t len);
void serprog_chip_writeb(uint8_t val, chipaddr addr);
uint8_t serprog_chip_readb(const chipaddr addr);
void serprog_chip_readn(uint8_t *buf, const chipaddr addr, size_t len);
===================================================================
@@ -601,6 +601,18 @@
return 0;
}
+void *serprog_map(const char *descr, unsigned long phys_addr, size_t len)
+{
+ if ((phys_addr & 0xFF000000) == 0xFF000000) {
+ msg_pdbg("Serprog map '%s' giving low 24 bits of phys_addr (0x%06X)\n",descr,phys_addr & 0xFFFFFF);
+ return (void*)(phys_addr & 0xFFFFFF);
+ } else {
+ msg_pinfo("Serprog-incompatible mapping '%s' phys_addr 0x%08X len %d, returning NULL\n",descr,phys_addr,len);
+ return NULL;
+ }
+}
+
+
/* Move an in flashrom buffer existing write-n operation to *
* the on-device operation buffer. */
static void sp_pass_writen(void)
Add serprog_map so that chips are addressed properly. I did this for adding LPC support to my ATmega644 programmer. Signed-off-by: Urja Rannikko <urjaman@gmail.com> ------ Sorry if I interrupted you all out of nowhere :P, I was porting LPC code somebody (Mike Stirling, had to look that up) did for the AVR to my ATmega644 (FTDI-USB) programmer, and noticed that it forced a base address of 0xFFF80000 that is right only for 512K chips. I modified the code to only add the highest 8 bits that are not addressable in serprog protocol, and added this map function to have flashrom address stuff properly. This shouldnt affect non-serprog code at all, and it shouldnt matter to parallel, nor it would affect the lpc addr or 0xFFF80000-implementation, also my SPI W25Q80 doesnt mind being addressed in this way at all (detect and read tested). Further testing is recommended. Also sidenote: it might be useful to add an optional write_jedec_1-implementation into serprog. This thing is taking forever to write LPC. (LPC with a 12Mhz AVR isnt that fast anyways, but with USB ping-pong on every byte written...)