mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
raiden_debug_spi: Link spi_master struct to spi data
For this programmer, spi_master struct is dynamically allocated and needs to be freed on shutdown. Adding a pointer to spi data struct allows to link spi_master from spi data, which in turn allows to pass spi data into shutdown function. As a result, both register_spi_master and register_shutdown use the same data, and this unblocks moving raiden_debug_spi to new API (like all the other spi masters in commit a69c5196d20d136b1de120f0fa5ea1e06c3776da). See further patches in this chain. BUG=b:185191942 TEST=test in CB:57918 Change-Id: I5400802aa6961538df12fcd5339f7e2a5db145a1 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/57972 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
This commit is contained in:
parent
7b9c74f496
commit
5a73eb7d1b
@ -441,6 +441,7 @@ struct raiden_debug_spi_data {
|
|||||||
*/
|
*/
|
||||||
uint16_t max_spi_write_count;
|
uint16_t max_spi_write_count;
|
||||||
uint16_t max_spi_read_count;
|
uint16_t max_spi_read_count;
|
||||||
|
struct spi_master *spi_config;
|
||||||
};
|
};
|
||||||
/*
|
/*
|
||||||
* USB permits a maximum bulk transfer of 64B.
|
* USB permits a maximum bulk transfer of 64B.
|
||||||
@ -1377,9 +1378,8 @@ static int configure_protocol(struct spi_master *spi_config)
|
|||||||
|
|
||||||
static int raiden_debug_spi_shutdown(void * data)
|
static int raiden_debug_spi_shutdown(void * data)
|
||||||
{
|
{
|
||||||
struct spi_master *spi_config = data;
|
struct raiden_debug_spi_data *ctx_data = (struct raiden_debug_spi_data *)data;
|
||||||
struct raiden_debug_spi_data *ctx_data =
|
struct spi_master *spi_config = ctx_data->spi_config;
|
||||||
(struct raiden_debug_spi_data *)spi_config->data;
|
|
||||||
|
|
||||||
int ret = LIBUSB(libusb_control_transfer(
|
int ret = LIBUSB(libusb_control_transfer(
|
||||||
ctx_data->dev->handle,
|
ctx_data->dev->handle,
|
||||||
@ -1594,6 +1594,7 @@ loop_end:
|
|||||||
data->dev = device;
|
data->dev = device;
|
||||||
data->in_ep = in_endpoint;
|
data->in_ep = in_endpoint;
|
||||||
data->out_ep = out_endpoint;
|
data->out_ep = out_endpoint;
|
||||||
|
data->spi_config = spi_config;
|
||||||
|
|
||||||
spi_config->data = data; /* data is needed to configure protocol below */
|
spi_config->data = data; /* data is needed to configure protocol below */
|
||||||
/*
|
/*
|
||||||
@ -1613,7 +1614,7 @@ loop_end:
|
|||||||
}
|
}
|
||||||
|
|
||||||
register_spi_master(spi_config, data);
|
register_spi_master(spi_config, data);
|
||||||
register_shutdown(raiden_debug_spi_shutdown, spi_config);
|
register_shutdown(raiden_debug_spi_shutdown, data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user