Hello,
i received today my 2 new SST chips for the Tyan S2895 mobo with BIOS version 1.06 alreday flashed by BIOSMAN company.
For a quick summary, what is working and what not:
WORKING is chip read, and write with flashrom dumpped image
NOT WORKING is writing from original Tyan BIOS image (Error: Image size doesn't match, 2895V106.wph, ftp://ftp.tyan.com/bios/S2895_v106.zip)
So, what have a done exactly:
- used flashrom v0.9.2-r1001 on Ubuntu to dump my current original bios SSTFL49080A with official 1.06 bios version flashed with propriarity tool provided by Tyan company.
- md5sum of this dump => 4c3cc932a149e8bf496160814d0a9c74
- powered computer down
- replaced original chip with one from BIOSMAN, same SST reference, with bios 1.06 on it (biosman has flashed the chip for me with lastest available bios version 1.06, not myself)
- power on computer with biosman chip inside
- used flashrom to dump biosman version of 1.06
- md5sum of the biosman 1.06 version => 18ede76905b99e4591122c5a3032bb2b
- used flashrom to write original bios from tyan website (files 2895V105.wph or 2895V106.wph) => FAILED with incorrect size error message
- used flashrom to write dump made with flashrom from original tyan bios chip => SUCCES (see file: flashrom_Vw_SST-49FL080A_TYAN_s2895_K8WE-flashrom_burn_from_original_tyanchip106_dump.txt)
- md5sum after successfull flashing => 4c3cc932a149e8bf496160814d0a9c74
md5sum gives me insurance that dumping flash chip content from first chip and burning to another chip (after computer power down/up to replace chip) is the same, so write function is working pretty
The only thing that it is not working is to flash from tyan bios downloaded version (.wph files), as their siez are bigger.
Bios SIZE: dump with flashrom => 1048576 bytes ; original Tyan bios file 2895V106.wph => 1050070 bytes
I have not tried the erase function so far.
Computer seems to work fine so far (Ubuntu gnome), with all bioses version, before and after flashing, bios menu are ok too.
Have a nice evening.
PS: file flashrom_Vw_SST-49FL080A_TYAN_s2895_K8WE-tyan105origtry1.txt is to show you siez error while trying flashing Tyan original wph bios files (version 105, but same for 106). File names wre truncated by Windows webmail :(
AMD SB700 and later have an integrated microcontroller (IMC) which runs
from shared flash. The IMC will happily issue reads while we write,
issue writes while we read, and generally cause lots of havoc due to the
concurrent accesses it performs while flashrom is running.
A failing or corrupted read can be detected since r1145, and the worst
case is that the read aborts and the user has to retry.
A failing write is much more serious. It can be detected since r1145,
but if the SPI interface locks up, we can't continue writing nor can we
read the current chip contents.
If the IMC is inactive, there is no reason to worry. If the IMC is
active, flashrom will refuse to erase/write the chip with this patch.
The correct fix would be to stop the IMC during flashing, but apparently
the relevant registers are undocumented, so we take the safe route for
now until someone from AMD can give us more info.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-sb700_imc_refuse_write/sb600spi.c
===================================================================
--- flashrom-sb700_imc_refuse_write/sb600spi.c (Revision 1171)
+++ flashrom-sb700_imc_refuse_write/sb600spi.c (Arbeitskopie)
@@ -294,6 +294,24 @@
return 0;
}
+ reg = pci_read_byte(dev, 0x40);
+ msg_pdbg("SB700 IMC is %sactive.\n", (tmp & (1 << 7)) ? "" : "not ");
+ if (tmp & (1 << 7)) {
+ /* If we touch any region used by the IMC, the IMC and the SPI
+ * interface will lock up, and the only way to recover is a
+ * hard reset, but that is a bad choice for a half-erased or
+ * half-written flash chip.
+ * There appears to be an undocumented register which can freeze
+ * or disable the IMC, but for now we want to play it safe.
+ */
+ msg_perr("The SB700 IMC is active and may interfere with SPI "
+ "commands. Disabling write.\n");
+ /* FIXME: Should we only disable SPI writes, or will the lockup
+ * affect LPC/FWH chips as well?
+ */
+ programmer_may_write = 0;
+ }
+
/* Bring the FIFO to a clean state. */
reset_internal_fifo_pointer();
--
http://www.hailfinger.org/
Author: hailfinger
Date: Wed Sep 15 14:02:07 2010
New Revision: 1173
URL: http://flashrom.org/trac/flashrom/changeset/1173
Log:
AMD SB700 and later have an integrated microcontroller (IMC) which runs
from shared flash. The IMC will happily issue reads while we write,
issue writes while we read, and generally cause lots of havoc due to the
concurrent accesses it performs while flashrom is running.
A failing or corrupted read can be detected since r1145, and the worst
case is that the read aborts and the user has to retry.
A failing write is much more serious. It can be detected since r1145,
but if the SPI interface locks up, we can't continue writing nor can we
read the current chip contents.
If the IMC is inactive, there is no reason to worry. If the IMC is
active, flashrom will refuse to erase/write the chip with this patch.
The correct fix would be to stop the IMC during flashing, but apparently
the relevant registers are undocumented, so we take the safe route for
now until someone from AMD can give us more info.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Tested-by: Matthias Kretz <kretz(a)kde.org>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/sb600spi.c
Modified: trunk/sb600spi.c
==============================================================================
--- trunk/sb600spi.c Wed Sep 15 12:20:16 2010 (r1172)
+++ trunk/sb600spi.c Wed Sep 15 14:02:07 2010 (r1173)
@@ -294,6 +294,24 @@
return 0;
}
+ reg = pci_read_byte(dev, 0x40);
+ msg_pdbg("SB700 IMC is %sactive.\n", (reg & (1 << 7)) ? "" : "not ");
+ if (reg & (1 << 7)) {
+ /* If we touch any region used by the IMC, the IMC and the SPI
+ * interface will lock up, and the only way to recover is a
+ * hard reset, but that is a bad choice for a half-erased or
+ * half-written flash chip.
+ * There appears to be an undocumented register which can freeze
+ * or disable the IMC, but for now we want to play it safe.
+ */
+ msg_perr("The SB700 IMC is active and may interfere with SPI "
+ "commands. Disabling write.\n");
+ /* FIXME: Should we only disable SPI writes, or will the lockup
+ * affect LPC/FWH chips as well?
+ */
+ programmer_may_write = 0;
+ }
+
/* Bring the FIFO to a clean state. */
reset_internal_fifo_pointer();
Delay between probe and subsequent operations.
Some flash chips need time to exit ID mode, and while we take care of
correct timing for the matching probe, subsequent probes may have
totally different timing, and that can lead to garbage responses from
the flash chip during the first accesses after the probe sequence is done.
Delay 100 ms between the last probe and any subsequent operation.
To ensure maximum correctness, we would have to reset the chip first in
case the last probe function left the chip in an undefined (non-read)
state. That will be possible once struct flashchip has a .reset function.
This fixes unstable erase/read/write for some flahs chips on nic3com and
possible other use cases as well.
Thanks to Maciej Pijanka for reporting the issue and testing patches.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-delay_after_probes/cli_classic.c
===================================================================
--- flashrom-delay_after_probes/cli_classic.c (Revision 1171)
+++ flashrom-delay_after_probes/cli_classic.c (Arbeitskopie)
@@ -456,5 +456,10 @@
if (write_it && !dont_verify_it)
verify_it = 1;
+ /* FIXME: We should issue an unconditional chip reset here. This can be
+ * done once we have a .reset function in struct flashchip.
+ * Give the chip time to settle.
+ */
+ programmer_delay(100000);
return doit(flash, force, filename, read_it, write_it, erase_it, verify_it);
}
--
http://www.hailfinger.org/
Author: hailfinger
Date: Wed Sep 15 12:20:16 2010
New Revision: 1172
URL: http://flashrom.org/trac/flashrom/changeset/1172
Log:
Delay between probe and subsequent operations.
Some flash chips need time to exit ID mode, and while we take care of
correct timing for the matching probe, subsequent probes may have
totally different timing, and that can lead to garbage responses from
the flash chip during the first accesses after the probe sequence is
done.
Delay 100 ms between the last probe and any subsequent operation.
To ensure maximum correctness, we would have to reset the chip first in
case the last probe function left the chip in an undefined (non-read)
state. That will be possible once struct flashchip has a .reset
function.
This fixes unstable erase/read/write for some flahs chips on nic3com and
possible other use cases as well.
Thanks to Maciej Pijanka for reporting the issue and testing patches.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Michael Karcher <flashrom(a)mkarcher.dialup.fu-berlin.de>
Modified:
trunk/cli_classic.c
Modified: trunk/cli_classic.c
==============================================================================
--- trunk/cli_classic.c Wed Sep 15 02:17:37 2010 (r1171)
+++ trunk/cli_classic.c Wed Sep 15 12:20:16 2010 (r1172)
@@ -456,5 +456,10 @@
if (write_it && !dont_verify_it)
verify_it = 1;
+ /* FIXME: We should issue an unconditional chip reset here. This can be
+ * done once we have a .reset function in struct flashchip.
+ * Give the chip time to settle.
+ */
+ programmer_delay(100000);
return doit(flash, force, filename, read_it, write_it, erase_it, verify_it);
}
---------- Forwarded message ----------
From: Shahar Or <mightyiampresence(a)gmail.com>
Date: Wed, 15 Sep 2010 08:59:02 +0200
Subject: Re: flashrom test on MSI PM8M3-V 4.1
To: Uwe Hermann <uwe(a)hermann-uwe.de>
Dear ones,
It is the V H, actually. Thanks for noticing.
Blessings,
Shahar
On 9/15/10, Uwe Hermann <uwe(a)hermann-uwe.de> wrote:
> On Sat, Sep 04, 2010 at 11:39:58AM +0000, Shahar Or wrote:
>> DMI string system-product-name: "MS-7211"
> [...]
>> SUCCESS.
>> COMPLETE.
>> Verifying flash... VERIFIED.
>
> Look good, thanks, we marked the "MSI MS-7211 (PM8M3-V)" as tested.
> Just to make sure, you have the "PM8M3-V", not the "PM8M3-V H", right?
>
>
> Thanks, Uwe.
> --
> http://hermann-uwe.de | http://sigrok.org
> http://randomprojects.org | http://unmaintained-free-software.org
>
--
Sent from my mobile device
--
Sent from my mobile device
SPI bitbanging on devices which speak SPI natively has a dual-use
problem: We need to shut down normal SPI operations to do the bitbanging
ourselves. Once we're done, it makes a lot of sense to reenable "normal"
SPI operations again. Add request_bus/release_bus functions to struct
bitbang_spi_master.
Add a bitbang shutdown function (not used yet).
Change MCP SPI and Intel NIC SPI to use the new request/release bus
infrastructure.
There are multiple possible strategies for bus request/release:
- Request at the start of a SPI command, release immediately afterwards.
- Request at the start of a SPI multicommand, release once all commands
of the multicommand are done.
- Request on programmer init, release on shutdown.
Each strategy has its own advantages. For now, we will stay with the
first strategy which worked fine so far.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Index: flashrom-bitbang_spi_init_errorcheck_request_release_bus/bitbang_spi.c
===================================================================
--- flashrom-bitbang_spi_init_errorcheck_request_release_bus/bitbang_spi.c (Revision 1164)
+++ flashrom-bitbang_spi_init_errorcheck_request_release_bus/bitbang_spi.c (Arbeitskopie)
@@ -53,6 +53,18 @@
return bitbang_spi_master->get_miso();
}
+static void bitbang_spi_request_bus(void)
+{
+ if (bitbang_spi_master->request_bus)
+ bitbang_spi_master->request_bus();
+}
+
+static void bitbang_spi_release_bus(void)
+{
+ if (bitbang_spi_master->release_bus)
+ bitbang_spi_master->release_bus();
+}
+
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod)
{
/* BITBANG_SPI_INVALID is 0, so if someone forgot to initialize ->type,
@@ -61,19 +73,44 @@
*/
if (!master || master->type == BITBANG_SPI_INVALID || !master->set_cs ||
!master->set_sck || !master->set_mosi || !master->get_miso) {
- msg_perr("Incomplete bitbanging SPI master setting! Please "
- "report a bug at flashrom(a)flashrom.org\n");
+ msg_perr("Incomplete SPI bitbang master setting! "
+ "Please report a bug at flashrom(a)flashrom.org\n");
return 1;
}
+ if (bitbang_spi_master) {
+ msg_perr("SPI bitbang master already initialized! "
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+
bitbang_spi_master = master;
bitbang_spi_half_period = halfperiod;
+ /* FIXME: Run bitbang_spi_request_bus here or in programmer init? */
bitbang_spi_set_cs(1);
bitbang_spi_set_sck(0);
bitbang_spi_set_mosi(0);
return 0;
}
+int bitbang_spi_shutdown(const struct bitbang_spi_master *master)
+{
+ if (!bitbang_spi_master) {
+ msg_perr("Shutting down an uninitialized SPI bitbang master! "
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+ if (master != bitbang_spi_master) {
+ msg_perr("Shutting down a mismatched SPI bitbang master! "
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+
+ /* FIXME: Run bitbang_spi_release_bus here or per command? */
+ bitbang_spi_master = NULL;
+ return 0;
+}
+
static uint8_t bitbang_spi_readwrite_byte(uint8_t val)
{
uint8_t ret = 0;
@@ -96,6 +133,11 @@
{
int i;
+ /* FIXME: Run bitbang_spi_request_bus here or in programmer init?
+ * Requesting and releasing the SPI bus is handled in here to allow the
+ * programmer to use its own SPI engine for native accesses.
+ */
+ bitbang_spi_request_bus();
bitbang_spi_set_cs(0);
for (i = 0; i < writecnt; i++)
bitbang_spi_readwrite_byte(writearr[i]);
@@ -105,6 +147,8 @@
programmer_delay(bitbang_spi_half_period);
bitbang_spi_set_cs(1);
programmer_delay(bitbang_spi_half_period);
+ /* FIXME: Run bitbang_spi_release_bus here or in programmer init? */
+ bitbang_spi_release_bus();
return 0;
}
Index: flashrom-bitbang_spi_init_errorcheck_request_release_bus/nicintel_spi.c
===================================================================
--- flashrom-bitbang_spi_init_errorcheck_request_release_bus/nicintel_spi.c (Revision 1164)
+++ flashrom-bitbang_spi_init_errorcheck_request_release_bus/nicintel_spi.c (Arbeitskopie)
@@ -91,20 +91,10 @@
{
uint32_t tmp;
- /*
- * Requesting and releasing the SPI bus is handled in here to allow
- * the chipset to use its own SPI engine for native reads.
- */
- if (val == 0)
- nicintel_request_spibus();
-
tmp = pci_mmio_readl(nicintel_spibar + FLA);
tmp &= ~(1 << FL_CS);
tmp |= (val << FL_CS);
pci_mmio_writel(tmp, nicintel_spibar + FLA);
-
- if (val == 1)
- nicintel_release_spibus();
}
static void nicintel_bitbang_set_sck(int val)
@@ -142,6 +132,8 @@
.set_sck = nicintel_bitbang_set_sck,
.set_mosi = nicintel_bitbang_set_mosi,
.get_miso = nicintel_bitbang_get_miso,
+ .request_bus = nicintel_request_spibus,
+ .release_bus = nicintel_release_spibus,
};
int nicintel_spi_init(void)
Index: flashrom-bitbang_spi_init_errorcheck_request_release_bus/mcp6x_spi.c
===================================================================
--- flashrom-bitbang_spi_init_errorcheck_request_release_bus/mcp6x_spi.c (Revision 1164)
+++ flashrom-bitbang_spi_init_errorcheck_request_release_bus/mcp6x_spi.c (Arbeitskopie)
@@ -66,18 +66,9 @@
static void mcp6x_bitbang_set_cs(int val)
{
- /* Requesting and releasing the SPI bus is handled in here to allow the
- * chipset to use its own SPI engine for native reads.
- */
- if (val == 0)
- mcp6x_request_spibus();
-
mcp_gpiostate &= ~(1 << MCP6X_SPI_CS);
mcp_gpiostate |= (val << MCP6X_SPI_CS);
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
-
- if (val == 1)
- mcp6x_release_spibus();
}
static void mcp6x_bitbang_set_sck(int val)
@@ -106,6 +97,8 @@
.set_sck = mcp6x_bitbang_set_sck,
.set_mosi = mcp6x_bitbang_set_mosi,
.get_miso = mcp6x_bitbang_get_miso,
+ .request_bus = mcp6x_request_spibus,
+ .release_bus = mcp6x_release_spibus,
};
int mcp6x_spi_init(int want_spi)
Index: flashrom-bitbang_spi_init_errorcheck_request_release_bus/programmer.h
===================================================================
--- flashrom-bitbang_spi_init_errorcheck_request_release_bus/programmer.h (Revision 1164)
+++ flashrom-bitbang_spi_init_errorcheck_request_release_bus/programmer.h (Arbeitskopie)
@@ -131,6 +131,8 @@
void (*set_sck) (int val);
void (*set_mosi) (int val);
int (*get_miso) (void);
+ void (*request_bus) (void);
+ void (*release_bus) (void);
};
#if CONFIG_INTERNAL == 1
@@ -443,6 +445,7 @@
/* bitbang_spi.c */
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
+int bitbang_spi_shutdown(const struct bitbang_spi_master *master);
int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);
--
http://www.hailfinger.org/
Author: hailfinger
Date: Wed Sep 15 02:17:37 2010
New Revision: 1171
URL: http://flashrom.org/trac/flashrom/changeset/1171
Log:
SPI bitbanging: request/release bus.
SPI bitbanging on devices which speak SPI natively has a dual-use
problem: We need to shut down normal SPI operations to do the bitbanging
ourselves. Once we're done, it makes a lot of sense to reenable "normal"
SPI operations again. Add request_bus/release_bus functions to struct
bitbang_spi_master.
Add a bitbang shutdown function (not used yet).
Change MCP SPI and Intel NIC SPI to use the new request/release bus
infrastructure.
Cosmetic changes to a few error messages (80 column limit).
There are multiple possible strategies for bus request/release:
- Request at the start of a SPI command, release immediately afterwards.
- Request at the start of a SPI multicommand, release once all commands
of the multicommand are done.
- Request on programmer init, release on shutdown.
Each strategy has its own advantages. For now, we will stay with the
first strategy which worked fine so far.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006(a)gmx.net>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/bitbang_spi.c
trunk/mcp6x_spi.c
trunk/nicintel_spi.c
trunk/programmer.h
Modified: trunk/bitbang_spi.c
==============================================================================
--- trunk/bitbang_spi.c Wed Sep 15 02:13:02 2010 (r1170)
+++ trunk/bitbang_spi.c Wed Sep 15 02:17:37 2010 (r1171)
@@ -53,6 +53,18 @@
return bitbang_spi_master->get_miso();
}
+static void bitbang_spi_request_bus(void)
+{
+ if (bitbang_spi_master->request_bus)
+ bitbang_spi_master->request_bus();
+}
+
+static void bitbang_spi_release_bus(void)
+{
+ if (bitbang_spi_master->release_bus)
+ bitbang_spi_master->release_bus();
+}
+
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod)
{
/* BITBANG_SPI_INVALID is 0, so if someone forgot to initialize ->type,
@@ -61,19 +73,44 @@
*/
if (!master || master->type == BITBANG_SPI_INVALID || !master->set_cs ||
!master->set_sck || !master->set_mosi || !master->get_miso) {
- msg_perr("Incomplete bitbanging SPI master setting! Please "
- "report a bug at flashrom(a)flashrom.org\n");
+ msg_perr("Incomplete SPI bitbang master setting!\n"
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+ if (bitbang_spi_master) {
+ msg_perr("SPI bitbang master already initialized!\n"
+ "Please report a bug at flashrom(a)flashrom.org\n");
return 1;
}
+
bitbang_spi_master = master;
bitbang_spi_half_period = halfperiod;
+ /* FIXME: Run bitbang_spi_request_bus here or in programmer init? */
bitbang_spi_set_cs(1);
bitbang_spi_set_sck(0);
bitbang_spi_set_mosi(0);
return 0;
}
+int bitbang_spi_shutdown(const struct bitbang_spi_master *master)
+{
+ if (!bitbang_spi_master) {
+ msg_perr("Shutting down an uninitialized SPI bitbang master!\n"
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+ if (master != bitbang_spi_master) {
+ msg_perr("Shutting down a mismatched SPI bitbang master!\n"
+ "Please report a bug at flashrom(a)flashrom.org\n");
+ return 1;
+ }
+
+ /* FIXME: Run bitbang_spi_release_bus here or per command? */
+ bitbang_spi_master = NULL;
+ return 0;
+}
+
static uint8_t bitbang_spi_readwrite_byte(uint8_t val)
{
uint8_t ret = 0;
@@ -96,6 +133,11 @@
{
int i;
+ /* FIXME: Run bitbang_spi_request_bus here or in programmer init?
+ * Requesting and releasing the SPI bus is handled in here to allow the
+ * programmer to use its own SPI engine for native accesses.
+ */
+ bitbang_spi_request_bus();
bitbang_spi_set_cs(0);
for (i = 0; i < writecnt; i++)
bitbang_spi_readwrite_byte(writearr[i]);
@@ -105,6 +147,8 @@
programmer_delay(bitbang_spi_half_period);
bitbang_spi_set_cs(1);
programmer_delay(bitbang_spi_half_period);
+ /* FIXME: Run bitbang_spi_release_bus here or in programmer init? */
+ bitbang_spi_release_bus();
return 0;
}
Modified: trunk/mcp6x_spi.c
==============================================================================
--- trunk/mcp6x_spi.c Wed Sep 15 02:13:02 2010 (r1170)
+++ trunk/mcp6x_spi.c Wed Sep 15 02:17:37 2010 (r1171)
@@ -66,18 +66,9 @@
static void mcp6x_bitbang_set_cs(int val)
{
- /* Requesting and releasing the SPI bus is handled in here to allow the
- * chipset to use its own SPI engine for native reads.
- */
- if (val == 0)
- mcp6x_request_spibus();
-
mcp_gpiostate &= ~(1 << MCP6X_SPI_CS);
mcp_gpiostate |= (val << MCP6X_SPI_CS);
mmio_writeb(mcp_gpiostate, mcp6x_spibar + 0x530);
-
- if (val == 1)
- mcp6x_release_spibus();
}
static void mcp6x_bitbang_set_sck(int val)
@@ -106,6 +97,8 @@
.set_sck = mcp6x_bitbang_set_sck,
.set_mosi = mcp6x_bitbang_set_mosi,
.get_miso = mcp6x_bitbang_get_miso,
+ .request_bus = mcp6x_request_spibus,
+ .release_bus = mcp6x_release_spibus,
};
int mcp6x_spi_init(int want_spi)
Modified: trunk/nicintel_spi.c
==============================================================================
--- trunk/nicintel_spi.c Wed Sep 15 02:13:02 2010 (r1170)
+++ trunk/nicintel_spi.c Wed Sep 15 02:17:37 2010 (r1171)
@@ -91,20 +91,10 @@
{
uint32_t tmp;
- /*
- * Requesting and releasing the SPI bus is handled in here to allow
- * the chipset to use its own SPI engine for native reads.
- */
- if (val == 0)
- nicintel_request_spibus();
-
tmp = pci_mmio_readl(nicintel_spibar + FLA);
tmp &= ~(1 << FL_CS);
tmp |= (val << FL_CS);
pci_mmio_writel(tmp, nicintel_spibar + FLA);
-
- if (val == 1)
- nicintel_release_spibus();
}
static void nicintel_bitbang_set_sck(int val)
@@ -142,6 +132,8 @@
.set_sck = nicintel_bitbang_set_sck,
.set_mosi = nicintel_bitbang_set_mosi,
.get_miso = nicintel_bitbang_get_miso,
+ .request_bus = nicintel_request_spibus,
+ .release_bus = nicintel_release_spibus,
};
int nicintel_spi_init(void)
Modified: trunk/programmer.h
==============================================================================
--- trunk/programmer.h Wed Sep 15 02:13:02 2010 (r1170)
+++ trunk/programmer.h Wed Sep 15 02:17:37 2010 (r1171)
@@ -131,6 +131,8 @@
void (*set_sck) (int val);
void (*set_mosi) (int val);
int (*get_miso) (void);
+ void (*request_bus) (void);
+ void (*release_bus) (void);
};
#if CONFIG_INTERNAL == 1
@@ -443,6 +445,7 @@
/* bitbang_spi.c */
int bitbang_spi_init(const struct bitbang_spi_master *master, int halfperiod);
+int bitbang_spi_shutdown(const struct bitbang_spi_master *master);
int bitbang_spi_send_command(unsigned int writecnt, unsigned int readcnt, const unsigned char *writearr, unsigned char *readarr);
int bitbang_spi_read(struct flashchip *flash, uint8_t *buf, int start, int len);
int bitbang_spi_write_256(struct flashchip *flash, uint8_t *buf, int start, int len);