summaryrefslogtreecommitdiffstats
path: root/ch341a_spi.c
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.de>2021-05-04 15:32:17 +0200
committerNico Huber <nico.h@gmx.de>2021-06-10 12:49:16 +0000
commit4f5169df5ff2b63a40d654ab133b8a3108b6a599 (patch)
treed345dd5f3068a2325298234e302988b0c82a62e3 /ch341a_spi.c
parent085db626fbf609704136aa3cc51c70325d0b40e2 (diff)
downloadflashrom-4f5169df5ff2b63a40d654ab133b8a3108b6a599.tar.gz
flashrom-4f5169df5ff2b63a40d654ab133b8a3108b6a599.tar.bz2
flashrom-4f5169df5ff2b63a40d654ab133b8a3108b6a599.zip
programmer_table: move each entry to the associated programmer source
Change-Id: I3d02bd789f0299e936eb86819b3b15b5ea2bb921 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/52946 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'ch341a_spi.c')
-rw-r--r--ch341a_spi.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/ch341a_spi.c b/ch341a_spi.c
index f84add4e4..185e5827d 100644
--- a/ch341a_spi.c
+++ b/ch341a_spi.c
@@ -84,7 +84,7 @@ static unsigned int stored_delay_us = 0;
static struct libusb_device_handle *handle = NULL;
-const struct dev_entry devs_ch341a_spi[] = {
+static const struct dev_entry devs_ch341a_spi[] = {
{0x1A86, 0x5512, OK, "Winchiphead (WCH)", "CH341A"},
{0},
@@ -323,7 +323,7 @@ static void pluck_cs(uint8_t *ptr)
*ptr++ = CH341A_CMD_UIO_STM_END;
}
-void ch341a_spi_delay(unsigned int usecs)
+static void ch341a_spi_delay(unsigned int usecs)
{
/* There is space for 28 bytes instructions of 750 ns each in the CS packet (32 - 4 for the actual CS
* instructions), thus max 21 us, but we avoid getting too near to this boundary and use
@@ -419,7 +419,7 @@ static int ch341a_spi_shutdown(void *data)
return 0;
}
-int ch341a_spi_init(void)
+static int ch341a_spi_init(void)
{
if (handle != NULL) {
msg_cerr("%s: handle already set! Please report a bug at flashrom@flashrom.org\n", __func__);
@@ -526,3 +526,13 @@ close_handle:
handle = NULL;
return -1;
}
+
+const struct programmer_entry programmer_ch341a_spi = {
+ .name = "ch341a_spi",
+ .type = USB,
+ .devs.dev = devs_ch341a_spi,
+ .init = ch341a_spi_init,
+ .map_flash_region = fallback_map,
+ .unmap_flash_region = fallback_unmap,
+ .delay = ch341a_spi_delay,
+};