Cosmetic fixes (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Acked-by: Uwe Hermann <uwe@hermann-uwe.de> git-svn-id: svn://svn.coreboot.org/coreboot/trunk@2748 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
parent
0a6bb91062
commit
ba9ce9f7f9
|
@ -77,7 +77,6 @@ int probe_82802ab(struct flashchip *flash)
|
||||||
|
|
||||||
uint8_t wait_82802ab(volatile uint8_t *bios)
|
uint8_t wait_82802ab(volatile uint8_t *bios)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
uint8_t id1, id2;
|
uint8_t id1, id2;
|
||||||
|
|
||||||
|
@ -100,9 +99,10 @@ uint8_t wait_82802ab(volatile uint8_t *bios)
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
|
||||||
return status;
|
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_82802ab_block(struct flashchip *flash, int offset)
|
int erase_82802ab_block(struct flashchip *flash, int offset)
|
||||||
{
|
{
|
||||||
volatile uint8_t *bios = flash->virtual_memory + offset;
|
volatile uint8_t *bios = flash->virtual_memory + offset;
|
||||||
|
@ -126,8 +126,10 @@ int erase_82802ab_block(struct flashchip *flash, int offset)
|
||||||
status = wait_82802ab(flash->virtual_memory);
|
status = wait_82802ab(flash->virtual_memory);
|
||||||
//print_82802ab_status(status);
|
//print_82802ab_status(status);
|
||||||
printf("DONE BLOCK 0x%x\n", offset);
|
printf("DONE BLOCK 0x%x\n", offset);
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_82802ab(struct flashchip *flash)
|
int erase_82802ab(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -138,7 +140,8 @@ int erase_82802ab(struct flashchip *flash)
|
||||||
for (i = 0; i < total_size; i += flash->page_size)
|
for (i = 0; i < total_size; i += flash->page_size)
|
||||||
erase_82802ab_block(flash, i);
|
erase_82802ab_block(flash, i);
|
||||||
printf("DONE ERASE\n");
|
printf("DONE ERASE\n");
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_page_82802ab(volatile uint8_t *bios, uint8_t *src,
|
void write_page_82802ab(volatile uint8_t *bios, uint8_t *src,
|
||||||
|
@ -152,7 +155,6 @@ void write_page_82802ab(volatile uint8_t *bios, uint8_t *src,
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
wait_82802ab(bios);
|
wait_82802ab(bios);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_82802ab(struct flashchip *flash, uint8_t *buf)
|
int write_82802ab(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -176,5 +178,6 @@ int write_82802ab(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
protect_jedec(bios);
|
protect_jedec(bios);
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ static __inline__ int erase_sector_29f040b(volatile uint8_t *bios,
|
||||||
/* wait for Toggle bit ready */
|
/* wait for Toggle bit ready */
|
||||||
toggle_ready_jedec(bios + address);
|
toggle_ready_jedec(bios + address);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
|
static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
|
||||||
|
@ -68,7 +68,7 @@ static __inline__ int write_sector_29f040b(volatile uint8_t *bios,
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b");
|
printf("\b\b\b\b\b\b\b\b\b\b");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_29f040b(struct flashchip *flash)
|
int probe_29f040b(struct flashchip *flash)
|
||||||
|
@ -108,7 +108,7 @@ int erase_29f040b(struct flashchip *flash)
|
||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_29f040b(struct flashchip *flash, uint8_t *buf)
|
int write_29f040b(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -131,5 +131,5 @@ int write_29f040b(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper functions for many Winbond superIOs of the w836xx range.
|
* Helper functions for many Winbond Super I/Os of the W836xx range.
|
||||||
*/
|
*/
|
||||||
#define W836_INDEX 0x2E
|
#define W836_INDEX 0x2E
|
||||||
#define W836_DATA 0x2F
|
#define W836_DATA 0x2F
|
||||||
|
@ -40,7 +40,7 @@ static void w836xx_ext_leave(void)
|
||||||
outb(0xAA, W836_INDEX);
|
outb(0xAA, W836_INDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* General functions for read/writing WB SuperIOs */
|
/* General functions for reading/writing Winbond Super I/Os. */
|
||||||
static unsigned char wbsio_read(unsigned char index)
|
static unsigned char wbsio_read(unsigned char index)
|
||||||
{
|
{
|
||||||
outb(index, W836_INDEX);
|
outb(index, W836_INDEX);
|
||||||
|
@ -53,8 +53,8 @@ static void wbsio_write(unsigned char index, unsigned char data)
|
||||||
outb(data, W836_DATA);
|
outb(data, W836_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void wbsio_mask(unsigned char index, unsigned char data,
|
||||||
wbsio_mask(unsigned char index, unsigned char data, unsigned char mask)
|
unsigned char mask)
|
||||||
{
|
{
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
|
||||||
|
@ -63,14 +63,13 @@ wbsio_mask(unsigned char index, unsigned char data, unsigned char mask)
|
||||||
outb(tmp | (data & mask), W836_DATA);
|
outb(tmp | (data & mask), W836_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* WinBond w83627hf: raise GPIO24.
|
* Winbond W83627HF: Raise GPIO24.
|
||||||
*
|
*
|
||||||
* Suited for:
|
* Suited for:
|
||||||
* * Agami Aruma
|
* - Agami Aruma
|
||||||
* * IWILL DK8-HTX
|
* - IWILL DK8-HTX
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int w83627hf_gpio24_raise(const char *name)
|
static int w83627hf_gpio24_raise(const char *name)
|
||||||
{
|
{
|
||||||
w836xx_ext_enter();
|
w836xx_ext_enter();
|
||||||
|
@ -101,12 +100,11 @@ static int w83627hf_gpio24_raise(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Suited for VIAs EPIA M and MII, and maybe other CLE266 based EPIAs.
|
* Suited for VIAs EPIA M and MII, and maybe other CLE266 based EPIAs.
|
||||||
*
|
*
|
||||||
* We don't need to do this when using linuxbios, GPIO15 is never lowered there.
|
* We don't need to do this when using LinuxBIOS, GPIO15 is never lowered there.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int board_via_epia_m(const char *name)
|
static int board_via_epia_m(const char *name)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
|
@ -135,12 +133,11 @@ static int board_via_epia_m(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Suited for:
|
* Suited for:
|
||||||
* ASUS A7V8X-MX SE and A7V400-MX: AMD K7 + VIA KM400A + VT8235
|
* - ASUS A7V8X-MX SE and A7V400-MX: AMD K7 + VIA KM400A + VT8235
|
||||||
* Tyan Tomcat K7M: AMD Geode NX + VIA KM400 + VT8237.
|
* - Tyan Tomcat K7M: AMD Geode NX + VIA KM400 + VT8237.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int board_asus_a7v8x_mx(const char *name)
|
static int board_asus_a7v8x_mx(const char *name)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev;
|
struct pci_dev *dev;
|
||||||
|
@ -170,14 +167,13 @@ static int board_asus_a7v8x_mx(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Suited for ASUS P5A.
|
* Suited for ASUS P5A.
|
||||||
*
|
*
|
||||||
* This is rather nasty code, but there's no way to do this cleanly.
|
* This is rather nasty code, but there's no way to do this cleanly.
|
||||||
* We're basically talking to some unknown device on SMBus, my guess
|
* We're basically talking to some unknown device on SMBus, my guess
|
||||||
* is that it is the Winbond W83781D that lives near the DIP BIOS.
|
* is that it is the Winbond W83781D that lives near the DIP BIOS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int board_asus_p5a(const char *name)
|
static int board_asus_p5a(const char *name)
|
||||||
{
|
{
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
|
@ -278,16 +274,14 @@ static int board_epox_ep_bx3(const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* We use 2 sets of ids here, you're free to choose which is which. This
|
* We use 2 sets of IDs here, you're free to choose which is which. This
|
||||||
* to provide a very high degree of certainty when matching a board on
|
* is to provide a very high degree of certainty when matching a board on
|
||||||
* the basis of Subsystem/card ids. As not every vendor handles
|
* the basis of subsystem/card IDs. As not every vendor handles
|
||||||
* subsystem/card ids in a sane manner.
|
* subsystem/card IDs in a sane manner.
|
||||||
*
|
|
||||||
* Keep the second set nulled if it should be ignored.
|
|
||||||
*
|
*
|
||||||
|
* Keep the second set NULLed if it should be ignored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct board_pciid_enable {
|
struct board_pciid_enable {
|
||||||
/* Any device, but make it sensible, like the isa bridge. */
|
/* Any device, but make it sensible, like the isa bridge. */
|
||||||
uint16_t first_vendor;
|
uint16_t first_vendor;
|
||||||
|
@ -331,10 +325,9 @@ struct board_pciid_enable board_pciid_enables[] = {
|
||||||
{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} /* Keep this */
|
{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} /* Keep this */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Match boards on linuxbios table gathered vendor and part name.
|
* Match boards on LinuxBIOS table gathered vendor and part name.
|
||||||
* Require main pci-ids to match too as extra safety.
|
* Require main PCI IDs to match too as extra safety.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static struct board_pciid_enable *board_match_linuxbios_name(char *vendor,
|
static struct board_pciid_enable *board_match_linuxbios_name(char *vendor,
|
||||||
char *part)
|
char *part)
|
||||||
|
@ -359,9 +352,9 @@ static struct board_pciid_enable *board_match_linuxbios_name(char *vendor,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Match boards on pci ids and subsystem ids.
|
* Match boards on PCI IDs and subsystem IDs.
|
||||||
* Second set of ids can be main only or missing completely.
|
* Second set of IDs can be main only or missing completely.
|
||||||
*/
|
*/
|
||||||
static struct board_pciid_enable *board_match_pci_card_ids(void)
|
static struct board_pciid_enable *board_match_pci_card_ids(void)
|
||||||
{
|
{
|
||||||
|
@ -396,9 +389,6 @@ static struct board_pciid_enable *board_match_pci_card_ids(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int board_flash_enable(char *vendor, char *part)
|
int board_flash_enable(char *vendor, char *part)
|
||||||
{
|
{
|
||||||
struct board_pciid_enable *board = NULL;
|
struct board_pciid_enable *board = NULL;
|
||||||
|
|
|
@ -112,6 +112,7 @@ static int enable_flash_piix4(struct pci_dev *dev, char *name)
|
||||||
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", xbcs, new, name);
|
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", xbcs, new, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +146,7 @@ static int enable_flash_ich(struct pci_dev *dev, char *name, int bios_cntl)
|
||||||
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", bios_cntl, new, name);
|
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", bios_cntl, new, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,14 +160,11 @@ static int enable_flash_ich_dc(struct pci_dev *dev, char *name)
|
||||||
return enable_flash_ich(dev, name, 0xdc);
|
return enable_flash_ich(dev, name, 0xdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static int enable_flash_vt823x(struct pci_dev *dev, char *name)
|
static int enable_flash_vt823x(struct pci_dev *dev, char *name)
|
||||||
{
|
{
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
|
|
||||||
/* ROM Write enable */
|
/* ROM write enable */
|
||||||
val = pci_read_byte(dev, 0x40);
|
val = pci_read_byte(dev, 0x40);
|
||||||
val |= 0x10;
|
val |= 0x10;
|
||||||
pci_write_byte(dev, 0x40, val);
|
pci_write_byte(dev, 0x40, val);
|
||||||
|
@ -221,6 +220,7 @@ static int enable_flash_sc1100(struct pci_dev *dev, char *name)
|
||||||
printf("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x52, new, name);
|
printf("tried to set register 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x52, new, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,6 +243,7 @@ static int enable_flash_sis5595(struct pci_dev *dev, char *name)
|
||||||
printf("Stuck at 0x%x\n", newer);
|
printf("Stuck at 0x%x\n", newer);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,6 +276,7 @@ static int enable_flash_amd8111(struct pci_dev *dev, char *name)
|
||||||
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name);
|
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x40, new, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,6 +310,7 @@ static int enable_flash_ck804(struct pci_dev *dev, char *name)
|
||||||
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name);
|
printf("tried to set 0x%x to 0x%x on %s failed (WARNING ONLY)\n", 0x6d, new, name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +396,6 @@ static int enable_flash_mcp55(struct pci_dev *dev, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int enable_flash_ht1000(struct pci_dev *dev, char *name)
|
static int enable_flash_ht1000(struct pci_dev *dev, char *name)
|
||||||
|
@ -406,7 +408,7 @@ static int enable_flash_ht1000(struct pci_dev *dev, char *name)
|
||||||
pci_write_byte(dev, 0x41, byte);
|
pci_write_byte(dev, 0x41, byte);
|
||||||
|
|
||||||
byte = pci_read_byte(dev, 0x43);
|
byte = pci_read_byte(dev, 0x43);
|
||||||
byte |= (1<<4);
|
byte |= (1 << 4);
|
||||||
pci_write_byte(dev, 0x43, byte);
|
pci_write_byte(dev, 0x43, byte);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -473,9 +475,6 @@ static FLASH_ENABLE enables[] = {
|
||||||
{0x1166, 0x0205, "Broadcom HT-1000", enable_flash_ht1000},
|
{0x1166, 0x0205, "Broadcom HT-1000", enable_flash_ht1000},
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
int chipset_flash_enable(void)
|
int chipset_flash_enable(void)
|
||||||
{
|
{
|
||||||
struct pci_dev *dev = 0;
|
struct pci_dev *dev = 0;
|
||||||
|
|
|
@ -150,5 +150,3 @@ struct flashchip flashchips[] = {
|
||||||
probe_jedec, erase_chip_jedec, write_49f002},
|
probe_jedec, erase_chip_jedec, write_49f002},
|
||||||
{NULL,}
|
{NULL,}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,12 +49,8 @@ char *chip_to_probe = NULL;
|
||||||
struct pci_access *pacc; /* For board and chipset_enable */
|
struct pci_access *pacc; /* For board and chipset_enable */
|
||||||
int exclude_start_page, exclude_end_page;
|
int exclude_start_page, exclude_end_page;
|
||||||
int force = 0, verbose = 0;
|
int force = 0, verbose = 0;
|
||||||
|
|
||||||
int fd_mem;
|
int fd_mem;
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
|
struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
|
||||||
{
|
{
|
||||||
struct pci_dev *temp;
|
struct pci_dev *temp;
|
||||||
|
@ -71,9 +67,6 @@ struct pci_dev *pci_dev_find(uint16_t vendor, uint16_t device)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
struct pci_dev *pci_card_find(uint16_t vendor, uint16_t device,
|
||||||
uint16_t card_vendor, uint16_t card_device)
|
uint16_t card_vendor, uint16_t card_device)
|
||||||
{
|
{
|
||||||
|
@ -163,6 +156,7 @@ struct flashchip *probe_flash(struct flashchip *flash)
|
||||||
|
|
||||||
flash++;
|
flash++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +190,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b ");
|
printf("\b\b\b\b\b\b\b\b\b\b ");
|
||||||
|
|
||||||
printf("- VERIFIED \n");
|
printf("- VERIFIED \n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ int erase_sector_jedec(volatile uint8_t *bios, unsigned int page)
|
||||||
/* wait for Toggle bit ready */
|
/* wait for Toggle bit ready */
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_block_jedec(volatile uint8_t *bios, unsigned int block)
|
int erase_block_jedec(volatile uint8_t *bios, unsigned int block)
|
||||||
|
@ -158,7 +158,7 @@ int erase_block_jedec(volatile uint8_t *bios, unsigned int block)
|
||||||
/* wait for Toggle bit ready */
|
/* wait for Toggle bit ready */
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_chip_jedec(struct flashchip *flash)
|
int erase_chip_jedec(struct flashchip *flash)
|
||||||
|
@ -182,7 +182,7 @@ int erase_chip_jedec(struct flashchip *flash)
|
||||||
|
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_page_write_jedec(volatile uint8_t *bios, uint8_t *src,
|
int write_page_write_jedec(volatile uint8_t *bios, uint8_t *src,
|
||||||
|
@ -229,7 +229,7 @@ retry:
|
||||||
fprintf(stderr, " page %d failed!\n",
|
fprintf(stderr, " page %d failed!\n",
|
||||||
(unsigned int)(d - bios) / page_size);
|
(unsigned int)(d - bios) / page_size);
|
||||||
}
|
}
|
||||||
return (!ok);
|
return !ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_byte_program_jedec(volatile uint8_t *bios, uint8_t *src,
|
int write_byte_program_jedec(volatile uint8_t *bios, uint8_t *src,
|
||||||
|
@ -259,7 +259,7 @@ retry:
|
||||||
if (tried >= MAX_REFLASH_TRIES)
|
if (tried >= MAX_REFLASH_TRIES)
|
||||||
ok = 0;
|
ok = 0;
|
||||||
|
|
||||||
return (!ok);
|
return !ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
|
int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
|
||||||
|
@ -272,7 +272,7 @@ int write_sector_jedec(volatile uint8_t *bios, uint8_t *src,
|
||||||
dst++, src++;
|
dst++, src++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_jedec(struct flashchip *flash, uint8_t *buf)
|
int write_jedec(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -301,5 +301,5 @@ int write_jedec(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
protect_jedec(bios);
|
protect_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,7 @@ int read_romlayout(char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(romlayout);
|
fclose(romlayout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,6 +156,7 @@ int find_romentry(char *name)
|
||||||
}
|
}
|
||||||
printf("not found.\n");
|
printf("not found.\n");
|
||||||
// Not found. Error.
|
// Not found. Error.
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
|
||||||
} value;
|
} value;
|
||||||
unsigned long sum;
|
unsigned long sum;
|
||||||
unsigned long i;
|
unsigned long i;
|
||||||
|
|
||||||
/* In the most straight forward way possible,
|
/* In the most straight forward way possible,
|
||||||
* compute an ip style checksum.
|
* compute an ip style checksum.
|
||||||
*/
|
*/
|
||||||
|
@ -64,6 +65,7 @@ static unsigned long compute_checksum(void *addr, unsigned long length)
|
||||||
}
|
}
|
||||||
value.byte[0] = sum & 0xff;
|
value.byte[0] = sum & 0xff;
|
||||||
value.byte[1] = (sum >> 8) & 0xff;
|
value.byte[1] = (sum >> 8) & 0xff;
|
||||||
|
|
||||||
return (~value.word) & 0xFFFF;
|
return (~value.word) & 0xFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,10 +80,12 @@ static int count_lb_records(struct lb_header *head)
|
||||||
{
|
{
|
||||||
struct lb_record *rec;
|
struct lb_record *rec;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for_each_lbrec(head, rec) {
|
for_each_lbrec(head, rec) {
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,6 +93,7 @@ static struct lb_header *find_lb_table(void *base, unsigned long start,
|
||||||
unsigned long end)
|
unsigned long end)
|
||||||
{
|
{
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
|
|
||||||
/* For now be stupid.... */
|
/* For now be stupid.... */
|
||||||
for (addr = start; addr < end; addr += 16) {
|
for (addr = start; addr < end; addr += 16) {
|
||||||
struct lb_header *head =
|
struct lb_header *head =
|
||||||
|
@ -123,6 +128,7 @@ static struct lb_header *find_lb_table(void *base, unsigned long start,
|
||||||
return head;
|
return head;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +137,7 @@ static void find_mainboard(struct lb_record *ptr, unsigned long addr)
|
||||||
struct lb_mainboard *rec;
|
struct lb_mainboard *rec;
|
||||||
int max_size;
|
int max_size;
|
||||||
char vendor[256], part[256];
|
char vendor[256], part[256];
|
||||||
|
|
||||||
rec = (struct lb_mainboard *)ptr;
|
rec = (struct lb_mainboard *)ptr;
|
||||||
max_size = rec->size - sizeof(*rec);
|
max_size = rec->size - sizeof(*rec);
|
||||||
printf("vendor id: %.*s part id: %.*s\n",
|
printf("vendor id: %.*s part id: %.*s\n",
|
||||||
|
@ -206,5 +213,6 @@ int linuxbios_init(void)
|
||||||
printf("No LinuxBIOS table found.\n");
|
printf("No LinuxBIOS table found.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ int erase_m29f400bt(struct flashchip *flash)
|
||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int block_erase_m29f400bt(volatile uint8_t *bios, volatile uint8_t *dst)
|
int block_erase_m29f400bt(volatile uint8_t *bios, volatile uint8_t *dst)
|
||||||
|
@ -118,7 +118,7 @@ int block_erase_m29f400bt(volatile uint8_t *bios, volatile uint8_t *dst)
|
||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
int write_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -173,7 +173,7 @@ int write_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
//protect_m29f400bt (bios);
|
//protect_m29f400bt (bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_linuxbios_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
int write_linuxbios_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -215,5 +215,5 @@ int write_linuxbios_m29f400bt(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
//protect_m29f400bt (bios);
|
//protect_m29f400bt (bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,23 +134,23 @@ int probe_md2802(struct flashchip *flash)
|
||||||
&& id_0x55 == 0x55 && id_0xAA == 0xaa
|
&& id_0x55 == 0x55 && id_0xAA == 0xaa
|
||||||
#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */
|
#endif /* !MSYSTEMS_DOC_NO_55AA_CHECKING */
|
||||||
) {
|
) {
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
} /* int probe_md2802(struct flashchip *flash) */
|
}
|
||||||
|
|
||||||
int read_md2802(struct flashchip *flash, uint8_t *buf)
|
int read_md2802(struct flashchip *flash, uint8_t *buf)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
return (0);
|
}
|
||||||
} /* int read_md2802(struct flashchip *flash, uint8_t *buf) */
|
|
||||||
|
|
||||||
int erase_md2802(struct flashchip *flash)
|
int erase_md2802(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
volatile uint8_t *bios = flash->virtual_memory;
|
volatile uint8_t *bios = flash->virtual_memory;
|
||||||
|
|
||||||
return (1);
|
return 1;
|
||||||
|
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0x80;
|
*(volatile uint8_t *)(bios + 0x5555) = 0x80;
|
||||||
|
@ -158,7 +158,7 @@ int erase_md2802(struct flashchip *flash)
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0x10;
|
*(volatile uint8_t *)(bios + 0x5555) = 0x10;
|
||||||
} /* int erase_md2802(struct flashchip *flash) */
|
}
|
||||||
|
|
||||||
int write_md2802(struct flashchip *flash, uint8_t *buf)
|
int write_md2802(struct flashchip *flash, uint8_t *buf)
|
||||||
{
|
{
|
||||||
|
@ -192,6 +192,7 @@ int write_md2802(struct flashchip *flash, uint8_t *buf)
|
||||||
0: ready
|
0: ready
|
||||||
-1: timeout expired
|
-1: timeout expired
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int doc_wait(volatile uint8_t *bios, int timeout)
|
static int doc_wait(volatile uint8_t *bios, int timeout)
|
||||||
{
|
{
|
||||||
int i = 20;
|
int i = 20;
|
||||||
|
@ -210,8 +211,8 @@ static int doc_wait(volatile uint8_t *bios, int timeout)
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
} /* static int doc_wait(volatile uint8_t *bios, int timeout) */
|
}
|
||||||
|
|
||||||
static uint8_t doc_read_docstatus(volatile uint8_t *bios)
|
static uint8_t doc_read_docstatus(volatile uint8_t *bios)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +220,7 @@ static uint8_t doc_read_docstatus(volatile uint8_t *bios)
|
||||||
doc_read_2nop(bios);
|
doc_read_2nop(bios);
|
||||||
|
|
||||||
return (doc_read(bios, _DOCStatus));
|
return (doc_read(bios, _DOCStatus));
|
||||||
} /* static uint8_t doc_read_docstatus(volatile uint8_t *bios) */
|
}
|
||||||
|
|
||||||
static uint8_t doc_read_chipid(volatile uint8_t *bios)
|
static uint8_t doc_read_chipid(volatile uint8_t *bios)
|
||||||
{
|
{
|
||||||
|
@ -227,7 +228,7 @@ static uint8_t doc_read_chipid(volatile uint8_t *bios)
|
||||||
doc_read_2nop(bios);
|
doc_read_2nop(bios);
|
||||||
|
|
||||||
return (doc_read(bios, _ChipID));
|
return (doc_read(bios, _ChipID));
|
||||||
} /* static uint8_t doc_read_chipid(volatile uint8_t *bios) */
|
}
|
||||||
|
|
||||||
static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios)
|
static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios)
|
||||||
{
|
{
|
||||||
|
@ -240,11 +241,11 @@ static uint8_t doc_read_cdsncontrol(volatile uint8_t *bios)
|
||||||
value = doc_read(bios, _CDSNControl);
|
value = doc_read(bios, _CDSNControl);
|
||||||
doc_read_2nop(bios);
|
doc_read_2nop(bios);
|
||||||
|
|
||||||
return (value);
|
return value;
|
||||||
} /* static uint8_t doc_read_chipid(volatile char *bios) */
|
}
|
||||||
|
|
||||||
static void doc_write_cdsncontrol(volatile uint8_t *bios, uint8_t data)
|
static void doc_write_cdsncontrol(volatile uint8_t *bios, uint8_t data)
|
||||||
{
|
{
|
||||||
doc_write(data, bios, _CDSNControl);
|
doc_write(data, bios, _CDSNControl);
|
||||||
doc_read_4nop(bios);
|
doc_read_4nop(bios);
|
||||||
} /* static void doc_write_chipid(volatile char *bios, uint8_t data) */
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ int erase_29f002(struct flashchip *flash)
|
||||||
*(bios + 0x3bfff) = 0x30;
|
*(bios + 0x3bfff) = 0x30;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_29f002(struct flashchip *flash, uint8_t *buf)
|
int write_29f002(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -113,5 +113,5 @@ int write_29f002(struct flashchip *flash, uint8_t *buf)
|
||||||
#endif
|
#endif
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,5 +51,5 @@ int write_49fl004(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,6 @@ int probe_lhf00l04(struct flashchip *flash)
|
||||||
|
|
||||||
uint8_t wait_lhf00l04(volatile uint8_t *bios)
|
uint8_t wait_lhf00l04(volatile uint8_t *bios)
|
||||||
{
|
{
|
||||||
|
|
||||||
uint8_t status;
|
uint8_t status;
|
||||||
uint8_t id1, id2;
|
uint8_t id1, id2;
|
||||||
|
|
||||||
|
@ -100,9 +99,10 @@ uint8_t wait_lhf00l04(volatile uint8_t *bios)
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xAA;
|
||||||
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
*(volatile uint8_t *)(bios + 0x2AAA) = 0x55;
|
||||||
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
|
*(volatile uint8_t *)(bios + 0x5555) = 0xF0;
|
||||||
return status;
|
|
||||||
|
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_lhf00l04_block(struct flashchip *flash, int offset)
|
int erase_lhf00l04_block(struct flashchip *flash, int offset)
|
||||||
{
|
{
|
||||||
volatile uint8_t *bios = flash->virtual_memory + offset;
|
volatile uint8_t *bios = flash->virtual_memory + offset;
|
||||||
|
@ -128,8 +128,10 @@ int erase_lhf00l04_block(struct flashchip *flash, int offset)
|
||||||
status = wait_lhf00l04(flash->virtual_memory);
|
status = wait_lhf00l04(flash->virtual_memory);
|
||||||
print_lhf00l04_status(status);
|
print_lhf00l04_status(status);
|
||||||
printf("DONE BLOCK 0x%x\n", offset);
|
printf("DONE BLOCK 0x%x\n", offset);
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_lhf00l04(struct flashchip *flash)
|
int erase_lhf00l04(struct flashchip *flash)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -140,7 +142,8 @@ int erase_lhf00l04(struct flashchip *flash)
|
||||||
for (i = 0; i < total_size; i += flash->page_size)
|
for (i = 0; i < total_size; i += flash->page_size)
|
||||||
erase_lhf00l04_block(flash, i);
|
erase_lhf00l04_block(flash, i);
|
||||||
printf("DONE ERASE\n");
|
printf("DONE ERASE\n");
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
|
void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
|
||||||
|
@ -154,7 +157,6 @@ void write_page_lhf00l04(volatile uint8_t *bios, uint8_t *src,
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
wait_lhf00l04(bios);
|
wait_lhf00l04(bios);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_lhf00l04(struct flashchip *flash, uint8_t *buf)
|
int write_lhf00l04(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -178,5 +180,6 @@ int write_lhf00l04(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
protect_jedec(bios);
|
protect_jedec(bios);
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ static __inline__ int erase_sector_28sf040(volatile uint8_t *bios,
|
||||||
/* wait for Toggle bit ready */
|
/* wait for Toggle bit ready */
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int write_sector_28sf040(volatile uint8_t *bios,
|
static __inline__ int write_sector_28sf040(volatile uint8_t *bios,
|
||||||
|
@ -98,7 +98,7 @@ static __inline__ int write_sector_28sf040(volatile uint8_t *bios,
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_28sf040(struct flashchip *flash)
|
int probe_28sf040(struct flashchip *flash)
|
||||||
|
@ -137,7 +137,7 @@ int erase_28sf040(struct flashchip *flash)
|
||||||
myusec_delay(10);
|
myusec_delay(10);
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_28sf040(struct flashchip *flash, uint8_t *buf)
|
int write_28sf040(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -164,5 +164,5 @@ int write_28sf040(struct flashchip *flash, uint8_t *buf)
|
||||||
|
|
||||||
protect_28sf040(bios);
|
protect_28sf040(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ static __inline__ int erase_sector_39sf020(volatile uint8_t *bios,
|
||||||
/* wait for Toggle bit ready */
|
/* wait for Toggle bit ready */
|
||||||
toggle_ready_jedec(bios);
|
toggle_ready_jedec(bios);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_39sf020(struct flashchip *flash, uint8_t *buf)
|
int write_39sf020(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -65,5 +65,5 @@ int write_39sf020(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* TODO: Consilidated to standard JEDEC code.
|
* TODO: Consilidated to standard JEDEC code.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
|
|
||||||
|
@ -39,6 +40,7 @@ int erase_49lf040(struct flashchip *flash)
|
||||||
* for the 49lf040. Use sector-erase instead */
|
* for the 49lf040. Use sector-erase instead */
|
||||||
erase_sector_jedec(bios, i * page_size);
|
erase_sector_jedec(bios, i * page_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,5 +69,5 @@ int write_49lf040(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ static __inline__ int write_lockbits_49lfxxxc(volatile uint8_t *bios, int size,
|
||||||
//printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) );
|
//printf("lockbits at address=0x%08lx is 0x%01x\n", (unsigned long)0xFFc00000 - size + address + 2, *(bios + address + 2) );
|
||||||
*(bios + address + 2) = bits;
|
*(bios + address + 2) = bits;
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
|
static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
|
||||||
|
@ -91,7 +91,7 @@ static __inline__ int erase_sector_49lfxxxc(volatile uint8_t *bios,
|
||||||
}
|
}
|
||||||
} while (!(status & STATUS_WSMS));
|
} while (!(status & STATUS_WSMS));
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
|
static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
|
||||||
|
@ -124,7 +124,7 @@ static __inline__ int write_sector_49lfxxxc(volatile uint8_t *bios,
|
||||||
} while (!(status & STATUS_WSMS));
|
} while (!(status & STATUS_WSMS));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int probe_49lfxxxc(struct flashchip *flash)
|
int probe_49lfxxxc(struct flashchip *flash)
|
||||||
|
@ -164,7 +164,8 @@ int erase_49lfxxxc(struct flashchip *flash)
|
||||||
return (-1);
|
return (-1);
|
||||||
|
|
||||||
*bios = RESET;
|
*bios = RESET;
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_49lfxxxc(struct flashchip *flash, uint8_t *buf)
|
int write_49lfxxxc(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -189,5 +190,6 @@ int write_49lfxxxc(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
*bios = RESET;
|
*bios = RESET;
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ int erase_sst_fwhub_block(struct flashchip *flash, int offset)
|
||||||
erase_block_jedec(flash->virtual_memory, offset);
|
erase_block_jedec(flash->virtual_memory, offset);
|
||||||
toggle_ready_jedec(flash->virtual_memory);
|
toggle_ready_jedec(flash->virtual_memory);
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int erase_sst_fwhub(struct flashchip *flash)
|
int erase_sst_fwhub(struct flashchip *flash)
|
||||||
|
@ -66,7 +66,8 @@ int erase_sst_fwhub(struct flashchip *flash)
|
||||||
|
|
||||||
for (i = 0; i < total_size; i += flash->page_size)
|
for (i = 0; i < total_size; i += flash->page_size)
|
||||||
erase_sst_fwhub_block(flash, i);
|
erase_sst_fwhub_block(flash, i);
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
|
int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
|
||||||
|
@ -95,5 +96,6 @@ int write_sst_fwhub(struct flashchip *flash, uint8_t *buf)
|
||||||
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return (0);
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,5 +49,5 @@ int write_49f002(struct flashchip *flash, uint8_t *buf)
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
return (0);
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue